HAPI FHIR 患者包请求

HAPI FHIR Patient Bundle Request

我正在使用 HAPI FHIR 服务器,对 java 客户端有点陌生。我希望完成的是创建 FHIR 患者包,在一个完整的包中包含一个识别患者资源和所有其他资源,并将其保存为 json 文件。

Patient Resource 1
Observation Resource 1
Condition Resource 1
Lab Resource 1
Observation Resource 2
...

我来自 python 背景,因此如果按照请求或 curl 为患者迭代正确的端点会更简单,那也将受到欢迎。这是一个一次性的过程。如果他们是更具交易性的替代方案,那也很好。真诚感谢任何建议!

听起来你想要 Patient/$everything(参见 http://hl7.org/fhir/patient-operations.html#everything)(尽管并非所有服务器都支持该操作)

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 层次结构: 捆 入口: 资源类型 = 条件 资源类型 = 观察 资源类型 = 患者

Json representation of Bundle

这在 DSTU2 和 DSTU3 中都受支持,但是我在 DSTU3 的测试服务器中找不到合适的 json,这是我粘贴 DSTU2 测试服务器 link 的唯一原因。

Bundle 将条目构造为 shown in this snap.

More details on Bundle