Exemple #1
0
        public void MapEventMilestoneToCompletedEvent(CompletedEvent completedEvent, EventMilestone eventMilestone, EventName targetEventName)
        {
            if (!(CompletedEvents.Any(@event => @event.Name.Code == targetEventName.Code)))
            {
                OnValidationFailed(new RuleViolation
                {
                    Message = string.Format("Event Milestone {0} on {1}, on pathway {2}, does not have target reference completed event {3}.", eventMilestone.Name.Description, completedEvent.Period.Name, completedEvent.Period.Pathway.PPINumber, targetEventName.Description),
                    Period  = completedEvent.Period
                });
            }

            eventMilestone.CompletedEvent = completedEvent;
        }
        public void ApplyTo(EventMilestone eventMilestone)
        {
            if (!eventMilestone.CompletedEvent.Cancer)
            {
                return;
            }

            var referralReceivedEvent =
                eventMilestone.CompletedEvent.Period.CompletedEvents.FirstOrDefault(completedEvent => completedEvent.Name.Code == EventCode.ReferralReceived);

            if (eventMilestone.Name.Code == EventCode.DiagnosticsTestResultAvailable ||
                eventMilestone.Name.Code == EventCode.AttendedOutpatientFirstAppointment)
            {
                if (referralReceivedEvent != null)
                {
                    eventMilestone.DateReferenceForTarget = referralReceivedEvent.EventDate;
                }
            }
        }