// public PatientInsInfo insurance; public Patient() { if (PIMS.Program.currentUser is Doctor || PIMS.Program.currentUser is MedStaff) { directory = new PatientDirInfo(); treatment = new PatientTreatmentInfo(); billing = new PatientBillingInfo(); //insurance = new PatientInsInfo(); } else if (PIMS.Program.currentUser is OfficeStaff) { directory = new PatientDirInfo(); billing = new PatientBillingInfo(); // insurance = new PatientInsInfo(); treatment = null; } else { directory = new PatientDirInfo(); // insurance = null; treatment = null; billing = null; } }
public static void updatePatient(Patient patient) { Patient x = PimsMain.Program.currentPatient; PatientDirInfo dir = x.directory; // Volunteers can't update info, so exit if current user is a volunteer if (PimsMain.Program.currentUser is Volunteer) { return; } // only office staff can update billing and directory info if (PimsMain.Program.currentUser is OfficeStaff) { // Start with directory updates updatePatientDirInfo(); updateBillingInfo(); } // nurse/med staff updates here if (PimsMain.Program.currentUser is MedStaff) { } // Doctor updates hereTreatment updates here if (PimsMain.Program.currentUser is Doctor) { } //TODO: SQL update this patient info }
static void updatePatientDirInfo() { PatientDirInfo dir = PimsMain.Program.currentPatient.directory; if (cnn != null && cnn.State == System.Data.ConnectionState.Open) { cnn.Close(); } cnn.Open(); String cmdText = "UPDATE patient SET firstName = @fn, lastName = @ln, middleName = @mn," + "DOB = @dob, gender = @g, patientAddress = @adr, patientZip = @zip, patientState = @ps," + "patientCity = @city, phone1 = @ph1, phone2 = @ph2,emergencyName = @em, emergencyNumber = @emn," + "emergencyName2 = @em2, emergencyNumber2 = @emn2, visitorList = @vl, bedNo = @bn " + "WHERE patientID = " + dir.patientID; SqlCommand cmd = new SqlCommand(cmdText, cnn); cmd.Parameters.AddWithValue("@fn", dir.fName); cmd.Parameters.AddWithValue("@ln", dir.lName); cmd.Parameters.AddWithValue("@mn", dir.mName); cmd.Parameters.AddWithValue("@dob", dir.DOB); cmd.Parameters.AddWithValue("@g", dir.gender ? "m" : "f"); cmd.Parameters.AddWithValue("@adr", dir.strAddress); cmd.Parameters.AddWithValue("@zip", dir.zip); cmd.Parameters.AddWithValue("@ps", dir.state); cmd.Parameters.AddWithValue("@city", dir.city); cmd.Parameters.AddWithValue("@ph1", dir.phoneNum1); cmd.Parameters.AddWithValue("@ph2", dir.phoneNum2); cmd.Parameters.AddWithValue("@em", dir.emerContact1.name); cmd.Parameters.AddWithValue("@emn", dir.emerContact1.phoneNum); cmd.Parameters.AddWithValue("@em2", dir.emerContact2.name); cmd.Parameters.AddWithValue("@emn2", dir.emerContact2.phoneNum); string visitors = "$"; foreach (Visitor v in dir.visitors) { visitors = visitors + v.name + "$"; } cmd.Parameters.AddWithValue("@vl", visitors); cmd.Parameters.AddWithValue("@bn", dir.location.bedNum); cmd.ExecuteNonQuery(); }