From e72164a71382d326fda0d09ce36432bc55eaf470 Mon Sep 17 00:00:00 2001 From: cfapress Date: Thu, 22 Jan 2009 18:08:08 +0000 Subject: [PATCH] list shows encounters regardless of billing status --- interface/main/finder/patient_select.php | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/interface/main/finder/patient_select.php b/interface/main/finder/patient_select.php index e6ee76904..519f041db 100644 --- a/interface/main/finder/patient_select.php +++ b/interface/main/finder/patient_select.php @@ -4,7 +4,7 @@ include_once("$srcdir/patient.inc"); $patient = $_REQUEST['patient']; $findBy = $_REQUEST['findBy']; -$MAXSHOW = 500; // maximum number of results to display at once +$MAXSHOW = 100; // maximum number of results to display at once // this is a quick fix so it doesn't go to thousands records. // the searching functions on patient.inc need improvement. @@ -177,14 +177,17 @@ if ($result) { if ($all_other_phones == '') {$all_other_phones = 'No other phone numbers listed';} //end of phone number display setup, now display the phone number(s) echo "" . $iter['phone_home']. "\n"; + echo "" . $iter['ss'] . ""; if ($iter{"DOB"} != "0000-00-00 00:00:00") { echo "" . $iter['DOB_TS'] . ""; } else { echo " "; } + echo "" . $iter['pubpid'] . ""; echo "" . $iter['pid'] . ""; + //setup for display of encounter date info $encounter_count = 0; $day_diff = ''; @@ -208,17 +211,40 @@ if ($result) { $day_diff = $results['day_diff']; $next_appt_date= $results['next_appt_day'].', '.$results['next_appt']; } + // calculate date differences based on date of last encounter regardless of billing + $query = "select DATE_FORMAT(max(form_encounter.date),'%m/%d/%y') as mydate," . + " (to_days(current_date())-to_days(max(form_encounter.date))) as day_diff," . + " DATE_FORMAT(max(form_encounter.date) + interval " . $add_days . + " day,'%m/%d/%y') as next_appt, dayname(max(form_encounter.date) + interval " . + $add_days." day) as next_appt_day from form_encounter " . + " where form_encounter.pid = " . $iter{"pid"}; + $statement= sqlStatement($query); + if ($results = mysql_fetch_array($statement, MYSQL_ASSOC)) { + $last_date_seen = $results['mydate']; + $day_diff = $results['day_diff']; + $next_appt_date= $results['next_appt_day'].', '.$results['next_appt']; + } //calculate count of encounters by distinct billing dates with cpt4 //entries $query = "select count(distinct date) as encounter_count " . - "from billing where code_type not like 'COPAY' and activity = 1 " . - "and pid = ".$iter{"pid"}; + " from billing ". + " where code_type not like 'COPAY' and activity = 1 " . + " and pid = ".$iter{"pid"}; + $statement= sqlStatement($query); + if ($results = mysql_fetch_array($statement, MYSQL_ASSOC)) { + $encounter_count_billed = $results['encounter_count']; + } + // calculate count of encounters, regardless of billing + $query = "select count(date) as encounter_count ". + " from form_encounter where ". + " pid = ".$iter{"pid"}; $statement= sqlStatement($query); if ($results = mysql_fetch_array($statement, MYSQL_ASSOC)) { $encounter_count = $results['encounter_count']; } echo "".$encounter_count.""; + //echo "".$encounter_count_billed.""; echo "".$day_diff.""; echo "".$last_date_seen.""; echo "".$next_appt_date.""; -- 2.11.4.GIT