public Dictionary <int, string> GetSelectableLpuList(Yamed_Service.Patient patient)
        {
            Dictionary <int, string> selectableLpuList = new Dictionary <int, string>();
            var availableLpuList = GetIdAvailableLpuList(patient.NPolis);

            //TODO: для тестирования. Будет срабатывать, когда сервис недоступен для 1 пациента - ОКИШЕВА А.С
            if (availableLpuList == null && patient.NPolis == "4647200887000088" && patient.Birthday == DateTime.Parse("12.12.1997"))
            {
                availableLpuList = new List <int>
                {
                    { 21 }, { 78 }, { 79 }, { 80 }, { 81 }, { 82 }, { 83 }, { 84 }, { 85 }, { 86 }, { 87 }, { 88 }, { 89 }, { 90 }, { 91 },
                    { 92 }, { 93 }, { 94 }, { 95 }, { 142 }, { 77 }, { 29 }, { 19 }, { 11 }, { 17 }
                };
            }
            if (availableLpuList != null)
            {
                var permissibleLpuList = GetPermissibleLpuList(availableLpuList, patient);
                var womanLpuList       = GetWomanLpuList(ref permissibleLpuList);
                var childLpuList       = GetChildLpuList(ref permissibleLpuList);
                var adultLpuList       = GetAdultLpuList(ref permissibleLpuList);
                var stomatLpuList      = GetStomatLuList(ref permissibleLpuList);


                if ((DateTime.Today.Year - patient.Birthday.Year) < 18)
                {
                    selectableLpuList = selectableLpuList.Concat(childLpuList).ToDictionary(d => d.Key, d => d.Value);
                    if (!StomatIsPresent(selectableLpuList))
                    {
                        selectableLpuList = selectableLpuList.Concat(stomatLpuList).ToDictionary(d => d.Key, d => d.Value);
                    }
                }
                else
                {
                    selectableLpuList = selectableLpuList.Concat(adultLpuList).ToDictionary(d => d.Key, d => d.Value);
                    if (!StomatIsPresent(selectableLpuList))
                    {
                        selectableLpuList = selectableLpuList.Concat(stomatLpuList).ToDictionary(d => d.Key, d => d.Value);
                    }
                }
                if (patient.SexPat == Yamed_Service.Sex.Female)
                {
                    selectableLpuList = selectableLpuList.Concat(womanLpuList).ToDictionary(d => d.Key, d => d.Value);
                }
                selectableLpuList = selectableLpuList.Concat(permissibleLpuList).ToDictionary(d => d.Key, d => d.Value);
            }
            else
            {
                selectableLpuList = null;
            }


            return(selectableLpuList);
        }
Exemplo n.º 2
0
 public Yamed_Service.Patient GetPatientInfo(string polOMSNumber)
 {
     Yamed_Service.Patient patient = null;
     if (polOMSNumber != null)
     {
         Yamed_Service.GetPatientClient yamedService = new Yamed_Service.GetPatientClient();
         var res = yamedService.GetPatientAsync(polOMSNumber);
         if (res.Result != null)
         {
             patient = res.Result;
         }
     }
     else
     {
         patient = null;
     }
     return(patient);
 }
        private AppointmentWithDoctorViewModel GetFilledAppointmentWithDoctorViewModel(Yamed_Service.Patient currentPatient,
                                                                                       string paginationType)
        {
            AppointmentWithDoctorViewModel viewModel = new AppointmentWithDoctorViewModel();
            PatientViewModel patient = new PatientViewModel
            {
                FIO       = HttpContext.Session.GetString("fioPatient"),
                Birthday  = DateTime.Parse(HttpContext.Session.GetString("birthdayPatient")),
                NPolis    = currentPatient.NPolis,
                SexPat    = currentPatient.SexPat,
                IdPatient = HttpContext.Session.GetString("idPatient")
            };
            LpuViewModel lpu = new LpuViewModel
            {
                IdLpu      = HttpContext.Session.GetString("idCurrentLpu"),
                NameLpu    = HttpContext.Session.GetString("nameCurrentLpu"),
                AddressLpu = HttpContext.Session.GetString("addressCurrentLpu")
            };
            LpuViewModel selectLpu = new LpuViewModel
            {
                IdLpu      = HttpContext.Session.GetString("idSelectLpu"),
                NameLpu    = HttpContext.Session.GetString("nameSelectLpu"),
                AddressLpu = HttpContext.Session.GetString("addressSelectLpu")
            };
            SpesialityViewModel spesiality = new SpesialityViewModel
            {
                IdSpesiality              = HttpContext.Session.GetString("idSpesiality"),
                NameSpesiality            = HttpContext.Session.GetString("nameSpesiality"),
                CountFreeTicketSpesiality = HttpContext.Session.GetString("countFreeTicketSpesiality")
            };
            DoctorViewModel doctor = new DoctorViewModel
            {
                IdDoctor              = HttpContext.Session.GetString("idDoctor"),
                NameDoctor            = HttpContext.Session.GetString("nameDoctor"),
                CountFreeTicketDoctor = HttpContext.Session.GetString("countFreeTicketDoctor")
            };
            SelectedDayViewModel selectedDay = new SelectedDayViewModel
            {
                DayName = HttpContext.Session.GetString("selectDayName"),
                DayDate = HttpContext.Session.GetString("selectDayDate")
            };
            string selectedTime        = HttpContext.Session.GetString("selectTime");
            string roomNumber          = HttpContext.Session.GetString("roomNumber");
            string idSelectAppointment = HttpContext.Session.GetString("idSelectAppointment");

            bool isAppointmentCOVID = false;

            if (HttpContext.Session.GetString("nextPathKey") == "AppointmentWithCOVID19")
            {
                isAppointmentCOVID = true;
            }

            viewModel = viewModelHelper.FillAppointmentWithDoctorViewModel(patient, lpu, selectLpu, spesiality, doctor, selectedDay, selectedTime,
                                                                           roomNumber, idSelectAppointment, currentPatient, paginationType, isAppointmentCOVID);
            return(viewModel);
        }
        private Dictionary <int, string> GetPermissibleLpuList(List <int> availableLpuList, Yamed_Service.Patient patient)
        {
            Dictionary <int, string> permissiblesLpu = new Dictionary <int, string>();
            var AllLpu = netricaHelper.GetAllLpu();

            foreach (var idLpu in availableLpuList)
            {
                var permissLpu = AllLpu.Where(l => l.Key == idLpu).FirstOrDefault();
                if (permissLpu.Key != 0)
                {
                    NetricaTestService.Patient netricaPatient = new NetricaTestService.Patient
                    {
                        Polis_N  = patient.NPolis,
                        Birthday = patient.Birthday
                    };
                    var idPatient = netricaHelper.GetIdPatient(netricaPatient, permissLpu.Key);
                    if (idPatient != "")
                    {
                        permissiblesLpu.Add(permissLpu.Key, permissLpu.Value);
                    }
                }
            }
            return(permissiblesLpu);
        }
Exemplo n.º 5
0
        public AppointmentWithDoctorViewModel FillAppointmentWithDoctorViewModel(PatientViewModel currentPatientModel, LpuViewModel currentLpuModel,
                                                                                 LpuViewModel selectLpuModel, SpesialityViewModel selectSpesialityModel,
                                                                                 DoctorViewModel selectDoctorModel, SelectedDayViewModel selectedDayViewModel,
                                                                                 string selectTime, string roomNumber, string idSelectAppointment,
                                                                                 Yamed_Service.Patient currentPatient_service,
                                                                                 string paginationType, bool isAppointmentCOVID = false)
        {
            PatientViewModel                      currentPatient                = currentPatientModel;
            LpuViewModel                          currentLpu                    = currentLpuModel;
            LpuViewModel                          selectLpu                     = selectLpuModel;
            SpesialityViewModel                   selectSpesiality              = selectSpesialityModel;
            DoctorViewModel                       selectDoctor                  = selectDoctorModel;
            SelectedDayViewModel                  selectDay                     = selectedDayViewModel;
            Dictionary <int, string>              selectableLpuList             = null;
            List <NetricaTestService.Spesiality>  specialitiesList              = null;
            List <NetricaTestService.Doctor1>     doctorsList                   = null;
            List <AvialableDateModel>             avialableDatesAppointmentList = null;
            List <NetricaTestService.Appointment> appointmentsList              = null;
            PaginationViewModel                   pageViewModel                 = null;

            if (currentPatient_service != null)
            {
                selectableLpuList = attachmentServiceHelper.GetSelectableLpuList(currentPatient_service);
                if (currentLpu.IdLpu == "267") // Для Щигровской ЦРБ сделан фильтр от ФАПов
                {
                    var selectableLpuListNoFAP = attachmentServiceHelper.RemoveFAPs(selectableLpuList);
                    selectableLpuList = selectableLpuListNoFAP;
                }
                if (isAppointmentCOVID)
                {
                    var newSelectableLpuList = dataHelper.GetCOVIDLpuList(selectableLpuList);
                    selectableLpuList = newSelectableLpuList;
                }
            }
            if (selectLpu.IdLpu != null)
            {
                specialitiesList = netricaHelper.GetSpesialityList(int.Parse(selectLpu?.IdLpu?.ToString()));
                if (isAppointmentCOVID)
                {
                    var newSpecialitiesList = dataHelper.GetCOVIDSpecialityList(specialitiesList);
                    specialitiesList = newSpecialitiesList;
                }
                if (selectSpesiality.IdSpesiality != null)
                {
                    doctorsList = netricaHelper.GetDoctorList(int.Parse(selectLpu.IdLpu), selectSpesiality.IdSpesiality);
                }
                if (selectDoctor.IdDoctor != null)
                {
                    DateTime dayStart = DateTime.Now.AddDays(1);
                    DateTime dayEnd   = DateTime.Now.AddDays(17);
                    List <AvialableDateModel> availableDatesList = netricaHelper.GetAvailableDates(int.Parse(selectLpu.IdLpu), selectDoctor.IdDoctor, currentPatient.IdPatient,
                                                                                                   dayStart, dayEnd);
                    avialableDatesAppointmentList = dateHelper.GetTwoWeekAvialableDyas(dayStart, dayEnd, availableDatesList);
                    appointmentsList = netricaHelper.GetAvailableAppointment(int.Parse(selectLpu.IdLpu), selectDoctor.IdDoctor, currentPatient.IdPatient,
                                                                             selectDay.DayDate);
                }
            }

            int startPage     = 1;
            int itemPageCount = 5;

            switch (paginationType)
            {
            case "SelectLpu":
                if (selectableLpuList != null)
                {
                    var count = selectableLpuList.Count();
                    selectableLpuList = selectableLpuList.Skip((startPage - 1) * itemPageCount).Take(itemPageCount).ToDictionary(d => d.Key, d => d.Value);
                    pageViewModel     = new PaginationViewModel(count, startPage, itemPageCount);
                }
                else
                {
                    pageViewModel = new PaginationViewModel(0, startPage, itemPageCount);
                }
                break;

            case "SelectSpesiality":
                if (specialitiesList != null)
                {
                    var count = specialitiesList.Count();
                    specialitiesList = specialitiesList.Skip((startPage - 1) * itemPageCount).Take(itemPageCount).ToList();
                    pageViewModel    = new PaginationViewModel(count, startPage, itemPageCount);
                }
                else
                {
                    pageViewModel = new PaginationViewModel(0, startPage, itemPageCount);
                }
                break;

            case "SelectDoctor":
                if (doctorsList != null)
                {
                    var count = doctorsList.Count();
                    doctorsList   = doctorsList.Skip((startPage - 1) * itemPageCount).Take(itemPageCount).ToList();
                    pageViewModel = new PaginationViewModel(count, startPage, itemPageCount);
                }
                else
                {
                    pageViewModel = new PaginationViewModel(0, startPage, itemPageCount);
                }
                break;

            default:
                pageViewModel = new PaginationViewModel(0, 0, 0);
                break;
            }

            AppointmentWithDoctorViewModel viewModel = new AppointmentWithDoctorViewModel()
            {
                Patient                   = currentPatient,
                Lpu                       = currentLpu,
                SelectLpu                 = selectLpu,
                Spesiality                = selectSpesiality,
                Doctor                    = selectDoctor,
                SelectedDay               = selectDay,
                SelectedTime              = selectTime,
                RoomNumber                = roomNumber,
                IdSelectAppointment       = idSelectAppointment,
                LpusList                  = selectableLpuList,
                SpesialitiesList          = specialitiesList,
                DoctorsList               = doctorsList,
                AvailableDatesAppointment = avialableDatesAppointmentList,
                AppointmentList           = appointmentsList,
                PaginationViewModel       = pageViewModel
            };

            return(viewModel);
        }