2 include_once("../../globals.php");
3 include_once("$srcdir/lists.inc");
4 include_once("$srcdir/acl.inc");
6 // We used to present a more complex list for "medical problem" issues
7 // for athletic teams. However we decided in May 2008 to stop that.
8 // The logic remains in case minds are again changed. -- Rod
10 $fancy_stats = false; // $GLOBALS['athletic_team'];
15 <?php
html_header_show();?
>
16 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
19 font
-family
: sans
-serif
;
20 text
-decoration
: none
;
27 <body
class="body_bottom">
29 <div id
="patient_stats_summary">
32 $thisauth = acl_check('patients', 'med');
34 $tmp = getPatientData($pid, "squad");
35 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
39 echo "<p>(".xl('Issues not authorized').")</p>\n";
40 echo "</body>\n</html>\n";
45 <table id
="patient_stats_issues">
48 $numcols = $fancy_stats ?
'7' : '1';
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 = $pid AND type = '$key' AND ";
55 $query .= "( enddate IS NULL OR returndate IS NULL ) ";
57 $query .= "enddate IS NULL ";
59 $query .= "ORDER BY begdate";
60 $pres = sqlStatement($query);
62 if (mysql_num_rows($pres) > 0 ||
$ix == 0) {
64 // output a header for the $ISSUE_TYPE
65 echo " <tr class='issuetitle'>\n";
66 echo " <td colspan='$numcols'>\n";
67 echo " <a href='stats_full.php?active=all' target='";
68 echo $GLOBALS['concurrent_layout'] ?
"_parent" : "Main";
69 echo "' onclick='top.restoreSession()'><span class='title'>" .
70 $arr[0] . "</span> <span class='more'>$tmore</span></a>\n";
74 // Show headers if this is a long line.
75 if ($fancy_stats && $arr[3] == 0 && mysql_num_rows($pres) > 0) {
76 echo " <tr class='issueheaders'>\n";
77 echo " <td> <b>" .xl('Title'). "</b></td>\n";
78 echo " <td> <b>" .xl('Diag'). "</b></td>\n";
79 echo " <td> <b>" .xl('Start'). "</b></td>\n";
80 echo " <td> <b>" .xl('Return'). "</b></td>\n";
81 echo " <td> <b>" .xl('Games'). "</b></td>\n";
82 echo " <td class='right'> <b>" .xl('Days'). "</b></td>\n";
83 echo " <td class='right'> <b>" .xl('Enc'). "</b></td>\n";
87 while ($row = sqlFetchArray($pres)) {
88 // output each issue for the $ISSUE_TYPE
89 if (!$row['enddate'] && !$row['returndate'])
90 $rowclass="noend_noreturn";
91 else if (!$row['enddate'] && $row['returndate'])
93 else if ($row['enddate'] && !$row['returndate'])
94 $rowclass = "noreturn";
96 echo " <tr class='$rowclass;'>\n";
98 if ($fancy_stats && $arr[3] == 0) {
99 $endsecs = $row['returndate'] ?
strtotime($row['returndate']) : time();
100 $daysmissed = round(($endsecs - strtotime($row['begdate'])) / (60 * 60 * 24));
101 $ierow = sqlQuery("SELECT count(*) AS count FROM issue_encounter " .
102 "WHERE list_id = '" . $row['id'] . "'");
103 // echo " <td><a class='link' target='Main' href='stats_full.php?active=1'>" .
104 // $row['title'] . "</a></td>\n";
105 echo " <td> " . $row['title'] . "</td>\n";
106 echo " <td> " . $row['diagnosis'] . "</td>\n";
107 echo " <td> " . $row['begdate'] . "</td>\n";
108 echo " <td> " . $row['returndate'] . "</td>\n";
109 echo " <td> " . $row['extrainfo'] . "</td>\n";
110 echo " <td class='right'> $daysmissed</td>\n";
111 echo " <td class='right'> " . $ierow['count'] . "</td>\n";
113 echo " <td colspan='$numcols'> " . $row['title'] . "</td>\n";
125 </table
> <!-- end patient_stats_issues
-->
127 <table id
="patient_stats_spreadsheets">
130 // Show spreadsheet forms if any are present.
133 foreach (array('treatment_protocols','injury_log') as $formname) {
134 if (mysql_num_rows(sqlStatement("SHOW TABLES LIKE 'form_$formname'")) > 0) {
135 $dres = sqlStatement("SELECT tp.id, tp.value FROM forms, " .
136 "form_$formname AS tp WHERE forms.pid = $pid AND " .
137 "forms.formdir = '$formname' AND tp.id = forms.form_id AND " .
138 "tp.rownbr = -1 AND tp.colnbr = -1 AND tp.value LIKE '0%' " .
139 "ORDER BY tp.value DESC");
140 if (mysql_num_rows($dres) > 0 && $need_head) {
143 echo " <td colspan='$numcols' valign='top'>\n";
144 echo " <span class='title'>Injury Log</span>\n";
148 while ($row = sqlFetchArray($dres)) {
149 list($completed, $start_date, $template_name) = explode('|', $row['value'], 3);
151 echo " <td colspan='$numcols'> ";
152 echo "<a class='link' target='_blank' ";
153 echo "href='../../forms/$formname/new.php?popup=1&id=";
154 echo $row['id'] . "' onclick='top.restoreSession()'>$start_date $template_name</a></td>\n";
160 </table
> <!-- end patient_stats_spreadsheets
-->
162 <?php
if (!$GLOBALS['weight_loss_clinic']) { ?
>
163 <table id
="patient_stats_imm">
164 <tr
class='issuetitle'>
165 <td colspan
='<?php echo $numcols ?>' valign
='top'>
166 <a href
="immunizations.php"
167 target
="<?php echo $GLOBALS['concurrent_layout'] ? "_parent
" : "Main
"; ?>"
168 onclick
="top.restoreSession()">
169 <span
class="title"><?php
xl('Immunizations','e'); ?
></span
>
170 <span
class=more
><?php
echo $tmore;?
></span
></a
>
175 $sql = "select i1.id as id, ".
176 " if (i1.administered_date, concat(i1.administered_date,' - ',i2.name), substring(i1.note,1,20)) as immunization_data ".
177 " from immunizations i1 ".
178 " left join immunization i2 ".
179 " on i1.immunization_id = i2.id ".
180 " where i1.patient_id = $pid ".
181 " order by i2.name, i1.administered_date desc";
183 $result = sqlStatement($sql);
185 while ($row=sqlFetchArray($result)){
187 echo "<a class='link' target='";
188 echo $GLOBALS['concurrent_layout'] ?
"_parent" : "Main";
189 echo "' href='immunizations.php?mode=edit&id=".$row['id']."' onclick='top.restoreSession()'>" .
190 $row{'immunization_data'} . "</a><br>\n";
195 </table
> <!-- end patient_stats_imm
-->
199 <table id
="patient_stats_prescriptions">
200 <tr
><td colspan
='<?php echo $numcols ?>' class='issuetitle'>
201 <span
class='title'><?php
echo xl('Prescriptions'); ?
></span
>
207 require_once("library/classes/Controller.class.php");
208 $c = new Controller();
209 echo $c->act(array("prescription" => "", "block" => "", "patient_id" => $pid));
212 </table
> <!-- end patient_stats_prescriptions
-->
214 </div
> <!-- end patient_stats_summary
-->