向指定医生发送每日患者状况更新
这是一个Miscellaneous, Multimodal AI领域的自动化工作流,包含 10 个节点。主要使用 Code, Cron, Filter, EmailSend, HttpRequest 等节点。 使用Google Sheets、邮件和WhatsApp提醒发送患者状况更新
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
{
"id": "pgQtR2koohYLYz2J",
"meta": {
"instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
"templateCredsSetupCompleted": true
},
"name": "向指定医生发送每日患者状况更新",
"tags": [],
"nodes": [
{
"id": "4919ea3e-0d1f-425f-9f04-5b1fa5d56cf9",
"name": "每日触发器(早上8点)",
"type": "n8n-nodes-base.cron",
"position": [
-1500,
-40
],
"parameters": {},
"typeVersion": 1
},
{
"id": "130907ef-736b-49af-b07e-0d0cd40d278f",
"name": "读取患者数据",
"type": "n8n-nodes-base.googleSheets",
"position": [
-1280,
-40
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultName": "Patients"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_GOOGLE_SHEET_ID"
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "ScSS2KxGQULuPtdy",
"name": "Google Sheets- test"
}
},
"typeVersion": 4
},
{
"id": "20cf609d-63d1-42cf-878e-40e40a37938a",
"name": "筛选活跃患者",
"type": "n8n-nodes-base.filter",
"position": [
-1060,
-40
],
"parameters": {
"options": {},
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "patient-filter",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.Status }}",
"rightValue": "Active"
}
]
}
},
"typeVersion": 2
},
{
"id": "72680bdb-08ea-45b2-a8e3-8f5c70d56b7e",
"name": "处理患者数据",
"type": "n8n-nodes-base.code",
"position": [
-840,
-40
],
"parameters": {
"jsCode": "const patients = $input.all();\nconst reports = [];\n\nfor (const patient of patients) {\n const currentDate = new Date().toLocaleDateString('en-US', {\n year: 'numeric',\n month: 'long',\n day: 'numeric'\n });\n \n const reportData = {\n patientId: patient.json['Patient ID'],\n patientName: patient.json['Patient Name'],\n age: patient.json['Age'],\n condition: patient.json['Current Condition'],\n vitals: {\n temperature: patient.json['Temperature'] || 'N/A',\n bloodPressure: patient.json['Blood Pressure'] || 'N/A',\n heartRate: patient.json['Heart Rate'] || 'N/A'\n },\n medication: patient.json['Current Medication'] || 'None',\n doctorEmail: patient.json['Assigned Doctor Email'],\n doctorWhatsApp: patient.json['Doctor WhatsApp'],\n lastUpdated: patient.json['Last Updated'] || currentDate,\n reportDate: currentDate,\n priority: patient.json['Priority'] || 'Normal'\n };\n \n // Generate condition summary\n let conditionStatus = 'Stable';\n if (patient.json['Temperature'] && parseFloat(patient.json['Temperature']) > 100.4) {\n conditionStatus = 'Attention Required';\n }\n if (patient.json['Priority'] === 'Critical') {\n conditionStatus = 'Critical';\n }\n \n reportData.conditionStatus = conditionStatus;\n \n // Create email content\n reportData.emailSubject = `Daily Patient Report - ${reportData.patientName} (${reportData.patientId}) - ${conditionStatus}`;\n \n reportData.emailBody = `\nDear Doctor,\n\nDaily Patient Condition Report for ${currentDate}\n\n📋 PATIENT INFORMATION:\n━━━━━━━━━━━━━━━━━━━━━━━━\nPatient ID: ${reportData.patientId}\nName: ${reportData.patientName}\nAge: ${reportData.age}\nCondition Status: ${conditionStatus}\n\n🏥 CURRENT CONDITION:\n━━━━━━━━━━━━━━━━━━━━━━━━\n${reportData.condition}\n\n📊 VITAL SIGNS:\n━━━━━━━━━━━━━━━━━━━━━━━━\n• Temperature: ${reportData.vitals.temperature}°F\n• Blood Pressure: ${reportData.vitals.bloodPressure} mmHg\n• Heart Rate: ${reportData.vitals.heartRate} bpm\n\n💊 CURRENT MEDICATION:\n━━━━━━━━━━━━━━━━━━━━━━━━\n${reportData.medication}\n\n📅 Last Updated: ${reportData.lastUpdated}\nReport Generated: ${currentDate}\n\nPlease review and take necessary action if required.\n\nBest regards,\nPatient Monitoring System\n `;\n \n // Create WhatsApp message\n reportData.whatsappMessage = `🏥 *DAILY PATIENT REPORT*\\n\\n👤 *Patient:* ${reportData.patientName} (${reportData.patientId})\\n📊 *Status:* ${conditionStatus}\\n🌡️ *Temp:* ${reportData.vitals.temperature}°F\\n💓 *BP:* ${reportData.vitals.bloodPressure}\\n💗 *HR:* ${reportData.vitals.heartRate} bpm\\n\\n📋 *Condition:* ${reportData.condition}\\n💊 *Medication:* ${reportData.medication}\\n\\n📅 *Report Date:* ${currentDate}`;\n \n reports.push(reportData);\n}\n\nreturn reports.map(report => ({ json: report }));"
},
"typeVersion": 2
},
{
"id": "c71e8ca4-b4d6-4e42-94d0-195d67701bfa",
"name": "发送邮件报告",
"type": "n8n-nodes-base.emailSend",
"position": [
-620,
-340
],
"webhookId": "2b0fd8ed-e133-437e-8d14-01611b1aea0a",
"parameters": {
"options": {},
"subject": "={{ $json.emailSubject }}",
"toEmail": "={{ $json.doctorEmail }}",
"fromEmail": "your-email@gmail.com"
},
"credentials": {
"smtp": {
"id": "G1kyF8cSWTZ4vouN",
"name": "SMTP -test"
}
},
"typeVersion": 2
},
{
"id": "792824e8-ca46-4f2e-a4c8-95f8d3803ba2",
"name": "发送 WhatsApp 消息",
"type": "n8n-nodes-base.httpRequest",
"position": [
-620,
60
],
"parameters": {
"url": "https://api.whatsapp.com/send",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "phone",
"value": "={{ $json.doctorWhatsApp }}"
},
{
"name": "message",
"value": "={{ $json.whatsappMessage }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer YOUR_WHATSAPP_TOKEN"
}
]
}
},
"typeVersion": 4.1
},
{
"id": "426ad1c8-9ea1-450a-b0db-43b4cabd8745",
"name": "筛选危重患者",
"type": "n8n-nodes-base.filter",
"position": [
-620,
-140
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "critical-condition",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.conditionStatus }}",
"rightValue": "Critical"
}
]
}
},
"typeVersion": 2
},
{
"id": "86c379d4-90e8-451c-aa1e-4cbf7aca7aac",
"name": "发送危重警报",
"type": "n8n-nodes-base.emailSend",
"position": [
-400,
-140
],
"webhookId": "a4218d52-9285-424f-9392-cd7b443fc0da",
"parameters": {
"options": {},
"subject": "🚨 CRITICAL PATIENT ALERT - {{ $json.patientName }}",
"toEmail": "head.doctor@hospital.com,emergency@hospital.com",
"fromEmail": "your-email@gmail.com"
},
"credentials": {
"smtp": {
"id": "G1kyF8cSWTZ4vouN",
"name": "SMTP -test"
}
},
"typeVersion": 2
},
{
"id": "cb4d6e31-b6f0-4002-aba8-6abab3d457ef",
"name": "将报告记录到表格",
"type": "n8n-nodes-base.googleSheets",
"position": [
-620,
260
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=1",
"cachedResultName": "Reports_Log"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_GOOGLE_SHEET_ID"
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "ScSS2KxGQULuPtdy",
"name": "Google Sheets- test"
}
},
"typeVersion": 4
},
{
"id": "a64546a8-35b2-4c4c-ab5b-837c35ed7dff",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1880,
-480
],
"parameters": {
"color": 3,
"width": 660,
"height": 300,
"content": "## 工作原理"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "36797054-fa50-46b7-a02b-5417b8d49379",
"connections": {
"Read Patient Data": {
"main": [
[
{
"node": "Filter Active Patients",
"type": "main",
"index": 0
}
]
]
},
"Daily Trigger (8 AM)": {
"main": [
[
{
"node": "Read Patient Data",
"type": "main",
"index": 0
}
]
]
},
"Process Patient Data": {
"main": [
[
{
"node": "Send Email Report",
"type": "main",
"index": 0
},
{
"node": "Send WhatsApp Message",
"type": "main",
"index": 0
},
{
"node": "Filter Critical Patients",
"type": "main",
"index": 0
},
{
"node": "Log Report to Sheet",
"type": "main",
"index": 0
}
]
]
},
"Filter Active Patients": {
"main": [
[
{
"node": "Process Patient Data",
"type": "main",
"index": 0
}
]
]
},
"Filter Critical Patients": {
"main": [
[
{
"node": "Send Critical Alert",
"type": "main",
"index": 0
}
]
]
}
}
}如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 杂项, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Oneclick AI Squad
@oneclick-aiThe AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.
分享此工作流