Ob/Gyn forms contributed by Douglas Crosdale
[openemr.git] / contrib / forms / high_risk_screening_record / save.php
blob31491de3caf2a8b2acc89b4c98b89f2e0c43c984
1 <?php
2 // 2005-03-14
3 // High risk screening storage and update module
4 //
6 include_once("../../globals.php");
7 include_once("$srcdir/api.inc");
8 include_once("$srcdir/forms.inc");
10 $flds = sqlListFields("form_high_risk_screening_record");
11 $flds = array_slice($flds,7);
12 foreach ($flds as $key => $fld){
13 $data[$fld] = '';
16 foreach ($_POST as $k => $var) {
17 $_POST[$k] = mysql_escape_string($var);
18 //echo "$var\n";
21 $ii = 0;
22 while ($ii<13){
23 $ii++;
24 $data["record_".$ii] =
25 $_POST["hemoglobin_date_".$ii].';'.$_POST["hemoglobin_res_".$ii].'|~'.
26 $_POST["bone_density_date_".$ii].';'.$_POST["bone_density_res_".$ii].'|~'.
27 $_POST["bacteriuria_date_".$ii] .';'.$_POST["bacteriuria_res_".$ii].'|~'.
28 $_POST["std_date_".$ii] .';'.$_POST["std_res_".$ii].'|~'.
29 $_POST["hiv_date_".$ii] .';'.$_POST["hiv_res_".$ii].'|~'.
30 $_POST["genetic_date_".$ii].';'.$_POST["genetic_res_".$ii].'|~'.
31 $_POST["rubella_date_".$ii].';'.$_POST["rubella_res_".$ii].'|~'.
32 $_POST["tb_skin_date_".$ii].';'.$_POST["tb_skin_res_".$ii].'|~'.
33 $_POST["lipid_date_".$ii].';'.$_POST["lipid_res_".$ii].'|~'.
34 $_POST["mammography_date_".$ii].';'.$_POST["mammography_res_".$ii].'|~'.
35 $_POST["fasting_glucose_date_".$ii].';'.$_POST["fasting_glucose_res_".$ii] .'|~'.
36 $_POST["tsh_date_".$ii].';'. $_POST["tsh_res_".$ii].'|~'.
37 $_POST["cancer_date_".$ii].';'. $_POST["cancer_res_".$ii].'|~'.
38 $_POST["hepatitis_c_date_".$ii].';'.$_POST["hepatitis_c_res_".$ii];
41 if ($_GET["mode"] == "new"){
42 if ($encounter == "") { $encounter = date("Ymd"); }
43 $newid = formSubmit("form_high_risk_screening_record", $data, $_GET["id"], $userauthorized);
44 addForm($encounter, "High risk screening record", $newid, "high_risk_screening_record", $pid, $userauthorized);
45 $_SESSION["encounter"] = $encounter;
46 } elseif ($_GET["mode"] == "update") {
47 $q1 = '';
48 foreach ($data as $key => $val){
49 $q1 .= "$key='$val', ";
51 sqlInsert("update form_high_risk_screening_record set pid = {$_SESSION["pid"]},groupname='".$_SESSION["authProvider"]."',user='".$_SESSION["authUser"]."',authorized=$userauthorized,activity=1, $q1 date = NOW() where id=$id");
53 sqlInsert("update patient_data set DOB='".$_POST['pbdate']."' where id=$pid");
55 //$_SESSION["pid"] = $pid;
56 formHeader("Redirecting....");
57 formJump();
58 formFooter();