Highway to PSR2
[openemr.git] / interface / forms / vitals / FormVitals.class.php
blobe8ff1e40e7eb144abc7d18205e7c32ee53942f5f
1 <?php
4 define("EVENT_VEHICLE", 1);
5 define("EVENT_WORK_RELATED", 2);
6 define("EVENT_SLIP_FALL", 3);
7 define("EVENT_OTHER", 4);
10 /**
11 * class FormHpTjePrimary
14 class FormVitals extends ORDataObject
17 /**
19 * @access public
23 /**
25 * static
27 var $id;
28 var $date;
29 var $pid;
30 var $user;
31 var $groupname;
32 var $authorized;
33 var $activity;
34 var $bps;
35 var $bpd;
36 var $weight;
37 var $height;
38 var $temperature;
39 var $temp_method;
40 var $pulse;
41 var $respiration;
42 var $note;
43 var $BMI;
44 var $BMI_status;
45 var $waist_circ;
46 var $head_circ;
47 var $oxygen_saturation;
49 // var $temp_methods;
50 /**
51 * Constructor sets all Form attributes to their default value
54 function __construct($id = "", $_prefix = "")
56 if ($id > 0) {
57 $this->id = $id;
58 } else {
59 $id = "";
60 $this->date = $this->get_date();
63 $this->_table = "form_vitals";
64 $this->activity = 1;
65 $this->pid = $GLOBALS['pid'];
66 if ($id != "") {
67 $this->populate();
70 function populate()
72 parent::populate();
73 //$this->temp_methods = parent::_load_enum("temp_locations",false);
76 function toString($html = false)
78 $string .= "\n"
79 ."ID: " . $this->id . "\n";
81 if ($html) {
82 return nl2br($string);
83 } else {
84 return $string;
87 function set_id($id)
89 if (!empty($id) && is_numeric($id)) {
90 $this->id = $id;
93 function get_id()
95 return $this->id;
97 function set_pid($pid)
99 if (!empty($pid) && is_numeric($pid)) {
100 $this->pid = $pid;
103 function get_pid()
105 return $this->pid;
107 function set_activity($tf)
109 if (!empty($tf) && is_numeric($tf)) {
110 $this->activity = $tf;
113 function get_activity()
115 return $this->activity;
118 function get_date()
120 if (!$this->date) {
121 $this->date = date('YmdHis', time());
124 return $this->date;
127 function set_date($dt)
129 if (!empty($dt)) {
130 $dt = str_replace('-', '', $dt);
131 $dt = str_replace(':', '', $dt);
132 $dt = str_replace(' ', '', $dt);
133 while (strlen($dt) < 14) {
134 $dt .= '0';
137 $this->date = $dt;
141 function get_user()
143 return $this->user;
145 function set_user($u)
147 if (!empty($u)) {
148 $this->user = $u;
151 function get_bps()
153 return $this->bps;
155 function set_bps($bps)
157 if (!empty($bps)) {
158 $this->bps = $bps;
161 function get_bpd()
163 return $this->bpd;
165 function set_bpd($bpd)
167 if (!empty($bpd)) {
168 $this->bpd = $bpd;
171 function get_weight()
173 return $this->weight;
175 function set_weight($w)
177 if (!empty($w) && is_numeric($w)) {
178 $this->weight = $w;
181 function display_weight($pounds)
183 if ($pounds!=0) {
184 if ($GLOBALS['us_weight_format']==2) {
185 $pounds_int=floor($pounds);
186 return $pounds_int." ".xl('lb') ." " .round(($pounds-$pounds_int)*16)." ".xl('oz');
187 } else {
188 return $pounds;
192 function get_height()
194 return $this->height;
196 function set_height($h)
198 if (!empty($h) && is_numeric($h)) {
199 $this->height = $h;
202 function get_temperature()
204 return $this->temperature;
206 function set_temperature($t)
208 if (!empty($t) && is_numeric($t)) {
209 $this->temperature = $t;
212 function get_temp_method()
214 return $this->temp_method;
216 function set_temp_method($tm)
218 $this->temp_method = $tm;
220 // function get_temp_methods() {
221 // return $this->temp_methods;
222 // }
223 function get_pulse()
225 return $this->pulse;
227 function set_pulse($p)
229 if (!empty($p) && is_numeric($p)) {
230 $this->pulse = $p;
233 function get_respiration()
235 return $this->respiration;
237 function set_respiration($r)
239 if (!empty($r) && is_numeric($r)) {
240 $this->respiration = $r;
243 function get_note()
245 return $this->note;
247 function set_note($n)
249 if (!empty($n)) {
250 $this->note = $n;
253 function get_BMI()
255 return $this->BMI;
257 function set_BMI($bmi)
259 if (!empty($bmi) && is_numeric($bmi)) {
260 $this->BMI = $bmi;
263 function get_BMI_status()
265 return $this->BMI_status;
267 function set_BMI_status($status)
269 $this->BMI_status = $status;
271 function get_waist_circ()
273 return $this->waist_circ;
275 function set_waist_circ($w)
277 if (!empty($w) && is_numeric($w)) {
278 $this->waist_circ = $w;
281 function get_head_circ()
283 return $this->head_circ;
285 function set_head_circ($h)
287 if (!empty($h) && is_numeric($h)) {
288 $this->head_circ = $h;
291 function get_oxygen_saturation()
293 return $this->oxygen_saturation;
295 function set_oxygen_saturation($o)
297 if (!empty($o) && is_numeric($o)) {
298 $this->oxygen_saturation = $o;
301 function persist()
303 parent::persist();
305 } // end of Form