# recommendation — FRIDAY 医生建议("建议根管治疗"/"建议拔除"等;treat[] route 分流产物)
# 实测 153 行(建议充填/建议拔除/建议根管治疗…),经共享 recommendation-code 字典翻召回码。
# code 用归一后的 value_norm("建议充填," → "建议充填" 精确命中;长尾靠共享 keyword 兜底)。
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
  updatedAt:                   updated_gmt_at
  createdAt:                   created_gmt_at
  patientExternalId:           patient_id
  clinicId:                    organization_id
  occurredAt:                  clinic_time
  sourceEncounterExternalId:   emr_sub_id
  code:                        value_norm       # "建议种植" 等 → 共享字典翻 PAC 推荐码
  name:                        value            # 医生原文(病历忠实展示;长尾建议靠它)
  toothPosition:               tooth_position
  doctorId:                    user_id
  doctorName:                  user_name

# ── 字典分层:标准"建议X"词典(enum+keyword)全在共享文件 ──
dict_includes:
  - ../../_shared/dict/recommendation-code.yaml

enum_mapping:
  code:
    _default: ""    # 未识别"建议X" → 共享 keyword 兜底;再不中 → 丢弃(不入 fact)
