2 include_once("../../globals.php");
3 include_once("$srcdir/acl.inc");
4 include_once("$srcdir/lists.inc");
6 $disabled = "disabled";
8 // If we are allowed to change encounter dates...
9 if (acl_check('encounters', 'date_a')) {
13 $months = array("01","02","03","04","05","06","07","08","09","10","11","12");
14 $days = array("01","02","03","04","05","06","07","08","09","10","11","12","13","14",
15 "15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31");
16 $thisyear = date("Y");
17 $years = array($thisyear-1, $thisyear, $thisyear+
1, $thisyear+
2);
19 $id = $_REQUEST['id'];
21 $result = sqlQuery("SELECT * FROM form_encounter WHERE id = '$id'");
23 $encounter = $result['encounter'];
25 if ($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) {
26 echo "<body>\n<html>\n";
27 echo "<p>You are not authorized to see this encounter.</p>\n";
28 echo "</body>\n</html>\n";
32 // Sort comparison for sensitivities by their order attribute.
33 function sensitivity_compare($a, $b) {
34 return ($a[2] < $b[2]) ?
-1 : 1;
38 $ires = sqlStatement("SELECT id, type, title, begdate FROM lists WHERE " .
39 "pid = $pid AND enddate IS NULL " .
40 "ORDER BY type, begdate");
43 <link rel
=stylesheet href
="<?echo $css_header;?>" type
="text/css">
47 <title
>Patient Encounter
</title
>
49 <script type
="text/javascript" src
="../../../library/dialog.js"></script
>
50 <script type
="text/javascript" src
="../../../library/overlib_mini.js"></script
>
51 <script type
="text/javascript" src
="../../../library/calendar.js"></script
>
52 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
54 <script language
="JavaScript">
56 var mypcc
= '<? echo $GLOBALS['phone_country_code
'] ?>';
58 // Process click on issue title.
60 dlgopen('../../patient_file/summary/add_edit_issue.php', '_blank', 600, 475);
64 // callback from add_edit_issue.php:
65 function refreshIssue(issue
, title
) {
66 var s
= document
.forms
[0]['issues[]'];
67 s
.options
[s
.options
.length
] = new Option(title
, issue
, true, true);
73 <body
<?
echo $top_bg_line;?
> topmargin
='0' rightmargin
='0' leftmargin
='2' bottommargin
='0'
74 marginwidth
='2' marginheight
='0'>
76 <!-- Required
for the popup date selectors
-->
77 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
79 <form method
='post' action
="<?echo $rootdir?>/forms/newpatient/save.php" name
='new_encounter'
80 <?php
if (!$GLOBALS['concurrent_layout']) echo "target='Main'"; ?
>>
81 <input type
=hidden name
='mode' value
='update'>
82 <input type
=hidden name
='id' value
='<? echo $_GET["id"] ?>'>
83 <span
class=title
>Patient Encounter Form
</span
>
89 <td colspan
='2' width
='50%' nowrap
class='text'>Chief Complaint
:</td
>
90 <td
class='text' width
='50%' nowrap
>
91 Issues (Problems
, Medications
, Surgeries
, Allergies
):
97 <textarea name
='reason' cols
='40' rows
='4' wrap
='virtual' style
='width:96%'><?
echo htmlspecialchars($result['reason']) ?
></textarea
>
99 <td rowspan
='5' valign
='top'>
100 <select multiple name
='issues[]' size
='10' style
='width:100%'
101 title
='Hold down [Ctrl] for multiple selections or to unselect'>
103 while ($irow = sqlFetchArray($ires)) {
104 $list_id = $irow['id'];
105 $tcode = $irow['type'];
106 if ($ISSUE_TYPES[$tcode]) $tcode = $ISSUE_TYPES[$tcode][2];
108 echo " <option value='$list_id'";
109 $perow = sqlQuery("SELECT count(*) AS count FROM issue_encounter WHERE " .
110 "pid = '$pid' AND encounter = '$encounter' AND list_id = '$list_id'");
111 if ($perow['count']) echo " selected";
112 echo ">$tcode: " . $irow['begdate'] . " " .
113 htmlspecialchars(substr($irow['title'], 0, 40)) . "</option>\n";
121 <td
class='text' width
='1%' nowrap
>Facility
:</td
>
123 <select name
='facility'>
125 $fres = sqlStatement("select * from facility order by name");
128 for ($iter = 0; $frow = sqlFetchArray($fres); $iter++
)
129 $fresult[$iter] = $frow;
130 foreach($fresult as $iter) {
132 <option value
="<?echo $iter{name};?>" <?
if ($result{facility
} == $iter{name
}) echo "selected";?
>><?
echo $iter{name
};?
></option
>
143 $sensitivities = acl_get_sensitivities();
144 if ($sensitivities && count($sensitivities)) {
145 usort($sensitivities, "sensitivity_compare");
147 <td
class='text' width
='1%' nowrap
>Sensitivity
:</td
>
149 <select name
='form_sensitivity'>
151 foreach ($sensitivities as $value) {
152 // Omit sensitivities to which this user does not have access.
153 if (acl_check('sensitivities', $value[1])) {
154 echo " <option value='" . $value[1] . "'";
155 if ($result['sensitivity'] == $value[1]) echo " selected";
156 echo ">" . $value[3] . "</option>\n";
159 echo " <option value=''";
160 if (!$result['sensitivity']) echo " selected";
161 echo ">None</option>\n";
168 <td colspan
='2'><!-- sensitivities not used
--></td
>
175 <td
class='text' nowrap
>Date of Service
:</td
>
177 <input type
='text' size
='10' name
='form_date' <?
echo $disabled ?
>
178 value
='<? echo substr($result['date
'], 0, 10) ?>'
179 title
='yyyy-mm-dd Date of service'
180 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' />
181 <a href
="javascript:show_calendar('new_encounter.form_date')"
182 title
="Click here to choose a date"
183 ><img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22' border
='0' alt
='[?]'></a
>
188 <td
class='text' nowrap
>Onset
/hospitalization date
:</td
>
190 <input type
='text' size
='10' name
='form_onset_date'
191 value
='<? echo substr($result['onset_date
'], 0, 10) ?>'
192 title
='yyyy-mm-dd Date of onset or hospitalization'
193 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' />
194 <a href
="javascript:show_calendar('new_encounter.form_onset_date')"
195 title
="Click here to choose a date"
196 ><img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22' border
='0' alt
='[?]'></a
>
203 <a href
="javascript:document.new_encounter.submit();" class="link_submit">[Save
]</a
>
206 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
207 <a href
="<?php echo "$rootdir/patient_file
/encounter
/encounter_top
.php
"; ?>"
208 class="link_submit">[Cancel
]</a
>
210 <a href
="<?php echo "$rootdir/patient_file
/encounter
/patient_encounter
.php
"; ?>"
211 class="link_submit" target
='Main'>[Cancel
]</a
>
215 <a href
="" onclick
="return newissue()" class="link_submit">[Add Issue
]</a
>