public void GetPreviousStepStatistic()
        {
            EventStorePatientStepSchedulingService eventStepService = SetupEventStepService();
            StepPreviousStatisticDTO stepStatistic = eventStepService.PreviousSchedulingStepStatistic();

            Assert.Equal(4, stepStatistic.TotalNumberOfPrevious);
        }
        public void GetNumberOfPreviousOnAppointmentStep()
        {
            EventStorePatientStepSchedulingService eventStepService = SetupEventStepService();
            StepPreviousStatisticDTO stepStatistic = eventStepService.PreviousSchedulingStepStatistic();

            Assert.Equal(1, stepStatistic.NumberOfPreviousOnAppointmentStep);
        }
        public void GetMostReturnedStep()
        {
            EventStorePatientStepSchedulingService eventStepService = SetupEventStepService();
            StepPreviousStatisticDTO stepStatistic = eventStepService.PreviousSchedulingStepStatistic();

            Assert.Equal(EventStep.Doctor, stepStatistic.MostReturnedStep);
        }
Esempio n. 4
0
        public StepPreviousStatisticDTO PreviousSchedulingStepStatistic()
        {
            StepPreviousStatisticDTO previousSchedulingStepStatistic = new StepPreviousStatisticDTO();

            try
            {
                IEnumerable <PatientStepSchedulingEvent> closedScheduling = _patientSchedulingEventRepository.GetAll
                                                                                (e => e.ClickEvent == ClickEvent.Previous);

                previousSchedulingStepStatistic.NumberOfPreviousOnSpecialtyStep   = closedScheduling.Where(e => e.EventStep == EventStep.Specialty).Count();
                previousSchedulingStepStatistic.NumberOfPrevoiusOnDoctorStep      = closedScheduling.Where(e => e.EventStep == EventStep.Doctor).Count();
                previousSchedulingStepStatistic.NumberOfPreviousOnAppointmentStep = closedScheduling.Where(e => e.EventStep == EventStep.Appointment).Count();
                previousSchedulingStepStatistic.TotalNumberOfPrevious             = closedScheduling.Count();

                EventStep mostReturnedStep = EventStep.Specialty;
                int       maxNumber        = previousSchedulingStepStatistic.NumberOfPreviousOnSpecialtyStep;

                if (previousSchedulingStepStatistic.NumberOfPrevoiusOnDoctorStep > maxNumber)
                {
                    mostReturnedStep = EventStep.Doctor;
                    maxNumber        = previousSchedulingStepStatistic.NumberOfPrevoiusOnDoctorStep;
                }
                if (previousSchedulingStepStatistic.NumberOfPreviousOnAppointmentStep > maxNumber)
                {
                    mostReturnedStep = EventStep.Appointment;
                    maxNumber        = previousSchedulingStepStatistic.NumberOfPreviousOnAppointmentStep;
                }
                previousSchedulingStepStatistic.MostReturnedStep = mostReturnedStep;
            }
            catch (Exception)
            {
                return(new StepPreviousStatisticDTO());
            }

            return(previousSchedulingStepStatistic);
        }