1

How do we support a query like

GET /base/ResearchStudy?_count=1&_has:ResearchSubject:study:individual=Patient/3635973&_elements=id 

using HAPI FHIR plain server? The documentation tells how to do chaining, but not reverse chaining (_has).

Eponymous
  • 6,143
  • 4
  • 43
  • 43

1 Answers1

0

This is another search parameter, a HasParam. There are also HasAndListParam and HasOrListParam variants.

Example:

@Search()
public List<ResearchStudy> searchByHas(@RequiredParam(name=Constants.PARAM_HAS) HasParam has) {

  final var paramName = has.getParameterName();
  final var paramVal = has.getParameterValue();
  final var fieldName = has.getReferenceFieldName();
  final var targetType = has.getTargetResourceType();
   
   List<ResearchStudy> retVal = new ArrayList<Patient>();
   // ...populate...
   return retVal;
}
Eponymous
  • 6,143
  • 4
  • 43
  • 43