生成紧急情况下快速访问的医疗信息摘要卡片。当用户需要旅行、就诊准备、紧急情况或询问"紧急信息"、"医疗卡片"、"急救信息"时使用此技能。提取关键信息(过敏、用药、急症、植入物),支持多格式输出(JSON、文本、二维码),用于急救或快速就医。
生成紧急情况下快速访问的医疗信息摘要,用于急救或就医。
从用户的健康数据中提取最关键的信息:
按照医疗紧急程度对信息排序:
支持多种输出格式以适应不同场景:
生成独立的HTML文件,包含:
使用方式:
# 生成标准卡片
python scripts/generate_emergency_card.py
# 指定卡片类型
python scripts/generate_emergency_card.py standard
python scripts/generate_emergency_card.py child
python scripts/generate_emergency_card.py elderly
python scripts/generate_emergency_card.py severe
# 指定打印尺寸
python scripts/generate_emergency_card.py standard a4 # A4标准
python scripts/generate_emergency_card.py standard wallet # 钱包卡
python scripts/generate_emergency_card.py standard large # 大字版(老年)
输出文件:emergency-cards/emergency-card-{variant}-{YYYY-MM-DD}.html
当用户提到以下场景时,使用此技能:
从以下数据源读取信息:
// 1. 用户档案
const profile = readFile('data/profile.json');
// 2. 过敏史
const allergies = readFile('data/allergies.json');
// 3. 当前用药
const medications = readFile('data/medications/medications.json');
// 4. 辐射记录
const radiation = readFile('data/radiation-records.json');
// 5. 手术记录(查找植入物)
const surgeries = glob('data/手术记录/**/*.json');
// 6. 出院小结(查找急症)
const dischargeSummaries = glob('data/出院小结/**/*.json');
const basicInfo = {
name: profile.basic_info?.name || "未设置",
age: calculateAge(profile.basic_info?.birth_date),
gender: profile.basic_info?.gender || "未设置",
blood_type: profile.basic_info?.blood_type || "未知",
weight: `${profile.basic_info?.weight} ${profile.basic_info?.weight_unit}`,
height: `${profile.basic_info?.height} ${profile.basic_info?.height_unit}`,
bmi: profile.calculated?.bmi,
emergency_contacts: profile.emergency_contacts || []
};
// 过滤出3-4级严重过敏
const criticalAllergies = allergies.allergies
.filter(a => a.severity_level >= 3 && a.current_status.status === 'active')
.map(a => ({
allergen: a.allergen.name,
severity: `过敏${getSeverityLabel(a.severity_level)}(${a.severity_level}级)`,
reaction: a.reaction_description,
diagnosed_date: a.diagnosis_date
}));
// 只包含活跃的药物
const currentMedications = medications.medications
.filter(m => m.active === true)
.map(m => ({
name: m.name,
dosage: `${m.dosage.value}${m.dosage.unit}`,
frequency: getFrequencyLabel(m.frequency),
instructions: m.instructions,
warnings: m.warnings || []
}));
从出院小结中提取诊断信息:
const medicalConditions = dischargeSummaries
.flatMap(ds => {
const data = readFile(ds.file_path);
return data.diagnoses || [];
})
.map(d => ({
condition: d.condition,
diagnosis_date: d.date,
status: d.status || "随访中"
}));
从手术记录中提取植入物信息:
const implants = surgeries
.flatMap(s => {
const data = readFile(s.file_path);
return data.procedure?.implants || [];
})
.map(i => ({
type: i.type,
implant_date: i.date,
hospital: i.hospital,
notes: i.notes
}));
const recentRadiation = {
total_dose_last_year: calculateTotalDose(radiation.records, 'last_year'),
last_exam: radiation.records[radiation.records.length - 1]
};
按照优先级组织信息:
const emergencyCard = {
version: "1.0",
generated_at: new Date().toISOString(),
basic_info: basicInfo,
critical_allergies: criticalAllergies.sort(bySeverityDesc),
current_medications: currentMedications,
medical_conditions: medicalConditions,
implants: implants,
recent_radiation_exposure: recentRadiation,
disclaimer: "此信息卡仅供参考,不替代专业医疗诊断",
data_source: "my-his个人健康信息系统"
};
直接输出结构化JSON数据。
生成易读的文本卡片:
╔═══════════════════════════════════════════════════════════╗
║ 紧急医疗信息卡 ║
╠═══════════════════════════════════════════════════════════╣
║ 姓名:张三 年龄:35岁 ║
║ 血型:A+ 体重:70kg ║
╠═══════════════════════════════════════════════════════════╣
║ 🆘 严重过敏 ║
║ ─────────────────────────────────────────────────────── ║
║ • 青霉素 - 过敏性休克(4级)🆘 ║
║ 反应:呼吸困难、喉头水肿、意识丧失 ║
╠═══════════════════════════════════════════════════════════╣
║ 💊 当前用药 ║
║ ─────────────────────────────────────────────────────── ║
║ • 阿司匹林 100mg - 每日1次,心血管预防 ║
║ • 氨氯地平 5mg - 每日2次,降压治疗 ║
╠═══════════════════════════════════════════════════════════╣
║ 🏥 医疗状况 ║
║ ─────────────────────────────────────────────────────── ║
║ • 高血压(2023-01-15诊断)- 控制中 ║
║ • 2型糖尿病(2022-08-20诊断)- 监测中 ║
╠═══════════════════════════════════════════════════════════╣
║ 📿 植入物 ║
║ ─────────────────────────────────────────────────────── ║
║ • 心脏起搏器(2022-06-10植入) ║
║ 医院:XX医院 ║
║ 注意:定期复查,避免MRI检查 ║
╠═══════════════════════════════════════════════════════════╣
║ 📞 紧急联系人 ║
║ ─────────────────────────────────────────────────────── ║
║ • 李四(配偶)- 138****1234 ║
╠═══════════════════════════════════════════════════════════╣
║ ⚠️ 免责声明 ║
║ 此信息卡仅供参考,不替代专业医疗诊断 ║
║ 生成时间:2025-12-31 12:34:56 ║
╚═══════════════════════════════════════════════════════════╝
将JSON数据转换为二维码图片:
const qrCode = generateQRCode(JSON.stringify(emergencyCard));
emergencyCard.qr_code = qrCode;
根据用户选择的格式保存文件:
// JSON格式
saveFile('emergency-card.json', JSON.stringify(emergencyCard, null, 2));
// 文本格式
saveFile('emergency-card.txt', generateTextCard(emergencyCard));
// 二维码格式
saveFile('emergency-card-qr.png', emergencyCard.qr_code);
✅ 紧急医疗信息卡已生成
文件位置:data/emergency-cards/emergency-card-2025-12-31.json
生成时间:2025-12-31 12:34:56
包含信息:
━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ 基础信息(姓名、年龄、血型)
✓ 严重过敏(1项4级过敏)
✓ 当前用药(2种药物)
✓ 医疗状况(2种疾病)
✓ 植入物(1项)
✓ 紧急联系人(1人)
💡 使用建议:
━━━━━━━━━━━━━━━━━━━━━━━━━━
• 将JSON文件保存到手机云盘
• 将二维码保存到手机相册
• 打印文本版随身携带
• 旅行前更新信息
⚠️ 注意事项:
━━━━━━━━━━━━━━━━━━━━━━━━━━
• 此信息卡仅供参考,不替代专业医疗诊断
• 定期更新(建议每3个月或健康信息变化后)
• 如有严重过敏,请随身携带过敏急救卡
完整示例请参考 examples.md。
测试数据文件位于 test-data/emergency-example.json。
详细的输出格式说明请参考 formats.md。