# treatment_review — 复查 / 拆线 / 暂观 / 无治疗 等流程性事实
# 消费 transforms 输出表 treatment_review_rows(route_by_pattern 已分流)
# 全部 fact 都打 category='review'(canonical-codes 第 11 类)
canonical: treatment

emits:
  action: treatment_planned
  subjectType: treatment
  occurredAtField: occurredAt
  kind: planned   # 复查 / 暂观 都是"未来安排"语义,kind=planned

primary:
  table: treatment_review_rows
  key: treat_external_id
  dedup_by: treat_external_id

field_mapping:
  externalId:                  treat_external_id
  patientExternalId:           patient_id
  clinicId:                    organization_id
  occurredAt:                  rq
  sourceEncounterExternalId:   emr_id
  category:                    category_raw    # transforms 已固定填 _review_sentinel
  subtype:                     treat_name      # 原始动作名("常规复查"/"拆线"等)
  toothPosition:               tooth_position

enum_mapping:
  category:
    _review_sentinel: review
