2 include_once("../../globals.php");
3 include_once($GLOBALS["srcdir"]."/api.inc");
4 include_once ($GLOBALS['fileroot']."/library/patient.inc");
7 function US_weight($pounds,$mode=1)
12 return $pounds . " " . xl('lb') ;
16 $pounds_int=floor($pounds);
17 $ounces=round(($pounds-$pounds_int)*16);
18 return $pounds_int . " " . xl('lb') . " " . $ounces . " " . xl('oz');
22 function vitals_report( $pid, $encounter, $cols, $id, $print = true) {
24 $data = formFetch("form_vitals", $id);
25 $patient_data = getPatientData($GLOBALS['pid']);
26 $patient_age = getPatientAge($patient_data['DOB']);
30 $vitals .= "<table><tr>";
32 foreach($data as $key => $value) {
34 if ($key == "id" ||
$key == "pid" ||
35 $key == "user" ||
$key == "groupname" ||
36 $key == "authorized" ||
$key == "activity" ||
37 $key == "date" ||
$value == "" ||
38 $value == "0000-00-00 00:00:00" ||
$value == "0.0" )
44 if ($value == "on") { $value = "yes"; }
46 $key = ucwords(str_replace("_"," ",$key));
48 //modified by BM 06-2009 for required translation
49 if ($key == "Temp Method" ||
$key == "BMI Status") {
50 if ($key == "BMI Status") {
51 if ($patient_age <= 20 ||
(preg_match('/month/', $patient_age))) {
52 $value = "See Growth-Chart";
55 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . xl($value) . "</span></td>";
57 elseif ($key == "Bps") {
60 $vitals .= "<td><span class=bold>" . xl('Blood Pressure') . ": </span><span class=text>" . $bps . "/". $bpd . "</span></td>";
66 elseif ($key == "Bpd") {
69 $vitals .= "<td><span class=bold>" . xl('Blood Pressure') . ": </span><span class=text>" . $bps . "/". $bpd . "</span></td>";
75 elseif ($key == "Weight") {
76 $convValue = number_format($value*0.45359237,2);
77 $vitals.="<td><span class=bold>" . xl($key) . ": </span><span class=text>";
78 // show appropriate units
79 $mode=$GLOBALS['us_weight_format'];
80 if ($GLOBALS['units_of_measurement'] == 2) {
81 $vitals .= $convValue . " " . xl('kg') . " (" . US_weight($value,$mode) . ")";
83 elseif ($GLOBALS['units_of_measurement'] == 3) {
84 $vitals .= US_weight($value,$mode) ;
86 elseif ($GLOBALS['units_of_measurement'] == 4) {
87 $vitals .= $convValue . " " . xl('kg') ;
89 else { // = 1 or not set
90 $vitals .= US_weight($value,$mode) . " (" . $convValue . " " . xl('kg') . ")";
92 $vitals.= "</span></td>";
94 elseif ($key == "Height" ||
$key == "Waist Circ" ||
$key == "Head Circ") {
95 $convValue = number_format($value*2.54,2);
96 // show appropriate units
97 if ($GLOBALS['units_of_measurement'] == 2) {
98 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('cm') . " (" . $value . " " . xl('in') . ")</span></td>";
100 elseif ($GLOBALS['units_of_measurement'] == 3) {
101 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('in') . "</span></td>";
103 elseif ($GLOBALS['units_of_measurement'] == 4) {
104 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('cm') . "</span></td>";
106 else { // = 1 or not set
107 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('in') . " (" . $convValue . " " . xl('cm') . ")</span></td>";
110 elseif ($key == "Temperature") {
111 $convValue = number_format((($value-32)*0.5556),2);
112 // show appropriate units
113 if ($GLOBALS['units_of_measurement'] == 2) {
114 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('C') . " (" . $value . " " . xl('F') . ")</span></td>";
116 elseif ($GLOBALS['units_of_measurement'] == 3) {
117 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('F') . "</span></td>";
119 elseif ($GLOBALS['units_of_measurement'] == 4) {
120 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('C') . "</span></td>";
122 else { // = 1 or not set
123 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('F') . " (" . $convValue . " " . xl('C') . ")</span></td>";
127 elseif ($key == "Pulse" ||
$key == "Respiration" ||
$key == "Oxygen Saturation" ||
$key == "BMI") {
128 $value = number_format($value,0);
129 if ($key == "Oxygen Saturation") {
130 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('%') . "</span></td>";
132 elseif ($key == "BMI") {
133 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('kg/m^2') . "</span></td>";
135 else { //pulse and respirations
136 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('per min') . "</span></td>";
140 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>$value</span></td>";
145 if ($count == $cols) {
147 $vitals .= "</tr><tr>\n";
151 $vitals .= "</tr></table>";
153 if ($print) echo $vitals ;