将 Bundle 中的患者导入 FHIR 服务器

Import patients in Bundle to FHIR server

我正在尝试使用 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

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

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'

return 没有。

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

{
  "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 脚本一次导入患者,但我更愿意一次导入整个包。

根据标准,当您将捆绑包 post 到 [base]/Bundle 时,您要求服务器像任何其他捆绑包一样存储批次/交易。当你 post 它到 [base] 然后它会被处理

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