Пример #1
0
 public void TestGetSetDob()
 {
     Patient p = new Patient();
     DateTime d = new DateTime(2013, 2, 2);
     p.DOB = d;
     Assert.True(p.DOB == d);
 }
Пример #2
0
        public void TestEditPatientInWaitlist()
        {
            Ward w = new Ward("UnitTestWard-WLP", "UTW");
            w.Insert();
            Room r = new Room(1, "UTW", 1);
            r.Insert();
            Bed b = new Bed(1, Bed.States.Available, 0, 1, "", "UTW");
            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, "UTW", "High", t.TreatmentID);
            List<WaitlistedPatient> patients = WaitlistedPatient.GetWaitlistedPatientsForWard("UTW");

            Assert.True(WaitlistedPatient.EditPatientInWaitlist(p.PatientID, "UTW", "High", t.TreatmentID));

            patients[0].RemovedPatientFromWaitlist();
            t.Delete();
            p.Delete();
            b.Delete();
            r.Delete();
            w.Delete();
        }
Пример #3
0
 public void TestGetDob()
 {
     Patient p = new Patient();
     p.DOB = new DateTime(2013, 2, 3);
     String date = p.DOB.ToShortDateString();
     Assert.True(p.getDOB == date);
 }
Пример #4
0
 public void TestGetPatientsWithValidPid()
 {
     Patient p = new Patient(10000);
     p.Insert();
     p.Select();
     Assert.True(p.GetPatient(p.PatientID));
     p.Delete();
 }
 public PatientTreatmentHistory(int hcno)
 {
     InitializeComponent();
     p = new Patient(hcno);
     lblPatientName.Content = p.LastName + ", " + p.FirstName;
     treatments = Treatment.GetTreatments(p.PatientID,"History");
     dgHistory.DataContext = treatments;
 }
Пример #6
0
        public void TestGetPatients()
        {
            Patient patient = new Patient(10000000, "UnitTestPatient", "UnitTestLName", new DateTime(), "", "", "", "", "", "", "");
            patient.Insert();

            List<Patient> p = Patient.GetPatients();
            Assert.IsNotEmpty(p);

            patient.Delete();
        }
Пример #7
0
 public AddTreatment(Treatment pTreatment)
 {
     InitializeComponent();
     treatment = pTreatment;
     waitlist = new WaitlistedPatient(treatment.TreatmentID);
     patient = new Patient();
     patient.GetPatient(treatment.PatientID);
     populatePreBoxFields();
      _isNewTreatment  = false;
 }
Пример #8
0
 //New
 public PrescriptionView(int healthCareNo)
 {
     InitializeComponent();
     this.patient = new Patient(healthCareNo);
     this.prescription = new Prescription();
     prescription.PatientID = patient.PatientID;
     prescription.StartDate = new MySql.Data.Types.MySqlDateTime(DateTime.Today);
     prescription.EndDate = new MySql.Data.Types.MySqlDateTime(DateTime.Today);
     populatePreBoxFields();
 }
Пример #9
0
 public PatientInformation(Patient Patient)
 {
     InitializeComponent();
     _isNewPatient = false;  //A new patient will not have a health care no to reference
     patient = Patient;
     if (Properties.Settings.Default.Role != "Support Staff")
     {
         buttonTreatment.Visibility = Visibility.Visible;
         buttonPrescription.Visibility = Visibility.Visible;
     }
 }
Пример #10
0
 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();
 }
Пример #11
0
        public PatientTreatmentView(int HCNO)
        {
            InitializeComponent();
            patient = new Patient(HCNO);
            lblName.Content = patient.LastName + ", " + patient.FirstName;
            upTreatments = Treatment.GetTreatments(patient.PatientID, "Upcoming");
            List<Treatment> currentTreatment = Treatment.GetTreatments(patient.PatientID, "Current");
            if (currentTreatment.Capacity > 0)
            {
                treatment = currentTreatment[0];
                //WaitlistedPatient wPatient = new WaitlistedPatient(treatment.TreatmentID);

                currentWardtb.Text = Database.Select("SELECT Ward.ward_name FROM Ward WHERE ward_slug IN (Select Bed.ward FROM Bed WHERE Bed.pid =" + patient.PatientID + ")")[0].ElementAt(0).ToString();

            }

            dataGridTreatments.DataContext = upTreatments;
        }
Пример #12
0
        public PrescriptionMainView(int HCNO)
        {
            InitializeComponent();
            //grab current patient to display name
            patient = new Patient(HCNO);
            lblPName.Content = patient.LastName + ", " + patient.FirstName;

            //set to upcioming or history based on date
            Prescription.CheckDatesForStatusChanges();

            //populate the three Datagrid lists
            prescripHist = Prescription.GetPrescriptions(patient.PatientID, "History");
            prescripUp = Prescription.GetPrescriptions(patient.PatientID, "Upcoming");
            prescripCurrent = Prescription.GetPrescriptions(patient.PatientID, "Current");

            //set data to Datagrids
            dataGridPrescriptionHist.DataContext = prescripHist;
            dataGridPrescriptionUp.DataContext = prescripUp;
            dataGridPrescriptionCurrent.DataContext = prescripCurrent;
        }
Пример #13
0
 /* Returns a list of patients based on query built from entries in UI
  */
 public static List<Patient> SearchPatient(string queryBuilt)
 {
     List<Patient> getPatients = new List<Patient>();
     try
     {
         List<object[]> dbPatient = Database.Select(queryBuilt);
         foreach (object[] row in dbPatient)
         {
             Patient newPatient = new Patient(Convert.ToInt32(row[1]), row[2].ToString(), row[3].ToString(),
                                         new DateTime(Convert.ToInt32(row[6]), Convert.ToInt32(row[5]), Convert.ToInt32(row[4])),
                                         row[7].ToString(), row[8].ToString(), row[9].ToString(), row[10].ToString(),
                                         row[11].ToString(), row[12].ToString(), row[13].ToString());
             newPatient.PatientID = Convert.ToInt32(row[0]);
             getPatients.Add(newPatient);
         }
     }
     catch (Exception)
     {
         System.Windows.MessageBox.Show("Error getting data from database and/or converting");
     }
     return getPatients;
 }
Пример #14
0
        private bool _isNewPatient = true; //To use the same window for edits and adds.

        #endregion Fields

        #region Constructors

        //Required for databinding -- END
        public PatientInformation()
        {
            InitializeComponent(); //New patient can use default constructor
            patient = new Patient();
        }
Пример #15
0
        public void TestSearchPatientWithValidQueryByMultipleExactParamters()
        {
            Patient p1 = new Patient(10000, "SearchFname1", "SearchLname1", new DateTime(), "Test Address", "Test City1", "Test Provice", "TEST", "1111111111", "2222222222", "3333333333");
            p1.Insert();
            p1.Select();

            Patient p2 = new Patient(20000, "SearchFname2", "SearchLname2", new DateTime(), "Test Address", "Test City2", "Test Provice", "TEST", "4444444444", "5555555555", "6666666666");
            p2.Insert();
            p2.Select();

            List<string> db = new List<string>();
            db.Add("fname");
            db.Add("lname");
            db.Add("city");

            List<string> s = new List<string>();
            s.Add("SearchFname1");
            s.Add("SearchLname1");
            s.Add("Test City1");

            Search search = new Search("Patient");
            search.UseInputs(db, s);

            List<Patient> p = Search.SearchPatient(search.GetBuiltQuery());
            //Assert.True(p[0].PatientID == p1.PatientID);

            p1.Delete();
            p2.Delete();
        }
Пример #16
0
 public void TestGetSetHealthCareNo()
 {
     Patient p = new Patient(1);
     Assert.True(p.HealthCareNo == 1);
     p.HealthCareNo = 2;
     Assert.True(p.HealthCareNo == 2);
 }
Пример #17
0
        public void TestPatientSelect()
        {
            Patient patient = new Patient(10000000, "UnitTestPatient", "UnitTestLName", new DateTime(), "", "", "", "", "", "", "");
            patient.Insert();

            Assert.True(patient.Select());

            patient.Delete();
        }
Пример #18
0
 public void TestGetSetFname()
 {
     Patient p = new Patient();
     p.FirstName = "Test";
     Assert.True(p.FirstName == "Test");
 }
Пример #19
0
 public void TestGetSetAddress()
 {
     Patient p = new Patient();
     p.StreetAddress = "Test";
     Assert.True(p.StreetAddress == "Test");
 }
Пример #20
0
 public void TestGetSetCity()
 {
     Patient p = new Patient();
     p.City = "Test";
     Assert.True(p.City == "Test");
 }
Пример #21
0
 public void TestGetPatientsWithInvalidPid()
 {
     Patient p = new Patient();
     Assert.False(p.GetPatient(-1));
 }
Пример #22
0
 public void TestGetSetPatientID()
 {
     Patient p = new Patient();
     p.PatientID = 1;
     Assert.True(p.PatientID == 1);
 }
Пример #23
0
 public void TestGetSetPostalCode()
 {
     Patient p = new Patient();
     p.PostalCode = "Test";
     Assert.True(p.PostalCode == "Test");
 }
Пример #24
0
 public void TestGetSetProvince()
 {
     Patient p = new Patient();
     p.Province = "Test";
     Assert.True(p.Province == "Test");
 }
Пример #25
0
        public void TestPatientUpdate()
        {
            Patient patient = new Patient(10000000, "UnitTestPatient", "UnitTestLName", new DateTime(), "", "", "", "", "", "", "");
            patient.Insert();
            patient.Select();

            patient.FirstName = "RenamedPatient";
            Assert.True(patient.Update());

            patient.Delete();
        }
Пример #26
0
        public void TestSearchPatientWithValidQueryByCloseProvice()
        {
            Patient p1 = new Patient(10000, "SearchFname1", "SearchLname1", new DateTime(), "Test Address", "Test City", "Test Provice", "TEST", "1111111111", "2222222222", "3333333333");
            p1.Insert();
            p1.Select();

            Patient p2 = new Patient(20000, "SearchFname2", "SearchLname2", new DateTime(), "Test Address", "Test City", "Test Provice", "TEST", "4444444444", "5555555555", "6666666666");
            p2.Insert();
            p2.Select();

            List<string> db = new List<string>();
            db.Add("province");

            List<string> s = new List<string>();
            s.Add("Test");

            Search search = new Search("Patient");
            search.UseInputs(db, s);

            List<Patient> p = Search.SearchPatient(search.GetBuiltQuery());
            Assert.True(p.Count >= 2);

            p1.Delete();
            p2.Delete();
        }
Пример #27
0
 public void TestGetSetMobilePhone()
 {
     Patient p = new Patient();
     p.MobilePhoneNo = "Test";
     Assert.True(p.MobilePhoneNo == "Test");
 }
Пример #28
0
 //Send in empty string if no search
 public static List<Patient> GetPatients()
 {
     List<object[]> rows = Database.Select("Select * FROM Patient");
     List<Patient> getPatients = new List<Patient>();
     if (rows != null)
     foreach (object[] row in rows)
     {
         Patient newPatient = new Patient(Convert.ToInt32(row[1]), row[2].ToString(), row[3].ToString(),
                                     new DateTime(Convert.ToInt32(row[6]), Convert.ToInt32(row[5]), Convert.ToInt32(row[4])),
                                     row[7].ToString(), row[8].ToString(), row[9].ToString(), row[10].ToString(),
                                     row[11].ToString(), row[12].ToString(), row[13].ToString());
         newPatient._PatientID = Convert.ToInt32(row[0]);
         getPatients.Add(newPatient);
     }
     return getPatients;
 }
Пример #29
0
 public void TestGetSetWorkPhone()
 {
     Patient p = new Patient();
     p.WorkPhoneNo = "Test";
     Assert.True(p.WorkPhoneNo == "Test");
 }