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

/modules/laboratory/labor_data_patient_such.php

https://bitbucket.org/vincentbii/amurt
PHP | 351 lines | 247 code | 62 blank | 42 comment | 26 complexity | 6757b7c3fc662d22fb0d5cd24de0bf4e 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. * CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
  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. # Default value for the maximum nr of rows per block displayed, define this to the value you wish
  14. # In normal cases this value is derived from the db table "care_config_global" using the "pagin_insurance_list_max_block_rows" element.
  15. define('MAX_BLOCK_ROWS',30);
  16. $lang_tables[]='search.php';
  17. define('LANG_FILE','lab.php');
  18. $local_user='ck_lab_user';
  19. require_once($root_path.'include/inc_front_chain_lang.php');
  20. $thisfile=basename($_SERVER['PHP_SELF']);
  21. $breakfile='labor.php'.URL_APPEND;
  22. # Workaround
  23. if(!isset($mode)){
  24. $mode='';
  25. }elseif($mode=='edit'){
  26. $editmode=TRUE;
  27. }
  28. //$db->debug=1;
  29. $keyword=trim($keyword);
  30. $toggle=0;
  31. # Initialize pages control variables
  32. if($mode=='paginate'){
  33. $keyword=$_SESSION['sess_searchkey'];
  34. }else{
  35. # Reset paginator variables
  36. $pgx=0;
  37. $totalcount=0;
  38. $odir='DESC';
  39. $oitem='send_date';
  40. # Workaround: Resolve the search key variables
  41. if(empty($keyword)&&!empty($searchkey)) $keyword=$searchkey;
  42. if(is_numeric($keyword)){
  43. $keyword=(int) $keyword;
  44. }else{
  45. # Convert other wildcards
  46. $keyword=strtr($keyword,'*&','%_');
  47. }
  48. }
  49. if($search&&!empty($keyword)){
  50. # Load the date formatter
  51. include_once($root_path.'include/inc_date_format_functions.php');
  52. include_once($root_path.'include/care_api_classes/class_lab.php');
  53. $lab_obj=new Lab();
  54. #Load and create paginator object
  55. include_once($root_path.'include/care_api_classes/class_paginator.php');
  56. $pagen=& new Paginator($pgx,$thisfile,$_SESSION['sess_searchkey'],$root_path);
  57. $GLOBAL_CONFIG=array();
  58. include_once($root_path.'include/care_api_classes/class_globalconfig.php');
  59. $glob_obj=new GlobalConfig($GLOBAL_CONFIG);
  60. # Get the max nr of rows from global config
  61. $glob_obj->getConfig('pagin_patient_search_max_block_rows');
  62. if(empty($GLOBAL_CONFIG['pagin_patient_search_max_block_rows'])) $pagen->setMaxCount(MAX_BLOCK_ROWS); # Last resort, use the default defined at the start of this page
  63. else $pagen->setMaxCount($GLOBAL_CONFIG['pagin_patient_search_max_block_rows']);
  64. $encounter=&$lab_obj->searchPatientWithPendingLabResults($keyword,$pagen->MaxCount(),$pgx,$oitem,$odir);
  65. //echo $lab_obj->getLastQuery()."<p>";
  66. # Get the resulting record count
  67. if($linecount=$lab_obj->LastRecordCount()){
  68. if($mode!='paginate') $_SESSION['sess_searchkey']=$keyword;
  69. $pagen->setTotalBlockCount($linecount);
  70. # Count total available data
  71. if(isset($totalcount)&&$totalcount){
  72. $pagen->setTotalDataCount($totalcount);
  73. }else{
  74. if($editmode){
  75. @$lab_obj->searchEncounterLaboratoryInfo($keyword);
  76. }else{
  77. @$lab_obj->searchEncounterLabResults($keyword);
  78. }
  79. $totalcount=$lab_obj->LastRecordCount();
  80. $pagen->setTotalDataCount($totalcount);
  81. }
  82. $pagen->setSortItem($oitem);
  83. $pagen->setSortDirection($odir);
  84. }
  85. }
  86. ?>
  87. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
  88. <?php html_rtl($lang); ?>
  89. <HEAD>
  90. <?php echo setCharSet(); ?>
  91. <?php
  92. require($root_path.'include/inc_js_gethelp.php');
  93. require($root_path.'include/inc_css_a_hilitebu.php');
  94. ?>
  95. <script language="JavaScript">
  96. <!-- Script Begin
  97. function checkForm(v) {
  98. if((v.value=="")||(v.value==" ")){
  99. v.value="";
  100. v.focus();
  101. return false;
  102. }else{
  103. return true;
  104. }
  105. }
  106. // Script End -->
  107. </script>
  108. </HEAD>
  109. <BODY onLoad="document.sform.keyword.select()">
  110. <img <?php echo createComIcon($root_path,'micros.gif','0','absmiddle') ?>><FONT COLOR="<?php echo $cfg[top_txtcolor] ?>" SIZE=5> <b><?php echo "$LDMedLab - "; if($editmode) echo "$LDNewData"; else echo "$LDSeeData"; ?></b></font>
  111. <table width=100% border=0 cellpadding="0" cellspacing="0">
  112. <tr>
  113. <td colspan=3><img <?php echo createLDImgSrc($root_path,'such-b.gif') ?>></td>
  114. </tr>
  115. <tr >
  116. <td bgcolor=#333399 colspan=3>&nbsp;
  117. </td>
  118. </tr>
  119. <tr bgcolor="#DDE1EC" >
  120. <td bgcolor=#333399>&nbsp;</td>
  121. <td valign=top><p><br>
  122. <ul>
  123. <!-- This is the search entry mask -->
  124. <FORM action="<?php echo $thisfile; ?>" method="post" name="sform" onSubmit="return checkForm(sform.keyword)">
  125. <B><?php echo $LDSearchWordPrompt ?></B></font><p>
  126. <font size=3>
  127. <INPUT type="text" name="keyword" size="20" maxlength="40" value="<?php echo $keyword ?>"></font>
  128. <input type=hidden name="search" value=1>
  129. <input type=hidden name="sid" value=<?php echo $sid ?>>
  130. <input type=hidden name="lang" value=<?php echo $lang ?>>
  131. <input type=hidden name="editmode" value=<?php echo $editmode ?>>
  132. <INPUT type="image" <?php echo createLDImgSrc($root_path,'searchlamp.gif','0','absmiddle') ?>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  133. <a href="javascript:gethelp('search_patient.php','Laboratories :: Search Patient','<?php echo $mode ?>','<?php echo $linecount ?>','<?php echo $datafound ?>')"><img <?php echo createLDImgSrc($root_path,'hilfe-r.gif','0','absmiddle') ?>></a>
  134. </FORM>
  135. <p>
  136. <?php
  137. $prev_nr=0;
  138. # Print the search result message
  139. if($search||$mode=='paginate'){
  140. if ($linecount) echo str_replace('~nr~',$totalcount,$LDSearchFound).' '.$LDShowing.' '.$pagen->BlockStartNr().' '.$LDTo.' '.$pagen->BlockEndNr().'.';
  141. else echo str_replace('~nr~','0',$LDSearchFound);
  142. }
  143. if($linecount){
  144. $dcount=0;
  145. $append="&search=1&editmode=$editmode";
  146. $img_male=createComIcon($root_path,'spm.gif','0','',TRUE);
  147. $img_female=createComIcon($root_path,'spf.gif','0','',TRUE);
  148. $bgimg='tableHeaderbg3.gif';
  149. $tbg= 'background="'.$root_path.'gui/img/common/'.$theme_com_icon.'/'.$bgimg.'"';
  150. # Create the column descriptors
  151. ?>
  152. <table border=0 cellpadding=3 cellspacing=1>
  153. <tr class="wardlisttitlerow">
  154. <td><b>
  155. <?php echo $pagen->makeSortLink($LDCaseNr,'encounter_nr',$oitem,$odir,$append); ?></b></td>
  156. <td><b>
  157. <?php echo $pagen->makeSortLink($LDBatchNumber,'batch_nr',$oitem,$odir,$append); ?></b></td>
  158. <td><b>
  159. <?php echo $pagen->makeSortLink($LDSelianFileNr,'selian_pid',$oitem,$odir,$append); ?></b></td>
  160. <td ><b>
  161. <?php echo $pagen->makeSortLink($LDSex,'sex',$oitem,$odir,$append); ?></b></td>
  162. <td><b>
  163. <?php echo $pagen->makeSortLink($LDLastName,'name_last',$oitem,$odir,$append); ?></b></td>
  164. <td><b>
  165. <?php echo $pagen->makeSortLink($LDName,'name_first',$oitem,$odir,$append); ?></b></td>
  166. <td><b>
  167. <?php echo $pagen->makeSortLink($LDBday,'date_birth',$oitem,$odir,$append); ?></b></td>
  168. <td><b>
  169. <?php echo $pagen->makeSortLink($LDDateOfTestRequest,'send_date',$oitem,$odir,$append); ?></b></td>
  170. <td background="<?php echo createBgSkin($root_path,'tableHeaderbg.gif'); ?>" align=center><font face=arial size=2 color="#ffffff"><b><?php echo $LDSelect; ?></td>
  171. </tr>
  172. <?php
  173. /* for($i=0;$i<sizeof($LDfieldname);$i++) {
  174. echo"<td><font face=arial size=2 color=#ffffff><b>".$LDfieldname[$i]."</b></td>";
  175. }
  176. */
  177. # List all the stored lab result documents of the patient
  178. while($zeile=$encounter->FetchRow()){
  179. //if($zeile['encounter_nr']!=$prev_nr){
  180. //$prev_nr=$zeile['encounter_nr'];
  181. //$dcount++;
  182. echo '
  183. <tr class=';
  184. if($toggle) { echo 'wardlistrow2>';} else {echo 'wardlistrow1>';}
  185. $toggle=!$toggle;
  186. echo '<td>';
  187. echo '&nbsp;'.$zeile['encounter_nr'];
  188. if($zeile['encounter_class_nr']==2) echo ' <img '.createComIcon($root_path,'redflag.gif','0','',TRUE).'> <font size=1 color="red">'.$LDAmbulant.'</font>';
  189. if ($lab_obj->IsMissingLabResult($zeile['batch_nr'])==1)
  190. echo ' <img '.createComIcon($root_path,'check2.gif','0','',TRUE).'></img>'; # all results are in the list
  191. elseif ($lab_obj->IsMissingLabResult($zeile['batch_nr'])==-1)
  192. echo ' <img '.createComIcon($root_path,'check-r.gif','0','',TRUE).'></img>'; # not all results are written to the file
  193. else
  194. echo ' <img '.createComIcon($root_path,'exclama.gif','0','',TRUE).'></img>'; # not even one results are written down to file
  195. echo '</td>';
  196. echo '<td>';
  197. echo '&nbsp;'.$zeile['batch_nr'];
  198. echo '</td>';
  199. echo '<td>';
  200. echo '&nbsp;'.$zeile['selian_pid'];
  201. echo '</td>';
  202. echo '<td>';
  203. switch($zeile['sex']){
  204. case 'f': echo '<img '.$img_female.'>'; break;
  205. case 'm': echo '<img '.$img_male.'>'; break;
  206. default: echo '&nbsp;'; break;
  207. }
  208. echo '</td><td>';
  209. echo '&nbsp;'.ucfirst($zeile['name_last']);
  210. echo '</td>
  211. <td>';
  212. echo '&nbsp;'.ucfirst($zeile['name_first']);
  213. echo '</td>
  214. <td>';
  215. echo '&nbsp;'.formatDate2Local($zeile['date_birth'],$date_format);
  216. echo '</td>';
  217. echo '</td>
  218. <td>';
  219. echo '&nbsp;'.formatDate2Local($zeile['send_date'],$date_format);
  220. echo '</td>';
  221. # if mode is edit, create the button linked to labor_data_check_arch.php
  222. # if mode is not edit, create button linked to labor_datalist_noedit.php (read only list)
  223. echo'
  224. <td>&nbsp';
  225. if($editmode){
  226. echo'<a href="labor_datainput.php?sid='.$sid.'&job_id='.$zeile['batch_nr'].'&mode=edit&encounter_nr='.$zeile['encounter_nr'].'&update=1" title="'.$LDEnterData.'">
  227. <img '.createComIcon($root_path,'play_one.gif','0','absmiddle',FALSE).' </a> ';
  228. }else{
  229. echo'
  230. <a href="labor_datalist_noedit.php'.URL_APPEND.'&encounter_nr='.$zeile['encounter_nr'].'&noexpand=1&nostat=1&user_origin=lab" title="'.$LDClk2See.'">
  231. <button onClick="javascript:window.location.href=\'labor_datalist_noedit.php'.URL_REDIRECT_APPEND.'&encounter_nr='.$zeile['encounter_nr'].'&noexpand=1&nostat=1&user_origin=lab\'"><img '.createComIcon($root_path,'update2.gif','0','absmiddle',FALSE).' alt="'.$LDClk2See.'"><font size=1> '.$LDLabReport;
  232. /*
  233. echo'
  234. <a href="labor_datalist_noedit.php'.URL_APPEND.'&encounter_nr='.$zeile['encounter_nr'].'&noexpand=1&nostat=1&user_origin=lab" title="'.$LDClk2See.'">
  235. <button onClick="javascript:window.location.href=\'labor_datalist_noedit.php'.URL_REDIRECT_APPEND.'&encounter_nr='.$zeile['encounter_nr'].'&noexpand=1&nostat=1&user_origin=lab\'"><img '.createComIcon($root_path,'update2.gif','0','absmiddle',FALSE).' alt="'.$LDClk2See.'"><font size=1> '.$LDLabReport;
  236. */
  237. }
  238. echo '</font></button></a>&nbsp;
  239. </td></tr>';
  240. //}
  241. }
  242. if($totalcount>$pagen->MaxCount()){
  243. echo '
  244. <tr><td colspan=5>'.$pagen->makePrevLink($LDPrevious,$append).'</td>
  245. <td align=right>'.$pagen->makeNextLink($LDNext,$append).'</td>
  246. </tr>';
  247. }
  248. echo '</table>';
  249. # If result is more than 15 items, create an additional search entry mask below the list
  250. if($dcount>$pagen->MaxCount()){
  251. echo '
  252. <p><font color=red><B>'.$LDNewSearch.':</font>
  253. <FORM action="'.$thisfile.'" method="post" name="form2" onSubmit="return checkForm(form2.keyword)">
  254. '.$LDSearchWordPrompt.'</B><p>
  255. <INPUT type="text" name="keyword" size="20" maxlength="40" value="'.$keyword.'">
  256. <input type=hidden name="search" value=1>
  257. <input type=hidden name="sid" value="'.$sid.'">
  258. <input type=hidden name="lang" value="'.$lang.'">
  259. <input type=hidden name="editmode" value="'.$editmode.'">
  260. <INPUT type="image" '.createLDImgSrc($root_path,'searchlamp.gif','0','absmiddle').'></FORM>
  261. <p>';
  262. }
  263. }
  264. ?>
  265. <p>
  266. <br>&nbsp;
  267. <p>
  268. <a href="<?php echo $breakfile ?>"><img <?php echo createLDImgSrc($root_path,'cancel.gif','0') ?>></a>
  269. <p>
  270. </ul>
  271. &nbsp;
  272. </FONT>
  273. <p>
  274. </td>
  275. <td bgcolor=#333399>&nbsp;</td>
  276. </tr>
  277. <tr >
  278. <td bgcolor="#333399" colspan=3><font size=1>
  279. &nbsp;
  280. </td>
  281. </tr>
  282. </table>
  283. <p>
  284. <?php
  285. require($root_path.'include/inc_load_copyrite.php');
  286. ?>
  287. </FONT>
  288. </BODY>
  289. </HTML>