} // end of FindControlForOutpatientAdmission #endregion #region FindControlForInpatientAdmission /// <summary> /// Finds a control unit that handles a specific inpatient admission type /// </summary> /// <param name="admission">The admission type that is searched for</param> /// <returns>Either a control unit that handles the admission or null if no such control unit exists</returns> public ControlUnit FindControlForInpatientAdmission(InpatientAdmissionTypes admission) { if (!HandledInpatientAdmissionTypes.Contains(admission)) { return(null); } if (this.ControlUnitType == Enums.ControlUnitType.Inpatient && this.HandledInpatientAdmissionTypes.Contains(admission)) { return(this); } else { foreach (ControlUnitHealthCare childControl in ChildHealthCareControlUnits) { ControlUnit foundControl = childControl.FindControlForInpatientAdmission(admission); if (foundControl != null) { return(foundControl); } } // end foreach } // end if return(null); } // end of FindControlForInpatientAdmission
} // end of InpatientNumberSlotsPerDay #endregion #region CreateInpatientPath public EntityInpatientPath CreateInpatientPath(EntityPatient patient, InpatientAdmissionTypes admission) { List <TimeSpan> timeGaps1 = new List <TimeSpan>(); timeGaps1.Add(TimeSpan.FromDays(1)); timeGaps1.Add(TimeSpan.FromDays(1)); TreatmentBlock newTreatmentBlocl0 = new TreatmentBlock( MathTool.Helpers <InpatientTreatmentTypes> .ToList(TreatmentTypes["InpatientInternalTreatment"]), timeGaps1, WardTypes.IntensiveCare, BedType.Intensive, true, this); List <InpatientTreatmentTypes> treatmentsBlock2 = new List <InpatientTreatmentTypes>(); treatmentsBlock2.Add(TreatmentTypes["InpatientInternalPreTreatment"]); treatmentsBlock2.Add(TreatmentTypes["InpatientInternalTreatment"]); treatmentsBlock2.Add(TreatmentTypes["InpatientInternalFollowUp"]); List <TimeSpan> timeGaps2 = new List <TimeSpan>(); timeGaps2.Add(TimeSpan.FromDays(1)); timeGaps2.Add(TimeSpan.FromDays(1)); timeGaps2.Add(TimeSpan.FromDays(1)); timeGaps2.Add(TimeSpan.FromDays(1)); TreatmentBlock newTreatmentBlock1 = new TreatmentBlock( treatmentsBlock2, timeGaps2, WardTypes.General, BedType.Scheduled, false, this); List <TreatmentBlock> treatmentBlocks = new List <TreatmentBlock>(); //if (patient.PatientType == PatientType.Emergency) // treatmentBlocks.Add(newTreatmentBlocl0); treatmentBlocks.Add(newTreatmentBlock1); return(new EntityInpatientPath(patient, treatmentBlocks)); } // end of EntityInpatientPath
} // end of HandleMoveOutpatient #endregion #region HandleMoveInpatient /// <summary> /// Handles the move or admission of a patient to an inpatient department in the model. The patient is /// directly referred to the inpatient control via the enter method. The handling of arriving /// patients is left to the target control. /// </summary> /// <param name="del">The RequestMoveInpatient delegate</param> /// <param name="controlUnit">The filing control unit</param> /// <param name="time">Time the request was filed</param> /// <param name="simEngine">SimEngine responsible</param> /// <returns>True if the request could be handled</returns> static public bool HandleMoveInpatient(IDelegate del, ControlUnit controlUnit, DateTime time, ISimulationEngine simEngine) { #region MoveInpatient if (del is RequestMoveInpatient) { ControlUnit controlForAction; RequestMoveInpatient outDel = (RequestMoveInpatient)del; InpatientAdmissionTypes admissionType = (InpatientAdmissionTypes)outDel.InpatientAdmission.AdmissionType; controlForAction = ((ControlUnitHealthCare)controlUnit).FindControlForInpatientAdmission(admissionType); if (controlForAction == null) { controlUnit.SendDelegateTo(controlUnit.ParentControlUnit, outDel); return(true); } else { EntityPatient patient = ((outDel).Patient); patient.StopCurrentActivities(time, simEngine); Event enterEvent = controlForAction.EntityEnterControlUnit(time, simEngine, patient, outDel); enterEvent.Trigger(time, simEngine); return(true); } // end if } // end if #endregion return(true); } // end of HandleMoveInpatient