- Base platform from base.git (ERP base: auth, core, config, message, workflow, plugin) - Created erp-diary module skeleton (lib.rs, dto.rs, error.rs, event.rs, state.rs) - Integrated erp-diary into workspace and erp-server - Added DiaryModule registration in main.rs - Added DiaryState FromRef in state.rs - Diary routes mounted (empty routes, ready for implementation) - Product design spec v1.2 preserved in docs/ - Implementation plan preserved in plans/ Cargo check: OK Cargo test: OK (78+ base tests passing)
262 lines
33 KiB
JavaScript
262 lines
33 KiB
JavaScript
/**
|
||
* 血透测试文章种子脚本
|
||
* 用法: node scripts/seed-dialysis-articles.mjs
|
||
* 删除现有文章,创建 4 篇血透相关的富文本文章(published 状态)
|
||
*/
|
||
|
||
const BASE = 'http://localhost:3000/api/v1';
|
||
const LOGIN = { username: 'admin', password: 'Admin@2026' };
|
||
|
||
const W = 'data-w-e-type="styled-block"';
|
||
const P = '#C4623A'; // primary
|
||
const PL = '#F0DDD4'; // primaryLight
|
||
|
||
function applyColor(html) {
|
||
return html.replaceAll('{{primary}}', P).replaceAll('{{primaryLight}}', PL);
|
||
}
|
||
|
||
const articles = [
|
||
{
|
||
title: '血透患者日常饮食管理指南',
|
||
summary: '科学的饮食管理是维持性血液透析患者保持良好营养状态、减少并发症的关键。本文详细介绍了血透患者的饮食原则、各类营养素的摄入建议以及实用的饮食搭配技巧。',
|
||
sort_order: 1,
|
||
content: [
|
||
`<p>血液透析患者在治疗过程中,合理的饮食管理不仅有助于维持良好的营养状态,还能有效减少透析并发症的发生。以下是一份全面的饮食管理指南,帮助您更好地控制饮食。</p>`,
|
||
|
||
applyColor(`<div ${W} style="margin: 24px 0 12px; padding: 12px 0 0; border-top: 4px solid ${P}; font-size: 20px; font-weight: 700; color: #1a1a1a;">一、蛋白质摄入管理</div>`),
|
||
|
||
`<p>透析患者需要适量增加蛋白质摄入,以弥补透析过程中的蛋白质丢失。推荐每日蛋白质摄入量为 <strong>1.0-1.2 g/kg体重</strong>,其中优质蛋白质应占50%以上。</p>`,
|
||
|
||
applyColor(`<div ${W} style="display: flex; gap: 12px; margin: 16px 0; flex-wrap: wrap;"><div style="flex: 1; min-width: 120px; background: ${PL}; border-radius: 8px; padding: 14px; text-align: center;"><div style="font-size: 24px; font-weight: 700; color: ${P};">1.2g</div><div style="font-size: 13px; color: #5a554f; margin-top: 4px;">每公斤体重/天</div></div><div style="flex: 1; min-width: 120px; background: #f3f4f6; border-radius: 8px; padding: 14px; text-align: center;"><div style="font-size: 24px; font-weight: 700; color: #1a1a1a;">50%</div><div style="font-size: 13px; color: #5a554f; margin-top: 4px;">优质蛋白占比</div></div></div>`),
|
||
|
||
applyColor(`<div ${W} style="background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 15px; line-height: 1.8; color: #166534;"><strong>✓ 推荐食物:</strong>鸡蛋清、鱼肉、瘦肉、牛奶、豆腐等优质蛋白来源。</div>`),
|
||
|
||
applyColor(`<div ${W} style="background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 15px; line-height: 1.8; color: #991b1b;"><strong>✕ 限制食物:</strong>减少植物蛋白(如豆类制品过量)摄入,避免高嘌呤食物。</div>`),
|
||
|
||
applyColor(`<div ${W} style="border: none; height: 2px; margin: 24px 0; background: linear-gradient(90deg, transparent, ${P}, transparent);"></div>`),
|
||
|
||
applyColor(`<div ${W} style="margin: 24px 0 12px; padding: 12px 0 0; border-top: 4px solid ${P}; font-size: 20px; font-weight: 700; color: #1a1a1a;">二、钾的控制</div>`),
|
||
|
||
`<p>高钾血症是透析患者常见的危及生命的并发症。透析间期血钾应控制在 <strong>3.5-5.5 mmol/L</strong>。</p>`,
|
||
|
||
applyColor(`<div ${W} style="margin: 16px 0; background: #f9fafb; border-radius: 8px; overflow: hidden; font-size: 14px;"><div style="display: flex; padding: 10px 16px; border-bottom: 1px solid #e5e7eb;"><div style="width: 100px; color: #5a554f; flex-shrink: 0;">检查项目</div><div style="flex: 1; font-weight: 600; color: #1a1a1a;">目标范围</div></div><div style="display: flex; padding: 10px 16px; border-bottom: 1px solid #e5e7eb; background: #fff;"><div style="width: 100px; color: #5a554f; flex-shrink: 0;">血钾</div><div style="flex: 1; font-weight: 600; color: ${P};">3.5-5.5 mmol/L</div></div><div style="display: flex; padding: 10px 16px; border-bottom: 1px solid #e5e7eb;"><div style="width: 100px; color: #5a554f; flex-shrink: 0;">血磷</div><div style="flex: 1; font-weight: 600; color: ${P};">0.87-1.45 mmol/L</div></div><div style="display: flex; padding: 10px 16px; background: #fff;"><div style="width: 100px; color: #5a554f; flex-shrink: 0;">血钙</div><div style="flex: 1; font-weight: 600; color: #1a1a1a;">2.1-2.6 mmol/L</div></div></div>`),
|
||
|
||
applyColor(`<div ${W} style="background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 15px; line-height: 1.8; color: #92400e;"><strong>⚠ 注意事项:</strong>高钾水果(香蕉、橙子、猕猴桃)需严格控制摄入量。蔬菜可通过水煮去钾处理后再食用。</div>`),
|
||
|
||
applyColor(`<div ${W} style="border: none; height: 2px; margin: 24px 0; background: linear-gradient(90deg, transparent, ${P}, transparent);"></div>`),
|
||
|
||
applyColor(`<div ${W} style="margin: 24px 0 12px; padding: 12px 0 0; border-top: 4px solid ${P}; font-size: 20px; font-weight: 700; color: #1a1a1a;">三、水分控制</div>`),
|
||
|
||
`<p>透析间期体重增长应控制在干体重的 <strong>3%-5%</strong> 以内。每日液体摄入量一般为前一日尿量加 500ml。</p>`,
|
||
|
||
applyColor(`<div ${W} style="margin: 16px 0;"><div style="display: flex; align-items: flex-start; margin-bottom: 16px;"><div style="width: 28px; height: 28px; background: ${P}; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-right: 12px;">1</div><div style="flex: 1; padding-top: 4px;"><div style="font-size: 15px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">记录每日体重</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">每天早上空腹称重,记录体重变化趋势</div></div></div><div style="display: flex; align-items: flex-start; margin-bottom: 16px;"><div style="width: 28px; height: 28px; background: ${P}; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-right: 12px;">2</div><div style="flex: 1; padding-top: 4px;"><div style="font-size: 15px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">控制液体摄入</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">使用有刻度的水杯,做到心中有数</div></div></div><div style="display: flex; align-items: flex-start;"><div style="width: 28px; height: 28px; background: ${P}; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-right: 12px;">3</div><div style="flex: 1; padding-top: 4px;"><div style="font-size: 15px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">减少隐形水分</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">粥、汤、水果中的水分也需计入总量</div></div></div></div>`),
|
||
|
||
applyColor(`<div ${W} style="margin: 20px 0; padding: 20px; background: linear-gradient(135deg, ${PL}, #f9fafb); border-radius: 12px; position: relative;"><div style="font-size: 36px; color: ${P}; opacity: 0.3; line-height: 1; font-family: Georgia, serif;">"</div><div style="font-size: 15px; color: #3a3a3c; line-height: 1.8; margin-top: -8px; font-style: italic;">透析间期体重增长不超过干体重的5%,是减少心血管并发症的重要措施。</div><div style="margin-top: 10px; font-size: 13px; color: #5a554f; font-weight: 500;">—— KDIGO 指南建议</div></div>`),
|
||
|
||
applyColor(`<div ${W} style="border: none; height: 2px; margin: 24px 0; background: linear-gradient(90deg, transparent, ${P}, transparent);"></div>`),
|
||
|
||
applyColor(`<div ${W} style="margin: 24px 0 12px; padding: 12px 0 0; border-top: 4px solid ${P}; font-size: 20px; font-weight: 700; color: #1a1a1a;">四、磷的管理</div>`),
|
||
|
||
`<p>高磷血症可导致继发性甲状旁腺功能亢进和血管钙化。每日磷摄入量应控制在 <strong>800-1000mg</strong>,并遵医嘱服用磷结合剂。</p>`,
|
||
|
||
applyColor(`<div ${W} style="display: flex; gap: 12px; margin: 16px 0; flex-wrap: wrap;"><div style="flex: 1; min-width: 140px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 14px;"><div style="font-size: 15px; font-weight: 700; color: #166534; margin-bottom: 8px;">✓ 低磷食物</div><div style="font-size: 14px; color: #166534; line-height: 1.8;">鸡蛋清<br/>冬瓜、黄瓜<br/>米饭、面条<br/>苹果、梨</div></div><div style="flex: 1; min-width: 140px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 14px;"><div style="font-size: 15px; font-weight: 700; color: #991b1b; margin-bottom: 8px;">✕ 高磷食物</div><div style="font-size: 14px; color: #991b1b; line-height: 1.8;">动物内脏<br/>坚果、芝麻<br/>碳酸饮料<br/>加工肉制品</div></div></div>`),
|
||
|
||
applyColor(`<div ${W} style="background: ${PL}; border: 1px solid ${P}; border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 15px; line-height: 1.8; color: #1a1a1a;"><strong style="color: ${P};">★ 温馨提示:</strong>以上饮食建议仅供参考,具体饮食方案请遵医嘱。如有不适请及时联系您的主治医生。</div>`),
|
||
].join(''),
|
||
},
|
||
{
|
||
title: '血液透析治疗流程全解析',
|
||
summary: '了解血液透析的完整治疗流程,从透析前准备到透析后护理,帮助患者和家属全面认识透析治疗过程,减少焦虑,提高治疗依从性。',
|
||
sort_order: 2,
|
||
content: [
|
||
`<p>血液透析(Hemodialysis, HD)是目前治疗急慢性肾衰竭最常用的肾脏替代治疗方法之一。本文将详细解析一次完整的血液透析治疗流程。</p>`,
|
||
|
||
applyColor(`<div ${W} style="text-align: center; margin: 24px 0 12px; padding: 10px 0; border-top: 2px solid ${P}; border-bottom: 2px solid ${P}; font-size: 20px; font-weight: 700; color: #1a1a1a;">透析治疗完整流程</div>`),
|
||
|
||
applyColor(`<div ${W} style="margin: 16px 0; padding-left: 20px; border-left: 2px solid ${P};"><div style="position: relative; padding: 0 0 20px 16px;"><div style="position: absolute; left: -27px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: ${P};"></div><div style="font-size: 14px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">透析前一天</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">控制水分摄入,测量体重,准备透析用品</div></div><div style="position: relative; padding: 0 0 20px 16px;"><div style="position: absolute; left: -27px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: ${P};"></div><div style="font-size: 14px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">透析当天 · 到达前</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">穿宽松衣物,带好透析卡和药物,测量体重</div></div><div style="position: relative; padding: 0 0 20px 16px;"><div style="position: absolute; left: -27px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: ${P};"></div><div style="font-size: 14px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">透析开始</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">血管穿刺/连接,血流量调节,参数设置</div></div><div style="position: relative; padding: 0 0 20px 16px;"><div style="position: absolute; left: -27px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: ${P};"></div><div style="font-size: 14px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">透析进行中(4小时)</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">持续监测血压、心率,注意有无不适</div></div><div style="position: relative; padding: 0 0 20px 16px;"><div style="position: absolute; left: -27px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: ${P};"></div><div style="font-size: 14px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">透析结束</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">回血、拔针、压迫止血、测量体重</div></div><div style="position: relative; padding: 0 0 0 16px;"><div style="position: absolute; left: -27px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: ${P};"></div><div style="font-size: 14px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">透析后观察</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">休息15-30分钟,确认无头晕出血后再离开</div></div></div>`),
|
||
|
||
applyColor(`<div ${W} style="border: none; height: 2px; margin: 24px 0; background: linear-gradient(90deg, transparent, ${P}, transparent);"></div>`),
|
||
|
||
applyColor(`<div ${W} style="border-left: 4px solid ${P}; padding-left: 12px; font-size: 20px; font-weight: 700; color: #1a1a1a; margin: 24px 0 12px;">透析参数与监测</div>`),
|
||
|
||
`<p>标准的血液透析治疗通常每次持续 <strong>4小时</strong>,每周进行 <strong>3次</strong>。治疗过程中需要持续监测多项参数。</p>`,
|
||
|
||
applyColor(`<div ${W} style="display: grid; grid-template-columns: 1fr 1fr 1fr; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; margin: 16px 0; font-size: 14px;"><div style="background: ${PL}; padding: 10px 12px; font-weight: 600; color: ${P}; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;">参数</div><div style="background: ${PL}; padding: 10px 12px; font-weight: 600; color: ${P}; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;">标准值</div><div style="background: ${PL}; padding: 10px 12px; font-weight: 600; color: ${P}; border-bottom: 1px solid #e5e7eb;">说明</div><div style="padding: 10px 12px; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;">血流量</div><div style="padding: 10px 12px; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;">200-300 ml/min</div><div style="padding: 10px 12px; border-bottom: 1px solid #e5e7eb;">因人而异</div><div style="background: #f9fafb; padding: 10px 12px; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;">透析液流量</div><div style="background: #f9fafb; padding: 10px 12px; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;">500 ml/min</div><div style="background: #f9fafb; padding: 10px 12px; border-bottom: 1px solid #e5e7eb;">标准设置</div><div style="padding: 10px 12px; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;">超滤量</div><div style="padding: 10px 12px; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;">个体化制定</div><div style="padding: 10px 12px; border-bottom: 1px solid #e5e7eb;">根据体重增长</div><div style="background: #f9fafb; padding: 10px 12px; border-right: 1px solid #e5e7eb;">治疗时间</div><div style="background: #f9fafb; padding: 10px 12px; border-right: 1px solid #e5e7eb;">4 小时</div><div style="background: #f9fafb; padding: 10px 12px;">每次标准</div></div>`),
|
||
|
||
applyColor(`<div ${W} style="background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 15px; line-height: 1.8; color: #1e40af;"><strong>ℹ 补充说明:</strong>透析充分性评估通常使用 Kt/V 值,目标值应 ≥ 1.2。您的医生会定期检查此项指标。</div>`),
|
||
|
||
applyColor(`<div ${W} style="margin: 16px 0; background: #f9fafb; border-radius: 8px; overflow: hidden;"><div style="background: ${PL}; padding: 10px 16px; font-size: 15px; font-weight: 600; color: ${P};">Q:透析过程中可以进食吗?</div><div style="padding: 12px 16px; font-size: 14px; line-height: 1.8; color: #3a3a3c;">A:可以少量进食,但建议选择易消化的食物。避免过饱进食,以防低血压。透析中进食还可以预防低血糖的发生。</div></div>`),
|
||
|
||
applyColor(`<div ${W} style="margin: 16px 0; background: #f9fafb; border-radius: 8px; overflow: hidden;"><div style="background: ${PL}; padding: 10px 16px; font-size: 15px; font-weight: 600; color: ${P};">Q:透析后为什么会感到疲乏?</div><div style="padding: 12px 16px; font-size: 14px; line-height: 1.8; color: #3a3a3c;">A:透析后疲乏是常见现象,主要与体液变化、电解质调整和代谢废物清除有关。建议透析后适当休息,保证充足睡眠。</div></div>`),
|
||
].join(''),
|
||
},
|
||
{
|
||
title: '血透患者血管通路的护理要点',
|
||
summary: '血管通路被称为血透患者的"生命线",正确的护理至关重要。本文介绍动静脉内瘘和中心静脉导管的日常护理方法,帮助您延长通路使用寿命。',
|
||
sort_order: 3,
|
||
content: [
|
||
`<p>血管通路是血液透析治疗的基础,良好的血管通路是保证透析质量和患者安全的前提。保护好您的"生命线",从日常护理做起。</p>`,
|
||
|
||
applyColor(`<div ${W} style="display: inline-block; background: ${PL}; color: ${P}; padding: 4px 14px; border-radius: 4px; font-size: 18px; font-weight: 700; margin: 24px 0 12px;">动静脉内瘘(AVF)护理</div>`),
|
||
|
||
`<p>动静脉内瘘是目前最理想的长期血管通路,平均使用寿命可达 <strong>5-10年</strong>。正确的日常护理能显著延长内瘘的使用寿命。</p>`,
|
||
|
||
applyColor(`<div ${W} style="margin: 16px 0;"><div style="display: flex; align-items: flex-start; margin-bottom: 16px;"><div style="width: 28px; height: 28px; background: ${P}; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-right: 12px;">1</div><div style="flex: 1; padding-top: 4px;"><div style="font-size: 15px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">每日自检</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">每天触摸内瘘部位,感受震颤("嗡嗡"感),如震颤消失需立即就医</div></div></div><div style="display: flex; align-items: flex-start; margin-bottom: 16px;"><div style="width: 28px; height: 28px; background: ${P}; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-right: 12px;">2</div><div style="flex: 1; padding-top: 4px;"><div style="font-size: 15px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">避免压迫</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">不在内瘘侧手臂测量血压、抽血、输液或佩戴过紧饰品</div></div></div><div style="display: flex; align-items: flex-start; margin-bottom: 16px;"><div style="width: 28px; height: 28px; background: ${P}; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-right: 12px;">3</div><div style="flex: 1; padding-top: 4px;"><div style="font-size: 15px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">适当锻炼</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">术后2-4周开始握球训练,促进内瘘成熟</div></div></div><div style="display: flex; align-items: flex-start;"><div style="width: 28px; height: 28px; background: ${P}; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-right: 12px;">4</div><div style="flex: 1; padding-top: 4px;"><div style="font-size: 15px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px;">保持清洁</div><div style="font-size: 14px; color: #5a554f; line-height: 1.6;">透析前清洗内瘘侧手臂,保持穿刺部位清洁干燥</div></div></div></div>`),
|
||
|
||
applyColor(`<div ${W} style="background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 15px; line-height: 1.8; color: #991b1b;"><strong>✕ 严禁事项:</strong>内瘘侧手臂避免提重物(>5kg)、避免侧卧压迫、避免接触锐器。如发现震颤减弱或消失、局部红肿热痛,应立即就医。</div>`),
|
||
|
||
applyColor(`<div ${W} style="border: none; height: 2px; margin: 24px 0; background: linear-gradient(90deg, transparent, ${P}, transparent);"></div>`),
|
||
|
||
applyColor(`<div ${W} style="display: inline-block; background: ${PL}; color: ${P}; padding: 4px 14px; border-radius: 4px; font-size: 18px; font-weight: 700; margin: 24px 0 12px;">中心静脉导管(CVC)护理</div>`),
|
||
|
||
`<p>中心静脉导管通常用于内瘘成熟前的过渡期或无法建立内瘘的患者。导管护理的核心是 <strong>预防感染</strong> 和 <strong>保持通畅</strong>。</p>`,
|
||
|
||
applyColor(`<div ${W} style="display: flex; gap: 12px; margin: 16px 0; flex-wrap: wrap;"><div style="flex: 1; min-width: 120px; background: ${PL}; border-radius: 8px; padding: 14px; text-align: center;"><div style="font-size: 24px; font-weight: 700; color: ${P};">100%</div><div style="font-size: 13px; color: #5a554f; margin-top: 4px;">保持敷料干燥</div></div><div style="flex: 1; min-width: 120px; background: #f3f4f6; border-radius: 8px; padding: 14px; text-align: center;"><div style="font-size: 24px; font-weight: 700; color: #1a1a1a;">2次</div><div style="font-size: 13px; color: #5a554f; margin-top: 4px;">每周换药频率</div></div></div>`),
|
||
|
||
applyColor(`<div ${W} style="background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 15px; line-height: 1.8; color: #92400e;"><strong>⚠ 注意事项:</strong>洗澡时必须用防水贴膜覆盖导管出口处。禁止在导管附近使用剪刀等锐器。如导管不慎脱出,立即压迫止血并急诊就医。</div>`),
|
||
|
||
applyColor(`<div ${W} style="margin: 16px 0;"><div style="display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px;"><span style="color: #1a1a1a; font-weight: 600;">内瘘成熟度</span><span style="color: ${P}; font-weight: 700;">良好</span></div><div style="background: #e5e7eb; border-radius: 99px; height: 8px; overflow: hidden;"><div style="background: ${P}; height: 100%; width: 85%; border-radius: 99px;"></div></div></div>`),
|
||
|
||
applyColor(`<div ${W} style="background: ${PL}; border: 1px solid ${P}; border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 15px; line-height: 1.8; color: #1a1a1a;"><strong style="color: ${P};">★ 就医指征:</strong>以下情况需立即就医:① 震颤消失 ② 穿刺点持续出血 ③ 导管出口红肿渗液 ④ 内瘘部位出现搏动性包块 ⑤ 体温超过38°C</div>`),
|
||
].join(''),
|
||
},
|
||
{
|
||
title: '血液透析常见并发症及应对策略',
|
||
summary: '了解血液透析过程中可能出现的低血压、肌肉痉挛、失衡综合征等常见并发症的表现形式和应对方法,做到早识别、早处理。',
|
||
sort_order: 4,
|
||
content: [
|
||
`<p>虽然血液透析是安全有效的治疗方式,但治疗过程中和治疗后可能出现一些并发症。了解这些并发症的表现和应对方法,有助于患者更好地配合治疗。</p>`,
|
||
|
||
applyColor(`<div ${W} style="margin: 24px 0 12px; display: flex; align-items: center; gap: 10px;"><span style="display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: ${P}; color: #fff; border-radius: 50%; font-size: 14px; font-weight: 700; flex-shrink: 0;">1</span><span style="font-size: 18px; font-weight: 700; color: #1a1a1a;">透析低血压</span></div>`),
|
||
|
||
`<p>透析低血压是最常见的急性并发症,发生率约 <strong>20%-30%</strong>。表现为头晕、恶心、出冷汗、肌肉痉挛等。</p>`,
|
||
|
||
applyColor(`<div ${W} style="display: flex; gap: 12px; margin: 16px 0; flex-wrap: wrap;"><div style="flex: 1; min-width: 120px; background: ${PL}; border-radius: 8px; padding: 14px; text-align: center;"><div style="font-size: 24px; font-weight: 700; color: ${P};">25%</div><div style="font-size: 13px; color: #5a554f; margin-top: 4px;">发生率</div></div><div style="flex: 1; min-width: 120px; background: #f3f4f6; border-radius: 8px; padding: 14px; text-align: center;"><div style="font-size: 24px; font-weight: 700; color: #1a1a1a;">90/60</div><div style="font-size: 13px; color: #5a554f; margin-top: 4px;">诊断标准 (mmHg)</div></div></div>`),
|
||
|
||
applyColor(`<div ${W} style="background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 15px; line-height: 1.8; color: #166534;"><strong>✓ 应对方法:</strong>立即降低超滤速度,采取头低脚高位,必要时补充生理盐水100-200ml。平时注意控制透析间期体重增长。</div>`),
|
||
|
||
applyColor(`<div ${W} style="border: none; border-top: 1px dashed #d1d5db; margin: 24px 0; height: 0;"></div>`),
|
||
|
||
applyColor(`<div ${W} style="margin: 24px 0 12px; display: flex; align-items: center; gap: 10px;"><span style="display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: ${P}; color: #fff; border-radius: 50%; font-size: 14px; font-weight: 700; flex-shrink: 0;">2</span><span style="font-size: 18px; font-weight: 700; color: #1a1a1a;">肌肉痉挛</span></div>`),
|
||
|
||
`<p>多发生于透析后半程,以小腿和足部肌肉痉挛最常见,与超滤过快、低血压、低钠血症等因素有关。</p>`,
|
||
|
||
applyColor(`<div ${W} style="background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 15px; line-height: 1.8; color: #166534;"><strong>✓ 应对方法:</strong>减慢超滤速度,局部按摩热敷,补充高渗盐水或葡萄糖。日常补充维生素E和左旋卡尼汀可能有预防作用。</div>`),
|
||
|
||
applyColor(`<div ${W} style="border: none; border-top: 1px dashed #d1d5db; margin: 24px 0; height: 0;"></div>`),
|
||
|
||
applyColor(`<div ${W} style="margin: 24px 0 12px; display: flex; align-items: center; gap: 10px;"><span style="display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: ${P}; color: #fff; border-radius: 50%; font-size: 14px; font-weight: 700; flex-shrink: 0;">3</span><span style="font-size: 18px; font-weight: 700; color: #1a1a1a;">透析失衡综合征</span></div>`),
|
||
|
||
`<p>主要见于首次透析或透析间隔过长的患者,由于血中尿素氮等溶质快速清除,导致脑组织与血液之间产生渗透压差。</p>`,
|
||
|
||
applyColor(`<div ${W} style="background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 15px; line-height: 1.8; color: #1e40af;"><strong>ℹ 临床表现:</strong>轻度表现为头痛、恶心、呕吐、烦躁不安;重度可出现意识障碍、抽搐甚至昏迷。预防关键是首次透析采用低血流量、短时间(2小时)的诱导透析方案。</div>`),
|
||
|
||
applyColor(`<div ${W} style="border: none; border-top: 1px dashed #d1d5db; margin: 24px 0; height: 0;"></div>`),
|
||
|
||
applyColor(`<div ${W} style="margin: 24px 0 12px; display: flex; align-items: center; gap: 10px;"><span style="display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: ${P}; color: #fff; border-radius: 50%; font-size: 14px; font-weight: 700; flex-shrink: 0;">4</span><span style="font-size: 18px; font-weight: 700; color: #1a1a1a;">透析相关发热</span></div>`),
|
||
|
||
`<p>透析过程中或透析结束后出现的体温升高,需区分感染性和非感染性发热。</p>`,
|
||
|
||
applyColor(`<div ${W} style="display: grid; grid-template-columns: 1fr 1fr 1fr; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; margin: 16px 0; font-size: 14px;"><div style="background: ${PL}; padding: 10px 12px; font-weight: 600; color: ${P}; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;">类型</div><div style="background: ${PL}; padding: 10px 12px; font-weight: 600; color: ${P}; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;">特点</div><div style="background: ${PL}; padding: 10px 12px; font-weight: 600; color: ${P}; border-bottom: 1px solid #e5e7eb;">处理</div><div style="padding: 10px 12px; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;">致热原反应</div><div style="padding: 10px 12px; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;">透析开始1-2h</div><div style="padding: 10px 12px; border-bottom: 1px solid #e5e7eb;">对症处理</div><div style="background: #f9fafb; padding: 10px 12px; border-right: 1px solid #e5e7eb;">感染性</div><div style="background: #f9fafb; padding: 10px 12px; border-right: 1px solid #e5e7eb;">透析结束后</div><div style="background: #f9fafb; padding: 10px 12px;">抗感染治疗</div></div>`),
|
||
|
||
applyColor(`<div ${W} style="margin: 16px 0; background: #f9fafb; border-radius: 8px; overflow: hidden;"><div style="background: ${PL}; padding: 10px 16px; font-size: 15px; font-weight: 600; color: ${P};">Q:透析中出现不适应该怎么办?</div><div style="padding: 12px 16px; font-size: 14px; line-height: 1.8; color: #3a3a3c;">A:立即告知医护人员,不要自行忍耐。医护人员会根据症状严重程度及时调整透析参数或给予对症处理。</div></div>`),
|
||
|
||
applyColor(`<div ${W} style="background: ${PL}; border: 1px solid ${P}; border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 15px; line-height: 1.8; color: #1a1a1a;"><strong style="color: ${P};">★ 紧急就医:</strong>如出现严重头痛伴呕吐、持续胸痛、呼吸困难、意识模糊、内瘘震颤消失、导管出口大量渗血渗液等严重情况,请立即拨打120或前往最近医院急诊。</div>`),
|
||
].join(''),
|
||
},
|
||
];
|
||
|
||
async function main() {
|
||
console.log('🔑 登录获取 Token...');
|
||
const loginRes = await fetch(`${BASE}/auth/login`, {
|
||
method: 'POST',
|
||
headers: { 'Content-Type': 'application/json' },
|
||
body: JSON.stringify(LOGIN),
|
||
});
|
||
const loginData = await loginRes.json();
|
||
const token = loginData.data.access_token;
|
||
if (!token) { console.error('登录失败:', loginData); process.exit(1); }
|
||
console.log('✅ 登录成功');
|
||
|
||
const headers = { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' };
|
||
|
||
// 删除现有文章
|
||
console.log('\n📋 获取现有文章...');
|
||
const listRes = await fetch(`${BASE}/health/articles?page=1&page_size=100`, { headers });
|
||
const listData = await listRes.json();
|
||
const existingArticles = listData.data?.items || [];
|
||
console.log(` 找到 ${existingArticles.length} 篇现有文章`);
|
||
|
||
for (const article of existingArticles) {
|
||
await fetch(`${BASE}/health/articles/${article.id}`, { method: 'DELETE', headers });
|
||
console.log(` 🗑 删除: ${article.title}`);
|
||
}
|
||
|
||
// 获取分类和标签
|
||
const [catsRes, tagsRes] = await Promise.all([
|
||
fetch(`${BASE}/health/article-categories`, { headers }),
|
||
fetch(`${BASE}/health/article-tags`, { headers }),
|
||
]);
|
||
const cats = (await catsRes.json()).data || [];
|
||
const tags = (await tagsRes.json()).data || [];
|
||
console.log(`\n📂 分类: ${cats.map((c) => c.name).join(', ') || '无'}`);
|
||
console.log(`🏷 标签: ${tags.map((t) => t.name).join(', ') || '无'}`);
|
||
|
||
// 创建文章
|
||
console.log('\n📝 创建血透测试文章...');
|
||
for (const article of articles) {
|
||
const createRes = await fetch(`${BASE}/health/articles`, {
|
||
method: 'POST',
|
||
headers,
|
||
body: JSON.stringify({
|
||
title: article.title,
|
||
summary: article.summary,
|
||
content: article.content,
|
||
content_type: 'rich_text',
|
||
sort_order: article.sort_order,
|
||
category_id: cats[0]?.id,
|
||
tag_ids: tags.slice(0, 2).map((t) => t.id),
|
||
}),
|
||
});
|
||
const created = await createRes.json();
|
||
if (!created.success) {
|
||
console.error(` ❌ 创建失败: ${article.title}`, created.message);
|
||
continue;
|
||
}
|
||
const articleId = created.data.id;
|
||
const version = created.data.version;
|
||
console.log(` ✅ 创建: ${article.title} (${articleId.slice(0, 8)}...)`);
|
||
|
||
// 提交审核
|
||
const submitRes = await fetch(`${BASE}/health/articles/${articleId}/submit`, {
|
||
method: 'POST',
|
||
headers,
|
||
body: JSON.stringify({ version }),
|
||
});
|
||
const submitted = await submitRes.json();
|
||
if (submitted.success) {
|
||
const newVersion = submitted.data.version;
|
||
console.log(` 📤 提交审核成功 (v${newVersion})`);
|
||
|
||
// 审核通过
|
||
const approveRes = await fetch(`${BASE}/health/articles/${articleId}/approve`, {
|
||
method: 'POST',
|
||
headers,
|
||
body: JSON.stringify({ version: newVersion }),
|
||
});
|
||
const approved = await approveRes.json();
|
||
if (approved.success) {
|
||
console.log(` ✅ 审核通过,已发布`);
|
||
} else {
|
||
console.error(` ❌ 审核失败:`, approved.message);
|
||
}
|
||
} else {
|
||
console.error(` ❌ 提交失败:`, submitted.message);
|
||
}
|
||
}
|
||
|
||
console.log('\n🎉 完成!4 篇血透测试文章已创建并发布。');
|
||
}
|
||
|
||
main().catch((e) => { console.error('脚本执行失败:', e); process.exit(1); });
|