---
# System prepended metadata

title: 第三方廠商API

---

# 第三方廠商API

## Org.-新增租戶(組織機構)

```url
POST /tenant/add
```
Request
| 欄位 | 型態 | 必填 | 說明 |
|---|---|---|---|
| name | string | Y | 租戶名稱 |
| idNo | string | | 租戶統編 |
| tenantType | string | Y | 租戶類別, DEALER: 經銷單位, HOSPITAL:醫療機構, WMT:緯創醫學 |
| dealerId | string | Y | 經銷階層租戶id |
| contact | string | Y | 聯絡人 |
| telephone | string | | 電話 |
| email | string | Y | email |
| divisions | string array | Y | 服務科別id array |
| idNo | string | | 租戶統編 |

```javascript
{
    "name": "租戶Test_DEALER22",
    "idNo": "3345678",
    "tenantType": "DEALER",
    "dealerId": "WMT",
    "contact": "小李",
    "telephone": "07-33345678",
    "email": "abc111@aaaa.aaaa",
    "divisions":[
        "db72e3a9-18f3-4f1f-a6d6-7c3370799f49"
    ]
}
```

Response
| 欄位 | 型態 | 說明 |
|---|---|---|
| id | string | 租戶 id |
| name | string | 租戶名稱 |
| idNo | string | 租戶統編 |
| tenantType | string | 租戶類別, DEALER: 經銷單位, HOSPITAL:醫療機構, WMT:緯創醫學 |
| dealerId | string | 經銷階層租戶id |
| dealerName | string | 經銷階層租戶名稱 |
| divisions | string | 服務科別 |
| contact | string | 聯絡人 |
| telephone | string | 電話 |
| status | bool | 啟用狀態, true: 啟用, false: 停用 |
| updateTime | timestamp | 最後更新時間 |

```javascript
//httpCode: 200
{
    "httpCode": 200,
    "result": {
        "data": {
            "id": "9da3256e-c940-48c2-86c2-087b24bd47b1",
            "name": "租戶Test_DEALER22",
            "idNo": "3345678",
            "tenantType": "DEALER",
            "dealerId": "WMT",
            "status": false,
            "contact": "小李",
            "telephone": "07-33345678",
            "email": "abc111@aaaa.aaaa",
            "createTime": 1610592296000,
            "updateTime": 1610592296000,
            "platformId": "WMT"
        }
    }
}

//httpCode: 422
{
    "errorMsg": "SERVICE_ERROR.DIVISION_DISABLED",
    "httpCode": 422
}
```

## account- 新增租戶管理帳號

```url
POST /account/platform-account/add
```
Request
| 欄位 | 型態 | 必填 | 說明 |
|---|---|---|---|
| name | string | Y | 姓名 |
| account | string | Y | 帳號, 格式為email |
| tenantId | string | Y | 租戶id |
| role | string | Y | 角色, 固定帶TENANT_ADMIN |
| telephone | string | | 電話 |


```javascript
{
    "name": "張三",
    "account": "aaa@abc.cc",
    "tenantId": "7a198963-e2aa-4937-92ad-c8bc9b4d926c",
    "role": "TENANT_ADMIN",
    "telephone": "07-33345678"
}
```

Response
| 欄位 | 型態 | 說明 |
|---|---|---|
| id | string | 帳號 id |
| name | string | 姓名 |
| account | string | 帳號名稱 |
| role | string | 系統內建角色, SYSTEM_ADMIN: 系統管理員, PLATFORM_ADMIN: 平台管理員, TENANT_ADMIN: 租戶管理員, TENANT_ROLE_USER: 租戶角色使用者 |
| telephone | string | 電話 |
| status | bool | 啟用狀態, true: 啟用, false: 停用 |
| updateTime | timestamp | 最後更新時間 |
| tenantId | string | 組織(租戶)id |
| tenantName | string | 組織(租戶)名稱 |

```javascript
//httpCode: 200
{
    "httpCode": 200,
    "result": {
        "data": {
            "id": "594bcf8d-a134-4efd-9366-392b8194e631",
            "name": "張三",
            "account": "wei@yopmail.com",
            "role": "TENANT_ADMIN", 
            "status": true,
            "telephone": "0987000000",
            "updateTime": 1610588709000,
            "tenantId": "7a198963-e2aa-4937-92ad-c8bc9b4d926c",
            "tenantName": "Osmile"
        }
    }
}

//httpCode: 422
{
    "errorMsg": "SERVICE_ERROR.ACCOUNT_DUPLICATE",
    "httpCode": 422
}
```

## account- 新增租戶腳色使用者帳號

```url
POST /account/tenant-account/add
```
Request
| 欄位 | 型態 | 必填 | 說明 |
|---|---|---|---|
| name | string | Y | 姓名 |
| account | string | Y | 帳號, 格式為email |
| idNo | string | | 身份證字號 |
| tenantRoleId | string | Y | 租戶角色id |
| divisionId | string | Y | 服務科別id |
| telephone | string | | 電話 |


```javascript
{
    "name": "張三",
    "account": "aaa@abc.cc",
    "idNo": "",
    "tenantRoleId": "5253249c-edd1-4bd0-b63a-3826beb9b9b2",
    "divisionId": "4bfc740f-c0b1-4f1f-bff4-a1c4e6297ae3",
    "telephone": "07-33345678"
}
```

Response
| 欄位 | 型態 | 說明 |
|---|---|---|
| id | string | 帳號 id |
| name | string | 姓名 |
| account | string | 帳號名稱 |
| idNo | string | 身份證字號 |
| tenantRoleId | string | 租戶角色id |
| tenantRoleName | string | 租戶角色名稱 |
| divisionId | string | 服務科別id |
| divisionName | string | 服務科別名稱 |
| telephone | string | 電話 |
| status | bool | 啟用狀態, true: 啟用, false: 停用 |
| updateTime | timestamp | 最後更新時間 |

```javascript
//httpCode: 200
{
  "httpCode": 200,
  "result": {
    "data": {
        "id": "594bcf8d-a134-4efd-9366-392b8194e631",
        "name": "張三",
        "account": "wei@yopmail.com",
        "tenantRoleId": "5253249c-edd1-4bd0-b63a-3826beb9b9b2", 
        "tenantRoleName": "心臟科醫師"
        "divisionId": "c09ca6f0-cef2-4348-bac4-018b6d3664da", 
        "divisionName": "心臟科",
        "status": true,
        "telephone": "0987000000",
        "updateTime": 1610588709000
    }
  }
}

//httpCode: 422
{
    "errorMsg": "SERVICE_ERROR.ACCOUNT_DUPLICATE",
    "httpCode": 422
}
```

## account- 會員註冊