comment fixes and removing dead code
This commit is contained in:
parent
228e75b501
commit
0dfc4597e8
|
@ -76,6 +76,7 @@ public class EmpiMatchLinkSvc {
|
|||
|
||||
private EmpiTransactionContext doEmpiUpdate(IAnyResource theResource, EmpiTransactionContext theEmpiTransactionContext) {
|
||||
CandidateList candidateList = myEmpiPersonFindingSvc.findPersonCandidates(theResource);
|
||||
|
||||
if (candidateList.isEmpty()) {
|
||||
handleEmpiWithNoCandidates(theResource, theEmpiTransactionContext);
|
||||
} else if (candidateList.exactlyOneMatch()) {
|
||||
|
@ -121,6 +122,7 @@ public class EmpiMatchLinkSvc {
|
|||
private void handleEmpiWithNoCandidates(IAnyResource theResource, EmpiTransactionContext theEmpiTransactionContext) {
|
||||
log(theEmpiTransactionContext, "There were no matched candidates for EMPI, creating a new Person.");
|
||||
IAnyResource newPerson = myPersonHelper.createPersonFromEmpiTarget(theResource);
|
||||
|
||||
myEmpiLinkSvc.updateLink(newPerson, theResource, EmpiMatchOutcome.NEW_PERSON_MATCH, EmpiLinkSourceEnum.AUTO, theEmpiTransactionContext);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,10 @@ public class EmpiPersonFindingSvc {
|
|||
|
||||
@Autowired
|
||||
private FindCandidateByEidSvc myFindCandidateByEidSvc;
|
||||
|
||||
@Autowired
|
||||
private FindCandidateByLinkSvc myFindCandidateByLinkSvc;
|
||||
|
||||
@Autowired
|
||||
private FindCandidateByScoreSvc myFindCandidateByScoreSvc;
|
||||
|
||||
|
@ -63,12 +65,14 @@ public class EmpiPersonFindingSvc {
|
|||
if (matchedPersonCandidates.isEmpty()) {
|
||||
matchedPersonCandidates = myFindCandidateByLinkSvc.findCandidates(theResource);
|
||||
}
|
||||
|
||||
if (matchedPersonCandidates.isEmpty()) {
|
||||
//OK, so we have not found any links in the EmpiLink table with us as a target. Next, let's find possible Patient/Practitioner
|
||||
//matches by following EMPI rules.
|
||||
|
||||
matchedPersonCandidates = myFindCandidateByScoreSvc.findCandidates(theResource);
|
||||
}
|
||||
|
||||
return matchedPersonCandidates;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,8 @@ public class FindCandidateByScoreSvc extends BaseCandidateFinder {
|
|||
List<MatchedPersonCandidate> retval = new ArrayList<>();
|
||||
|
||||
List<Long> personPidsToExclude = getNoMatchPersonPids(theTarget);
|
||||
|
||||
|
||||
List<MatchedTarget> matchedCandidates = myEmpiMatchFinderSvc.getMatchedTargets(myFhirContext.getResourceType(theTarget), theTarget);
|
||||
|
||||
//Convert all possible match targets to their equivalent Persons by looking up in the EmpiLink table,
|
||||
|
|
|
@ -21,14 +21,13 @@ package ca.uhn.fhir.empi.api;
|
|||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public interface IEmpiMatchFinderSvc {
|
||||
/**
|
||||
* Retrieve a list of possible Patient/Practitioner candidates for matching, based on the given {@link IBaseResource}
|
||||
* Retrieve a list of possible Patient/Practitioner candidates for matching, based on the given {@link IAnyResource}
|
||||
* Internally, performs all EMPI matching rules on the type of the resource.
|
||||
*
|
||||
* @param theResourceType the type of the resource.
|
||||
|
|
|
@ -214,7 +214,6 @@ public class PersonHelper {
|
|||
* @return the Person that is created.
|
||||
*/
|
||||
public IAnyResource createPersonFromEmpiTarget(IAnyResource theSourceResource) {
|
||||
String eidSystem = myEmpiConfig.getEmpiRules().getEnterpriseEIDSystem();
|
||||
List<CanonicalEID> eidsToApply = myEIDHelper.getExternalEid(theSourceResource);
|
||||
if (eidsToApply.isEmpty()) {
|
||||
eidsToApply.add(myEIDHelper.createHapiEid());
|
||||
|
@ -222,6 +221,7 @@ public class PersonHelper {
|
|||
switch (myFhirContext.getVersion().getVersion()) {
|
||||
case R4:
|
||||
Person personR4 = new Person();
|
||||
|
||||
personR4.setActive(true);
|
||||
eidsToApply.forEach(eid -> personR4.addIdentifier(eid.toR4()));
|
||||
personR4.getMeta().addTag((Coding) buildEmpiManagedTag());
|
||||
|
@ -396,7 +396,6 @@ public class PersonHelper {
|
|||
List<CanonicalEID> incomingTargetEid = myEIDHelper.getExternalEid(theEmpiTarget);
|
||||
List<CanonicalEID> personOfficialEid = myEIDHelper.getExternalEid(thePerson);
|
||||
|
||||
|
||||
if (!incomingTargetEid.isEmpty()) {
|
||||
if (personOfficialEid.isEmpty() || !myEmpiConfig.isPreventMultipleEids()) {
|
||||
log(theEmpiTransactionContext, "Incoming resource:" + theEmpiTarget.getIdElement().toUnqualifiedVersionless() + " + with EID " + incomingTargetEid.stream().map(CanonicalEID::toString).collect(Collectors.joining(",")) + " is applying this EIDs to its related Person, as this person does not yet have an external EID");
|
||||
|
|
Loading…
Reference in New Issue