[英]Using Firely how can I parse the data from the participant section of a HL7.Fhir.Model.Appointment JSON response?
使用 Hl7.Fhir.R4 (2.0.1)
當我收到 API 預約響應時,有一部分參與者使用 Firely package,如何提取特定參與者數據?
例如,對於約會,我在 JSON 中為約會參與者提供了此部分。
"participant": [
{
"actor": {
"reference": "https://url/fhir/v2/Practitioner/111",
"display": "https://url/fhir/v2/Practitioner/111"
}
},
{
"actor": {
"reference": "https://url/fhir/v2/Location/222",
"display": "https://url/fhir/v2/Location/222"
}
},
{
"actor": {
"reference": "https://url/fhir/v2/Patient/333",
"display": "https://url/fhir/v2/Patient/333"
}
}
]
如果有從業者演員,我想創建一個新字符串設置為從業者的 ID; (111) 在上面的例子中。 從參考 URL 中提取該信息的正確方法是什么?
您可以使用 ITypedElement 和 FhirPath 來獲取您需要的數據。 添加這些 using 語句:
using Hl7.Fhir.Model;
using Hl7.Fhir.ElementModel;
using Hl7.FhirPath;
然后您可以使用以下代碼獲取包含從業者 ID 的列表:
List<string> practitionerList = new List<string>();
var typedApp = [yourAppointmentResource].ToTypedElement();
foreach (var p in typedApp.Select("participant.actor"))
{
var r = new ResourceIdentity(p.ParseResourceReference().Reference);
if (r.ResourceType.Equals("Practitioner"))
practitionerList.Add(r.Id);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.