在 HAPI FHIR 中使用搜索参数“_profile”

Usage of search parameter "_profile" in HAPI FHIR

在 FHIR REST API 中,有一些可用于 'search' 端点的所有资源的标准参数。

我需要在搜索操作中使用“_profile”参数:https://www.hl7.org/fhir/search.html#profile

关于实现搜索操作的 HAPI FHIR 文档 (https://hapifhir.io/hapi-fhir/docs/server_plain/rest_operations_search.html) 有很多例子,none 提到了适用于所有资源的参数,比如 '_profile' .

我还在线检查了他们的测试服务器 (http://hapi.fhir.org/resource?serverId=home_r4&pretty=true&resource=Observation),但我找不到在那里指定“_profile”的方法,看看它是如何工作的。

在代码层面,我要做的是:

@Search
public List<Observation> getObservationsByProfile(??? profile)
{
  ...
  if (profile == '...')
  {
    ...
  }
  else
  {
    ...
  }
  ...
}

我不知道如何指定参数的注释和类型,因此它绑定到所请求的“_profile”参数中提供的值 URL。

有没有我可以参考的示例代码或文档?谢谢

使用“_profile”参数进行搜索的方法是这样的:

@Search
public List<Observation> getObservationsByProfile(@OptionalParam(name="_profile) UriParam profile)
{
  ...
  if (profile == '...')
  {
    ...
  }
  else
  {
    ...
  }
  ...
}

尽管 _xxx 参数适用于所有 FHIR 资源,但 HAPI FHIR 文档并未包含有关如何在搜索中使用这些资源的示例。希望这对其他人有所帮助。