PageRenderTime 33ms CodeModel.GetById 11ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/nursing/nursing-ward-patientdata-report.php

https://github.com/timschofield/2.8
PHP | 428 lines | 321 code | 55 blank | 52 comment | 44 complexity | acdc29d9eef3b6e0cbe8c9afb0f040a4 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, GPL-2.0
  1. <?php
  2. error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
  3. require('./roots.php');
  4. require('../../include/helpers/inc_environment_global.php');
  5. /**
  6. * CARE2X Integrated Hospital Information System version deployment 1.1 (mysql) 2004-01-11
  7. * GNU General Public License
  8. * Copyright 2002,2003,2004,2005 Elpidio Latorilla
  9. * , elpidio@care2x.org
  10. *
  11. * See the file "copy_notice.txt" for the licence notice
  12. */
  13. define('MODULE','nursing');
  14. define('LANG_FILE_MODULAR','nursing.php');
  15. $local_user='ck_pflege_user';
  16. require_once($root_path.'include/helpers/inc_front_chain_lang.php');
  17. if($edit&&!$_COOKIE[$local_user.$sid]) {header('Location:'.$root_path.'language/'.$lang.'/lang_'.$lang.'_invalid-access-warning.php'); exit;};
  18. $thisfile=basename(__FILE__);
  19. $breakfile="nursing-ward-patientdata.php?sid=$sid&lang=$lang&station=$station&pn=$pn&edit=$edit";
  20. /* Create encounter object */
  21. require_once($root_path.'include/core/class_encounter.php');
  22. $enc_obj= new Encounter;
  23. /* Create nursing notes object */
  24. require_once($root_path.'modules/nursing/model/class_notes_nursing.php');
  25. $report_obj= new NursingNotes;
  26. /* Load global configs */
  27. require_once($root_path.'include/core/class_globalconfig.php');
  28. $GLOBAL_CONFIG=array();
  29. $glob_obj=new GlobalConfig($GLOBAL_CONFIG);
  30. $glob_obj->getConfig('patient_%');
  31. /* Establish db connection */
  32. if(!isset($db)||!$db) include($root_path.'include/helpers/inc_db_makelink.php');
  33. if($dblink_ok)
  34. {
  35. /* Load date formatter */
  36. include_once($root_path.'include/helpers/inc_date_format_functions.php');
  37. if($mode=='save'){
  38. if(($dateput&&$timeput&&$berichtput&&$author)||($dateput2&&$berichtput2&&$author2)){
  39. // Load the editor functions
  40. include_once($root_path.'modules/news/includes/inc_editor_fx.php');
  41. // Load the visual signalling functions
  42. include_once($root_path.'include/helpers/inc_visual_signalling_fx.php');
  43. // Prepare the date
  44. if($dateput&&$timeput&&$berichtput&&$author){
  45. if($dateput) $_POST['dateput']=formatDate2STD($dateput,$date_format);
  46. $_POST['timeput']=$_POST['timeput'].':00'; // adjust time to 00:00:00 format
  47. $_POST['berichtput']=deactivateHotHtml($berichtput);
  48. if($report_obj->saveNursingReport($_POST)){
  49. // Get the last insert id
  50. $_POST['ref_notes_nr']=$db->Insert_ID();
  51. // Set the visual signal
  52. setEventSignalColor($pn, SIGNAL_COLOR_NURSE_REPORT, SIGNAL_COLOR_LEVEL_FULL);
  53. $saved=true;
  54. }else{
  55. $saved=false;
  56. echo "<p>$report_obj->sql$LDDbNoSave";
  57. }
  58. }
  59. if($dateput2&&$berichtput2&&$author2){
  60. if(!$_POST['ref_notes_nr']) $_POST['timeput']=date('H:i:s');
  61. if($dateput2) $_POST['dateput2']=formatDate2STD($dateput2,$date_format);
  62. $_POST['berichtput2']=deactivateHotHtml($berichtput2);
  63. if($report_obj->saveEffectivityReport($_POST)){
  64. // Set the visual signal
  65. setEventSignalColor($pn, SIGNAL_COLOR_NURSE_REPORT, SIGNAL_COLOR_LEVEL_FULL);
  66. $saved=true;
  67. }else{
  68. $saved=false;
  69. echo "<p>$report_obj->sql$LDDbNoSave";
  70. }
  71. }
  72. if($saved){
  73. header("location:$thisfile?sid=$sid&lang=$lang&saved=1&pn=$pn&station=$station&edit=$edit");
  74. }
  75. }else{
  76. $saved=false;
  77. }
  78. }else{
  79. // end of if(mode==save)
  80. $enc_obj->where=" encounter_nr=$pn";
  81. if( $enc_obj->loadEncounterData($pn)) {
  82. switch ($enc_obj->EncounterClass())
  83. {
  84. case '1': $full_en = ($pn + $GLOBAL_CONFIG['patient_inpatient_nr_adder']);
  85. break;
  86. case '2': $full_en = ($pn + $GLOBAL_CONFIG['patient_outpatient_nr_adder']);
  87. break;
  88. default: $full_en = ($pn + $GLOBAL_CONFIG['patient_inpatient_nr_adder']);
  89. }
  90. if( $enc_obj->is_loaded){
  91. $result=&$enc_obj->encounter;
  92. $rows=$enc_obj->record_count;
  93. }
  94. }else{
  95. echo "$sql<br>$LDDbNoRead";
  96. $mode='?';
  97. }
  98. // Load the nursing and effectivity reports in one instance
  99. $neff_report=&$report_obj->getNursingAndEffectivityReport($pn);
  100. // Load the date range
  101. $neff_date_range=&$report_obj->getNursingReportDateRange($pn);
  102. }
  103. }else{
  104. echo "$LDDbNoLink<br>$sql<br>";
  105. }
  106. # Start Smarty templating here
  107. /**
  108. * LOAD Smarty
  109. */
  110. # Note: it is advisable to load this after the inc_front_chain_lang.php so
  111. # that the smarty script can use the user configured template theme
  112. require_once(CARE_BASE.'/include/helpers/smarty_care.class.php');
  113. $smarty = new smarty_care('nursing');
  114. # Title in toolbar
  115. $smarty->assign('sToolbarTitle',"$LDNursingReport $station");
  116. $smarty->assign('LDBack', $LDBack);
  117. $smarty->assign('LDHelp', $LDHelp);
  118. $smarty->assign('LDClose', $LDClose);
  119. # hide return button
  120. $smarty->assign('pbBack',FALSE);
  121. # href for help button
  122. $smarty->assign('pbHelp',CARE_GUI . "modules/" . MODULE . "/help/" . $lang . "/nursing_report.html");
  123. # href for close button
  124. $smarty->assign('breakfile',$breakfile);
  125. # Window bar title
  126. $smarty->assign('sWindowTitle',"$LDNursingReport $station");
  127. # Body Onload JS
  128. $sOnLoadJs ='onLoad="if (window.focus) window.focus();';
  129. if((($mode=='save')||($saved))&&$edit) $sOnLoadJs =$sOnLoadJs.";window.location.href='#bottom';document.berichtform.berichtput.focus()";
  130. $smarty->assign('sOnLoadJs',$sOnLoadJs.'"');
  131. # Collect javascript code
  132. ob_start();
  133. ?>
  134. <style type="text/css">
  135. div.fva2_ml10 {font-size: 12; margin-left: 10;}
  136. div.fa2_ml10 {font-size: 12; margin-left: 10;}
  137. div.fva2_ml3 {font-size: 12; margin-left: 3; }
  138. div.fa2_ml3 {font-size: 12; margin-left: 3; }
  139. </style>
  140. <script language="javascript">
  141. <!--
  142. var urlholder;
  143. var focusflag=0;
  144. var formsaved=0;
  145. function pruf(d){
  146. if(((d.dateput.value)&&(d.timeput.value)&&(d.berichtput.value)&&(d.author.value))||((d.dateput2.value)&&(d.berichtput2.value)&&(d.author2.value))) return true;
  147. else
  148. {
  149. alert("<?php echo $LDAlertIncomplete ?>");
  150. return false;
  151. }
  152. }
  153. function submitform(){
  154. document.forms[0].submit();
  155. }
  156. function closewindow(){
  157. opener.window.focus();
  158. window.close();
  159. }
  160. function resetinput(){
  161. document.berichtform.reset();
  162. }
  163. function select_this(formtag){
  164. document.berichtform.elements[formtag].select();
  165. }
  166. function getinfo(patientID){
  167. urlholder="nursing-ward.php?sid=<?php echo "$sid&lang=$lang" ?>&route=validroute&patient=" + patientID + "&user=<?php echo $_COOKIE[$local_user.$sid].'"' ?>;
  168. patientwin=window.open(urlholder,patientID,"width=600,height=400,menubar=no,resizable=yes,scrollbars=yes");
  169. }
  170. function sethilite(d){
  171. d.focus();
  172. d.value=d.value+"~";
  173. d.focus();
  174. }
  175. function endhilite(d){
  176. d.focus();
  177. d.value=d.value+"~~";
  178. d.focus();
  179. }
  180. <?php require($root_path.'include/helpers/inc_checkdate_lang.php'); ?>
  181. -->
  182. </script>
  183. <?php
  184. $sTemp = ob_get_contents();
  185. ob_end_clean();
  186. $smarty->append('JavaScript',$sTemp);
  187. # Buffer page output
  188. ob_start();
  189. ?>
  190. <ul>
  191. <form name="berichtform" method="post" action="<?php echo $thisfile ?>" onSubmit="return pruf(this)">
  192. <table cellpadding="0" cellspacing=1 border="0" width="650">
  193. <tr valign="top">
  194. <td colspan=4 bgcolor="#99ccff" width="50%">
  195. <?php
  196. /*echo '<div class=fva2_ml10>
  197. <span style="background:yellow"><b>'.$result[patnum].'</b></span><br>
  198. <b>'.$result[name].', '.$result[vorname].'</b> <br>
  199. <font color=maroon>'.formatDate2Local($result[gebdatum],$date_format).'</font><font size=1> <p>
  200. '.nl2br($result[address]).'<p>
  201. '.$station.'&nbsp;'.$result[kasse].' '.$result[kassename].'</div>';*/
  202. echo '<img src="'.$root_path.'include/imgcreator/barcode_label_single_large.php?sid='.$sid.'&lang='.$lang.'&fen='.$full_en.'&en='.$pn.'" width=282 height=178>';
  203. ?>
  204. </td>
  205. <td colspan=3 bgcolor="#99ccff"><div class=fva2_ml10>
  206. <?php
  207. echo '<font size="6">'.$LDNursingReport.' <p><font size=2>'.$LDPage.' 1/1
  208. <br><font size=1>'.$LDFrom.'</font> ';
  209. if($neff_date_range['fe_date']) echo formatDate2Local($neff_date_range['fe_date'],$date_format);
  210. echo ' <font size=1>'.$LDTo.'</font> ';
  211. if($neff_date_range['le_date']) echo formatDate2Local($neff_date_range['le_date'],$date_format).' ';
  212. ?>
  213. </div></td></tr>
  214. <?php
  215. echo ' <tr bgcolor="#99ccff">
  216. <td colspan=4><div class=fva2_ml10><font color="#000099"><b>'.$LDNursingReport.'</b></div></td>
  217. <td colspan=3><div class=fva2_ml10><font color="#000099"><b>'.$LDEffectReport.'</b></div></td>
  218. </tr>';
  219. echo ' <tr bgcolor="#99ccff">
  220. <td><div class=fva2_ml3><b>'.$LDDate.'</b></div></td><td><div class=fva2_ml3><b>'.$LDClockTime.'</b></div></td><td><div class=fva2_ml3>&nbsp;</div></td><td><div class=fva2_ml3><b>'.$LDSignature.'</b></div></td>
  221. <td><div class=fva2_ml3><b>'.$LDDate.'</b></div></td><td><div class=fva2_ml3>&nbsp;</div></td><td><div class=fva2_ml3><b>'.$LDSignature.'</b></div></td>
  222. </tr>';
  223. if(is_object($neff_report)) $cnt=$neff_report->RecordCount();
  224. else $cnt=15;
  225. $buf=array();
  226. if($cnt){
  227. if($cnt<15) $cnt=15;
  228. for ($i=0;$i<$cnt;$i++){
  229. if(is_object($neff_report)) $buf=$neff_report->FetchRow();
  230. if($buf['type_nr']==17){
  231. if($buf['ref_notes_nr']) continue;
  232. $buf['eff_date']=$buf['date'];
  233. $buf['date']='';
  234. $buf['eff_time']=$buf['time'];
  235. $buf['time']='';
  236. $buf['eff_notes']=$buf['notes'];
  237. $buf['notes']='';
  238. $buf['eff_staff_name']=$buf['staff_name'];
  239. $buf['staff_name']='';
  240. $buf['eff_aux_notes']=$buf['aux_notes'];
  241. $buf['aux_notes']='';
  242. }
  243. echo '
  244. <tr bgcolor="#99ccff">';
  245. // Column for the nursing report
  246. echo '
  247. <td><div class=fa2_ml3>';
  248. if($buf['date']) echo formatDate2Local($buf['date'],$date_format);
  249. echo '&nbsp;</div>
  250. </td>
  251. <td><div class=fa2_ml3>'.$buf['time'].'</div>
  252. </td>
  253. <td><div class=fva2_ml3><i>';
  254. if(stristr($buf['aux_notes'],'warn')) echo '<img '.createComIcon($root_path,'warn.gif','0','absmiddle',TRUE).'> ';
  255. $strbuf=str_replace('~~','</span>',stripcslashes(nl2br($buf['notes'])));
  256. echo str_replace('~','<span style="background:yellow">',$strbuf).'</i></div>
  257. </td>
  258. <td>
  259. <div class=fa2_ml3>'.$buf['staff_name'].'</div>
  260. </td>';
  261. // Column for the effectivity report
  262. echo '
  263. <td><div class=fa2_ml3>';
  264. if($buf['eff_date']) echo formatDate2Local($buf['eff_date'],$date_format);
  265. echo '&nbsp;</div>
  266. </td>
  267. <td><div class=fva2_ml3><i>';
  268. if(stristr($buf['eff_aux_notes'],'warn')) echo '<img '.createComIcon($root_path,'warn.gif','0','absmiddle',TRUE).'> ';
  269. $strbuf=str_replace('~~','</span>',stripcslashes(nl2br($buf['eff_notes'])));
  270. echo str_replace('~','<span style="background:yellow">',$strbuf).'</i></div>
  271. </td>
  272. <td>
  273. <div class=fa2_ml3>'.$buf['eff_staff_name'].'</div>
  274. </td>';
  275. echo'</tr>';
  276. }
  277. }
  278. if($edit) {
  279. ?>
  280. <tr>
  281. <td colspan=7 bgcolor="#ffffff">&nbsp;
  282. </td>
  283. </tr>
  284. <tr bgcolor="#99ccff">
  285. <td valign="top"><?php echo $LDDate ?>:<br>
  286. <?php
  287. //gjergji : new calendar
  288. require_once ('../../js/jscalendar/calendar.php');
  289. $calendar = new DHTML_Calendar('../../js/jscalendar/', $lang, 'calendar-system', true);
  290. $calendar->load_files();
  291. //end : gjergji
  292. echo $calendar->show_calendar($calendar,$date_format,'dateput');
  293. //end gjergji
  294. ?>
  295. </font>
  296. <!-- <a href="javascript:document.berichtform.dateput.value='h';setDate(document.berichtform.dateput);"><img <?php echo createComIcon($root_path,'arrow-t.gif','0') ?> alt="<?php echo $LDInsertDate ?>"></a>
  297. -->
  298. </td>
  299. <td valign="top"><?php echo $LDClockTime ?>:<br>
  300. <input type=text size=4 maxlength=5 name="timeput" value="<?php echo date('H:i'); ?>" onKeyUp=setTime(this,'<?php echo $lang ?>') onFocus=this.select()><br>
  301. <!-- <a href="javascript:document.berichtform.timeput.value='j';setTime(document.berichtform.timeput);"><img <?php echo createComIcon($root_path,'arrow-t.gif','0') ?> alt="<?php echo $LDInsertTimeNow ?>"></a>
  302. --> </td>
  303. <td><?php echo $LDNursingReport ?>:<br>&nbsp;<textarea rows="4" cols="25" name="berichtput"><?php if(!$saved) echo $berichtput; ?></textarea><br>
  304. <input type="checkbox" name="warn" <?php if((!$saved)&&($warn)) echo "checked"; ?> value="warn"> <img <?php echo createComIcon($root_path,'warn.gif','0','top',TRUE) ?>>
  305. <font size=1 face=arial><?php echo $LDInsertSymbol ?><br><font size=2 face=arial><b>
  306. &nbsp;<a href="javascript:sethilite(document.berichtform.berichtput)"><img <?php echo createComIcon($root_path,'color_marker_yellow.gif','0','',TRUE) ?>> <?php echo $LDStart ?></a>
  307. <a href="javascript:endhilite(document.berichtform.berichtput)"><img <?php echo createComIcon($root_path,'color_marker_yellow.gif','0','',TRUE) ?>> <?php echo $LDEnd ?></a>
  308. </b>
  309. </td>
  310. <td valign="top"><?php echo $LDSignature ?>:<br><input type=text size="3" name="author" onFocus=this.select() value="<?php if(!$saved) echo $author; ?>">
  311. </td>
  312. <!-- <td valign="top"><?php echo $LDDate ?>:<br><input type=text size="8" name="dateput2" value="<?php if(!$saved) echo $dateput2; ?>" onKeyUp="setDate(this)" onFocus="this.select()"><br>
  313. <a href="javascript:document.berichtform.dateput2.value='h';setDate(document.berichtform.dateput2);"><img <?php echo createComIcon($root_path,'arrow-t.gif','0') ?> alt="<?php echo $LDInsertDate ?>"></a>
  314. </td>
  315. -->
  316. <td valign="top"><?php echo $LDDate ?>:<br>
  317. <?php
  318. echo $calendar->show_calendar($calendar,$date_format,'dateput2');
  319. //end gjergji
  320. ?>
  321. </font>
  322. <!-- <a href="javascript:document.berichtform.dateput2.value='h';setDate(document.berichtform.dateput2);"><img <?php echo createComIcon($root_path,'arrow-t.gif','0') ?> alt="<?php echo $LDInsertDate ?>"></a>
  323. -->
  324. </td>
  325. <td><?php echo $LDEffectReport ?>:<br>&nbsp;<textarea rows="4" cols="25" name="berichtput2"><?php if(!$saved) echo $berichtput2; ?></textarea><br>
  326. <input type="checkbox" name="warn2" <?php if((!$saved)&&($warn2)) echo "checked"; ?> value="warn"> <img <?php echo createComIcon($root_path,'warn.gif','0','top',TRUE) ?>>
  327. <font size=1><?php echo $LDInsertSymbol ?><br><font size=2><b>
  328. &nbsp;<a href="javascript:sethilite(document.berichtform.berichtput2)"><img <?php echo createComIcon($root_path,'color_marker_yellow.gif','0','',TRUE) ?>> <?php echo $LDStart ?></a>
  329. <a href="javascript:endhilite(document.berichtform.berichtput2)"><img <?php echo createComIcon($root_path,'color_marker_yellow.gif','0','',TRUE) ?>> <?php echo $LDEnd ?></a>
  330. </b>
  331. </td>
  332. <td valign="top"><?php echo $LDSignature ?>:<br><input type=text size="3" name="author2" onFocus=this.select() value="<?php if(!$saved) echo $author2; ?>">
  333. </td>
  334. </tr>
  335. <?php
  336. }
  337. ?>
  338. </table>
  339. <p>
  340. <table width="650" cellpadding="0" cellspacing="0">
  341. <tr>
  342. <?php if($edit) : ?>
  343. <td>
  344. <input type="image" <?php echo createLDImgSrc($root_path,'savedisc.gif','0') ?> width=99 height=24 alt="<?php echo $LDSave ?>">
  345. </td>
  346. <?php endif ?>
  347. <td>
  348. <!-- <?php if($edit) : ?>
  349. <a href="javascript:resetinput()"><img <?php echo createLDImgSrc($root_path,'reset.gif','0') ?> width=156 height=24 alt="<?php echo $LDReset ?>"></a>
  350. &nbsp;&nbsp;
  351. <?php endif ?> -->
  352. <!-- Uncomment the following line if you want to show the cancel button at the bottom of the page -->
  353. </td>
  354. </tr>
  355. </table>
  356. <input type="hidden" name="sid" value="<?php echo $sid ?>">
  357. <input type="hidden" name="lang" value="<?php echo $lang ?>">
  358. <input type="hidden" name="station" value="<?php echo $station ?>">
  359. <input type="hidden" name="pn" value="<?php echo $pn ?>">
  360. <input type="hidden" name="edit" value="<?php echo $edit ?>">
  361. <input type="hidden" name="mode" value="save">
  362. </form>
  363. </ul>
  364. <?php
  365. $sTemp = ob_get_contents();
  366. ob_end_clean();
  367. # Assign page output to the mainframe template
  368. $smarty->assign('sMainFrameBlockData',$sTemp);
  369. /**
  370. * show Template
  371. */
  372. $smarty->display(CARE_BASE . 'main/view/mainframe.tpl');
  373. ?>