public ListPatientReconciliationMatchesResponse ListPatientReconciliationMatches(ListPatientReconciliationMatchesRequest request) { var targetProfile = this.PersistenceContext.GetBroker<IPatientProfileBroker>().Load(request.PatientProfileRef); var strategy = (IPatientReconciliationStrategy)(new PatientReconciliationStrategyExtensionPoint()).CreateExtension(); var matches = strategy.FindReconciliationMatches(targetProfile, this.PersistenceContext); var profileAssembler = new PatientProfileAssembler(); var rcAssembler = new ReconciliationCandidateAssembler(); var response = new ListPatientReconciliationMatchesResponse { ReconciledProfiles = CollectionUtils.Map<PatientProfile, PatientProfileSummary, List<PatientProfileSummary>>( targetProfile.Patient.Profiles, profile => profileAssembler.CreatePatientProfileSummary(profile, this.PersistenceContext)), MatchCandidates = CollectionUtils.Map<PatientProfileMatch, ReconciliationCandidate, List<ReconciliationCandidate>>( matches, match => rcAssembler.CreateReconciliationCandidate(match, this.PersistenceContext)) }; return response; }
public ListPatientReconciliationMatchesResponse ListPatientReconciliationMatches(ListPatientReconciliationMatchesRequest request) { var targetProfile = this.PersistenceContext.GetBroker <IPatientProfileBroker>().Load(request.PatientProfileRef); var strategy = (IPatientReconciliationStrategy)(new PatientReconciliationStrategyExtensionPoint()).CreateExtension(); var matches = strategy.FindReconciliationMatches(targetProfile, this.PersistenceContext); var profileAssembler = new PatientProfileAssembler(); var rcAssembler = new ReconciliationCandidateAssembler(); var response = new ListPatientReconciliationMatchesResponse { ReconciledProfiles = CollectionUtils.Map <PatientProfile, PatientProfileSummary, List <PatientProfileSummary> >( targetProfile.Patient.Profiles, profile => profileAssembler.CreatePatientProfileSummary(profile, this.PersistenceContext)), MatchCandidates = CollectionUtils.Map <PatientProfileMatch, ReconciliationCandidate, List <ReconciliationCandidate> >( matches, match => rcAssembler.CreateReconciliationCandidate(match, this.PersistenceContext)) }; return(response); }