###### tags: `FHIR`
# FHIR-快速入門組出第一個Patient-Resource
此篇將帶大家了解基本的FHIR Resource content、Data Types並組出第一個Patient JSON。
# 必備知識
- JSON
# FHIR Data Types

- Primite Types 是最基本的(**而且只有 Primive Type 是首字小寫**),以程式來看就是常見的string、int、float這種型態
- 其餘Types,都是以所有Types複合組成的Type,以程式來看就像是Class、Interface、Object
# FHIR Resource Content
以下是Resource Content的小小說明

:::info
Note: **`欄位名稱`**、**`數量`**、**`資料型態`** 是組成Resource的關鍵重點。
:::
# 看文件組JSON的小技巧
- 看到Type小寫且Card.(數量)為**0..1**
```JSON=
{
"field": "value",
//或者是
"field": 123456
}
```
- 看到Type小寫且Card.(數量)為**0..\***
```JSON=
{
"field": [ //0..* 會是中括弧
"value1",
"value2"
],
//或者是
"field": [
123456,
456789
]
}
```
- 看到Type大寫且Card.(數量)為**0..1**
```JSON=
{
//以HumanName為例
"name": { //Type大寫會是大括弧
"use": "official"
"text": "hello world",
"family": "world",
"given" : [
"hello"
]
}
}
```
- 看到Type大寫且Card.(數量)為**0..\***
```JSON=
{
//以HumanName為例
"name": [ //0..* 會是中括弧
{ //Type大寫大括弧
"use": "official"
"text": "hello world",
"family": "world",
"given" : [
"hello"
]
},
{ //Type大寫大括弧
"use": "official"
"text": "hello world",
"family": "world",
"given" : [
"hello"
]
},
]
}
```
# 組出Patient Resource JSON
題目來自: [演練 I:建立單筆 Patient Resource](https://hackmd.io/@lorex8711/rkCXQV7hr#%E6%BC%94%E7%B7%B4-I%EF%BC%9A%E5%BB%BA%E7%AB%8B%E5%96%AE%E7%AD%86-Patient-Resource)
- 病人英文姓名為「Jennifer Lopez」,中譯姓名為「珍妮佛羅培茲」
- 這是他的照片:https://i.imgur.com/VeTQheO.png
- 護照號碼:65848725
- 聯絡電話:(宅) 07-2159685 (公) 07-7938888 (手機) 0912-354879
- 聯絡地址:高雄市橋頭區經武路 58 號 24 樓之 11
- 戶籍地址同聯絡地址
- 緊急聯絡人姓名:余智波鮭魚
- 緊急聯絡人電話:(手機) 0988-878545
- 緊急聯絡人關係:父子
- 病人慣用溝通之語言為英文(en-US)
```json=
{
"resourceType": "Patient",
"identifier": [
{
"use": "official",
"type": {
"coding": [
{
"system": "https://www.hl7.org/fhir/v2/0203/index.html",
"code": "PPN",
"display": "Passport number"
}
],
"text": "passport number"
}
}
],
"gender": "male",
"name": [
{
"use": "official",
"text": "Jennifer Lopez",
"family": "Lopez",
"given": [
"Jennifer"
]
},
{
"use": "usual",
"text": "珍妮佛羅培茲",
"family": "羅培茲",
"given": [
"珍妮佛"
]
}
],
"telecom": [
{
"system": "phone",
"use": "home",
"value": "07–2159685"
},
{
"system": "phone",
"use": "work",
"value": "07–7938888"
},
{
"system": "phone",
"use": "mobile",
"value": "0912–354879"
}
],
"address": [
{
"text": "高雄市橋頭區經武路 58 號 24 樓之 11"
}
],
"photo": [
{
"url": "https://i.imgur.com/VeTQheO.png"
}
],
"contact": [
{
"relationship": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0131",
"code": "C",
"display": "Emergency Contact"
}
],
"text": "緊急聯絡人"
},
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0131",
"code": "N",
"display": "Next-of-Kin",
"text": ""
}
],
"text": "父子"
}
],
"name": {
"use": "official",
"text": "余智波鮭魚"
},
"telecom": [
{
"system": "phone",
"use": "mobile",
"value": "0988–878545"
}
]
}
],
"communication": [
{
"language" : {
"coding": [
{
"system": "urn:ietf:bcp:47",
"code": "en-US"
}
]
},
"preferred": true
}
]
}
```
# 參考資料
- [陽明大學 / FHIR快速跳坑指南](https://www.slideshare.net/lorexyang/fhir-201786643)
- [FHIR 開發教育訓練相關資源](https://hackmd.io/@lorex8711/rkCXQV7hr)
# Support Me
文件創作花費了很多心血製作,如果你覺得很有幫助
不妨贊助我一下喝杯咖啡唄,[Support Me](https://portaly.cc/Li070/support)