# treatment_review — FRIDAY 流程性事实(复查/暂观/观察等;treat[] route 分流产物)
# 全部 fact 打 category='review'(canonical-codes 第 11 类);chain S4"已复查"信号源。
# kind=actual:treat[] = 本次治疗(用户确认),复查/观察是"本次确实做的"流程事件。
# 注:拆线不入 review(route 词表已排除)—— 按 jvs-dw 2026-06-11 一线判例,
#    拆线=术后护理=外科治疗动作,归 actual→surgical(见 treatment_actual.yaml 本地 enum)。
canonical: treatment

emits:
  action: treatment_completed
  subjectType: treatment
  occurredAtField: occurredAt
  kind: actual

primary:
  table: treatment_review_rows
  key: treat_external_id
  dedup_by: treat_external_id

field_mapping:
  externalId:                  treat_external_id
  updatedAt:                   updated_gmt_at
  createdAt:                   created_gmt_at
  patientExternalId:           patient_id
  clinicId:                    organization_id
  occurredAt:                  clinic_time
  sourceEncounterExternalId:   emr_sub_id
  category:                    category_raw     # transforms 已固定填 _review_sentinel
  subtype:                     value            # 原始动作名("复查"/"暂观"等)
  toothPosition:               tooth_position
  doctorId:                    user_id
  doctorName:                  user_name

enum_mapping:
  category:
    _review_sentinel: review
