/**
 * 从传方记录中解析药品列表（兼容 drug_list / prescription.content / content.repice）
 */
export function parseSalespersonTransferDrugList(item: any): any[] {
  if (item.drug_list?.length) return item.drug_list;
  if (item.prescription?.content?.length) return item.prescription.content;
  const content = item.content;
  if (!content?.repice) return [];
  const drugs: any[] = [];
  for (const recipe of content.repice) {
    let rc = recipe.content;
    if (typeof rc === 'string') {
      try {
        rc = JSON.parse(rc);
      } catch {
        rc = [];
      }
    }
    if (Array.isArray(rc)) drugs.push(...rc);
  }
  return drugs;
}
