From 266fac5b0516c6286feb384fbf90383415a136ad Mon Sep 17 00:00:00 2001 From: sunsetsystems Date: Fri, 28 Oct 2005 05:16:05 +0000 Subject: [PATCH] add user column and encounter form info --- interface/patient_file/history/encounters.php | 81 ++++++++------ .../{encounters.php => encounters_full.php} | 120 +++++++++++---------- 2 files changed, 116 insertions(+), 85 deletions(-) copy interface/patient_file/history/{encounters.php => encounters_full.php} (57%) diff --git a/interface/patient_file/history/encounters.php b/interface/patient_file/history/encounters.php index aa5d79d90..df67ed2e6 100644 --- a/interface/patient_file/history/encounters.php +++ b/interface/patient_file/history/encounters.php @@ -44,15 +44,16 @@ topmargin='0' rightmargin='0' leftmargin='2' bottommargin='0' marginwidth='2' marginheight='0'> -Past Encounters
+Past Encounters
- - - - - + + + + + +\n"; - echo "\n"; - echo "\n"; + + echo "\n"; // show issues for this encounter - echo "\n"; //this is where we print out the text of the billing that occurred on this encounter $thisauth = $auth_coding_a; if (!$thisauth && $auth_coding) { - $erow = sqlQuery("SELECT user FROM forms WHERE encounter = '" . - $iter['encounter'] . "' AND formdir = 'newpatient' LIMIT 1"); if ($erow['user'] == $_SESSION['authUser']) $thisauth = $auth_coding; } @@ -141,8 +135,7 @@ if ($result = getEncounters($pid)) { $coded = "(No access)"; } - echo "\n"; // Show insurance. @@ -165,12 +158,40 @@ if ($result = getEncounters($pid)) { } echo "\n"; + "href='$href'>" . $insured . "\n"; echo "\n"; - } -} + + // Now show a line for each encounter form, if the user is authorized to + // see this encounter's notes. + // + if ($auth_notes_a || ($auth_notes && $iter['user'] == $_SESSION['authUser'])) { + $encarr = getFormByEncounter($pid, $iter['encounter'], "formdir, user, form_name, form_id"); + foreach ($encarr as $enc) { + if ($enc['formdir'] == 'newpatient') continue; + $title = ""; + $frow = sqlQuery("select * from form_" . $enc['formdir'] . + " where id = " . $enc['form_id']); + foreach ($frow as $fkey => $fvalue) { + if (! preg_match('/[A-Za-z]/', $fvalue)) continue; + if ($title) $title .= "; "; + $title .= strtoupper($fkey) . ': ' . $fvalue; + } + $title = htmlspecialchars(strtr($title, "\t\n\r", " "), ENT_QUOTES); + + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + } // end foreach $encarr + } // end if + + } // end foreach $result +} // end if ?>
DateReasonIssueInsuranceDateProviderReason/FormIssueInsurance
" . + echo "" . $raw_encounter_date . "" . + echo "" . + $erow['user'] . "" . $reason_string . ""; - + echo ""; if ($auth_med) { $ires = sqlStatement("SELECT lists.type, lists.title, lists.begdate " . "FROM issue_encounter, lists WHERE " . @@ -103,28 +108,17 @@ if ($result = getEncounters($pid)) { 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'; - ****/ if ($ISSUE_TYPES[$tcode]) $tcode = $ISSUE_TYPES[$tcode][2]; - echo "$tcode: " . $irow['title']; } } else { echo "(No access)"; } - echo "
" . + echo "" . $coded . "" . - $insured . "
" . + $enc['user'] . "   " . + $enc['form_name'] . "
diff --git a/interface/patient_file/history/encounters.php b/interface/patient_file/history/encounters_full.php similarity index 57% copy from interface/patient_file/history/encounters.php copy to interface/patient_file/history/encounters_full.php index aa5d79d90..fe5de3870 100644 --- a/interface/patient_file/history/encounters.php +++ b/interface/patient_file/history/encounters_full.php @@ -7,9 +7,6 @@ include_once("$srcdir/lists.inc"); include_once("$srcdir/acl.inc"); - //maximum number of encounter entries to display on this page: - $N = 12; - // Get relevant ACL info. $auth_notes_a = acl_check('encounters', 'notes_a'); $auth_notes = acl_check('encounters', 'notes'); @@ -41,58 +38,54 @@ - topmargin='0' rightmargin='0' leftmargin='2' + topmargin='0' rightmargin='0' leftmargin='2' bottommargin='0' marginwidth='2' marginheight='0'> -Past Encounters
+Past Encounters
- +
- - - - - + + + + + + $N) { - //we have more encounters to print, but we've reached our display maximum - print "\n"; - break; - } + + $href = "javascript:window.toencounter(" . $iter['encounter'] . ")"; $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"})); - - // if ($auth_notes_a || ($auth_notes && $iter['user'] == $_SESSION['authUser'])) - $reason_string .= $result4{"reason"} . "
\n"; - // else - // $reason_string = "(No access)"; + 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"})); + + // if ($auth_notes_a || ($auth_notes && $iter['user'] == $_SESSION['authUser'])) + $reason_string .= $result4{"reason"} . "
\n"; + // else + // $reason_string = "(No access)"; } - echo "\n"; + $erow = sqlQuery("SELECT user FROM forms WHERE encounter = '" . + $iter['encounter'] . "' AND formdir = 'newpatient' LIMIT 1"); + + print "\n"; - echo "\n"; - echo "\n"; + + echo "\n"; // show issues for this encounter - echo "\n"; //this is where we print out the text of the billing that occurred on this encounter $thisauth = $auth_coding_a; if (!$thisauth && $auth_coding) { - $erow = sqlQuery("SELECT user FROM forms WHERE encounter = '" . - $iter['encounter'] . "' AND formdir = 'newpatient' LIMIT 1"); if ($erow['user'] == $_SESSION['authUser']) $thisauth = $auth_coding; } $coded = ""; if ($thisauth) { - if ($subresult2 = getBillingByEncounter($pid,$iter{"encounter"})) { + if ($subresult2 = getBillingByEncounter($pid, $iter{"encounter"})) { foreach ($subresult2 as $iter2) { $coded .= ""; $coded .= $iter2{"code"} . ", "; @@ -141,8 +123,7 @@ if ($result = getEncounters($pid)) { $coded = "(No access)"; } - echo "\n"; // Show insurance. @@ -164,13 +145,42 @@ if ($result = getEncounters($pid)) { $insured = "(No access)"; } - echo "\n"; + echo "\n"; + + print "\n"; + + // Now show a line for each encounter form, if the user is authorized to + // see this encounter's notes. + // + if ($auth_notes_a || ($auth_notes && $iter['user'] == $_SESSION['authUser'])) { + $encarr = getFormByEncounter($pid, $iter['encounter'], "formdir, user, form_name, form_id"); + foreach ($encarr as $enc) { + if ($enc['formdir'] == 'newpatient') continue; + $title = ""; + $frow = sqlQuery("select * from form_" . $enc['formdir'] . + " where id = " . $enc['form_id']); + foreach ($frow as $fkey => $fvalue) { + if (! preg_match('/[A-Za-z]/', $fvalue)) continue; + if ($title) $title .= "; "; + $title .= strtoupper($fkey) . ': ' . $fvalue; + } + $title = htmlspecialchars(strtr($title, "\t\n\r", " "), ENT_QUOTES); + + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + } // end foreach $encarr + } // end if - echo "\n"; } } + ?>
DateReasonIssueInsuranceDateProviderReasonIssueInsurance
Some encounters were not displayed. Click here to view all.
" . + echo "" . $raw_encounter_date . "" . + echo "" . + $erow['user'] . "" . $reason_string . ""; - + echo ""; if ($auth_med) { $ires = sqlStatement("SELECT lists.type, lists.title, lists.begdate " . "FROM issue_encounter, lists WHERE " . @@ -103,34 +96,23 @@ if ($result = getEncounters($pid)) { 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'; - ****/ if ($ISSUE_TYPES[$tcode]) $tcode = $ISSUE_TYPES[$tcode][2]; - echo "$tcode: " . $irow['title']; } } else { echo "(No access)"; } - echo "
" . + echo "" . $coded . "" . - $insured . "" . $insured . "
" . + $enc['user'] . "   " . + $enc['form_name'] . "
-- 2.11.4.GIT