3 // Routine screening storage and update module
6 include_once("../../globals.php");
7 include_once("$srcdir/api.inc");
8 include_once("$srcdir/forms.inc");
10 $flds = sqlListFields("form_routine_screening_record");
11 $flds = array_slice($flds,7);
12 foreach ($flds as $key => $fld){
16 foreach ($_POST as $k => $var) {
17 $_POST[$k] = mysql_escape_string($var);
20 $factors = array("cervical", "lipid", "mammo", "colorectal",
21 "bone", "chlamyd", "gonor", "urinal", "glucose", "thyroid");
27 foreach($factors as $k=>$v){
28 $record .= $_POST[$v."_date_".$ii] .'|'. $_POST[$v."_res_".$ii];
29 if ($v != "thyroid") { $record .= '|~'; }
31 $data["record_".$ii] = $record;
35 if ($_GET["mode"] == "new"){
36 if ($encounter == "") { $encounter = date("Ymd"); }
37 $newid = formSubmit("form_routine_screening_record", $data, $_GET["id"], $userauthorized);
38 addForm($encounter, "Routine screening record", $newid, "routine_screening_record", $pid, $userauthorized);
39 $_SESSION["encounter"] = $encounter;
40 } elseif ($_GET["mode"] == "update") {
42 foreach ($data as $key => $val){
43 $q1 .= "$key='$val', ";
45 sqlInsert("update form_routine_screening_record set pid = {$_SESSION["pid
"]},groupname='".$_SESSION["authProvider"]."',user='".$_SESSION["authUser"]."',authorized=$userauthorized,activity=1, $q1 date = NOW() where id=$id");
47 sqlInsert("update patient_data set DOB='".$_POST['pbdate']."' where id=$pid");
49 //$_SESSION["pid"] = $pid;
50 formHeader("Redirecting....");