Пример #1
0
        private void CreateTestDataForDebug()
        {
#if DEBUG
            // This is some test data to assist in the UI Designer
            Expecting.Add(new PmsAppointment()
            {
                PatientName = "Postlethwaite, Brian", PatientMobilePhone = "0423857505", ArrivalStatus = Hl7.Fhir.Model.Appointment.AppointmentStatus.Pending, AppointmentStartTime = DateTime.Parse("9:45am"), PractitionerName = "Dr Nathan Pinskier"
            });
            Expecting.Add(new PmsAppointment()
            {
                PatientName = "Esler, Brett", PatientMobilePhone = "0423083847", ArrivalStatus = Hl7.Fhir.Model.Appointment.AppointmentStatus.Pending, AppointmentStartTime = DateTime.Parse("10:00am"), PractitionerName = "Dr Nathan Pinskier"
            });
            Waiting.Add(new PmsAppointment()
            {
                PatientName = "Grieve, Grahame", PatientMobilePhone = "0423083847", ArrivalStatus = Hl7.Fhir.Model.Appointment.AppointmentStatus.Arrived, AppointmentStartTime = DateTime.Parse("10:00am"), PractitionerName = "Dr Nathan Pinskier"
            });
            RoomMappings.Add(new DoctorRoomLabelMapping()
            {
                PractitionerFhirID  = "1",
                PractitionerName    = "Dr Nathan",
                LocationName        = "Room 1",
                LocationDescription = "Proceed through the main lobby and its the 3rd door on the right"
            });
            RoomMappings.Add(new DoctorRoomLabelMapping()
            {
                PractitionerFhirID  = "1",
                PractitionerName    = "Dr Smith",
                LocationName        = "Room 2",
                LocationDescription = "Proceed through the main lobby and its the 2nd door on the right"
            });
#endif
        }
Пример #2
0
        public Model()
        {
#if DEBUG
            // This is some test data to assist in the UI Designer
            Expecting.Add(new PmsAppointment()
            {
                ArrivalTime = "10:35am", PatientName = "Postlethwaite, Brian", PatientMobilePhone = "0423857505", ArrivalStatus = "Pending", AppointmentStartTime = "9:45am", PractitionerName = "Dr Nathan Pinskier"
            });
            Expecting.Add(new PmsAppointment()
            {
                ArrivalTime = "10:35am", PatientName = "Esler, Brett", PatientMobilePhone = "0423083847", ArrivalStatus = "Pending", AppointmentStartTime = "10:00am", PractitionerName = "Dr Nathan Pinskier"
            });
            Waiting.Add(new PmsAppointment()
            {
                ArrivalTime = "10:35am", PatientName = "Grieve, Grahame", PatientMobilePhone = "0423083847", ArrivalStatus = "Arrived", AppointmentStartTime = "10:00am", PractitionerName = "Dr Nathan Pinskier"
            });
            RoomMappings.Add(new DoctorRoomLabelMappings()
            {
                PractitionerFhirID  = "1",
                PractitionerName    = "Dr Nathan",
                LocationName        = "Room 1",
                LocationDescription = "Proceed through the main lobby and its the 3rd door on the right"
            });
#endif
        }
        public RoomFacilityModel GetRoomFacilityById(int id)
        {
            var roomid = GetRoomIdFromRoomFacilityId(id);
            var facilityid = GetFacilityIdFromRoomFacilityId(id);
            var room = _internalUnitOfWork.RoomRepository.GetByID(roomid);
            var roomcategory = room.Category;
            var facility = _internalUnitOfWork.FacilitiesRepository.GetByID(facilityid);
 
            var roomfacility = _internalUnitOfWork.RoomFacilitiesRepository.GetByID(id);
            return FacilityMappings.MapRoomFacilityToRFModel(roomfacility, RoomMappings.MapRoomToRModel(room), FacilityMappings.MapFacilityToFacilityModel2(facility));
        }
 public void CreateNewRoom(string RoomName, string RoomDescription, int RoomGuestNr, decimal RoomPrice, string RoomImageUrl, int CatId)
 {
     var room = new RoomModel()
     {
         RoomName = RoomName,
         RoomDescription = RoomDescription,
         GuestsNr = RoomGuestNr,
         Price = RoomPrice,
         ImagePath = RoomImageUrl,
         Active = true,
         Occupied = false,
         CategoryId = CatId,
     };
     var dbroom = RoomMappings.MapRoomModelToRomWithoutFacilities(room);
     _internalUnitOfWork.RoomRepository.Insert(dbroom);
     _internalUnitOfWork.Save();
 }
 public List<RoomModel> GetAllRooms()
 {
     return _internalUnitOfWork.RoomRepository.Get().Select(r => RoomMappings.MapRoomToRModel(r)).ToList();
 }
 public List<RoomCategoryModel> GetAllRoomCategories()
 {
     return _internalUnitOfWork.RoomCategoriesRepository.Get()
         .Select(rc => RoomMappings.MapRoomCatToRCModel(rc)).ToList();
 }
 public RoomModel GetRoomById(int id)
 {
     var room = _internalUnitOfWork.RoomRepository.GetByID(id);
     return RoomMappings.MapRoomToRModel(room);
 }
Пример #8
0
        public async Task Initialize(Dispatcher dispatcher)
        {
            // read the settings from storage
            Settings.CopyFrom(await Storage.LoadSettings());
            if (Settings.SystemIdentifier == Guid.Empty)
            {
                // this only occurs when the system hasn't had one allocated
                // so we can create a new one, then save the settings.
                // (this will force an empty setting file with the System Identifier if needed)
                Settings.AllocateNewSystemIdentifier();
                await Storage.SaveSettings(Settings);
            }

            // read the room mappings from storage
            RoomMappings.Clear();
            foreach (var map in await Storage.LoadRoomMappings())
            {
                RoomMappings.Add(map);
            }

            Templates.Clear();
            foreach (var template in await Storage.LoadTemplates())
            {
                Templates.Add(template);
            }
            AddMissingTemplates();

            // reload any unmatched messages
            var messages = await Storage.LoadUnprocessableMessages(DisplayingDate);

            foreach (var item in messages)
            {
                UnprocessableMessages.Add(item);
            }

            PmsSimulator.Initialize(Storage);
            if (!IsSimulation)
            {
                FhirApptReader = new FhirAppointmentReader(FhirAppointmentReader.GetServerConnection);
                SmsProcessor.Initialize(Settings);
            }
            logger.Log(1, "Start up");
            if (!String.IsNullOrEmpty(Settings.AdministratorPhone))
            {
                logger.Log(1, "Send SMS to " + Settings.AdministratorPhone);
                try
                {
                    SmsProcessor.SendMessage(new SmsMessage(Settings.AdministratorPhone, "System is starting"));
                    if (!IsSimulation)
                    {
                        App.AdministratorPhone = Settings.AdministratorPhone;
                        App.SmsSender          = SmsProcessor;
                    }
                }
                catch (Exception ex)
                {
                    System.Windows.MessageBox.Show("Error sending message: " + ex.Message);
                }
            }

            // setup the background worker routines
            ReadSmsMessage = new BackgroundProcess(Settings, serverStatuses.IncomingSmsReader, dispatcher, async() =>
            {
                // Logic to run on this process
                // (called every settings.interval)
                StatusBarMessage            = $"Last read SMS messages at {DateTime.Now.ToLongTimeString()}";
                var engine                  = PrepareMessagingEngine();
                List <PmsAppointment> appts = new List <PmsAppointment>();
                appts.AddRange(Appointments);
                var messagesReceived = await engine.SmsSender.ReceiveMessages();
                serverStatuses.IncomingSmsReader.Use(messagesReceived.Count());
                engine.ProcessIncomingMessages(appts, messagesReceived);
            });

            ScanAppointments = new BackgroundProcess(Settings, serverStatuses.AppointmentScanner, dispatcher, async() =>
            {
                // Logic to run on this process
                // (called every settings.interval)
                var engine = PrepareMessagingEngine();
                List <PmsAppointment> appts = await FhirApptReader.SearchAppointments(this.DisplayingDate, RoomMappings, Storage);
                serverStatuses.Oridashi.Use(1);
                serverStatuses.AppointmentScanner.Use(engine.ProcessTodaysAppointments(appts));

                // Now update the UI once we've processed it all
                Expecting.Clear();
                Waiting.Clear();
                Appointments.Clear();
                foreach (var appt in appts)
                {
                    Appointments.Add(appt);
                    if (appt.ArrivalStatus == Hl7.Fhir.Model.Appointment.AppointmentStatus.Booked)
                    {
                        Expecting.Add(appt);
                    }
                    else if (appt.ArrivalStatus == Hl7.Fhir.Model.Appointment.AppointmentStatus.Arrived)
                    {
                        Waiting.Add(appt);
                    }
                }
            });

            ProcessUpcomingAppointments = new BackgroundProcess(Settings, serverStatuses.UpcomingAppointmentProcessor, dispatcher, async() =>
            {
                // Logic to run on this process
                // (called every settings.intervalUpcoming)
                var engine = PrepareMessagingEngine();
                List <PmsAppointment> appts = new List <PmsAppointment>();
                appts.AddRange(await FhirApptReader.SearchAppointments(this.DisplayingDate.AddDays(1), RoomMappings, Storage));
                appts.AddRange(await FhirApptReader.SearchAppointments(this.DisplayingDate.AddDays(2), RoomMappings, Storage));
                serverStatuses.Oridashi.Use(1);
                serverStatuses.UpcomingAppointmentProcessor.Use(engine.ProcessUpcomingAppointments(appts));
            }, true);
        }
Пример #9
0
 public List <RoomModel> GetAllFreeRooms()
 {
     return(_internalUnitOfWork.RoomRepository.Get(r => r.Occupied == false && r.Enabled == true).Select(r => RoomMappings.MapRoomToRModel(r)).ToList());
 }