2016-08-10 120 views
1

我正在使用HAPI FHIR服務器,並且對於java客戶端來說有點新鮮。我希望完成的是創建FHIR Patient Bundles,其中包含一個識別患者資源及其所有其他資源的完整捆綁包,並將其保存爲json文件。HAPI FHIR患者包請求

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

我來自一個Python的背景,所以如果它會更簡單,做的請求或捲曲通過對患者是會受到歡迎,以及正確的端點進行迭代。這是一次性過程。如果他們是更具交易性的替代品,那也會很好。任何建議真誠感謝!

回答

1

一個捆綁的資源可以用來捆綁像條件,遭遇戰,觀察,病人的資源等等。

//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測試服務器鏈接的唯一原因。

的捆綁結構中的條目爲shown in this snap.

More details on Bundle