3 * This report lists all the demographics allergies,problems,drugs and lab results
6 * @link http://www.open-emr.org
7 * @author Brady Miller <brady.g.miller@gmail.com>
8 * @copyright Copyright (c) 2014 Ensoftek, Inc
9 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("../globals.php");
15 require_once("$srcdir/patient.inc");
16 require_once("$srcdir/options.inc.php");
17 require_once("../drugs/drugs.inc.php");
18 require_once("$srcdir/payment_jav.inc.php");
20 use OpenEMR\Core\Header
;
22 $search_options = array("Demographics"=>xl("Demographics"),"Problems"=>xl("Problems"),"Medications"=>xl("Medications"),"Allergies"=>xl("Allergies"),"Lab results"=>xl("Lab Results"),"Communication"=>xl("Communication"));
23 $comarr = array("allow_sms"=>xl("Allow SMS"),"allow_voice"=>xl("Allow Voice Message"),"allow_mail"=>xl("Allow Mail Message"),"allow_email"=>xl("Allow Email"));
24 $_POST['form_details'] = true;
26 $sql_date_from = (!empty($_POST['date_from'])) ?
DateTimeToYYYYMMDDHHMMSS($_POST['date_from']) : date('Y-01-01 H:i:s');
27 $sql_date_to = (!empty($_POST['date_to'])) ?
DateTimeToYYYYMMDDHHMMSS($_POST['date_to']) : date('Y-m-d H:i:s');
29 $patient_id = trim($_POST["patient_id"]);
30 $age_from = $_POST["age_from"];
31 $age_to = $_POST["age_to"];
32 $sql_gender = $_POST["gender"];
33 $sql_ethnicity = $_POST["cpms_ethnicity"];
34 $sql_race=$_POST["race"];
35 $form_drug_name = trim($_POST["form_drug_name"]);
36 $form_diagnosis = trim($_POST["form_diagnosis"]);
37 $form_lab_results = trim($_POST["form_lab_results"]);
38 $form_service_codes = trim($_POST["form_service_codes"]);
39 $form_immunization = trim($_POST["form_immunization"]);
40 $communication = trim($_POST["communication"]);
46 <?php
echo xlt('Patient List Creation'); ?
>
49 <?php Header
::setupHeader(['datetime-picker', 'report-helper']); ?
>
51 <script language
="JavaScript">
52 function Form_Validate() {
53 var d
= document
.forms
[0];
54 FromDate
= d
.date_from
.value
;
55 ToDate
= d
.date_to
.value
;
56 if ( (FromDate
.length
> 0) && (ToDate
.length
> 0) ) {
57 if ( FromDate
> ToDate
){
58 alert("<?php echo xls('To date must be later than From date!'); ?>");
62 $
("#processing").show();
67 <style type
="text/css">
68 /* specifically include & exclude from printing */
74 #report_parameters_daterange {
78 #report_results table {
87 /* specifically exclude some from the screen */
89 #report_parameters_daterange {
95 <script language
="javascript" type
="text/javascript">
96 function submitForm() {
97 var d_from
= new String($
('#date_from').val());
98 var d_to
= new String($
('#date_to').val());
100 var d_from_arr
= d_from
.split('-');
101 var d_to_arr
= d_to
.split('-');
103 var dt_from
= new Date(d_from_arr
[0], d_from_arr
[1], d_from_arr
[2]);
104 var dt_to
= new Date(d_to_arr
[0], d_to_arr
[1], d_to_arr
[2]);
106 var mili_from
= dt_from
.getTime();
107 var mili_to
= dt_to
.getTime();
108 var diff
= mili_to
- mili_from
;
110 $
('#date_error').css("display", "none");
112 if(diff
< 0) //negative
114 $
('#date_error').css("display", "inline");
118 $
("#form_refresh").attr("value","true");
119 top
.restoreSession();
120 $
("#theform").submit();
125 function sortingCols(sort_by
,sort_order
)
127 $
("#sortby").val(sort_by
);
128 $
("#sortorder").val(sort_order
);
129 $
("#form_refresh").attr("value","true");
130 $
("#theform").submit();
133 $
(document
).ready(function() {
134 $
(".numeric_only").keydown(function(event
) {
135 //alert(event.keyCode);
136 // Allow only backspace and delete
137 if ( event
.keyCode
== 46 || event
.keyCode
== 8 ) {
138 // let it happen, don't do anything
141 if(!((event
.keyCode
>= 96 && event
.keyCode
<= 105) ||
(event
.keyCode
>= 48 && event
.keyCode
<= 57)))
143 event
.preventDefault();
147 <?php
if ($_POST['srch_option'] == "Communication") { ?
>
148 $
('#com_pref').show();
151 $
('.datetimepicker').datetimepicker({
152 <?php
$datetimepicker_timepicker = true; ?
>
153 <?php
$datetimepicker_showseconds = true; ?
>
154 <?php
$datetimepicker_formatInput = true; ?
>
155 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
156 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
160 function printForm(){
161 var win
= top
.printLogPrint ? top
: opener
.top
;
162 win
.printLogPrint(window
);
167 <body
class="body_top">
168 <!-- Required
for the popup date selectors
-->
169 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
171 <?php
echo xlt('Report - Patient List Creation');?
>
173 <!-- Search can be done using age range
, gender
, and ethnicity filters
.
174 Search options
include diagnosis
, procedure
, prescription
, medical history
, and lab results
.
177 <div id
="report_parameters_daterange">
179 <?php
echo "<span style='margin-left:5px;'><b>".xlt('Date Range').":</b> ".text(oeFormatDateTime($sql_date_from, "global", true)) .
180 " " . xlt('to') . " ". text(oeFormatDateTime($sql_date_to, "global", true))."</span>"; ?
>
181 <span style
="margin-left:5px; " ><b
><?php
echo xlt('Option'); ?
>:</b
> 
;<?php
echo text($_POST['srch_option']);
182 if ($_POST['srch_option'] == "Communication" && $_POST['communication'] != "") {
183 if (isset($comarr[$_POST['communication']])) {
184 echo "(".text($comarr[$_POST['communication']]).")";
186 echo "(".xlt('All').")";
191 <form name
='theform' id
='theform' method
='post' action
='patient_list_creation.php' onSubmit
="return Form_Validate();">
192 <div id
="report_parameters">
193 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>
197 <div
class="cancel-float" style
='float:left'>
200 <td
class='control-label' ><?php
echo xlt('From'); ?
>: </td
>
201 <td
><input type
='text' class='datetimepicker form-control' name
='date_from' id
="date_from" size
='18' value
='<?php echo attr(oeFormatDateTime($sql_date_from, 0, true)); ?>'>
203 <td
class='control-label'><?php
echo xlt('To{{range}}'); ?
>: </td
>
204 <td
><input type
='text' class='datetimepicker form-control' name
='date_to' id
="date_to" size
='18' value
='<?php echo attr(oeFormatDateTime($sql_date_to, 0, true)); ?>'>
206 <td
class='control-label'><?php
echo xlt('Option'); ?
>: </td
>
207 <td
class='control-label'>
208 <select
class="form-control" name
="srch_option" id
="srch_option" onchange
="javascript:$('#sortby').val('');$('#sortorder').val('');if(this.value == 'Communication'){ $('#communication').val('');$('#com_pref').show();}else{ $('#communication').val('');$('#com_pref').hide();}">
209 <?php
foreach ($search_options as $skey => $svalue) { ?
>
210 <option
<?php
echo ($_POST['srch_option'] == $skey) ?
'selected' : ''; ?
> value
="<?php echo attr($skey); ?>"><?php
echo text($svalue); ?
></option
>
217 <span id
="com_pref" style
="display:none">
218 <select
class="form-control" name
="communication" id
="communication" title
="<?php echo xlt('Select Communication Preferences'); ?>">
219 <option
> <?php
echo xlt('All'); ?
></option
>
220 <option value
="allow_sms" <?php
echo ($communication == "allow_sms") ?
"selected" : ""; ?
>><?php
echo xlt('Allow SMS'); ?
></option
>
221 <option value
="allow_voice" <?php
echo ($communication == "allow_voice") ?
"selected" : ""; ?
>><?php
echo xlt('Allow Voice Message'); ?
></option
>
222 <option value
="allow_mail" <?php
echo ($communication == "allow_mail") ?
"selected" : ""; ?
>><?php
echo xlt('Allow Mail Message'); ?
></option
>
223 <option value
="allow_email" <?php
echo ($communication == "allow_email") ?
"selected" : ""; ?
>><?php
echo xlt('Allow Email'); ?
></option
>
230 <td
class='control-label'><?php
echo xlt('Patient ID'); ?
>:</td
>
231 <td
><input name
='patient_id' class="numeric_only form-control" type
='text' id
="patient_id" title
='<?php echo xla('Optional
numeric patient ID
'); ?>' value
='<?php echo attr($patient_id); ?>' size
='10' maxlength
='20' /></td
>
232 <td
class='control-label'><?php
echo xlt('Age Range'); ?
>:</td
>
237 <td
class='control-label'>
238 <?php
echo xlt('From'); ?
>:
241 <input name
='age_from' class="numeric_only form-control" type
='text' id
="age_from" value
="<?php echo attr($age_from); ?>" size
='3' maxlength
='3' />
243 <td
class='control-label'>
244 <?php
echo xlt('To{{range}}'); ?
>:
247 <input name
='age_to' class="numeric_only form-control" type
='text' id
="age_to" value
="<?php echo attr($age_to); ?>" size
='3' maxlength
='3' />
253 <td
class='control-label'><?php
echo xlt('Gender'); ?
>:</td
>
254 <td colspan
="2"><?php
echo generate_select_list('gender', 'sex', $sql_gender, 'Select Gender', 'Unassigned', '', ''); ?
></td
>
260 <td height
="100%" valign
='middle' width
="175"><table style
='border-left:1px solid; width:100%; height:100%'>
263 <div
class="text-center">
264 <div
class="btn-group" role
="group">
265 <a href
='#' class='btn btn-default btn-save' onclick
='submitForm();'>
266 <?php
echo xlt('Submit'); ?
>
268 <?php
if (isset($_POST['form_refresh'])) {?
>
269 <a href
='#' class='btn btn-default btn-print' onclick
="printForm()">
270 <?php
echo xlt('Print'); ?
>
277 <div id
='processing' style
='display:none;' ><img src
='../pic/ajax-loader.gif'/></div
>
285 <!-- end of parameters
-->
288 // SQL scripts for the various searches
289 $sqlBindArray = array();
290 if ($_POST['form_refresh']) {
292 pd.date as patient_date,
293 concat(pd.lname, ', ', pd.fname) AS patient_name,
294 pd.pid AS patient_id,
295 DATE_FORMAT(FROM_DAYS(DATEDIFF('".date('Y-m-d H:i:s')."',pd.dob)), '%Y')+0 AS patient_age,
296 pd.sex AS patient_sex,
297 pd.race AS patient_race,pd.ethnicity AS patient_ethinic,
298 concat(u.lname, ', ', u.fname) AS users_provider";
300 $srch_option = $_POST['srch_option'];
301 switch ($srch_option) {
305 $sqlstmt=$sqlstmt.",li.date AS lists_date,
306 li.diagnosis AS lists_diagnosis,
307 li.title AS lists_title";
310 $sqlstmt = $sqlstmt.",pr.date AS procedure_result_date,
311 pr.facility AS procedure_result_facility,
312 pr.units AS procedure_result_units,
313 pr.result AS procedure_result_result,
314 pr.range AS procedure_result_range,
315 pr.abnormal AS procedure_result_abnormal,
316 pr.comments AS procedure_result_comments,
317 pr.document_id AS procedure_result_document_id";
319 case "Communication":
320 $sqlstmt = $sqlstmt.",REPLACE(REPLACE(concat_ws(',',IF(pd.hipaa_allowemail = 'YES', 'Allow Email','NO'),IF(pd.hipaa_allowsms = 'YES', 'Allow SMS','NO') , IF(pd.hipaa_mail = 'YES', 'Allow Mail Message','NO') , IF(pd.hipaa_voice = 'YES', 'Allow Voice Message','NO') ), ',NO',''), 'NO,','') as communications";
325 $sqlstmt=$sqlstmt." from patient_data as pd left outer join users as u on u.id = pd.providerid";
327 switch ($srch_option) {
329 $sqlstmt = $sqlstmt." left outer join lists as li on (li.pid = pd.pid AND li.type='medical_problem')";
332 $sqlstmt = $sqlstmt." left outer join lists as li on (li.pid = pd.pid AND (li.type='medication')) ";
335 $sqlstmt = $sqlstmt." left outer join lists as li on (li.pid = pd.pid AND (li.type='allergy')) ";
338 $sqlstmt = $sqlstmt." left outer join procedure_order as po on po.patient_id = pd.pid
339 left outer join procedure_order_code as pc on pc.procedure_order_id = po.procedure_order_id
340 left outer join procedure_report as pp on pp.procedure_order_id = po.procedure_order_id
341 left outer join procedure_type as pt on pt.procedure_code = pc.procedure_code and pt.lab_id = po.lab_id
342 left outer join procedure_result as pr on pr.procedure_report_id = pp.procedure_report_id";
346 //WHERE Conditions started
347 $whr_stmt="where 1=1";
348 switch ($srch_option) {
351 $whr_stmt=$whr_stmt." AND li.date >= ? AND li.date < DATE_ADD(?, INTERVAL 1 DAY) AND li.date <= ?";
352 array_push($sqlBindArray, $sql_date_from, $sql_date_to, date("Y-m-d H:i:s"));
355 $whr_stmt = $whr_stmt." AND li.title != '' ";
356 $whr_stmt=$whr_stmt." AND li.date >= ? AND li.date < DATE_ADD(?, INTERVAL 1 DAY) AND li.date <= ?";
357 array_push($sqlBindArray, $sql_date_from, $sql_date_to, date("Y-m-d H:i:s"));
360 $whr_stmt=$whr_stmt." AND pr.date >= ? AND pr.date < DATE_ADD(?, INTERVAL 1 DAY) AND pr.date <= ?";
361 $whr_stmt= $whr_stmt." AND (pr.result != '') ";
362 array_push($sqlBindArray, $sql_date_from, $sql_date_to, date("Y-m-d H:i:s"));
364 case "Communication":
365 $whr_stmt .= " AND (pd.hipaa_allowsms = 'YES' OR pd.hipaa_voice = 'YES' OR pd.hipaa_mail = 'YES' OR pd.hipaa_allowemail = 'YES') ";
369 if (strlen($patient_id) != 0) {
370 $whr_stmt = $whr_stmt." and pd.pid = ?";
371 array_push($sqlBindArray, $patient_id);
374 if (strlen($age_from) != 0) {
375 $whr_stmt = $whr_stmt." and DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(),pd.dob)), '%Y')+0 >= ?";
376 array_push($sqlBindArray, $age_from);
379 if (strlen($age_to) != 0) {
380 $whr_stmt = $whr_stmt." and DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(),pd.dob)), '%Y')+0 <= ?";
381 array_push($sqlBindArray, $age_to);
384 if (strlen($sql_gender) != 0) {
385 $whr_stmt = $whr_stmt." and pd.sex = ?";
386 array_push($sqlBindArray, $sql_gender);
389 if ($srch_option == "Communication" && strlen($communication) > 0) {
390 if ($communication == "allow_sms") {
391 $whr_stmt .= " AND pd.hipaa_allowsms = 'YES' ";
392 } else if ($communication == "allow_voice") {
393 $whr_stmt .= " AND pd.hipaa_voice = 'YES' ";
394 } else if ($communication == "allow_mail") {
395 $whr_stmt .= " AND pd.hipaa_mail = 'YES' ";
396 } else if ($communication == "allow_email") {
397 $whr_stmt .= " AND pd.hipaa_allowemail = 'YES' ";
401 //Sorting By filter fields
402 $sortby = $_REQUEST['sortby'];
403 $sortorder = $_REQUEST['sortorder'];
405 // This is for sorting the records.
406 switch ($srch_option) {
410 $sort = array("lists_date","lists_diagnosis","lists_title");
416 $sort = array("procedure_result_date","procedure_result_facility","procedure_result_units","procedure_result_result","procedure_result_range","procedure_result_abnormal");
417 //$odrstmt = " procedure_result_result";
419 case "Communication":
420 //$commsort = " ROUND((LENGTH(communications) - LENGTH(REPLACE(communications, ',', '')))/LENGTH(','))";
421 $sort = array("patient_date","patient_name","patient_id","patient_age","patient_sex","users_provider", "communications");
426 //$odrstmt = " ROUND((LENGTH(communications) - LENGTH(REPLACE(communications, ',', '')))/LENGTH(',')) , communications";
429 $sort = array("patient_date","patient_name","patient_id","patient_age","patient_sex","patient_race","patient_ethinic","users_provider");
437 if ($sortorder == "") {
441 for ($i = 0; $i < count($sort); $i++
) {
442 $sortlink[$i] = "<a href=\"#\" onclick=\"sortingCols('$sort[$i]','asc');\" ><img src=\"../../images/sortdown.gif\" border=0 alt=\"".xla('Sort Up')."\"></a>";
445 for ($i = 0; $i < count($sort); $i++
) {
446 if ($sortby == $sort[$i]) {
447 switch ($sortorder) {
449 $sortlink[$i] = "<a href=\"#\" onclick=\"sortingCols('$sortby','desc');\" ><img src=\"../../images/sortup.gif\" border=0 alt=\"".htmlspecialchars(xl('Sort Up'), ENT_QUOTES
)."\"></a>";
452 $sortlink[$i] = "<a href=\"#\" onclick=\"sortingCols('$sortby','asc');\" onclick=\"top.restoreSession()\"><img src=\"../../images/sortdown.gif\" border=0 alt=\"".xla('Sort Down')."\"></a>";
458 switch ($srch_option) {
462 $odrstmt = " ORDER BY lists_date asc";
465 $odrstmt = " ORDER BY procedure_result_date asc";
467 case "Communication":
468 $odrstmt = "ORDER BY ROUND((LENGTH(communications) - LENGTH(REPLACE(communications, ',', '')))/LENGTH(',')) asc, communications asc";
471 $odrstmt = " ORDER BY patient_date asc";
472 //$odrstmt = " ROUND((LENGTH(communications) - LENGTH(REPLACE(communications, ',', '')))/LENGTH(',')) , communications";
476 if (!empty($_REQUEST['sortby']) && !empty($_REQUEST['sortorder'])) {
477 if ($_REQUEST['sortby'] =="communications") {
478 $odrstmt = "ORDER BY ROUND((LENGTH(communications) - LENGTH(REPLACE(communications, ',', '')))/LENGTH(',')) ".escape_sort_order($_REQUEST['sortorder']).", communications ".escape_sort_order($_REQUEST['sortorder']);
480 $odrstmt = "ORDER BY ".escape_identifier($_REQUEST['sortby'], $sort, true)." ".escape_sort_order($_REQUEST['sortorder']);
484 $sqlstmt=$sqlstmt." ".$whr_stmt." ".$odrstmt;
485 //echo $sqlstmt."<hr>";
486 $result = sqlStatement($sqlstmt, $sqlBindArray);
488 $row_id = 1.1;//given to each row to identify and toggle
492 if (sqlNumRows($result) > 0) {
495 $patDataArr = array();
496 $smoke_codes_arr = getSmokeCodes();
497 while ($row = sqlFetchArray($result)) {
498 $patArr[] = $row['patient_id'];
499 $patInfoArr = array();
500 $patInfoArr['patient_id'] = $row['patient_id'];
502 if ($srch_option == "Medications" ||
$srch_option == "Allergies" ||
$srch_option == "Problems") {
503 $patInfoArr['lists_date'] = $row['lists_date'];
504 $patInfoArr['lists_diagnosis'] = $row['lists_diagnosis'];
505 $patInfoArr['lists_title'] = $row['lists_title'];
506 $patInfoArr['patient_name'] = $row['patient_name'];
507 $patInfoArr['patient_age'] = $row['patient_age'];
508 $patInfoArr['patient_sex'] = $row['patient_sex'];
509 $patInfoArr['patient_race'] = $row['patient_race'];
510 $patInfoArr['patient_ethinic'] = $row['patient_ethinic'];
511 $patInfoArr['users_provider'] = $row['users_provider'];
512 } elseif ($srch_option == "Lab results") {
513 $patInfoArr['procedure_result_date'] = $row['procedure_result_date'];
514 $patInfoArr['procedure_result_facility'] = $row['procedure_result_facility'];
515 $patInfoArr['procedure_result_units'] = $row['procedure_result_units'];
516 $patInfoArr['procedure_result_result'] = $row['procedure_result_result'];
517 $patInfoArr['procedure_result_range'] = $row['procedure_result_range'];
518 $patInfoArr['procedure_result_abnormal'] = $row['procedure_result_abnormal'];
519 $patInfoArr['procedure_result_comments'] = $row['procedure_result_comments'];
520 $patInfoArr['procedure_result_document_id'] = $row['procedure_result_document_id'];
521 } elseif ($srch_option == "Communication") {
522 $patInfoArr['patient_date'] = $row['patient_date'];
523 $patInfoArr['patient_name'] = $row['patient_name'];
524 $patInfoArr['patient_age'] = $row['patient_age'];
525 $patInfoArr['patient_sex'] = $row['patient_sex'];
526 $patInfoArr['users_provider'] = $row['users_provider'];
527 $patInfoArr['communications'] = $row['communications'];
528 } elseif ($srch_option == "Demographics") {
529 $patInfoArr['patient_date'] = $row['patient_date'];
530 $patInfoArr['patient_name'] = $row['patient_name'];
531 $patInfoArr['patient_age'] = $row['patient_age'];
532 $patInfoArr['patient_sex'] = $row['patient_sex'];
533 $patInfoArr['patient_race'] = $row['patient_race'];
534 $patInfoArr['patient_ethinic'] = $row['patient_ethinic'];
535 $patInfoArr['users_provider'] = $row['users_provider'];
538 $patFinalDataArr[] = $patInfoArr;
544 <input type
="hidden" name
="sortby" id
="sortby" value
="<?php echo attr($sortby); ?>" />
545 <input type
="hidden" name
="sortorder" id
="sortorder" value
="<?php echo attr($sortorder); ?>" />
546 <div id
= "report_results">
549 <td
class="text"><strong
><?php
echo xlt('Total Number of Patients')?
>:</strong
> 
;<span id
="total_patients"><?php
echo attr(count(array_unique($patArr)));?
></span
></td
>
553 <table width
=90% align
="center" cellpadding
="5" cellspacing
="0" style
="font-family:tahoma;color:black;" border
="0">
556 if ($srch_option == "Medications" ||
$srch_option == "Allergies" ||
$srch_option == "Problems") { ?
>
557 <tr style
="font-size:15px;">
558 <td width
="15%"><b
><?php
echo xlt('Diagnosis Date'); ?
><?php
echo $sortlink[0]; ?
></b
></td
>
559 <td width
="15%"><b
><?php
echo xlt('Diagnosis'); ?
><?php
echo $sortlink[1]; ?
></b
></td
>
560 <td width
="15%"><b
><?php
echo xlt('Diagnosis Name');?
><?php
echo $sortlink[2]; ?
></b
></td
>
561 <td width
="15%"><b
><?php
echo xlt('Patient Name'); ?
></b
></td
>
562 <td width
="5%"><b
><?php
echo xlt('PID');?
></b
></td
>
563 <td width
="5%"><b
><?php
echo xlt('Age');?
></b
></td
>
564 <td width
="10%"><b
><?php
echo xlt('Gender');?
></b
></td
>
565 <td colspan
=4><b
><?php
echo xlt('Provider');?
></b
></td
>
567 <?php
foreach ($patFinalDataArr as $patKey => $patDetailVal) { ?
>
568 <tr bgcolor
= "#CCCCCC" style
="font-size:15px;">
569 <td
><?php
echo text(oeFormatDateTime($patDetailVal['lists_date'], "global", true)); ?
></td
>
570 <td
><?php
echo text($patDetailVal['lists_diagnosis']); ?
></td
>
571 <td
><?php
echo text($patDetailVal['lists_title']); ?
></td
>
572 <td
><?php
echo text($patDetailVal['patient_name']); ?
></td
>
573 <td
><?php
echo text($patDetailVal['patient_id']); ?
></td
>
574 <td
><?php
echo text($patDetailVal['patient_age']);?
></td
>
575 <td
><?php
echo text($patDetailVal['patient_sex']);?
></td
>
576 <td colspan
=4><?php
echo text($patDetailVal['users_provider']);?
></td
>
579 } elseif ($srch_option == "Lab results") { ?
>
580 <tr bgcolor
="#C3FDB8" align
= "left" >
581 <td width
="15%"><b
><?php
echo xlt('Date'); ?
><?php
echo $sortlink[0]; ?
></b
></td
>
582 <td width
="15%"><b
><?php
echo xlt('Facility');?
><?php
echo $sortlink[1]; ?
></b
></td
>
583 <td width
="10%"><b
><?php
echo xlt('Unit');?
></b
><?php
echo $sortlink[2]; ?
></td
>
584 <td width
="10%"><b
><?php
echo xlt('Result');?
></b
><?php
echo $sortlink[3]; ?
></td
>
585 <td width
="10%"><b
><?php
echo xlt('Range');?
></b
><?php
echo $sortlink[4]; ?
></td
>
586 <td width
="10%"><b
><?php
echo xlt('Abnormal');?
><?php
echo $sortlink[5]; ?
></b
></td
>
587 <td
><b
><?php
echo xlt('Comments');?
></b
></td
>
588 <td width
="5%"><b
><?php
echo xlt('Document ID');?
></b
></td
>
589 <td width
="5%"><b
><?php
echo xlt('PID');?
></b
></td
>
592 foreach ($patFinalDataArr as $patKey => $labResInsideArr) {?
>
593 <tr bgcolor
= "#CCCCCC" >
594 <td
> <?php
echo text(oeFormatDateTime($labResInsideArr['procedure_result_date'], "global", true));?
> 
;</td
>
595 <td
> <?php
echo text($labResInsideArr['procedure_result_facility'], ENT_NOQUOTES
); ?
> 
;</td
>
596 <td
> <?php
echo generate_display_field(array('data_type'=>'1','list_id'=>'proc_unit'), $labResInsideArr['procedure_result_units']); ?
> 
;</td
>
597 <td
> <?php
echo text($labResInsideArr['procedure_result_result']); ?
> 
;</td
>
598 <td
> <?php
echo text($labResInsideArr['procedure_result_range']); ?
> 
;</td
>
599 <td
> <?php
echo text($labResInsideArr['procedure_result_abnormal']); ?
> 
;</td
>
600 <td
> <?php
echo text($labResInsideArr['procedure_result_comments']); ?
> 
;</td
>
601 <td
> <?php
echo text($labResInsideArr['procedure_result_document_id']); ?
> 
;</td
>
602 <td colspan
="3"> <?php
echo text($labResInsideArr['patient_id']); ?
> 
;</td
>
606 } elseif ($srch_option == "Communication") { ?
>
607 <tr style
="font-size:15px;">
608 <td width
="15%"><b
><?php
echo xlt('Date'); ?
></b
><?php
echo $sortlink[0]; ?
></td
>
609 <td width
="20%"><b
><?php
echo xlt('Patient Name'); ?
></b
><?php
echo $sortlink[1]; ?
></td
>
610 <td width
="5%"><b
><?php
echo xlt('PID');?
></b
><?php
echo $sortlink[2]; ?
></td
>
611 <td width
="5%"><b
><?php
echo xlt('Age');?
></b
><?php
echo $sortlink[3]; ?
></td
>
612 <td width
="10%"><b
><?php
echo xlt('Gender');?
></b
><?php
echo $sortlink[4]; ?
></td
>
613 <td width
="15%"><b
><?php
echo xlt('Provider');?
></b
><?php
echo $sortlink[5]; ?
></td
>
614 <td
><b
><?php
echo xlt('Communication');?
></b
><?php
echo $sortlink[6]; ?
></td
>
616 <?php
foreach ($patFinalDataArr as $patKey => $patDetailVal) { ?
>
617 <tr bgcolor
= "#CCCCCC" >
618 <td
><?php
echo ($patDetailVal['patient_date'] != '') ?
text(oeFormatDateTime($patDetailVal['patient_date'], "global", true)) : ""; ?
></td
>
619 <td
><?php
echo text($patDetailVal['patient_name']); ?
></td
>
620 <td
><?php
echo text($patDetailVal['patient_id']); ?
></td
>
621 <td
><?php
echo text($patDetailVal['patient_age']);?
></td
>
622 <td
><?php
echo text($patDetailVal['patient_sex']);?
></td
>
623 <td
><?php
echo text($patDetailVal['users_provider']);?
></td
>
624 <td
><?php
echo text($patDetailVal['communications']);?
></td
>
627 } elseif ($srch_option == "Demographics") { ?
>
628 <tr style
="font-size:15px;">
629 <td width
="15%"><b
><?php
echo xlt('Date'); ?
></b
><?php
echo $sortlink[0]; ?
></td
>
630 <td width
="20%"><b
><?php
echo xlt('Patient Name'); ?
></b
><?php
echo $sortlink[1]; ?
></td
>
631 <td width
="15%"><b
><?php
echo xlt('PID');?
></b
><?php
echo $sortlink[2]; ?
></td
>
632 <td width
="5%"><b
><?php
echo xlt('Age');?
></b
><?php
echo $sortlink[3]; ?
></td
>
633 <td width
="10%"><b
><?php
echo xlt('Gender'); ?
></b
><?php
echo $sortlink[4]; ?
></td
>
634 <td width
="20%"><b
><?php
echo xlt('Race');?
></b
><?php
echo $sortlink[5]; ?
></td
>
635 <td colspan
=5><b
><?php
echo xlt('Provider');?
></b
><?php
echo $sortlink[7]; ?
></td
>
637 <?php
foreach ($patFinalDataArr as $patKey => $patDetailVal) { ?
>
638 <tr bgcolor
= "#CCCCCC" style
="font-size:15px;">
639 <td
><?php
echo ($patDetailVal['patient_date'] != '') ?
text(oeFormatDateTime($patDetailVal['patient_date'], "global", true)) : ""; ?
></td
>
640 <td
><?php
echo text($patDetailVal['patient_name']); ?
></td
>
641 <td
><?php
echo text($patDetailVal['patient_id']); ?
></td
>
642 <td
><?php
echo text($patDetailVal['patient_age']);?
></td
>
643 <td
><?php
echo text($patDetailVal['patient_sex']);?
></td
>
644 <td
><?php
echo generate_display_field(array('data_type'=>'36','list_id'=>'race'), $patDetailVal['patient_race']); ?
></td
>
645 <td colspan
=5><?php
echo text($patDetailVal['users_provider']);?
></td
>
651 <!-- Main table ends
-->
653 } else {//End if $result?>
656 <td
class="text"> 
; 
;<?php
echo xlt('No records found.')?
></td
>
665 } else {//End if form_refresh
666 ?
><div
class='text'> <?php
echo xlt('Please input search criteria above, and click Submit to view results.'); ?
> </div
><?php