static void AddMedicalRecord(List <Patient> patientsList) { try { Console.Write("Enter patient ID number: "); string pid = Console.ReadLine().ToUpper(); Console.Write("\n Patient temperature: "); double ptm = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter patient observation: "); string pob = Console.ReadLine(); foreach (Patient p in patientsList) { if (p.Id == pid) { Stay st = new Stay(DateTime.Now, p); MedicalRecord mr = new MedicalRecord(pob, ptm, DateTime.Now); p.Stay = st; st.AddMedicalRecord(mr); Console.WriteLine("Medical record entry successfully added."); break; } else { Console.WriteLine("Error, Patient not found, please try again"); break; } } } catch { Console.WriteLine("Invalid Input. Please try again."); } }
static void RegisterHospitalStay(List <Patient> pList, List <Bed> bList) { DisplayPatientsRetrieve(pList); Console.Write("Enter patient ID number: "); string Patientid = Console.ReadLine().ToUpper(); DisplayBeds(bList); Console.Write("\nSelect bed to stay: "); int bednum = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter Date of Admission (DD/MM/YYYY): "); string d = Console.ReadLine(); string[] d2 = d.Split('/'); DateTime Dates = new DateTime(Convert.ToInt32(d2[2]), Convert.ToInt32(d2[1]), Convert.ToInt32(d2[0])); BedStay newbedStay = new BedStay(); Bed b = bList[bednum - 1]; if (b.Available != false) { if (b is ClassABed) { ClassABed bl = (ClassABed)b; Console.Write("Any accompanying guest?(Additional $100 per day)[Y/N]: "); string answer = Console.ReadLine().ToUpper(); if (answer == "Y") { bl.AccompanyingPerson = true; newbedStay = new BedStay(Dates, bl); } else if (answer == "N") { bl.AccompanyingPerson = false; newbedStay = new BedStay(Dates, bl); } else { Console.WriteLine("Incorrect Input, Please Try again..."); } } else if (b is ClassBBed) { ClassBBed bb = (ClassBBed)b; Console.Write("Is AirCon needed? [Y/N]: "); string answer = Console.ReadLine().ToUpper(); if (answer == "Y") { bb.AirCon = true; newbedStay = new BedStay(Dates, bb); } else if (answer == "N") { bb.AirCon = false; newbedStay = new BedStay(Dates, bb); } else { Console.WriteLine("Incorrect Input, Please Try again..."); } } else { ClassCBed bc = (ClassCBed)b; Console.Write("Is a portable TV required? [Y/N]: "); string answer = Console.ReadLine().ToUpper(); if (answer == "Y") { bc.PortableTv = true; newbedStay = new BedStay(Dates, bc); } else if (answer == "N") { bc.PortableTv = false; newbedStay = new BedStay(Dates, bc); } else { Console.WriteLine("Incorrect Input, Please Try again..."); } } foreach (Patient p in pList) { if (p.Id == Patientid) { Stay NewStay = new Stay(Dates, p); NewStay.AddBedstay(newbedStay); p.Stay = NewStay; p.Status = "Admitted"; } } b.Available = false; Console.WriteLine("\n\nStay registration successful!\n"); } else { Console.WriteLine("Bed does not exist. ."); Console.WriteLine("Stay registration unsucessful\n"); } }