From 47d928559d5c7a9be96fdb18376aefc5531026ba Mon Sep 17 00:00:00 2001 From: sunsetsystems Date: Wed, 6 Aug 2008 18:04:46 +0000 Subject: [PATCH] added metric version of the vitals form --- interface/forms/vitalsM/C_FormVitalsM.class.php | 107 ++++++++ interface/forms/vitalsM/FormVitalsM.class.php | 279 +++++++++++++++++++++ interface/forms/vitalsM/info.txt | 1 + interface/forms/vitalsM/new.php | 8 + interface/forms/vitalsM/report.php | 31 +++ interface/forms/vitalsM/save.php | 9 + interface/forms/vitalsM/table.sql | 24 ++ .../vitalsM/templates/vitalsM/general_new.html | 197 +++++++++++++++ interface/forms/vitalsM/view.php | 8 + 9 files changed, 664 insertions(+) create mode 100644 interface/forms/vitalsM/C_FormVitalsM.class.php create mode 100644 interface/forms/vitalsM/FormVitalsM.class.php create mode 100644 interface/forms/vitalsM/info.txt create mode 100644 interface/forms/vitalsM/new.php create mode 100644 interface/forms/vitalsM/report.php create mode 100644 interface/forms/vitalsM/save.php create mode 100644 interface/forms/vitalsM/table.sql create mode 100644 interface/forms/vitalsM/templates/vitalsM/general_new.html create mode 100644 interface/forms/vitalsM/view.php diff --git a/interface/forms/vitalsM/C_FormVitalsM.class.php b/interface/forms/vitalsM/C_FormVitalsM.class.php new file mode 100644 index 000000000..1114a5e96 --- /dev/null +++ b/interface/forms/vitalsM/C_FormVitalsM.class.php @@ -0,0 +1,107 @@ +template_mod = $template_mod; + $this->template_dir = dirname(__FILE__) . "/templates/vitalsM/"; + $this->assign("FORM_ACTION", $GLOBALS['web_root']); + $this->assign("DONT_SAVE_LINK",$GLOBALS['webroot'] . "/interface/patient_file/encounter/$returnurl"); + $this->assign("STYLE", $GLOBALS['style']); + } + + function default_action_old() { + $vitals = new FormVitalsM(); + $this->assign("vitals",$vitals); + $this->assign("results", $results); + return $this->fetch($this->template_dir . $this->template_mod . "_new.html"); + } + + function default_action($form_id) { + + if (is_numeric($form_id)) { + $vitals = new FormVitalsM($form_id); + } + else { + $vitals = new FormVitalsM(); + } + + $dbconn = $GLOBALS['adodb']['db']; + $sql = "SELECT * from form_vitalsM where id != $form_id and pid = ".$GLOBALS['pid']; + $result = $dbconn->Execute($sql); + + $i = 1; + while($result && !$result->EOF) + { + $results[$i]['id'] = $result->fields['id']; + $results[$i]['date'] = $result->fields['date']; + $results[$i]['activity'] = $result->fields['activity']; + $results[$i]['bps'] = $result->fields['bps']; + $results[$i]['bpd'] = $result->fields['bpd']; + $results[$i]['weight'] = $result->fields['weight']; + $results[$i]['height'] = $result->fields['height']; + $results[$i]['temperature'] = $result->fields['temperature']; + $results[$i]['temp_method'] = $result->fields['temp_method']; + $results[$i]['pulse'] = $result->fields['pulse']; + $results[$i]['respiration'] = $result->fields['respiration']; + $results[$i]['BMI'] = $result->fields['BMI']; + $results[$i]['BMI_status'] = $result->fields['BMI_status']; + $results[$i]['note'] = $result->fields['note']; + $results[$i]['waist_circ'] = $result->fields['waist_circ']; + $results[$i]['head_circ'] = $result->fields['head_circ']; + $results[$i++]['oxygen_saturation'] = $result->fields['oxygen_saturation']; + $result->MoveNext(); + } + $this->assign("vitals",$vitals); + $this->assign("results", $results); + $this->assign("VIEW",true); + return $this->fetch($this->template_dir . $this->template_mod . "_new.html"); + } + + function default_action_process() { + if ($_POST['process'] != "true") + return; + + $weight = $_POST["weight"]; + $height = $_POST["height"]; + if ($weight > 0 && $height > 0) { + $_POST["BMI"] = ($weight/$height/$height)*10000; + } + if ( $_POST["BMI"] > 42 ) $_POST["BMI_status"] = 'Obesity III'; + elseif ( $_POST["BMI"] > 34 ) $_POST["BMI_status"] = 'Obesity II'; + elseif ( $_POST["BMI"] > 30 ) $_POST["BMI_status"] = 'Obesity I'; + elseif ( $_POST["BMI"] > 27 ) $_POST["BMI_status"] = 'Overweight'; + elseif ( $_POST["BMI"] > 25 ) $_POST["BMI_status"] = 'Normal BL'; + elseif ( $_POST["BMI"] > 18.5 ) $_POST["BMI_status"] = 'Normal'; + elseif ( $_POST["BMI"] > 10 ) $_POST["BMI_status"] = 'Underweight'; + $temperature = $_POST["temperature"]; + if ($temperature == '0' || $temperature == '') { + $_POST["temp_method"] = ""; + } + + $this->vitals = new FormVitalsM($_POST['id']); + + parent::populate_object($this->vitals); + + $this->vitals->persist(); + if ($GLOBALS['encounter'] < 1) { + $GLOBALS['encounter'] = date("Ymd"); + } + if(empty($_POST['id'])) + { + addForm($GLOBALS['encounter'], "Vitals (Metric)", $this->vitals->id, "vitalsM", $GLOBALS['pid'], $_SESSION['userauthorized']); + $_POST['process'] = ""; + } + return; + } + +} +?> diff --git a/interface/forms/vitalsM/FormVitalsM.class.php b/interface/forms/vitalsM/FormVitalsM.class.php new file mode 100644 index 000000000..6f60508c0 --- /dev/null +++ b/interface/forms/vitalsM/FormVitalsM.class.php @@ -0,0 +1,279 @@ + 0) { + $this->id = $id; + } + else { + $id = ""; + $this->date = $this->get_date(); + } + $this->_table = "form_vitalsM"; + $this->activity = 1; + $this->pid = $GLOBALS['pid']; + if ($id != "") { + $this->populate(); + } + } + + function populate() { + parent::populate(); + } + + function toString($html = false) { + $string .= "\n" + ."ID: " . $this->id . "\n"; + if ($html) { + return nl2br($string); + } + else { + return $string; + } + } + + function set_id($id) { + if (!empty($id) && is_numeric($id)) { + $this->id = $id; + } + } + + function get_id() { + return $this->id; + } + + function set_pid($pid) { + if (!empty($pid) && is_numeric($pid)) { + $this->pid = $pid; + } + } + + function get_pid() { + return $this->pid; + } + + function set_activity($tf) { + if (!empty($tf) && is_numeric($tf)) { + $this->activity = $tf; + } + } + + function get_activity() { + return $this->activity; + } + + function get_date() { + if(!$this->date){ + $dbconn = $GLOBALS['adodb']['db']; + $sql = "SELECT date from form_encounter where encounter =" . $GLOBALS{'encounter'} ; + $result = $dbconn->Execute($sql); + $this->date = $result->fields['date']; + } + return $this->date; + } + + function set_date($dt) { + if (!empty($dt)) { + $this->date = $dt; + } + } + + function get_user() { + return $this->user; + } + + function set_user($u) { + if(!empty($u)){ + $this->user = $u; + } + } + + function get_bps() { + return $this->bps; + } + + function set_bps($bps) { + if(!empty($bps)){ + $this->bps = $bps; + } + } + + function get_bpd() { + return $this->bpd; + } + + function set_bpd($bpd) { + if(!empty($bpd)){ + $this->bpd = $bpd; + } + } + + function get_weight() { + return $this->weight; + } + + function set_weight($w) { + if(!empty($w) && is_numeric($w)){ + $this->weight = $w; + } + } + + function get_height() { + return $this->height; + } + + function set_height($h) { + if(!empty($h) && is_numeric($h)){ + $this->height = $h; + } + } + + function get_temperature() { + return $this->temperature; + } + + function set_temperature($t) { + if(!empty($t) && is_numeric($t)){ + $this->temperature = $t; + } + } + + function get_temp_method() { + return $this->temp_method; + } + + function set_temp_method($tm) { + $this->temp_method = $tm; + } + + function get_pulse() { + return $this->pulse; + } + + function set_pulse($p) { + if(!empty($p) && is_numeric($p)){ + $this->pulse = $p; + } + } + + function get_respiration() { + return $this->respiration; + } + + function set_respiration($r) { + if(!empty($r) && is_numeric($r)){ + $this->respiration = $r; + } + } + + function get_note() { + return $this->note; + } + + function set_note($n) { + if(!empty($n)){ + $this->note = $n; + } + } + + function get_BMI() { + return $this->BMI; + } + + function set_BMI($bmi) { + if(!empty($bmi) && is_numeric($bmi)){ + $this->BMI = $bmi; + } + } + + function get_BMI_status() { + return $this->BMI_status; + } + + function set_BMI_status($status) { + $this->BMI_status = $status; + } + + function get_waist_circ() { + return $this->waist_circ; + } + + function set_waist_circ($w) { + if(!empty($w) && is_numeric($w)){ + $this->waist_circ = $w; + } + } + + function get_head_circ() { + return $this->head_circ; + } + + function set_head_circ($h) { + if(!empty($h) && is_numeric($h)){ + $this->head_circ = $h; + } + } + + function get_oxygen_saturation() { + return $this->oxygen_saturation; + } + + function set_oxygen_saturation($o) { + if(!empty($o) && is_numeric($o)){ + $this->oxygen_saturation = $o; + } + } + + function persist() { + parent::persist(); + } +} // end of Form + +?> diff --git a/interface/forms/vitalsM/info.txt b/interface/forms/vitalsM/info.txt new file mode 100644 index 000000000..ea855df33 --- /dev/null +++ b/interface/forms/vitalsM/info.txt @@ -0,0 +1 @@ +Vitals (Metric) diff --git a/interface/forms/vitalsM/new.php b/interface/forms/vitalsM/new.php new file mode 100644 index 000000000..539db55d3 --- /dev/null +++ b/interface/forms/vitalsM/new.php @@ -0,0 +1,8 @@ +default_action(0); +?> diff --git a/interface/forms/vitalsM/report.php b/interface/forms/vitalsM/report.php new file mode 100644 index 000000000..15f2b05cf --- /dev/null +++ b/interface/forms/vitalsM/report.php @@ -0,0 +1,31 @@ +"; + foreach($data as $key => $value) { + if ($key == "id" || $key == "pid" || $key == "user" || + $key == "groupname" || $key == "authorized" || $key == "activity" || + $key == "date" || $value == "" || $value == "0000-00-00 00:00:00" || + $value == "0.0" ) + { + continue; + } + if ($value == "on") { + $value = "yes"; + } + $key = ucwords(str_replace("_"," ",$key)); + print "$key: $value"; + $count++; + if ($count == $cols) { + $count = 0; + print "\n"; + } + } + } + print ""; +} +?> diff --git a/interface/forms/vitalsM/save.php b/interface/forms/vitalsM/save.php new file mode 100644 index 000000000..03fff17d5 --- /dev/null +++ b/interface/forms/vitalsM/save.php @@ -0,0 +1,9 @@ +default_action_process($_POST); +@formJump(); +?> diff --git a/interface/forms/vitalsM/table.sql b/interface/forms/vitalsM/table.sql new file mode 100644 index 000000000..b09b1e96a --- /dev/null +++ b/interface/forms/vitalsM/table.sql @@ -0,0 +1,24 @@ +CREATE TABLE IF NOT EXISTS `form_vitalsM` ( +`id` bigint(20) NOT NULL auto_increment, +`date` datetime default NULL, +`pid` bigint(20) default 0, +`user` varchar(255) default NULL, +`groupname` varchar(255) default NULL, +`authorized` tinyint(4) default 0, +`activity` tinyint(4) default 0, +`bps` varchar(40) default 0, +`bpd` varchar(40) default 0, +`weight` FLOAT(5,2) default 0, +`height` FLOAT(5,2) default 0, +`temperature` FLOAT(5,2) default 0, +`temp_method` VARCHAR(255) default NULL, +`pulse` FLOAT(5,2) default 0, +`respiration` FLOAT(5,2) default 0, +`note` VARCHAR(255) default NULL, +`BMI` FLOAT(4,1) default 0, +`BMI_status` VARCHAR(255) default NULL, +`waist_circ` FLOAT(5,2) default 0, +`head_circ` FLOAT(5,2) default 0, +`oxygen_saturation` FLOAT(5,2) default 0, +PRIMARY KEY (id) +) TYPE=MyISAM; diff --git a/interface/forms/vitalsM/templates/vitalsM/general_new.html b/interface/forms/vitalsM/templates/vitalsM/general_new.html new file mode 100644 index 000000000..6e77b423e --- /dev/null +++ b/interface/forms/vitalsM/templates/vitalsM/general_new.html @@ -0,0 +1,197 @@ + + +{php}html_header_show();{/php} +{literal} + + +{/literal} + + + +

Vitals (Metric)

+
+ + + + + {foreach item=result from=$results} + + {/foreach} + + + + + + {foreach item=result from=$results} + + {/foreach} + + + + + + {foreach item=result from=$results} + + {/foreach} + + + + + + {foreach item=result from=$results} + + {/foreach} + + + + + + {foreach item=result from=$results} + + {/foreach} + + + + + + {foreach item=result from=$results} + + {/foreach} + + + + + {foreach item=result from=$results} + + {/foreach} + + + + + + {foreach item=result from=$results} + + {/foreach} + + + + + + + + + + + {foreach item=result from=$results} + + {/foreach} + + + + + {foreach item=result from=$results} + + {/foreach} + + + + + {foreach item=result from=$results} + + {/foreach} + + + + + {foreach item=result from=$results} + + {/foreach} + + + + {foreach item=result from=$results} + + {/foreach} + + + + + {foreach item=result from=$results} + + {/foreach} + + + + +
NameUnit{$vitals->get_date()|date_format:"%m/%d/%y"}{$result.date|date_format:"%m/%d/%y"}
Weightkg{$result.weight}
Heightcm{$result.height}
BP Systolicmm/hg{$result.bps}
BP Diastolicmm/hg{$result.bpd}
Pulseper min{$result.pulse}
Respirationper min{$result.respiration}
TemperatureC{$result.temperature}
Temp Location + + {$result.temp_method}
Oxygen Saturation%{$result.oxygen_saturation}
Head Circumferencecm{$result.head_circ}
Waist Circumferencecm{$result.waist_circ}
BMI%{$result.BMI}
BMI StatusType{$vitals->get_BMI_status()}{$result.BMI_status}
Other Notes{$result.note}
        [Don't Save]
+ + + + +
+ + diff --git a/interface/forms/vitalsM/view.php b/interface/forms/vitalsM/view.php new file mode 100644 index 000000000..1ee57ab8a --- /dev/null +++ b/interface/forms/vitalsM/view.php @@ -0,0 +1,8 @@ +default_action($_GET['id']); +?> -- 2.11.4.GIT