-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FM2-534: Searching should provide method to ensure consistent sort order #453
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
import ca.uhn.fhir.rest.param.DateRangeParam; | ||
import ca.uhn.fhir.rest.param.HasAndListParam; | ||
import ca.uhn.fhir.rest.param.ReferenceAndListParam; | ||
import ca.uhn.fhir.rest.param.ReferenceOrListParam; | ||
import ca.uhn.fhir.rest.param.TokenAndListParam; | ||
import ca.uhn.fhir.rest.server.IResourceProvider; | ||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; | ||
|
@@ -115,15 +116,15 @@ public OperationOutcome deleteEncounter(@IdParam @Nonnull IdType id) { | |
public IBundleProvider searchEncounter(@OptionalParam(name = Encounter.SP_DATE) DateRangeParam date, | ||
@OptionalParam(name = Encounter.SP_LOCATION, chainWhitelist = { "", Location.SP_ADDRESS_CITY, | ||
Location.SP_ADDRESS_STATE, Location.SP_ADDRESS_COUNTRY, | ||
Location.SP_ADDRESS_POSTALCODE }, targetTypes = Location.class) ReferenceAndListParam location, | ||
Location.SP_ADDRESS_POSTALCODE }, targetTypes = Location.class) ReferenceOrListParam location, | ||
@OptionalParam(name = Encounter.SP_PARTICIPANT, chainWhitelist = { "", Practitioner.SP_IDENTIFIER, | ||
Practitioner.SP_GIVEN, Practitioner.SP_FAMILY, | ||
Practitioner.SP_NAME }, targetTypes = Practitioner.class) ReferenceAndListParam participantReference, | ||
Practitioner.SP_NAME }, targetTypes = Practitioner.class) ReferenceOrListParam participantReference, | ||
@OptionalParam(name = Encounter.SP_SUBJECT, chainWhitelist = { "", Patient.SP_IDENTIFIER, Patient.SP_GIVEN, | ||
Patient.SP_FAMILY, | ||
Patient.SP_NAME }, targetTypes = Patient.class) ReferenceAndListParam subjectReference, | ||
Patient.SP_NAME }, targetTypes = Patient.class) ReferenceOrListParam subjectReference, | ||
@OptionalParam(name = Encounter.SP_PATIENT, chainWhitelist = { "", Patient.SP_IDENTIFIER, Patient.SP_GIVEN, | ||
Patient.SP_FAMILY, Patient.SP_NAME }, targetTypes = Patient.class) ReferenceAndListParam patientParam, | ||
Patient.SP_FAMILY, Patient.SP_NAME }, targetTypes = Patient.class) ReferenceOrListParam patientParam, | ||
@OptionalParam(name = Encounter.SP_TYPE) TokenAndListParam encounterType, | ||
@OptionalParam(name = Encounter.SP_RES_ID) TokenAndListParam id, | ||
@OptionalParam(name = "_tag") TokenAndListParam tag, | ||
|
@@ -148,7 +149,7 @@ public IBundleProvider searchEncounter(@OptionalParam(name = Encounter.SP_DATE) | |
} | ||
|
||
return new SearchQueryBundleProviderR3Wrapper(encounterService | ||
.searchForEncounters(new EncounterSearchParams(date, location, participantReference, subjectReference, | ||
.searchForEncounters(new EncounterSearchParams(date, new ReferenceAndListParam().addAnd(location), new ReferenceAndListParam().addAnd(participantReference), new ReferenceAndListParam().addAnd(subjectReference), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And the created a new And from the Or here, so that the other methods could remain the same... |
||
encounterType, tag, hasAndListParam, id, lastUpdated, sort, includes, revIncludes))); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -818,4 +818,21 @@ public void shouldThrow404WhenUpdatingNonExistingVisitAsJson() throws Exception | |
assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString())); | ||
assertThat(response.getContentAsString(), notNullValue()); | ||
} | ||
|
||
@Test | ||
public void shouldSearchForEncountersByPatientIdentifiersOr() throws Exception { | ||
String uri = String.format("/Encounter?subject.identifier=101-6&subject.name=Chebaskwony"); | ||
MockHttpServletResponse response = get(uri).accept(FhirMediaTypes.XML).go(); | ||
|
||
Bundle results = readBundleResponse(response); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is now failing and returning a "Multiple values detected for non-repeatable parameter 'subject'. This server is not configured to allow multiple (AND/OR) values for this param" message |
||
|
||
assertThat(results, notNullValue()); | ||
assertThat(results.getType(), equalTo(Bundle.BundleType.SEARCHSET)); | ||
assertThat(results.hasEntry(), is(true)); | ||
|
||
// TODO add testing | ||
} | ||
} | ||
|
||
|
||
//6TS-4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I changed all these from And to Or...