PageRenderTime 54ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

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

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