首页 > 解决方案 > 将 Bundle 中的患者导入 FHIR 服务器

问题描述

我正在尝试使用 cURL 将患者资源包导入 FHIR 服务器。这是我的命令和响应:

curl --header "Content-Type:application/json" -X POST -k -i -u 'fhiruser:change-password' --data @10patients.json 'https://localhost:9443/fhir-server/api/v4/Bundle'
HTTP/2 201 
location: https://localhost:9443/fhir-server/api/v4/Bundle/17621baad7c-6fdc1153-38d8-4987-9be3-0d4f0983dbac/_history/1
etag: W/"1"
last-modified: Wed, 02 Dec 2020 04:34:10 GMT
date: Wed, 02 Dec 2020 04:34:10 GMT
content-length: 0
content-language: en-US

它似乎奏效了。如果我得到捆绑包本身,我可以这样做;但是如果我尝试通过 id 访问任何单个 Patient 资源或获取所有 Patient 资源,我什么也得不到。似乎它们只能作为捆绑包的一部分访问。例如:

curl -i -s -k -u 'fhiruser:change-password' -X GET 'https://localhost:9443/fhir-server/api/v4/Patient'

或者

curl -i -s -k -u 'fhiruser:change-password' -X GET 'https://localhost:9443/fhir-server/api/v4/Patient/17621b90c2f-492f5677-f480-4ef8-8b6a-4a2ebfbad715'

什么都不返回。

这是包含患者资源的数据文件的开头:

{
  "resourceType": "Bundle",
  "id": "b248b1b2-1686-4b94-9936-37d7a5f94b51",
  "meta": {
    "lastUpdated": "2012-05-29T23:45:32Z"
  },
  "type": "batch",
  "entry": [
    {
      "fullUrl": "http://hl7.org/fhir/Patient/1",
      "resource": {
        "resourceType": "Patient",
        "id": "1",
        "meta": {
          "lastUpdated": "2012-05-29T23:45:32Z"
        },
        "text": {
          "status": "generated",
          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Everywoman, Eve. SSN:\n            444222222</div>"
        },
        "identifier": [
          {
            "type": {
              "coding": [
                {
                  "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
                  "code": "SS"
                }
              ]
            },
            "system": "http://hl7.org/fhir/sid/us-ssn",
            "value": "444222222"
          }
        ],
        "active": true,
        "name": [
          {
            "use": "official",
            "family": "Everywoman",
            "given": [
              "Eve"
            ]
          }
        ],
        "telecom": [
          {
            "system": "phone",
            "value": "555-555-2003",
            "use": "work"
          }
        ],
        "gender": "female",
        "birthDate": "1973-05-31",
        "address": [
          {
            "use": "home",
            "line": [
              "2222 Home Street"
            ]
          }
        ],
        "managingOrganization": {
          "reference": "Organization/hl7"
        }
      },
      "request": {
        "method": "POST",
        "url": "Patient"
      }
    },
    {
      "fullUrl": "http://hl7.org/fhir/Patient/2",
      "resource": {
        "resourceType": "Patient",
        "id": "2",
        "meta": {
          "lastUpdated": "2012-05-29T23:45:32Z"
        },
        "text": {
          "status": "generated",
          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Everyman, Adam. SSN:\n            444333333</div>"
        },
        "identifier": [
          {
            "type": {
              "coding": [
                {
                  "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
                  "code": "SS"
                }
              ]
            },
            "system": "http://hl7.org/fhir/sid/us-ssn",
            "value": "444333333"
          }
        ],
        "active": true,
        "name": [
          {
            "use": "official",
...

如您所见,我在数据文件中使用了“type”:“batch”。我也试过 "type": "transaction" 但结果相同。显然,我可以使用 shell 脚本一次导入患者,但我更愿意一次导入整个包。

标签: curlbundlehl7-fhir

解决方案


根据标准,当您将捆绑包发布到 [base]/Bundle 时,您要求服务器像任何其他捆绑包一样存储批处理/事务。当您将其发布到 [base] 时,它将被处理

http://hl7.org/fhir/bundle.html#rest


推荐阅读