fix(recall): 引擎两缺口 — 0命中关闭遗留plan + wholeMouth全口病牙位忽略
修"正畸/牙周误召"(40393fbe)后暴露的两个独立引擎缺口。 缺口1(主):0 命中时不关闭遗留 active plan recomputeForPatient 在 hits.length===0 时直接 return,runAllForHost 只遍历 hitsByPatient(有命中的患者)→ 患者治完疗变 0 命中后,旧召回 plan 永远残留召回池(status 一直 active,该结案却不结)。 修复: - recomputeForPatient 0 命中 → closeStaleActivePlan supersede 关闭 该患者 active(非 assigned)plan。 - runAllForHost upsert 循环后,扫该 (host,tenant) 全部 status='active' plan,凡不在本轮 hitsByPatient 的 supersede 关闭。 - 纪律:按 tenant 限定;assigned 不动(客服跟进中);终态不动; 不建后继版本(无信号是终结,非版本演进);循环后扫避免误关本轮新 active。 - 新增 plansClosed 计数(EngineRunResult + recomputeForPatient 返回 + CLI 日志)。 缺口2(次):scenario 排除/聚类不消费 wholeMouth flag K05 标了 wholeMouth(牙周全口病)但 ⑤a 排除 SQL / tooth-overlap 聚类 都没消费 → K05 诊断带具体牙位(如@38)、牙周治疗在别的牙(@36)时被当 单牙不重叠 → 误召 perio_no_srp@38。 修复:wholeMouth 码把"信号牙位"统一替换成 NULL(sigToothExpr)→ - ⑤a 第一分支"信号无牙位"恒真 → category 级排除 - ⑤c/⑤e"信号有牙位"守卫恒假 → 单颗拔除/冠桥不误终结全口病 - 主 SELECT tooth=null → 聚类归 'whole' cluster(sub_key=...@whole) K07 经临床确认正畸=全牙弓矫治,同加 wholeMouth(K07 + ORTHO_CONSULT_RECOMMENDED),消除残留 3 例 ortho 误召。 测试:plan-engine-stale-close.spec.ts 覆盖 - 有命中→0命中→plan 被关闭(recomputeForPatient 4 例 + runAllForHost 3 例) - wholeMouth flag 标注防漂移(K05/K07/SRP/ORTHO 标,K02/K04/K08 不标) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Showing
Please
register
or
sign in
to comment