-- ============================================================
-- 营养素知识内容初始化（备用方案 B：手动 SQL 插入）
-- 日期: 2026-03-25
-- 说明: 若 Coze AI 生成接口（POST /api/front/tool/knowledge/generate-nutrients）
--       效果不理想，可直接执行本脚本将内置内容写入 v2_knowledge 表。
--       内容已按 CKD 营养管理临床指南整理。
-- ============================================================

-- 执行前检查（可选）：
-- SELECT nutrient_name, status FROM v2_knowledge WHERE type = 'nutrients';

INSERT INTO v2_knowledge
  (type, nutrient_name, title, content, summary, status, sort_order, view_count, like_count, created_at, published_at)
VALUES
-- 1. 蛋白质
('nutrients', '蛋白质', '蛋白质 — CKD患者膳食管理',
 '{"name":"蛋白质","english":"Protein","icon":"🥩","description":"构成人体组织的重要营养素","status":"需控制","statusDesc":"根据CKD分期调整摄入量","importance":"蛋白质是人体细胞的基本组成成分，参与免疫功能和组织修复。但过多蛋白质会增加肾脏代谢负担，加速肾功能恶化。透析患者因透析过程中蛋白质丢失，反而需要适当增加摄入。","recommendation":"CKD 1-2期：0.8-1.0g/kg体重/天\\nCKD 3-5期（未透析）：0.6-0.8g/kg体重/天\\n透析患者：1.0-1.2g/kg体重/天","foodSources":["鸡蛋","鱼类","瘦肉","牛奶","豆腐","鸡胸肉"],"riskWarning":"过多蛋白质摄入会产生大量含氮废物，加重肾脏负担；过少则导致营养不良、免疫力下降，影响透析充分性。","suggestions":["优先选择优质蛋白（鸡蛋、鱼、瘦肉）","控制植物蛋白摄入（豆类适量）","每餐均匀分配蛋白质摄入","透析患者需适当增加蛋白质","定期监测血白蛋白水平","咨询营养师制定个性化方案"],"disclaimer":"以上建议仅供参考，具体方案请咨询您的主治医生或营养师"}',
 '了解蛋白质在慢性肾病饮食中的重要性', 'published', 1, 0, 0, NOW(), NOW()),

-- 2. 钾
('nutrients', '钾', '钾 — CKD患者膳食管理',
 '{"name":"钾","english":"Potassium (K)","icon":"🍌","description":"维持神经肌肉功能的重要元素","status":"严格控制","statusDesc":"高钾血症可危及生命","importance":"钾离子参与维持心脏节律、神经传导和肌肉收缩。肾功能下降时，钾排泄减少，血钾升高可导致心律失常甚至心脏骤停，是CKD患者最危险的并发症之一。","recommendation":"CKD 3-5期：1500-2000mg/天\\n透析患者：2000-2500mg/天（透析间期严格控制）\\n血钾目标：3.5-5.0mmol/L","foodSources":["香蕉","橙子","土豆","番茄","菠菜","蘑菇"],"riskWarning":"高钾血症可导致心律失常、肌肉无力，严重时危及生命；低钾同样有害，需保持动态平衡。","suggestions":["避免高钾水果（香蕉、橙子、猕猴桃）","蔬菜先焯水再烹饪可减少30-50%的钾","避免饮用浓缩果汁和菜汤","少吃坚果、巧克力、干果","定期监测血钾水平","透析日可适当放宽限制"],"disclaimer":"以上建议仅供参考，具体方案请咨询您的主治医生或营养师"}',
 '了解钾在慢性肾病饮食中的重要性', 'published', 2, 0, 0, NOW(), NOW()),

-- 3. 磷
('nutrients', '磷', '磷 — CKD患者膳食管理',
 '{"name":"磷","english":"Phosphorus (P)","icon":"🥜","description":"骨骼健康的重要矿物质","status":"严格控制","statusDesc":"高磷可导致骨病和血管钙化","importance":"磷与钙共同维持骨骼健康。肾功能下降时磷排泄减少，血磷升高可导致继发性甲状旁腺功能亢进、肾性骨病和血管钙化，显著增加心血管疾病风险。","recommendation":"CKD 3-5期及透析患者：800-1000mg/天\\n血磷目标：1.13-1.78mmol/L\\n注意：透析只能清除约900mg磷/次，饮食控制不可或缺","foodSources":["坚果","动物内脏","可乐","加工食品","奶酪","蛋黄"],"riskWarning":"高磷血症可导致皮肤瘙痒、骨痛、血管钙化，增加心血管疾病风险。磷酸盐添加剂（无机磷）吸收率可达90%，危害更大。","suggestions":["避免含磷添加剂的加工食品（看成分表）","限制坚果、动物内脏摄入","少喝碳酸饮料（含磷酸）","按医嘱服用磷结合剂（随餐服用）","选择低磷蛋白质来源（蛋白、鸡胸肉）","烹饪时焯水可减少蔬菜中的磷"],"disclaimer":"以上建议仅供参考，具体方案请咨询您的主治医生或营养师"}',
 '了解磷在慢性肾病饮食中的重要性', 'published', 3, 0, 0, NOW(), NOW()),

-- 4. 钠
('nutrients', '钠', '钠 — CKD患者膳食管理',
 '{"name":"钠","english":"Sodium (Na)","icon":"🧂","description":"调节体液平衡的电解质","status":"适量控制","statusDesc":"减少摄入，保护肾功能","importance":"钠参与调节体液平衡和血压，是控制水肿和高血压的关键。过多钠摄入会导致水肿、血压升高，加速肾功能恶化，增加心血管负担。","recommendation":"CKD患者：<2000mg钠/天（相当于5g食盐）\\n高血压/水肿患者：<1500mg钠/天\\n透析患者：严格控制，防止透析间期体重增加过多","foodSources":["食盐","酱油","腌制食品","加工肉类","咸菜","速食方便面"],"riskWarning":"摄入过多会导致水肿、高血压、心力衰竭等问题，并加重肾脏负担；过少则可能引起低钠血症和低血压。","suggestions":["每日食盐控制在5g以内（约一啤酒瓶盖）","避免腌制、熏制食品","少用酱油、味精等调味品","可用葱姜蒜、柠檬汁增加风味","查看食品标签，选择低钠产品","透析患者严格控制两次透析间体重增长"],"disclaimer":"以上建议仅供参考，具体方案请咨询您的主治医生或营养师"}',
 '了解钠在慢性肾病饮食中的重要性', 'published', 4, 0, 0, NOW(), NOW()),

-- 5. 钙
('nutrients', '钙', '钙 — CKD患者膳食管理',
 '{"name":"钙","english":"Calcium (Ca)","icon":"🥛","description":"骨骼和牙齿的主要成分","status":"注意补充","statusDesc":"CKD患者易发生钙代谢紊乱","importance":"钙是骨骼和牙齿的主要成分，参与肌肉收缩和神经传导。CKD患者因维生素D活化障碍、高磷血症等因素，常出现低钙血症和肾性骨病，需要在医生指导下补充。","recommendation":"CKD 3-5期：800-1000mg/天（含饮食+补充剂）\\n透析患者：按血钙水平调整\\n血钙目标：2.1-2.5mmol/L\\n注意：补钙同时需控磷，避免钙磷乘积过高","foodSources":["低脂牛奶","豆腐","绿叶蔬菜","芝麻","小虾皮","钙强化食品"],"riskWarning":"低钙会导致骨质疏松、肌肉抽搐；高钙（尤其合并高磷时）会加重血管钙化，增加心血管风险。","suggestions":["在医生指导下补充钙剂","选择碳酸钙（随餐服用效果最佳）","补钙的同时需服用活性维生素D","避免与磷结合剂同时服用","定期检测血钙、血磷和PTH","避免高草酸食物（影响钙吸收）"],"disclaimer":"以上建议仅供参考，具体方案请咨询您的主治医生或营养师"}',
 '了解钙在慢性肾病饮食中的重要性', 'published', 5, 0, 0, NOW(), NOW()),

-- 6. 水分
('nutrients', '水分', '水分 — CKD患者膳食管理',
 '{"name":"水分","english":"Water / Fluid","icon":"💧","description":"生命之源，CKD患者需精确管理","status":"严格限制","statusDesc":"透析患者须控制每日摄水量","importance":"水分维持体内环境稳定，参与所有代谢反应。CKD晚期患者肾脏排水能力下降，水分积聚可导致水肿、高血压、肺水肿，甚至危及生命。","recommendation":"CKD 1-3期：通常无需限制，保持正常饮水\\nCKD 4-5期（未透析）：根据尿量调整，一般为尿量+500ml\\n透析患者：每日摄入量 = 尿量 + 透析间期允许体重增加量（一般不超过1kg/天）","foodSources":["白开水","茶","汤品","粥","水果","蔬菜（含水量高）"],"riskWarning":"水分摄入过多可导致水肿、呼吸困难、血压升高；过少则可能引起脱水和低血压，影响残余肾功能。","suggestions":["记录每日饮水量和尿量","口渴时小口慢饮，避免大量饮水","减少含水量高的食物（西瓜、汤面）","用冰块含服缓解口渴","避免过咸食物（会增加渴感）","透析患者严格控制两次透析间体重增长不超过5%干体重"],"disclaimer":"以上建议仅供参考，具体方案请咨询您的主治医生或营养师"}',
 '了解水分在慢性肾病饮食中的重要性', 'published', 6, 0, 0, NOW(), NOW())

ON DUPLICATE KEY UPDATE
  content = VALUES(content),
  status = 'published',
  updated_at = NOW();

-- 验证
SELECT knowledge_id, nutrient_name, status, created_at FROM v2_knowledge WHERE type = 'nutrients' ORDER BY sort_order;
