From fe69b0ddc37061cc9407eeedb9ae9b528ecea8be Mon Sep 17 00:00:00 2001 From: sunsetsystems Date: Mon, 18 Jul 2005 21:56:00 +0000 Subject: [PATCH] added an issues column --- interface/patient_file/history/encounters.php | 139 ++++++++++++++++---------- 1 file changed, 88 insertions(+), 51 deletions(-) diff --git a/interface/patient_file/history/encounters.php b/interface/patient_file/history/encounters.php index 79ce94e60..d0e199693 100644 --- a/interface/patient_file/history/encounters.php +++ b/interface/patient_file/history/encounters.php @@ -1,21 +1,25 @@ - - + + topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0> Past Encounters
@@ -24,6 +28,7 @@ $N = 10; Date Reason +Issue Insurance @@ -31,13 +36,13 @@ $N = 10; = $N) { - //we have more encounters to print, but we've reached our display maximum - print "Some encounters were not displayed. Click here to view all.\n"; - break; - } + foreach ($result as $iter ) { + $count++; + if ($count > $N) { + //we have more encounters to print, but we've reached our display maximum + print "Some encounters were not displayed. Click here to view all.\n"; + break; + } /**** $subresult = getFormByEncounter($pid, $iter{"encounter"}, "*", "New Patient Encounter"); @@ -47,16 +52,44 @@ if ($result = getEncounters($pid)) { print "" . $encounter_date . ""; ****/ - $reason_string = ""; - if ($result4 = sqlQuery("select * from form_encounter where encounter='" . $iter{"encounter"} . "' and pid='$pid'")) { - $raw_encounter_date = date("Y-m-d", strtotime($result4{"date"})); - $encounter_date = date("D F jS", strtotime($result4{"date"})); - $reason_string .= $result4{"reason"} . "
\n"; - } - - print "\n"; - print "" . $encounter_date . "\n"; - print "" . $reason_string . "\n"; + $reason_string = ""; + if ($result4 = sqlQuery("select * from form_encounter where encounter='" . + $iter{"encounter"} . "' and pid='$pid'")) + { + $raw_encounter_date = date("Y-m-d", strtotime($result4{"date"})); + $encounter_date = date("D F jS", strtotime($result4{"date"})); + $reason_string .= $result4{"reason"} . "
\n"; + } + + echo "\n"; + + echo "" . + $raw_encounter_date . "\n"; + + echo "" . + $reason_string . "\n"; + + // show issues for this encounter + $ires = sqlStatement("SELECT lists.type, lists.title, lists.begdate " . + "FROM issue_encounter, lists WHERE " . + "issue_encounter.pid = '$pid' AND " . + "issue_encounter.encounter = '" . $iter['encounter'] . "' AND " . + "lists.id = issue_encounter.list_id " . + "ORDER BY lists.type, lists.begdate"); + echo ""; + for ($i = 0; $irow = sqlFetchArray($ires); ++$i) { + if ($i > 0) echo "
"; + $tcode = $irow['type']; + if ($tcode == 'medical_problem' || $tcode == 'problem') $tcode = 'P'; + else if ($tcode == 'allergy') $tcode = 'A'; + else if ($tcode == 'medication') $tcode = 'M'; + else if ($tcode == 'surgery') $tcode = 'S'; + echo "$tcode: " . $irow['title']; + } + echo "
\n"; /**** /////////// @@ -75,36 +108,40 @@ if ($result = getEncounters($pid)) { print "" . $comments . ""; ****/ - $coded = ""; - if ($subresult2 = getBillingByEncounter($pid,$iter{"encounter"})) { - //this is where we print out the text of the billing that occurred on this encounter - foreach ($subresult2 as $iter2) { - $coded .= ""; - $coded .= $iter2{"code"} . ", "; - } - $coded = substr($coded, 0, strlen($coded) - 2); - } - - print "" . $coded . "\n"; - - $insured = "$raw_encounter_date"; - $subresult5 = getInsuranceDataByDate($pid, $raw_encounter_date, "primary"); - if ($subresult5 && $subresult5{"provider_name"}) { - $insured = "Primary: " . $subresult5{"provider_name"} . "
\n"; - } - $subresult6 = getInsuranceDataByDate($pid, $raw_encounter_date, "secondary"); - if ($subresult6 && $subresult6{"provider_name"}) { - $insured .= "Secondary: ".$subresult6{"provider_name"}."
\n"; - } - $subresult7 = getInsuranceDataByDate($pid, $raw_encounter_date, "tertiary"); - if ($subresult6 && $subresult7{"provider_name"}) { - $insured .= "Tertiary: ".$subresult7{"provider_name"}."
\n"; - } - - print "" . $insured . "\n"; - - print "\n"; - } + $coded = ""; + if ($subresult2 = getBillingByEncounter($pid,$iter{"encounter"})) { + //this is where we print out the text of the billing that occurred on this encounter + foreach ($subresult2 as $iter2) { + $coded .= ""; + $coded .= $iter2{"code"} . ", "; + } + $coded = substr($coded, 0, strlen($coded) - 2); + } + + echo "" . + $coded . "\n"; + + $insured = "$raw_encounter_date"; + $subresult5 = getInsuranceDataByDate($pid, $raw_encounter_date, "primary"); + if ($subresult5 && $subresult5{"provider_name"}) { + $insured = "Primary: " . $subresult5{"provider_name"} . "
\n"; + } + $subresult6 = getInsuranceDataByDate($pid, $raw_encounter_date, "secondary"); + if ($subresult6 && $subresult6{"provider_name"}) { + $insured .= "Secondary: ".$subresult6{"provider_name"}."
\n"; + } + $subresult7 = getInsuranceDataByDate($pid, $raw_encounter_date, "tertiary"); + if ($subresult6 && $subresult7{"provider_name"}) { + $insured .= "Tertiary: ".$subresult7{"provider_name"}."
\n"; + } + + echo "" . + $insured . "\n"; + + echo "\n"; + } } ?> -- 2.11.4.GIT