yl-frontend/api-docs/medical-api.txt

278 lines
5.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

医疗管理模块接口文档
================
基础信息
-------
- 基础路径: /api/v1/medical
- 请求方式: REST
- 数据格式: JSON
- 认证方式: Bearer Token
数据结构
-------
HealthData 健康数据对象:
{
id: number, // 数据ID
type: string, // 数据类型
value: string, // 数据值
unit: string, // 单位
time: string, // 记录时间
status: string // 状态(normal/warning/danger)
}
MedicineReminder 用药提醒对象:
{
id: number, // 提醒ID
medicine: string, // 药品名称
time: string, // 服药时间
status: string, // 状态(pending/done)
dosage: string, // 剂量
notes?: string // 备注说明
}
Appointment 预约对象:
{
id: number, // 预约ID
date: string, // 预约日期
time: string, // 预约时间
department: string, // 科室
doctor: string, // 医生
status: string, // 状态(pending/confirmed/cancelled)
description?: string // 预约说明
}
MedicalRecord 医疗记录对象:
{
id: number, // 记录ID
date: string, // 记录日期
type: string, // 记录类型
title: string, // 标题
description: string, // 描述
doctor: string, // 医生
hospital: string, // 医院
attachments?: Array<{// 附件
name: string, // 文件名
url: string, // 文件URL
type: string // 文件类型
}>
}
API 接口
-------
1. 获取健康数据
GET /api/v1/medical/health-data
响应示例:
{
"code": 200,
"message": "success",
"data": [
{
"id": 1,
"type": "bloodPressure",
"value": "120/80",
"unit": "mmHg",
"time": "2024-03-20 08:00",
"status": "normal"
}
]
}
2. 获取用药提醒
GET /api/v1/medical/medicine-reminders
响应示例:
{
"code": 200,
"message": "success",
"data": [
{
"id": 1,
"medicine": "降压药",
"time": "08:00",
"status": "pending",
"dosage": "1片",
"notes": "饭后服用"
}
]
}
3. 添加用药提醒
POST /api/v1/medical/medicine-reminders
请求参数:
{
"medicine": "降压药",
"time": "08:00",
"dosage": "1片",
"notes": "饭后服用"
}
4. 更新用药状态
PUT /api/v1/medical/medicine-reminders/{id}/status
请求参数:
{
"status": "done" // pending/done
}
5. 获取预约列表
GET /api/v1/medical/appointments
响应示例:
{
"code": 200,
"message": "success",
"data": [
{
"id": 1,
"date": "2024-03-25",
"time": "09:30",
"department": "心内科",
"doctor": "张医生",
"status": "confirmed",
"description": "常规检查"
}
]
}
6. 创建预约
POST /api/v1/medical/appointments
请求参数:
{
"date": "2024-03-25",
"time": "09:30",
"department": "心内科",
"doctor": "张医生",
"description": "常规检查"
}
7. 取消预约
POST /api/v1/medical/appointments/{id}/cancel
8. 获取医疗记录
GET /api/v1/medical/records
响应示例:
{
"code": 200,
"message": "success",
"data": [
{
"id": 1,
"date": "2024-03-15",
"type": "examination",
"title": "年度体检",
"description": "各项指标正常",
"doctor": "王医生",
"hospital": "市第一医院",
"attachments": [
{
"name": "体检报告.pdf",
"url": "https://example.com/report1.pdf",
"type": "pdf"
}
]
}
]
}
9. 添加医疗记录
POST /api/v1/medical/records
请求参数:
{
"date": "2024-03-15",
"type": "examination",
"title": "年度体检",
"description": "各项指标正常",
"doctor": "王医生",
"hospital": "市第一医院",
"attachments": []
}
10. 上传文件
POST /api/v1/medical/upload
Content-Type: multipart/form-data
11. 生成健康报告
GET /api/v1/medical/health-report
响应示例:
{
"code": 200,
"message": "success",
"data": {
"url": "https://example.com/health_report.pdf"
}
}
12. 获取可预约时间段
GET /api/v1/medical/available-times
请求参数:
| 参数名 | 类型 | 必填 | 说明 |
| date | string | 是 | 日期 |
| department| string | 是 | 科室 |
响应示例:
{
"code": 200,
"message": "success",
"data": [
"09:00",
"09:30",
"10:00",
"10:30"
]
}
13. 获取医生列表
GET /api/v1/medical/doctors
请求参数:
| 参数名 | 类型 | 必填 | 说明 |
| department| string | 是 | 科室 |
响应示例:
{
"code": 200,
"message": "success",
"data": [
{
"id": 1,
"name": "张医生",
"title": "主任医师"
}
]
}
错误码说明
--------
| 错误码 | 说明 |
| 200 | 成功 |
| 400 | 请求参数错误 |
| 401 | 未授权 |
| 403 | 禁止访问 |
| 404 | 资源不存在 |
| 500 | 服务器内部错误 |
注意事项
-------
1. 日期格式统一使用YYYY-MM-DD
2. 时间格式统一使用HH:mm
3. 文件上传要求:
- 支持格式jpg、png、pdf
- 单个文件大小限制10MB
- 批量上传限制最多5个文件
4. 预约规则:
- 提前24小时预约
- 每个时段限额5人
- 同一科室每天最多预约1次
5. 数据安全:
- 所有医疗数据需要加密存储
- 定期备份医疗记录
- 敏感信息脱敏展示