public async void Initialize(IArrivalsLocalStorage storage) { this.Storage = storage; Appointments.Clear(); foreach (var map in await storage.LoadSimulationAppointments()) { Appointments.Add(map); } PractitionerFhirIds.Clear(); foreach (var id in await storage.LoadSimulationIds()) { PractitionerFhirIds.Add(id); } DateTime dt = DateTime.Now; EditingAppointment.AppointmentStartTime = dt.AddTicks(-(dt.Ticks % TimeSpan.TicksPerSecond)); EditingAppointment.ArrivalStatus = AppointmentStatus.Booked; }
public ReloadSettingsCommand(IArrivalsLocalStorage storage) { _storage = storage; }
public TestSmsSettingsCommand(IArrivalsLocalStorage storage) { _storage = storage; }
public SaveSettingsCommand(IArrivalsLocalStorage storage) { _storage = storage; }
/// <summary> /// Retrieve the set of appointments that have mobile numbers with a status of booked, arrived, or fulfilled /// And attach the processing status data from local storage too /// </summary> /// <param name="model"></param> public async System.Threading.Tasks.Task <List <PmsAppointment> > SearchAppointments(DateTime date, IList <DoctorRoomLabelMapping> roomMappings, IArrivalsLocalStorage storage) { List <PmsAppointment> results = new List <PmsAppointment>(); var server = GetServerConnection(); if (server == null) { return(null); } var criteria = new SearchParams(); criteria.Add("date", date.Date.ToString("yyyy-MM-dd")); criteria.Include.Add("Appointment:actor"); var bundle = await server.SearchAsync <Appointment>(criteria); // Debugging var doc = System.Xml.Linq.XDocument.Parse(new Hl7.Fhir.Serialization.FhirXmlSerializer().SerializeToString(bundle)); // Console.WriteLine(doc.ToString(System.Xml.Linq.SaveOptions.None)); Func <ResourceReference, System.Threading.Tasks.Task <Resource> > resolveReference = async(reference) => { if (string.IsNullOrEmpty(reference.Reference)) { return(null); } ResourceIdentity ri = new ResourceIdentity(reference.Reference); var resource = bundle.Entry.FirstOrDefault(e => e.Resource.ResourceType.GetLiteral() == ri.ResourceType && e.Resource.Id == ri.Id)?.Resource; if (resource == null) { // wasn't returned in the bundle, so go searching for it resource = await server.ReadAsync <Resource>(reference.Reference); } return(resource); }; foreach (var entry in bundle.Entry.Select(e => e.Resource as Appointment).Where(e => e != null)) { PmsAppointment appt = null; if (entry.Status == Appointment.AppointmentStatus.Booked || entry.Status == Appointment.AppointmentStatus.Arrived || entry.Status == Appointment.AppointmentStatus.Fulfilled) { appt = await ToPmsAppointment(entry, resolveReference); if (appt != null) { if (!string.IsNullOrEmpty(appt.PatientMobilePhone)) { results.Add(appt); // Check if the practitioner has a mapping already if (!roomMappings.Any(m => m.PractitionerFhirID == appt.PractitionerFhirID)) { // Add in an empty room mapping roomMappings.Add(new DoctorRoomLabelMapping() { PractitionerFhirID = appt.PractitionerFhirID, PractitionerName = appt.PractitionerName }); } // And read in the extended content from storage await storage.LoadAppointmentStatus(appt); } } } } return(results); }
public ReloadTemplatesCommand(IArrivalsLocalStorage storage) { _storage = storage; }
public SaveTemplatesCommand(IArrivalsLocalStorage storage) { _storage = storage; }
public ClearUnproccessedMessagesCommand(IArrivalsLocalStorage storage) { _storage = storage; }
public ReloadRoomMappingsCommand(IArrivalsLocalStorage storage) { _storage = storage; }
public async Task <List <PmsAppointment> > SearchAppointments(DateTime date, IList <DoctorRoomLabelMapping> roomMappings, IArrivalsLocalStorage storage) { List <PmsAppointment> result = new List <PmsAppointment>(); result.AddRange(Appointments.Where(a => a.AppointmentStartTime.Date == date.Date)); foreach (var appt in result) { // Check if the practitioner has a mapping already if (!roomMappings.Any(m => m.PractitionerFhirID == appt.PractitionerFhirID)) { // Add in an empty room mapping roomMappings.Add(new DoctorRoomLabelMapping() { PractitionerFhirID = appt.PractitionerFhirID, PractitionerName = appt.PractitionerName }); } // And read in the extended content from storage await storage.LoadAppointmentStatus(appt); } return(result); }