// 伪代码示例
function checkVaccineAllergies(vaccine) {
const allergies = loadAllergies('data/allergies.json');
const warnings = [];
for (const allergy of allergies.allergies) {
if (allergy.current_status.status !== 'active') continue;
const isContraindication = vaccine.contraindications.some(c =>
c.type === 'allergy' && c.allergen === allergy.allergen.name
);
if (isContraindication) {
warnings.push({
allergen: allergy.allergen.name,
severity: allergy.severity.level,
recommendation: getRecommendation(allergy.severity.level)
});
}
}
return warnings;
}
function checkAgeAppropriateness(vaccine, birthDate) {
const age = calculateAge(birthDate);
const recommendation = vaccine.age_recommendations;
if (age < recommendation.min_age) {
return {
appropriate: false,
reason: `年龄不足,建议${recommendation.min_age}后再接种`
};
}
return {
appropriate: true,
recommended_age: recommendation.recommended_age
};
}
function checkVaccineInteractions(vaccine) {
const medications = loadMedications();
const interactions = [];
for (const vaccineInteraction of vaccine.interactions) {
const matchingMeds = medications.filter(med =>
med.active && med.category === vaccineInteraction.drug_category
);
if (matchingMeds.length > 0) {
interactions.push({
drugs: matchingMeds.map(m => m.name),
interaction: vaccineInteraction
});
}
}
return interactions;
}
function generateVaccineSchedule(vaccine, firstDoseDate) {
const scheduleTypes = {
'0-1-6': [
{ dose: 1, offset: 0, unit: 'months' },
{ dose: 2, offset: 1, unit: 'months' },
{ dose: 3, offset: 6, unit: 'months' }
],
'0-2-6': [
{ dose: 1, offset: 0, unit: 'months' },
{ dose: 2, offset: 2, unit: 'months' },
{ dose: 3, offset: 6, unit: 'months' }
],
'annual': [
{ dose: 1, offset: 1, unit: 'years' }
],
'single': [
{ dose: 1, offset: 0, unit: 'days' }
]
};
const pattern = scheduleTypes[vaccine.standard_schedule];
const schedule = [];
for (const doseInfo of pattern) {
const scheduledDate = addOffset(firstDoseDate, doseInfo.offset, doseInfo.unit);
const isFirstDose = doseInfo.dose === 1;
schedule.push({
dose_number: doseInfo.dose,
scheduled_date: formatDate(scheduledDate),
administered_date: isFirstDose && firstDoseDate <= new Date() ? formatDate(firstDoseDate) : null,
status: isFirstDose && firstDoseDate <= new Date() ? 'completed' : 'scheduled'
});
}
return schedule;
}
{
"id": "vax_20251231123456789",
"vaccine_info": {
"name": "乙型肝炎疫苗",
"type": "recombinant",
"manufacturer": "北京生物制品研究所",
"batch_number": "202512001",
"dose_volume": {
"value": 0.5,
"unit": "ml"
},
"route": "intramuscular"
},
"series_info": {
"is_series": true,
"series_type": "primary",
"total_doses": 3,
"current_dose": 2,
"schedule_type": "0-1-6"
},
"doses": [
{
"dose_number": 1,
"scheduled_date": "2025-11-15",
"administered_date": "2025-11-15",
"site": "left_arm",
"facility": "社区卫生服务中心",
"status": "completed"
},
{
"dose_number": 2,
"scheduled_date": "2025-12-15",
"administered_date": "2025-12-16",
"site": "right_arm",
"status": "completed"
},
{
"dose_number": 3,
"scheduled_date": "2026-05-15",
"administered_date": null,
"status": "scheduled"
}
],
"adverse_reactions": [],
"safety_checks": {
"allergy_warnings": [],
"drug_interactions": [],
"age_appropriate": true,
"contraindications": []
},
"status": {
"series_status": "in_progress",
"completion_percentage": 66.7,
"next_dose_due": "2026-05-15",
"is_overdue": false
}
}
用户: 疫苗检查 乙肝疫苗
AI: 🔍 疫苗接种前安全检查
疫苗: 乙型肝炎疫苗(重组)
1️⃣ 过敏史检查: ✅ 通过
检查结果: 无相关过敏史
2️⃣ 年龄适宜性检查: ✅ 通过
当前年龄: 35岁
推荐年龄: 任何年龄均可接种
3️⃣ 当前健康状况检查: ✅ 通过
无发热或急性疾病
4️⃣ 药物相互作用检查: ⚠️ 发现1项
当前用药: 环孢素 100mg 每日2次
影响: 可能降低疫苗免疫效果
建议: 接种后2-3个月检测抗体滴度
━━━━━━━━━━━━━━━━━━━━━━━━━
综合评估: ✅ 可以接种
━━━━━━━━━━━━━━━━━━━━━━━━━
注意事项:
• 接种后留观30分钟
• 如出现不良反应,及时记录
• 建议接种后2个月检测抗体
是否继续添加疫苗计划?
A. 继续添加
B. 取消