Fixed code for use case #3 test case
This commit is contained in:
parent
5d6ede660b
commit
ac3b1e3e17
|
@ -22,11 +22,13 @@ package ca.uhn.fhir.jpa.empi.svc;
|
|||
|
||||
import ca.uhn.fhir.empi.api.EmpiConstants;
|
||||
import ca.uhn.fhir.empi.api.IEmpiSettings;
|
||||
import ca.uhn.fhir.empi.util.EIDHelper;
|
||||
import ca.uhn.fhir.empi.util.EmpiUtil;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
|
@ -70,7 +72,9 @@ public class EmpiResourceDaoSvc {
|
|||
SearchParameterMap map = new SearchParameterMap();
|
||||
map.setLoadSynchronous(true);
|
||||
map.add("identifier", new TokenParam(myEmpiConfig.getEmpiRules().getEnterpriseEIDSystem(), theEid));
|
||||
map.add("active", new TokenParam("true"));
|
||||
// TODO NG - During person dedup do we set this to false? We might be setting a person to inactive...
|
||||
// map.add("active", new TokenParam("true"));
|
||||
map.add("_tag", new TokenParam(EmpiConstants.SYSTEM_EMPI_MANAGED, EmpiConstants.CODE_HAPI_EMPI_MANAGED));
|
||||
|
||||
IFhirResourceDao resourceDao = myDaoRegistry.getResourceDao(theResourceType);
|
||||
IBundleProvider search = resourceDao.search(map);
|
||||
|
|
|
@ -225,24 +225,28 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
|||
Patient patient1 = addExternalEID(buildJanePatient(), "uniqueid");
|
||||
createPatientAndUpdateLinks(patient1);
|
||||
|
||||
// state is now > Patient/ID.JANE.123[name=jane & EID = uniqueid] <-- EMPI Link -- Patient/[name=jane & EDI = uniqueid & EMPI_MANAGED = true]
|
||||
IBundleProvider bundle = myPatientDao.search(new SearchParameterMap());
|
||||
List<IBaseResource> resources = bundle.getResources(0, bundle.size());
|
||||
resources.forEach(r -> {
|
||||
print(r);
|
||||
assertFalse(myEidHelper.getExternalEid(r).isEmpty());
|
||||
});
|
||||
assertEquals(2, resources.size());
|
||||
{
|
||||
// state is now > Patient/ID.JANE.123[name=jane & EID = uniqueid] <-- EMPI Link -- Patient/[name=jane & EDI = uniqueid & EMPI_MANAGED = true]
|
||||
IBundleProvider bundle = myPatientDao.search(new SearchParameterMap());
|
||||
List<IBaseResource> resources = bundle.getResources(0, bundle.size());
|
||||
resources.forEach(r -> {
|
||||
print(r);
|
||||
assertFalse(myEidHelper.getExternalEid(r).isEmpty());
|
||||
});
|
||||
assertEquals(2, resources.size());
|
||||
|
||||
IBaseResource testPatient1 = resources.get(0);
|
||||
IBaseResource testPatient2 = resources.get(1);
|
||||
IBaseResource testPatient1 = resources.get(0);
|
||||
IBaseResource testPatient2 = resources.get(1);
|
||||
|
||||
assertThat((Patient) testPatient1, is(sameSourceResourceAs((Patient) testPatient2)));
|
||||
assertThat((Patient) testPatient1, is(sameSourceResourceAs((Patient) testPatient2)));
|
||||
|
||||
Optional<EmpiLink> empiLinkByTarget = myEmpiLinkDaoSvc.findEmpiLinkByTarget(patient1);
|
||||
assertTrue(empiLinkByTarget.isPresent());
|
||||
|
||||
Patient patient2 = addExternalEID(buildPaulPatient(), "uniqueid");
|
||||
Optional<EmpiLink> empiLinkByTarget = myEmpiLinkDaoSvc.findEmpiLinkByTarget(patient1);
|
||||
assertTrue(empiLinkByTarget.isPresent());
|
||||
System.out.println(empiLinkByTarget.get());
|
||||
}
|
||||
Patient patient2 = buildPaulPatient();
|
||||
patient2.setActive(true);
|
||||
patient2 = addExternalEID(patient2, "uniqueid");
|
||||
createPatientAndUpdateLinks(patient2);
|
||||
// state should be > Patient/ID.JANE.123[name=jane & EID = uniqueid] <--> Patient/[name=jane & EDI = uniqueid] <--> Patient/[name=paul & EDI = uniqueid]
|
||||
IBundleProvider search = myPatientDao.search(new SearchParameterMap());
|
||||
|
|
Loading…
Reference in New Issue