2 // Copyright (C) 2005-2009 Rod Roark <rod@sunsetsystems.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 require_once("../../globals.php");
10 require_once("$srcdir/lists.inc");
11 require_once("$srcdir/acl.inc");
12 require_once("../../../custom/code_types.inc.php");
13 require_once("$srcdir/options.inc.php");
15 // Check authorization.
16 $thisauth = acl_check('patients', 'med');
18 $tmp = getPatientData($pid, "squad");
19 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
22 if (!$thisauth) die(xl('Not authorized'));
25 $pres = sqlStatement("SELECT * FROM lists WHERE pid = $pid " .
26 "ORDER BY type, begdate");
31 <?php
html_header_show();?
>
33 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
35 <title
><?php
xl('Patient Issues','e'); ?
></title
>
37 <script type
="text/javascript" src
="../../../library/dialog.js"></script
>
38 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script
>
40 <script language
="JavaScript">
42 // callback from add_edit_issue.php:
43 function refreshIssue(issue
, title
) {
48 function dopclick(id
) {
49 <?php
if ($thisauth == 'write'): ?
>
50 dlgopen('add_edit_issue.php?issue=' + id
, '_blank', 550, 400);
52 alert("<?php xl('You are not authorized to add/edit issues','e'); ?>");
56 // Process click on number of encounters.
57 function doeclick(id
) {
58 dlgopen('../problem_encounter.php?issue=' + id
, '_blank', 550, 400);
61 // Add Encounter button is clicked.
62 function newEncounter() {
63 var f
= document
.forms
[0];
65 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
66 parent
.left_nav
.setRadio(window
.name
, 'nen');
67 location
.href
='../../forms/newpatient/new.php?autoloaded=1&calenc=';
69 top
.Title
.location
.href
='../encounter/encounter_title.php';
70 top
.Main
.location
.href
='../encounter/patient_encounter.php?mode=new';
78 <body
class="body_top">
79 <div id
='patient_stats'>
81 <form method
='post' action
='stats_full.php' onsubmit
='return top.restoreSession()'>
85 <th
><?php
xl('Type','e'); ?
></th
>
86 <th
><?php
xl('Title','e'); ?
></th
>
87 <th
><?php
xl('Begin','e'); ?
></th
>
88 <th
><?php
xl('End','e'); ?
></th
>
89 <th
><?php
xl('Diag','e'); ?
></th
>
90 <th
><?php
xl('Occurrence','e'); ?
></th
>
91 <?php
if ($GLOBALS['athletic_team']) { ?
>
92 <th
><?php
xl('Missed','e'); ?
></th
>
94 <th
><?php
xl('Referred By','e'); ?
></th
>
96 <th
><?php
xl('Comments','e'); ?
></th
>
97 <th
><?php
xl('Enc','e'); ?
></th
>
103 while ($row = sqlFetchArray($pres)) {
104 if ($lasttype != $row['type']) {
106 $lasttype = $row['type'];
109 $disptype = $lasttype;
111 case "allergy" : $disptype = "Allergies" ; break;
113 case "medical_problem": $disptype = "Medical Problems"; break;
114 case "medication" : $disptype = "Medications" ; break;
115 case "surgery" : $disptype = "Surgeries" ; break;
118 $disptype = $ISSUE_TYPES[$lasttype][0];
120 echo " <tr class='detail'>\n";
121 echo " <td class='typehead' colspan='9'><b>$disptype</b></td>\n";
127 $disptitle = trim($row['title']) ?
$row['title'] : "[Missing Title]";
129 $ierow = sqlQuery("SELECT count(*) AS count FROM issue_encounter WHERE " .
132 // encount is used to toggle the color of the table-row output below
134 $bgclass = (($encount & 1) ?
"bg1" : "bg2");
136 // look up the diag codes
138 if ($row['diagnosis'] != "") {
139 $diags = explode(";", $row['diagnosis']);
140 foreach ($diags as $diag) {
141 $codedesc = lookup_code_descriptions($diag);
142 $codetext .= $diag." (".$codedesc.")<br>";
146 // output the TD row of info
147 echo " <tr class='$bgclass detail statrow' id='$rowid'>\n";
148 echo " <td> </td>\n";
149 echo " <td>$disptitle</td>\n";
150 echo " <td>" . $row['begdate'] . " </td>\n";
151 echo " <td>" . $row['enddate'] . " </td>\n";
152 echo " <td>" . $codetext . "</td>\n";
153 echo " <td class='nowrap'>";
154 echo generate_display_field(array('data_type'=>'1','list_id'=>'occurrence'), $row['occurrence']);
156 if ($GLOBALS['athletic_team']) {
157 echo " <td class='center'>" . $row['extrainfo'] . "</td>\n"; // games missed
160 echo " <td>" . $row['referredby'] . "</td>\n";
162 echo " <td>" . $row['comments'] . "</td>\n";
163 echo " <td id='e_$rowid' class='noclick center' title='" . xl('View related encounters') . "'>";
164 echo " <input type='button' value='" . $ierow['count'] . "' class='editenc' id='".$rowid."' />";
171 <div style
="text-align:center" class="buttons">
173 <input type
='button' value
='<?php xl('Add Issue
','e
'); ?>' id
='addissue' class='btn' />  
;
174 <input type
='button' value
='<?php xl('Add Encounter
','e
'); ?>' id
='newencounter' class='btn' />  
;
175 <input type
='button' value
='<?php xl('To History
','e
'); ?>' id
='history' class='btn' />  
;
176 <input type
='button' value
='<?php xl('Back
','e
'); ?>' id
='back' class='btn' />
181 </div
> <!-- end patient_stats
-->
185 <script language
="javascript">
186 // jQuery stuff to make the page a little easier to use
188 $
(document
).ready(function(){
189 $
(".statrow").mouseover(function() { $
(this
).toggleClass("highlight"); });
190 $
(".statrow").mouseout(function() { $
(this
).toggleClass("highlight"); });
192 $
(".statrow").click(function() { dopclick(this
.id
); });
193 $
(".editenc").click(function(event
) { doeclick(this
.id
); event
.stopPropagation(); });
194 $
("#addissue").click(function() { dopclick(0); });
195 $
("#newencounter").click(function() { newEncounter(); });
196 $
("#history").click(function() { GotoHistory(); });
197 $
("#back").click(function() { GoBack(); });
200 var GotoHistory
= function() {
201 top
.restoreSession();
202 <?php
if ($GLOBALS['concurrent_layout']): ?
>
203 parent
.left_nav
.setRadio(window
.name
,'his');
204 location
.href
='../history/history_full.php';
206 location
.href
='../history/history_full.php';
210 var GoBack
= function () {
211 top
.restoreSession();
212 <?php
if ($GLOBALS['concurrent_layout']): ?
>
213 parent
.left_nav
.setRadio(window
.name
,'dem');
214 location
.href
='demographics.php';
216 location
.href
="patient_summary.php";