You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.9 KiB
1.9 KiB
07-健康档案模块
目标
实现用户健康档案的查询和管理功能,提供完整的健康信息视图。
前置要求
- 健康调查模块已完成
- 体质辨识模块已完成
实施步骤
详细代码请参考原文档 02-后端开发/07-健康档案模块.md
主要任务
-
创建用户 Service
internal/service/user.go- 获取用户资料
- 更新用户资料
- 获取完整健康档案
-
创建用户 Handler
internal/api/handler/user.go -
更新完整路由配置
-
更新主程序完整版
API 接口
| 方法 | 路径 | 说明 | 认证 |
|---|---|---|---|
| GET | /api/user/profile | 获取用户资料 | 是 |
| PUT | /api/user/profile | 更新用户资料 | 是 |
| GET | /api/user/health-profile | 获取健康档案 | 是 |
| PUT | /api/user/health-profile | 更新健康档案 | 是 |
| GET | /api/user/lifestyle | 获取生活习惯 | 是 |
| PUT | /api/user/lifestyle | 更新生活习惯 | 是 |
健康档案数据结构
interface FullHealthProfile {
basic_info: {
name: string;
gender: string;
height: number;
weight: number;
bmi: number;
blood_type: string;
};
lifestyle: {
sleep_time: string;
wake_time: string;
exercise_frequency: string;
};
medical_history: Array<{ disease_name: string; status: string }>;
family_history: Array<{ relation: string; disease_name: string }>;
allergy_records: Array<{ allergen: string; severity: string }>;
constitution: {
primary_type: string;
primary_name: string;
assessed_at: string;
};
}
验收标准
- 获取用户资料正常
- 获取完整健康档案正常
- 更新资料和生活习惯正常
- 所有 API 接口可正常调用
- 服务器启动日志完整
预计耗时
30-40 分钟
下一步
完成后进入 04-后端开发/08-保健品商城关联模块.md