Uploaded image for project: 'FHIR Module v2'
  1. FHIR Module v2
  2. FM2-233

Add support for OR'ing Patient References

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Must
    • Resolution: Fixed
    • FM2 1.0.0
    • FM2 1.0.0
    • None

    Description

      The current implementation of handlePatientReference in BaseDao appears to always result in AND queries instead of both AND and OR queries as appropriate so that a request for:

      /Observation?subject.family=Foo,Bar
      

      Effectively results in a query with a WHERE clause like this:

      where pn.familyName = Foo and pn.familyName = Bar
      

      Obviously this is not what is intended and should be fixed.

      An example test (for the Encounter resource) that should pass:

      @Test
      public void searchForEncounters_shouldSearchForEncountersByMultipleFamilyNames() {
      	ReferenceAndListParam subjectReference = new ReferenceAndListParam();
      	subjectReference.addAnd(new ReferenceOrListParam()
      			.addOr(new ReferenceParam().setValue("Hornblower").setChain(Patient.SP_FAMILY))
      			.addOr(new ReferenceParam().setValue("Chebaskwony").setChain(Patient.SP_FAMILY)));
      
      	IBundleProvider results = search(new SearchParameterMap()
      			.addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, subjectReference));
      
      	assertThat(results, notNullValue());
      
      	List<IBaseResource> resultList = get(results);
      	assertThat(resultList, not(empty()));
      	assertThat(resultList, hasItem(hasProperty("subject", hasProperty("referenceElement",
      			hasProperty("idPart", equalTo("da7f524f-27ce-4bb2-86d6-6d1d05312bd5"))))));
      	assertThat(resultList, hasItem(hasProperty("subject", hasProperty("referenceElement",
      			hasProperty("idPart", equalTo("5946f880-b197-400b-9caa-a3c661d23041"))))));
      }
      

      Other similar tests should be added to other resources as appropriate.

      Gliffy Diagrams

        Attachments

          Activity

            People

              varung31 Varun Gupta
              ibacher Ian Bacher
              Ian Bacher Ian Bacher
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: