3 require_once ($GLOBALS['fileroot'] . "/library/forms.inc");
4 require_once("FormVitalsM.class.php");
6 class C_FormVitalsM
extends Controller
{
10 function C_FormVitalsM($template_mod = "general") {
12 $returnurl = 'encounter_top.php';
13 $this->template_mod
= $template_mod;
14 $this->template_dir
= dirname(__FILE__
) . "/templates/vitalsM/";
15 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
16 $this->assign("DONT_SAVE_LINK",$GLOBALS['webroot'] . "/interface/patient_file/encounter/$returnurl");
17 $this->assign("STYLE", $GLOBALS['style']);
20 function default_action_old() {
21 $vitals = new FormVitalsM();
22 $this->assign("vitals",$vitals);
23 $this->assign("results", $results);
24 return $this->fetch($this->template_dir
. $this->template_mod
. "_new.html");
27 function default_action($form_id) {
29 if (is_numeric($form_id)) {
30 $vitals = new FormVitalsM($form_id);
33 $vitals = new FormVitalsM();
36 $dbconn = $GLOBALS['adodb']['db'];
37 $sql = "SELECT * from form_vitalsM where id != $form_id and pid = ".$GLOBALS['pid'];
38 $result = $dbconn->Execute($sql);
41 while($result && !$result->EOF
)
43 $results[$i]['id'] = $result->fields
['id'];
44 $results[$i]['date'] = $result->fields
['date'];
45 $results[$i]['activity'] = $result->fields
['activity'];
46 $results[$i]['bps'] = $result->fields
['bps'];
47 $results[$i]['bpd'] = $result->fields
['bpd'];
48 $results[$i]['weight'] = $result->fields
['weight'];
49 $results[$i]['height'] = $result->fields
['height'];
50 $results[$i]['temperature'] = $result->fields
['temperature'];
51 $results[$i]['temp_method'] = $result->fields
['temp_method'];
52 $results[$i]['pulse'] = $result->fields
['pulse'];
53 $results[$i]['respiration'] = $result->fields
['respiration'];
54 $results[$i]['BMI'] = $result->fields
['BMI'];
55 $results[$i]['BMI_status'] = $result->fields
['BMI_status'];
56 $results[$i]['note'] = $result->fields
['note'];
57 $results[$i]['waist_circ'] = $result->fields
['waist_circ'];
58 $results[$i]['head_circ'] = $result->fields
['head_circ'];
59 $results[$i++
]['oxygen_saturation'] = $result->fields
['oxygen_saturation'];
62 $this->assign("vitals",$vitals);
63 $this->assign("results", $results);
64 $this->assign("VIEW",true);
65 return $this->fetch($this->template_dir
. $this->template_mod
. "_new.html");
68 function default_action_process() {
69 if ($_POST['process'] != "true")
72 $weight = $_POST["weight"];
73 $height = $_POST["height"];
74 if ($weight > 0 && $height > 0) {
75 $_POST["BMI"] = ($weight/$height/$height)*10000;
77 if ( $_POST["BMI"] > 42 ) $_POST["BMI_status"] = 'Obesity III';
78 elseif ( $_POST["BMI"] > 34 ) $_POST["BMI_status"] = 'Obesity II';
79 elseif ( $_POST["BMI"] > 30 ) $_POST["BMI_status"] = 'Obesity I';
80 elseif ( $_POST["BMI"] > 27 ) $_POST["BMI_status"] = 'Overweight';
81 elseif ( $_POST["BMI"] > 25 ) $_POST["BMI_status"] = 'Normal BL';
82 elseif ( $_POST["BMI"] > 18.5 ) $_POST["BMI_status"] = 'Normal';
83 elseif ( $_POST["BMI"] > 10 ) $_POST["BMI_status"] = 'Underweight';
84 $temperature = $_POST["temperature"];
85 if ($temperature == '0' ||
$temperature == '') {
86 $_POST["temp_method"] = "";
89 $this->vitals
= new FormVitalsM($_POST['id']);
91 parent
::populate_object($this->vitals
);
93 $this->vitals
->persist();
94 if ($GLOBALS['encounter'] < 1) {
95 $GLOBALS['encounter'] = date("Ymd");
97 if(empty($_POST['id']))
99 addForm($GLOBALS['encounter'], "Vitals (Metric)", $this->vitals
->id
, "vitalsM", $GLOBALS['pid'], $_SESSION['userauthorized']);
100 $_POST['process'] = "";