Files
hms/wiki/index.md
iven 75cd305996
Some checks failed
CI / security-audit (push) Has been cancelled
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
docs(wiki): 全景梳理 — 更新 9 个 wiki + CLAUDE.md scope + 头脑风暴记录
基于 3 个并行探索代理的全面扫描结果,更新 wiki 数据至实际状态:
- index.md: 18 crate / 76 迁移 / 44 实体 / 77k 行 / 409 提交
- erp-health.md: 44 实体 / 21 handler / 22 权限 / 25 事件 / 6 消费者
- erp-server.md: 9 后台任务 / RLS 中间件栈
- architecture.md: 新增 erp-ai/dialysis 到依赖图 / 测试覆盖表
- testing.md: 225 单元 + 159 集成 / 4 模块零测试警告
- database.md: 76 迁移 / RLS+哈希链+盲索引+Dead Letter
- erp-core.md: PiiCrypto 加密体系 / EventBus 完整描述
- frontend.md: 163 文件 / 5 store / 10 API 文件
- CLAUDE.md: 新增 health/ai/dialysis/assessment scope

头脑风暴 4 个议题决策:
- dialysis: 接入激活
- 测试: 按风险排序(workflow > ai > message > config)
- AI: 数据桥接优先
- 路线图: AI 驱动 3 个月 5 Phase
2026-04-28 14:53:04 +08:00

7.4 KiB
Raw Blame History

HMS 健康管理平台 — 知识库

Health Management System (HMS) — 面向体检中心/医疗机构的综合健康管理平台。从 ERP 底座分叉,继承身份权限/工作流/消息/配置等基础能力,erp-health 原生模块承载医疗业务。

关键数字

指标
Rust crate 18 个erp-core + 5 基础业务 + erp-health + erp-ai + erp-dialysis + erp-plugin + 5 插件 + erp-plugin-prototype
数据库表 30 基础表 + 44 健康业务表 + 3 AI 表(已实现)
数据库迁移 76 个
核心模块 5 基础 (auth/config/workflow/message/plugin) + 3 业务 (health + ai + dialysis)
erp-health 实体 44 个 Entity~21k 行 Rust
erp-ai 实体 3 个 Entity1.7k 行 Rust
Web 前端 92 TSX + 71 TS = 163 个源文件(含 25+ 健康路由页面 + 11 健康组件)
微信小程序 Taro 4.2 + React 1840 个页面31 患者端 + 9 医护端5 个 TabBar
前端单元测试 5 个vitest+ 5 E2E specplaywright
后端测试 225 单元 + 159 集成(含 18 个健康模块集成测试文件)
总代码量 Rust ~77k 行459 源文件)+ Web 前端 163 文件 + 小程序 125 文件
API 文档 http://localhost:3000/api/docs/openapi.json
Git 提交 409 次
UI/UX 重构 Phase 1-5 完成6 共享组件 + 4 角色仪表盘 + 个人统计数据 + 表单抽屉 + 小程序优化)

症状导航

症状 先查 再查 常见根因
API 返回 403 权限码检查 wasm-plugin 权限系统 权限码不匹配 / 缺少 .list 权限
API 返回 500 无日志 erp-core 错误链 后端 tracing 输出 AppError::Internal 静默
数据库连接失败 infrastructure PostgreSQL 服务状态 服务未启动 / 环境变量未设置
前端 401 刷新时 frontend auth store API client token 刷新 token 过期未主动刷新
迁移执行失败 database PostgreSQL 日志 表冲突 / 唯一索引 + 软删除 / 缺失迁移文件
端口被占用 infrastructure dev.ps1 端口 5174-5189 进程 残留 Vite 进程
预约创建 400 doctor_id is required erp-health 预约并发控制 AppointmentList.tsx 医生字段为必填(后端 CAS 要求)
预约超额 erp-health 排班并发 appointment CAS 操作 并发控制未走原子 CAS
患者创建 422 birth_date trailing input frontend 日期序列化 DatePicker dayjs 对象 未格式化为 YYYY-MM-DD 字符串
跨租户数据泄漏 architecture 多租户策略 database tenant_id 查询缺少 tenant_id 过滤
小程序页面空白 miniprogram defineConstants process.env 未替换 编译时未注入环境变量
小程序登录失败 btoa is not defined miniprogram secure-storage Web API 不可用 使用 Taro.arrayBufferToBase64 替代
微信登录 500 database wechat_users 表结构 Entity 字段与表不匹配 created_by/updated_by/version
迁移文件缺失报错 database 迁移注册 migration/src/lib.rs 已应用的迁移文件被删除,需创建 stub
MCP 连接失败 split error miniprogram MCP 联调 project.config.json 未开启 automationAudits
MCP mp_screenshot 超时 miniprogram MCP 联调 automator 已知 bug page_getElement 替代截图
MCP 导航后跳回登录页 miniprogram MCP 联调 §6.4 storage 被清空 明文 token 写入后立即 reLaunch
MCP token 注入后仍 401 miniprogram MCP 联调 §6.1 用了生产构建 dev 构建(NODE_ENV=development+ 空密钥
积分商城 Tab 页空白 miniprogram 待优化 未关联患者档案 需增加降级 UI 引导建档
MCP 批量审计页面栈溢出 miniprogram MCP 联调 §6.6 navigateTo 超 10 层 改用 reLaunch 逐页测试

模块导航

基础层(继承自 ERP 底座)

  • erp-core — 错误体系 · 事件总线 · 模块 trait · 共享类型
  • architecture — 架构决策 · 设计原则 · 技术选型

业务层(继承自 ERP 底座)

  • erp-auth — 用户/角色/权限/组织/部门/岗位 · JWT · RBAC · 行级数据权限
  • erp-config — 字典/菜单/设置/编号规则/主题/语言
  • erp-workflow — BPMN 解析 · Token 驱动 · 任务分配
  • erp-message — 消息 CRUD · 模板 · 订阅 · 通知面板
  • erp-plugin — WASM 运行时 · 动态表 · 热更新HMS 保留但非主要扩展方式)

核心业务层HMS 专属)

  • erp-health患者管理 · 健康数据 · 预约排班 · 随访管理 · 咨询管理 · 内容管理 · 积分商城 · 透析管理 · 线下活动 · 日常监测 · 告警系统(原生 Rust 模块44 实体,已实现)
  • erp-aiAI 智能分析 · 化验单解读 · 趋势分析 · 报告摘要(原生 Rust 模块3 实体Phase 1 MVP

组装层

  • erp-server — Axum 入口 · AppState · 7+ 模块注册 · 后台任务 · 优雅关闭

患者端

  • miniprogram微信小程序 · Taro 4.2 · 微信登录 · 手机绑定 · 健康数据查看

基础设施

  • infrastructure — 连接信息 · 环境变量 · 一键启动 (单一真相源)
  • database — SeaORM 迁移 · 多租户表结构76 迁移)
  • frontend — React 19 SPA · 健康管理页面25+ 路由 + 11 组件)
  • testing — 验证清单 · 测试分布 · 性能基准

核心架构问答

为什么 erp-health 用原生模块而非 WASM 插件? 医疗业务需要 18 强类型实体、自定义 API趋势分析/统计报表)、文件上传(化验单/体检报告)、未来 AI 集成,超出 WASM 插件能力范围。详见 erp-health

模块间如何通信? erp-core EventBus 发布/订阅 DomainEvent。erp-health 发布 patient.createdappointment.confirmed 等事件,订阅 workflow.task.completed 等。详见 architecture

多租户怎么隔离? 共享数据库 + tenant_id 列过滤,中间件从 JWT 注入。详见 database architecture

患者/医护与 erp-auth 的关系? 账号走 userserp-health 通过 user_id 外键关联扩展字段(科室、职称、档案等)。患者可先建档后绑定账号。

文档索引

类型 位置
健康模块设计规格 docs/superpowers/specs/2026-04-23-health-management-module-design.md
AI 模块设计规格 docs/superpowers/specs/2026-04-25-erp-ai-module-design.md
内容管理设计规格 docs/superpowers/specs/2026-04-26-content-management-design.md
PII 加密扩展规格 docs/superpowers/specs/2026-04-26-pii-encryption-expansion-design.md
实时体征管线探讨 docs/superpowers/specs/2026-04-26-realtime-vital-signs-pipeline-design.md
平台复盘与演进 docs/superpowers/specs/2026-04-26-platform-retrospective-and-evolution-design.md
设计规格(全量) docs/superpowers/specs/ (31 份)
UI/UX 重构设计规格 docs/superpowers/specs/2026-04-28-ui-ux-overhaul-design.md
UI/UX 重构实施计划 docs/superpowers/plans/2026-04-28-ui-ux-overhaul-plan.md
实施计划(全量) docs/superpowers/plans/ (27 份)
讨论记录 docs/discussions/ (10 份)
协作规则 CLAUDE.md
插件制作指南 .claude/skills/plugin-development/SKILL.md