Пример #1
0
 public static Api.Repository.Appointment ToRepositoryAppointment(Appointment m)
 {
     return(new Api.Repository.Appointment
     {
         ChewsiId = m.ChewsiId,
         SubscriberFirstName = m.PatientName,
         DateTime = m.Date,
         State = AppointmentState.TreatmentCompleted,
         Id = Random.Next(10000, 100000).ToString(),
         PatientId = m.PatientId,
         StatusText = Random.Next(10000, 100000).ToString(),
         ProviderId = m.ProviderId,
         PatientName = m.PatientName
     });
 }
Пример #2
0
        public override List <Appointment> GetAppointments(DateTime date)
        {
            Initialize();

            // Find carrier by name
            var carrierInfo = _proxy.CarriersGetSimilarNames(InsuranceCarrierName).FirstOrDefault(m => m.CarrierName == InsuranceCarrierName);

            if (carrierInfo != null)
            {
                var planNums = _proxy.InsPlansGetPlanNumsByCarrierNum(carrierInfo.CarrierNum);

                // Find appointments by insurance plan, dates, status
                var dateRange    = GetTimeRangeForToday(date);
                var appointments = _proxy.GetAppointmentsStartingWithinPeriod(dateRange.Item1, dateRange.Item2);

                var filtered     = appointments.Where(m => m.AptStatus == "Complete" && (planNums.Contains(m.InsPlan1) || planNums.Contains(m.InsPlan2))).ToList();
                var patientIds   = filtered.Select(m => m.PatNum).Distinct();
                var patientInfos = patientIds.ToDictionary(m => m, GetPatientInfo);

                return(new List <Appointment>(filtered
                                              .Select(m =>
                {
                    var patient = patientInfos[m.PatNum];
                    var appointment = new Appointment
                    {
                        Id = m.AptNum.ToString(),
                        PmsModifiedDate = m.DateTStamp,
                        Date = m.AptDateTime,
                        ChewsiId = patient.ChewsiId,
                        PatientId = m.PatNum.ToString(),
                        PatientName = $"{patient.PatientLastName}, {patient.PatientFirstName}",
                        ProviderId = m.ProvNum.ToString()
                    };
                    return appointment;
                })
                                              .ToList()));
            }
            return(new List <Appointment>());
        }