Add Employee Hospital
เพิ่มโรงพยาบาลตามสิทธิของพนักงาน
Endpoint
POST /api/v1/open-apis/employee/add-employee-profile?path_action=hospitalQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path_action | string | Yes | ต้องเป็น hospital |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
employee_code | string | Yes | รหัสพนักงาน (ไม่ต้อง encode Base64) |
hospital_name | string | Yes | ชื่อโรงพยาบาล |
hospital_link_flag | string | No | ประเภทสิทธิ (01, 02, 03) ค่า default: 01 |
Option Values
hospital_link_flag
| Value | Description (TH) | Description (EN) |
|---|---|---|
01 | ประกันสังคม | Social Security |
02 | ประกันอื่นๆ | Insurance Other |
03 | สวัสดิการ | Welfare |
หากไม่ระบุ hospital_link_flag ระบบจะใช้ค่า default เป็น "01" (ประกันสังคม)
Response Format
Success Response
{
"code": 200,
"message": "Add Hospital Success",
"payload": {
"employee_hospital_id": "20260121HP01D2E3F4A5",
"hospital_name": "โรงพยาบาลกรุงเทพ"
}
}Response Fields
| Field | Type | Description |
|---|---|---|
employee_hospital_id | string | ID ของโรงพยาบาลที่สร้าง (Plain text) |
hospital_name | string | ชื่อโรงพยาบาลที่สร้าง |
Error Response
{
"code": 400,
"message": "Validation failed",
"errors": ["Missing required parameter: 'employee_code'"]
}Validation Rules
| Field | Rule |
|---|---|
employee_code | ต้องระบุและต้องมีพนักงานในระบบ |
hospital_name | ต้องระบุและต้องไม่เป็นค่าว่าง |
hospital_link_flag | ไม่บังคับ ถ้าระบุต้องเป็นค่า 01, 02, 03 |
Code Examples
cURL
curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/employee/add-employee-profile?path_action=hospital" \
-H "Content-Type: application/json" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
-d '{
"employee_code": "EMP001",
"hospital_name": "โรงพยาบาลกรุงเทพ",
"hospital_link_flag": "01"
}'Notes
- Endpoint นี้ใช้
employee_code(Plain text) ไม่ใช่employee_id(Base64) - Response field
employee_hospital_idเป็น Plain text ไม่ได้ encode Base64 - สามารถเพิ่มโรงพยาบาลได้หลายรายการต่อพนักงาน 1 คน
- ระบบจะสร้าง
employee_hospital_idและบันทึก timestamp อัตโนมัติ
Related APIs
- List Hospitals - ดึงรายการโรงพยาบาลตามสิทธิทั้งหมด
- Get Hospital - ดึงข้อมูลโรงพยาบาลตามสิทธิตาม ID
- Update Hospital - แก้ไขโรงพยาบาลตามสิทธิ
- Delete Hospital - ลบโรงพยาบาลตามสิทธิ
Last updated on