# patient_return_visit — 诊所回访任务记录(展示用,5 试点)
#
# 消费 sql_source.fact_returnvisit_out(已 customer_id→patient_id + org∈5试点过滤)。
# upsert 资源(无 emits,同 patient/relation):落 PatientReturnVisit 表,不进 transaction/fact、不进召回。
canonical: patient_return_visit

primary:
  table: fact_returnvisit_out
  key: id
  dedup_by: id

field_mapping:
  externalId:        id
  patientExternalId: patient_id          # = customer_id(源 SQL 已 alias)
  clinicId:          organization_id
  taskDate:          task_date
  type:              return_visit_type_name
  status:            return_visit_status_name
  taskStatus:        task_status_name
  treatmentItems:    treatment_items_full   # 大类·子项 合并(transforms H);单字段展示,不镜像 host 两列
  followContent:     follow_content
  result:            return_visit_result
