4 include_once("../../globals.php");
5 include_once("$srcdir/api.inc");
6 include_once("$srcdir/forms.inc");
8 foreach ($_POST as $k => $var) {
9 $_POST[$k] = mysql_escape_string($var);
12 if ($encounter == "") $encounter = date("Ymd");
14 // calculate body mass index bmi=k/(m**2)
15 $k=$_POST["weight"]/2.2;
16 $w=$_POST["height"]/39.4;
17 $_POST["BMI"]=round ( ($k/($w*$w)),2);
19 if ( $bmi > 42 ) { $_POST["BMI_status"]='Obesity III'; }
20 elseif ( $bmi > 34 ) { $_POST["BMI_status"]='Obesity II'; }
21 elseif ( $bmi > 30 ) { $_POST["BMI_status"]='Obesity I'; }
22 elseif ( $bmi > 27 ) { $_POST["BMI_status"]='Overweight'; }
23 elseif ( $bmi > 25 ) { $_POST["BMI_status"]='Normal BL'; }
24 elseif ( $bmi > 18.5 ) { $_POST["BMI_status"]='Normal'; }
25 elseif ( $bmi > 10 ) { $_POST["BMI_status"]='Underweight'; }
27 if ($_GET["mode"] == "new"){
28 $newid = formSubmit("form_vitals", $_POST, $_GET["id"], $userauthorized);
29 addForm($encounter, "Vital Signs", $newid, "vitals", $pid, $userauthorized);
30 } elseif ($_GET["mode"] == "update") {
31 sqlInsert("update form_vitals set `pid` = {$_SESSION["pid
"]},
32 `groupname`='".$_SESSION["authProvider"]."',
33 `user`='".$_SESSION["authUser"]."',
34 `authorized`=$userauthorized,
37 `bps` ='".$_POST["bps"]."',
38 `bpd` ='".$_POST["bpd"]."',
39 `weight` ='".$_POST["weight"]."',
40 `height` ='".$_POST["height"]."',
41 `temperature` ='".$_POST["temperature"]."',
42 `temp_method` ='".$_POST["temp_method"]."',
43 `pulse` ='".$_POST["pulse"]."',
44 `respiration` ='".$_POST["respiration"]."',
45 `note` ='".$_POST["note"]."',
46 `BMI` ='".$_POST["BMI"]."',
47 `BMI_status` ='".$_POST["BMI_status"]."',
48 `waist_circ` ='".$_POST["waist_circ"]."'
52 $_SESSION["encounter"] = $encounter;
54 formHeader("Redirecting....");