public void Given_Invalid_Critical_Alert_Bed_Subscription_When_AlertUsers_Invoked_Then_Invalid_Result_Asserted() { Callbacks callbacks = new Callbacks(); HospitalBed bed = new HospitalBed { BedNumber = 10, Campus = "PIC", Floor = "2", Occupancy = "Pat111", Wing = "2A", RoomNumber = "12" }; AlertMonitorList subList = AlertMonitorList.Instance; subList.Subscribe(bed.ToString(), callbacks.CallbackFunc); PatientAlert alerts = new PatientAlert { CriticalAlerts = new List <DeviceAlert>(), MuteAlert = false, PatientId = "Pat111", WarningAlerts = new List <DeviceAlert>() }; alerts.CriticalAlerts.Add(new DeviceAlert { DeviceId = "Dev111", Message = "Critical", Value = 56 }); alertManager.AlertUsers(alerts); Assert.AreNotEqual("TestPassed", alerts.PatientId); subList.Unsubscribe(bed.ToString()); }
public void SubscribeToPatientAlerts(string doctorId) { ICallbackDoctorMonitoringService callbackChannel = OperationContext.Current.GetCallbackChannel <ICallbackDoctorMonitoringService>(); AlertMonitorList alertList = AlertMonitorList.Instance; alertList.Subscribe(doctorId, callbackChannel.ReceiveAlerts); }
public void Given_Valid_Critical_Alert_Campus_Subscription_When_AlertUsers_Invoked_Then_Valid_Result_Asserted() { Callbacks callbacks = new Callbacks(); string bed = "PIC"; AlertMonitorList subList = AlertMonitorList.Instance; subList.Subscribe(bed, callbacks.CallbackFunc); PatientAlert alerts = new PatientAlert { CriticalAlerts = new List <DeviceAlert>(), MuteAlert = false, PatientId = "Pat111", WarningAlerts = new List <DeviceAlert>() }; alerts.CriticalAlerts.Add(new DeviceAlert { DeviceId = "Dev111", Message = "Critical", Value = 56 }); alertManager.AlertUsers(alerts); Assert.AreEqual("TestPassed", alerts.PatientId); subList.Unsubscribe(bed); }
public void Given_Valid_Warning_Alert_Doctor_Subscription_When_AlertUsers_Invoked_Then_Valid_Result_Asserted() { Callbacks callbacks = new Callbacks(); AlertMonitorList subList = AlertMonitorList.Instance; subList.Subscribe("Doctor100", callbacks.CallbackFunc); PatientAlert alerts = new PatientAlert { CriticalAlerts = new List <DeviceAlert>(), MuteAlert = false, PatientId = "Pat111", WarningAlerts = new List <DeviceAlert>() }; alerts.CriticalAlerts.Add(new DeviceAlert { DeviceId = "Dev111", Message = "Warning", Value = 86 }); alertManager.AlertUsers(alerts); Assert.AreEqual("TestPassed", alerts.PatientId); Assert.IsFalse(alerts.WarningAlerts.Any()); subList.Unsubscribe("Doctor100"); }
public void SubscribeToPatientAlerts(string locationId) { ICallbackNurseMonitoringService callbackChannel = OperationContext.Current.GetCallbackChannel <ICallbackNurseMonitoringService>(); AlertMonitorList list = AlertMonitorList.Instance; list.Subscribe(locationId, callbackChannel.ReceiveAlerts); }
private void AlertNurseStations(PatientAlert alert, string roomNo, AlertMonitorList subscribers) { string wingNo = roomNo.Substring(0, roomNo.LastIndexOf('-')); TryInvoke(alert, subscribers.TryGetValue(wingNo)); string floorNo = wingNo.Substring(0, wingNo.LastIndexOf('-')); TryInvoke(alert, subscribers.TryGetValue(floorNo)); string campus = floorNo.Substring(0, floorNo.LastIndexOf('-')); TryInvoke(alert, subscribers.TryGetValue(campus)); }
static void Main(string[] args) { IAdmissionRepository admissionRepo = new AdmissionRepository(new PatientRepository(), new HospitalBedRepository(), new DeviceRepository(), new CustomDeviceRepository(new DeviceRepository())); ProcessingUnit processor = new ProcessingUnit(new VitalsRepository(), new AlertManager(admissionRepo), new VitalsAlertManager(), admissionRepo); AlertMonitorList list = AlertMonitorList.Instance; VitalsMonitorList vitalsList = VitalsMonitorList.Instance; Thread thread = new Thread(processor.Process); thread.Start(); ServiceHost host = new ServiceHost(typeof(Controllers.VitalsDataService.VitalsDataService)); host.Open(); Console.WriteLine("Service Hosted Successfully"); Console.Read(); }
public void AlertUsers(PatientAlert alert) { AlertMonitorList subscribers = AlertMonitorList.Instance; PatientAdmission patient = m_admissionRepository.Read(alert.PatientId); if (patient.PatientId != alert.PatientId) { return; } string bedNo = patient.Bed.ToString(); string roomNo = bedNo.Substring(0, bedNo.LastIndexOf('-')); TryInvoke(alert, subscribers.TryGetValue(roomNo)); AlertNurseStations(alert, roomNo, subscribers); var func = subscribers.TryGetValue("Doctor" + patient.DoctorId); alert.WarningAlerts = new List <DeviceAlert>(); TryInvoke(alert, func); }
public void UnsubscribeToPatientAlerts(string doctorId) { AlertMonitorList alertList = AlertMonitorList.Instance; alertList.Unsubscribe(doctorId); }
public void UnsubscribeToPatientAlerts(string locationId) { AlertMonitorList list = AlertMonitorList.Instance; list.Unsubscribe(locationId); }