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 // $enc_year = substr($result{'date'}, 0, 4);
26 // $enc_month = substr($result{'date'}, 5, 2);
27 // $enc_day = substr($result{'date'}, 8, 2);
28 // $ons_year = substr($result{'onset_date'}, 0, 4);
29 // $ons_month = substr($result{'onset_date'}, 5, 2);
30 // $ons_day = substr($result{'onset_date'}, 8, 2);
33 $ires = sqlStatement("SELECT id, type, title, begdate FROM lists WHERE " .
34 "pid = $pid AND enddate IS NULL " .
35 "ORDER BY type, begdate");
38 <link rel
=stylesheet href
="<?echo $css_header;?>" type
="text/css">
42 <title
>Patient Encounter
</title
>
44 <script type
="text/javascript" src
="../../../library/dialog.js"></script
>
45 <script type
="text/javascript" src
="../../../library/overlib_mini.js"></script
>
46 <script type
="text/javascript" src
="../../../library/calendar.js"></script
>
47 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
49 <script language
="JavaScript">
51 var mypcc
= '<? echo $GLOBALS['phone_country_code
'] ?>';
53 // Process click on issue title.
55 dlgopen('../../patient_file/summary/add_edit_issue.php', '_blank', 500, 450);
59 // callback from add_edit_issue.php:
60 function refreshIssue(issue
, title
) {
61 var s
= document
.forms
[0]['issues[]'];
62 s
.options
[s
.options
.length
] = new Option(title
, issue
, true, true);
68 <body
<?
echo $top_bg_line;?
> topmargin
='0' rightmargin
='0' leftmargin
='2' bottommargin
='0'
69 marginwidth
='2' marginheight
='0'>
71 <!-- Required
for the popup date selectors
-->
72 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
74 <form method
='post' action
="<?echo $rootdir?>/forms/newpatient/save.php" name
='new_encounter' target
='Main'>
75 <input type
=hidden name
='mode' value
='update'>
76 <input type
=hidden name
='id' value
='<? echo $_GET["id"] ?>'>
77 <span
class=title
>Patient Encounter Form
</span
>
83 <td colspan
='2' width
='50%' nowrap
class='text'>Chief Complaint
:</td
>
84 <td
class='text' width
='50%' nowrap
>
85 Issues (Problems
, Medications
, Surgeries
, Allergies
):
91 <textarea name
='reason' cols
='40' rows
='5' wrap
='virtual' style
='width:96%'><?
echo htmlspecialchars($result['reason']) ?
></textarea
>
93 <td rowspan
='4' valign
='top'>
94 <select multiple name
='issues[]' size
='10' style
='width:100%'
95 title
='Hold down [Ctrl] for multiple selections or to unselect'>
97 while ($irow = sqlFetchArray($ires)) {
98 $list_id = $irow['id'];
99 $tcode = $irow['type'];
101 if ($tcode == 'medical_problem' || $tcode == 'problem') $tcode = 'P';
102 else if ($tcode == 'allergy') $tcode = 'A';
103 else if ($tcode == 'medication') $tcode = 'M';
104 else if ($tcode == 'surgery') $tcode = 'S';
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");
127 for ($iter = 0; $frow = sqlFetchArray($fres); $iter++
)
128 $result[$iter] = $frow;
129 foreach($result as $iter) {
131 <option value
="<?echo $iter{name};?>" <?
if ($result{facility
} == $iter{name
}) echo "selected";?
>><?
echo $iter{name
};?
></option
>
141 <td
class='text' nowrap
>Date of Service
:</td
>
144 <input type
='text' size
='10' name
='form_date' <?
echo $disabled ?
>
145 value
='<? echo substr($result['date
'], 0, 10) ?>'
146 title
='yyyy-mm-dd Date of service'
147 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' />
148 <a href
="javascript:show_calendar('new_encounter.form_date')"
149 title
="Click here to choose a date"
150 ><img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22' border
='0' alt
='[?]'></a
>
153 <select name
='month' <?
echo $disabled ?
>>
155 foreach($months as $month) {
157 <option value
="<?echo $month;?>" <?
if($month == $enc_month) echo "selected";?
>><?
echo $month?
></option
>
162 <select name
='day' <?
echo $disabled ?
>>
164 foreach($days as $day){
166 <option value
="<?echo $day;?>" <?
if($day == $enc_day) echo "selected";?
>><?
echo $day?
></option
>
171 <select name
='year' <?
echo $disabled ?
>>
173 foreach($years as $year){
175 <option value
="<?echo $year;?>" <?
if($year == $enc_year) echo "selected";?
>><?
echo $year?
></option
>
186 <td
class='text' nowrap
>Onset
/hospitalization date
:</td
>
189 <input type
='text' size
='10' name
='form_onset_date'
190 value
='<? echo substr($result['onset_date
'], 0, 10) ?>'
191 title
='yyyy-mm-dd Date of onset or hospitalization'
192 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' />
193 <a href
="javascript:show_calendar('new_encounter.form_onset_date')"
194 title
="Click here to choose a date"
195 ><img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22' border
='0' alt
='[?]'></a
>
198 <select name
='onset_month'>
200 foreach($months as $month){
202 <option value
="<?echo $month;?>" <?
if($month == $ons_month) echo "selected";?
>><?
echo $month?
></option
>
207 <select name
='onset_day'>
209 foreach($days as $day){
211 <option value
="<?echo $day;?>" <?
if($day == $ons_day) echo "selected";?
>><?
echo $day?
></option
>
216 <select name
='onset_year'>
218 foreach($years as $year){
220 <option value
="<?echo $year;?>" <?
if($year == $ons_year) echo "selected";?
>><?
echo $year?
></option
>
233 <a href
="javascript:document.new_encounter.submit();" class="link_submit">[Save
]</a
>
235 <a href
="<?echo "$rootdir/patient_file
/encounter
/patient_encounter
.php
";?>" class="link_submit" target
='Main'>[Cancel
]</a
>
237 <a href
="" onclick
="return newissue()" class="link_submit">[Add Issue
]</a
>