From 1326b3e504c2a22dcce4e214e6b322a807a3f22f Mon Sep 17 00:00:00 2001 From: iven Date: Sun, 26 Apr 2026 13:12:34 +0800 Subject: [PATCH] =?UTF-8?q?docs(wiki):=20=E6=9B=B4=E6=96=B0=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97=20=E2=80=94=20?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E6=95=B0/=E6=9D=83=E9=99=90/=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2/=E7=8A=B6=E6=80=81=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - index.md: 数据库表 18→22, 页面 62→66, 健康 15→19 页面 - erp-health.md: 21 实体, 15 权限, 审核状态机, 分类/标签 API --- wiki/erp-health.md | 44 +++++++++++++++++++++++++++++++++----------- wiki/index.md | 10 +++++----- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/wiki/erp-health.md b/wiki/erp-health.md index ed7ba28..f050c14 100644 --- a/wiki/erp-health.md +++ b/wiki/erp-health.md @@ -1,8 +1,8 @@ --- title: erp-health 健康管理模块 -updated: 2026-04-25 +updated: 2026-04-26 status: implemented -tags: [health, patient, appointment, follow-up, consultation] +tags: [health, patient, appointment, follow-up, consultation, content] --- # erp-health 健康管理模块 @@ -47,16 +47,16 @@ crates/erp-health/ │ ├── state.rs ← HealthState { db, event_bus, crypto } │ ├── crypto.rs ← AES-256-GCM 加密 + HMAC-SHA256 (PII 保护) │ ├── event.rs ← 事件处理器 (订阅 workflow/message 事件) -│ ├── entity/ ← 18 个 SeaORM Entity (872 行) -│ ├── service/ ← 11 个业务 service (4122 行) -│ ├── handler/ ← 7 个路由 handler (1493 行) -│ ├── dto/ ← 7 个请求/响应 DTO (814 行) +│ ├── entity/ ← 21 个 SeaORM Entity +│ ├── service/ ← 14 个业务 service +│ ├── handler/ ← 9 个路由 handler +│ ├── dto/ ← 7 个请求/响应 DTO │ ├── validation.rs ← 输入验证逻辑 (302 行, 57 纯函数测试) │ ├── masking.rs ← PII 数据脱敏 (手机号/身份证) │ └── seed.rs ← 租户种子数据 + 软删除清理 ``` -### 实体模型(18 个实体,对应数据库表 + 1 个文章实体) +### 实体模型(21 个实体) | 域 | 实体 | |----|------| @@ -66,9 +66,9 @@ crates/erp-health/ | 预约排班 | appointment, doctor_schedule | | 随访管理 | follow_up_task, follow_up_record | | 咨询管理 | consultation_session, consultation_message | -| 内容管理 | article | +| 内容管理 | article, article_category, article_tag, article_article_tag, article_revision | -### 权限码(14 个) +### 权限码(15 个) | 权限码 | 说明 | |--------|------| @@ -79,6 +79,7 @@ crates/erp-health/ | `health.consultation.list` / `health.consultation.manage` | 咨询查看/管理 | | `health.doctor.list` / `health.doctor.manage` | 医护查看/管理 | | `health.articles.list` / `health.articles.manage` | 文章查看/管理 | +| `health.articles.review` | 文章审核 | ### 集成契约 @@ -111,7 +112,14 @@ crates/erp-health/ - `/consultation-sessions` — 咨询会话管理 + 消息 + 导出 + 关闭 - `/consultation-messages` — 咨询消息发送 - `/doctors` — 医护档案 CRUD -- `/articles` — 健康文章 CRUD +- `/articles` — 健康文章 CRUD + 审核状态机(draft→pending_review→published) +- `/articles/{id}/submit` — 提交审核 +- `/articles/{id}/approve` — 批准发布 +- `/articles/{id}/reject` — 拒绝(附原因) +- `/articles/{id}/unpublish` — 撤回已发布文章 +- `/articles/{id}/view` — 增加阅读计数 +- `/article-categories` — 分类 CRUD +- `/article-tags` — 标签 CRUD ### 预约并发控制 @@ -130,6 +138,18 @@ pending → confirmed → completed pending → cancelled ``` +### 文章审核状态机 + +``` +draft → pending_review → published → draft (撤回) + → rejected → pending_review (重新提交) +``` + +- `submit` — draft/rejected → pending_review +- `approve` — pending_review → published(自动设置 published_at、reviewed_by) +- `reject` — pending_review → rejected(附 review_note) +- `unpublish` — published → draft + ### PII 数据保护 - `HealthCrypto`: AES-256-GCM 加密敏感字段,HMAC-SHA256 哈希身份证号 @@ -149,7 +169,7 @@ pending → cancelled ### 当前状态: ✅ 已完成 -18 实体、14 权限、13 Web 页面、20 小程序页面,全链路流通性验证通过。 +21 实体、15 权限、19 Web 页面、20 小程序页面,全链路流通性验证通过。 ### 待优化 @@ -169,10 +189,12 @@ pending → cancelled | 随访管理 | 创建→进行→完成 | 随访列表/操作 | ✅ | | 咨询管理 | 创建会话+消息 | 咨询列表/导出 | ✅ | | 患者详情 | 详情/编辑/标签 | 详情页+健康数据标签 | ✅ | +| 内容管理 | 文章CRUD+审核状态机 | 列表/编辑器/分类/标签 | ✅ | ## 5. 变更记录 | 日期 | 变更 | |------|------| | 2026-04-25 | 全面更新为已实现状态:18 实体、14 权限、全链路验证通过 | +| 2026-04-26 | 新增内容管理:article_category/article_tag/article_article_tag/article_revision 4 实体、审核状态机、分类/标签 CRUD、富文本编辑器(+4 实体 = 21 总实体,+1 权限 = 15 总权限,+4 前端页面 = 19 总页面) | | 2026-04-23 | 创建模块 wiki 页,设计规格确认 | diff --git a/wiki/index.md b/wiki/index.md index 143c382..6fadf84 100644 --- a/wiki/index.md +++ b/wiki/index.md @@ -7,17 +7,17 @@ | 指标 | 值 | |------|-----| | Rust crate | 16 个(erp-core + 6 基础业务 + erp-health + erp-ai + 6 插件 + erp-plugin-prototype) | -| 数据库表 | 30 基础表 + 18 健康业务表 + 3 AI 表(已实现) | +| 数据库表 | 30 基础表 + 22 健康业务表 + 3 AI 表(已实现) | | 数据库迁移 | 55 个 | | 核心模块 | 5 基础 (auth/config/workflow/message/plugin) + 2 业务 (health + ai) | -| Web 前端页面 | 62 个 TSX 组件(含 15 健康管理页面) | +| Web 前端页面 | 66 个 TSX 组件(含 19 健康管理页面) | | 健康模块组件 | 12 个共享组件(StatusTag/PatientSelect/DoctorSelect/VitalSignsChart 等) | | 微信小程序 | Taro 4.2 + React 18,27 个页面 | | 前端单元测试 | 3 个(vitest)+ 4 E2E spec(playwright) | | 后端测试 | 36 个(workspace)+ 57 validation 纯函数测试 | | 总代码量 | Rust ~57k 行 + 前端 TSX/TS ~174 文件 | | API 文档 | `http://localhost:3000/api/docs/openapi.json` | -| Git 提交 | 270 次 | +| Git 提交 | 273 次 | ## 症状导航 @@ -52,7 +52,7 @@ - erp-plugin — WASM 运行时 · 动态表 · 热更新(HMS 保留但非主要扩展方式) ### 核心业务层(HMS 专属) -- [[erp-health]] — **患者管理 · 健康数据 · 预约排班 · 随访管理 · 咨询管理**(原生 Rust 模块,已实现) +- [[erp-health]] — **患者管理 · 健康数据 · 预约排班 · 随访管理 · 咨询管理 · 内容管理**(原生 Rust 模块,已实现) - [[erp-ai]] — **AI 智能分析 · 化验单解读 · 趋势分析 · 报告摘要**(原生 Rust 模块,开发中) ### 组装层 @@ -64,7 +64,7 @@ ### 基础设施 - [[infrastructure]] — 连接信息 · 环境变量 · 一键启动 (**单一真相源**) - [[database]] — SeaORM 迁移 · 多租户表结构 -- [[frontend]] — React 19 SPA · 健康管理页面(15 页面 + 12 组件) +- [[frontend]] — React 19 SPA · 健康管理页面(19 页面 + 12 组件) - [[testing]] — 验证清单 · 测试分布 · 性能基准 ## 核心架构问答