Search code examples
javahl7-fhirhapi-fhirsmart-on-fhir

Is there any way to fetch the list of resource types available for a patient id from FHIR Server?


I want the fetch the list of resource types available for a patient from the FHIR server. I tried to fetch the List of items from the Patient. But it doesn't contain all the resource types available for that particular patient.


Solution

  • When you say "the list of resource types available for a patient from the FHIR server", I think what you mean is the resource types that can be searched by patient on the FHIR server.

    To build such a list, read the FHIR server's CapabilityStatement. Iterate through the CapabilityStatement's resource array, checking each item's searchParam array for an element where name = 'patient' and type = 'reference'. If you find it, add that item's type value (i.e. the resource type) to the list.