/modules/laboratory/labor_data_patient_such.php
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
- <?php
- error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
- require('./roots.php');
- require($root_path.'include/inc_environment_global.php');
- /**
- * CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
- * GNU General Public License
- * Copyright 2002,2003,2004,2005 Elpidio Latorilla
- * elpidio@care2x.org,
- *
- * See the file "copy_notice.txt" for the licence notice
- */
- # Default value for the maximum nr of rows per block displayed, define this to the value you wish
- # In normal cases this value is derived from the db table "care_config_global" using the "pagin_insurance_list_max_block_rows" element.
- define('MAX_BLOCK_ROWS',30);
- $lang_tables[]='search.php';
- define('LANG_FILE','lab.php');
- $local_user='ck_lab_user';
- require_once($root_path.'include/inc_front_chain_lang.php');
- $thisfile=basename($_SERVER['PHP_SELF']);
- $breakfile='labor.php'.URL_APPEND;
- # Workaround
- if(!isset($mode)){
- $mode='';
- }elseif($mode=='edit'){
- $editmode=TRUE;
- }
-
- //$db->debug=1;
- $keyword=trim($keyword);
- $toggle=0;
- # Initialize page�s control variables
- if($mode=='paginate'){
- $keyword=$_SESSION['sess_searchkey'];
- }else{
- # Reset paginator variables
- $pgx=0;
- $totalcount=0;
- $odir='DESC';
- $oitem='send_date';
- # Workaround: Resolve the search key variables
- if(empty($keyword)&&!empty($searchkey)) $keyword=$searchkey;
-
- if(is_numeric($keyword)){
- $keyword=(int) $keyword;
- }else{
- # Convert other wildcards
- $keyword=strtr($keyword,'*&','%_');
- }
- }
- if($search&&!empty($keyword)){
- # Load the date formatter
- include_once($root_path.'include/inc_date_format_functions.php');
-
- include_once($root_path.'include/care_api_classes/class_lab.php');
-
- $lab_obj=new Lab();
-
- #Load and create paginator object
- include_once($root_path.'include/care_api_classes/class_paginator.php');
- $pagen=& new Paginator($pgx,$thisfile,$_SESSION['sess_searchkey'],$root_path);
- $GLOBAL_CONFIG=array();
- include_once($root_path.'include/care_api_classes/class_globalconfig.php');
- $glob_obj=new GlobalConfig($GLOBAL_CONFIG);
- # Get the max nr of rows from global config
- $glob_obj->getConfig('pagin_patient_search_max_block_rows');
- 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
- else $pagen->setMaxCount($GLOBAL_CONFIG['pagin_patient_search_max_block_rows']);
- $encounter=&$lab_obj->searchPatientWithPendingLabResults($keyword,$pagen->MaxCount(),$pgx,$oitem,$odir);
- //echo $lab_obj->getLastQuery()."<p>";
- # Get the resulting record count
- if($linecount=$lab_obj->LastRecordCount()){
-
- if($mode!='paginate') $_SESSION['sess_searchkey']=$keyword;
- $pagen->setTotalBlockCount($linecount);
- # Count total available data
- if(isset($totalcount)&&$totalcount){
- $pagen->setTotalDataCount($totalcount);
- }else{
- if($editmode){
- @$lab_obj->searchEncounterLaboratoryInfo($keyword);
- }else{
- @$lab_obj->searchEncounterLabResults($keyword);
- }
- $totalcount=$lab_obj->LastRecordCount();
- $pagen->setTotalDataCount($totalcount);
- }
- $pagen->setSortItem($oitem);
- $pagen->setSortDirection($odir);
- }
- }
- ?>
- <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
- <?php html_rtl($lang); ?>
- <HEAD>
- <?php echo setCharSet(); ?>
- <?php
- require($root_path.'include/inc_js_gethelp.php');
- require($root_path.'include/inc_css_a_hilitebu.php');
- ?>
- <script language="JavaScript">
- <!-- Script Begin
- function checkForm(v) {
- if((v.value=="")||(v.value==" ")){
- v.value="";
- v.focus();
- return false;
- }else{
- return true;
- }
- }
- // Script End -->
- </script>
- </HEAD>
- <BODY onLoad="document.sform.keyword.select()">
- <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>
- <table width=100% border=0 cellpadding="0" cellspacing="0">
- <tr>
- <td colspan=3><img <?php echo createLDImgSrc($root_path,'such-b.gif') ?>></td>
- </tr>
- <tr >
- <td bgcolor=#333399 colspan=3>
- </td>
- </tr>
- <tr bgcolor="#DDE1EC" >
- <td bgcolor=#333399> </td>
- <td valign=top><p><br>
- <ul>
- <!-- This is the search entry mask -->
- <FORM action="<?php echo $thisfile; ?>" method="post" name="sform" onSubmit="return checkForm(sform.keyword)">
- <B><?php echo $LDSearchWordPrompt ?></B></font><p>
- <font size=3>
- <INPUT type="text" name="keyword" size="20" maxlength="40" value="<?php echo $keyword ?>"></font>
- <input type=hidden name="search" value=1>
- <input type=hidden name="sid" value=<?php echo $sid ?>>
- <input type=hidden name="lang" value=<?php echo $lang ?>>
- <input type=hidden name="editmode" value=<?php echo $editmode ?>>
- <INPUT type="image" <?php echo createLDImgSrc($root_path,'searchlamp.gif','0','absmiddle') ?>>
- <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>
- </FORM>
- <p>
- <?php
- $prev_nr=0;
- # Print the search result message
- if($search||$mode=='paginate'){
- if ($linecount) echo str_replace('~nr~',$totalcount,$LDSearchFound).' '.$LDShowing.' '.$pagen->BlockStartNr().' '.$LDTo.' '.$pagen->BlockEndNr().'.';
- else echo str_replace('~nr~','0',$LDSearchFound);
- }
- if($linecount){
- $dcount=0;
- $append="&search=1&editmode=$editmode";
- $img_male=createComIcon($root_path,'spm.gif','0','',TRUE);
- $img_female=createComIcon($root_path,'spf.gif','0','',TRUE);
- $bgimg='tableHeaderbg3.gif';
- $tbg= 'background="'.$root_path.'gui/img/common/'.$theme_com_icon.'/'.$bgimg.'"';
- # Create the column descriptors
- ?>
- <table border=0 cellpadding=3 cellspacing=1>
- <tr class="wardlisttitlerow">
- <td><b>
- <?php echo $pagen->makeSortLink($LDCaseNr,'encounter_nr',$oitem,$odir,$append); ?></b></td>
- <td><b>
- <?php echo $pagen->makeSortLink($LDBatchNumber,'batch_nr',$oitem,$odir,$append); ?></b></td>
- <td><b>
- <?php echo $pagen->makeSortLink($LDSelianFileNr,'selian_pid',$oitem,$odir,$append); ?></b></td>
-
- <td ><b>
- <?php echo $pagen->makeSortLink($LDSex,'sex',$oitem,$odir,$append); ?></b></td>
- <td><b>
- <?php echo $pagen->makeSortLink($LDLastName,'name_last',$oitem,$odir,$append); ?></b></td>
- <td><b>
- <?php echo $pagen->makeSortLink($LDName,'name_first',$oitem,$odir,$append); ?></b></td>
- <td><b>
- <?php echo $pagen->makeSortLink($LDBday,'date_birth',$oitem,$odir,$append); ?></b></td>
- <td><b>
- <?php echo $pagen->makeSortLink($LDDateOfTestRequest,'send_date',$oitem,$odir,$append); ?></b></td>
- <td background="<?php echo createBgSkin($root_path,'tableHeaderbg.gif'); ?>" align=center><font face=arial size=2 color="#ffffff"><b><?php echo $LDSelect; ?></td>
- </tr>
- <?php
- /* for($i=0;$i<sizeof($LDfieldname);$i++) {
- echo"<td><font face=arial size=2 color=#ffffff><b>".$LDfieldname[$i]."</b></td>";
- }
- */
-
- # List all the stored lab result documents of the patient
-
- while($zeile=$encounter->FetchRow()){
- //if($zeile['encounter_nr']!=$prev_nr){
- //$prev_nr=$zeile['encounter_nr'];
- //$dcount++;
- echo '
- <tr class=';
- if($toggle) { echo 'wardlistrow2>';} else {echo 'wardlistrow1>';}
- $toggle=!$toggle;
- echo '<td>';
- echo ' '.$zeile['encounter_nr'];
- if($zeile['encounter_class_nr']==2) echo ' <img '.createComIcon($root_path,'redflag.gif','0','',TRUE).'> <font size=1 color="red">'.$LDAmbulant.'</font>';
-
- if ($lab_obj->IsMissingLabResult($zeile['batch_nr'])==1)
- echo ' <img '.createComIcon($root_path,'check2.gif','0','',TRUE).'></img>'; # all results are in the list
- elseif ($lab_obj->IsMissingLabResult($zeile['batch_nr'])==-1)
- echo ' <img '.createComIcon($root_path,'check-r.gif','0','',TRUE).'></img>'; # not all results are written to the file
- else
- echo ' <img '.createComIcon($root_path,'exclama.gif','0','',TRUE).'></img>'; # not even one results are written down to file
-
- echo '</td>';
- echo '<td>';
- echo ' '.$zeile['batch_nr'];
- echo '</td>';
-
- echo '<td>';
- echo ' '.$zeile['selian_pid'];
- echo '</td>';
-
- echo '<td>';
- switch($zeile['sex']){
- case 'f': echo '<img '.$img_female.'>'; break;
- case 'm': echo '<img '.$img_male.'>'; break;
- default: echo ' '; break;
- }
-
- echo '</td><td>';
- echo ' '.ucfirst($zeile['name_last']);
- echo '</td>
- <td>';
- echo ' '.ucfirst($zeile['name_first']);
- echo '</td>
- <td>';
- echo ' '.formatDate2Local($zeile['date_birth'],$date_format);
- echo '</td>';
-
- echo '</td>
- <td>';
- echo ' '.formatDate2Local($zeile['send_date'],$date_format);
- echo '</td>';
- # if mode is edit, create the button linked to labor_data_check_arch.php
- # if mode is not edit, create button linked to labor_datalist_noedit.php (read only list)
- echo'
- <td> ';
-
- if($editmode){
- echo'<a href="labor_datainput.php?sid='.$sid.'&job_id='.$zeile['batch_nr'].'&mode=edit&encounter_nr='.$zeile['encounter_nr'].'&update=1" title="'.$LDEnterData.'">
- <img '.createComIcon($root_path,'play_one.gif','0','absmiddle',FALSE).' </a> ';
- }else{
- echo'
- <a href="labor_datalist_noedit.php'.URL_APPEND.'&encounter_nr='.$zeile['encounter_nr'].'&noexpand=1&nostat=1&user_origin=lab" title="'.$LDClk2See.'">
- <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;
- /*
- echo'
- <a href="labor_datalist_noedit.php'.URL_APPEND.'&encounter_nr='.$zeile['encounter_nr'].'&noexpand=1&nostat=1&user_origin=lab" title="'.$LDClk2See.'">
- <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;
- */
- }
-
- echo '</font></button></a>
- </td></tr>';
- //}
- }
- if($totalcount>$pagen->MaxCount()){
- echo '
- <tr><td colspan=5>'.$pagen->makePrevLink($LDPrevious,$append).'</td>
- <td align=right>'.$pagen->makeNextLink($LDNext,$append).'</td>
- </tr>';
- }
- echo '</table>';
-
- # If result is more than 15 items, create an additional search entry mask below the list
- if($dcount>$pagen->MaxCount()){
- echo '
- <p><font color=red><B>'.$LDNewSearch.':</font>
- <FORM action="'.$thisfile.'" method="post" name="form2" onSubmit="return checkForm(form2.keyword)">
- '.$LDSearchWordPrompt.'</B><p>
- <INPUT type="text" name="keyword" size="20" maxlength="40" value="'.$keyword.'">
- <input type=hidden name="search" value=1>
- <input type=hidden name="sid" value="'.$sid.'">
- <input type=hidden name="lang" value="'.$lang.'">
- <input type=hidden name="editmode" value="'.$editmode.'">
- <INPUT type="image" '.createLDImgSrc($root_path,'searchlamp.gif','0','absmiddle').'></FORM>
- <p>';
- }
- }
- ?>
- <p>
- <br>
- <p>
- <a href="<?php echo $breakfile ?>"><img <?php echo createLDImgSrc($root_path,'cancel.gif','0') ?>></a>
- <p>
- </ul>
-
- </FONT>
- <p>
- </td>
- <td bgcolor=#333399> </td>
- </tr>
- <tr >
- <td bgcolor="#333399" colspan=3><font size=1>
-
- </td>
- </tr>
- </table>
- <p>
- <?php
- require($root_path.'include/inc_load_copyrite.php');
- ?>
- </FONT>
- </BODY>
- </HTML>