コード例 #1
0
 private IEnumerable <CompletedEvent> GetOrderedCompletedEventsByDirectionAndPagination <TKey>(IEnumerable <CompletedEvent> completedEvents, ListInputInfo listInputInfo, Func <CompletedEvent, TKey> orderCriteria)
 {
     return(listInputInfo.OrderDirection == OrderDirection.Ascending
         ? OrderCompletedEventsAscendingWithPagination(completedEvents, listInputInfo, orderCriteria)
         : OrderCompletedEventsDescendingWithPagination(completedEvents, listInputInfo, orderCriteria));
 }
コード例 #2
0
        public PeriodBreachesInfo GetPeriodBreachesReport(RoleData role, int weeksToBreach,
                                                          BreachFilterInputInfo filterInputInfo, ListInputInfo listInputInfo)
        {
            var result = _reportApplicationService.GetPeriodBreachesReport(weeksToBreach, filterInputInfo, listInputInfo);

            if (role.Permissions.All(permission => permission.Id != PermissionId.Patient))
            {
                foreach (var periodInfo in result.PeriodsInfo)
                {
                    periodInfo.PatientNHSNumber = "Not Authorized";
                    periodInfo.PatientName      = "Not Authorized";
                }
            }

            return(result);
        }
コード例 #3
0
        public PeriodBreachesInfo GetPeriodBreachesReport(int weeksToBreach, BreachFilterInputInfo filterInputInfo, ListInputInfo listInputInfo)
        {
            var completedEvents = _completedEventRepository
                                  .Get(_periodBreachesReportService.GetCriteria(filterInputInfo),
                                       filterInputInfo.PeriodType,
                                       null,
                                       e => e.Name,
                                       e => e.Period.CompletedEvents,
                                       e => e.Period.Pathway.Patient,
                                       e => e.Clinician.Specialty)
                                  .Where(_periodBreachesReportService.GetFilter(weeksToBreach))
                                  .ToList();

            var totalNumberOfPeriodBreaches = completedEvents.Count;

            completedEvents = _periodBreachesReportService.ApplyPaginationAndOrdering(completedEvents, listInputInfo).ToList();

            var periodsInfoList = (
                from completedEvent in completedEvents
                let postBreachDays = completedEvent.Period.GetDaysRemainingAt(_clock.Today)
                                     let daysRemaining = completedEvent.Period.GetDaysRemainingAt(_clock.Today)
                                                         select new PeriodBreachInfo
            {
                EventDescription = completedEvent.Name.Description,
                PatientNHSNumber = completedEvent.Period.Pathway.Patient.NHSNumber,
                PatientName = completedEvent.Period.Pathway.Patient.Name,
                PPINumber = completedEvent.Period.Pathway.PPINumber,
                Clinician = completedEvent.Clinician.Name,
                Specialty = completedEvent.Clinician.Specialty.Name,
                PostBreachDays = Math.Abs(postBreachDays),
                DaysInPeriod = completedEvent.Period.GetDaysSpentAt(_clock.Today),
                DaysRemainingInPeriod = daysRemaining < 0 ? 0 : daysRemaining,
                PeriodType = completedEvent.Period.GetType().Name,
                EventType = completedEvent.GetType().Name,
                PeriodId = completedEvent.Period.Id
            }).ToArray();

            return(new PeriodBreachesInfo
            {
                PeriodsInfo = periodsInfoList,
                TotalNumberOfPeriodBreaches = totalNumberOfPeriodBreaches
            });
        }
コード例 #4
0
        public EventBreachesInfo GetEventBreachesReport(RoleData role, int daysToBreach, BreachFilterInputInfo filterInputInfo, ListInputInfo listInputInfo)
        {
            var result = _reportApplicationService.GetEventBreachesReport(daysToBreach, filterInputInfo, listInputInfo);

            if (role.Permissions.All(permission => permission.Id != PermissionId.Patient))
            {
                foreach (var eventBreachInfo in result.EventBreaches)
                {
                    eventBreachInfo.PatientNHSNumber = "Not Authorized";
                    eventBreachInfo.PatientName      = "Not Authorized";
                }
            }

            return(result);
        }
コード例 #5
0
        public EventBreachesInfo GetEventBreachesReport(int daysToBreach, BreachFilterInputInfo filterInputInfo, ListInputInfo listInputInfo)
        {
            var eventMilestones = _eventMilestoneRepository
                                  .Get(_eventBreachesReportService.GetCriteria(filterInputInfo),
                                       filterInputInfo.PeriodType,
                                       e => e.Name,
                                       e => e.CompletedEvent.Period.CompletedEvents.Select(completedEvent => completedEvent.Name),
                                       e => e.CompletedEvent.Period.Pathway.Patient,
                                       e => e.CompletedEvent.Clinician.Specialty)
                                  .Where(_eventBreachesReportService.GetFilter(daysToBreach, filterInputInfo.AdvancementOrDelay)).ToList();

            var totalNumberOfEventBreaches = eventMilestones.Count;

            eventMilestones = _eventBreachesReportService.ApplyPaginationAndOrdering(eventMilestones, listInputInfo).ToList();

            var eventBreachesList = (
                from eventMilestone in eventMilestones
                let postBreachDays = eventMilestone.GetDaysToBreachAt(_clock.Today)
                                     let daysRemaining = eventMilestone.CompletedEvent.Period.GetDaysRemainingAt(_clock.Today)
                                                         where postBreachDays != null
                                                         select new EventBreachInfo
            {
                EventDescription = eventMilestone.Name.Description,
                PatientNHSNumber = eventMilestone.CompletedEvent.Period.Pathway.Patient.NHSNumber,
                PatientName = eventMilestone.CompletedEvent.Period.Pathway.Patient.Name,
                PPINumber = eventMilestone.CompletedEvent.Period.Pathway.PPINumber,
                Clinician = eventMilestone.CompletedEvent.Clinician.Name,
                Specialty = eventMilestone.CompletedEvent.Clinician.Specialty.Name,
                PostBreachDays = Math.Abs((int)postBreachDays),
                DaysInPeriod = eventMilestone.CompletedEvent.Period.GetDaysSpentAt(_clock.Today),
                DaysRemainingInPeriod = daysRemaining < 0 ? 0 : daysRemaining,
                DelayOrAdvancementDays = eventMilestone.CompletedEvent.Period.GetDelayOrAdvancementDays(_clock.Today),
                PeriodType = eventMilestone.CompletedEvent.Period.GetType().Name,
                EventType = eventMilestone.CompletedEvent.GetType().Name,
                PeriodId = eventMilestone.CompletedEvent.Period.Id
            }).ToArray();

            return(new EventBreachesInfo
            {
                EventBreaches = eventBreachesList,
                TotalNumberOfEventBreaches = totalNumberOfEventBreaches
            });
        }