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");
14 // Check authorization.
15 $thisauth = acl_check('patients', 'med');
17 $tmp = getPatientData($pid, "squad");
18 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
21 if (!$thisauth) die("Not authorized.");
24 $pres = sqlStatement("SELECT * FROM lists WHERE pid = $pid " .
25 "ORDER BY type, begdate");
30 <?php
html_header_show();?
>
32 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
34 <title
><?php
xl('Patient Issues','e'); ?
></title
>
36 <script type
="text/javascript" src
="../../../library/dialog.js"></script
>
37 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script
>
39 <script language
="JavaScript">
41 // callback from add_edit_issue.php:
42 function refreshIssue(issue
, title
) {
47 function dopclick(id
) {
48 <?php
if ($thisauth == 'write'): ?
>
49 dlgopen('add_edit_issue.php?issue=' + id
, '_blank', 550, 400);
51 alert("You are not authorized to add/edit issues");
55 // Process click on number of encounters.
56 function doeclick(id
) {
57 dlgopen('../problem_encounter.php?issue=' + id
, '_blank', 550, 400);
60 // Add Encounter button is clicked.
61 function newEncounter() {
62 var f
= document
.forms
[0];
64 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
65 parent
.left_nav
.setRadio(window
.name
, 'nen');
66 location
.href
='../../forms/newpatient/new.php?autoloaded=1&calenc=';
68 top
.Title
.location
.href
='../encounter/encounter_title.php';
69 top
.Main
.location
.href
='../encounter/patient_encounter.php?mode=new';
77 <body
class="body_top">
78 <div id
='patient_stats'>
80 <form method
='post' action
='stats_full.php' onsubmit
='return top.restoreSession()'>
84 <th
><?php
xl('Type','e'); ?
></th
>
85 <th
><?php
xl('Title','e'); ?
></th
>
86 <th
><?php
xl('Begin','e'); ?
></th
>
87 <th
><?php
xl('End','e'); ?
></th
>
88 <th
><?php
xl('Diag','e'); ?
></th
>
89 <th
><?php
xl('Occurrence','e'); ?
></th
>
90 <?php
if ($GLOBALS['athletic_team']) { ?
>
91 <th
><?php
xl('Missed','e'); ?
></th
>
93 <th
><?php
xl('Referred By','e'); ?
></th
>
95 <th
><?php
xl('Comments','e'); ?
></th
>
96 <th
><?php
xl('Enc','e'); ?
></th
>
102 while ($row = sqlFetchArray($pres)) {
103 if ($lasttype != $row['type']) {
105 $lasttype = $row['type'];
108 $disptype = $lasttype;
110 case "allergy" : $disptype = "Allergies" ; break;
112 case "medical_problem": $disptype = "Medical Problems"; break;
113 case "medication" : $disptype = "Medications" ; break;
114 case "surgery" : $disptype = "Surgeries" ; break;
117 $disptype = $ISSUE_TYPES[$lasttype][0];
119 echo " <tr class='detail'>\n";
120 echo " <td class='typehead' colspan='9'><b>$disptype</b></td>\n";
126 $disptitle = trim($row['title']) ?
$row['title'] : "[Missing Title]";
128 $ierow = sqlQuery("SELECT count(*) AS count FROM issue_encounter WHERE " .
131 // encount is used to toggle the color of the table-row output below
133 $bgclass = (($encount & 1) ?
"bg1" : "bg2");
135 // look up the diag codes
137 if ($row['diagnosis'] != "") {
138 $diags = explode(";", $row['diagnosis']);
139 foreach ($diags as $diag) {
140 $codedesc = lookup_code_descriptions($diag);
141 $codetext .= $diag." (".$codedesc.")<br>";
145 // output the TD row of info
146 echo " <tr class='$bgclass detail statrow' id='$rowid'>\n";
147 echo " <td> </td>\n";
148 echo " <td>$disptitle</td>\n";
149 echo " <td>" . $row['begdate'] . " </td>\n";
150 echo " <td>" . $row['enddate'] . " </td>\n";
151 echo " <td>" . $codetext . "</td>\n";
152 echo " <td class='nowrap'>" . $ISSUE_OCCURRENCES[$row['occurrence']] . "</td>\n";
153 if ($GLOBALS['athletic_team']) {
154 echo " <td class='center'>" . $row['extrainfo'] . "</td>\n"; // games missed
157 echo " <td>" . $row['referredby'] . "</td>\n";
159 echo " <td>" . $row['comments'] . "</td>\n";
160 echo " <td id='e_$rowid' class='noclick center' title='View related encounters'>";
161 echo " <input type='button' value='" . $ierow['count'] . "' class='editenc' id='".$rowid."' />";
168 <div style
="text-align:center" class="buttons">
170 <input type
='button' value
='<?php xl('Add Issue
','e
'); ?>' id
='addissue' class='btn' />  
;
171 <input type
='button' value
='<?php xl('Add Encounter
','e
'); ?>' id
='newencounter' class='btn' />  
;
172 <input type
='button' value
='<?php xl('To History
','e
'); ?>' id
='history' class='btn' />  
;
173 <input type
='button' value
='<?php xl('Back
','e
'); ?>' id
='back' class='btn' />
178 </div
> <!-- end patient_stats
-->
182 <script language
="javascript">
183 // jQuery stuff to make the page a little easier to use
185 $
(document
).ready(function(){
186 $
(".statrow").mouseover(function() { $
(this
).toggleClass("highlight"); });
187 $
(".statrow").mouseout(function() { $
(this
).toggleClass("highlight"); });
189 $
(".statrow").click(function() { dopclick(this
.id
); });
190 $
(".editenc").click(function(event
) { doeclick(this
.id
); event
.stopPropagation(); });
191 $
("#addissue").click(function() { dopclick(0); });
192 $
("#newencounter").click(function() { newEncounter(); });
193 $
("#history").click(function() { GotoHistory(); });
194 $
("#back").click(function() { GoBack(); });
197 var GotoHistory
= function() {
198 top
.restoreSession();
199 <?php
if ($GLOBALS['concurrent_layout']): ?
>
200 parent
.left_nav
.setRadio(window
.name
,'his');
201 location
.href
='../history/history_full.php';
203 location
.href
='../history/history_full.php';
207 var GoBack
= function () {
208 top
.restoreSession();
209 <?php
if ($GLOBALS['concurrent_layout']): ?
>
210 <?php
if( $GLOBALS['dutchpc'] ): ?
>
211 parent
.left_nav
.setRadio(window
.name
,'dem');
212 location
.href
='demographics_dutch.php';
214 parent
.left_nav
.setRadio(window
.name
,'dem');
215 location
.href
='demographics.php';
218 location
.href
="patient_summary.php";