如何使用_content搜索fhir中的birthData?

问题描述 投票:0回答:2

[当我只搜索birthData时,我得到的结果。

例如:http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?_pretty=true&birthdate=2020-03-16将返回生日为2020-03-16的患者。

当我用_content搜索时,没有得到任何结果。像这样:

http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?_content=2019-09-05
hl7-fhir hapi-fhir
2个回答
2
投票

_ content用于搜索文本内容。

如果要搜索日期,则需要使用日期搜索参数。例如:

http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?birthDate=2019-09-05


2
投票

这可以使用搜索参数来实现。

搜索参数在本质上是系统内索引的资源中的命名路径,因此它们可用于查找与给定条件匹配的资源。

使用搜索参数

  • 我们可以添加其他搜索参数,这些索引将为未定义标准搜索参数的字段建立索引。

  • 我们可以添加其他搜索参数,这些参数将为您的客户使用的扩展名编制索引。

  • 我们可以禁用搜索参数

示例:

假设我有一个PractitionerRole

    "resourceType": "PractitionerRole",
    "id": "6639",
    "meta": {
      "versionId": "1",
      "lastUpdated": "2020-03-19T13:26:34.748+05:30",
      "source": "#aYyeIlv9Yutudiwy"
    },
    "text": {
      "status": "generated",
      "div": "<div xmlns=\"<http://www.w3.org/1999/xhtml\">foo</div>">
    },
    "active": true,
    "practitioner": {
      "reference": "Practitioner/6607"
    },
    "organization": {
      "reference": "Organization/6528"
    },
    "specialty": [
      {
        "coding": [
          {
            "system": "<http://snomed.info/sct",>
            "code": "42343242",
            "display": "Clinical immunology"
          }
        ]
      }
    ]
}

PractitionerRole具有自己的搜索参数。除了这些搜索参数外,我们还希望有一个搜索参数,该参数将根据开业者。参考过滤所有开业者角色。我们可以使用搜索参数来实现。我们需要做的就是创建一个新的搜索参数,如下所示。

{
"resourceType": "SearchParameter",
"title": "Practitioner Referecene",
"base": [ "PractitionerRole" ],
"status": "active",
"code": "practitioner_reference",
"type": "token",
"expression": "PractitionerRole.practitioner.reference",
"xpathUsage": "normal"
}

[fhir告诉您的是,当用户希望使用racter_reference进行过滤,然后寻找PractitionerRole.practitioner.reference。

这看起来像这样:http://localhost:8080/hapi-fhir-jpaserver/fhir/PractitionerRole?practitioner_reference=Practitioner/6607

我们还可以将其扩展为使用多个参数进行搜索。我们可以使用或条件创建搜索参数,以便可以使用多个参数进行搜索。

  "resourceType": "SearchParameter",
  "title": "Patient Multi Search",
  "base": [ "Patient" ],
  "status": "active",
  "code": "pcontent",
  "type": "token",
  "expression": "Patient.managingOrganization.reference|Patient.birthDate|Patient.address[0].city",
  "xpathUsage": "normal"
}

以上SearchParameter会使用Patient.managingOrganization.reference或Patient.birthDate或Patient.address [0] .city。

查询看起来像这样:

搜索城市→http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?pcontent=Bruenmouth

搜索出生日期→http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?pcontent=2019-04-06

© www.soinside.com 2019 - 2024. All rights reserved.