Merge branch 'gg_20201105-remove-person-references' of github.com:jamesagnew/hapi-fhir into gg_20201105-remove-person-references
This commit is contained in:
commit
a73d0421ba
|
@ -133,12 +133,12 @@ abstract public class BaseEmpiR4Test extends BaseJpaR4Test {
|
|||
|
||||
@Nonnull
|
||||
protected Person createUnmanagedPerson() {
|
||||
return createPerson(new Person(), false);
|
||||
return createSourceResourcePatient(new Person(), false);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
protected Person createPerson() {
|
||||
return createPerson(new Person(), true);
|
||||
protected Person createSourceResourcePatient() {
|
||||
return createSourceResourcePatient(new Patient(), true);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -147,17 +147,17 @@ abstract public class BaseEmpiR4Test extends BaseJpaR4Test {
|
|||
}
|
||||
|
||||
@Nonnull
|
||||
protected Person createPerson(Person thePerson) {
|
||||
return createPerson(thePerson, true);
|
||||
protected Person createSourceResourcePatient(Person thePerson) {
|
||||
return createSourceResourcePatient(thePerson, true);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
protected Person createPerson(Person thePerson, boolean theEmpiManaged) {
|
||||
protected Person createSourceResourcePatient(Patient theSourceResourcePatient, boolean theEmpiManaged) {
|
||||
if (theEmpiManaged) {
|
||||
thePerson.getMeta().addTag().setSystem(EmpiConstants.SYSTEM_EMPI_MANAGED).setCode(EmpiConstants.CODE_HAPI_EMPI_MANAGED);
|
||||
thePerson.setActive(true);
|
||||
theSourceResourcePatient.getMeta().addTag().setSystem(EmpiConstants.SYSTEM_EMPI_MANAGED).setCode(EmpiConstants.CODE_HAPI_EMPI_MANAGED);
|
||||
theSourceResourcePatient.setActive(true);
|
||||
}
|
||||
DaoMethodOutcome outcome = myPersonDao.create(thePerson);
|
||||
DaoMethodOutcome outcome = myPatientDao.create(theSourceResourcePatient);
|
||||
Person person = (Person) outcome.getResource();
|
||||
person.setId(outcome.getId());
|
||||
return person;
|
||||
|
@ -396,7 +396,7 @@ abstract public class BaseEmpiR4Test extends BaseJpaR4Test {
|
|||
|
||||
@Nonnull
|
||||
protected EmpiLink createResourcesAndBuildTestEmpiLink() {
|
||||
Person person = createPerson();
|
||||
Person person = createSourceResourcePatient();
|
||||
Patient patient = createPatient();
|
||||
|
||||
EmpiLink empiLink = myEmpiLinkDaoSvc.newEmpiLink();
|
||||
|
|
|
@ -32,9 +32,9 @@ public class EmpiProviderMergePersonsR4Test extends BaseProviderR4Test {
|
|||
super.before();
|
||||
super.loadEmpiSearchParameters();
|
||||
|
||||
myFromPerson = createPerson();
|
||||
myFromPerson = createSourceResourcePatient();
|
||||
myFromPersonId = new StringType(myFromPerson.getIdElement().getValue());
|
||||
myToPerson = createPerson();
|
||||
myToPerson = createSourceResourcePatient();
|
||||
myToPersonId = new StringType(myToPerson.getIdElement().getValue());
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,10 @@ public class EmpiProviderQueryLinkR4Test extends BaseLinkR4Test {
|
|||
|
||||
// Add a possible duplicate
|
||||
myLinkSource = new StringType(EmpiLinkSourceEnum.AUTO.name());
|
||||
Person person1 = createPerson();
|
||||
Person person1 = createSourceResourcePatient();
|
||||
myPerson1Id = new StringType(person1.getIdElement().toVersionless().getValue());
|
||||
Long person1Pid = myIdHelperService.getPidOrNull(person1);
|
||||
Person person2 = createPerson();
|
||||
Person person2 = createSourceResourcePatient();
|
||||
myPerson2Id = new StringType(person2.getIdElement().toVersionless().getValue());
|
||||
Long person2Pid = myIdHelperService.getPidOrNull(person2);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class EmpiLinkSvcTest extends BaseEmpiR4Test {
|
|||
@Test
|
||||
public void testCreateRemoveLink() {
|
||||
assertLinkCount(0);
|
||||
Person person = createPerson();
|
||||
Person person = createSourceResourcePatient();
|
||||
IdType personId = person.getIdElement().toUnqualifiedVersionless();
|
||||
assertEquals(0, person.getLink().size());
|
||||
Patient patient = createPatient();
|
||||
|
@ -71,8 +71,8 @@ public class EmpiLinkSvcTest extends BaseEmpiR4Test {
|
|||
@Test
|
||||
public void testPossibleDuplicate() {
|
||||
assertLinkCount(0);
|
||||
Person person = createPerson();
|
||||
Person target = createPerson();
|
||||
Person person = createSourceResourcePatient();
|
||||
Person target = createSourceResourcePatient();
|
||||
// TODO NOT VALID
|
||||
myEmpiLinkSvc.updateLink(person, target, EmpiMatchOutcome.POSSIBLE_DUPLICATE, EmpiLinkSourceEnum.AUTO, createContextForCreate("Person"));
|
||||
assertLinkCount(1);
|
||||
|
@ -81,8 +81,8 @@ public class EmpiLinkSvcTest extends BaseEmpiR4Test {
|
|||
@Test
|
||||
public void testNoMatchBlocksPossibleDuplicate() {
|
||||
assertLinkCount(0);
|
||||
Person person = createPerson();
|
||||
Person target = createPerson();
|
||||
Person person = createSourceResourcePatient();
|
||||
Person target = createSourceResourcePatient();
|
||||
|
||||
Long personPid = myIdHelperService.getPidOrNull(person);
|
||||
Long targetPid = myIdHelperService.getPidOrNull(target);
|
||||
|
@ -99,8 +99,8 @@ public class EmpiLinkSvcTest extends BaseEmpiR4Test {
|
|||
@Test
|
||||
public void testNoMatchBlocksPossibleDuplicateReversed() {
|
||||
assertLinkCount(0);
|
||||
Person person = createPerson();
|
||||
Person target = createPerson();
|
||||
Person person = createSourceResourcePatient();
|
||||
Person target = createSourceResourcePatient();
|
||||
|
||||
Long personPid = myIdHelperService.getPidOrNull(person);
|
||||
Long targetPid = myIdHelperService.getPidOrNull(target);
|
||||
|
@ -125,7 +125,7 @@ public class EmpiLinkSvcTest extends BaseEmpiR4Test {
|
|||
|
||||
@Test
|
||||
public void testManualEmpiLinksCannotBeModifiedBySystem() {
|
||||
Person person = createPerson(buildJanePerson());
|
||||
Person person = createSourceResourcePatient(buildJanePerson());
|
||||
Patient patient = createPatient(buildJanePatient());
|
||||
|
||||
myEmpiLinkSvc.updateLink(person, patient, EmpiMatchOutcome.NO_MATCH, EmpiLinkSourceEnum.MANUAL, createContextForCreate("Patient"));
|
||||
|
@ -139,7 +139,7 @@ public class EmpiLinkSvcTest extends BaseEmpiR4Test {
|
|||
|
||||
@Test
|
||||
public void testAutomaticallyAddedNO_MATCHEmpiLinksAreNotAllowed() {
|
||||
Person person = createPerson(buildJanePerson());
|
||||
Person person = createSourceResourcePatient(buildJanePerson());
|
||||
Patient patient = createPatient(buildJanePatient());
|
||||
|
||||
// Test: it should be impossible to have a AUTO NO_MATCH record. The only NO_MATCH records in the system must be MANUAL.
|
||||
|
@ -153,7 +153,7 @@ public class EmpiLinkSvcTest extends BaseEmpiR4Test {
|
|||
|
||||
@Test
|
||||
public void testSyncDoesNotSyncNoMatchLinks() {
|
||||
Person person = createPerson(buildJanePerson());
|
||||
Person person = createSourceResourcePatient(buildJanePerson());
|
||||
Patient patient1 = createPatient(buildJanePatient());
|
||||
Patient patient2 = createPatient(buildJanePatient());
|
||||
assertEquals(0, myEmpiLinkDao.count());
|
||||
|
|
|
@ -66,10 +66,10 @@ public class EmpiPersonMergerSvcTest extends BaseEmpiR4Test {
|
|||
public void before() {
|
||||
super.loadEmpiSearchParameters();
|
||||
|
||||
myFromPerson = createPerson();
|
||||
myFromPerson = createSourceResourcePatient();
|
||||
IdType fromPersonId = myFromPerson.getIdElement().toUnqualifiedVersionless();
|
||||
myFromPersonPid = myIdHelperService.getPidOrThrowException(fromPersonId);
|
||||
myToPerson = createPerson();
|
||||
myToPerson = createSourceResourcePatient();
|
||||
IdType toPersonId = myToPerson.getIdElement().toUnqualifiedVersionless();
|
||||
myToPersonPid = myIdHelperService.getPidOrThrowException(toPersonId);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.empi.svc;
|
|||
|
||||
import ca.uhn.fhir.jpa.empi.BaseEmpiR4Test;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.r4.model.Patient;
|
||||
import org.hl7.fhir.r4.model.Person;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -25,10 +26,10 @@ public class EmpiResourceDaoSvcTest extends BaseEmpiR4Test {
|
|||
|
||||
@Test
|
||||
public void testSearchPersonByEidExcludesInactive() {
|
||||
Person goodPerson = addExternalEID(createPerson(), TEST_EID);
|
||||
Person goodPerson = addExternalEID(createSourceResourcePatient(), TEST_EID);
|
||||
myPersonDao.update(goodPerson);
|
||||
|
||||
Person badPerson = addExternalEID(createPerson(), TEST_EID);
|
||||
Person badPerson = addExternalEID(createSourceResourcePatient(), TEST_EID);
|
||||
badPerson.setActive(false);
|
||||
myPersonDao.update(badPerson);
|
||||
|
||||
|
@ -39,10 +40,10 @@ public class EmpiResourceDaoSvcTest extends BaseEmpiR4Test {
|
|||
|
||||
@Test
|
||||
public void testSearchPersonByEidExcludesNonEmpiManaged() {
|
||||
Person goodPerson = addExternalEID(createPerson(), TEST_EID);
|
||||
Person goodPerson = addExternalEID(createSourceResourcePatient(), TEST_EID);
|
||||
myPersonDao.update(goodPerson);
|
||||
|
||||
Person badPerson = addExternalEID(createPerson(new Person(), false), TEST_EID);
|
||||
Person badPerson = addExternalEID(createSourceResourcePatient(new Patient(), false), TEST_EID);
|
||||
myPersonDao.update(badPerson);
|
||||
|
||||
Optional<IAnyResource> foundPerson = myResourceDaoSvc.searchSourceResourceByEID(TEST_EID, "Person");
|
||||
|
|
Loading…
Reference in New Issue