liuyun 2792dc7e34 chore(openspec): 归档 C4 质控闸门 change
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-15 07:25:19 +08:00

39 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Context
C3 已有 ho_record(submitted)、abnormal(handle_status)、C2 的 plan.change、C1 的 elder。C4 新增质控闸门,纯新增、不侵入脚手架。设计背景见 `docs/superpowers/specs/2026-10-15-服务机构端-C4质控闸门-design.md`。
## Goals / Non-Goals
**Goals:** qc + ho_record_correction 两表、全量质控(定时任务)、放行/退回(4001 自审自放行)、五类推送聚合、异常联动改计划、补正、admin 质控中心页。
**Non-Goals:** 上报池(二期)、真推送(APP 期)、APP 补正录入、家属端。
## Decisions
1. **表命名**:`qc`(无前缀)、`ho_record_correction`(补正属留痕域 ho_)。
2. **全量质控**:`@Cron` 每小时扫描 submitted 无 qc → 生成 qc(pending)。
3. **qc 生命周期**:pending → passed/returned;退回补正后 recheck(first_qc_id)。
4. **放行自检**:四要素(1004) → 必拍(3001) → 幂等 → 非自审(4001)。
5. **五类推送** = pending/list 跨表聚合(异常/逾期/住院/计划/待质控),带消除条件。
6. **异常联动改计划**:复用 plan.change + link_plan_change。
7. **补正**:ho_record_correction 新增说明,不改原记录;≥3 次进质控重点。
8. **批量放行**:排除异常/未执行项/临时加项/时长异常/补正过。
## 数据模型
qc(id/tenant_code/record_id/qc_type/qc_result/qc_note/qc_staff_id/qc_time/pass_time/first_qc_id,SOFT_DELETE)、ho_record_correction(id/tenant_code/record_id/qc_id/correction_note/corrected_by/corrected_at,子表不入 SOFT_DELETE)。UUID v7、@map snake_case、utf8mb4_general_ci。
## 接口
qc:GET /qc/pending/list、GET /qc/detail、POST /qc/pass、POST /qc/return、POST /qc/exception/link、POST /qc/correct、POST /qc/batch-pass。权限码 qc.*;错误码域 46;规则号 1004/3001/4001 写 message。
## Risks / Trade-offs
- 定时任务延迟(≤1h)→ 可后续改 checkout 同步。
- 补正=新增说明(不可无痕修改)→ 合规。
- 自审自放行 4001 → 单人机构必须再配审的人(PRD 底线)。
## Migration Plan
新增 2 表(utf8mb4_general_ci 手改)。迁移链损坏:migrate diff + 手工目录 + deploy。