public List <District> GetDistrictList() { List <District> districts = new List <District>(); netricaClient = new HubServiceClient(new HubServiceClient.EndpointConfiguration()); var r = netricaClient.GetDistrictListAsync(Startup.Configuration["GUID"], null); if (r.Result.ErrorList.Length == 0) { for (int i = 0; i < r.Result.Districts.Count(); i++) { districts.Add(new District { DistrictName = r.Result.Districts[i].DistrictName, IdDistrict = r.Result.Districts[i].IdDistrict, Okato = r.Result.Districts[i]?.Okato }); } } else { districts = null; } netricaClient.CloseAsync(); return(districts); }
public List <Appointment> GetAvailableAppointment(int idLpu, string idDoc, string idPat, string selectDate) { List <Appointment> appointment = new List <Appointment>(); netricaClient = new HubServiceClient(new HubServiceClient.EndpointConfiguration()); var r = netricaClient.GetAvaibleAppointmentsAsync(idDoc, idLpu, idPat, DateTime.Today, DateTime.Today.AddDays(14), Startup.Configuration["GUID"], null); if (r.Result.ListAppointments != null) { for (int i = 0; i < r.Result.ListAppointments.Count(); i++) { if (r.Result.ListAppointments[i].VisitStart.ToShortDateString() == selectDate) { appointment.Add(new Appointment { Address = r.Result.ListAppointments[i].Address, IdAppointment = r.Result.ListAppointments[i].IdAppointment, Num = r.Result.ListAppointments[i].Num, Room = r.Result.ListAppointments[i].Room, VisitEnd = r.Result.ListAppointments[i].VisitEnd, VisitStart = r.Result.ListAppointments[i].VisitStart }); } } netricaClient.CloseAsync(); } else { appointment = null; } netricaClient.CloseAsync(); return(appointment); }
//public NextAction GetPatientAuthorization(AuthorizationModel model, int idLpu) //{ // Patient patient = new Patient(); // if (model.PolisOMSNumber != null) // { // patient.Polis_N = model.PolisOMSNumber; // } // patient.Birthday = DateTime.Parse(model.PatientBirthday); // string idPatient = null; // idPatient = GetIdPatient(patient, idLpu); // var result = netricaClient.CheckPatientAsync(patient, idLpu, Startup.Configuration["GUID"], null); // try // { // idPatient = result?.Result?.IdPat; // //TODO: не выводим ошибку на отдельную страницу, а выводим ошибку на главной "пациент не найден" // //if(result.Result.ErrorList.Length != 0) // //{ // // ErrorModel errorModel = new ErrorModel(); // // errorModel.IdError = "m1"; // // errorModel.TextError = result.Result.ErrorList[0].ErrorDescription; // // NextAction.path = "~/Views/Home/ErrorPage.cshtml"; // // NextAction.obj = errorModel; // // return NextAction; // //} // } // catch // { // } // if (!string.IsNullOrEmpty(idPatient)) // { // patient.IdPat = idPatient; // if (model.PatientName != null) // patient.Name = model.PatientName; // else // { // Yamed_Service.GetFIOPatientClient client = new Yamed_Service.GetFIOPatientClient(); // var res = client.GetFIOPatientAsync(model.PolisOMSNumber); // var FIO = res.Result; // patient.Name = FIO.ToString(); // } // patient.Birthday = DateTime.Parse(model.PatientBirthday); // } // netricaClient.CloseAsync(); // NextAction.obj = patient; // return NextAction; //} public List <Clinic> GetLpuList(int idDistrict) { List <Clinic> lpus = new List <Clinic>(); netricaClient = new HubServiceClient(new HubServiceClient.EndpointConfiguration()); var r = netricaClient.GetLPUListAsync(idDistrict, Startup.Configuration["GUID"], null); // 1 - idDistrict "Курск" for (int i = 0; i < r.Result.ListLPU.Count(); i++) { lpus.Add(new Clinic { Description = r.Result.ListLPU[i].Description, District = (int)r.Result.ListLPU[i].District, IdLPU = r.Result.ListLPU[i].IdLPU, IsActive = r.Result.ListLPU[i].IsActive, LPUFullName = r.Result.ListLPU[i].LPUFullName, LPUShortName = r.Result.ListLPU[i].LPUShortName, LPUType = r.Result.ListLPU[i].LPUType, Oid = r.Result.ListLPU[i].Oid }); } netricaClient.CloseAsync(); return(lpus); }
public Error[] CreateClaimForRefusalAsync(int idLpu, string idPat, string idAppointment) { netricaClient = new HubServiceClient(new HubServiceClient.EndpointConfiguration()); var r = netricaClient.CreateClaimForRefusalAsync(idLpu, idPat, idAppointment, Startup.Configuration["GUID"], null); var errors = r.Result.ErrorList; netricaClient.CloseAsync(); return(errors); }
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 LpuInfo GetLpuInfo(int idLpu) { LpuInfo lpuInfo = null; netricaClient = new HubServiceClient(new HubServiceClient.EndpointConfiguration()); var res = netricaClient.GetLPUInfoAsync(idLpu, Startup.Configuration["GUID"], null); if (res.Result.LpuCollection.Length != 0) { lpuInfo = res.Result.LpuCollection[0]; } netricaClient.CloseAsync(); return(lpuInfo); }
public string GetIdPatient(Patient patientModel, int idLpu) { string patientId = null; netricaClient = new HubServiceClient(new HubServiceClient.EndpointConfiguration()); var result = netricaClient.CheckPatientAsync(patientModel, idLpu, Startup.Configuration["GUID"], null); try { patientId = result.Result.IdPat; } catch { patientId = ""; } netricaClient.CloseAsync(); return(patientId); }
public List <AvialableDateModel> GetAvailableDates(int idLpu, string idDoc, string idPat, DateTime dayStart, DateTime dayEnd) { List <AvialableDateModel> dates = new List <AvialableDateModel>(); AvialableDateModel avialableDateModel; netricaClient = new HubServiceClient(new HubServiceClient.EndpointConfiguration()); var r = netricaClient.GetAvaibleAppointmentsAsync(idDoc, idLpu, idPat, dayStart, dayEnd, Startup.Configuration["GUID"], null); if (r.Result.ListAppointments != null) { avialableDateModel = new AvialableDateModel(r.Result.ListAppointments[0].VisitStart.Date); foreach (var avialableDateModel_1item in r.Result.ListAppointments) { if (avialableDateModel?.date.ToShortDateString() != avialableDateModel_1item.VisitStart.Date.ToShortDateString()) { avialableDateModel = new AvialableDateModel(avialableDateModel_1item.VisitStart.Date); } if (avialableDateModel.countFreeTicket == 0) { foreach (var avialableDateModel_2item in r.Result.ListAppointments) { if (avialableDateModel_2item.VisitStart.Date == avialableDateModel.date) { avialableDateModel.countFreeTicket++; } else { continue; } } dates.Add(avialableDateModel); } } netricaClient.CloseAsync(); } else { dates = null; } return(dates); }
public List <Doctor1> GetDoctorList(int idLpu, string idSpesiality) { List <Doctor1> doctors = new List <Doctor1>(); netricaClient = new HubServiceClient(new HubServiceClient.EndpointConfiguration()); var r = netricaClient.GetDoctorListAsync(idSpesiality, idLpu, null, Startup.Configuration["GUID"], null); // узнать на каком idLPU есть доктора if (r.Result.Docs != null) { for (int i = 0; i < r.Result.Docs.Count(); i++) { if (r.Result.Docs[i].CountFreeTicket != 0) { doctors.Add(new Doctor1 { AriaNumber = r.Result.Docs[i].AriaNumber, Comment = r.Result.Docs[i].Comment, CountFreeParticipantIE = r.Result.Docs[i].CountFreeParticipantIE, CountFreeTicket = r.Result.Docs[i].CountFreeTicket, IdDoc = r.Result.Docs[i].IdDoc, LastDate = r.Result.Docs[i].LastDate, Name = r.Result.Docs[i].Name, NearestDate = r.Result.Docs[i].NearestDate, Snils = r.Result.Docs[i].Snils }); } } netricaClient.CloseAsync(); doctors.Sort((x, y) => x.Name.CompareTo(y.Name)); // сортировка списка врачей по фамилии } else { doctors = null; } return(doctors); }
public List <Spesiality> GetSpesialityList(int idLpu) { List <Spesiality> speciality = new List <Spesiality>(); if (idLpu != 0) { netricaClient = new HubServiceClient(new HubServiceClient.EndpointConfiguration()); var r = netricaClient.GetSpesialityListAsync(idLpu, null, Startup.Configuration["GUID"], null); if (r.Result.ListSpesiality != null) { for (int i = 0; i < r.Result.ListSpesiality.Count(); i++) { if (r.Result.ListSpesiality[i].CountFreeTicket != 0) { speciality.Add(new Spesiality { CountFreeParticipantIE = r.Result.ListSpesiality[i].CountFreeParticipantIE, CountFreeTicket = r.Result.ListSpesiality[i].CountFreeTicket, FerIdSpesiality = r.Result.ListSpesiality[i].FerIdSpesiality, IdSpesiality = r.Result.ListSpesiality[i].IdSpesiality, LastDate = r.Result.ListSpesiality[i].LastDate, NameSpesiality = r.Result.ListSpesiality[i].NameSpesiality, NearestDate = r.Result.ListSpesiality[i].NearestDate }); } } } netricaClient.CloseAsync(); } else { speciality = null; } return(speciality); }