POST /api/auth/register
POST /api/auth/login
POST /api/auth/login/phone-code
POST /api/auth/sms/send-code
POST /api/auth/sms/verify
GET /api/auth/me
PUT /api/auth/password
POST /api/auth/2fa/setup
POST /api/auth/2fa/enable
POST /api/auth/2fa/disable
GET /api/auth/oauth/providers
GET /api/profile
PUT /api/profile
GET /api/records?record_type=&start=&end=
POST /api/records
POST /api/records/import
GET /api/records/device-providers
POST /api/records/device-providers/{provider}/authorize
GET /api/records/device-providers/{provider}/callback
POST /api/records/sync-device
GET /api/records/export?format=csv|xlsx|pdf
PUT /api/records/{id}
DELETE /api/records/{id}
GET /api/dashboard/summary
GET /api/recommendations?refresh=true
POST /api/assistant/chat
POST /api/assistant/agent
GET /api/assistant/status
GET /api/assistant/knowledge/search?q=
GET /api/diet/plans
POST /api/diet/generate
GET /api/exercise/plans
POST /api/exercise/generate
GET /api/mental/emotions
POST /api/mental/emotions
GET /api/consultations
POST /api/consultations
GET /api/consultations/{id}
PUT /api/consultations/{id}
GET /api/consultations/{id}/profile # 医生角色查看患者档案
POST /api/consultations/{id}/room # 创建 WebRTC 问诊房间
WS /api/consultations/{id}/ws # WebSocket 信令:join/offer/answer/ice/chat/leave
GET /api/consultations/{id}/signals
POST /api/consultations/{id}/signals
GET /api/consultations/doctors
GET /api/reminders
POST /api/reminders
GET /api/reminders/due
GET /api/reminders/notification-channels
POST /api/reminders/test-email
PUT /api/reminders/{id}
DELETE /api/reminders/{id}
健康管理系统(Web 端 MVP)
一个面向「普通用户 / 健康管理师 / 医生」的 AI 辅助健康管理 Web 系统,包含完整的前后端可运行 MVP。
当前进度
截至 2026-05-28,项目处于 本地可运行 MVP / 前后端联调完成 阶段:
比赛亮点
/dashboard、/assistant/records、/settings/exercise/consultation/mental/login、/records、/settingsdocs/评分标准对应说明
backend/tests/、frontend/tests/docs/business-feasibility.mddocs/operation-plan.md、docs/test-report.md如何演示给评委看
建议按 6-8 分钟节奏演示:
demo@health.cn / demo1234登录,说明系统定位为 AI 健康管理 Web MVP。doctor@health.cn / doctor1234登录查看医生回复流程。docs/business-feasibility.md、docs/operation-plan.md、docs/test-report.md,说明商业与运营交付已补齐。当前已完成 / 生产需配置
交付文档
目录结构
快速开始
1. 启动后端
需要 Python 3.10 及以上。
开发环境默认会在启动时执行 Alembic 迁移并写入演示数据。访问:
2. 启动前端
需要 Node.js 18.18+ 或 20+。
打开浏览器访问 http://localhost:3000,使用演示账号登录。
3. 本地验证
Playwright e2e 默认连接
http://127.0.0.1:3000和http://127.0.0.1:8000。如服务未启动,测试会在全局初始化阶段给出启动命令提示;可通过E2E_FRONTEND_BASE_URL、E2E_API_BASE_URL、E2E_EMAIL、E2E_PASSWORD覆盖默认地址和账号。演示账号
普通用户已带 7 天健康记录、情绪打卡、提醒,登录后可直接体验 Dashboard 与 AI 建议。新库种子数据中普通用户手机号为
13800000000;仅当后端设置SMS_PROVIDER=demo时,登录页手机号验证码会返回明确标记的演示验证码,不会发送真实短信。切换到 PostgreSQL
编辑
backend/.env:并补装驱动:
pip install psycopg2-binary。重启后端即可。切换到 MySQL
编辑
backend/.env:执行
pip install -r requirements.txt后重启后端。开发环境会自动执行 Alembic 迁移;生产环境请先手动执行alembic upgrade head,再启动服务。数据库迁移
后端已使用 Alembic 管理数据库结构。常用命令需在
backend/目录执行:默认本地开发配置:
DB_AUTO_MIGRATE=true:启动后端时自动执行迁移。DB_SEED_ENABLED=true:首次启动写入演示账号和演示数据。生产部署要求:
APP_ENV=productionAPP_DEBUG=falseDB_AUTO_MIGRATE=falseDB_SEED_ENABLED=falsealembic upgrade headSECRET_KEY必须替换为 32 位以上随机值,CORS_ORIGINS只能填写真实 HTTPS 前端域名。完整生产部署流程见 生产部署加固指南,包含环境变量、MySQL 初始化、Alembic、前端构建、Nginx/HTTPS 和备份策略。
核心功能
/login、/register/profile/records/records、/settings/dashboard/diet/exercise/mental/assistant/consultation/reminders/settings手动测试主流程
demo@health.cn / demo1234登录。doctor@health.cn / doctor1234登录可看到收到的咨询并回复。WEBRTC_TURN_URLS,局域网或部分 NAT 可用,生产环境需配置 TURN。API 概览
后端统一以
/api为前缀,主要路由:完整 OpenAPI 在 http://localhost:8000/docs。
未完成项与后续建议
MVP 阶段已补齐基础能力,仍需外部服务密钥或生产基础设施支撑的项目:
RTCPeerConnection协商;生产环境仍需部署 TURN 服务并做多网络浏览器回归。.env中填写 SMTP 配置。设计取舍
AI_API_KEY时返回明确错误,不生成模拟 AI 结果。created_at/updated_at一致:模型层有TimestampMixin复用。api/deps.py提供require_roles装饰,方便后续扩展专业 / 医生 / 管理员权限。