use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class ObservationSearchQueryTest method searchForObs_shouldSearchForObsByMultiplePatientIdentifierOr.
@Test
public void searchForObs_shouldSearchForObsByMultiplePatientIdentifierOr() {
ReferenceAndListParam referenceParam = new ReferenceAndListParam();
ReferenceParam patient = new ReferenceParam();
patient.setValue(PATIENT_IDENTIFIER);
patient.setChain(Patient.SP_IDENTIFIER);
ReferenceParam badPatient = new ReferenceParam();
badPatient.setValue(PATIENT_WRONG_IDENTIFIER);
badPatient.setChain(Patient.SP_IDENTIFIER);
referenceParam.addValue(new ReferenceOrListParam().add(patient).add(badPatient));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, referenceParam);
IBundleProvider results = search(theParams);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, not(empty()));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList, everyItem(hasProperty("subject", hasProperty("reference", endsWith(PATIENT_UUID)))));
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class ObservationSearchQueryTest method searchForObs_shouldReturnObsByPatientIdentifier.
@Test
public void searchForObs_shouldReturnObsByPatientIdentifier() {
ReferenceAndListParam patientReference = new ReferenceAndListParam().addAnd(new ReferenceOrListParam().add(new ReferenceParam().setValue(PATIENT_IDENTIFIER).setChain(Patient.SP_IDENTIFIER)));
SearchParameterMap theParams = new SearchParameterMap();
theParams.addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, patientReference);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
List<IBaseResource> resources = get(results);
assertThat(resources, not(empty()));
assertThat(resources, hasItem(hasProperty("id", equalTo(OBS_UUID))));
assertThat(resources, everyItem(hasProperty("subject", hasProperty("reference", endsWith(PATIENT_UUID)))));
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class ServiceRequestSearchQueryTest method searchForServiceRequests_shouldReturnServiceRequestsByPatientUuid.
@Test
public void searchForServiceRequests_shouldReturnServiceRequestsByPatientUuid() {
ReferenceAndListParam patientReference = new ReferenceAndListParam().addAnd(new ReferenceOrListParam().add(new ReferenceParam().setValue(PATIENT_UUID)));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, patientReference);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), equalTo(4));
List<ServiceRequest> resultList = get(results);
assertThat(resultList, not(empty()));
assertThat(resultList, hasSize(equalTo(4)));
assertThat(resultList, everyItem(hasProperty("subject", hasProperty("referenceElement", hasProperty("idPart", equalTo(PATIENT_UUID))))));
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class ServiceRequestSearchQueryTest method searchForServiceRequests_shouldReturnServiceRequestsByPatientFamilyName.
@Test
public void searchForServiceRequests_shouldReturnServiceRequestsByPatientFamilyName() {
ReferenceAndListParam patientReference = new ReferenceAndListParam().addAnd(new ReferenceOrListParam().add(new ReferenceParam().setValue(PATIENT_FAMILY_NAME).setChain(Patient.SP_FAMILY)));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, patientReference);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), equalTo(4));
List<ServiceRequest> resources = get(results);
assertThat(resources, not(empty()));
assertThat(resources, everyItem(hasProperty("subject", hasProperty("referenceElement", hasProperty("idPart", equalTo(PATIENT_UUID))))));
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class ServiceRequestSearchQueryTest method searchForServiceRequests_shouldSearchForServiceRequestsByMultiplePatientUuidOr.
@Test
public void searchForServiceRequests_shouldSearchForServiceRequestsByMultiplePatientUuidOr() {
ReferenceAndListParam patientReference = new ReferenceAndListParam().addAnd(new ReferenceOrListParam().add(new ReferenceParam().setValue(PATIENT_UUID)).add(new ReferenceParam().setValue(PATIENT_WRONG_UUID)));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, patientReference);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), equalTo(4));
List<ServiceRequest> resultList = get(results);
assertThat(resultList, not(empty()));
assertThat(resultList, hasSize(equalTo(4)));
assertThat(resultList, everyItem(hasProperty("subject", hasProperty("referenceElement", hasProperty("idPart", equalTo(PATIENT_UUID))))));
}
Aggregations