Search in sources :

Example 6 with ReferenceParam

use of ca.uhn.fhir.rest.param.ReferenceParam in project ipf by oehf.

the class Iti67SearchParametersTest method setAuthor.

@Test
public void setAuthor() {
    var searchParameters = Iti67SearchParameters.builder().build();
    var param = new ReferenceAndListParam().addAnd(new ReferenceOrListParam().addOr(new ReferenceParam(Practitioner.SP_FAMILY, "family"))).addAnd(new ReferenceOrListParam().addOr(new ReferenceParam(Practitioner.SP_GIVEN, "given")));
    searchParameters.setAuthor(param);
    assertEquals("family", searchParameters.getAuthorFamilyName().getValue());
    assertEquals("given", searchParameters.getAuthorGivenName().getValue());
}
Also used : ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) ReferenceAndListParam(ca.uhn.fhir.rest.param.ReferenceAndListParam) ReferenceOrListParam(ca.uhn.fhir.rest.param.ReferenceOrListParam) Test(org.junit.jupiter.api.Test)

Example 7 with ReferenceParam

use of ca.uhn.fhir.rest.param.ReferenceParam in project openmrs-module-fhir2 by openmrs.

the class ConditionSearchQueryTest method searchForObsConditions_shouldSearchForConditionsByMultiplePatientGivenNameOr.

@Test
public void searchForObsConditions_shouldSearchForConditionsByMultiplePatientGivenNameOr() {
    ReferenceAndListParam referenceParam = new ReferenceAndListParam();
    ReferenceParam patient = new ReferenceParam();
    patient.setValue(PATIENT_GIVEN_NAME);
    patient.setChain(Patient.SP_GIVEN);
    ReferenceParam badPatient = new ReferenceParam();
    badPatient.setValue(PATIENT_WRONG_GIVEN_NAME);
    badPatient.setChain(Patient.SP_GIVEN);
    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()));
    assertEquals(resultList.size(), 2);
}
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 8 with ReferenceParam

use of ca.uhn.fhir.rest.param.ReferenceParam in project openmrs-module-fhir2 by openmrs.

the class ConditionSearchQueryTest method searchForObsConditions_shouldReturnConditionByPatientIdentifier.

@Test
public void searchForObsConditions_shouldReturnConditionByPatientIdentifier() {
    ReferenceParam patientReference = new ReferenceParam(Patient.SP_IDENTIFIER, PATIENT_IDENTIFIER);
    ReferenceAndListParam patientList = new ReferenceAndListParam();
    patientList.addAnd(new ReferenceOrListParam().addOr(patientReference));
    SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, patientList);
    IBundleProvider results = search(theParams);
    List<IBaseResource> resultList = get(results);
    assertThat(results, notNullValue());
    assertThat(resultList, not(empty()));
    assertEquals(resultList.size(), 2);
    assertThat(((org.hl7.fhir.r4.model.Condition) resultList.iterator().next()).getSubject().getReference(), endsWith(PATIENT_UUID));
}
Also used : Condition(org.hl7.fhir.r4.model.Condition) 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 9 with ReferenceParam

use of ca.uhn.fhir.rest.param.ReferenceParam in project openmrs-module-fhir2 by openmrs.

the class ConditionSearchQueryTest method searchForConditions_shouldReturnEmptyListOfConditionsByMultiplePatientFamilyNameAnd.

@Test
public void searchForConditions_shouldReturnEmptyListOfConditionsByMultiplePatientFamilyNameAnd() {
    ReferenceAndListParam referenceParam = new ReferenceAndListParam();
    ReferenceParam patient = new ReferenceParam();
    patient.setValue(PATIENT_FAMILY_NAME);
    patient.setChain(Patient.SP_FAMILY);
    ReferenceParam badPatient = new ReferenceParam();
    badPatient.setValue(PATIENT_WRONG_FAMILY_NAME);
    badPatient.setChain(Patient.SP_FAMILY);
    referenceParam.addValue(new ReferenceOrListParam().add(patient)).addAnd(new ReferenceOrListParam().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, empty());
}
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 10 with ReferenceParam

use of ca.uhn.fhir.rest.param.ReferenceParam in project openmrs-module-fhir2 by openmrs.

the class ConditionSearchQueryTest method searchForConditions_shouldReturnEmptyListOfConditionsByMultiplePatientNameAnd.

@Test
public void searchForConditions_shouldReturnEmptyListOfConditionsByMultiplePatientNameAnd() {
    ReferenceAndListParam referenceParam = new ReferenceAndListParam();
    ReferenceParam patient = new ReferenceParam();
    patient.setValue(PATIENT_PARTIAL_NAME);
    patient.setChain(Patient.SP_NAME);
    ReferenceParam badPatient = new ReferenceParam();
    badPatient.setValue(PATIENT_NOT_FOUND_NAME);
    badPatient.setChain(Patient.SP_NAME);
    referenceParam.addValue(new ReferenceOrListParam().add(patient)).addAnd(new ReferenceOrListParam().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, empty());
}
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)

Aggregations

ReferenceParam (ca.uhn.fhir.rest.param.ReferenceParam)468 ReferenceOrListParam (ca.uhn.fhir.rest.param.ReferenceOrListParam)460 Test (org.junit.Test)452 ReferenceAndListParam (ca.uhn.fhir.rest.param.ReferenceAndListParam)358 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)354 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)275 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)253 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)221 TokenParam (ca.uhn.fhir.rest.param.TokenParam)47 TokenAndListParam (ca.uhn.fhir.rest.param.TokenAndListParam)45 ServiceRequest (org.hl7.fhir.r4.model.ServiceRequest)37 NumberParam (ca.uhn.fhir.rest.param.NumberParam)33 MedicationRequest (org.hl7.fhir.r4.model.MedicationRequest)32 BaseFhirProvenanceResourceTest (org.openmrs.module.fhir2.providers.BaseFhirProvenanceResourceTest)28 DiagnosticReport (org.hl7.fhir.r4.model.DiagnosticReport)26 FhirDiagnosticReport (org.openmrs.module.fhir2.model.FhirDiagnosticReport)26 TokenOrListParam (ca.uhn.fhir.rest.param.TokenOrListParam)20 ArrayList (java.util.ArrayList)20 HashSet (java.util.HashSet)19 MockIBundleProvider (org.openmrs.module.fhir2.providers.r4.MockIBundleProvider)19