FHIR 复合扩展

FHIR complex extension

如何添加具有多个字段的扩展? 例如,如果我在我的应用程序中有一个与访问动机相关的扩展,其结构如下:

"visit_motive":
    {
          "id": "1",
          "label": "Visit motive name",
          "color": "#000000",
          "duration": 5
    }

我暂时有这样的东西:

"extension": [
    {
      "url": "https://api.test.com/fhir/StructureDefinition/schedule-visit_motives",
      "valueIdentifier": "visit_motive1_id",
      "valueString" : "visit motive name",
      "valueString" : "#000",
      "valueInteger" : 5,
    },
    {
      "url": "https://api.test.com/fhir/StructureDefinition/schedule-visit_motives",
      "valueIdentifier": "visit_motive2_id",
      "valueString" : "visit motive name 2",
      "valueString" : "#111",
      "valueInteger" : 10,
    }
]

但我很确定它不正确,因为我无法命名字段,因为我每次都必须精确值 [x]。

我该怎么做?

您可以使用复杂的扩展来做到这一点,它基本上是一个包含扩展的扩展。可以看到more information about extensions in the spec. Scroll down a bit for the complex one. Or view an example of the structure of a complex extension here.

您的扩展程序的使用看起来像这样:

"extension" : [{
    "url" : "https://api.test.com/fhir/StructureDefinition/schedule-visit_motives",
    "extension" : [{
        "url" : "id",
        "valueIdentifier": "visit_motive1_id"
    }, {
        "url" : "label", 
        "valueString" : "visit motive name"
    }, {
        "url" : "color",
        "valueString" : "#000"
    }, {
        "url" : "duration",
        "valueInteger" : 5,
    }]
}]