public static bool ShowReconciliationDialog(EntityRef targetProfile, IDesktopWindow window) { IList <ReconciliationCandidate> candidates = null; IList <PatientProfileSummary> reconciledProfiles = null; Platform.GetService <IPatientReconciliationService>( delegate(IPatientReconciliationService service) { ListPatientReconciliationMatchesResponse response = service.ListPatientReconciliationMatches(new ListPatientReconciliationMatchesRequest(targetProfile)); candidates = response.MatchCandidates; reconciledProfiles = response.ReconciledProfiles; }); if (candidates.Count > 0) { ReconciliationComponent component = new ReconciliationComponent(targetProfile, reconciledProfiles, candidates); ApplicationComponentExitCode exitCode = ApplicationComponent.LaunchAsDialog( window, component, SR.TitlePatientReconciliation); return(exitCode == ApplicationComponentExitCode.Accepted); } else { window.ShowMessageBox(SR.MessageNoReconciliationCandidate, MessageBoxActions.Ok); return(false); } }
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); }