use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class EncounterSearchQueryTest method searchForEncounters_shouldSearchForEncountersBySubjectGivenName.
@Test
public void searchForEncounters_shouldSearchForEncountersBySubjectGivenName() {
ReferenceAndListParam subjectReference = new ReferenceAndListParam();
ReferenceParam subject = new ReferenceParam();
subject.setValue(PATIENT_GIVEN_NAME);
subject.setChain(Patient.SP_GIVEN);
subjectReference.addValue(new ReferenceOrListParam().add(subject));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, subjectReference);
IBundleProvider results = search(theParams);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, not(empty()));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(((Encounter) resultList.iterator().next()).getId(), equalTo(ENCOUNTER_UUID));
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class EncounterSearchQueryTest method searchForEncounters_shouldSearchForEncountersBySubjectUuid.
@Test
public void searchForEncounters_shouldSearchForEncountersBySubjectUuid() {
ReferenceAndListParam subjectReference = new ReferenceAndListParam();
ReferenceParam subject = new ReferenceParam();
subject.setValue(PATIENT_UUID);
subjectReference.addValue(new ReferenceOrListParam().add(subject));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, subjectReference);
IBundleProvider results = search(theParams);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, not(empty()));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(((Encounter) resultList.iterator().next()).getSubject().getReferenceElement().getIdPart(), equalTo(PATIENT_UUID));
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class EncounterSearchQueryTest method searchForEncounters_shouldSearchForEncountersBySubjectFamilyName.
@Test
public void searchForEncounters_shouldSearchForEncountersBySubjectFamilyName() {
ReferenceAndListParam subjectReference = new ReferenceAndListParam();
ReferenceParam subject = new ReferenceParam();
subject.setValue(PATIENT_FAMILY_NAME);
subject.setChain(Patient.SP_FAMILY);
subjectReference.addValue(new ReferenceOrListParam().add(subject));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, subjectReference);
IBundleProvider results = search(theParams);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, not(empty()));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(((Encounter) resultList.iterator().next()).getId(), equalTo(ENCOUNTER_UUID));
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class EncounterSearchQueryTest method searchForEncounters_shouldSearchForEncountersBySubjectName.
@Test
public void searchForEncounters_shouldSearchForEncountersBySubjectName() {
ReferenceAndListParam subjectReference = new ReferenceAndListParam();
ReferenceParam subject = new ReferenceParam();
subject.setValue(PATIENT_FULL_NAME);
subject.setChain(Patient.SP_NAME);
subjectReference.addValue(new ReferenceOrListParam().add(subject));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, subjectReference);
IBundleProvider results = search(theParams);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, not(empty()));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(((Encounter) resultList.iterator().next()).getId(), equalTo(ENCOUNTER_UUID));
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class EncounterSearchQueryTest method searchForEncounters_shouldSearchForEncountersBySubjectIdentifier.
@Test
public void searchForEncounters_shouldSearchForEncountersBySubjectIdentifier() {
ReferenceAndListParam subjectReference = new ReferenceAndListParam();
ReferenceParam subject = new ReferenceParam();
subject.setValue(PATIENT_IDENTIFIER);
subject.setChain(Patient.SP_IDENTIFIER);
subjectReference.addValue(new ReferenceOrListParam().add(subject));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, subjectReference);
IBundleProvider results = search(theParams);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, not(empty()));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(((Encounter) resultList.iterator().next()).getSubject().getReference(), endsWith(PATIENT_UUID));
}
Aggregations