Search in sources :

Example 41 with Subject

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));
}
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 42 with Subject

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));
}
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 43 with Subject

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));
}
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 44 with Subject

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));
}
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 45 with Subject

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));
}
Also used : ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) Encounter(org.hl7.fhir.r4.model.Encounter) 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)

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