API DOC for health_normal (一般健檢 API 介接文件)
===

## **API 列表**

- [POST] `/api/health-normal/store`
- [GET]  `/api/health-normal/sheets/all`
- [GET]  `/api/health-normal/sheets/employee/{eid}`
- [GET]  `/api/health-normal/sheet/{id}`
- [POST] `/api/health-normal/update/{id}`

## **Create** (上傳) 

#### **Method:** POST
#### **Url:** `/api/health-normal/store`
#### **Body**

```
{
    "employee_id": 1,
    "exam_date": "2024-01-01",
    "file": [Object file],               // optional
    "checkitems": [
        {
            "health_normal_exam_id": 1,
            "result": false,
        },
        {
            "health_normal_exam_id": 2,
            "result": false,
        },
        {
            "health_normal_exam_id": 3,
            "result": false,
        },
        ...
    ],
}
```

## **Read** (獲取) 一家工廠的所有員工一般健檢資訊

#### **Method:** GET
#### **Url:** `/api/health-normal/sheets/all`
#### **Response**

```
[
    {
        "id": 1,
        "memberid": "001",
        "name_zh": "陳小華",
        "last_exam": "2022-10-01",
        "next_exam": "2023-10-01",
        ...
        "state": "合格",
    },
    {
        ...
    }
]
```

## **Read** (獲取) 一個員工新增過的所有一般健檢

####  **Method:** GET
####  **Url:** `/api/health-normal/sheets/employee/{eid}`
- eid: employee_id
#### **Response:**

```
[
    {
        "id": 2,
        "employee_id": 3,
        "exam_date": "2022-09-01",
        "result": true,
        "created_at": ...,
        "updated_at": ...,
    },
    {
        ...
    }
]
```
- result is ordered by exam_date => updated_at => created_at

## **Read** (獲取) 一張健檢的詳細資訊

####  **Method:** GET
####  **Url:** `/api/health-normal/sheet/{id}`
- id: health sheet id
#### **Response:**

```
{
    id: 1,
    employee_id: 1,
    exam_date: "2021-01-02",
    result: false,
    created_at: "2021-02-03",
    updated_at: "2021-02-04",
    details: [
        {
            id: 1,
            employee_health_normal_exam_id: 2,
            health_normal_exam_id: 1,
            result: false,
        },
        {
            id: 2,
            employee_health_normal_exam_id: 2,
            health_normal_exam_id: 2,
            result: false,
        },
        ...
    ],
    upload: {
        id: 2,
        employee_health_normal_exam_id: 10,
        upload_name: "filename.pdf",
        upload_path: "/path/to/upload/file/filename.pdf",
        origin_name: "三軍總醫檢查報告.pdf"
    },
}
```

## **Update** (更新) 

####  **Method:** POST
####  **Url:** `/api/health-normal/update/{id}`
- id: health sheet id
#### **Body:**

```
{
    "id": 1,
    "employee_id": 1,
    "exam_date": "2024-01-01",
    "file": [Object file],      // optional
    "checkitems": [
        {
            id: 1,
            "health_normal_exam_id": 1,
            "result": false,
        },
        {
            id: 2,
            "health_normal_exam_id": 2,
            "result": false,
        },
        {
            id: 3,
            "health_normal_exam_id": 3,
            "result": false,
        },
        ...
    ],
}
```
