External database import utility.
[openemr.git] / interface / forms / vitals / report.php
bloba7494d4d0746a1daf26b2a3488cfbb10e330ecf7
1 <?php
2 include_once("../../globals.php");
3 include_once($GLOBALS["srcdir"]."/api.inc");
4 include_once ($GLOBALS['fileroot']."/library/patient.inc");
6 function vitals_report( $pid, $encounter, $cols, $id, $print = true) {
7 $count = 0;
8 $data = formFetch("form_vitals", $id);
9 $patient_data = getPatientData($GLOBALS['pid']);
10 $patient_age = getPatientAge($patient_data['DOB']);
12 if ($data) {
13 $vitals .= "<table><tr>";
15 foreach($data as $key => $value) {
17 if ($key == "id" || $key == "pid" ||
18 $key == "user" || $key == "groupname" ||
19 $key == "authorized" || $key == "activity" ||
20 $key == "date" || $value == "" ||
21 $value == "0000-00-00 00:00:00" || $value == "0.0" )
23 // skip certain data
24 continue;
27 if ($value == "on") { $value = "yes"; }
29 $key=ucwords(str_replace("_"," ",$key));
31 //modified by BM 06-2009 for required translation
32 if ($key == "Temp Method" || $key == "BMI Status") {
33 if ($key == "BMI Status") {
34 if ($patient_age <= 20 || (preg_match('/month/', $patient_age))) {
35 $value = "See Growth-Chart";
38 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . xl($value) . "</span></td>";
40 elseif ($key == "Bps") {
41 $bps = $value;
42 if ($bpd) {
43 $vitals .= "<td><span class=bold>" . xl('Blood Pressure') . ": </span><span class=text>" . $bps . "/". $bpd . "</span></td>";
45 else {
46 continue;
49 elseif ($key == "Bpd") {
50 $bpd = $value;
51 if ($bps) {
52 $vitals .= "<td><span class=bold>" . xl('Blood Pressure') . ": </span><span class=text>" . $bps . "/". $bpd . "</span></td>";
54 else {
55 continue;
58 elseif ($key == "Weight") {
59 $convValue = number_format($value*0.45359237,2);
60 // show appropriate units
61 if ($GLOBALS['units_of_measurement'] == 2) {
62 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('kg') . " (" . $value . " " . xl('lb') . ")</span></td>";
64 elseif ($GLOBALS['units_of_measurement'] == 3) {
65 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('lb') . "</span></td>";
67 elseif ($GLOBALS['units_of_measurement'] == 4) {
68 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('kg') . "</span></td>";
70 else { // = 1 or not set
71 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('lb') . " (" . $convValue . " " . xl('kg') . ")</span></td>";
74 elseif ($key == "Height" || $key == "Waist Circ" || $key == "Head Circ") {
75 $convValue = number_format($value*2.54,2);
76 // show appropriate units
77 if ($GLOBALS['units_of_measurement'] == 2) {
78 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('cm') . " (" . $value . " " . xl('in') . ")</span></td>";
80 elseif ($GLOBALS['units_of_measurement'] == 3) {
81 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('in') . "</span></td>";
83 elseif ($GLOBALS['units_of_measurement'] == 4) {
84 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('cm') . "</span></td>";
86 else { // = 1 or not set
87 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('in') . " (" . $convValue . " " . xl('cm') . ")</span></td>";
90 elseif ($key == "Temperature") {
91 $convValue = number_format((($value-32)*0.5556),2);
92 // show appropriate units
93 if ($GLOBALS['units_of_measurement'] == 2) {
94 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('C') . " (" . $value . " " . xl('F') . ")</span></td>";
96 elseif ($GLOBALS['units_of_measurement'] == 3) {
97 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('F') . "</span></td>";
99 elseif ($GLOBALS['units_of_measurement'] == 4) {
100 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $convValue . " " . xl('C') . "</span></td>";
102 else { // = 1 or not set
103 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('F') . " (" . $convValue . " " . xl('C') . ")</span></td>";
107 elseif ($key == "Pulse" || $key == "Respiration" || $key == "Oxygen Saturation" || $key == "BMI") {
108 $value = number_format($value,0);
109 if ($key == "Oxygen Saturation") {
110 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('%') . "</span></td>";
112 elseif ($key == "BMI") {
113 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('kg/m^2') . "</span></td>";
115 else { //pulse and respirations
116 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . $value . " " . xl('per min') . "</span></td>";
119 else {
120 $vitals .= "<td><span class=bold>" . xl($key) . ": </span><span class=text>$value</span></td>";
123 $count++;
125 if ($count == $cols) {
126 $count = 0;
127 $vitals .= "</tr><tr>\n";
131 $vitals .= "</tr></table>";
133 if($print) echo $vitals ;
134 else return $vitals;