public IActionResult AppointmentWithDoctorSelectType(int idSelectLpu, string nameSelectLpu)
        {
            AppointmentWithDoctorViewModel appointmentViewModel = null;

            if (idSelectLpu != 0 && nameSelectLpu != null)
            {
                string polisNPatient   = HttpContext.Session.GetString("polisNPatient");
                string birthdayPatient = HttpContext.Session.GetString("birthdayPatient");
                HttpContext.Session.SetString("idSelectLpu", idSelectLpu.ToString());
                HttpContext.Session.SetString("nameSelectLpu", nameSelectLpu);
                var patientNetrica = new NetricaTestService.Patient
                {
                    Polis_N  = polisNPatient,
                    Birthday = DateTime.Parse(birthdayPatient)
                };
                var idPatient = netricaHelper.GetIdPatient(patientNetrica, idSelectLpu);
                if (idPatient == "")
                {
                    ErrorModel errors = new ErrorModel();
                    errors.IdError   = "idPatient is null";
                    errors.TextError = "Ошибка. Обратитесь к администратору системы";
                    return(View("~/Views/Home/ErrorPage.cshtml", errors));
                }
                HttpContext.Session.SetString("idPatient", idPatient);
            }

            if (HttpContext.Session.GetString("nextPathKey") == "AppointmentWithCOVID19")
            {
                appointmentViewModel = GetFilledAppointmentWithDoctorViewModel(null, "SelectSpesiality");
                return(View("~/Views/AppointmentWithDoctor/AppointmentWithDoctorSelectSpesiality.cshtml", appointmentViewModel));
            }

            appointmentViewModel = GetFilledAppointmentWithDoctorViewModel(null, null);
            return(View("~/Views/AppointmentWithDoctor/AppointmentWithDoctorSelectType.cshtml", appointmentViewModel));
        }
        public IActionResult AppointmentWithDoctorSetAppointment()
        {
            AppointmentWithDoctorViewModel appointmentViewModel = GetFilledAppointmentWithDoctorViewModel(null, null);
            var resultSetAppointment = netricaHelper.SetAppointment(appointmentViewModel);

            if (resultSetAppointment.Length == 0)
            {
                using (DataBaseContext db = new DataBaseContext())
                {
                    AppointmentQualityDBModel appointmentQualityModel = FillAppointmentQualityModel();

                    try
                    {
                        db.AppointmentQuality.Add(appointmentQualityModel);
                        db.SaveChanges();
                        return(Ok("OK"));
                    }
                    catch (Exception ex)
                    {
                        ErrorModel errorModel = new ErrorModel();
                        errorModel.IdError   = "m1";
                        errorModel.TextError = ex.Message;
                        return(Ok(ex.Message));
                    }
                }
            }
            else
            {
                ErrorModel errorModel = new ErrorModel();
                errorModel.IdError   = resultSetAppointment[0].IdError.ToString();
                errorModel.TextError = resultSetAppointment[0].ErrorDescription;
                return(Ok(errorModel.TextError));
            }
        }
        public IActionResult AppointmentWithDoctorSelectTime(string selectDayName, string selectDayDate)
        {
            HttpContext.Session.SetString("selectDayName", selectDayName);
            HttpContext.Session.SetString("selectDayDate", selectDayDate);

            AppointmentWithDoctorViewModel appointmentViewModel = GetFilledAppointmentWithDoctorViewModel(null, null);

            return(View("~/Views/AppointmentWithDoctor/AppointmentWithDoctorSelectTime.cshtml", appointmentViewModel));
        }
        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);
        }
        public IActionResult AppointmentWithDoctorSelectDate(string idSelectDoctor, string nameSelectDoctor, string countFreeTicketSelectDoctor)
        {
            HttpContext.Session.SetString("idSelectDoctor", idSelectDoctor);
            HttpContext.Session.SetString("nameSelectDoctor", nameSelectDoctor);
            HttpContext.Session.SetString("countFreeTicketSelectDoctor", countFreeTicketSelectDoctor);

            AppointmentWithDoctorViewModel appointmentViewModel = GetFilledAppointmentWithDoctorViewModel(null, "SelectDates");

            return(View("~/Views/AppointmentWithDoctor/AppointmentWithDoctorSelectDate.cshtml", appointmentViewModel));
        }
Example #6
0
        public Error[] SetAppointment(AppointmentWithDoctorViewModel appointmentWithDoctorViewModel)
        {
            netricaClient = new HubServiceClient(new HubServiceClient.EndpointConfiguration());
            var r = netricaClient.SetAppointmentAsync(appointmentWithDoctorViewModel.IdSelectAppointment, int.Parse(appointmentWithDoctorViewModel.SelectLpu.IdLpu),
                                                      appointmentWithDoctorViewModel.Patient.IdPatient, null, null, null,
                                                      Startup.Configuration["GUID"], null);
            var errors = r.Result.ErrorList;

            netricaClient.CloseAsync();
            return(errors);
        }
        public async Task <IActionResult> Login(AuthorizationModel model)
        {
            var patient = autorizationPatientHelper.GetPatientInfo(model.PolisOMSNumber);

            if (patient != null)
            {
                HttpContext.Session.SetString("polisNPatient", patient.NPolis);
                HttpContext.Session.SetString("fioPatient", patient.FIO);
                HttpContext.Session.SetString("birthdayPatient", patient.Birthday.ToShortDateString());

                if (HttpContext.Session.GetString("nextPathKey") == "AppointmentWithDoctor")
                {
                    AppointmentWithDoctorViewModel viewModel = GetFilledAppointmentWithDoctorViewModel(patient, "SelectLpu");
                    return(View("~/Views/AppointmentWithDoctor/AppointmentWithDoctorSelectLpu.cshtml", viewModel));
                }
                else if (HttpContext.Session.GetString("nextPathKey") == "ServiceEvaluation")
                {
                    ServiceEvaluationViewModel viewModel = GetFilledServiceEvaluationViewModel();
                    return(View("~/Views/ServiceEvaluation/ServiceEvaluationSelectAppointment.cshtml", viewModel));
                }
                else if (HttpContext.Session.GetString("nextPathKey") == "ViewingAndCancelRecording")
                {
                    ViewingAndCancelRecordingViewModel viewModel = GetFilledViewingAndCancelRecordingViewModel();
                    return(View("~/Views/ViewingAndCancelRecording/ViewingAndCancelRecordingSelectRecording.cshtml", viewModel));
                }
                else if (HttpContext.Session.GetString("nextPathKey") == "AppointmentWithCOVID19")
                {
                    AppointmentWithDoctorViewModel viewModel = GetFilledAppointmentWithDoctorViewModel(patient, "SelectLpu");
                    return(View("~/Views/AppointmentWithDoctor/AppointmentWithDoctorSelectLpu.cshtml", viewModel));
                }
                //else if (HttpContext.Session.GetString("nextPathKey") == "RegistrMedicalExamination")
                //{

                //}
                else
                {
                    ErrorModel errorModel = new ErrorModel();
                    errorModel.IdError   = "nextPathKeyIsNULL";
                    errorModel.TextError = "Необходимая страница не найдена. Обратитесь к администратору системы";
                    return(View("~/Views/Home/ErrorModel.cshtml", errorModel));
                }
            }
            else
            {
                ViewBag.ErrorString = "*пациент по введенному номеру полиса не найден";
                return(View("~/Views/Authorization/Authorization.cshtml"));
            }
        }
        public IActionResult PaginationAppointmentWithDoctorSelectSpesiality(int page = 1)
        {
            int itemPageCount = 5; //количество элементов на странице
            int idSelectLpu   = int.Parse(HttpContext.Session.GetString("idSelectLpu"));
            List <NetricaTestService.Spesiality> spesiality = netricaHelper.GetSpesialityList(idSelectLpu);
            var count = spesiality.Count();
            var items = spesiality.Skip((page - 1) * itemPageCount).Take(itemPageCount).ToList();
            PaginationViewModel            pageViewModel        = new PaginationViewModel(count, page, itemPageCount);
            AppointmentWithDoctorViewModel appointmentViewModel = new AppointmentWithDoctorViewModel
            {
                PaginationViewModel = pageViewModel,
                SpesialitiesList    = items
            };

            return(PartialView("~/Views/Pagination/AppointmentWithDoctor/PaginationAppointmentWithDoctorSelectSpesiality.cshtml", appointmentViewModel));
        }
        public IActionResult AppointmentWithDoctorConfirmationAppointment(string selectTime, string idSelectAppointment, string roomNumber,
                                                                          string addressSelectLpu)
        {
            if (roomNumber == null)
            {
                roomNumber = " ";
            }
            HttpContext.Session.SetString("selectTime", selectTime);
            HttpContext.Session.SetString("idSelectAppointment", idSelectAppointment);
            HttpContext.Session.SetString("roomNumber", roomNumber);
            HttpContext.Session.SetString("addressSelectLpu", addressSelectLpu);

            AppointmentWithDoctorViewModel appointmentViewModel = GetFilledAppointmentWithDoctorViewModel(null, null);

            return(View("~/Views/AppointmentWithDoctor/AppointmentWithDoctorConfirmationAppointment.cshtml", appointmentViewModel));
        }
        public IActionResult AppointmentWithDoctorSelectLpu()
        {
            string polisNPatinet = HttpContext.Session.GetString("polisNPatient");
            var    patient       = autorizationPatientHelper.GetPatientInfo(polisNPatinet);

            if (patient != null)
            {
                AppointmentWithDoctorViewModel appointmentViewModel = GetFilledAppointmentWithDoctorViewModel(patient, "SelectLpu");
                return(View("~/Views/AppointmentWithDoctor/AppointmentWithDoctorSelectLpu.cshtml", appointmentViewModel));
            }
            else
            {
                ErrorModel error = new ErrorModel();
                error.IdError   = "fatal_error";
                error.TextError = "Что-то пошло не так. обратитесь к администратору";
                return(View("~/Views/Home/ErrorPage.cshtml", error));
            }
        }
        public IActionResult PaginationAppointmentWithDoctorSelectLpu(string patientPolN, int page = 1)
        {
            int itemPageCount = 5; //количество элементов на странице
            var patient       = autorizationPatientHelper.GetPatientInfo(patientPolN);
            var lpus          = attachmentServiceHelper.GetSelectableLpuList(patient);
            var count         = lpus.Count();

            lpus = lpus.Skip((page - 1) * itemPageCount).Take(itemPageCount).ToDictionary(d => d.Key, d => d.Value);
            PaginationViewModel            pageViewModel        = new PaginationViewModel(count, page, itemPageCount);
            AppointmentWithDoctorViewModel appointmentViewModel = new AppointmentWithDoctorViewModel
            {
                Patient = new PatientViewModel
                {
                    FIO      = patient.FIO,
                    Birthday = patient.Birthday,
                    NPolis   = patient.NPolis,
                    SexPat   = patient.SexPat
                },
                PaginationViewModel = pageViewModel,
                LpusList            = lpus
            };

            return(PartialView("~/Views/Pagination/AppointmentWithDoctor/PaginationAppointmentWithDoctorSelectLpu.cshtml", appointmentViewModel));
        }
Example #12
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);
        }
        public IActionResult AppointmentWithDoctorSelectSpesiality()
        {
            AppointmentWithDoctorViewModel appointmentViewModel = GetFilledAppointmentWithDoctorViewModel(null, "SelectSpesiality");

            return(View("~/Views/AppointmentWithDoctor/AppointmentWithDoctorSelectSpesiality.cshtml", appointmentViewModel));
        }