4 $sanitize_all_escapes=true;
7 //STOP FAKE REGISTER GLOBALS
8 $fake_register_globals=false;
11 include_once("../../globals.php");
12 include_once("$srcdir/lists.inc");
13 include_once("$srcdir/acl.inc");
14 include_once("$srcdir/options.inc.php");
15 include_once("$srcdir/formdata.inc.php");
18 <div id
="patient_stats_summary">
21 $thisauth = acl_check('patients', 'med');
23 $tmp = getPatientData($pid, "squad");
24 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
28 echo "<p>(".htmlspecialchars(xl('Issues not authorized'),ENT_NOQUOTES
).")</p>\n";
29 echo "</body>\n</html>\n";
34 <script type
='text/javascript'>
35 function load_location( location
) {
37 if ( !top
.frames
["RTop"] ) {
38 document
.location
=location
;
40 top
.frames
["RTop"].location
=location
;
45 <table id
="patient_stats_issues">
50 foreach ($ISSUE_TYPES as $key => $arr) {
51 // $result = getListByType($pid, $key, "id,title,begdate,enddate,returndate,extrainfo", "all", "all", 0);
53 $query = "SELECT * FROM lists WHERE pid = ? AND type = ? AND ";
54 $query .= "enddate IS NULL ";
55 $query .= "ORDER BY begdate";
56 $pres = sqlStatement($query, array($pid, $key) );
58 if (sqlNumRows($pres) > 0 ||
$ix == 0 ||
$key == "allergy" ||
$key == "medication") {
60 if ($_POST['embeddedScreen']) {
62 // Issues expand collapse widget
63 $widgetTitle = $arr[0];
65 if(($key == "allergy" ||
$key == "medication") && $GLOBALS['erx_enable'])
67 $widgetButtonLabel = xl("Add");
68 $widgetButtonLink = "load_location(\"${GLOBALS['webroot']}/interface/eRx.php?page=medentry\")";
72 $widgetButtonLabel = xl("Edit");
73 $widgetButtonLink = "load_location(\"${GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=" . $key . "\")";
75 $widgetButtonClass = "";
76 $linkMethod = "javascript";
77 $bodyClass = "summary_item small";
80 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
83 <tr
class='issuetitle'>
84 <td colspan
='$numcols'>
85 <span
class="text"><b
><?php
echo htmlspecialchars($arr[0],ENT_NOQUOTES
); ?
></b
></span
>
86 <a href
="javascript:;" class="small" onclick
="load_location('stats_full.php?active=all&category=" . $key . "')">
87 (<b
><?php
echo htmlspecialchars(xl('Manage'),ENT_NOQUOTES
); ?
></b
>)
93 if (sqlNumRows($pres) == 0) {
94 if ( getListTouch($pid,$key) ) {
95 // Data entry has happened to this type, so can display an explicit None.
96 echo " <tr><td colspan='$numcols' class='text'> " . htmlspecialchars( xl('None'), ENT_NOQUOTES
) . "</td></tr>\n";
99 // Data entry has not happened to this type, so show 'Nothing Recorded"
100 echo " <tr><td colspan='$numcols' class='text'> " . htmlspecialchars( xl('Nothing Recorded'), ENT_NOQUOTES
) . "</td></tr>\n";
104 while ($row = sqlFetchArray($pres)) {
105 // output each issue for the $ISSUE_TYPE
106 if (!$row['enddate'] && !$row['returndate'])
107 $rowclass="noend_noreturn";
108 else if (!$row['enddate'] && $row['returndate'])
110 else if ($row['enddate'] && !$row['returndate'])
111 $rowclass = "noreturn";
113 echo " <tr class='text $rowclass;'>\n";
115 //turn allergies red and bold and show the reaction (if exist)
116 if ($key == "allergy") {
118 if (!empty($row['reaction'])) {
119 $reaction = " (" . $row['reaction'] . ")";
121 echo " <td colspan='$numcols' style='color:red;font-weight:bold;'> " . htmlspecialchars( $row['title'] . $reaction, ENT_NOQUOTES
) . "</td>\n";
124 echo " <td colspan='$numcols'> " . htmlspecialchars($row['title'],ENT_NOQUOTES
) . "</td>\n";
130 if ($_POST['embeddedScreen']) {
131 echo "</div></td></tr>";
139 </table
> <!-- end patient_stats_issues
-->
141 <table id
="patient_stats_spreadsheets">
144 // Show spreadsheet forms if any are present.
147 foreach (array('treatment_protocols','injury_log') as $formname) {
148 if (sqlNumRows(sqlStatement("SHOW TABLES LIKE ?", array("form_".$formname) )) > 0) {
149 $dres = sqlStatement("SELECT tp.id, tp.value FROM forms, " .
150 "form_" . add_escape_custom($formname) .
151 " AS tp WHERE forms.pid = ? AND " .
152 "forms.formdir = ? AND tp.id = forms.form_id AND " .
153 "tp.rownbr = -1 AND tp.colnbr = -1 AND tp.value LIKE '0%' " .
154 "ORDER BY tp.value DESC", array($pid, $formname) );
155 if (sqlNumRows($dres) > 0 && $need_head) {
158 echo " <td colspan='$numcols' valign='top'>\n";
159 echo " <span class='title'>Injury Log</span>\n";
163 while ($row = sqlFetchArray($dres)) {
164 list($completed, $start_date, $template_name) = explode('|', $row['value'], 3);
166 echo " <td colspan='$numcols'> ";
167 echo "<a class='link' href='javascript:;' ";
168 echo "onclick='load_location(\"../../forms/$formname/new.php?popup=1&id=";
169 echo htmlspecialchars($row['id'],ENT_QUOTES
) . "\")'>" .
170 htmlspecialchars($start_date,ENT_NOQUOTES
) . " " .
171 htmlspecialchars($template_name,ENT_NOQUOTES
) . "</a></td>\n";
177 </table
> <!-- end patient_stats_spreadsheets
-->
179 <?php
if (!$GLOBALS['disable_immunizations'] && !$GLOBALS['weight_loss_clinic']) { ?
>
181 <table id
="patient_stats_imm">
183 <?php
if ($_POST['embeddedScreen']) {
185 // Issues expand collapse widget
186 $widgetTitle = xl('Immunizations');
187 $widgetLabel = "immunizations";
188 $widgetButtonLabel = xl("Edit");
189 $widgetButtonLink = "javascript:load_location(\"${GLOBALS['webroot']}/interface/patient_file/summary/immunizations.php\")";
190 $widgetButtonClass = "";
191 $linkMethod = "javascript";
192 $bodyClass = "summary_item small";
195 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
198 <td colspan
='<?php echo $numcols ?>' valign
='top'>
199 <span
class="text"><b
><?php
echo htmlspecialchars(xl('Immunizations', 'e'),ENT_NOQUOTES
); ?
></b
></span
>
200 <a href
="javascript:;" class="small" onclick
="javascript:load_location('immunizations.php')">
201 (<b
><?php
echo htmlspecialchars(xl('Manage'),ENT_NOQUOTES
) ?
></b
>)
208 $sql = "select i1.id as id, i1.immunization_id as immunization_id, i1.cvx_code as cvx_code, c.code_text_short as cvx_text, ".
209 " if (i1.administered_date, concat(i1.administered_date,' - '), substring(i1.note,1,20)) as immunization_data ".
210 " from immunizations i1 ".
211 " left join codes c on CAST(IFNULL(i1.cvx_code,0) AS CHAR) = c.code ".
212 " left join code_types ct on c.code_type = ct.ct_id ".
213 " where i1.patient_id = ? ".
214 " AND (( i1.cvx_code = '0' OR i1.cvx_code IS NULL ) OR ".
215 " ( ( i1.cvx_code != '0' AND i1.cvx_code IS NOT NULL ) AND ct.ct_key = 'CVX') ) ".
216 " order by i1.administered_date desc";
218 $result = sqlStatement($sql, array($pid) );
220 if (sqlNumRows($result) == 0) {
221 echo " <table><tr>\n";
222 echo " <td colspan='$numcols' class='text'> " . htmlspecialchars( xl('None'), ENT_NOQUOTES
) . "</td>\n";
223 echo " </tr></table>\n";
226 while ($row=sqlFetchArray($result)){
228 echo "<a class='link'";
229 echo "' href='javascript:;' onclick='javascript:load_location(\"immunizations.php?mode=edit&id=".htmlspecialchars($row['id'],ENT_QUOTES
) . "\")'>" .
230 htmlspecialchars($row{'immunization_data'},ENT_NOQUOTES
);
232 // Figure out which name to use (ie. from cvx list or from the custom list)
233 if ($GLOBALS['use_custom_immun_list']) {
234 echo generate_display_field(array('data_type'=>'1','list_id'=>'immunizations'), $row['immunization_id']);
237 if (!(empty($row['cvx_text']))) {
238 echo htmlspecialchars( xl($row['cvx_text']), ENT_NOQUOTES
);
241 echo generate_display_field(array('data_type'=>'1','list_id'=>'immunizations'), $row['immunization_id']);
248 <?php
if ($_POST['embeddedScreen']) {
249 echo "</td></tr></div>";
254 </table
> <!-- end patient_stats_imm
-->
258 <?php
if (!$GLOBALS['disable_prescriptions']) { ?
>
260 <table id
="patient_stats_prescriptions">
261 <?php
if($GLOBALS['erx_enable']){ ?
>
263 <?php
if ($_POST['embeddedScreen']) {
265 $widgetTitle = xl('Current Medications');
266 $widgetLabel = "current_prescriptions";
267 $widgetButtonLabel = '';
268 $widgetButtonLink = '';
269 $widgetButtonClass = '';
271 $bodyClass = "summary_item small";
274 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
279 $res=sqlStatement("select * from prescriptions where patient_id=? and active='1'",array($pid));
283 if(sqlNumRows($res)==0)
287 <td
><?php
echo htmlspecialchars(xl('None'), ENT_NOQUOTES
);?
></td
>
291 while($row_currentMed=sqlFetchArray($res))
293 $rin=generate_display_field(array('data_type'=>'1','list_id'=>'drug_form'),$row_currentMed['form']);
294 $rroute=generate_display_field(array('data_type'=>'1','list_id'=>'drug_route'),$row_currentMed['route']);
295 $rint=generate_display_field(array('data_type'=>'1','list_id'=>'drug_interval'),$row_currentMed['interval']);
297 <tr
class=text style
='font-weight:bold;color:blue;'>
298 <td
><?php
echo $row_currentMed['drug'];?
></td
>
299 <td
><?php
echo htmlspecialchars($row_currentMed['dosage']." ".xl("in")." ".$rin['title']." ".$rint['title'],ENT_NOQUOTES
);?
></td
>
307 <tr
><td colspan
='<?php echo $numcols ?>' class='issuetitle'>
309 <?php
if ($_POST['embeddedScreen']) {
310 // Issues expand collapse widget
311 $widgetLabel = "prescriptions";
312 $linkMethod = "html";
313 if($GLOBALS['erx_enable'])
315 $widgetTitle = xl('Prescription History');
316 $widgetButtonLabel = xl("Add/Edit eRx");
317 $widgetButtonLink = $GLOBALS['webroot'] . "/interface/eRx.php?page=compose";
318 $widgetButtonClass = "";
322 $widgetTitle = xl('Prescription');
323 $widgetButtonLabel = xl("Edit");
324 $widgetButtonLink = $GLOBALS['webroot'] . "/interface/patient_file/summary/rx_frameset.php";
325 $widgetButtonClass = "iframe rx_modal";
327 $bodyClass = "summary_item small";
330 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
333 <span
class='text'><b
><?php
echo htmlspecialchars(xl('Prescriptions'),ENT_NOQUOTES
); ?
></b
></span
>
341 require_once("library/classes/Controller.class.php");
342 $c = new Controller();
343 echo $c->act(array("prescription" => "", "fragment" => "", "patient_id" => $pid));
346 <?php
if ($_POST['embeddedScreen']) {
351 </table
> <!-- end patient_stats_prescriptions
-->
355 </div
> <!-- end patient_stats_summary
-->