From a7ec52ca4f3db0f4caacde8588efaae429ca3226 Mon Sep 17 00:00:00 2001 From: ViCarePlus Date: Fri, 18 Feb 2011 12:59:42 +0530 Subject: [PATCH] NIST inconsistency fix - Included sorting and simultaneous selection of diagnosis, lab results and prescription. (note left the original Rx report feature there for now) --- interface/main/left_nav.php | 1 + interface/pic/blue-down-arrow.gif | Bin 0 -> 517 bytes interface/pic/blue-up-arrow.gif | Bin 0 -> 515 bytes interface/reports/clinical_reports.php | 783 +++++++++++++++++++++++++++++++++ 4 files changed, 784 insertions(+) create mode 100755 interface/pic/blue-down-arrow.gif create mode 100755 interface/pic/blue-up-arrow.gif create mode 100644 interface/reports/clinical_reports.php diff --git a/interface/main/left_nav.php b/interface/main/left_nav.php index e837a77f2..177db28e7 100644 --- a/interface/main/left_nav.php +++ b/interface/main/left_nav.php @@ -1017,6 +1017,7 @@ if (!empty($reg)) { diff --git a/interface/pic/blue-down-arrow.gif b/interface/pic/blue-down-arrow.gif new file mode 100755 index 0000000000000000000000000000000000000000..40e37669d9c2b35a00fbff2020c36de9e9c0622a GIT binary patch literal 517 zcwTe&bhEHbHcp*ok~Y&gb((29kTKmXW43Af470T9mf3TxvSx?YuMBTm6WP2r zsdH0O=Z5s&Eg5}Vi>L0Gvi{Vbv-fwMx@D9;(Gv9D9JJr_6U=08Xu8?Q| literal 0 HcwPel00001 diff --git a/interface/pic/blue-up-arrow.gif b/interface/pic/blue-up-arrow.gif new file mode 100755 index 0000000000000000000000000000000000000000..a01976198d945e473d0c5dbb7915837e968c144b GIT binary patch literal 515 zcwTe&bhEHbHcp*ok~Y&gb((29kTKmXW43Af470T9mf3TxvSx?YuMBTm6WP2r zsdH0O=Z5s&Eg5}Vi>L0Gvi{Vbv-fwMx@D9;(^>ioR=%_f>+I)(}&0@{{M+ + + + + +<?php echo htmlspecialchars(xl('Clinical Reports'),ENT_NOQUOTES); ?> + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
: : [?]'>
:' value='' size='10' maxlength='20' />: [?]'>
: + + :' readonly /> 
::' />
::
:' />:  
+ + + + + + + + +
   : ' readonly /> 
+ + + + + + + + + + + +
: + > +   + + > +   + + > +   + + > +   + + > +   + + > +   + > +   +
 
+
+ + + +
+ + + + + + + +
+
+ + 0) { + $sqlstmt=$sqlstmt.",li.date AS lists_date, + li.diagnosis AS lists_diagnosis, + li.title AS lists_title"; + } + if(strlen($form_drug_name) > 0) { + + $sqlstmt=$sqlstmt.",r.id as id, r.date_modified AS prescriptions_date_modified, r.dosage as dosage, r.route as route, r.interval as hinterval, r.refills as refills, r.drug as drug, + r.form as hform, r.size as size, r.unit as hunit, d.name as name, d.ndc_number as ndc_number,r.quantity as quantity"; + } + if(strlen($form_lab_results) > 0) { + + $sqlstmt = $sqlstmt.",pr.date AS procedure_result_date, + pr.facility AS procedure_result_facility, + pr.units AS procedure_result_units, + pr.result AS procedure_result_result, + pr.range AS procedure_result_range, + pr.abnormal AS procedure_result_abnormal, + pr.comments AS procedure_result_comments, + pr.document_id AS procedure_result_document_id"; + } + if ( $type == 'Procedure') { + $sqlstmt = $sqlstmt.",po.date_ordered AS procedure_order_date_ordered, + pt.standard_code AS procedure_type_standard_code, + pt.name as procedure_name, + po.order_priority AS procedure_order_order_priority, + po.order_status AS procedure_order_order_status, + po.encounter_id AS procedure_order_encounter, + po.patient_instructions AS procedure_order_patient_instructions, + po.activity AS procedure_order_activity, + po.control_id AS procedure_order_control_id "; + } + if ( $type == 'Medical History') { + $sqlstmt = $sqlstmt.",hd.date AS history_data_date, + hd.tobacco AS history_data_tobacco, + hd.alcohol AS history_data_alcohol, + hd.recreational_drugs AS history_data_recreational_drugs "; + } + if($type == 'Service Codes') { + $sqlstmt .= ", c.code as code, + c.code_text as code_text, + fe.encounter as encounter, + b.date as date"; + $mh_stmt = $mh_stmt.",code,code_text,encounter,date"; + } +//from + $sqlstmt=$sqlstmt." from patient_data as pd left outer join users as u on u.id = pd.providerid + left outer join facility as f on f.id = u.facility_id"; + + if(strlen($form_diagnosis) > 0 ){ + $sqlstmt = $sqlstmt." left outer join lists as li on li.pid = pd.pid "; + } + if ( $type == 'Procedure' ||( strlen($form_lab_results)!=0) ) { + $sqlstmt = $sqlstmt." left outer join procedure_order as po on po.patient_id = pd.pid + left outer join procedure_report as pp on pp.procedure_order_id = po.procedure_order_id + left outer join procedure_type as pt on pt.procedure_type_id = po.procedure_type_id "; + } + if (strlen($form_lab_results)!=0 ) { + $sqlstmt = $sqlstmt." left outer join procedure_result as pr on pr.procedure_report_id = pp.procedure_report_id + and pr.procedure_type_id = po.procedure_type_id "; + } + if(strlen($form_drug_name)!=0) { + $sqlstmt=$sqlstmt." left outer join prescriptions AS r on r.patient_id=pd.pid + LEFT OUTER JOIN drugs AS d ON d.drug_id = r.drug_id"; + } + if ( $type == 'Medical History') { + $sqlstmt = $sqlstmt." left outer join history_data as hd on hd.pid = pd.pid + and (isnull(hd.tobacco) = 0 + or isnull(hd.alcohol) = 0 + or isnull(hd.recreational_drugs) = 0)"; + } + if($type == 'Service Codes') { + $sqlstmt = $sqlstmt." left outer join billing as b on b.pid = pd.pid + left outer join form_encounter as fe on fe.encounter = b.encounter and b.code_type = 'CPT4' + left outer join codes as c on c.code = b.code "; + } +//where + $whr_stmt="where 1=1"; + if(strlen($form_diagnosis) > 0 ) { + $whr_stmt=$whr_stmt." AND li.date >= ? AND li.date < DATE_ADD(?, INTERVAL 1 DAY) AND li.date <= ?"; + array_push($sqlBindArray, $sql_date_from, $sql_date_to, date("Y-m-d H:i:s")); + } + if(strlen($form_lab_results)!=0 ) { + $whr_stmt=$whr_stmt." AND pr.date >= ? AND pr.date < DATE_ADD(?, INTERVAL 1 DAY) AND pr.date <= ?"; + array_push($sqlBindArray, $sql_date_from, $sql_date_to, date("Y-m-d H:i:s")); + } + if(strlen($form_drug_name)!=0) { + $whr_stmt=$whr_stmt." AND r.date_modified >= ? AND r.date_modified < DATE_ADD(?, INTERVAL 1 DAY) AND r.date_modified <= ?"; + array_push($sqlBindArray, $sql_date_from, $sql_date_to, date("Y-m-d H:i:s")); + } + if($type == 'Medical History') { + $whr_stmt=$whr_stmt." AND hd.date >= ? AND hd.date < DATE_ADD(?, INTERVAL 1 DAY) AND hd.date <= ?"; + array_push($sqlBindArray, $sql_date_from, $sql_date_to, date("Y-m-d H:i:s")); + } + if($type == 'Procedure') { + $whr_stmt=$whr_stmt." AND po.date_ordered >= ? AND po.date_ordered < DATE_ADD(?, INTERVAL 1 DAY) AND po.date_ordered <= ?"; + array_push($sqlBindArray, $sql_date_from, $sql_date_to, date("Y-m-d H:i:s")); + } + if($type == "Service Codes") { + $whr_stmt=$whr_stmt." AND b.date >= ? AND b.date < DATE_ADD(?, INTERVAL 1 DAY) AND b.date <= ?"; + array_push($sqlBindArray, $sql_date_from, $sql_date_to, date("Y-m-d H:i:s")); + } + if(strlen($form_lab_results) != 0) { + $whr_stmt= $whr_stmt." AND (pr.result LIKE ?) "; + array_push($sqlBindArray, $form_lab_results); + } + if(strlen($form_drug_name) > 0) { + $whr_stmt .= " AND ( + d.name LIKE ? + OR r.drug LIKE ? + ) "; + array_push($sqlBindArray, $form_drug_name, $form_drug_name); + } + if($type == 'Service Codes') { + if(strlen($form_service_codes) != 0) { + $whr_stmt = $whr_stmt." AND (b.code = ?) "; + $service_code = explode(":",$form_service_codes); + array_push($sqlBindArray, $service_code[1]); + } + } + if(strlen($patient_id) != 0) { + $whr_stmt = $whr_stmt." and pd.pid = ?"; + array_push($sqlBindArray, $patient_id); + } + + if(strlen($age_from) != 0) { + $whr_stmt = $whr_stmt." and DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(),pd.dob)), '%Y')+0 >= ?"; + array_push($sqlBindArray, $age_from); + } + if(strlen($age_to) != 0) { + $whr_stmt = $whr_stmt." and DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(),pd.dob)), '%Y')+0 <= ?"; + array_push($sqlBindArray, $age_to); + } + if(strlen($sql_gender) != 0) { + $whr_stmt = $whr_stmt." and pd.sex = ?"; + array_push($sqlBindArray, $sql_gender); + } + if(strlen($sql_ethnicity) != 0) { + $whr_stmt = $whr_stmt." and pd.ethnicity = ?"; + array_push($sqlBindArray, $sql_ethnicity); + } + if(strlen($sql_race) != 0) { + $whr_stmt = $whr_stmt." and pd.race = ?"; + array_push($sqlBindArray, $sql_race); + } + if($facility != '') { + $whr_stmt = $whr_stmt." and f.id = ? "; + array_push($sqlBindArray, $facility); + } + if(strlen($form_diagnosis) > 0) { + $whr_stmt = $whr_stmt." AND (li.diagnosis LIKE ? or li.diagnosis LIKE ? or li.diagnosis LIKE ? or li.diagnosis = ?) "; + array_push($sqlBindArray, $form_diagnosis.";%", '%;'.$form_diagnosis.';%', '%;'.$form_diagnosis, $form_diagnosis); + } +// order by + $odrstmt = $odrstmt."ORDER BY patient_id"; + if ($_POST['form_pt_name'] == true){ + $odrstmt=$odrstmt.",patient_name"; + } + if ($_POST['form_pt_age'] == true) { + $odrstmt=$odrstmt.",patient_age"; + } + if (($_POST['form_diagnosis_code'] == true) && (strlen($form_diagnosis) > 0)){ + $odrstmt=$odrstmt.",lists_diagnosis"; + } + if (($_POST['form_diagnosis_tit'] == true) && (strlen($form_diagnosis) > 0)){ + $odrstmt=$odrstmt.",lists_title"; + } + if (($_POST['form_drug'] == true)&& (strlen($form_drug_name) > 0)){ + $odrstmt=$odrstmt.",r.drug"; + } + if (($_POST['ndc_no'] == true) && (strlen($form_drug_name) > 0)) { + $odrstmt=$odrstmt.",d.ndc_number"; + } + if (($_POST['lab_results'] == true) && (strlen($form_lab_results) > 0)) { + $odrstmt=$odrstmt.",procedure_result_result"; + } + + + if($type == 'Medical History') { + $sqlstmt="select * from (".$sqlstmt." ".$whr_stmt." ".$odrstmt.",history_data_date desc) a group by patient_id"; + } + else + $sqlstmt=$sqlstmt." ".$whr_stmt." ".$odrstmt; + +$result = sqlStatement($sqlstmt,$sqlBindArray); + +$row_id = 1.1;//given to each row to identify and toggle +$img_id = 1.2; +$k=1.3; + +if(sqlNumRows($result) > 0) +{ +?> +
+
+ + + + + + + +
   + +
+ + + + + + + + + + + + + + + + + + + + 0) + { + ?> + + + + + + + + + + + + + + + + + + 0) + { + ?> + + + + + + + + + + + + + + + + + '1','list_id'=>'drug_route'), $row['route']) ; + $rx_form = generate_display_field(array('data_type'=>'1','list_id'=>'drug_form'), $row['hform']) ; + $rx_interval = generate_display_field(array('data_type'=>'1','list_id'=>'drug_interval'), $row['hinterval']) ; + $rx_units = generate_display_field(array('data_type'=>'1','list_id'=>'drug_units'), $row['hunit']); + ?> + + + + + + + + + + + + + + + + + 0) + { + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + '1','list_id'=>'smoking_status'), $tmp_t[3]) ; + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + -- 2.11.4.GIT