Search in sources :

Example 46 with Subject

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)))));
}
Also used : ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) ReferenceAndListParam(ca.uhn.fhir.rest.param.ReferenceAndListParam) IBundleProvider(ca.uhn.fhir.rest.api.server.IBundleProvider) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) ReferenceOrListParam(ca.uhn.fhir.rest.param.ReferenceOrListParam) SearchParameterMap(org.openmrs.module.fhir2.api.search.param.SearchParameterMap) BaseModuleContextSensitiveTest(org.openmrs.test.BaseModuleContextSensitiveTest) Test(org.junit.Test)

Example 47 with Subject

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)))));
}
Also used : ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) ReferenceAndListParam(ca.uhn.fhir.rest.param.ReferenceAndListParam) IBundleProvider(ca.uhn.fhir.rest.api.server.IBundleProvider) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) ReferenceOrListParam(ca.uhn.fhir.rest.param.ReferenceOrListParam) SearchParameterMap(org.openmrs.module.fhir2.api.search.param.SearchParameterMap) BaseModuleContextSensitiveTest(org.openmrs.test.BaseModuleContextSensitiveTest) Test(org.junit.Test)

Example 48 with Subject

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))))));
}
Also used : ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) ReferenceAndListParam(ca.uhn.fhir.rest.param.ReferenceAndListParam) IBundleProvider(ca.uhn.fhir.rest.api.server.IBundleProvider) ReferenceOrListParam(ca.uhn.fhir.rest.param.ReferenceOrListParam) ServiceRequest(org.hl7.fhir.r4.model.ServiceRequest) SearchParameterMap(org.openmrs.module.fhir2.api.search.param.SearchParameterMap) BaseModuleContextSensitiveTest(org.openmrs.test.BaseModuleContextSensitiveTest) Test(org.junit.Test)

Example 49 with Subject

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))))));
}
Also used : ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) ReferenceAndListParam(ca.uhn.fhir.rest.param.ReferenceAndListParam) IBundleProvider(ca.uhn.fhir.rest.api.server.IBundleProvider) ReferenceOrListParam(ca.uhn.fhir.rest.param.ReferenceOrListParam) ServiceRequest(org.hl7.fhir.r4.model.ServiceRequest) SearchParameterMap(org.openmrs.module.fhir2.api.search.param.SearchParameterMap) BaseModuleContextSensitiveTest(org.openmrs.test.BaseModuleContextSensitiveTest) Test(org.junit.Test)

Example 50 with Subject

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))))));
}
Also used : ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) ReferenceAndListParam(ca.uhn.fhir.rest.param.ReferenceAndListParam) IBundleProvider(ca.uhn.fhir.rest.api.server.IBundleProvider) ReferenceOrListParam(ca.uhn.fhir.rest.param.ReferenceOrListParam) ServiceRequest(org.hl7.fhir.r4.model.ServiceRequest) SearchParameterMap(org.openmrs.module.fhir2.api.search.param.SearchParameterMap) BaseModuleContextSensitiveTest(org.openmrs.test.BaseModuleContextSensitiveTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)124 Test (org.junit.jupiter.api.Test)68 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)64 Bundle (org.hl7.fhir.r4.model.Bundle)56 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)54 Parameters (org.hl7.fhir.r4.model.Parameters)46 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)43 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)42 StringType (org.hl7.fhir.r4.model.StringType)41 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)39 Observation (org.hl7.fhir.r4.model.Observation)38 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)37 Bundle (org.hl7.fhir.dstu3.model.Bundle)35 ReferenceParam (ca.uhn.fhir.rest.param.ReferenceParam)32 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)32 ReferenceAndListParam (ca.uhn.fhir.rest.param.ReferenceAndListParam)31 ReferenceOrListParam (ca.uhn.fhir.rest.param.ReferenceOrListParam)31 Patient (org.hl7.fhir.r4.model.Patient)30 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)30 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)29