PageRenderTime 24ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/ambulatory2/amb_clinic_discharge1.php

https://bitbucket.org/vincentbii/amurt
PHP | 303 lines | 253 code | 30 blank | 20 comment | 38 complexity | 6b1b34d05cb13a3e3a0bd7ba1dbb8bc5 MD5 | raw file
Possible License(s): GPL-2.0, Apache-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, MIT, BSD-3-Clause, LGPL-2.0, GPL-3.0
  1. <?php
  2. error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
  3. require('./roots.php');
  4. require($root_path.'include/inc_environment_global.php');
  5. /**
  6. * CARE 2X Integrated Hospital Information System version deployment 1.1 (mysql) 2004-01-11
  7. * GNU General Public License
  8. * Copyright 2002,2003,2004 Elpidio Latorilla
  9. * elpidio@care2x.net, elpidio@care2x.org
  10. *
  11. * See the file "copy_notice.txt" for the licence notice
  12. */
  13. $lang_tables[]='prompt.php';
  14. define('LANG_FILE','nursing.php');
  15. $local_user='ck_pflege_user';
  16. require_once($root_path.'include/inc_front_chain_lang.php');
  17. if(!$encoder) $encoder=$HTTP_SESSION_VARS['sess_user_name'];
  18. $breakfile="amb_clinic_patients.php".URL_APPEND."&edit=$edit&dept_nr=$dept_nr";
  19. $thisfile=basename(__FILE__);
  20. # Load date formatter
  21. require_once($root_path.'include/inc_date_format_functions.php');
  22. require_once($root_path.'include/care_api_classes/class_encounter.php');
  23. $enc_obj=new Encounter;
  24. if($enc_obj->loadEncounterData($pn)){
  25. if(($mode=='release')&&!(isset($lock)||$lock)){
  26. $date=(empty($x_date))?date('Y-m-d'):formatDate2STD($x_date,$date_format);
  27. $time=(empty($x_time))?date('H:i:s'):convertTimeToStandard($x_time);
  28. # Check the discharge type
  29. switch($relart){
  30. case 8: if( $released=$enc_obj->DischargeFromDept($pn,$relart,$date,$time)){
  31. # Reset current department
  32. //$enc_obj->ResetAllCurrentPlaces($pn,0);
  33. }
  34. break;
  35. default: $released=$enc_obj->Discharge($pn,$relart,$date,$time);
  36. }
  37. if($released){
  38. # If discharge note present
  39. if(!empty($info)){
  40. $data_array['notes']=$info;
  41. $data_array['encounter_nr']=$pn;
  42. $data_array['date']=$date;
  43. $data_array['time']=$time;
  44. $data_array['personell_name']=$encoder;
  45. $enc_obj->saveDischargeNotesFromArray($data_array);
  46. }
  47. # If patient died
  48. if($relart==7){
  49. include_once($root_path.'include/care_api_classes/class_person.php');
  50. $person=new Person;
  51. $death['death_date']=$date;
  52. $death['death_encounter_nr']=$pn;
  53. $death['history']="CONCAT(history,'Discharged ".date('Y-m-d H:i:s')." $encoder\n')";
  54. $death['modify_id']=$encoder;
  55. $death['modify_time']=date('YmdHis');
  56. @$person->setDeathInfo($enc_obj->PID(),$death);
  57. //echo $person->getLastQuery();
  58. }
  59. header("location:$thisfile?sid=$sid&lang=$lang&pn=$pn&bd=$bd&rm=$rm&pyear=$pyear&pmonth=$pmonth&pday=$pday&mode=$mode&released=1&lock=1&x_date=$x_date&x_time=$x_time&relart=$relart&encoder=".strtr($encoder," ","+")."&info=".strtr($info," ","+")."&station=$station&dept_nr=$dept_nr");
  60. exit;
  61. }
  62. }
  63. include_once($root_path.'include/care_api_classes/class_globalconfig.php');
  64. $GLOBAL_CONFIG=array();
  65. $glob_obj=new GlobalConfig($GLOBAL_CONFIG);
  66. $glob_obj->getConfig('patient_%');
  67. $glob_obj->getConfig('person_%');
  68. $result=&$enc_obj->encounter;
  69. /* Check whether config foto path exists, else use default path */
  70. $default_photo_path='fotos/registration';
  71. $photo_filename=$result['photo_filename'];
  72. $photo_path = (is_dir($root_path.$GLOBAL_CONFIG['person_foto_path'])) ? $GLOBAL_CONFIG['person_foto_path'] : $default_photo_path;
  73. require_once($root_path.'include/inc_photo_filename_resolve.php');
  74. /* Load the discharge types */
  75. $discharge_types=$enc_obj->getDischargeTypesData();
  76. if(!isset($dept)||empty($dept)){
  77. # Create nursing notes object
  78. include_once($root_path.'include/care_api_classes/class_department.php');
  79. $dept_obj= new Department;
  80. $dept=$dept_obj->FormalName($dept_nr);
  81. }
  82. }
  83. ?>
  84. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
  85. <?php html_rtl($lang); ?>
  86. <HEAD>
  87. <?php echo setCharSet(); ?>
  88. <?php
  89. require($root_path.'include/inc_js_gethelp.php');
  90. require($root_path.'include/inc_css_a_hilitebu.php');
  91. ?>
  92. <style type="text/css" name="s2">
  93. td.vn { font-family:verdana,arial; color:#000088; font-size:12}
  94. td.vl { font-family:verdana,arial; background-color:#ffffff;color:#0; font-size:12}
  95. </style>
  96. <script language="javascript">
  97. <!--
  98. function pruf(d)
  99. {
  100. if(!d.sure.checked){
  101. return false;
  102. }else{
  103. if(!d.encoder.value){
  104. alert("<?php echo $LDAlertNoName ?>");
  105. d.encoder.focus();
  106. return false;
  107. }
  108. if (!d.x_date.value){ alert("<?php echo $LDAlertNoDate ?>"); d.x_date.focus();return false;}
  109. if (!d.x_time.value){ alert("<?php echo $LDAlertNoTime ?>"); d.x_time.focus();return false;}
  110. // Check if death
  111. if(d.relart[3].checked==true&&d.x_date.value!=""){
  112. if(!confirm("<?php echo $LDDeathDateIs ?> "+d.x_date.value+". <?php echo "$LDIsCorrect $LDProceedSave" ?>")) return false;
  113. }
  114. return true;
  115. }
  116. }
  117. <?php require($root_path.'include/inc_checkdate_lang.php'); ?>
  118. //-->
  119. </script>
  120. <script language="javascript" src="<?php echo $root_path; ?>js/checkdate.js"></script>
  121. <script language="javascript" src="<?php echo $root_path; ?>js/setdatetime.js"></script>
  122. <script language="javascript" src="<?php echo $root_path; ?>js/dtpick_care2x.js"></script>
  123. </HEAD>
  124. <BODY bgcolor=<?php echo $cfg['body_bgcolor']; ?> onLoad="if (window.focus) window.focus()" topmargin=0 leftmargin=0 marginwidth=0 marginheight=0
  125. <?php if (!$cfg['dhtml']){ echo 'link='.$cfg['idx_txtcolor'].' alink='.$cfg['body_alink'].' vlink='.$cfg['idx_txtcolor']; } ?>>
  126. <table width=100% border=0 cellpadding="5" cellspacing=0>
  127. <tr>
  128. <td bgcolor="<?php echo $cfg['top_bgcolor']; ?>" >
  129. <FONT COLOR="<?php echo $cfg['top_txtcolor']; ?>" SIZE=+2 FACE="Arial"><STRONG><?php echo $LDReleasePatient ?> </STRONG></FONT>
  130. </td>
  131. <td bgcolor="<?php echo $cfg['top_bgcolor']; ?>" align=right ><nobr>
  132. <!-- <a href="javascript:window.history.back()"><img <?php echo createLDImgSrc($root_path,'back2.gif','0') ?> <?php if($cfg['dhtml'])echo'style=filter:alpha(opacity=70) onMouseover=hilite(this,1) onMouseOut=hilite(this,0)>';?></a> --><a href="javascript:gethelp('outpatient_discharge.php','discharge','','<?php echo $station ?>','<?php echo $LDReleasePatient ?>')"><img <?php echo createLDImgSrc($root_path,'hilfe-r.gif','0') ?> <?php if($cfg['dhtml'])echo'style=filter:alpha(opacity=70) onMouseover=hilite(this,1) onMouseOut=hilite(this,0)>';?></a><a href="<?php echo $breakfile ?>" ><img <?php echo createLDImgSrc($root_path,'close2.gif','0') ?> <?php if($cfg['dhtml'])echo'style=filter:alpha(opacity=70) onMouseover=hilite(this,1) onMouseOut=hilite(this,0)>';?></a></nobr></td>
  133. </tr>
  134. <tr>
  135. <td bgcolor="<?php echo $cfg['body_bgcolor']; ?>" colspan=2>
  136. <ul>
  137. <?php if(($mode=='release')&&($released)) { ?>
  138. <font face="verdana,arial" size="3" ><b><?php echo $LDJustReleased ?></b></font>
  139. <?php } ?>
  140. <form action="<?php echo $thisfile ?>" name="discform" method="post" onSubmit="return pruf(this)">
  141. <table border=0 bgcolor="#efefef">
  142. <tr>
  143. <td colspan=2>
  144. <table border=0 cellpadding=0 cellspacing=0 width=100%>
  145. <tr>
  146. <td>
  147. <?php
  148. echo '<img src="'.$root_path.'main/imgcreator/barcode_label_single_large.php?sid=$sid&lang=$lang&fen='.$pn.'&en='.$pn.'" width=282 height=178 >';
  149. ?><br>
  150. </td>
  151. <td valign=top align=center><img <?php echo $img_source; ?> align="top"></td>
  152. </tr>
  153. </table>
  154. </td>
  155. </tr>
  156. <tr>
  157. <tr>
  158. <td class=vn><?php echo "$LDClinic/$LDDept" ?>:</td>
  159. <td class=vl>&nbsp;<?php echo $dept;//$rm.$bd ?></td>
  160. </tr>
  161. <td class=vn><?php echo $LDDate ?>:</td>
  162. <td class=vl>&nbsp;
  163. <?php
  164. if($released){
  165. echo nl2br($x_date);
  166. }else{
  167. echo '<input type="text" name="x_date" size=12 maxlength=10 value="'.formatdate2Local(date('Y-m-d'),$date_format).'" onBlur="IsValidDate(this,\''.$date_format.'\')" onKeyUp="setDate(this,\''.$date_format.'\',\''. $lang.'\')">';
  168. ?>
  169. <a href="javascript:show_calendar('discform.x_date','<?php echo $date_format ?>')">
  170. <img <?php echo createComIcon($root_path,'show-calendar.gif','0','top'); ?>></a>
  171. <?php
  172. }
  173. ?>
  174. </td>
  175. </tr>
  176. <tr>
  177. <td class=vn><?php echo $LDClockTime ?>:</td>
  178. <td class=vl>&nbsp;
  179. <?php if($released) echo nl2br($x_time);
  180. else echo '<input type="text" name="x_time" size=12 maxlength=12 value="'.convertTimeToLocal(date('H:i:s')).'" onKeyUp=setTime(this,\''.$lang.'\')>';
  181. ?>
  182. </td>
  183. </tr>
  184. <tr>
  185. <td class=vn><?php echo $LDReleaseType ?>:</td>
  186. <td class=vl><?php if($released)
  187. {
  188. while($dis_type=$discharge_types->FetchRow()){
  189. if($dis_type['nr']==$relart){
  190. echo '&nbsp;';
  191. if(isset($$dis_type['LD_var'])&&!empty($$dis_type['LD_var'])) echo $$dis_type['LD_var'];
  192. else echo $dis_type['name'];
  193. break;
  194. }
  195. }
  196. }else{
  197. $init=1;
  198. $disType = $enc_obj->getDischargeTypesData();
  199. while($dis_type=$disType->FetchRow()){
  200. if(stristr('4,5,6',$dis_type['nr'])) continue;
  201. echo '&nbsp;<input type="radio" name="relart" value="'.$dis_type['nr'].'"';
  202. if($init){
  203. echo ' checked';
  204. $init=0;
  205. }
  206. echo '>';
  207. if(isset($$dis_type['LD_var'])&&!empty($$dis_type['LD_var'])) echo $$dis_type['LD_var'];
  208. else echo $dis_type['name'];
  209. echo '<br>
  210. ';
  211. }
  212. }
  213. ?>
  214. </td>
  215. </tr>
  216. <tr>
  217. <td class=vn><?php echo $LDNotes ?>:</td>
  218. <td class=vl>&nbsp;
  219. <?php if($released) echo nl2br($info); else echo '<textarea name="info" cols=40 rows=3></textarea>';
  220. ?></td>
  221. </tr>
  222. <tr>
  223. <td class=vn><?php echo $LDNurse ?>:</td>
  224. <td class=vl>&nbsp;
  225. <?php if($released) echo $encoder; else echo '<input type="text" name="encoder" size=25 maxlength=30 value="'.$encoder.'">';
  226. ?>
  227. </td>
  228. </tr>
  229. <?php if(!(($mode=='release')&&($released))) { ?>
  230. <tr>
  231. <td class=vn><input type="submit" value="<?php echo $LDRelease ?>"></td>
  232. <td class=vn> <input type="checkbox" name="sure" value="1"> <?php echo $LDYesSure ?><br>
  233. </td>
  234. </tr>
  235. <?php } ?>
  236. </table>
  237. <input type="hidden" name="mode" value="release">
  238. <?php if(($released)||($lock)) : ?>
  239. <input type="hidden" name="lock" value="1">
  240. <?php endif ?>
  241. <input type="hidden" name="sid" value="<?php echo $sid ?>">
  242. <input type="hidden" name="lang" value="<?php echo $lang ?>">
  243. <input type="hidden" name="station" value="<?php echo $station ?>">
  244. <input type="hidden" name="ward_nr" value="<?php echo $ward_nr ?>">
  245. <input type="hidden" name="dept" value="<?php echo $dept ?>">
  246. <input type="hidden" name="dept_nr" value="<?php echo $dept_nr ?>">
  247. <input type="hidden" name="pday" value="<?php echo $pday ?>">
  248. <input type="hidden" name="pmonth" value="<?php echo $pmonth ?>">
  249. <input type="hidden" name="pyear" value="<?php echo $pyear ?>">
  250. <input type="hidden" name="rm" value="<?php echo $rm ?>">
  251. <input type="hidden" name="bd" value="<?php echo $bd ?>">
  252. <input type="hidden" name="pn" value="<?php echo $pn ?>">
  253. <input type="hidden" name="s_date" value="<?php echo "$pyear-$pmonth-$pday" ?>">
  254. </form>
  255. <p>
  256. <br><a href="<?php echo $breakfile; ?>">
  257. <?php if(($mode=='release')&&($released)) : ?>
  258. <img <?php echo createLDImgSrc($root_path,'close2.gif','0') ?>>
  259. <?php else : ?>
  260. <img <?php echo createLDImgSrc($root_path,'cancel.gif','0') ?> border="0">
  261. <?php endif ?></a>
  262. </FONT>
  263. </ul>
  264. <p>
  265. </td>
  266. </tr>
  267. </table>
  268. <p>
  269. <?php
  270. require($root_path.'include/inc_load_copyrite.php');
  271. ?>
  272. </BODY>
  273. </HTML>