private GetPatientProfileDetailResponse GetPatientProfileDetail(GetPatientProfileDetailRequest request)
        {
            var profile = this.PersistenceContext.Load <PatientProfile>(request.PatientProfileRef);

            var patientProfileAssembler = new PatientProfileAssembler();
            var response = new GetPatientProfileDetailResponse();

            response.PatientProfile = patientProfileAssembler.CreatePatientProfileDetail(
                profile,
                this.PersistenceContext,
                request.IncludeAddresses,
                request.IncludeContactPersons,
                request.IncludeEmailAddresses,
                request.IncludeTelephoneNumbers,
                request.IncludeNotes,
                request.IncludeAttachments,
                request.IncludeAllergies);

            if (request.IncludeAlerts)
            {
                var alerts = new List <AlertNotification>();
                alerts.AddRange(AlertHelper.Instance.Test(profile.Patient, this.PersistenceContext));
                alerts.AddRange(AlertHelper.Instance.Test(profile, this.PersistenceContext));

                var alertAssembler = new AlertAssembler();
                response.PatientAlerts = CollectionUtils.Map <AlertNotification, AlertNotificationDetail>(alerts, alertAssembler.CreateAlertNotification);
            }

            return(response);
        }
        private void NotifyPerformedProcedureStepComplete()
        {
            var args = new WorkflowEventListener.PerformedProcedureStepCompletedArgs(
                this.Host.DesktopWindow,
                new WorkflowEventListener.PatientProfileInfo
            {
                FamilyName = _worklistItem.PatientName.FamilyName,
                GivenName  = _worklistItem.PatientName.GivenName,
                Id         = _worklistItem.Mrn.Id,
            },
                _worklistItem.AccessionNumber,
                _selectedMpps.ModalityProcedureSteps,
                (DateTime)_selectedMpps.EndTime);

            // need to contact the server to populate the DateOfBirth and Sex fields
            Platform.GetService <IBrowsePatientDataService>(service =>
            {
                var profileRequest = new GetPatientProfileDetailRequest {
                    PatientProfileRef = _worklistItem.PatientProfileRef
                };
                var profile = service.GetData(new GetDataRequest {
                    GetPatientProfileDetailRequest = profileRequest
                })
                              .GetPatientProfileDetailResponse.PatientProfile;

                args.PatientProfile.Sex       = profile.Sex.Value;
                args.PatientProfile.BirthDate = profile.DateOfBirth;
            });

            WorkflowEventPublisher.Instance.PerformedProcedureStepCompleted(args);
        }