private static void DischargePatient(PatientStay stay, DateTime now) { stay.visit.DateOfDischarge = now; }
private static PatientStay ProcessPatientVisit(DateTime now, Patient nextPatient, Doctor doctor, bool isOutPatient) { Visit visit = Visit.CreateVisit(0, doctor.Id, nextPatient.Id, now); if (isOutPatient) { visit.DateOfDischarge = now; } else { var nextBed = NextAvailableBed(); if (nextBed == null) { Console.WriteLine("no beds available!!!!"); Console.WriteLine("Current time: {0}", now); return null; } visit.Bed = nextBed; } context.Visits.AddObject(visit); context.SaveChanges(); if (!isOutPatient || RandomEvent(out_patient_notes_chance)) { CreateAmusingVisitDetail(visit); } if (isOutPatient) return null; PatientStay stay = new PatientStay() { visit = visit, length = new TimeSpan(rnd.Next(min_stay_duration, max_stay_duration), 0, 0, 0)}; return stay; }