2 include_once("../../globals.php");
3 include_once("$srcdir/lists.inc");
4 include_once("$srcdir/acl.inc");
9 <link rel
=stylesheet href
="<?echo $css_header;?>" type
="text/css">
12 font
-family
: sans
-serif
;
13 text
-decoration
: none
;
20 <body
<?
echo $bottom_bg_line;?
> topmargin
='0' rightmargin
='0' leftmargin
='2'
21 bottommargin
='0' marginwidth
='2' marginheight
='0'>
24 $thisauth = acl_check('patients', 'med');
26 $tmp = getPatientData($pid, "squad");
27 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
31 echo "<p>(".xl('Issues not authorized').")</p>\n";
32 echo "</body>\n</html>\n";
37 <table cellpadding
='0' cellspacing
='0'>
40 $numcols = $GLOBALS['athletic_team'] ?
'7' : '1';
42 foreach ($ISSUE_TYPES as $key => $arr) {
43 // $result = getListByType($pid, $key, "id,title,begdate,enddate,returndate,extrainfo", "all", "all", 0);
45 $query = "SELECT * FROM lists WHERE pid = $pid AND type = '$key' AND ";
46 if ($GLOBALS['athletic_team']) {
47 $query .= "( enddate IS NULL OR returndate IS NULL ) ";
49 $query .= "enddate IS NULL ";
51 $query .= "ORDER BY begdate";
52 $pres = sqlStatement($query);
54 if (mysql_num_rows($pres) > 0 ||
$ix == 0) {
56 echo " <td colspan='$numcols' valign='top'>\n";
57 echo " <a href='stats_full.php?active=all' target='";
58 echo $GLOBALS['concurrent_layout'] ?
"_parent" : "Main";
59 echo "'><font class='title'>" .
60 $arr[0] . "</font><font class='more'>$tmore</font></a>\n";
64 // Show headers if this is a long line.
65 if ($GLOBALS['athletic_team'] && $arr[3] == 0 && mysql_num_rows($pres) > 0) {
67 echo " <td class='link'> <b>" .xl('Title'). "</b></td>\n";
68 echo " <td class='link'> <b>" .xl('Diag'). "</b></td>\n";
69 echo " <td class='link'> <b>" .xl('Start'). "</b></td>\n";
70 echo " <td class='link'> <b>" .xl('Return'). "</b></td>\n";
71 echo " <td class='link'> <b>" .xl('Games'). "</b></td>\n";
72 echo " <td class='link' align='right'> <b>" .xl('Days'). "</b></td>\n";
73 echo " <td class='link' align='right'> <b>" .xl('Enc'). "</b></td>\n";
77 while ($row = sqlFetchArray($pres)) {
78 $rowcolor = '#000000';
79 if (!$row['enddate'] && !$row['returndate'])
80 $rowcolor = '#ee0000';
81 else if (!$row['enddate'] && $row['returndate'])
82 $rowcolor = '#dd5500';
83 else if ($row['enddate'] && !$row['returndate'])
84 $rowcolor = '#0000ff';
86 echo " <tr style='color:$rowcolor;'>\n";
88 if ($GLOBALS['athletic_team'] && $arr[3] == 0) {
89 $endsecs = $row['returndate'] ?
strtotime($row['returndate']) : time();
90 $daysmissed = round(($endsecs - strtotime($row['begdate'])) / (60 * 60 * 24));
91 $ierow = sqlQuery("SELECT count(*) AS count FROM issue_encounter " .
92 "WHERE list_id = '" . $row['id'] . "'");
93 // echo " <td><a class='link' target='Main' href='stats_full.php?active=1'>" .
94 // $row['title'] . "</a></td>\n";
95 echo " <td class='link' style='color:$rowcolor;'> " . $row['title'] . "</td>\n";
96 echo " <td class='link' style='color:$rowcolor;'> " . $row['diagnosis'] . "</td>\n";
97 echo " <td class='link' style='color:$rowcolor;'> " . $row['begdate'] . "</td>\n";
98 echo " <td class='link' style='color:$rowcolor;'> " . $row['returndate'] . "</td>\n";
99 echo " <td class='link' style='color:$rowcolor;'> " . $row['extrainfo'] . "</td>\n";
100 echo " <td class='link' style='color:$rowcolor;' align='right'> $daysmissed</td>\n";
101 echo " <td class='link' style='color:$rowcolor;' align='right'> " . $ierow['count'] . "</td>\n";
103 echo " <td colspan='$numcols' class='link'> " . $row['title'] . "</td>\n";
115 // Show treatments if any are present.
117 if (mysql_num_rows(sqlStatement("SHOW TABLES LIKE 'form_treatment_protocols'")) > 0) {
118 $dres = sqlStatement("SELECT tp.id, tp.value FROM forms, " .
119 "form_treatment_protocols AS tp WHERE forms.pid = $pid AND " .
120 "forms.formdir = 'treatment_protocols' AND tp.id = forms.form_id AND " .
121 "tp.rownbr = -1 AND tp.colnbr = -1 AND tp.value LIKE '0%' " .
122 "ORDER BY tp.value DESC");
123 if (mysql_num_rows($dres) > 0) {
125 echo " <td colspan='$numcols' valign='top'>\n";
126 echo " <font class='title'>Treatments</font>\n";
129 while ($row = sqlFetchArray($dres)) {
130 list($completed, $start_date, $template_name) = explode('|', $row['value'], 3);
132 echo " <td colspan='$numcols'> ";
133 echo "<a class='link' target='_blank' ";
134 echo "href='../../forms/treatment_protocols/new.php?popup=1&id=";
135 echo $row['id'] . "'>$start_date $template_name</a></td>\n";
142 <?php
if (!$GLOBALS['weight_loss_clinic']) { ?
>
144 <td colspan
='<?php echo $numcols ?>' valign
='top'>
145 <a href
="immunizations.php"
146 target
="<?php echo $GLOBALS['concurrent_layout'] ? "_parent
" : "Main
"; ?>">
147 <font
class="title"><?
xl('Immunizations','e'); ?
></font
>
148 <font
class=more
><?
echo $tmore;?
></font
></a
><br
>
151 $sql = "select if(i1.administered_date
152 ,concat(i1.administered_date,' - ',i2.name)
153 ,substring(i1.note,1,20)
154 ) as immunization_data
155 from immunizations i1
156 left join immunization i2
157 on i1.immunization_id = i2.id
158 where i1.patient_id = $pid
159 order by administered_date desc";
161 $result = sqlStatement($sql);
163 while ($row=sqlFetchArray($result)){
164 echo "<a class='link' target='";
165 echo $GLOBALS['concurrent_layout'] ?
"_parent" : "Main";
166 echo "' href='immunizations.php'>" . $row{'immunization_data'} . "</a><br>\n";
174 <td colspan
='<?php echo $numcols ?>' valign
='top'>
178 require_once("library/classes/Controller.class.php");
179 $c = new Controller();
180 echo '<font class="title">'.xl('Prescriptions').'</font>';
181 echo $c->act(array("prescription" => "", "block" => "", "patient_id" => $pid));