1. FHIR中三種範式交換數據
| 範式 | 描述 | 使用案例 |
|---|---|---|
| RESTful API | 每個資源上的 CRUD 操作 | 即時互動應用 |
| 文件 | 資源集合構成了完整的「文件」。 | 出院小結、轉院文件、病歷 |
| 訊息傳遞 | 事件驅動,在系統之間發送訊息 | 入院通知書、檢查結果、醫囑 |
2.FHIR 文件
FHIR 檔案是 捆綁類型“文檔”,第一個條目必須是 成分,後面跟著所有引用的資源。
作文資源
{
"resourceType": "Composition",
"id": "comp-discharge-001",
"status": "final",
"type": {
"coding": [
{
"system": "http://loinc.org",
"code": "18842-5",
"display": "Discharge summary"
}
],
"text": "Tóm tắt xuất viện"
},
"subject": {
"reference": "Patient/patient-001",
"display": "Nguyễn Văn A"
},
"encounter": {
"reference": "Encounter/encounter-inpatient-001"
},
"date": "2025-01-20T16:00:00+07:00",
"author": [
{
"reference": "Practitioner/practitioner-001",
"display": "BS. Trần Thị B"
}
],
"title": "Tóm tắt xuất viện - Nguyễn Văn A",
"custodian": {
"reference": "Organization/org-bvdk-001"
},
"section": [
{
"title": "Chẩn đoán",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "11535-2",
"display": "Hospital discharge Dx Narrative"
}
]
},
"text": {
"status": "generated",
"div": "Tăng huyết áp độ 2, Đái tháo đường type 2
"
},
"entry": [
{"reference": "Condition/cond-hypertension-001"},
{"reference": "Condition/cond-diabetes-001"}
]
},
{
"title": "Thuốc kê đơn khi xuất viện",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "10183-2",
"display": "Hospital discharge medications"
}
]
},
"entry": [
{"reference": "MedicationRequest/mr-amlodipine-001"},
{"reference": "MedicationRequest/mr-metformin-001"}
]
},
{
"title": "Kết quả xét nghiệm",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "30954-2",
"display": "Relevant diagnostic tests/lab data"
}
]
},
"entry": [
{"reference": "DiagnosticReport/dr-cbc-001"},
{"reference": "Observation/obs-hba1c-001"}
]
}
]
}
文件包
{
"resourceType": "Bundle",
"type": "document",
"identifier": {
"system": "http://hospital.vn/documents",
"value": "DOC-20250120-001"
},
"timestamp": "2025-01-20T16:00:00+07:00",
"entry": [
{
"fullUrl": "urn:uuid:comp-001",
"resource": {
"resourceType": "Composition"
}
},
{
"fullUrl": "urn:uuid:patient-001",
"resource": {
"resourceType": "Patient"
}
},
{
"fullUrl": "urn:uuid:cond-001",
"resource": {
"resourceType": "Condition"
}
}
]
}
文件規則
- Bundle.type = "文件"
- 第一個條目必須是作文
- 組合引用的所有資源必須位於捆綁包中
- 文件簽署後不可更改
- 可以進行數位簽章(捆綁包或來源中的簽名)
3.FHIR 訊息傳遞
訊息傳遞使用 捆綁類型“訊息” 與 訊息頭 進行第一個條目。
訊息頭資源
{
"resourceType": "MessageHeader",
"id": "msg-admission-001",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/message-events",
"code": "admin-notify"
},
"source": {
"name": "HIS Bệnh viện ĐK TW",
"endpoint": "https://his.bvdk.vn/fhir/$process-message"
},
"destination": [
{
"name": "Hệ thống BHXH",
"endpoint": "https://api.bhxh.gov.vn/fhir/$process-message"
}
],
"focus": [
{
"reference": "Encounter/encounter-inpatient-001"
},
{
"reference": "Patient/patient-001"
}
],
"reason": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/message-reasons-encounter",
"code": "admit"
}
],
"text": "Thông báo nhập viện"
}
}
訊息包
{
"resourceType": "Bundle",
"type": "message",
"timestamp": "2025-01-15T14:30:00+07:00",
"entry": [
{
"fullUrl": "urn:uuid:msg-001",
"resource": {
"resourceType": "MessageHeader"
}
},
{
"fullUrl": "urn:uuid:encounter-001",
"resource": {
"resourceType": "Encounter"
}
},
{
"fullUrl": "urn:uuid:patient-001",
"resource": {
"resourceType": "Patient"
}
}
]
}
發送訊息
POST /fhir/$process-message HTTP/1.1
Content-Type: application/fhir+json
{
"resourceType": "Bundle",
"type": "message",
...
}
4. 比較三種範式
| 標準 | 休息 | 文件 | 訊息傳遞 |
|---|---|---|---|
| 型號 | 請求/回應增刪改查 | 不可變的包 | 事件驅動 |
| 聯軸器 | 鬆動 | 無(獨立) | 鬆動 |
| 原子性 | 交易捆綁 | 整個文檔 | 整個訊息 |
| 路由 | 基於URL | 不適用 | 基於端點 |
| 時機 | 同步 | 不適用 | 非同步或同步 |
| 相容於HL7 v2 | 型號不同 | 類似 CDA | 類似 HL7 v2 訊息 |
5. 總結
文件 — 組合+捆綁“文件”,獨立,不可變,可簽名
訊息傳遞 — MessageHeader + Bundle“訊息”,事件驅動,$process-message
休息 仍然是最受歡迎的範例,但文件和訊息對於許多傳統醫療用例至關重要