---
# System prepended metadata

title: Clinic Management System

---

# Clinic Management System
# 會議記錄

## 第1次專案會議
> 時間: 2019/9/25 16:30 ~ 17:30
> 地點: 宏裕科技大樓 1623 室
* 題意
    * 我們資料要從FHIR取得
    * 去實現新的頁面

* 以後開會時間時間
    * 一： 13:00~
    * 五： 整天
    * 暫停開會時間
        * 10/19 POSD考試
* 討論內容
    * 需求 
    * 分工
        * 5後端，2個兼職前端
		* 後端前端擔當
			* 前端 蕭文全
			* 後端 劉孝忠
* 下次討論

	* 時間: 9/30 13:00
	* 主題: 
		* 需求
		* 分工 (前後端)
		* 寫文件
	* 前置作業: 
		* 看FHIR

---

## 第2次專案會議
> 時間: 2019/9/30-13:30 ~ 16:30
> 地點: 宏裕科技大樓 1623 室
* Systems
    * 身份管理系統
    * 登入系統
    * 病歷儲存系統(Keep Track of Patient Electronic Health Record History)
    * 掛號系統
        * 看診進度
    * 病人管理系統
    * 財務系統
    * 藥品管理系統
    * 公告系統

* Pages
    * 首頁
        * 看診進度
        * ...
    * 登入頁面
    * ==<font color="red">管理頁面</font>==
        * ==身份管理==
        * ==掛號管理==
        * ==病人管理==
        * ==病歷管理==
        * ==財務管理==
        * ==藥品管理==
        * 公告管理
        * 首頁管理

## 第3次專案會議
> 時間: 2019/10/2 16:45 ~ 18:45
> 地點: 宏裕科技大樓 1623 室
* Systems
    * 身份管理系統
        * Admin
        * Practitioner
        * Employee
    * 登入系統
    * 病歷儲存系統(Keep Track of Patient Electronic Health Record History)
        * Patient
        * Problem
        * Medication
        * CarePlan
    * 掛號系統
        * 看診進度
        * 員工掛號
        * 普通病患
            * 沒有在本診所看診過 現場填寫
            * 有的話 輸入身份證 出生年月日
    * 病人管理系統
        * Patient
        * 建立,修改,刪除病人資料
    * 財務系統
        * Invoice
    * 藥品管理系統
        * Medication
        * 建立,修改,刪除藥品資料
    * 網頁管理
        * 新增,修改網頁資料

* Pages
    * 首頁
        * 看診進度
        * ...
    * 登入頁面
    * ==<font color="red">管理頁面</font>==
        * ==身份管理==
        * ==掛號管理==
        * ==病人管理==
        * ==病歷管理==
        * ==財務管理==
        * ==藥品管理==
        * 首頁管理

## 第4次專案會議
> 時間: 2019/10/2 16:45 ~ 18:45
> 地點: 宏裕科技大樓 1623 室
* Systems
* 章節分工
    * 蕭文全：六 八
    * 劉孝忠：五 七
    * 古兆瑋：三
    * 黃俊凱：四、WBS
    * 陳冠穎：二

## 第5次專案會議
> datetime: 2019/10/17 13:30 ~ 17:30
* 系統需求規格書(Software Requirements Specification) 討論
    * 控制文件: 問老師該做什麼
    * 1.2.3 符號為功能的簡稱
    * 2 功能性需求用F代表，非功能性需求用N代表
        * 我們自己做，功能性需求要寫比較多
    * 追溯矩陣，那些東西需要寫在這個介面上
- 子系統
    * 身份管理 & 登入子系統(User Identity Management and Login Subsystem) - UIMLS
    * 病歷儲存子系統(Patient Electronic Health Record Subsystem) - PEHRS 
    * 病人管理子系統(Patient Infomation Management Subsystem) - PIMS
    * 掛號子系統(Online Registration Subsystem) - ORS
    * 藥品管理子系統(Medicaction Management Subsystem) - MMS
    * 財務子系統(Financial Subsystem) - FS 
    * 網頁管理(Website Management Subsystem) - WMS

| 子系統名稱 | 文件撰寫負責人|
|---|---|
|身份管理 & 登入子系統(UIMLS)|古兆瑋 |
|病歷儲存子系統(PEHRS)      |劉孝忠 |
|病人管理子系統(PIMS)       |陳冠穎 |
|掛號子系統(ORS)           |蕭文全 |
|藥品管理子系統(MMS) & 財務子系統(FS)|黃俊凱 |
|網頁管理(WMS)             |一起做 |
   
- 分工
    - 文件可用子系統分
    - 開發一起開發一個子系統

- 工作
    - (10/22)完成各子系統文件
    - (10/22)下次討論
    - (10/27)UI開始開發

## 第6次專案會議
> 時間: 2019/10/23 17:00 ~ 
> 地點: 宏裕科技大樓 1623 室
### 子系統SRS review
- 統一的項目
	- 安裝需求
	- 環境需求
	- 設計限制
	- 可信度需求，備份 恢復 log
- 病歷
	- 操作概念潤稿
- 身分管理 & 登入子系統
	- N-13改成單元測試
	- N-15刪除
	- 操作概念需修正(只有在此子系統能做的事)
- 掛號
	- 圖新增admin
	- 新增查詢病人掛號的號碼
- 藥品管理
	- 一般使用者的相關刪除
- 病人管理
	- 可信度需求要跟其他一樣
### 下次開會
- 時間: 10/28 14:00
- 主要子系統的介面：病例 病患 藥品 身分管理
- 討論項目
	- 報告的人
	- 簡報如何做

## 前端訓練計畫（序）
> 時間: 2019/10/27 13:30 ~ 16:30
> 地點: Skype 語音通話
> 講師: 劉孝忠
> 參與人員: 劉孝忠、蕭文全、黃俊凱、陳冠穎、古兆瑋
### Vue.js
https://vuetifyjs.com
https://materialdesignicons.com
https://github.com/creativetimofficial/vuetify-material-dashboard

### 分工
- 首頁
	- 掛號管理
- 後台
	- 身份管理
	- 病人管理
	- 病歷管理
	- 財務管理
	- 藥品管理
#### 全部頁面
- 形象官網(3)
	- 首頁
	- 掛號進度
	- 立即掛號頁面
- 根據網址進入login介面(1) - 孝忠
- 後台
	- 首頁(1) - 孝忠
	- 病歷儲存系統(2)
		- 新增病例(包括修改)
		- 顯示病例(包括刪除)
	- 掛號系統(2)
		- 幫病患掛號(與形象官網立即掛號頁面相同)
		- 顯示掛號病人資訊
	- 病人管理系統(2)
		- 新增病人(包括修改)
		- 顯示病人(包括刪除)
	- 財務系統(2)
		- 新增收據(無修改)
		- 顯示收據(無刪除)
	- 藥品管理(2)
		- 新增藥品(包括修改)
		- 顯示藥品(包括刪除)

- 後台 - 文全
- 形象官網 - 俊凱

## 第7次專案會議
> 時間: 2019/10/28 15:20 ~ 
> 地點: 宏裕科技大樓 1623 室

### SRS review
- 下拉式選單：
    - [x]顯示及新增
    - [ ]只有顯示，新增dialog
- 藥品資訊，藥品數量刪除。

### 討論事項
- 圖(第二章及WMS)、系統架構圖彙整：黃俊凱
- Glossary，referance ：蕭文全
    - Vue.js
    - Flask
    - MongoDB
    - HAPI FHIR Server
    - GraphQL
    - Docker
    - Unit Test
- 文件prototyping圖(報告完)
- 簡報檔案製作 :古兆瑋
    - ![](https://i.imgur.com/GuEZjMO.png)
- 上台報告
    - 文件
        - 1. ~ 4.：陳冠穎
        - 5.6. ：劉孝忠
    - prototyping :蕭文全
    - 備註： 
        - 功能名稱 N-XX 標上簡報

## 第8次專案會議
> 時間: 2019/10/30 16:30 ~ 18:25
> 地點: 宏裕科技大樓 1623 室
### 討論項目
- 定義每個表格需要的項目(後台)
    - FHIR需要用到哪些項目
- admin的角色定位
    - 超級帳號
- UI確認
	- 主畫面
		- 左上角改為: [診所名稱]
		- 右上角全改為中文
	- 後台
		- 真的假資料
		- CMS用全名
- (下次討論)製作use case>
    >需求不用use case列的話不用來了，沒人知道需求是什麼
- 非功能性是否做
- stake holder
- 財務是否要做
    - 是
- 病例是否可以更新
    - 目前先保留功能

### 定義每個表格需要的項目
#### patient
必要：身分證 姓 名 生日
詳細資訊：
GET 200 all: http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?_getpagesoffset={int}&_count={int}
GET 200 patient_id: http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient/{id}
GET 200 query patient: http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?identifier=H123456789
POST 201 新增(need data) create : POST http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient
DELETE 200 刪除 : http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient/{id}
PUT 200 更新(need data) : http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient/{id}

```json
{
    "resourceType": "Patient",
    "identifier": [
        {
            "value": "H123456789" // 身分證 required type:string
        }
    ],
    "name": {
        "family": "姓氏", // required type:string
        "given": "名字" // required type:string
    },
    "telecom": [
        {
            "system": "phone",// type:code
            "value": "電話號碼" // required type:string limit:20
        }
    ],
    "gender": "male", // required type:code |male | female | other | unknown|
    "birthDate": "2000-01-01", //required type:date format: YYYY-MM-DD
    "address": {
        "text": "你家" // required type:string 
    },
    "maritalStatus": {
        "text": "未婚" //required 	未婚|已婚|離婚|喪偶|不願提供
    }
}
```
```json
{
    "resourceType": "Patient",
    "identifier": [
        {
            "value": "C123456789" 
        }
    ],
    "name": {
        "family": "姓氏", 
        "given": "名字"
    },
    "telecom": [
        {
            "system": "phone",
            "value": "電話號碼" 
        }
    ],
    "gender": "male", 
    "birthDate": "2000-01-01", 
    "address": {
        "text": "你家" 
    },
    "maritalStatus": {
        "text": "未婚" 
    }
}
```
#### Clinical

all: GET http://localhost:8080/hapi-fhir-jpaserver/fhir/Condition?_getpagesoffset={int}&_count={int}

get id: GET http://localhost:8080/hapi-fhir-jpaserver/fhir/Condition/{id}

query patient: GET http://localhost:8080/hapi-fhir-jpaserver/fhir/Condition?patient={id}

新增(need data) create: POST http://localhost:8080/hapi-fhir-jpaserver/fhir/Condition

刪除 DELETE: http://localhost:8080/hapi-fhir-jpaserver/fhir/Condition/{id}

更新(need data) PUT: http://localhost:8080/hapi-fhir-jpaserver/fhir/Condition/{id}

```json
{
    "resourceType": "Condition",
    "recordedDate": "2019-12-15",
    "subject": {
        "reference": "Patient/56",
        "display": "H123456789"
    },
    "code": {
        "text": "病況描述"
    },
    "note": {
        "text": "用藥" // required type:string
    }
}
```
#### medication
http://hl7.org/fhir/medicinalproduct.html
http://web.tygh.gov.tw/pharmacy/
```json
{
    resourceType: "MedicationKnowledge",
    code: {
        "coding": {
            display: "藥品學名"
        }
    },
    synonym: "藥品別名",
    ingredient: {
        item: {
            itemCodeableConcept: {
                text: "成份"
            }
        }
    },
    contraindication: {
        display: "副作用"
    },
    
    administrationGuidelines: {
        dosage: {
            type: "...",
            dosage: {
                "投藥指引"
            }
        },
        patientCharacteristics: {
            value: "適用"
        }
    }
}

```



#### Invoice
```json 
{
    resourceType: "Invoice",
    date: "2019-10-10",
    subject: {
        reference: "Patient/56"
    },
    note: {
        text: "Notation"
    }
}
```

#### finicial

#### UI
- 病人資訊管理頁面
    - 列表顯示:
        - 病人ID(不是身分證是FHIR給的)
        - 身分證
        - 姓名
        - 出生年月日
        - 操作：編輯、刪除、詳細資料
    - 詳細資料
        - 身分證
        - 姓名
        - 電話
        - 性別
        - 出生年月日
        - 地址
        - 婚姻
    - 限制
        - 身分證：10碼
        - 電話：<=20
        - 性別：男、女、其他、不願提供
        - 生日：XXXX-XX-XX
        - 婚姻：已婚、未婚、不願提供、喪偶、離婚
- 病歷資訊管理頁面
    - 列表顯示
        - 身分證
		- 姓名
		- 看診日期
		- 病歷號碼(FHIR)
		- 操作:刪除、詳細資料
    - 詳細資料
    	- 身分證
		- 姓名
		- 看診日期
		- 病況描述
		- 用藥情況
    - 新增頁面
        - 加入掛號病人柱列的card
        - 加入病歷新增的card
            >點選柱列裡的病人來新增病歷
    - 限制
        - 身分證：10碼
        - 看診日期：XXXX-XX-XX
- 掛號
    - 目前重新設計版面，要新增一個可以手動跳號的按鈕
- 藥品管理
	- 列表顯示
		- 藥品學名
		- 藥品名稱
		- 操作:編輯、刪除、詳細資料
    - 詳細資料
		- 藥品學名
		- 藥品名稱
		- 藥品成份
		- 副作用
		- 適應症
		- 投藥指引
    - 限制
	    - 無
- 收據
	- 列表顯示
		- 建立時間
		- 姓名
		- 身分證
		- 操作:詳細資料
	- 詳細資料
		- 建立時間
		- 姓名
		- 身分證
		- 項目
	- 限制
	    - 無

新增病例(身分證 姓名 看診日期 生病原因 用藥情況)
掛號病人柱列的card
病例新增的card

病例列表(病歷號碼 身分證 姓名 建立日期)

掛號(操作只剩刪除)
跳號的bottom

藥品列表(學名 名稱 )




careplan關連到condition及medication


## 第9次專案會議
> 時間: 2019/11/20 16:30 ~ 18:30
> 地點: 宏裕科技大樓 1623 室
### PEP修改
#### 開發順後順序: Gantt
某個子系統設計完馬上實作測試
兩個子系統可以同時設計

**順序**:按照現有的順序

### SRS修改
- 使用者管理
    - 瀏覽使用者
    - 新增使用者
    - 個人資料設定
- 掛號子系統
    - 跳號
- 形象網頁子系統
    - 自定義網頁
        - 四個表格(上傳圖片 超連結)
        - 四個表格(院所介紹 主治項目 醫師介紹 院所位置)
    - 瀏覽公告
    - 新增公告
- 其他子系統
    - 瀏覽
    - 新增
### 下次開會項目
- 訓練
- 分工

## 第10次專案會議
> 時間: 2019/11/22 15:30 ~ 16:30
> 地點: 宏裕科技大樓 1623 室
### PEP修改
Gantt and its related description.

### SRS修改
CMS's system block diagram.
(其他圖的小問題)
Author: 俊凱

### SDD分工
- 操作流程示意圖: 冠穎
- USE CASE: 按照上次子系統分工
- User Interface: 等前端
    - 截所有頁面
- Static model: 孝忠
- Dynamic model: 孝忠分配
    - 等class diagram 與 use case做完才能做
- 驗收
    - 時間: 11/27(星期三)
    - 項目: 所有(除了Dynamic model)

### 實作及測試分工
- 待系統設計完成後進行(預計12/4後)

### 專案視覺化
- 1623室白板加上project/document due date及內部作業期限

## 後端訓練計畫（序）
> 時間: 2019/11/22 16:40 ~ 17:20
> 地點: 宏裕科技大樓 1623 室
> 講師: 劉孝忠
> 參與人員: 劉孝忠、蕭文全、黃俊凱、陳冠穎、古兆瑋

主題: 後端Python、Flask練習
Navigator: 劉孝忠
Driver: 陳冠穎
內容: 實際演練後端查詢user資料之功能


## 第11次專案會議
> 時間: 2019/11/27 16:30 ~ 18:10
> 地點: 宏裕科技大樓 1623 室
### SDD驗收
- use case: Actor對case統一不要箭頭
- Use Case Specification
    - 新增一個colume: related to
        - value是功能性需求的編號
    - usecase的編號
        - 討論
            - usecase是什麼
                - 給user能操作的範圍
        - 結論
            - No.: 改成 XXX-UC-01
            - 圖上標註No.
    - Preconditions
        - 都需要 login use case 編號
    - Extensions要怎麼寫
        - description的細節，例如資料類型
        - 出生年月日寫法: 出生年月日(跳出年月日選項)
        - ![](https://i.imgur.com/i1jT47A.png)
    - Exceptions
        - 要加上資料庫操作之 存在、不存在、重複 等情形
    - Postconditions
        - 兩條
            - 資料庫新增資料
            - 顯示成功
- 不需要寫顯示功能
- ORS
    - ~~沒有病患~~
    - 線上掛號
        - 分兩種種
            - 病患可用
            - 病患不可用
        - Postconditions
            - 顯示可供病人查詢的號碼
    - 掛號時間設定
        - 只能設定每天終止時間
    - 跳號
        - exception: 超過總號碼不能跳號
- WBS 還沒做

## 第12次專案會議
> 時間: 2019/12/06 15:50 ~ 16:50
> 地點: 宏裕科技大樓 1623 室

### 分工
- 後端
	- Done
		- loginBlueprint
		- MainBlueprint
	- 孝忠
		- HealthRecordBlueprint
		- UserBlueprint
	- 兆瑋
		- RegistrationBlueprint
		- PatientBlueprint
		- InvoiceBlueprint
		- MedicationBlueprint
		- ManagementBlueprint
	- 冠穎
- 前端


### 下禮拜分工
遠端到孝忠實驗室電腦?使用vscode live share

## 第13次專案會議
> 時間: 2019/12/13 15:45 ~ 
> 地點: 宏裕科技大樓 1623 室

### 下禮拜分工
一人做兩個
#### 定義每個表格需要的項目
- 孝忠:
	- FHIR
	- [healthrecord](#Clinical)
	- [patient](#patient)
- 冠穎: 
	- management
		- 要設計time
	- [invoice](#Invoice)
- 兆瑋
	- registration
		- setTime要跟management做操作
	- medication
- 俊凱
- 文全

## 第14次專案會議
> 時間: 2020/01/08 15:51 ~ 16:28
> 地點: 宏裕科技大樓 1623 室

### 時程問題
系統測試文件
- 理論時間: 

測試
- 理論時間: 12/25
- 實際:
    - 跟FHIR相關的整合測試未完成

開發與測試時程太短
- 設計估計時間太長，如果設計時間往前一周實作時間會比較充裕
- SDD繳交時間誤解

時程表工作項目可以切割為很多工期

### 其他問題
能力問題
- 東看西看東湊西湊

在文件的期限要求下，我們產品規模太大
- 小一點比較容易做好

# API
## User
GET /user/all 取全部使用者資料
return
```json
{
  "ok": true,
  "users": [
    {
      "email": "madness48596@gmail.com",
      "id": "5df0ac327beb154cd0e80f09",
      "image": "https://en.gravatar.com/userimage/114454781/cf32b5aa139921a70bd0d1c1ac760d67.jpg",
      "introduction": "test",
      "name": "Mino",
      "role": "Admin"
    },
    {
      "email": "admin@gmail.com",
      "id": "5df36085ed7e979f96072156",
      "image": "https://tva1.sinaimg.com/large/8f1bd2b1jw1eox8yv9wg9j21kw11u1kx.jpg",
      "introduction": "測試123",
      "name": "蕭文全123",
      "role": "Admin"
    }
  ]
}
```
GET     /user/<user_id>  取得單一ID使用者資料
return
```json
{
  "ok": true,
  "user": {
    "email": "admin@gmail.com",
    "id": "5df36085ed7e979f96072156",
    "image": "https://tva1.sinaimg.com/large/8f1bd2b1jw1eox8yv9wg9j21kw11u1kx.jpg",
    "introduction": "測試123",
    "name": "蕭文全123",
    "role": "Admin"
  }
}
```
POST    /user/<user_id> 更新單一ID使用者的 role
```json
data = { "role": "<role>" } 
// role = Admin|Doctor|Nurse
```
return
```json
{
  "ok": true
}
```
PUT     /user 更新使用者資料 name, image, introduction
```json
data = {
    "name": String,
    "image": String,
    "introduction": String
}
```
return
```json
{
  "ok": true,
  "user": {
    "email": "madness48596@gmail.com",
    "id": "5df0ac327beb154cd0e80f09",
    "image": "https://en.gravatar.com/userimage/114454781/cf32b5aa139921a70bd0d1c1ac760d67.jpg",
    "introduction": "test",
    "name": "Mino",
    "role": "Admin"
  }
}
```
POST    /user 新增一位使用者 email name password role image introduction
```json 
data = {
    "email": "test@gmail.com",
    "image": "https://en.gravatar.com/userimage/114454781/cf32b5aa139921a70bd0d1c1ac760d67.jpg",
    "introduction": "test",
    "name": "test",
    "role": "Nurse" // Admin|Doctor|Nurse
    "password": "test"
}
```
return
```json 
{
  "ok": true,
  "user": {
    "email": "test@gmail.com",
    "id": "5df9ec935d840723168f7786",
    "image": "https://en.gravatar.com/userimage/114454781/cf32b5aa139921a70bd0d1c1ac760d67.jpg",
    "introduction": "test",
    "name": "test",
    "role": "Nurse"
  }
}
```
POST    /user/change_password 要求資料 old_password password
```json 
data = {
    "old_password": "old_password",
    "password": "new_password"
}
```
return
```json 
{
  "ok": true,
  "user": {
    "email": "madness48596@gmail.com",
    "id": "5df0ac327beb154cd0e80f09",
    "image": "https://en.gravatar.com/userimage/114454781/cf32b5aa139921a70bd0d1c1ac760d67.jpg",
    "introduction": "test",
    "name": "Mino",
    "role": "Admin"
  }
}
```

DELETE /user/<user_id>
```json
{
  "ok": true
}
```


## Patient
GET /patient/all
return
```json
{
  "ok": true,
  "patients": {
    "count": 20,
    "entry": [
      {
        "address": "你家",
        "birthDate": "2000-01-01",
        "family": "姓氏",
        "gender": "male",
        "given": "名字",
        "id": 56,
        "identifier": "H123456789",
        "maritalStatus": "未婚",
        "phone": "0987654321"
      },
      {
        "address": "你家",
        "birthDate": "2000-01-01",
        "family": "姓氏",
        "gender": "male",
        "given": "名字",
        "id": 75,
        "identifier": "C123456789",
        "maritalStatus": "未婚",
        "phone": "電話號碼"
      },
      {
        "address": "test address",
        "birthDate": "2000-01-01",
        "family": "family",
        "gender": "female",
        "given": "given",
        "id": 76,
        "identifier": "Z123456789",
        "maritalStatus": "已婚",
        "phone": "1234567891233"
      }
    ],
    "offset": 0,
    "total": 3
  }
}
```

GET /patient/all?offset=1&count=1
return
```json 
{
  "ok": true,
  "patients": {
    "count": 1,
    "entry": [
      {
        "address": "你家",
        "birthDate": "2000-01-01",
        "family": "姓氏",
        "gender": "male",
        "given": "名字",
        "id": 75,
        "identifier": "C123456789",
        "maritalStatus": "未婚",
        "phone": "電話號碼"
      }
    ],
    "offset": 1,
    "total": 3
  }
}
```

GET /patient/<patient_id>
patient_id = Int or String
for example  56  or H123456789
```json 
// GET /patient/H123456789
{
  "ok": true,
  "patient": {
    "address": "你家",
    "birthDate": "2000-01-01",
    "family": "姓氏",
    "gender": "male",
    "given": "名字",
    "id": 56,
    "identifier": "H123456789",
    "maritalStatus": "未婚",
    "phone": "0987654321"
  }
}
// Same as GET /patient/56
{
  "ok": true,
  "patient": {
    "address": "你家",
    "birthDate": "2000-01-01",
    "family": "姓氏",
    "gender": "male",
    "given": "名字",
    "id": 56,
    "identifier": "H123456789",
    "maritalStatus": "未婚",
    "phone": "0987654321"
  }
}
```

POST /patient 新增病人
```json 
data = {
    "address": "你家",
    "birthDate": "2000-01-01",
    "family": "姓氏",
    "gender": "male",
    "given": "名字",
    "identifier": "P123456789",
    "maritalStatus": "未婚",
    "phone": "0987654321"
}
```
return
```json 
{
  "ok": true,
  "patient": {
    "address": "你家",
    "birthDate": "2000-01-01",
    "family": "姓氏",
    "gender": "male",
    "given": "名字",
    "id": 80,
    "identifier": "P123456789",
    "maritalStatus": "未婚",
    "phone": "0987654321"
  }
}
```

PUT /patient/<patient_id>
patient_id must be <font color="red"> **Int**</font>
```json 
data = {
    "address": "home",
    "birthDate": "2000-01-01",
    "family": "姓氏",
    "gender": "male",
    "given": "名字",
    "identifier": "P123456789",
    "maritalStatus": "未婚",
    "phone": "0987654321"
}
```
return
```json 
{
  "ok": true,
  "patient": {
    "address": "home",
    "birthDate": "2000-01-01",
    "family": "姓氏",
    "gender": "male",
    "given": "名字",
    "id": 80,
    "identifier": "P123456789",
    "maritalStatus": "未婚",
    "phone": "0987654321"
  }
}
```


DELETE /patient/<patient_id>
patient_id = Int or String
return
```json 
{
  "ok": true
}
```

## HealthRecord
GET /healthrecord/all
offset and count same as patient
return 
```json
{
  "healthrecords": {
    "count": 20,
    "entry": [
      {
        "code": "test code1",
        "date": "2010-10-10",
        "id": 79,
        "identifier": "H123456789",
        "medication": "test medication",
        "name": "test name11",
        "patientId": 56
      }
    ],
    "offset": 0,
    "total": 1
  },
  "ok": true
}
```

GET /healthrecord/all?patientId=<patientId>&offset=0&count=20

patient_id must be <font color="red"> **Int**</font>
return 
```json 
{
  "healthrecords": {
    "count": 20,
    "entry": [
      {
        "code": "test code1",
        "date": "2010-10-10",
        "id": 79,
        "identifier": "H123456789",
        "medication": "test medication",
        "name": "test name11",
        "patientId": 56
      }
    ],
    "offset": 0,
    "total": 1
  },
  "ok": true
}
```

GET /healthrecord/<healthrecord_id> 
healthrecord_id must be <font color="red"> **Int**</font>
```json 
{
  "healthRecord": {
    "code": "test code1",
    "date": "2010-10-10",
    "id": 79,
    "identifier": "H123456789",
    "medication": "test medication",
    "name": "test name11",
    "patientId": 56
  },
  "ok": true
}
```

POST /healthrecord 新增病例
```json 
data = {
    "code": "test code1",
    "date": "2010-10-10",
    "identifier": "H123456789",
    "medication": "test medication",
    "name": "test name11",
    "patientId": 56
}
```
return
```json 
{
  "healthRecord": {
    "code": "test code1",
    "date": "2019-12-18",
    "id": 81,
    "identifier": "H123456789",
    "medication": "test medication",
    "name": "test name11",
    "patientId": 56
  },
  "ok": true
}
```

PUT /healthrecord/<healthrecord_id>
healthrecord_id must be <font color="red"> **Int**</font>
```json 
data = {
    "code": "123123123 code1",
    "identifier": "H123456789",
    "medication": "test medication",
    "name": "test name11"
}
```
return
```json 
{
  "healthRecord": {
    "code": "123123123 code1",
    "date": "2019-12-18",
    "id": 81,
    "identifier": "H123456789",
    "medication": "test medication",
    "name": "test name11",
    "patientId": 56
  },
  "ok": true
}
```

DELETE /healthrecord/<healthrecord_id>
healthrecord_id must be <font color="red"> **Int**</font>
return
```json 
{
  "ok": true
}
```


## Management_Information
GET /management 取得所有information資料
```json
{
  "management": {
    "URLs": [
      "https://google.com",
      "https://google.com",
      "https://google.com",
      "https://google.com"
    ],
    "clinicAddress": "Default_診所位置",
    "description": "內容描述",
    "doctorDescription": "醫師介紹",
    "images": [
      "https://cdn.vuetifyjs.com/images/carousel/squirrel.jpg",
      "https://cdn.vuetifyjs.com/images/carousel/squirrel.jpg",
      "https://cdn.vuetifyjs.com/images/carousel/bird.jpg",
      "https://cdn.vuetifyjs.com/images/carousel/planet.jpg"
    ],
    "ourServices": "關於我們",
    "time": "19:00",
    "title": "網站標題"
  },
  "ok": true
}
```

PUT /management/information 更新management資料
```json
data = {
    images: List
    URLs: List
    title: String
    time: String
    description: String
    ourServices: String
    doctorDescription: String
    clinicAddress: String
}

test_data_value = {
    "images": [
      "https://cdn.vuetifyjs.com/images/carousel/squirrel.jpg",
      "https://cdn.vuetifyjs.com/images/carousel/squirrel.jpg",
      "https://cdn.vuetifyjs.com/images/carousel/bird.jpg",
      "https://cdn.vuetifyjs.com/images/carousel/planet.jpg"
    ],
    "URLs": [
      "https://google.com",
      "https://google.com",
      "https://google.com",
      "https://cms.mino.tw"
    ],
    "title": "Default_title",
    "time": "test title",
    "description": "test description",
    "ourServices": "Default_our_services",
    "doctorDescription": "Default_doctor_description",
    "clinicAddress": "Default_clinic_address"
}
```
return
```json 
{
  "management": {
    "URLs": [
      "https://google.com",
      "https://google.com",
      "https://google.com",
      "https://cms.mino.tw"
    ],
    "clinicAddress": "Default_clinic_address",
    "description": "test description",
    "doctorDescription": "Default_doctor_description",
    "images": [
      "https://cdn.vuetifyjs.com/images/carousel/squirrel.jpg",
      "https://cdn.vuetifyjs.com/images/carousel/squirrel.jpg",
      "https://cdn.vuetifyjs.com/images/carousel/bird.jpg",
      "https://cdn.vuetifyjs.com/images/carousel/planet.jpg"
    ],
    "ourServices": "Default_our_services",
    "time": "test title",
    "title": "Default_title"
  },
  "ok": true
}
```

## Management_Announcement
GET /management/announcements 取得所有announcement資料
```json
{
  "announcements": {
    "count": 20,
    "entry": [
      {
        "author": "中文",
        "context": "內容",
        "date": "2010-10-10T00:00:00",
        "id": "5dfc7e11b2b644a852c96f3b",
        "title": "標題"
      },
      {
        "author": "author",
        "context": "context",
        "date": "2010-10-10T00:00:00",
        "id": "5dfc7e2ab2b644a852c96f3c",
        "title": "title"
      }
    ],
    "offset": 0,
    "total": 2
  },
  "ok": true
}
```

GET /management/announcement/<announcements_id> 取得單一announcement資料
announcements_id is String
```json
{
  "announcement": {
    "author": "作者",
    "context": "內容",
    "date": "2010-10-10T00:00:00",
    "id": "5dfc7e2ab2b644a852c96f3c",
    "title": "標題"
  },
  "ok": true
}
```

POST /management/announcement 新增單一announcement資料
```json
data = {
    title: String
    context: String
    author: String
    date: Datatime
}
```
return
```json
{
  "announcement": {
        "id": "5dfcb42c5360146570a3d307",
        "title": "標題",
        "context": "內容",
        "author": "作者",
        "date": "2019-11-11T00:00:00"
  },
  "ok": true
}
```

PUT /management/announcement/<announcements_id> 更新單一announcement資料
announcements_id is String
```json
data = {
    title: String
    context: String
    author: String
    date: Datetime
}
```
return
```json
{
    "data": {
        "mutateAnnouncement": {
          "announcement": {
            "id": "5dfcb42c5360146570a3d307",
            "title": "標題",
            "context": "內容",
            "author": "作者",
            "date": "1990-01-01T00:00:00"
          },
          "ok": true
        }
      }
}
```

DELETE /management/announcement/<announcements_id> 刪除單一announcement資料
announcements_id is String
return
```json
{
  "ok": true
}
```




## Medication
GET /medication/all 取全部藥品資料
return
```json

  "medications": {
    "count": 20, 
    "entry": [
      {
        "contraindication": "副作用", 
        "dosage": "投藥指引", 
        "id": 1, 
        "ingredient": "成份", 
        "name": "藥品學名", 
        "patientCharacteristics": "適用", 
        "synonym": "藥品別名"
      }, 
      {
        "contraindication": "副作用", 
        "dosage": "投藥指引", 
        "id": 2, 
        "ingredient": "成份", 
        "name": "藥品學名", 
        "patientCharacteristics": "適用", 
        "synonym": "藥品別名"
      }
    ], 
    "offset": 1, 
    "total": 461
  }, 
  "ok": true
}

```
GET /medication/all?offset=1&count=2
return
```json

  "medications": {
    "count": 2, 
    "entry": [
      {
        "contraindication": "副作用", 
        "dosage": "投藥指引", 
        "id": 1, 
        "ingredient": "成份", 
        "name": "藥品學名", 
        "patientCharacteristics": "適用", 
        "synonym": "藥品別名"
      }, 
      {
        "contraindication": "副作用", 
        "dosage": "投藥指引", 
        "id": 2, 
        "ingredient": "成份", 
        "name": "藥品學名", 
        "patientCharacteristics": "適用", 
        "synonym": "藥品別名"
      }
    ], 
    "offset": 1, 
    "total": 461
  }, 
  "ok": true
}

```
GET     /medication/<medication_id> 
medication_id = Int
return
```json
{
  "medication": {
    "contraindication": "副作用", 
    "dosage": "投藥指引", 
    "id": 2,
    "ingredient": "成份", 
    "name": "藥品學名", 
    "patientCharacteristics": "適用", 
    "synonym": "藥品別名"
  }, 
  "ok": true
}
```

PUT     /medication/<medication_id> 更新藥品資料 name, contraindication, dosage, ingredient, patientCharacteristics, synonym

medication_id = Int

```json
data = {
    "name": String,
    "contraindication": String,
    "dosage": String
    "ingredient": String
    "patientCharacteristics": String
    "synonym": String
}
```
return
```json
{
    "medication": {
        "contraindication": "副作用",
        "dosage": "投藥指引",
        "id": 580101,
        "ingredient": "成分",
        "name": "藥品2學a名",
        "patientCharacteristics": "適用",
        "synonym": "藥物別名"
    },
    "ok": true
}

```
POST    /medication 新增藥品 name, contraindication, dosage, ingredient, patientCharacteristics, synonym
```json 
data =  {
    "name": "藥品學名",
    "synonym": "藥物別名",
    "ingredient": "成分",
    "contraindication": "副作用",
    "dosage": "投藥指引",
    "patientCharacteristics": "適用"
  }
```
return
```json 
{
    "medication": {
        "contraindication": "副作用",
        "dosage": "投藥指引",
        "id": 580102,
        "ingredient": "成分",
        "name": "藥品學名",
        "patientCharacteristics": "適用",
        "synonym": "藥物別名"
    },
    "ok": true
}
```

DELETE /medication/<medication_id>

medication_id = Int

```json
{
  "ok": true
}
```

## Invoice
GET /invoice/all 取得所有invoice資料
```json
{
  "invoices": {
    "count": 20,
    "entry": [
      {
        "date": "2019-10-10",
        "id": 115,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "Notation"
      },
      {
        "date": "2019-10-10",
        "id": 116,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "Notation"
      },
      {
        "date": "2011-11-11",
        "id": 117,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "notation man"
      },
      {
        "date": "2017-12-12",
        "id": 118,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "text"
      },
      {
        "date": "2017-10-21",
        "id": 120,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "test test"
      },
      {
        "date": "2002-10-10",
        "id": 121,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "I am a text. 你好。"
      },
      {
        "date": "2002-10-10",
        "id": 122,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "I am a text. 你好。"
      },
      {
        "date": "2019-12-17",
        "id": 152,
        "identifier": "A123456789",
        "name": "Name is good",
        "patientId": 56,
        "text": "I am a text."
      }
    ],
    "offset": 0,
    "total": 8
  },
  "ok": true
}
```


GET /<invoice_id> 取得單一invoice資料
invoice_id is Int
```json
{
  "invoice": {
    "date": "2019-12-17",
    "id": 152,
    "identifier": "A123456789",
    "name": "Name is good",
    "patientId": 56,
    "text": "I am a text."
  },
  "ok": true
}
```

GET /invoice?patient=<patient_id> 取得以patient_id做查詢的所有invoice資料
<patient_id> is Int
```json
{
  "invoices": {
    "count": 20,
    "entry": [
      {
        "date": "2019-10-10",
        "id": 115,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "Notation"
      },
      {
        "date": "2019-10-10",
        "id": 116,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "Notation"
      },
      {
        "date": "2011-11-11",
        "id": 117,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "notation man"
      },
      {
        "date": "2017-12-12",
        "id": 118,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "text"
      },
      {
        "date": "2017-10-21",
        "id": 120,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "test test"
      },
      {
        "date": "2002-10-10",
        "id": 121,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "I am a text. 你好。"
      },
      {
        "date": "2002-10-10",
        "id": 122,
        "identifier": null,
        "name": null,
        "patientId": 56,
        "text": "I am a text. 你好。"
      },
      {
        "date": "2019-12-17",
        "id": 152,
        "identifier": "A123456789",
        "name": "Name is good",
        "patientId": 56,
        "text": "I am a text."
      }
    ],
    "offset": 0,
    "total": 8
  },
  "ok": true
}
```


POST /invoice 新增單一invoice資料
```json
data = {
    date: Datetime
    patientId: Int
    name: String
    identifier: String
    text: String
}
```
return
```json
{
  "data": {
    "createInvoice": {
      "ok": true,
      "invoice": {
        "id": 152,
        "date": "2019-12-17",
        "patientId": 56,
        "name": "姓名 is good",
        "identifier": "A123456789",
        "text": "I am a 文字."
      }
    }
  }
}
```

## Registration
GET /registration 
return
```json
{
    "ok": true,
    "registrations": [
        {
            "birthDate": "2018-12-22",
            "id": "5dfdc220032560a0e69c2a7d",
            "identifier": "H123456789",
            "name": "姓氏名字",
            "order": 1,
            "registrationDate": "2219-12-02"
        },
        {
            "birthDate": "2018-12-22",
            "id": "5dfdc377032560a0e69c2a7e",
            "identifier": "A123456789",
            "name": "姓名",
            "order": 2,
            "registrationDate": "2219-12-02"
        },
        {
            "birthDate": "2018-12-22",
            "id": "5dfdc3dad1bbf15c3a213ac0",
            "identifier": "A123456789",
            "name": "姓名",
            "order": 3,
            "registrationDate": "2219-12-02"
        }
    ]
}
```
GET /registration/<registration_id> 
return
```json
{
    "ok": true,
    "registration": {
        "birthDate": "2018-12-22",
        "identifier": "H123456789",
        "name": "姓氏名字",
        "order": 9,
        "registrationDate": "3019-12-02"
    }
}
```

GET    /registration?identifier=H123456789
return
```json
{
    "ok": true,
    "registrations": [
        {
            "birthDate": "2018-12-22",
            "id": "5dfdc220032560a0e69c2a7d",
            "identifier": "H123456789",
            "name": "姓氏名字",
            "order": 1,
            "registrationDate": "2219-12-02"
        }
    ]
}
```

GET    /registration?date=3019-12-02
date = registrationDate
return
```json
{
    "ok": true,
    "registrations": [
        {
            "birthDate": "2018-12-22",
            "id": "5dfdc6bf6bea9fca81902c3a",
            "identifier": "A123456789",
            "name": "姓名",
            "order": 2,
            "registrationDate": "3019-12-02"
        },
        {
            "birthDate": "2018-12-22",
            "id": "5dfdc6c66bea9fca81902c3b",
            "identifier": "H123456789",
            "name": "姓氏名字",
            "order": 3,
            "registrationDate": "3019-12-02"
        }
    ]
}
```



POST    /registration 新增掛號 birthDate, identifier, registrationDate
需是已經新增的病人的identifier
```json 
data =  {
    "birthDate": "2018-12-22",
    "identifier": "A123456789",
    "registrationDate": "3019-12-02"
  }
```
return
```json 
{
    {
    "ok": true,
    "registration": {
        "birthDate": "2018-12-22",
        "id": "5dfdc7b56bea9fca81902c3c",
        "identifier": "H123456789",
        "name": "姓氏名字",
        "order": 4,
        "registrationDate": "3019-12-02"
    }
}
}
```

DELETE /registration/<registration_id>

registration_id = String
return

```json
{
  "ok": true
}
```

GET /skip
return
```json

{
    "ok": true,
    "registrations": [
        {
            "birthDate": "2018-12-22",
            "id": "5dfdc6bf6bea9fca81902c3a",
            "identifier": "A123456789",
            "name": "姓名",
            "order": 2,
            "registrationDate": "3019-12-02"
        },
        {
            "birthDate": "2018-12-22",
            "id": "5dfdc6c66bea9fca81902c3b",
            "identifier": "H123456789",
            "name": "姓氏名字",
            "order": 3,
            "registrationDate": "3019-12-02"
        }
    ]
}
```

GET /registration/next
return
```json

{
    "ok": true,
    "registrations": [
        {
            "birthDate": "2018-12-22",
            "identifier": "H123456789",
            "name": "姓氏名字",
            "order": 3,
            "registrationDate": "3019-12-02"
        }
    ]
}
```

Post /registration/time
```json
data =  {
    "time": "18:25",
  }
```
return
```json
{
    "ok": true,
    "time": "18:25"
}
```

GET /registration/order
return
```json
{
  "ok": true, 
  "order": 1,
  "total": 3
}
```
