# image — FRIDAY 影像 metadata(MySQL emr.med_check;PAC 不持文件本体)
# 影像不在 Mongo 病历文档内(全字段枚举证实),挂 emr_id(10 位病历号)回病历。
# 消费 transforms 输出表 image_rows(med_check lookup std_check_class 附 class_name)
canonical: image

emits:
  action: image_uploaded
  subjectType: image
  occurredAtField: uploadedAt

primary:
  table: image_rows
  key: id
  dedup_by: id

field_mapping:
  externalId:           id
  updatedAt:            updated_gmt_at
  createdAt:            created_gmt_at
  patientExternalId:    patient_id
  clinicId:             organization_id
  uploadedAt:           shooting_time     # 拍摄时间
  encounterExternalId:  emr_id            # 病历号级挂载(= med_emr_info.emr_id,非 emr_sub_id)
  modality:             class_name        # lookup 自 std_check_class 字典
  fileUrl:              file_url          # OSS 相对路径(passthrough)
  fileName:             file_name

# ── 字典分层:真影像类型名共享(与 jvs-dw 实测同名);FRIDAY 特有名目留本地 ──
dict_includes:
  - ../../_shared/dict/image-modality.yaml

enum_mapping:
  modality:
    # FRIDAY 特有:胸片(987d743a 字典)→ 非口腔影像归 other;
    # 3a9d9c68 字典乱录("测试"/"1"/"11")与 lookup 未命中(class_name=null)→ _default
    胸片:                         other
    _default:                     other
