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']);
29 $vitals .= "<table><tr>";
31 foreach($data as $key => $value) {
33 if ($key == "id" ||
$key == "pid" ||
34 $key == "user" ||
$key == "groupname" ||
35 $key == "authorized" ||
$key == "activity" ||
36 $key == "date" ||
$value == "" ||
37 $value == "0000-00-00 00:00:00" ||
$value == "0.0" )
43 if ($value == "on") { $value = "yes"; }
45 $key = ucwords(str_replace("_"," ",$key));
47 //modified by BM 06-2009 for required translation
48 if ($key == "Temp Method" ||
$key == "BMI Status") {
49 if ($key == "BMI Status") {
50 if ($patient_age <= 20 ||
(preg_match('/month/', $patient_age))) {
51 $value = "See Growth-Chart";
54 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . xl($value) . "</span></td>";
56 elseif ($key == "Bps") {
59 $vitals .= "<td><span class=bold>" . xl('Blood Pressure') . ": </span><span class=text>" . $bps . "/". $bpd . "</span></td>";
65 elseif ($key == "Bpd") {
68 $vitals .= "<td><span class=bold>" . xl('Blood Pressure') . ": </span><span class=text>" . $bps . "/". $bpd . "</span></td>";
74 elseif ($key == "Weight") {
75 $convValue = number_format($value*0.45359237,2);
76 $vitals.="<td><span class=bold>" . xl($key) . ": </span><span class=text>";
77 // show appropriate units
78 $mode=$GLOBALS['us_weight_format'];
79 if ($GLOBALS['units_of_measurement'] == 2) {
80 $vitals .= $convValue . " " . xl('kg') . " (" . US_weight($value,$mode) . ")";
82 elseif ($GLOBALS['units_of_measurement'] == 3) {
83 $vitals .= US_weight($value,$mode) ;
85 elseif ($GLOBALS['units_of_measurement'] == 4) {
86 $vitals .= $convValue . " " . xl('kg') ;
88 else { // = 1 or not set
89 $vitals .= US_weight($value,$mode) . " (" . $convValue . " " . xl('kg') . ")";
91 $vitals.= "</span></td>";
93 elseif ($key == "Height" ||
$key == "Waist Circ" ||
$key == "Head Circ") {
94 $convValue = number_format($value*2.54,2);
95 // show appropriate units
96 if ($GLOBALS['units_of_measurement'] == 2) {
97 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('cm') . " (" . $value . " " . xl('in') . ")</span></td>";
99 elseif ($GLOBALS['units_of_measurement'] == 3) {
100 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('in') . "</span></td>";
102 elseif ($GLOBALS['units_of_measurement'] == 4) {
103 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('cm') . "</span></td>";
105 else { // = 1 or not set
106 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('in') . " (" . $convValue . " " . xl('cm') . ")</span></td>";
109 elseif ($key == "Temperature") {
110 $convValue = number_format((($value-32)*0.5556),2);
111 // show appropriate units
112 if ($GLOBALS['units_of_measurement'] == 2) {
113 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('C') . " (" . $value . " " . xl('F') . ")</span></td>";
115 elseif ($GLOBALS['units_of_measurement'] == 3) {
116 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('F') . "</span></td>";
118 elseif ($GLOBALS['units_of_measurement'] == 4) {
119 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('C') . "</span></td>";
121 else { // = 1 or not set
122 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('F') . " (" . $convValue . " " . xl('C') . ")</span></td>";
126 elseif ($key == "Pulse" ||
$key == "Respiration" ||
$key == "Oxygen Saturation" ||
$key == "BMI") {
127 $value = number_format($value,0);
128 if ($key == "Oxygen Saturation") {
129 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('%') . "</span></td>";
131 elseif ($key == "BMI") {
132 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('kg/m^2') . "</span></td>";
134 else { //pulse and respirations
135 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('per min') . "</span></td>";
139 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>$value</span></td>";
144 if ($count == $cols) {
146 $vitals .= "</tr><tr>\n";
150 $vitals .= "</tr></table>";
152 if ($print) echo $vitals ;