- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / laboratory / labor_test_findings_radio.php
blob5a1776c517e2d7f06e1ec533b944411dd615ccd6
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.2 - 2006-07-10
7 * GNU General Public License
8 * Copyright 2002,2003,2004,2005,2006 Elpidio Latorilla
9 * elpidio@care2x.org,
11 * See the file "copy_notice.txt" for the licence notice
13 $lang_tables=array('departments.php');
14 define('LANG_FILE','konsil.php');
15 $local_user='ck_lab_user';
17 require_once($root_path.'include/inc_front_chain_lang.php');
18 require_once($root_path.'global_conf/inc_global_address.php');
19 require_once($root_path.'include/inc_diagnostics_report_fx.php');
21 $breakfile=$root_path.'modules/radiology/radiolog.php'.URL_APPEND;
22 $returnfile='labor_test_request_admin_'.$subtarget.'.php'.URL_APPEND.'&target='.$target.'&subtarget='.$subtarget.'&user_origin='.$user_origin;
23 $thisfile='labor_test_findings_'.$subtarget.'.php';
25 $bgc1='#ffffff';
27 $edit=1; /* Assume to edit first */
29 $formtitle=$LDRadiology;
30 $dept_nr=19; // 19 = department nr. of radiology
31 $db_request_table=$subtarget;
33 //$db->debug=1;
35 require_once($root_path.'include/care_api_classes/class_encounter.php');
36 $enc_obj=new Encounter;
38 /* Here begins the real work */
40 require_once($root_path.'include/inc_date_format_functions.php');
43 /* Check for the patient number = $pn. If available get the patients data, otherwise set edit to 0 */
44 if(isset($pn)&&$pn)
47 if( $enc_obj->loadEncounterData($pn)) {
49 include_once($root_path.'include/care_api_classes/class_globalconfig.php');
50 $GLOBAL_CONFIG=array();
51 $glob_obj=new GlobalConfig($GLOBAL_CONFIG);
52 $glob_obj->getConfig('patient_%');
53 switch ($enc_obj->EncounterClass())
55 case '1': $full_en = ($pn + $GLOBAL_CONFIG['patient_inpatient_nr_adder']);
56 break;
57 case '2': $full_en = ($pn + $GLOBAL_CONFIG['patient_outpatient_nr_adder']);
58 break;
59 default: $full_en = ($pn + $GLOBAL_CONFIG['patient_inpatient_nr_adder']);
62 $result=&$enc_obj->encounter;
64 else
66 $edit=0;
67 $mode='';
68 $pn='';
74 if(!isset($mode) && $batch_nr && $pn) $mode='edit';
76 switch($mode)
78 case 'save':
80 $sql="INSERT INTO care_test_findings_".$db_request_table."
82 batch_nr, encounter_nr, dept_nr,
83 findings, diagnosis,
84 doctor_id, findings_date, findings_time,
85 status,
86 history,
87 create_id,
88 create_time
90 VALUES
92 '".$batch_nr."','".$pn."','".$dept_nr."',
93 '".addslashes(htmlspecialchars($findings))."','".addslashes(htmlspecialchars($diagnosis))."',
94 '".htmlspecialchars($doctor_id)."', '".formatDate2Std($findings_date,$date_format)."', '".date('H:i:s')."',
95 'initial',
96 'Create: ".date('Y-m-d H:i:s')." = ".$HTTP_SESSION_VARS['sess_user_name']."\n',
97 '".$HTTP_SESSION_VARS['sess_user_name']."',
98 '".date('YmdHis')."'
99 )";
102 if($ergebnis=$enc_obj->Transact($sql))
104 signalNewDiagnosticsReportEvent($findings_date);
105 //echo $sql;
106 header("location:$thisfile?sid=$sid&lang=$lang&edit=$edit&saved=insert&mode=edit&pn=$pn&station=$station&user_origin=$user_origin&status=$status&target=$target&subtarget=$subtarget&noresize=$noresize&batch_nr=$batch_nr&entry_date=$entry_date");
107 exit;
109 else
111 echo "<p>$sql<p>$LDDbNoSave";
112 $mode='';
115 break; // end of case 'save'
117 case 'update':
119 $sql="UPDATE care_test_findings_".$db_request_table." SET
120 findings='".addslashes(htmlspecialchars($findings))."',
121 diagnosis='".addslashes(htmlspecialchars($diagnosis))."',
122 doctor_id='".htmlspecialchars($doctor_id)."',
123 findings_date='".formatDate2Std($findings_date,$date_format)."',
124 findings_time='".date('H:i:s')."',
125 history=".$enc_obj->ConcatHistory("Update: ".date('Y-m-d H:i:s')." = ".$HTTP_SESSION_VARS['sess_user_name']."\n").",
126 modify_id = '".$HTTP_SESSION_VARS['sess_user_name']."',
127 modify_time='".date('YmdHis')."'
128 WHERE batch_nr = '".$batch_nr."'";
130 if($ergebnis=$enc_obj->Transact($sql))
132 signalNewDiagnosticsReportEvent($findings_date);
133 //echo $sql;
134 header("location:$thisfile?sid=$sid&lang=$lang&edit=$edit&saved=insert&mode=edit&pn=$pn&station=$station&user_origin=$user_origin&status=$status&target=$target&subtarget=$subtarget&noresize=$noresize&batch_nr=$batch_nr&entry_date=$entry_date");
135 exit;
137 else
139 echo "<p>$sql<p>$LDDbNoSave";
140 $mode='';
143 break; // end of case 'save'
145 case 'done':
147 $sql="UPDATE care_test_findings_".$db_request_table." SET
148 status='done',
149 history=".$enc_obj->ConcatHistory("Done: ".date('Y-m-d H:i:s')." = ".$HTTP_SESSION_VARS['sess_user_name']."\n").",
150 modify_id = '".$HTTP_SESSION_VARS['sess_user_name']."',
151 modify_time='".date('YmdHis')."'
152 WHERE batch_nr = '".$batch_nr."'";
154 if($ergebnis=$enc_obj->Transact($sql))
156 //echo $sql;
157 $sql="UPDATE care_test_request_".$db_request_table." SET
158 status='done',
159 history=".$enc_obj->ConcatHistory("Done: ".date('Y-m-d H:i:s')." = ".$HTTP_SESSION_VARS['sess_user_name']."\n").",
160 modify_id = '".$HTTP_SESSION_VARS['sess_user_name']."',
161 modify_time='".date('YmdHis')."'
162 WHERE batch_nr = '".$batch_nr."'";
164 if($ergebnis=$enc_obj->Transact($sql))
166 // Load the visual signalling functions
167 include_once($root_path.'include/inc_visual_signalling_fx.php');
168 // Set the visual signal
169 setEventSignalColor($pn,SIGNAL_COLOR_DIAGNOSTICS_REPORT);
170 header("location:$thisfile?sid=$sid&lang=$lang&edit=$edit&saved=insert&mode=edit&pn=$pn&station=$station&user_origin=$user_origin&status=$status&target=$target&subtarget=$subtarget&noresize=$noresize&batch_nr=$batch_nr&entry_date=$entry_date");
171 exit;
173 else
175 echo "<p>$sql<p>$LDDbNoSave";
176 $mode='save';
179 else
181 echo "<p>$sql<p>$LDDbNoSave";
182 $mode='save';
185 break; // end of case 'save'
188 /* If mode is edit, get the stored test findings
190 case 'edit':
192 $sql="SELECT * FROM care_test_findings_".$db_request_table." WHERE batch_nr='$batch_nr'";
193 if($ergebnis=$db->Execute($sql))
195 if($editable_rows=$ergebnis->RecordCount())
197 $stored_findings=$ergebnis->FetchRow();
198 if($stored_findings['status']=='done') $edit=0; /* Inhibit editing of the findings */
199 $edit_form=1;
201 else
203 $mode='save';
206 else
208 $mode='save';
211 break; ///* End of case 'edit': */
213 default: $mode='';
215 }// end of switch($mode)
217 if($edit) $returnfile.='&batch_nr='.$batch_nr.'&pn='.$pn.'&tracker='.$tracker;
219 # Start Smarty templating here
221 * LOAD Smarty
224 # Note: it is advisable to load this after the inc_front_chain_lang.php so
225 # that the smarty script can use the user configured template theme
227 require_once($root_path.'gui/smarty_template/smarty_care.class.php');
228 $smarty = new smarty_care('nursing');
230 # Title in toolbar
231 $smarty->assign('sToolbarTitle',$LDDiagnosticTest." (".$batch_nr.")");
233 # hide back button
234 $smarty->assign('pbBack',$returnfile);
236 # href for help button
237 $smarty->assign('pbHelp',"javascript:gethelp('pending_radio_findings.php')");
239 # href for close button
240 $smarty->assign('breakfile',$breakfile);
242 # Window bar title
243 $smarty->assign('sWindowTitle',$LDDiagnosticTest." (".$batch_nr.")");
245 $smarty->assign('sOnLoadJs','onLoad="if (window.focus) window.focus();"');
247 # Collect extra javascript code
249 ob_start();
252 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
253 <?php html_rtl($lang); ?>
254 <HEAD>
255 <?php echo setCharSet(); ?>
256 <TITLE><?php echo "$LDDiagnosticTest $station" ?></TITLE>
257 <?php
258 require($root_path.'include/inc_js_gethelp.php');
259 require($root_path.'include/inc_css_a_hilitebu.php');
262 <style type="text/css">
263 div.fva2_ml10 {font-family: verdana,arial; font-size: 12; margin-left: 10;}
264 div.fa2_ml10 {font-family: arial; font-size: 12; margin-left: 10;}
265 div.fva2_ml3 {font-family: verdana; font-size: 12; margin-left: 3; }
266 div.fa2_ml3 {font-family: arial; font-size: 12; margin-left: 3; }
267 .fva2_ml10 {font-family: verdana,arial; font-size: 12; margin-left: 10; color:#000099;}
268 .fva2b_ml10 {font-family: verdana,arial; font-size: 12; margin-left: 10; color:#000000;}
269 .fva0_ml10 {font-family: verdana,arial; font-size: 10; margin-left: 10; color:#000099;}
270 .fvag_ml10 {font-family: verdana,arial; font-size: 10; margin-left: 10; color:#969696;}
271 </style>
273 <script language="javascript">
274 <!--
276 <?php
278 * Output the following function only when in edit mode
280 if ($edit)
284 function chkForm(d){
286 if(d.findings.value=="" && d.diagnosis.value=="") return false;
287 else if(d.findings_date.value=="" || d.findings_date.value==" ")
289 alert("<?php echo $LDPlsEnterDate ?>");
290 d.findings_date.focus();
291 return false;
293 else if(d.doctor_id.value=="" || d.doctor_id.value==" ")
295 alert("<?php echo $LDPlsEnterDoctorName ?>");
296 d.doctor_id.focus();
297 return false;
299 else
301 return true;
305 <?php
309 function printOut()
311 urlholder="labor_test_findings_printpop.php?sid=<?php echo $sid ?>&lang=<?php echo $lang ?>&user_origin=<?php echo $user_origin ?>&subtarget=<?php echo $subtarget ?>&batch_nr=<?php echo $batch_nr ?>&pn=<?php echo $pn ?>&entry_date=<?php echo $entry_date ?>";
312 findings_printout<?php echo $sid ?>=window.open(urlholder,"findings_printout<?php echo $sid ?>","width=800,height=600,menubar=no,resizable=yes,scrollbars=yes");
313 findings_printout<?php echo $sid ?>.print();
316 <?php require($root_path.'include/inc_checkdate_lang.php'); ?>
317 //-->
318 </script>
319 <?php
321 $sTemp = ob_get_contents();
323 ob_end_clean();
325 $smarty->append('JavaScript',$sTemp);
327 ob_start();
331 <ul>
333 <?php if ($edit)
336 <form name="form_test_request" method="post" action="<?php echo $thisfile ?>" onSubmit="return chkForm(this)">
337 <?php
340 require_once($root_path.'include/inc_test_findings_form_'.$subtarget.'.php');
342 echo '&nbsp;<br>';
343 if ($edit)
345 echo'
346 <input type="image" '.createLDImgSrc($root_path,'savedisc.gif','0').'>';
352 <a href="javascript:printOut()"><img <?php echo createLDImgSrc($root_path,'printout.gif','0') ?>></a>
353 <?php
354 if (isset($stored_findings['status']) && $stored_findings['status']!='done' )
356 echo'
357 <a href="'. $thisfile.'?sid='.$sid.'&lang='.$lang.'&edit='.$edit.'&mode=done&target='.$target.'&subtarget='.$subtarget.'&batch_nr='.$batch_nr.'&pn='.$pn.'&user_origin='.$user_origin.'&entry_date='.$entry_date.'"><img '.createLDImgSrc($root_path,'done.gif','0').' alt="'.$LDDone.'"></a>';
361 <?php
362 if ($edit)
364 require($root_path.'include/inc_test_request_hiddenvars.php');
367 <input type="hidden" name="entry_date" value="<?php echo $entry_date ?>">
369 </form>
370 <?php
374 </ul>
376 <?php
378 $sTemp = ob_get_contents();
379 ob_end_clean();
381 # Assign to page template object
382 $smarty->assign('sMainFrameBlockData',$sTemp);
385 * show Template
387 $smarty->display('common/mainframe.tpl');