【问题标题】:How to search birthData in fhir using _content?如何使用_content在fhir中搜索birthData?
【发布时间】:2020-03-23 13:13:01
【问题描述】:

当我在 fhir 中仅使用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


    【解决方案1】:

    _content 用于搜索文本内容。

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

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

    【讨论】:

    • 我可以使用birthDate 进行搜索,但我们可以在_content 上编写自己的索引吗? hapi fhir 是否提供这种类型的功能?
    • 暂时没有,没有。
    【解决方案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 有自己的搜索参数。除了那些搜索参数之外,我们还希望有一个搜索参数,它将根据从业者.reference 过滤所有从业者角色。我们可以使用搜索参数来实现这一点。我们需要做的就是创建一个新的搜索参数,如下所示。

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

    这里 fhir 告诉用户什么时候想要使用practice_reference 进行过滤,然后查找 PractitionerRole.practitioner.reference。

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

    我们还可以扩展它以使用多个参数进行搜索。我们可以创建一个带有 or 条件的搜索参数,以便它可以使用多个参数进行搜索。

      "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"
    }
    

    搜索参数上方将使用 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多