use of org.hl7.fhir.dstu3.model.Person in project openmrs-module-fhir2 by openmrs.
the class PersonFhirResourceProviderTest method searchPeople_shouldReturnMatchingBundleOfPeopleByName.
@Test
public void searchPeople_shouldReturnMatchingBundleOfPeopleByName() {
StringAndListParam nameParam = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(GIVEN_NAME)));
when(fhirPersonService.searchForPeople(argThat(is(nameParam)), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(person), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchPeople(nameParam, null, null, null, null, null, null, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.iterator().next().fhirType(), is(FhirConstants.PERSON));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.dstu3.model.Person in project openmrs-module-fhir2 by openmrs.
the class PersonFhirResourceProviderTest method searchForPeople_shouldReturnMatchingBundleOfPeopleByCity.
@Test
public void searchForPeople_shouldReturnMatchingBundleOfPeopleByCity() {
StringAndListParam cityParam = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(CITY)));
when(fhirPersonService.searchForPeople(isNull(), isNull(), isNull(), argThat(is(cityParam)), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(person), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchPeople(null, null, null, cityParam, null, null, null, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.iterator().next().fhirType(), is(FhirConstants.PERSON));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.dstu3.model.Person in project openmrs-module-fhir2 by openmrs.
the class PersonFhirResourceProviderTest method searchForPeople_shouldReturnMatchingBundleOfPeopleByPostalCode.
@Test
public void searchForPeople_shouldReturnMatchingBundleOfPeopleByPostalCode() {
StringAndListParam postalCodeParam = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(POSTAL_CODE)));
when(fhirPersonService.searchForPeople(isNull(), isNull(), isNull(), isNull(), isNull(), argThat(is(postalCodeParam)), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(person), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchPeople(null, null, null, null, null, postalCodeParam, null, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.iterator().next().fhirType(), is(FhirConstants.PERSON));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.dstu3.model.Person in project openmrs-module-fhir2 by openmrs.
the class PersonFhirResourceProviderTest method searchForPeople_shouldReturnMatchingBundleOfPeopleByUUID.
@Test
public void searchForPeople_shouldReturnMatchingBundleOfPeopleByUUID() {
TokenAndListParam uuid = new TokenAndListParam().addAnd(new TokenParam(PERSON_UUID));
when(fhirPersonService.searchForPeople(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), argThat(is(uuid)), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(person), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchPeople(null, null, null, null, null, null, null, uuid, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.iterator().next().fhirType(), is(FhirConstants.PERSON));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.dstu3.model.Person in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composePerson.
protected void composePerson(Complex parent, String parentType, String name, Person element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Person", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Person", "identifier", element.getIdentifier().get(i), i);
for (int i = 0; i < element.getName().size(); i++) composeHumanName(t, "Person", "name", element.getName().get(i), i);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "Person", "telecom", element.getTelecom().get(i), i);
if (element.hasGenderElement())
composeEnum(t, "Person", "gender", element.getGenderElement(), -1);
if (element.hasBirthDateElement())
composeDate(t, "Person", "birthDate", element.getBirthDateElement(), -1);
for (int i = 0; i < element.getAddress().size(); i++) composeAddress(t, "Person", "address", element.getAddress().get(i), i);
if (element.hasPhoto())
composeAttachment(t, "Person", "photo", element.getPhoto(), -1);
if (element.hasManagingOrganization())
composeReference(t, "Person", "managingOrganization", element.getManagingOrganization(), -1);
if (element.hasActiveElement())
composeBoolean(t, "Person", "active", element.getActiveElement(), -1);
for (int i = 0; i < element.getLink().size(); i++) composePersonPersonLinkComponent(t, "Person", "link", element.getLink().get(i), i);
}
Aggregations