FHIR 中的捆绑资源可用于捆绑资源,如条件、遭遇、观察、患者等。
//Example scala pseudo code
//For each of your FHIR resources, add them to a new Entry in your Bundle
// Create a new Patient
val patient = new Patient()
// Add the patient name
patient.addName()
.addGiven("Bender Bending")
.addFamily("Rodriguez")
//similarly you can create observation and condition object.
//Every Bundle *must* contain a Patient resource
bundle.addEntry().setResource(patient)
bundle.addEntry().setResource(observation)
bundle.addEntry().setResource(condition)
bundle.setType(BundleTypeEnum.COLLECTION)
FhirContext ourCtx = FhirContext.forDstu3();
String output =ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(bundle);
// output will contain the JSON created from the bundle. more details on how
JSON 将如下所示。示例:捆绑 JSON 层次结构:捆绑条目:资源类型 = 条件资源类型 = 观察资源类型 = 患者
Bundle的Json表示
这在 DSTU2 和 DSTU3 中都受支持,但是我在 DSTU3 的测试服务器中找不到合适的 json,这是我粘贴 DSTU2 测试服务器链接的唯一原因。
Bundle 构建条目,如本快照所示。
有关捆绑包的更多详细信息