3 * This report lists all the demographics allergies,problems,drugs and lab results
5 * Copyright (C) 2014 Ensoftek, Inc
6 * Copyright (C) 2017 Brady Miller <brady.g.miller@gmail.com>
8 * LICENSE: This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 3
11 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
20 * @author Brady Miller <brady.g.miller@gmail.com>
21 * @link http://www.open-emr.org
24 use OpenEMR\Core\Header
;
26 require_once("../globals.php");
27 require_once("$srcdir/patient.inc");
28 require_once("$srcdir/options.inc.php");
29 require_once("../drugs/drugs.inc.php");
30 require_once("$srcdir/payment_jav.inc.php");
32 $search_options = array("Demographics"=>xl("Demographics"),"Problems"=>xl("Problems"),"Medications"=>xl("Medications"),"Allergies"=>xl("Allergies"),"Lab results"=>xl("Lab Results"),"Communication"=>xl("Communication"));
33 $comarr = array("allow_sms"=>xl("Allow SMS"),"allow_voice"=>xl("Allow Voice Message"),"allow_mail"=>xl("Allow Mail Message"),"allow_email"=>xl("Allow Email"));
34 $_POST['form_details'] = true;
35 function add_date($givendate, $day = 0, $mth = 0, $yr = 0)
37 $cd = strtotime($givendate);
38 $newdate = date('Y-m-d H:i:s', mktime(
48 if ($_POST['date_from'] != "") {
49 $sql_date_from = $_POST['date_from'];
51 $sql_date_from = fixDate($_POST['date_from'], date('Y-01-01 H:i:s'));
54 if ($_POST['date_to'] != "") {
55 $sql_date_to = $_POST['date_to'];
57 $sql_date_to = fixDate($_POST['date_to'], add_date(date('Y-m-d H:i:s')));
60 //echo "<pre>";print_r($_POST);
61 $patient_id = trim($_POST["patient_id"]);
62 $age_from = $_POST["age_from"];
63 $age_to = $_POST["age_to"];
64 $sql_gender = $_POST["gender"];
65 $sql_ethnicity = $_POST["cpms_ethnicity"];
66 $sql_race=$_POST["race"];
67 $form_drug_name = trim($_POST["form_drug_name"]);
68 $form_diagnosis = trim($_POST["form_diagnosis"]);
69 $form_lab_results = trim($_POST["form_lab_results"]);
70 $form_service_codes = trim($_POST["form_service_codes"]);
71 $form_immunization = trim($_POST["form_immunization"]);
72 $communication = trim($_POST["communication"]);
78 <?php
echo xlt('Patient List Creation'); ?
>
81 <?php Header
::setupHeader(['datetime-picker', 'report-helper']); ?
>
83 <script language
="JavaScript">
84 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
85 var global_date_format
= '%Y-%m-%d';
87 function Form_Validate() {
88 var d
= document
.forms
[0];
89 FromDate
= d
.date_from
.value
;
90 ToDate
= d
.date_to
.value
;
91 if ( (FromDate
.length
> 0) && (ToDate
.length
> 0) ) {
92 if ( FromDate
> ToDate
){
93 alert("<?php echo xls('To date must be later than From date!'); ?>");
97 $
("#processing").show();
103 <style type
="text/css">
104 /* specifically include & exclude from printing */
110 #report_parameters_daterange {
114 #report_results table {
123 /* specifically exclude some from the screen */
125 #report_parameters_daterange {
132 <script language
="javascript" type
="text/javascript">
134 function submitForm() {
135 var d_from
= new String($
('#date_from').val());
136 var d_to
= new String($
('#date_to').val());
138 var d_from_arr
= d_from
.split('-');
139 var d_to_arr
= d_to
.split('-');
141 var dt_from
= new Date(d_from_arr
[0], d_from_arr
[1], d_from_arr
[2]);
142 var dt_to
= new Date(d_to_arr
[0], d_to_arr
[1], d_to_arr
[2]);
144 var mili_from
= dt_from
.getTime();
145 var mili_to
= dt_to
.getTime();
146 var diff
= mili_to
- mili_from
;
148 $
('#date_error').css("display", "none");
150 if(diff
< 0) //negative
152 $
('#date_error').css("display", "inline");
156 $
("#form_refresh").attr("value","true");
157 top
.restoreSession();
158 $
("#theform").submit();
163 function sortingCols(sort_by
,sort_order
)
165 $
("#sortby").val(sort_by
);
166 $
("#sortorder").val(sort_order
);
167 $
("#form_refresh").attr("value","true");
168 $
("#theform").submit();
171 $
(document
).ready(function() {
172 $
(".numeric_only").keydown(function(event
) {
173 //alert(event.keyCode);
174 // Allow only backspace and delete
175 if ( event
.keyCode
== 46 || event
.keyCode
== 8 ) {
176 // let it happen, don't do anything
179 if(!((event
.keyCode
>= 96 && event
.keyCode
<= 105) ||
(event
.keyCode
>= 48 && event
.keyCode
<= 57)))
181 event
.preventDefault();
185 <?php
if ($_POST['srch_option'] == "Communication") { ?
>
186 $
('#com_pref').show();
189 $
('.datetimepicker').datetimepicker({
190 <?php
$datetimepicker_timepicker = true; ?
>
191 <?php
$datetimepicker_showseconds = true; ?
>
192 <?php
$datetimepicker_formatInput = false; ?
>
193 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
194 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
198 function printForm(){
199 var win
= top
.printLogPrint ? top
: opener
.top
;
200 win
.printLogPrint(window
);
205 <body
class="body_top">
206 <!-- Required
for the popup date selectors
-->
207 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
209 <?php
echo xlt('Report - Patient List Creation');?
>
211 <!-- Search can be done using age range
, gender
, and ethnicity filters
.
212 Search options
include diagnosis
, procedure
, prescription
, medical history
, and lab results
.
215 <div id
="report_parameters_daterange">
217 <?php
echo "<span style='margin-left:5px;'><b>".xlt('Date Range').":</b> ".text(date($sql_date_from, strtotime($sql_date_from))) .
218 " to ". text(date($sql_date_to, strtotime($sql_date_to)))."</span>"; ?
>
219 <span style
="margin-left:5px; " ><b
><?php
echo xlt('Option'); ?
>:</b
> 
;<?php
echo text($_POST['srch_option']);
220 if ($_POST['srch_option'] == "Communication" && $_POST['communication'] != "") {
221 if (isset($comarr[$_POST['communication']])) {
222 echo "(".text($comarr[$_POST['communication']]).")";
224 echo "(".xlt('All').")";
229 <form name
='theform' id
='theform' method
='post' action
='patient_list_creation.php' onSubmit
="return Form_Validate();">
230 <div id
="report_parameters">
231 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>
235 <div
class="cancel-float" style
='float:left'>
238 <td
class='control-label' ><?php
echo xlt('From'); ?
>: </td
>
239 <td
><input type
='text' class='datetimepicker form-control' name
='date_from' id
="date_from" size
='18' value
='<?php echo attr($sql_date_from); ?>' title
='<?php echo attr($title_tooltip) ?>'>
241 <td
class='control-label'><?php
echo xlt('To{{range}}'); ?
>: </td
>
242 <td
><input type
='text' class='datetimepicker form-control' name
='date_to' id
="date_to" size
='18' value
='<?php echo attr($sql_date_to); ?>' title
='<?php echo attr($title_tooltip) ?>'>
244 <td
class='control-label'><?php
echo xlt('Option'); ?
>: </td
>
245 <td
class='control-label'>
246 <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();}">
247 <?php
foreach ($search_options as $skey => $svalue) { ?
>
248 <option
<?php
if ($_POST['srch_option'] == $skey) {
250 } ?
> value
="<?php echo attr($skey); ?>"><?php
echo text($svalue); ?
></option
>
257 <span id
="com_pref" style
="display:none">
258 <select
class="form-control" name
="communication" id
="communication" title
="<?php echo xlt('Select Communication Preferences'); ?>">
259 <option
> <?php
echo xlt('All'); ?
></option
>
260 <option value
="allow_sms" <?php
if ($communication == "allow_sms") {
262 }?
>><?php
echo xlt('Allow SMS'); ?
></option
>
263 <option value
="allow_voice" <?php
if ($communication == "allow_voice") {
265 }?
>><?php
echo xlt('Allow Voice Message'); ?
></option
>
266 <option value
="allow_mail" <?php
if ($communication == "allow_mail") {
268 }?
>><?php
echo xlt('Allow Mail Message'); ?
></option
>
269 <option value
="allow_email" <?php
if ($communication == "allow_email") {
271 }?
>><?php
echo xlt('Allow Email'); ?
></option
>
278 <td
class='control-label'><?php
echo xlt('Patient ID'); ?
>:</td
>
279 <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
>
280 <td
class='control-label'><?php
echo xlt('Age Range'); ?
>:</td
>
285 <td
class='control-label'>
286 <?php
echo xlt('From'); ?
>:
289 <input name
='age_from' class="numeric_only form-control" type
='text' id
="age_from" value
="<?php echo attr($age_from); ?>" size
='3' maxlength
='3' />
291 <td
class='control-label'>
292 <?php
echo xlt('To{{range}}'); ?
>:
295 <input name
='age_to' class="numeric_only form-control" type
='text' id
="age_to" value
="<?php echo attr($age_to); ?>" size
='3' maxlength
='3' />
301 <td
class='control-label'><?php
echo xlt('Gender'); ?
>:</td
>
302 <td colspan
="2"><?php
echo generate_select_list('gender', 'sex', $sql_gender, 'Select Gender', 'Unassigned', '', ''); ?
></td
>
308 <td height
="100%" valign
='middle' width
="175"><table style
='border-left:1px solid; width:100%; height:100%'>
311 <div
class="text-center">
312 <div
class="btn-group" role
="group">
313 <a href
='#' class='btn btn-default btn-save' onclick
='submitForm();'>
314 <?php
echo xlt('Submit'); ?
>
316 <?php
if (isset($_POST['form_refresh'])) {?
>
317 <a href
='#' class='btn btn-default btn-print' onclick
="printForm()">
318 <?php
echo xlt('Print'); ?
>
325 <div id
='processing' style
='display:none;' ><img src
='../pic/ajax-loader.gif'/></div
>
333 <!-- end of parameters
-->
336 // SQL scripts for the various searches
337 $sqlBindArray = array();
338 if ($_POST['form_refresh']) {
340 pd.date as patient_date,
341 concat(pd.lname, ', ', pd.fname) AS patient_name,
342 pd.pid AS patient_id,
343 DATE_FORMAT(FROM_DAYS(DATEDIFF('".date('Y-m-d H:i:s')."',pd.dob)), '%Y')+0 AS patient_age,
344 pd.sex AS patient_sex,
345 pd.race AS patient_race,pd.ethnicity AS patient_ethinic,
346 concat(u.lname, ', ', u.fname) AS users_provider";
348 $srch_option = $_POST['srch_option'];
349 switch ($srch_option) {
353 $sqlstmt=$sqlstmt.",li.date AS lists_date,
354 li.diagnosis AS lists_diagnosis,
355 li.title AS lists_title";
358 $sqlstmt = $sqlstmt.",pr.date AS procedure_result_date,
359 pr.facility AS procedure_result_facility,
360 pr.units AS procedure_result_units,
361 pr.result AS procedure_result_result,
362 pr.range AS procedure_result_range,
363 pr.abnormal AS procedure_result_abnormal,
364 pr.comments AS procedure_result_comments,
365 pr.document_id AS procedure_result_document_id";
367 case "Communication":
368 $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";
373 $sqlstmt=$sqlstmt." from patient_data as pd left outer join users as u on u.id = pd.providerid";
375 switch ($srch_option) {
377 $sqlstmt = $sqlstmt." left outer join lists as li on (li.pid = pd.pid AND li.type='medical_problem')";
380 $sqlstmt = $sqlstmt." left outer join lists as li on (li.pid = pd.pid AND (li.type='medication')) ";
383 $sqlstmt = $sqlstmt." left outer join lists as li on (li.pid = pd.pid AND (li.type='allergy')) ";
386 $sqlstmt = $sqlstmt." left outer join procedure_order as po on po.patient_id = pd.pid
387 left outer join procedure_order_code as pc on pc.procedure_order_id = po.procedure_order_id
388 left outer join procedure_report as pp on pp.procedure_order_id = po.procedure_order_id
389 left outer join procedure_type as pt on pt.procedure_code = pc.procedure_code and pt.lab_id = po.lab_id
390 left outer join procedure_result as pr on pr.procedure_report_id = pp.procedure_report_id";
394 //WHERE Conditions started
395 $whr_stmt="where 1=1";
396 switch ($srch_option) {
399 $whr_stmt=$whr_stmt." AND li.date >= ? AND li.date < DATE_ADD(?, INTERVAL 1 DAY) AND li.date <= ?";
400 array_push($sqlBindArray, $sql_date_from, $sql_date_to, date("Y-m-d H:i:s"));
403 $whr_stmt = $whr_stmt." AND li.title != '' ";
404 $whr_stmt=$whr_stmt." AND li.date >= ? AND li.date < DATE_ADD(?, INTERVAL 1 DAY) AND li.date <= ?";
405 array_push($sqlBindArray, $sql_date_from, $sql_date_to, date("Y-m-d H:i:s"));
408 $whr_stmt=$whr_stmt." AND pr.date >= ? AND pr.date < DATE_ADD(?, INTERVAL 1 DAY) AND pr.date <= ?";
409 $whr_stmt= $whr_stmt." AND (pr.result != '') ";
410 array_push($sqlBindArray, $sql_date_from, $sql_date_to, date("Y-m-d H:i:s"));
412 case "Communication":
413 $whr_stmt .= " AND (pd.hipaa_allowsms = 'YES' OR pd.hipaa_voice = 'YES' OR pd.hipaa_mail = 'YES' OR pd.hipaa_allowemail = 'YES') ";
417 if (strlen($patient_id) != 0) {
418 $whr_stmt = $whr_stmt." and pd.pid = ?";
419 array_push($sqlBindArray, $patient_id);
422 if (strlen($age_from) != 0) {
423 $whr_stmt = $whr_stmt." and DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(),pd.dob)), '%Y')+0 >= ?";
424 array_push($sqlBindArray, $age_from);
427 if (strlen($age_to) != 0) {
428 $whr_stmt = $whr_stmt." and DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(),pd.dob)), '%Y')+0 <= ?";
429 array_push($sqlBindArray, $age_to);
432 if (strlen($sql_gender) != 0) {
433 $whr_stmt = $whr_stmt." and pd.sex = ?";
434 array_push($sqlBindArray, $sql_gender);
437 if ($srch_option == "Communication" && strlen($communication) > 0) {
438 if ($communication == "allow_sms") {
439 $whr_stmt .= " AND pd.hipaa_allowsms = 'YES' ";
440 } else if ($communication == "allow_voice") {
441 $whr_stmt .= " AND pd.hipaa_voice = 'YES' ";
442 } else if ($communication == "allow_mail") {
443 $whr_stmt .= " AND pd.hipaa_mail = 'YES' ";
444 } else if ($communication == "allow_email") {
445 $whr_stmt .= " AND pd.hipaa_allowemail = 'YES' ";
449 //Sorting By filter fields
450 $sortby = $_REQUEST['sortby'];
451 $sortorder = $_REQUEST['sortorder'];
453 // This is for sorting the records.
454 switch ($srch_option) {
458 $sort = array("lists_date","lists_diagnosis","lists_title");
464 $sort = array("procedure_result_date","procedure_result_facility","procedure_result_units","procedure_result_result","procedure_result_range","procedure_result_abnormal");
465 //$odrstmt = " procedure_result_result";
467 case "Communication":
468 //$commsort = " ROUND((LENGTH(communications) - LENGTH(REPLACE(communications, ',', '')))/LENGTH(','))";
469 $sort = array("patient_date","patient_name","patient_id","patient_age","patient_sex","users_provider", "communications");
474 //$odrstmt = " ROUND((LENGTH(communications) - LENGTH(REPLACE(communications, ',', '')))/LENGTH(',')) , communications";
477 $sort = array("patient_date","patient_name","patient_id","patient_age","patient_sex","patient_race","patient_ethinic","users_provider");
485 if ($sortorder == "") {
489 for ($i = 0; $i < count($sort); $i++
) {
490 $sortlink[$i] = "<a href=\"#\" onclick=\"sortingCols('$sort[$i]','asc');\" ><img src=\"../../images/sortdown.gif\" border=0 alt=\"".xla('Sort Up')."\"></a>";
493 for ($i = 0; $i < count($sort); $i++
) {
494 if ($sortby == $sort[$i]) {
495 switch ($sortorder) {
497 $sortlink[$i] = "<a href=\"#\" onclick=\"sortingCols('$sortby','desc');\" ><img src=\"../../images/sortup.gif\" border=0 alt=\"".htmlspecialchars(xl('Sort Up'), ENT_QUOTES
)."\"></a>";
500 $sortlink[$i] = "<a href=\"#\" onclick=\"sortingCols('$sortby','asc');\" onclick=\"top.restoreSession()\"><img src=\"../../images/sortdown.gif\" border=0 alt=\"".xla('Sort Down')."\"></a>";
506 switch ($srch_option) {
510 $odrstmt = " ORDER BY lists_date asc";
513 $odrstmt = " ORDER BY procedure_result_date asc";
515 case "Communication":
516 $odrstmt = "ORDER BY ROUND((LENGTH(communications) - LENGTH(REPLACE(communications, ',', '')))/LENGTH(',')) asc, communications asc";
519 $odrstmt = " ORDER BY patient_date asc";
520 //$odrstmt = " ROUND((LENGTH(communications) - LENGTH(REPLACE(communications, ',', '')))/LENGTH(',')) , communications";
524 if (!empty($_REQUEST['sortby']) && !empty($_REQUEST['sortorder'])) {
525 if ($_REQUEST['sortby'] =="communications") {
526 $odrstmt = "ORDER BY ROUND((LENGTH(communications) - LENGTH(REPLACE(communications, ',', '')))/LENGTH(',')) ".escape_sort_order($_REQUEST['sortorder']).", communications ".escape_sort_order($_REQUEST['sortorder']);
528 $odrstmt = "ORDER BY ".escape_identifier($_REQUEST['sortby'], $sort, true)." ".escape_sort_order($_REQUEST['sortorder']);
532 $sqlstmt=$sqlstmt." ".$whr_stmt." ".$odrstmt;
533 //echo $sqlstmt."<hr>";
534 $result = sqlStatement($sqlstmt, $sqlBindArray);
536 $row_id = 1.1;//given to each row to identify and toggle
540 if (sqlNumRows($result) > 0) {
543 $patDataArr = array();
544 $smoke_codes_arr = getSmokeCodes();
545 while ($row = sqlFetchArray($result)) {
546 $patArr[] = $row['patient_id'];
547 $patInfoArr = array();
548 $patInfoArr['patient_id'] = $row['patient_id'];
550 if ($srch_option == "Medications" ||
$srch_option == "Allergies" ||
$srch_option == "Problems") {
551 $patInfoArr['lists_date'] = $row['lists_date'];
552 $patInfoArr['lists_diagnosis'] = $row['lists_diagnosis'];
553 $patInfoArr['lists_title'] = $row['lists_title'];
554 $patInfoArr['patient_name'] = $row['patient_name'];
555 $patInfoArr['patient_age'] = $row['patient_age'];
556 $patInfoArr['patient_sex'] = $row['patient_sex'];
557 $patInfoArr['patient_race'] = $row['patient_race'];
558 $patInfoArr['patient_ethinic'] = $row['patient_ethinic'];
559 $patInfoArr['users_provider'] = $row['users_provider'];
560 } elseif ($srch_option == "Lab results") {
561 $patInfoArr['procedure_result_date'] = $row['procedure_result_date'];
562 $patInfoArr['procedure_result_facility'] = $row['procedure_result_facility'];
563 $patInfoArr['procedure_result_units'] = $row['procedure_result_units'];
564 $patInfoArr['procedure_result_result'] = $row['procedure_result_result'];
565 $patInfoArr['procedure_result_range'] = $row['procedure_result_range'];
566 $patInfoArr['procedure_result_abnormal'] = $row['procedure_result_abnormal'];
567 $patInfoArr['procedure_result_comments'] = $row['procedure_result_comments'];
568 $patInfoArr['procedure_result_document_id'] = $row['procedure_result_document_id'];
569 } elseif ($srch_option == "Communication") {
570 $patInfoArr['patient_date'] = $row['patient_date'];
571 $patInfoArr['patient_name'] = $row['patient_name'];
572 $patInfoArr['patient_age'] = $row['patient_age'];
573 $patInfoArr['patient_sex'] = $row['patient_sex'];
574 $patInfoArr['users_provider'] = $row['users_provider'];
575 $patInfoArr['communications'] = $row['communications'];
576 } elseif ($srch_option == "Demographics") {
577 $patInfoArr['patient_date'] = $row['patient_date'];
578 $patInfoArr['patient_name'] = $row['patient_name'];
579 $patInfoArr['patient_age'] = $row['patient_age'];
580 $patInfoArr['patient_sex'] = $row['patient_sex'];
581 $patInfoArr['patient_race'] = $row['patient_race'];
582 $patInfoArr['patient_ethinic'] = $row['patient_ethinic'];
583 $patInfoArr['users_provider'] = $row['users_provider'];
586 $patFinalDataArr[] = $patInfoArr;
594 <input type
="hidden" name
="sortby" id
="sortby" value
="<?php echo attr($sortby); ?>" />
595 <input type
="hidden" name
="sortorder" id
="sortorder" value
="<?php echo attr($sortorder); ?>" />
596 <div id
= "report_results">
599 <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
>
603 <table width
=90% align
="center" cellpadding
="5" cellspacing
="0" style
="font-family:tahoma;color:black;" border
="0">
605 <?php
if ($srch_option == "Medications" ||
$srch_option == "Allergies" ||
$srch_option == "Problems") { ?
>
606 <tr style
="font-size:15px;">
607 <td width
="15%"><b
><?php
echo xlt('Diagnosis Date'); ?
><?php
echo $sortlink[0]; ?
></b
></td
>
608 <td width
="15%"><b
><?php
echo xlt('Diagnosis'); ?
><?php
echo $sortlink[1]; ?
></b
></td
>
609 <td width
="15%"><b
><?php
echo xlt('Diagnosis Name');?
><?php
echo $sortlink[2]; ?
></b
></td
>
610 <td width
="15%"><b
><?php
echo xlt('Patient Name'); ?
></b
></td
>
611 <td width
="5%"><b
><?php
echo xlt('PID');?
></b
></td
>
612 <td width
="5%"><b
><?php
echo xlt('Age');?
></b
></td
>
613 <td width
="10%"><b
><?php
echo xlt('Gender');?
></b
></td
>
614 <td colspan
=4><b
><?php
echo xlt('Provider');?
></b
></td
>
616 <?php
foreach ($patFinalDataArr as $patKey => $patDetailVal) { ?
>
617 <tr bgcolor
= "#CCCCCC" style
="font-size:15px;">
618 <td
><?php
echo text($patDetailVal['lists_date']); ?
></td
>
619 <td
><?php
echo text($patDetailVal['lists_diagnosis']); ?
></td
>
620 <td
><?php
echo text($patDetailVal['lists_title']); ?
></td
>
621 <td
><?php
echo text($patDetailVal['patient_name']); ?
></td
>
622 <td
><?php
echo text($patDetailVal['patient_id']); ?
></td
>
623 <td
><?php
echo text($patDetailVal['patient_age']);?
></td
>
624 <td
><?php
echo text($patDetailVal['patient_sex']);?
></td
>
625 <td colspan
=4><?php
echo text($patDetailVal['users_provider']);?
></td
>
628 } elseif ($srch_option == "Lab results") { ?
>
629 <tr bgcolor
="#C3FDB8" align
= "left" >
630 <td width
="15%"><b
><?php
echo xlt('Date'); ?
><?php
echo $sortlink[0]; ?
></b
></td
>
631 <td width
="15%"><b
><?php
echo xlt('Facility');?
><?php
echo $sortlink[1]; ?
></b
></td
>
632 <td width
="10%"><b
><?php
echo xlt('Unit');?
></b
><?php
echo $sortlink[2]; ?
></td
>
633 <td width
="10%"><b
><?php
echo xlt('Result');?
></b
><?php
echo $sortlink[3]; ?
></td
>
634 <td width
="10%"><b
><?php
echo xlt('Range');?
></b
><?php
echo $sortlink[4]; ?
></td
>
635 <td width
="10%"><b
><?php
echo xlt('Abnormal');?
><?php
echo $sortlink[5]; ?
></b
></td
>
636 <td
><b
><?php
echo xlt('Comments');?
></b
></td
>
637 <td width
="5%"><b
><?php
echo xlt('Document ID');?
></b
></td
>
638 <td width
="5%"><b
><?php
echo xlt('PID');?
></b
></td
>
641 foreach ($patFinalDataArr as $patKey => $labResInsideArr) {?
>
642 <tr bgcolor
= "#CCCCCC" >
643 <td
> <?php
echo text($labResInsideArr['procedure_result_date']);?
> 
;</td
>
644 <td
> <?php
echo text($labResInsideArr['procedure_result_facility'], ENT_NOQUOTES
); ?
> 
;</td
>
645 <td
> <?php
echo generate_display_field(array('data_type'=>'1','list_id'=>'proc_unit'), $labResInsideArr['procedure_result_units']); ?
> 
;</td
>
646 <td
> <?php
echo text($labResInsideArr['procedure_result_result']); ?
> 
;</td
>
647 <td
> <?php
echo text($labResInsideArr['procedure_result_range']); ?
> 
;</td
>
648 <td
> <?php
echo text($labResInsideArr['procedure_result_abnormal']); ?
> 
;</td
>
649 <td
> <?php
echo text($labResInsideArr['procedure_result_comments']); ?
> 
;</td
>
650 <td
> <?php
echo text($labResInsideArr['procedure_result_document_id']); ?
> 
;</td
>
651 <td colspan
="3"> <?php
echo text($labResInsideArr['patient_id']); ?
> 
;</td
>
655 } elseif ($srch_option == "Communication") { ?
>
656 <tr style
="font-size:15px;">
657 <td width
="15%"><b
><?php
echo xlt('Date'); ?
></b
><?php
echo $sortlink[0]; ?
></td
>
658 <td width
="20%"><b
><?php
echo xlt('Patient Name'); ?
></b
><?php
echo $sortlink[1]; ?
></td
>
659 <td width
="5%"><b
><?php
echo xlt('PID');?
></b
><?php
echo $sortlink[2]; ?
></td
>
660 <td width
="5%"><b
><?php
echo xlt('Age');?
></b
><?php
echo $sortlink[3]; ?
></td
>
661 <td width
="10%"><b
><?php
echo xlt('Gender');?
></b
><?php
echo $sortlink[4]; ?
></td
>
662 <td width
="15%"><b
><?php
echo xlt('Provider');?
></b
><?php
echo $sortlink[5]; ?
></td
>
663 <td
><b
><?php
echo xlt('Communication');?
></b
><?php
echo $sortlink[6]; ?
></td
>
665 <?php
foreach ($patFinalDataArr as $patKey => $patDetailVal) { ?
>
666 <tr bgcolor
= "#CCCCCC" >
667 <td
><?php
if ($patDetailVal['patient_date'] != '') {
668 echo text($patDetailVal['patient_date']);
672 <td
><?php
echo text($patDetailVal['patient_name']); ?
></td
>
673 <td
><?php
echo text($patDetailVal['patient_id']); ?
></td
>
674 <td
><?php
echo text($patDetailVal['patient_age']);?
></td
>
675 <td
><?php
echo text($patDetailVal['patient_sex']);?
></td
>
676 <td
><?php
echo text($patDetailVal['users_provider']);?
></td
>
677 <td
><?php
echo text($patDetailVal['communications']);?
></td
>
681 } elseif ($srch_option == "Demographics") { ?
>
682 <tr style
="font-size:15px;">
683 <td width
="15%"><b
><?php
echo xlt('Date'); ?
></b
><?php
echo $sortlink[0]; ?
></td
>
684 <td width
="20%"><b
><?php
echo xlt('Patient Name'); ?
></b
><?php
echo $sortlink[1]; ?
></td
>
685 <td width
="15%"><b
><?php
echo xlt('PID');?
></b
><?php
echo $sortlink[2]; ?
></td
>
686 <td width
="5%"><b
><?php
echo xlt('Age');?
></b
><?php
echo $sortlink[3]; ?
></td
>
687 <td width
="10%"><b
><?php
echo xlt('Gender'); ?
></b
><?php
echo $sortlink[4]; ?
></td
>
688 <td width
="20%"><b
><?php
echo xlt('Race');?
></b
><?php
echo $sortlink[5]; ?
></td
>
689 <td colspan
=5><b
><?php
echo xlt('Provider');?
></b
><?php
echo $sortlink[7]; ?
></td
>
691 <?php
foreach ($patFinalDataArr as $patKey => $patDetailVal) { ?
>
692 <tr bgcolor
= "#CCCCCC" style
="font-size:15px;">
693 <td
><?php
if ($patDetailVal['patient_date'] != '') {
694 echo text($patDetailVal['patient_date']);
698 <td
><?php
echo text($patDetailVal['patient_name']); ?
></td
>
699 <td
><?php
echo text($patDetailVal['patient_id']); ?
></td
>
700 <td
><?php
echo text($patDetailVal['patient_age']);?
></td
>
701 <td
><?php
echo text($patDetailVal['patient_sex']);?
></td
>
702 <td
><?php
echo generate_display_field(array('data_type'=>'36','list_id'=>'race'), $patDetailVal['patient_race']); ?
></td
>
703 <td colspan
=5><?php
echo text($patDetailVal['users_provider']);?
></td
>
709 <!-- Main table ends
-->
711 } else {//End if $result?>
714 <td
class="text"> 
; 
;<?php
echo xlt('No records found.')?
></td
>
723 } else {//End if form_refresh
724 ?
><div
class='text'> <?php
echo xlt('Please input search criteria above, and click Submit to view results.'); ?
> </div
><?php