iven
22ef5b6d1f
feat(core): 审计日志哈希链 — prev_hash + record_hash + 完整性验证
...
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
- 迁移 087: audit_logs 表添加 prev_hash/record_hash 列 + 索引
- audit_service::record() 写入时查询前一条 record_hash 作为 prev_hash
- SHA256(id+action+resource_type+resource_id+created_at+prev_hash) 计算 record_hash
- verify_hash_chain() 验证链完整性,返回 (总记录数, 断链数)
2026-04-27 19:38:39 +08:00
iven
633bf8c62d
feat(auth): data_scope 行级数据权限 — DataScope 枚举 + 中间件加载
...
- TenantContext 新增 permission_data_scopes: HashMap<String, DataScope>
- DataScope 枚举: All/SelfOnly/Department/DepartmentTree
- JWT 中间件查询 role_permissions.data_scope 填充到上下文
- rbac::get_data_scope() 供 service 层按权限获取数据范围
- 默认 All,完全向后兼容现有行为
2026-04-27 19:31:19 +08:00
iven
d5c9654370
fix(db): 修复迁移 084/085 SQL 语法 + RLS 动态表名查询
...
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
- 084/085: PostgreSQL DELETE 不支持 LIMIT,改用 ctid IN (SELECT ... LIMIT)
- 086: RLS 迁移改为动态查询 information_schema 获取含 tenant_id 的表,
避免硬编码表名不一致问题
- 全量测试 490 个通过(含 27 个集成测试 + RLS 验证)
2026-04-27 18:52:03 +08:00
iven
bcaeb0beef
feat(server): tenant RLS 中间件 — SET app.current_tenant_id
...
- 新增 tenant_rls_middleware:JWT 解析后 SET 租户 ID,请求结束 RESET
- 挂载到 protected router 的 JWT 层之后
- SET 失败仅 warn 不阻断(RLS 是安全网,主隔离在应用层)
- RESET 防止连接池复用时租户上下文泄漏
2026-04-27 18:41:28 +08:00
iven
b7b9f50d00
feat(db): RLS 策略迁移 — 80 张 tenant_id 表启用行级安全
...
- 所有含 tenant_id 的表(基础 34 + 健康 28 + 其他 18)启用 RLS
- 策略:未设置 app.current_tenant_id 时允许全部,设置后按 tenant_id 过滤
- down 方法完整回退(DROP POLICY + DISABLE ROW LEVEL SECURITY)
2026-04-27 18:40:07 +08:00
iven
3197dde33c
feat(core): 事件归档 + 消费者幂等性 — 迁移 084/085 + 清理任务
...
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
- 迁移 084: domain_events_archive 归档表 + cleanup_old_published_events()
- 迁移 085: processed_events 去重表 + cleanup_old_processed_events()
- erp-core: is_event_processed() / mark_event_processed() 幂等性辅助
- erp-server: tasks::start_event_cleanup() 每 24h 归档 >90 天事件
2026-04-27 18:12:43 +08:00
iven
97bb592688
feat(core): build_event_payload 统一信封 — 28 处事件发布全部迁移
...
- erp-core 添加 build_event_payload(),自动注入 schema_version + occurred_at
- erp-health 12 个 service(25 处)、erp-auth(1 处)、erp-workflow(2 处)
全部迁移到统一信封格式
2026-04-27 18:01:05 +08:00
iven
d31d7beb1f
feat(server): outbox relay 改为 LISTEN/NOTIFY + 30s 兜底轮询
...
- EventBus::publish() 持久化后执行 NOTIFY outbox_channel
- outbox relay 使用 sqlx::PgListener 监听 + tokio::select! 竞争
- 30s 兜底轮询防止 NOTIFY 丢失,断线自动重连
- 轮询间隔从 5s 提升到 30s,事件延迟降至 <100ms
2026-04-27 17:50:38 +08:00
iven
8d55d98f4f
feat(health): daily_monitoring.created 事件发布
...
日常监测记录创建后发布 domain event,payload 包含 record_id、
patient_id、record_date 及关键体征数据。
2026-04-27 17:42:12 +08:00
iven
13b23e90f4
feat(health): 消息推送集成 — 定时任务启动 + 预约提醒事件
...
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
- erp-server: 启动逾期随访检查(6h)、积分过期(24h)、预约提醒(1h) 定时任务
- appointment_service: 新增 send_reminders 扫描明日确认预约发送事件
- erp-message: 订阅 appointment.reminder 事件,向患者发送提醒消息
2026-04-27 14:51:40 +08:00
iven
dc5879228e
feat(health): 随访模板系统 — follow_up_template + template_field 全栈
...
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
新增随访模板和模板字段两张表及完整 CRUD:
- 迁移 083: follow_up_template + follow_up_template_field
- Entity: 模板(名称/类型/适用范围/状态) + 字段(标签/键名/类型/选项/校验)
- DTO: 创建时内嵌字段列表、更新支持全量替换字段
- Service: 随访类型+字段类型校验、级联软删除
- Handler: 5 端点 + RBAC 权限
- 路由: /api/v1/health/follow-up-templates
2026-04-27 14:40:28 +08:00
iven
ca96310a84
feat(health): 透析方案管理 CRUD — dialysis_prescription 全栈
...
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
新增透析方案实体和完整 CRUD:
- Entity: 20 字段含抗凝/血管通路/透析参数
- DTO: f64 类型适配 utoipa ToSchema
- Service: 抗凝类型 + 血管通路类型校验
- Handler: 5 端点 + RBAC 权限控制
- 路由: /api/v1/health/dialysis-prescriptions
2026-04-27 14:26:41 +08:00
iven
19cb2bf8bf
feat(health): 批量随访操作 — batch_create/assign/complete 三个端点
...
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
POST /health/follow-up-tasks/batch-create — 多患者同配置批量创建
POST /health/follow-up-tasks/batch-assign — 批量分配负责人
POST /health/follow-up-tasks/batch-complete — 批量标记完成
含参数校验(上限 100)、部分失败报告、事件发布、审计日志。
2026-04-27 14:01:58 +08:00
iven
a36720cbbc
feat(health): 补全事件发布 — consent/points/article 6 个领域事件
...
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
- consent.granted/revoked: 知情同意授权/撤销
- points.earned/exchanged: 积分获得/兑换
- article.published/rejected: 文章审核发布/拒绝
所有事件通过 EventBus 发布,支持跨模块订阅和审计追溯。
2026-04-27 13:33:11 +08:00
iven
a5646ddbb3
perf(health): 随访列表内联负责人名称 — 消除 N+1 查询
...
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
follow_up list_tasks 批量查询 users 表获取 assigned_to_name,
前端移除 doctorLabels 逐条请求缓存,直接使用后端内联字段。
2026-04-27 13:22:46 +08:00
iven
2519ad8fee
feat(auth): 微信 session_key 迁移到 Redis — 内存降级兜底
...
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
session_key 从全局 HashMap 迁移到 Redis(SET key EX 300 / GETDEL),
Redis 不可用时自动降级到内存缓存,提升多实例部署安全性。
2026-04-27 13:05:25 +08:00
iven
a4daa8f49c
feat(server): 健康检查增强 — 新增 /health/ready 就绪检查
...
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
- 保留 /health 轻量存活检查
- 新增 /health/ready 含 DB ping + Redis ping 并行检测
- 返回 status(ok/degraded/unavailable) + 各组件延迟和错误信息
2026-04-27 12:54:16 +08:00
iven
a2c1b5ece8
feat(db): 注册透析处方迁移 + AI Prompt 种子数据(4 个默认模板)
...
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
- 注册遗漏的 m20260427_000081_create_dialysis_prescription 迁移
- 新增 000082 种子迁移:插入 4 个 AI Prompt 模板
(化验单解读/趋势分析/体检方案/报告摘要)
2026-04-27 12:50:16 +08:00
iven
a1bc62cd5e
fix(plugin): WASM 集成测试自动构建 Component — OnceLock 线程安全
...
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
测试无法找到 .component.wasm 文件导致 6 个测试全部失败。
改进 wasm_path() 使用 OnceLock 保证只转换一次,
自动从编译产物通过 wasm-tools component new 生成。
2026-04-27 12:34:52 +08:00
iven
bab0d6619b
feat(health): 用药记录实体 — CRUD 全栈
...
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
- 迁移 080: medication_record 表(18 字段 + 频率/给药途径校验)
- Entity/DTO/Service/Handler 全链路
- 端点: GET/POST/PUT/DELETE /health/medications + /health/patients/{id}/medications
- 软删除 + 乐观锁 + 审计日志
2026-04-27 11:45:49 +08:00
iven
67f2d07809
feat(health): 体征增加体温/SpO2/血糖类型字段
...
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
- 迁移 079: vital_signs 表新增 body_temperature/spo2/blood_sugar_type 列
- Entity/DTO/Service 全链路支持新字段
- blood_sugar_type: fasting/postprandial/random/ogtt
- daily_monitoring 兼容层补全新字段为 None
2026-04-27 11:31:40 +08:00
iven
7e66561a5f
fix(health): 统一随访类型为 5 种 — phone/outpatient/home_visit/online/wechat
...
- validation.rs: face_to_face 替换为 outpatient,新增 home_visit/wechat
- FollowUpTaskList.tsx: 新增 online 选项,与后端对齐
- 迁移 078: follow_up_task + follow_up_record face_to_face → outpatient
2026-04-27 11:20:57 +08:00
iven
6a7d83ec4d
refactor(health): 集中管理事件类型常量 + 积分过期发布事件
...
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
- event.rs 新增 20 个事件类型常量(PATIENT_CREATED 等)
- 10 个 service 文件引用常量替代硬编码字符串
- expire_points 增加 EventBus 参数,处理完成后发布 points.expired 事件
- start_points_expiration_checker 传入 EventBus
2026-04-27 11:11:33 +08:00
iven
0929825ae7
perf(health): alert_engine 批量预加载 + 内存匹配替代逐规则DB查询
...
批量查询 cooldown 期间所有 alerts 和最近 hourly 记录,
在内存中完成 cooldown 检查和规则匹配。
N规则评估从 2N+ 次查询降为 2 次批量查询。
2026-04-27 09:55:39 +08:00
iven
0a387c189a
perf(health): get_health_summary 4次串行查询改为 tokio::join! 并行
...
总延迟从 sum(4次查询) 降为 max(4次查询),预估延迟降低约75%。
2026-04-27 09:52:31 +08:00
iven
04c5f3c0d5
perf(health): stats_service 合并 COUNT 为 GROUP BY + 宏化 compute_avg_field
...
get_follow_up_statistics: 4次独立COUNT合并为1次GROUP BY GROUPING SETS。
compute_avg_field: format! 动态拼接改为宏生成静态SQL,利用PG prepared statement缓存。
2026-04-27 09:50:10 +08:00
iven
4a5dbaeaeb
feat(health): consultation/follow_up 列表 API 内联 patient_name/doctor_name
...
consultation session list 添加 patient_name/doctor_name,
follow_up task list 添加 patient_name,批量查询消除 N+1。
DTO 新增 Option 字段,向后兼容。
2026-04-27 09:39:46 +08:00
iven
432f6e3554
feat(health): appointment list API 内联 patient_name/doctor_name
...
列表查询后批量获取 patient 和 doctor 名称,消除前端 N+1 请求。
DTO 新增 patient_name/doctor_name Option 字段,向后兼容。
2026-04-27 09:34:04 +08:00
iven
c09f6ecdc8
perf(health): upsert_hourly_aggregates 批量化 — 批量查询+insert_many
...
将逐组查询+更新/插入改为一次批量查询所有已存在记录,
分为"新增"和"更新"两组,新增用 insert_many() 一次性插入。
查询次数从 N 降为 1+更新数。
2026-04-27 09:29:55 +08:00
iven
59a22e762d
fix: 审计修复 — SSE事件监听 + 软删除列表 + 页面配置
...
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
- [HIGH] 前端 SSE store 补充 alert/vital_update 事件监听
- [LOW] seed.rs 软删除列表补充 device_readings
- [LOW] 小程序 device-sync 补充 index.config.ts 页面配置
2026-04-27 09:27:30 +08:00
iven
587f51c0c1
perf(health): batch_insert_readings 改为 SeaORM insert_many 批量插入
...
逐条 INSERT(最多 500 次 DB 往返)替换为构建 Vec<ActiveModel>
后一次性 insert_many(),延迟降低 95%+。
2026-04-27 09:26:41 +08:00
iven
3424a33b6b
fix(miniprogram): 小程序审计修复 — 安全加固+功能链路+输入验证
...
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
安全修复:
- H1: Token 刷新竞态条件 → Singleton Promise 模式防止并发刷新
- H4: 移除 store 中的 token 明文状态,统一走 secure storage
- H5: 登录/绑定手机号添加 loading 防重复点击保护
- H6: Analytics 改用 request.ts 统一请求层,不再绕过认证
- M1: logout 清理所有残留数据(openid/tenant_id/analytics_queue)
- M2/M7: 敏感数据(user/openid/tenant_id)统一走加密存储
- M3: 移除开发日志中的请求体打印
- M4: secure-storage 解密失败返回 null 而非空串
功能修复:
- F1: 今日体征概览 API 支持 patient_id 查询参数(后端+前端)
- F2: 积分商城对无患者档案用户展示引导 UI
- M6: daily-monitoring 添加 Zod 数值范围验证
清理:
- L4: 移除 devLogin 开发辅助函数
2026-04-27 00:41:30 +08:00
iven
5b81a0051f
docs: 修正测试策略 spec 的事实性错误
...
修正 spec review 发现的问题:
- C-1: TestDb 实际是本地 PostgreSQL 隔离,非 Testcontainers
- C-2: E2E 已有 4 spec/10 测试,非零测试
- 补充 6 个遗漏的 service(alert/daily_monitoring/critical_value_threshold 等)
- 增加 Phase 0 基础设施搭建
- 修正 CI 配置(增加 PostgreSQL service、验证链)
- 补充 5 个遗漏风险项和回退策略
- 统一"全量 80%"目标的准确含义
2026-04-27 00:21:02 +08:00
iven
ac919731a9
fix: QA 全量测试发现 5 个 bug 修复
...
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
- [P0] 登录失败无反馈: client.ts 响应拦截器跳过 /auth/login 的 401 处理,让错误传播到 Login 组件
- [P0] 统计仪表盘 400: 前端用独立 try/catch 替代 Promise.all 提高容错性;后端 stats_service 白名单补充 ultrafiltration_volume/dialysis_duration
- [P1] 随访负责人显示 UUID: 批量解析 assigned_to 用户名
- [P2] 消息中心时间未格式化: 添加 formatDateTime 函数
- [P2] 首页显示 login_failed: 过滤审计日志中的 login_failed 动作
2026-04-26 23:48:22 +08:00
iven
96b952c32e
fix(health): 文章列表 API 补充 version 字段
...
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
文章列表 ArticleListItem 缺少 version 字段,导致前端提交审核
时 version 为 undefined,请求体序列化为 {},后端报 422。
补充 DTO 字段和 service 映射。
2026-04-26 22:22:08 +08:00
iven
787e64d9a9
fix: 前端深度审计全量修复 — 安全/功能/代码质量
...
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
严重 BUG 修复:
- 修复 Token 过期后 hash 重定向导致无法跳转登录页
- 修复文章编辑器新建后提交审核使用错误 ID
安全加固:
- HTML 清理函数替换为 ammonia 专业库(替代自定义解析器)
- 文件上传添加 magic bytes 校验(防 Content-Type 伪造)
- 登录添加账户级失败锁定(5次失败→15分钟锁定)
- 审计日志 9 个关键更新操作补充变更前后值(with_changes)
功能缺陷修复:
- 登录/登出时清理 API 缓存(防多账户数据污染)
- 文章编辑器上传改用统一 HTTP 客户端(自动 token 刷新)
- 添加全局 HTTP 错误处理和后端错误消息展示
- PrivateRoute 增加路由级权限检查(系统管理页面)
- 健康数据三个 Tab 添加编辑/删除功能
- 预约创建增加排班可用性校验提示
- 医生详情 API 返回解密后的原始执照号
代码清理:
- 删除未使用的 auth.ts refresh() 函数
- 删除重复的 AuthGuard.tsx 组件
- 删除未使用的 getHealthSummary API
2026-04-26 21:47:26 +08:00
iven
f0c3426792
fix(health): 医生详情 API 返回解密后的原始执照号,不再脱敏
...
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
model_to_resp_decrypted 错误地对解密后的 license_number
调用 mask_license_number,导致详情 API 返回脱敏值
(YL****23) 而非完整原始值 (YL-2024-00123)。
修复:详情/创建/更新响应只做解密不做脱敏,列表 API
仍然将 Tier 1 字段设为 None。
2026-04-26 21:31:41 +08:00
iven
8a253a4910
fix: 低优先级收尾 — 图片上传/语言编辑/插件恢复/URL 编码
...
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
- P3-2: ArticleEditor 图片上传接入 /upload 端点 + 封面图上传按钮
- P4-3: recover_plugins 添加 tenant 日志 + 同 ID 去重保护
- P4-4: LanguageManager 编辑弹窗改为真实表单 (name 字段) + 后端 name 持久化
- P4-6: Settings API getSetting/updateSetting 添加 encodeURIComponent
2026-04-26 19:52:42 +08:00
iven
b05b7c27a0
feat: 审计修复 Phase 6-7 — SSE 推送/工作流补全/消息群发/前端收尾
...
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
Phase 6 功能补全:
- P1-3: 消息 SSE 实时推送端点 + 前端 EventSource 连接
- P1-6: ServiceTask HTTP 调用能力 (reqwest GET/POST)
- P1-7: user.deleted 事件处理 — 终止相关流程实例
- P1-8: 任务认领 (claim) 端点 + handler
- P1-9: 超时检查器发布 task.timeout 事件
- P1-15: 组织/部门名称唯一性校验 (create + update)
- P1-18: 消息群发 fan-out (role/department/all 批量投递)
Phase 7 P3-P4 收尾:
- PluginAdmin purge 按钮状态修复
- ChangePassword 最小 8 字符 + 新旧密码不同验证
- AuditLogViewer 用户名缓存 + 扩展资源类型
- InstanceMonitor 通过 definition 缓存解析 node_name
- NotificationPreferences DND 时间范围校验
2026-04-26 19:44:04 +08:00
iven
83fe89cbcd
fix: 全系统审计问题修复 — 安全/数据完整性/功能缺陷/UX (Phase 1-5)
...
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
Phase 1 安全热修复:
- P0-1: /uploads 文件服务添加 JWT 认证中间件(支持 header + query param)
- P0-2: analytics/batch 路由从 public 移到 protected_routes
- P0-3: plugin engine SQL 注入修复(format! → 参数化查询)
- P0-new: stats_service compute_avg_field 字段白名单 + FLOAT8 类型转换
Phase 2 数据完整性:
- P0-4: 组织删除级联检查(添加部门存在性校验)
- P0-5: 部门删除级联检查(添加岗位 + 用户存在性校验)
- P0-8: workflow on_tenant_deleted 实现 5 实体批量删除
- P0-7: 并行网关 race condition 修复(consumed → completed 原子转换)
Phase 3 P1 后端 Bug:
- P1-12: plugin host 表名消毒(使用 sanitize_identifier)
- P1-10: workflow deprecated 状态转换(published → deprecated)
- P1-11: workflow 更新验证条件(nodes/edges 任一变化即验证)
- P0-9: 小程序 .gitignore 添加 .env/.env.*/日志
- P1-19: 小程序加密密钥替换为 64 字符强密钥
Phase 4 消息模块:
- P1-5: 通知偏好 GET 路由 + handler
- P1-4: 消息模板 update/delete CRUD + version
- P2-8: mark_all_read SQL 添加 version + 1
- P2-7: markAsRead 改为乐观更新 + 失败回滚
Phase 5 前端修复:
- P2-9: 通知面板点击导航到 /messages
- P2-1: 随访任务患者名批量 ID 解析(替代 UUID 显示)
- P2-5: AppointmentList 分离 patient_id/doctor_id 分别调用 API
- P2-17: PluginMarket installed 字段修正(name → id)
- P3-3: 路由标题 fallback 改为模式匹配(支持 :id 动态路径)
- P2-15: workflow updateDefinition 添加 version 字段
- P3-9: Kanban 版本使用记录实际 version
- P2-21: secure-storage 生产环境无密钥时阻止存储
- P3-11: destroyOnHidden → destroyOnClose
- P3-13: PendingTasks 深色模式 Tag 颜色适配
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-04-26 19:16:23 +08:00
iven
a19b097409
refactor(health): 状态转换验证统一到 validation 模块
...
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
- article/dialysis/lab_report 审核流程改用 validation 函数校验状态转换
- 移除 article_service/approve/reject/unpublish 中硬编码的 if 检查
- dialysis review 和 lab report review 新增前置状态校验
- 修正 article 状态转换图:pending_review → published(直接发布,无中间 approved)
2026-04-26 14:44:01 +08:00
iven
4f4a44ddb6
test(health): 补充 article/dialysis/lab_report 状态转换验证 + 83 单元测试
...
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
- validate_article_status (枚举白名单) + validate_article_status_transition
(draft→pending_review→approved→published, rejected→pending_review, published→draft)
- validate_dialysis_status + validate_dialysis_status_transition
(draft→completed→reviewed)
- validate_lab_report_status_transition (pending→reviewed)
- 全部 83 个 validation 测试通过
2026-04-26 14:35:19 +08:00
iven
7a9054c914
feat: 医护仪表盘增强 + 患者端文章分类浏览
...
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
- DoctorDashboard 增加 pending_dialysis_review/pending_lab_review/today_appointments
- 医护小程序首页增加「健康审核」区块(待审透析/化验/今日预约)
- 患者端文章列表增加分类 tabs 横向滚动筛选
- article service 增加 listCategories + category_id 筛选
2026-04-26 14:25:06 +08:00
iven
c9bf5f6139
feat(health): 健康数据统计 — 透析/化验/预约/体征上报率
...
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
- 新增 6 个统计端点: dialysis, lab-reports, appointments,
vital-signs-report-rate, health-data(综合)
- 透析统计: 类型分布/并发症率/平均超滤/平均时长
- 化验统计: 类型分布/异常项计数/审核状态
- 预约统计: 状态/类型分布/取消率
- 体征上报率: 月度上报率 + 近 7 天趋势
- Web 统计面板增加健康数据中心区块
2026-04-26 14:19:38 +08:00
iven
55ec57b2c0
feat(health): 积分规则/商品 update/delete + 标签更新端点
...
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
- 积分规则: 添加 update/delete service + handler + 路由
- 兑换商品: 添加 update/delete service + handler + 路由
- 文章标签: 添加 update service + handler + 路由
- Web 管理端: 规则/商品列表页支持编辑/删除/启用切换
- Web 管理端: 标签管理页支持编辑、删除传 version
2026-04-26 14:07:21 +08:00
iven
f0076aa240
feat: Iteration 3 — 咨询轮询、统计概览、埋点后端
...
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
- consultation_service 支持 after_id 增量消息查询
- 小程序咨询详情页 8 秒轮询新消息
- 新增 DashboardStatsResp 综合统计端点 (/statistics/dashboard)
- 新增 /analytics/batch 埋点接收端点(日志记录模式)
2026-04-26 13:54:21 +08:00
iven
0cf69815d9
feat: 通知分发器 DND 检查 + 咨询/报告事件 + 线下活动页面
...
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
Iteration 2 剩余工作:
通知分发器改进(erp-message module.rs):
- 添加 should_skip_for_dnd() 免打扰检查(urgent 级别不受限)
- DND 支持跨午夜窗口(如 22:00-08:00)
- 新增 consultation.new_message 事件(患者发消息通知医生)
- 新增 lab_report.reviewed 事件(报告审核完成通知患者)
- 改进已有事件:预约确认含日期、随访逾期含患者名
积分前端补充:
- points.ts 新增 OfflineEvent/EventRegistration 接口 + API
- 新增线下活动列表页面(报名/人数/积分奖励)
- 注册 events 页面路由
2026-04-26 13:43:54 +08:00
iven
7ab57ea1b2
fix(health): PII 加密安全审计修复 — 2 Critical + 6 Medium + 4 Low
...
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
审计发现 55 检查点,46 PASS / 7 WARN / 2 FAIL,修复内容:
Critical:
- C1: 密钥轮换端点现在持久化新 DEK 到 tenant_crypto_keys 表
- C2: CachedDek 实现 Drop trait,释放时清零密钥材料
Medium:
- M1: 密文格式添加版本前缀 0x01,向后兼容旧格式
- M2: HMAC 索引使用独立子密钥,与加密 KEK 分离
- M4: 脱敏函数使用 chars() 迭代器,UTF-8 安全
- M5-M6: 医生执业证号详情响应脱敏 (mask_license_number)
Low:
- L1: dek_manager 改为 pub(crate),暴露 invalidate_dek() 方法
- L3: 合并 patient 列表搜索中冗余的重复 HMAC 计算
- L4: update_family_member/update_doctor 更新时设置 key_version
2026-04-26 13:34:25 +08:00
iven
a0b72b0f73
feat: Iteration 1 — 审计日志IP记录、文件上传、医护端API、小程序角色切换
...
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
Iteration 1 六项任务全部完成:
1. 审计日志IP记录 — task_local RequestInfo 自动注入 IP/user_agent
2. 文件上传服务 — multipart 上传 + ServeDir 静态文件服务
3. 医护端后端API — 医生工作台仪表盘 + 患者标签CRUD + 会话已读
4. 小程序角色切换 — 登录后根据角色跳转医护台/患者首页
5. 小程序安全加固 — secure-storage 开发模式警告
6. 讨论记录归档 — docs/discussions/
2026-04-26 13:13:25 +08:00
iven
ebc0f20e33
test(health): PII 加密集成测试 + 性能基准 + 编译修复
...
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
- 10 个集成测试: CRUD 加密流(8) + 多租户隔离(2)
- 3 个性能基准: encrypt avg 17μs, decrypt avg 14μs, 批量50条 877μs
- 8 个 key_manager 单元测试 + 4 个 masking 边界测试
- 迁移: 加宽 emergency_contact_phone/phone/license_number/result 列
- 修复: follow_up_service.create_record 返回密文改为解密返回
- 修复: consultation_service/patient_service HealthError::NotFound 引用
2026-04-26 13:10:53 +08:00