2 include_once("../globals.php");
3 include_once("$srcdir/sql.inc");
4 include_once("$srcdir/pid.inc");
5 include_once("$srcdir/patient.inc");
7 //here, we lock the patient data table while we find the most recent max PID
8 //other interfaces can still read the data during this lock, however
9 sqlStatement("lock tables patient_data read");
11 $result = sqlQuery("select max(pid)+1 as pid from patient_data");
13 // TBD: This looks wrong to unlock the table before we have added our
14 // patient with its newly allocated pid!
16 sqlStatement("unlock tables");
20 if ($result['pid'] > 1)
21 $newpid = $result['pid'];
29 //what do we set for the public pid?
30 if (isset($_POST["pubpid"]) && ($_POST["pubpid"] != "")) {
31 $mypubpid = $_POST["pubpid"];
36 if ($_POST['form_create']) {
38 $form_fname = ucwords(trim($_POST["fname"]));
39 $form_lname = ucwords(trim($_POST["lname"]));
40 $form_mname = ucwords(trim($_POST["mname"]));
61 "", // contact_relationship
68 "", // migrantseasonal
72 "", // financial_review
86 newEmployerData($pid);
88 newInsuranceData($pid, "primary");
89 newInsuranceData($pid, "secondary");
90 newInsuranceData($pid, "tertiary");
92 // Set referral source separately because we don't want it messed
93 // with later by newPatientData().
94 if ($refsource = trim($_POST["refsource"])) {
95 sqlQuery("UPDATE patient_data SET referral_source = '$refsource' " .
96 "WHERE pid = '$pid'");
102 <script language
="Javascript">
105 echo "alert('$alertmsg');\n";
107 if ($GLOBALS['concurrent_layout']) {
108 echo "window.location='$rootdir/patient_file/summary/demographics.php?" .
109 "set_pid=$pid&is_new=1';\n";
111 echo "window.location='$rootdir/patient_file/patient_file.php?set_pid=$pid';\n";