public AddTreatment(Treatment pTreatment) { InitializeComponent(); treatment = pTreatment; waitlist = new WaitlistedPatient(treatment.TreatmentID); patient = new Patient(); patient.GetPatient(treatment.PatientID); populatePreBoxFields(); _isNewTreatment = false; }
public AddTreatment(int healthCareNo) { InitializeComponent(); this.patient = new Patient(healthCareNo); treatment = new Treatment(); waitlist = new WaitlistedPatient(); treatment.Status = "Upcoming"; treatment.PatientID = patient.PatientID; waitlist.Pid = patient.PatientID; populatePreBoxFields(); boxDate.Text = System.DateTime.Today.ToString(); }
public void TestSelectWithValidRtid() { Ward w = new Ward("UnitTestWard-WLP", "UTW"); w.Insert(); Room r = new Room(1, "UnitTestWard-WLP", 1); r.Insert(); Bed b = new Bed(1, Bed.States.Available, 0, 1, "", "UnitTestWard-WLP"); b.Insert(); Patient p = new Patient(10000, "Test-WLP", "Test-WLP", new DateTime(), "", "", "", "", "", "", ""); p.Insert(); p.Select(); Treatment treat = new Treatment(p.PatientID, "UnitTestTreatment-WLP", 1, 1, 1, "", "", 1, "Upcoming"); treat.Insert(); List<Treatment> list = Treatment.GetTreatments(p.PatientID, "Upcoming"); Treatment t = list[0]; WaitlistedPatient.AddPatientToWaitlist(p.PatientID, "UnitTestWard-WLP", "High", t.TreatmentID); List<WaitlistedPatient> patients = WaitlistedPatient.GetWaitlistedPatientsForWard("UnitTestWard-WLP"); WaitlistedPatient waitlist = new WaitlistedPatient(t.TreatmentID); Assert.True(waitlist.Pid == p.PatientID); patients[0].RemovedPatientFromWaitlist(); t.Delete(); p.Delete(); b.Delete(); r.Delete(); w.Delete(); }
public static List<WaitlistedPatient> GetWaitlistedPatientsForWard(string ward) { List<object[]> patients = Database.Select("Select WL.waitlistId, WL.patientId, P.fname, P.lname, WL.priority, WL.treatmentID, TM.treatment " + "FROM Waitlist as WL " + "INNER JOIN (SELECT patient,rtid,treatment " + "FROM ReceivesTreatment " + "WHERE treatmentStatus = 'Upcoming' " + "AND patient NOT IN( Select patient " + "FROM ReceivesTreatment " + "WHERE treatmentStatus = 'Current') " + ") as TM " + "ON WL.treatmentID = TM.rtid " + "INNER JOIN Patient as P on P.pid = WL.patientID " + "WHERE WL.wardName = '" + ward + "' " + "ORDER BY priority='Low',priority='Medium',priority='High';"); List<WaitlistedPatient> getpatients = new List<WaitlistedPatient>(); if (patients != null) foreach (object[] row in patients) { if (row.Length == 7) { WaitlistedPatient newPatient = new WaitlistedPatient(Convert.ToInt32(row[0]), Convert.ToInt32(row[1]), row[2].ToString(), row[3].ToString(), row[4].ToString(), Convert.ToInt32(row[5]), row[6].ToString(),ward); getpatients.Add(newPatient); } } return getpatients; }
public void TestGetSetWard() { WaitlistedPatient w = new WaitlistedPatient(); w.Ward = "Test"; Assert.True(w.Ward == "Test"); }
public void TestSelectWithInvalidRtid() { WaitlistedPatient w = new WaitlistedPatient(-1); Assert.True(w.Pid == 0); }
public void TestGetSetTreatment() { WaitlistedPatient w = new WaitlistedPatient(); w.Treatment = "Test"; Assert.True(w.Treatment == "Test"); }
public void TestGetSetPriority() { WaitlistedPatient w = new WaitlistedPatient(); w.Priority = "Test"; Assert.True(w.Priority == "Test"); }
public void TestGetSetPid() { WaitlistedPatient w = new WaitlistedPatient(); w.Pid = 1; Assert.True(w.Pid == 1); }
public void TestGetSetLname() { WaitlistedPatient w = new WaitlistedPatient(); w.Lname = "Test"; Assert.True(w.Lname == "Test"); }
private void dgHistory_SelectionChanged(object sender, SelectionChangedEventArgs e) { treatment = (Treatment)dgHistory.SelectedItem; waitlist = new WaitlistedPatient(treatment.TreatmentID); lblDetails.Content = treatment.Type + " " + treatment.DateToShortDateString + " " + treatment.Time; }