2 include_once("../../globals.php");
4 include_once("$srcdir/sql.inc");
5 include_once("$srcdir/patient.inc");
9 //function called to set the global session variable for patient id (pid) number
10 function setpid($new_pid) {
13 $_SESSION['pid']=$new_pid;
16 newEvent("view",$_SESSION["authUser"],$_SESSION["authProvider"],$pid);
24 //check if the name already exists:
25 if ($result = sqlQuery("select * from patient_data where lower(fname)=lower('".$_POST["fname"]."') and lower(lname)=lower('".$_POST["lname"]."')")) {
26 //setpid($result{"pid"});
34 //here, we lock the patient data table while we find the most recent max PID
35 //other interfaces can still read the data during this lock, however
36 sqlStatement("lock tables patient_data read");
38 $result = sqlQuery("select max(pid)+1 as pid from patient_data");
40 sqlStatement("unlock tables");
44 //setpid($result{"pid"});
45 $pid = $result{"pid"};
51 //what do we set for the public pid?
52 if (isset($_POST["pubpid"]) && ($_POST["pubpid"] != "")) {
53 $mypubpid = $_POST["pubpid"];
60 newPatientData( $_POST["db_id"],
62 ucwords($_POST["fname"]),
63 ucwords($_POST["lname"]),
64 ucwords($_POST["mname"]),
95 newEmployerData( $pid);
97 newHistoryData( $pid);
100 newInsuranceData( $pid, "primary");
105 newInsuranceData( $pid, "secondary");
108 newInsuranceData( $pid, "tertiary");
129 <script language
="Javascript">
131 window
.location
="<?echo "find_patient
.php?mode
=setpatient
&pid
=$pid";?>";