4 $sanitize_all_escapes=true;
7 //STOP FAKE REGISTER GLOBALS
8 $fake_register_globals=false;
11 include_once("../../globals.php");
12 include_once("$srcdir/lists.inc");
13 include_once("$srcdir/acl.inc");
14 include_once("$srcdir/options.inc.php");
15 include_once("$srcdir/formdata.inc.php");
18 <div id
="patient_stats_summary">
21 $thisauth = acl_check('patients', 'med');
23 $tmp = getPatientData($pid, "squad");
24 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
28 echo "<p>(".htmlspecialchars(xl('Issues not authorized'),ENT_NOQUOTES
).")</p>\n";
29 echo "</body>\n</html>\n";
34 <script type
='text/javascript'>
35 function load_location( location
) {
37 if ( !top
.frames
["RTop"] ) {
38 document
.location
=location
;
40 top
.frames
["RTop"].location
=location
;
45 <table id
="patient_stats_issues">
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 = ? AND type = ? AND ";
54 $query .= "(enddate is null or enddate = '' or enddate = '0000-00-00') ";
55 if($GLOBALS['erx_enable'] && $GLOBALS['erx_medication_display'] && $key=='medication')
56 $query .= "and erx_uploaded != '1' ";
57 if($GLOBALS['erx_enable'] && $GLOBALS['erx_allergy_display'] && $key=='allergy')
58 $query .= "and erx_uploaded != '1' ";
59 $query .= "ORDER BY begdate";
60 $pres = sqlStatement($query, array($pid, $key) );
62 if (sqlNumRows($pres) > 0 ||
$ix == 0 ||
$key == "allergy" ||
$key == "medication") {
64 if ($_POST['embeddedScreen']) {
66 // Issues expand collapse widget
67 $widgetTitle = $arr[0];
69 if(($key == "allergy" ||
$key == "medication") && $GLOBALS['erx_enable'])
71 $widgetButtonLabel = xl("Add");
72 $widgetButtonLink = "load_location(\"${GLOBALS['webroot']}/interface/eRx.php?page=medentry\")";
76 $widgetButtonLabel = xl("Edit");
77 $widgetButtonLink = "load_location(\"${GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=" . $key . "\")";
79 $widgetButtonClass = "";
80 $linkMethod = "javascript";
81 $bodyClass = "summary_item small";
84 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
87 <tr
class='issuetitle'>
88 <td colspan
='$numcols'>
89 <span
class="text"><b
><?php
echo htmlspecialchars($arr[0],ENT_NOQUOTES
); ?
></b
></span
>
90 <a href
="javascript:;" class="small" onclick
="load_location('stats_full.php?active=all&category=" . $key . "')">
91 (<b
><?php
echo htmlspecialchars(xl('Manage'),ENT_NOQUOTES
); ?
></b
>)
97 if (sqlNumRows($pres) == 0) {
98 if ( getListTouch($pid,$key) ) {
99 // Data entry has happened to this type, so can display an explicit None.
100 echo " <tr><td colspan='$numcols' class='text'> " . htmlspecialchars( xl('None'), ENT_NOQUOTES
) . "</td></tr>\n";
103 // Data entry has not happened to this type, so show 'Nothing Recorded"
104 echo " <tr><td colspan='$numcols' class='text'> " . htmlspecialchars( xl('Nothing Recorded'), ENT_NOQUOTES
) . "</td></tr>\n";
108 while ($row = sqlFetchArray($pres)) {
109 // output each issue for the $ISSUE_TYPE
110 if (!$row['enddate'] && !$row['returndate'])
111 $rowclass="noend_noreturn";
112 else if (!$row['enddate'] && $row['returndate'])
114 else if ($row['enddate'] && !$row['returndate'])
115 $rowclass = "noreturn";
117 echo " <tr class='text $rowclass;'>\n";
119 //turn allergies red and bold and show the reaction (if exist)
120 if ($key == "allergy") {
122 if (!empty($row['reaction'])) {
123 $reaction = " (" . $row['reaction'] . ")";
125 echo " <td colspan='$numcols' style='color:red;font-weight:bold;'> " . htmlspecialchars( $row['title'] . $reaction, ENT_NOQUOTES
) . "</td>\n";
128 echo " <td colspan='$numcols'> " . htmlspecialchars($row['title'],ENT_NOQUOTES
) . "</td>\n";
134 if ($_POST['embeddedScreen']) {
135 echo "</div></td></tr>";
143 </table
> <!-- end patient_stats_issues
-->
145 <table id
="patient_stats_spreadsheets">
148 // Show spreadsheet forms if any are present.
151 foreach (array('treatment_protocols','injury_log') as $formname) {
152 if (sqlNumRows(sqlStatement("SHOW TABLES LIKE ?", array("form_".$formname) )) > 0) {
153 $dres = sqlStatement("SELECT tp.id, tp.value FROM forms, " .
154 "form_" . add_escape_custom($formname) .
155 " AS tp WHERE forms.pid = ? AND " .
156 "forms.formdir = ? AND tp.id = forms.form_id AND " .
157 "tp.rownbr = -1 AND tp.colnbr = -1 AND tp.value LIKE '0%' " .
158 "ORDER BY tp.value DESC", array($pid, $formname) );
159 if (sqlNumRows($dres) > 0 && $need_head) {
162 echo " <td colspan='$numcols' valign='top'>\n";
163 echo " <span class='title'>Injury Log</span>\n";
167 while ($row = sqlFetchArray($dres)) {
168 list($completed, $start_date, $template_name) = explode('|', $row['value'], 3);
170 echo " <td colspan='$numcols'> ";
171 echo "<a class='link' href='javascript:;' ";
172 echo "onclick='load_location(\"../../forms/$formname/new.php?popup=1&id=";
173 echo htmlspecialchars($row['id'],ENT_QUOTES
) . "\")'>" .
174 htmlspecialchars($start_date,ENT_NOQUOTES
) . " " .
175 htmlspecialchars($template_name,ENT_NOQUOTES
) . "</a></td>\n";
181 </table
> <!-- end patient_stats_spreadsheets
-->
183 <?php
if (!$GLOBALS['disable_immunizations'] && !$GLOBALS['weight_loss_clinic']) { ?
>
185 <table id
="patient_stats_imm">
187 <?php
if ($_POST['embeddedScreen']) {
189 // Issues expand collapse widget
190 $widgetTitle = xl('Immunizations');
191 $widgetLabel = "immunizations";
192 $widgetButtonLabel = xl("Edit");
193 $widgetButtonLink = "javascript:load_location(\"${GLOBALS['webroot']}/interface/patient_file/summary/immunizations.php\")";
194 $widgetButtonClass = "";
195 $linkMethod = "javascript";
196 $bodyClass = "summary_item small";
199 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
202 <td colspan
='<?php echo $numcols ?>' valign
='top'>
203 <span
class="text"><b
><?php
echo htmlspecialchars(xl('Immunizations', 'e'),ENT_NOQUOTES
); ?
></b
></span
>
204 <a href
="javascript:;" class="small" onclick
="javascript:load_location('immunizations.php')">
205 (<b
><?php
echo htmlspecialchars(xl('Manage'),ENT_NOQUOTES
) ?
></b
>)
212 $sql = "select i1.id as id, i1.immunization_id as immunization_id, i1.cvx_code as cvx_code, c.code_text_short as cvx_text, ".
213 " if (i1.administered_date, concat(i1.administered_date,' - '), substring(i1.note,1,20)) as immunization_data ".
214 " from immunizations i1 ".
215 " left join codes c on CAST(IFNULL(i1.cvx_code,0) AS CHAR) = c.code ".
216 " left join code_types ct on c.code_type = ct.ct_id ".
217 " where i1.patient_id = ? ".
218 " AND (( i1.cvx_code = '0' OR i1.cvx_code IS NULL ) OR ".
219 " ( ( i1.cvx_code != '0' AND i1.cvx_code IS NOT NULL ) AND ct.ct_key = 'CVX') ) ".
220 " order by i1.administered_date desc";
222 $result = sqlStatement($sql, array($pid) );
224 if (sqlNumRows($result) == 0) {
225 echo " <table><tr>\n";
226 echo " <td colspan='$numcols' class='text'> " . htmlspecialchars( xl('None'), ENT_NOQUOTES
) . "</td>\n";
227 echo " </tr></table>\n";
230 while ($row=sqlFetchArray($result)){
232 echo "<a class='link'";
233 echo "' href='javascript:;' onclick='javascript:load_location(\"immunizations.php?mode=edit&id=".htmlspecialchars($row['id'],ENT_QUOTES
) . "\")'>" .
234 htmlspecialchars($row{'immunization_data'},ENT_NOQUOTES
);
236 // Figure out which name to use (ie. from cvx list or from the custom list)
237 if ($GLOBALS['use_custom_immun_list']) {
238 echo generate_display_field(array('data_type'=>'1','list_id'=>'immunizations'), $row['immunization_id']);
241 if (!(empty($row['cvx_text']))) {
242 echo htmlspecialchars( xl($row['cvx_text']), ENT_NOQUOTES
);
245 echo generate_display_field(array('data_type'=>'1','list_id'=>'immunizations'), $row['immunization_id']);
252 <?php
if ($_POST['embeddedScreen']) {
253 echo "</td></tr></div>";
258 </table
> <!-- end patient_stats_imm
-->
262 <?php
if (!$GLOBALS['disable_prescriptions']) { ?
>
264 <table id
="patient_stats_prescriptions">
265 <?php
if($GLOBALS['erx_enable']){ ?
>
267 <?php
if ($_POST['embeddedScreen']) {
269 $widgetTitle = xl('Current Medications');
270 $widgetLabel = "current_prescriptions";
271 $widgetButtonLabel = '';
272 $widgetButtonLink = '';
273 $widgetButtonClass = '';
275 $bodyClass = "summary_item small";
278 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
283 $res=sqlStatement("select * from prescriptions where patient_id=? and active='1'",array($pid));
287 if(sqlNumRows($res)==0)
291 <td
><?php
echo htmlspecialchars(xl('None'), ENT_NOQUOTES
);?
></td
>
295 while($row_currentMed=sqlFetchArray($res))
297 $runit=generate_display_field(array('data_type'=>'1','list_id'=>'drug_units'),$row_currentMed['unit']);
298 $rin=generate_display_field(array('data_type'=>'1','list_id'=>'drug_form'),$row_currentMed['form']);
299 $rroute=generate_display_field(array('data_type'=>'1','list_id'=>'drug_route'),$row_currentMed['route']);
300 $rint=generate_display_field(array('data_type'=>'1','list_id'=>'drug_interval'),$row_currentMed['interval']);
302 <tr
class=text style
='font-weight:bold;color:blue;'>
303 <td
><?php
echo $row_currentMed['drug'];?
></td
>
304 <td
><?php
$unit=''; if($row_currentMed['size']>0) $unit=$row_currentMed['size']." ".$runit." "; echo htmlspecialchars($unit." ".$row_currentMed['dosage']." ".$rin." ".$rroute." ".$rint,ENT_NOQUOTES
);?
></td
>
312 <tr
><td colspan
='<?php echo $numcols ?>' class='issuetitle'>
314 <?php
if ($_POST['embeddedScreen']) {
315 // Issues expand collapse widget
316 $widgetLabel = "prescriptions";
317 $linkMethod = "html";
318 if($GLOBALS['erx_enable'])
320 $widgetTitle = xl('Prescription History');
321 $widgetButtonLabel = xl("Add/Edit eRx");
322 $widgetButtonLink = $GLOBALS['webroot'] . "/interface/eRx.php?page=compose";
323 $widgetButtonClass = "";
327 $widgetTitle = xl('Prescription');
328 $widgetButtonLabel = xl("Edit");
329 $widgetButtonLink = $GLOBALS['webroot'] . "/interface/patient_file/summary/rx_frameset.php";
330 $widgetButtonClass = "iframe rx_modal";
332 $bodyClass = "summary_item small";
335 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
338 <span
class='text'><b
><?php
echo htmlspecialchars(xl('Prescriptions'),ENT_NOQUOTES
); ?
></b
></span
>
346 require_once("library/classes/Controller.class.php");
347 $c = new Controller();
348 echo $c->act(array("prescription" => "", "fragment" => "", "patient_id" => $pid));
351 <?php
if ($_POST['embeddedScreen']) {
356 </table
> <!-- end patient_stats_prescriptions
-->
360 </div
> <!-- end patient_stats_summary
-->