# recommendation — 医生建议("建议种植"/"建议拔除"等,EMR.treat_plan 路由产物)
# 消费 transforms 输出表 recommendation_rows(route_by_pattern starts_with ['建议','推荐'] 命中)
canonical: recommendation

emits:
  action: recommendation_extracted
  subjectType: recommendation
  occurredAtField: occurredAt

primary:
  table: recommendation_rows
  key: rec_external_id
  dedup_by: rec_external_id

field_mapping:
  externalId:        rec_external_id
  patientExternalId: patient_id
  clinicId:          organization_id
  occurredAt:        rq
  code:              treat_name             # "建议种植" 等 → enum_mapping 翻译到 PAC 推荐码
  toothPosition:     tooth_position

# treat_name 自由文本,enum_mapping cover 高频"建议 XX"白名单
# 长尾 _default: '' parser 跳过(不入 recommendation_record fact)
enum_mapping:
  code:
    # ── 种植 ──
    建议种植:           IMPLANT_RECOMMENDED
    建议种植修复:       IMPLANT_RECOMMENDED
    推荐种植:           IMPLANT_RECOMMENDED
    建议种植治疗:       IMPLANT_RECOMMENDED
    建议种植牙:         IMPLANT_RECOMMENDED

    # ── 戴冠 / 修复 ──
    建议戴冠:           CROWN_RECOMMENDED
    建议冠修复:         CROWN_RECOMMENDED
    建议全冠:           CROWN_RECOMMENDED
    建议桩核冠:         CROWN_RECOMMENDED
    建议做冠:           CROWN_RECOMMENDED
    推荐冠修复:         CROWN_RECOMMENDED

    # ── 充填 ──
    建议充填:           FILLING_RECOMMENDED
    "建议充填。":        FILLING_RECOMMENDED
    建议树脂充填:       FILLING_RECOMMENDED
    建议补牙:           FILLING_RECOMMENDED

    # ── 牙周基础 ──
    建议洁牙:           SRP_RECOMMENDED
    建议龈上洁治:       SRP_RECOMMENDED
    建议牙周治疗:       SRP_RECOMMENDED
    建议牙周基础治疗:   SRP_RECOMMENDED

    # ── 拔除 ──
    建议拔除:           EXTRACTION_RECOMMENDED
    "建议拔除。":        EXTRACTION_RECOMMENDED
    建议拔牙:           EXTRACTION_RECOMMENDED
    推荐拔除:           EXTRACTION_RECOMMENDED

    # ── 复查 ──
    建议年度复查:       ANNUAL_REVIEW_RECOMMENDED
    建议定期复查:       ANNUAL_REVIEW_RECOMMENDED
    建议复查:           ANNUAL_REVIEW_RECOMMENDED

    # ── 正畸咨询 ──
    建议正畸咨询:       ORTHO_CONSULT_RECOMMENDED
    建议正畸:           ORTHO_CONSULT_RECOMMENDED
    建议矫正:           ORTHO_CONSULT_RECOMMENDED

    _default: ""    # 未识别"建议X" → 丢弃(后续 Layer C LLM 抽取增强)
