public static List<Doctor> Select() { var result = new List<Doctor>(); result.Add(new Doctor(){Id = 0, Name = ""}); using(var client = new VistaService.s11PortTypeClient()) { var persons = client.getPersonnel(new getPersonnelInDoc() { orgStructureId = null, recursive = true, serverId = Settings.Default.SoapServerId }); foreach (var personInfo in persons) { result.Add(new Doctor() { Id = personInfo.id, Name = personInfo.lastName + " " + personInfo.firstName + " " + personInfo.patrName, Cabinet = personInfo.office }); } } result = result.OrderBy(x => x.Name).ToList(); return result; }
public void EnqueueTalon(bool print = false) { if(drdDoctor.SelectedItem != null && drdTicket.SelectedValue != "" && drdTicket.SelectedValue != DateTime.MinValue.ToString()) { var doctorId = int.Parse(drdDoctor.SelectedValue); var ticketTime = DateTime.Parse(drdTicket.SelectedValue); if(doctorId > 0 && Session["policy"] != null && Session["userName"] != null) { using (var client = new VistaService.s11PortTypeClient()) { var policy = (Policy) Session["policy"]; var pacient = client.findPatient(new findPatientInDoc() { lastName = policy.FAM, firstName = policy.IM, patrName = policy.OT, birthDate = policy.DR, serverId = Settings.Default.SoapServerId }); if (pacient != null && pacient.patientId.HasValue) { var queueInfos = client.getPatientQueue(new getPatientQueueInDoc() { patientId = pacient.patientId.Value, serverId = Settings.Default.SoapServerId }).Where(x => x.date == DateTime.Today); var duplicate = (from q in queueInfos where q.personId == doctorId select q).FirstOrDefault(); if (duplicate == null) { var opResult = client.enqueuePatient(new enqueuePatientInDoc() { date = DateTime.Today, note = Session["userName"].ToString(), personId = doctorId, patientId = pacient.patientId.Value, time = ticketTime, serverId = Settings.Default.SoapServerId }); if (opResult.success) { lblVistaTalon.ForeColor = Color.DarkViolet; lblVistaTalon.Text = string.Format("Пациент записан на прием {0:t}", ticketTime); var dataContext = (DataModelContainer) Application["dataContext"]; dataContext.RegisterEvent(Session["userName"].ToString(), (policy.S_POL + " " + policy.N_POL).Trim(), policy.FAM+" "+policy.IM+" "+policy.OT, "Запись на прием к врачу " + drdDoctor.SelectedItem.Text+" на "+drdTicket.SelectedItem.Text); Session["clientId"] = pacient.patientId; var reportName ="PrintTicketReport"; ReportViewer1.LocalReport.ReportPath = Server.MapPath(reportName + ".rdlc"); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", PrnTicketDataSource)); ReportViewer1.DataBind(); ReportViewer1.LocalReport.Refresh(); } else { lblVistaTalon.ForeColor = Color.Red; lblVistaTalon.Text = string.Format("Ошибка при записи на прием {0}", opResult.message); } } else { lblVistaTalon.ForeColor = Color.Red; lblVistaTalon.Text = string.Format("Повторная запись к этому доктору", duplicate.time); } } } } } }
public static List<DoctorTicket> Select(int doctorId) { var result = new List<DoctorTicket>(); using (var client = new VistaService.s11PortTypeClient()) { var workStatus = client.getWorkTimeAndStatus(new getWorkTimeAndStatusInDoc() { date = DateTime.Now, personId = doctorId, serverId = Settings.Default.SoapServerId }); if (workStatus.amb != null && workStatus.amb.tickets != null && workStatus.amb.tickets.Any()) { var tickets = workStatus.amb.tickets.Where(y => y.available && y.free && DateTime.Today.Add(y.time.TimeOfDay) > DateTime.Now).OrderBy(x => x.time); if(!tickets.Any()) result.Add(new DoctorTicket() { Id = 0, Name = "Свободных талонов нет" }); else { var i = 1; foreach (var ticket in tickets) { result.Add(new DoctorTicket() { Id = i++, TalonTime = ticket.time, Name = string.Format(@"{0:t}", ticket.time) }); } } } else { result.Add(new DoctorTicket() {Id = 0, Name = "Приема нет"}); } } return result; }