This commit is contained in:
Tadgh 2020-03-09 16:05:41 -07:00
parent e38ec3e3dd
commit c3ceffbd72
2 changed files with 17 additions and 0 deletions

View File

@ -809,11 +809,17 @@ class PredicateBuilderReference extends BasePredicateBuilder {
}
assert parameterName != null;
//Ensure that the name of the search param
// (e.g. the `code` in Patient?_has:Observation:subject:code=sys|val)
// exists on the target resource type.
RuntimeSearchParam owningParameterDef = mySearchParamRegistry.getSearchParamByName(targetResourceDefinition, paramName);
if (owningParameterDef == null) {
throw new InvalidRequestException("Unknown parameter name: " + targetResourceType + ':' + parameterName);
}
//Ensure that the name of the back-referenced search param on the target (e.g. the `subject` in Patient?_has:Observation:subject:code=sys|val)
//exists on the target resource.
owningParameterDef = mySearchParamRegistry.getSearchParamByName(targetResourceDefinition, paramReference);
if (owningParameterDef == null) {
throw new InvalidRequestException("Unknown parameter name: " + targetResourceType + ':' + paramReference);

View File

@ -363,6 +363,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
obs.addIdentifier().setSystem("urn:system").setValue("FOO");
obs.setDevice(new Reference(devId));
obs.setSubject(new Reference(pid0));
obs.setCode(new CodeableConcept(new Coding("sys", "val", "disp")));
myObservationDao.create(obs, mySrd).getId();
}
@ -382,6 +383,16 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
IBundleProvider chainSearch = myObservationDao.search(chainQuery);
List<SqlQuery> selectqueriesForCurrentThread = myCaptureQueriesListener.getSelectQueriesForCurrentThread();
assertThat(chainQuery.size(), is(equalTo(1)));
SearchParameterMap hasQuery = new SearchParameterMap();
hasQuery.setLoadSynchronous(true);
hasQuery.add("_has", new HasParam("Observation", "subject", "code", "sys|val"));
//hasQuery.add(Observation.SP_DEVICE, new ReferenceParam("device", "urn:system|FOO").setChain("identifier"));
myCaptureQueriesListener.clear();
IBundleProvider hasSearch = myPatientDao.search(hasQuery);
selectqueriesForCurrentThread = myCaptureQueriesListener.getSelectQueriesForCurrentThread();
assertThat(hasQuery.size(), is(equalTo(1)));
}
@Test