2 include_once("../../globals.php");
3 include_once("$srcdir/lists.inc");
4 include_once("$srcdir/acl.inc");
5 include_once("$srcdir/options.inc.php");
7 // We used to present a more complex list for "medical problem" issues
8 // for athletic teams. However we decided in May 2008 to stop that.
9 // The logic remains in case minds are again changed. -- Rod
11 $fancy_stats = false; // $GLOBALS['athletic_team'];
16 <?php
html_header_show();?
>
17 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
20 font
-family
: sans
-serif
;
21 text
-decoration
: none
;
28 <body
class="body_bottom">
30 <div id
="patient_stats_summary">
33 $thisauth = acl_check('patients', 'med');
35 $tmp = getPatientData($pid, "squad");
36 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
40 echo "<p>(".xl('Issues not authorized').")</p>\n";
41 echo "</body>\n</html>\n";
46 <table id
="patient_stats_issues">
49 $numcols = $fancy_stats ?
'7' : '1';
51 foreach ($ISSUE_TYPES as $key => $arr) {
52 // $result = getListByType($pid, $key, "id,title,begdate,enddate,returndate,extrainfo", "all", "all", 0);
54 $query = "SELECT * FROM lists WHERE pid = $pid AND type = '$key' AND ";
56 $query .= "( enddate IS NULL OR returndate IS NULL ) ";
58 $query .= "enddate IS NULL ";
60 $query .= "ORDER BY begdate";
61 $pres = sqlStatement($query);
63 if (mysql_num_rows($pres) > 0 ||
$ix == 0) {
65 // output a header for the $ISSUE_TYPE
66 echo " <tr class='issuetitle'>\n";
67 echo " <td colspan='$numcols'>\n";
68 echo " <a href='stats_full.php?active=all' target='";
69 echo $GLOBALS['concurrent_layout'] ?
"_parent" : "Main";
70 echo "' onclick='top.restoreSession()'><span class='title'>" .
71 $arr[0] . "</span> <span class='more'>$tmore</span></a>\n";
75 // Show headers if this is a long line.
76 if ($fancy_stats && $arr[3] == 0 && mysql_num_rows($pres) > 0) {
77 echo " <tr class='issueheaders'>\n";
78 echo " <td> <b>" .xl('Title'). "</b></td>\n";
79 echo " <td> <b>" .xl('Diag'). "</b></td>\n";
80 echo " <td> <b>" .xl('Start'). "</b></td>\n";
81 echo " <td> <b>" .xl('Return'). "</b></td>\n";
82 echo " <td> <b>" .xl('Games'). "</b></td>\n";
83 echo " <td class='right'> <b>" .xl('Days'). "</b></td>\n";
84 echo " <td class='right'> <b>" .xl('Enc'). "</b></td>\n";
88 while ($row = sqlFetchArray($pres)) {
89 // output each issue for the $ISSUE_TYPE
90 if (!$row['enddate'] && !$row['returndate'])
91 $rowclass="noend_noreturn";
92 else if (!$row['enddate'] && $row['returndate'])
94 else if ($row['enddate'] && !$row['returndate'])
95 $rowclass = "noreturn";
97 echo " <tr class='$rowclass;'>\n";
99 if ($fancy_stats && $arr[3] == 0) {
100 $endsecs = $row['returndate'] ?
strtotime($row['returndate']) : time();
101 $daysmissed = round(($endsecs - strtotime($row['begdate'])) / (60 * 60 * 24));
102 $ierow = sqlQuery("SELECT count(*) AS count FROM issue_encounter " .
103 "WHERE list_id = '" . $row['id'] . "'");
104 // echo " <td><a class='link' target='Main' href='stats_full.php?active=1'>" .
105 // $row['title'] . "</a></td>\n";
106 echo " <td> " . $row['title'] . "</td>\n";
107 echo " <td> " . $row['diagnosis'] . "</td>\n";
108 echo " <td> " . $row['begdate'] . "</td>\n";
109 echo " <td> " . $row['returndate'] . "</td>\n";
110 echo " <td> " . $row['extrainfo'] . "</td>\n";
111 echo " <td class='right'> $daysmissed</td>\n";
112 echo " <td class='right'> " . $ierow['count'] . "</td>\n";
114 echo " <td colspan='$numcols'> " . $row['title'] . "</td>\n";
126 </table
> <!-- end patient_stats_issues
-->
128 <table id
="patient_stats_spreadsheets">
131 // Show spreadsheet forms if any are present.
134 foreach (array('treatment_protocols','injury_log') as $formname) {
135 if (mysql_num_rows(sqlStatement("SHOW TABLES LIKE 'form_$formname'")) > 0) {
136 $dres = sqlStatement("SELECT tp.id, tp.value FROM forms, " .
137 "form_$formname AS tp WHERE forms.pid = $pid AND " .
138 "forms.formdir = '$formname' AND tp.id = forms.form_id AND " .
139 "tp.rownbr = -1 AND tp.colnbr = -1 AND tp.value LIKE '0%' " .
140 "ORDER BY tp.value DESC");
141 if (mysql_num_rows($dres) > 0 && $need_head) {
144 echo " <td colspan='$numcols' valign='top'>\n";
145 echo " <span class='title'>Injury Log</span>\n";
149 while ($row = sqlFetchArray($dres)) {
150 list($completed, $start_date, $template_name) = explode('|', $row['value'], 3);
152 echo " <td colspan='$numcols'> ";
153 echo "<a class='link' target='_blank' ";
154 echo "href='../../forms/$formname/new.php?popup=1&id=";
155 echo $row['id'] . "' onclick='top.restoreSession()'>$start_date $template_name</a></td>\n";
161 </table
> <!-- end patient_stats_spreadsheets
-->
163 <?php
if (!$GLOBALS['weight_loss_clinic']) { ?
>
164 <table id
="patient_stats_imm">
165 <tr
class='issuetitle'>
166 <td colspan
='<?php echo $numcols ?>' valign
='top'>
167 <a href
="immunizations.php"
168 target
="<?php echo $GLOBALS['concurrent_layout'] ? "_parent
" : "Main
"; ?>"
169 onclick
="top.restoreSession()">
170 <span
class="title"><?php
xl('Immunizations','e'); ?
></span
>
171 <span
class=more
><?php
echo $tmore;?
></span
></a
>
176 $sql = "select i1.id as id, i1.immunization_id as immunization_id,".
177 " if (i1.administered_date, concat(i1.administered_date,' - '), substring(i1.note,1,20)) as immunization_data ".
178 " from immunizations i1 ".
179 " where i1.patient_id = $pid ".
180 " order by i1.immunization_id, i1.administered_date desc";
182 $result = sqlStatement($sql);
184 while ($row=sqlFetchArray($result)){
186 echo "<a class='link' target='";
187 echo $GLOBALS['concurrent_layout'] ?
"_parent" : "Main";
188 echo "' href='immunizations.php?mode=edit&id=".$row['id']."' onclick='top.restoreSession()'>" .
189 $row{'immunization_data'} .
190 generate_display_field(array('data_type'=>'1','list_id'=>'immunizations'), $row['immunization_id']) .
196 </table
> <!-- end patient_stats_imm
-->
200 <table id
="patient_stats_prescriptions">
201 <tr
><td colspan
='<?php echo $numcols ?>' class='issuetitle'>
202 <span
class='title'><?php
echo xl('Prescriptions'); ?
></span
>
208 require_once("library/classes/Controller.class.php");
209 $c = new Controller();
210 echo $c->act(array("prescription" => "", "block" => "", "patient_id" => $pid));
213 </table
> <!-- end patient_stats_prescriptions
-->
215 </div
> <!-- end patient_stats_summary
-->