fix: QA 第二轮修复 — PatientDetail 重构/测试覆盖/id_number 列宽/小程序 URL 规范化
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

- refactor(web): PatientDetail.tsx 拆分为 4 个子组件(737→334行)
- refactor(web): 提取 usePaginatedData hook 消除重复分页状态
- feat(db): patient.id_number varchar(20)→varchar(255) 容纳加密值
- test(health): 添加预约模块集成测试(创建/列表/租户隔离)
- test(plugin): 添加 6 个 SQL 注入 sanitize 测试
- fix(miniprogram): 7 个 service 文件 URL 构建规范化(params 对象)
- fix(miniprogram): 跨平台字段名对齐(birth_date/start_time/end_time)
This commit is contained in:
iven
2026-04-25 10:22:44 +08:00
parent 55a3fd32d0
commit 0bf1822fa9
34 changed files with 1110 additions and 641 deletions

View File

@@ -35,6 +35,8 @@ React 19.2.4 / Ant Design 6.3.5 / React Router 7.14.0 / Zustand 5.0.12 / Vite 8.
| `apps/web/src/api/` | 21 个 API 服务文件 |
| `apps/web/vite.config.ts` | Vite 配置 + API 代理 |
> 微信小程序(患者端)是独立前端项目,详见 [[miniprogram]]
### 路由结构
**公开**: `/login`
@@ -100,4 +102,5 @@ ws://localhost:5174/ws/* → ws://localhost:3000/* (WebSocket)
| 日期 | 变更 |
|------|------|
| 2026-04-24 | 添加小程序交叉引用 |
| 2026-04-23 | 重构为 5 节结构,更新为当前完整前端状态 |

View File

@@ -10,6 +10,7 @@
| 数据库表 | 30+ 基础表 + 16 健康业务表(规划中) |
| 核心模块 | 5 基础 (auth/config/workflow/message/plugin) + 1 业务 (health) |
| 健康模块页面 | 13 个(规划中) |
| 微信小程序 | Taro 4.2 + React 18 + TypeScript |
| API 文档 | `http://localhost:3000/api/docs/openapi.json` |
## 症状导航
@@ -24,6 +25,9 @@
| 端口被占用 | [[infrastructure]] dev.ps1 | 端口 5174-5189 进程 | 残留 Vite 进程 |
| 预约超额 | [[erp-health]] 排班并发 | appointment CAS 操作 | 并发控制未走原子 CAS |
| 跨租户数据泄漏 | [[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` 列 |
## 模块导航
@@ -44,6 +48,9 @@
### 组装层
- [[erp-server]] — Axum 入口 · AppState · 模块注册 · 后台任务 · 优雅关闭
### 患者端
- [[miniprogram]] — **微信小程序** · Taro 4.2 · 微信登录 · 手机绑定 · 健康数据查看
### 基础设施
- [[infrastructure]] — 连接信息 · 环境变量 · 一键启动 (**单一真相源**)
- [[database]] — SeaORM 迁移 · 多租户表结构

View File

@@ -58,6 +58,16 @@ curl -s http://localhost:3000/api/v1/auth/login \
Accessibility / SEO / Best Practices 均 100LCP 840msCLS 0.02
### 微信小程序验证
```bash
cd apps/miniprogram && pnpm build:weapp # 构建
# 在微信开发者工具中打开 apps/miniprogram 项目
# 点击"编译" → 勾选协议 → 点击"微信一键登录"
```
验证点:登录成功 → 首页加载 → 各 Tab 页面可访问
## 3. 代码逻辑
### 集成契约
@@ -104,5 +114,6 @@ SELECT code, name FROM permissions WHERE deleted_at IS NULL ORDER BY code; --
| 日期 | 变更 |
|------|------|
| 2026-04-24 | 添加微信小程序验证步骤 |
| 2026-04-23 | 重构为 5 节结构,去除与 infrastructure.md 重复 |
| 2026-04-18 | Lighthouse 审计 + 性能优化 |