From 6ffb726db6194fa88772528315835c3bd065e463 Mon Sep 17 00:00:00 2001 From: sunsetsystems Date: Tue, 29 Jul 2008 17:00:24 +0000 Subject: [PATCH] added a read-only data type for the patients active allergies, and a minor cosmetic fix --- library/options.inc.php | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/library/options.inc.php b/library/options.inc.php index 5ff5cd1bd..3b686f3b9 100644 --- a/library/options.inc.php +++ b/library/options.inc.php @@ -261,6 +261,22 @@ function generate_form_field($frow, $currvalue) { echo ""; } + // the list of active allergies for the current patient + // this is read-only! + else if ($data_type == 24) { + $query = "SELECT title, comments FROM lists WHERE " . + "pid = '" . $GLOBALS['pid'] . "' AND type = 'allergy' AND enddate IS NULL " . + "ORDER BY begdate"; + // echo "\n"; // debugging + $lres = sqlStatement($query); + $count = 0; + while ($lrow = sqlFetchArray($lres)) { + if ($count++) echo "
"; + echo $lrow['title']; + if ($lrow['comments']) echo ' (' . $lrow['comments'] . ')'; + } + } + } function generate_display_field($frow, $currvalue) { @@ -367,8 +383,8 @@ function generate_display_field($frow, $currvalue) { while ($lrow = sqlFetchArray($lres)) { $option_id = $lrow['option_id']; if (empty($avalue[$option_id])) continue; - $s .= "" . $lrow['title'] . ": "; - $s .= "" . $avalue[$option_id] . ""; + $s .= "" . $lrow['title'] . ": "; + $s .= "" . $avalue[$option_id] . ""; } $s .= ""; } @@ -390,15 +406,30 @@ function generate_display_field($frow, $currvalue) { $restype = substr($avalue[$option_id], 0, 1); $resnote = substr($avalue[$option_id], 2); if (empty($restype) && empty($resnote)) continue; - $s .= "" . $lrow['title'] . " "; + $s .= "" . $lrow['title'] . " "; $restype = ($restype == '1') ? 'Normal' : (($restype == '2') ? 'Abnormal' : 'N/A'); - $s .= "$restype"; - $s .= "$resnote"; + $s .= "$restype"; + $s .= "$resnote"; $s .= ""; } $s .= ""; } + // the list of active allergies for the current patient + else if ($data_type == 24) { + $query = "SELECT title, comments FROM lists WHERE " . + "pid = '" . $GLOBALS['pid'] . "' AND type = 'allergy' AND enddate IS NULL " . + "ORDER BY begdate"; + // echo "\n"; // debugging + $lres = sqlStatement($query); + $count = 0; + while ($lrow = sqlFetchArray($lres)) { + if ($count++) $s .= "
"; + $s .= $lrow['title']; + if ($lrow['comments']) $s .= ' (' . $lrow['comments'] . ')'; + } + } + return $s; } @@ -476,7 +507,7 @@ function display_layout_rows($formtype, $result1, $result2='') { // Handle starting of a new row. if (($titlecols > 0 && $cell_count >= $CPR) || $cell_count == 0) { disp_end_row(); - echo " "; + echo " "; if ($group_name) { echo "$group_name"; $group_name = ''; @@ -491,7 +522,7 @@ function display_layout_rows($formtype, $result1, $result2='') { // Handle starting of a new label cell. if ($titlecols > 0) { disp_end_cell(); - echo ""; $cell_count += $titlecols; @@ -503,7 +534,7 @@ function display_layout_rows($formtype, $result1, $result2='') { // Handle starting of a new data cell. if ($datacols > 0) { disp_end_cell(); - echo " 0) echo " style='padding-left:5pt'"; echo ">"; $cell_count += $datacols; -- 2.11.4.GIT