AI医疗助手 - 多智能体演示系统
高级
这是一个AI Chatbot, Multimodal AI领域的自动化工作流,包含 52 个节点。主要使用 If, Set, Code, Switch, WhatsApp 等节点。 集成WhatsApp、GPT-4和Google Sheets的多智能体医疗助手
前置要求
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
- •Google Sheets API 凭证
- •PostgreSQL 数据库连接信息
使用的节点 (52)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "demo-healthcare-assistant-workflow",
"meta": {
"instanceId": "demo-instance-placeholder",
"templateCredsSetupCompleted": false
},
"name": "AI 医疗助手 - 多智能体演示系统",
"tags": [
"healthcare",
"demo",
"ai-agents",
"educational",
"multi-agent"
],
"nodes": [
{
"id": "sticky-note-warning",
"name": "⚠️ 演示警告与设置指南",
"type": "n8n-nodes-base.stickyNote",
"position": [
-800,
-400
],
"parameters": {
"width": 863,
"height": 464,
"content": "## ⚠️ 仅供教育演示 ⚠️"
},
"typeVersion": 1
},
{
"id": "sticky-note-architecture",
"name": "🏗️ 架构指南",
"type": "n8n-nodes-base.stickyNote",
"position": [
200,
-600
],
"parameters": {
"width": 400,
"height": 340,
"content": "## 🏗️ 架构概览"
},
"typeVersion": 1
},
{
"id": "sticky-note-processing",
"name": "🔄 处理流水线",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
-600
],
"parameters": {
"width": 400,
"height": 280,
"content": "## 🔄 多模态处理"
},
"typeVersion": 1
},
{
"id": "40c6fe48-7b5a-4c23-ac14-e19e77fb8e28",
"name": "预约系统",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1960,
-112
],
"parameters": {
"text": "={{ $json.chatInput }}",
"options": {
"systemMessage": "=You are Medical Appointment Assistant, the main AI agent for managing patient interactions on WhatsApp.\nYour job is to guide the patient through:\n\t1.\tIdentifying themselves\n\t2.\tRegistering if they are new\n\t3.\tScheduling appointments if they are an existing patient\n\t4.\tAnalyzing medical reports when provided\n\t5.\tAnalyzing prescriptions and verifying medicines\nYou must use only the Appointment Scheduler Tool, Register Patient Tool, Report Analyzer Tool, and Prescription Medicine Analyzer Tool to complete these tasks.\n\nCurrent Date & Time: {{ $now }}\n\nResponsibilities in Flow\n\t1.\tGreet the patient politely and professionally. Example:\n\"Hello! Welcome to the Medical Appointment Assistant. I can help you with registration, scheduling, analyzing medical reports, or verifying prescription medicines.\"\n\t2.\tCollect basic info: Full Name + Date of Birth.\n\t3.\tFind patient using the Appointment Scheduler Tool.\n\t4.\tIf found → Continue to appointment scheduling, report analysis, or prescription verification.\nIf not found → Offer registration with:\n\"I couldn't find a record for you. Would you like me to register you as a new patient?\"\n\t5.\tIf agreed → Pass control to Register Patient Tool. Wait until it completes before continuing.\n\t6.\tAfter registration (if requested) → Continue to appointment scheduling, report analysis, or prescription verification.\n\t7.\tFor appointments → Pass control to Appointment Scheduler Tool and wait for its response before updating the patient.\n\t8.\tFor report analysis → When patient sends medical reports, images, or documents, use the Report Analyzer Tool to provide detailed medical analysis and recommendations.\n\t9.\tFor prescription verification → When patient asks about medicines or uploads prescription/medicine photos, use the Prescription Medicine Analyzer Tool to verify medicines and provide prescription information.\n\t10.\tError handling: If a tool fails or info is missing, ask for the correct details in plain language.\n\t11.\tTone: Professional, concise, and empathetic. Avoid jargon. No assumptions.\n\t12.\tPrivacy: Handle patient data securely; share only as needed for the process.\n\nDocument Classification Intelligence\n\t•\tWhen patient uploads ANY document/image, first analyze the content to determine type:\n\t\t○\tIf it contains medicine names, dosages, doctor signatures, or prescription format → Use Prescription Medicine Analyzer Tool\n\t\t○\tIf it contains lab values, test results, medical measurements, or report format → Use Report Analyzer Tool\n\t\t○\tIf unclear, ask patient: \"I see you've uploaded a document. Is this a prescription from your doctor or a medical report/lab results?\"\n\t•\tALWAYS classify documents before routing to specialist tools\n\t•\tHandle both PDF documents and images equally for analysis\n\nReport Analysis Guidelines\n\t•\tWhen patients share medical reports, lab results, X-rays, or other medical documents, automatically use the Report Analyzer Tool\n\t•\tProvide clear, understandable explanations of findings\n\t•\tHighlight any concerning values or abnormalities\n\t•\tSuggest follow-up actions when appropriate\n\t•\tAlways recommend consulting with healthcare providers for medical advice\n\nPrescription Medicine Guidelines\n\t•\tWhen patients ask about medicines, prescriptions, or upload medicine photos, use the Prescription Medicine Analyzer Tool\n\t•\tHelp verify if medicines match prescriptions\n\t•\tProvide detailed prescription information\n\t•\tEnsure patient safety by identifying medicine discrepancies\n\t•\tAlways encourage verification with pharmacists and doctors\n\nConstraints\n\t•\tNo free-text scheduling, registration, report analysis, or prescription verification outside the tools.\n\t•\tNo status updates until the tool response arrives.\n\t•\tNo medical diagnosis - only report analysis, prescription information, and general health guidance.\n\t•\tALWAYS route documents to appropriate specialist tools based on content analysis."
},
"promptType": "define"
},
"typeVersion": 2.1
},
{
"id": "33b75de0-3e63-42db-9786-ed2dd7bd9dd5",
"name": "记忆存储",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
1376,
112
],
"parameters": {
"tableName": "demo_chat_histories",
"sessionKey": "={{ $('If').item.json.sessionId }}",
"sessionIdType": "customKey",
"contextWindowLength": 500
},
"credentials": {
"postgres": {
"id": "REPLACE_WITH_YOUR_POSTGRES_CREDENTIAL_ID",
"name": "Your PostgreSQL Database"
}
},
"typeVersion": 1.3
},
{
"id": "7ca21910-050e-442e-98b5-2e399f29f1ec",
"name": "OpenAI",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1248,
112
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "REPLACE_WITH_YOUR_OPENAI_CREDENTIAL_ID",
"name": "Your OpenAI API Key"
}
},
"typeVersion": 1.2
},
{
"id": "61add2e7-96cd-4259-a337-69b60fde97a1",
"name": "WA触发器",
"type": "n8n-nodes-base.whatsAppTrigger",
"position": [
-544,
-112
],
"webhookId": "REPLACE_WITH_YOUR_WEBHOOK_ID",
"parameters": {
"options": {},
"updates": [
"messages"
]
},
"credentials": {
"whatsAppTriggerApi": {
"id": "REPLACE_WITH_YOUR_WHATSAPP_TRIGGER_CREDENTIAL_ID",
"name": "Your WhatsApp Business API Trigger"
}
},
"typeVersion": 1
},
{
"id": "97c88a88-d253-4f76-b3c5-ab15353b333c",
"name": "准备输入",
"type": "n8n-nodes-base.code",
"position": [
576,
176
],
"parameters": {
"jsCode": "// Get incoming JSON from previous node\nconst data = items[0].json;\n\n// Initialize defaults\nlet sessionId = null;\nlet chatInput = null;\n\n// Check if it's a \"messages\" type payload with text\nif (Array.isArray(data.messages) && data.messages.length > 0) {\n const msg = data.messages[0];\n sessionId = msg.from || null;\n chatInput = msg.text?.body || null;\n}\n\n// If no messages, maybe it's a status update - extract recipient_id as sessionId\nif (!sessionId && Array.isArray(data.statuses) && data.statuses.length > 0) {\n sessionId = data.statuses[0].recipient_id || null;\n chatInput = null; // No text in statuses\n}\n\n// Output result\nreturn [\n {\n json: {\n sessionId,\n chatInput\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "8d4fa7c5-643c-4778-a800-87e53e4cf399",
"name": "创建患者",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
1584,
320
],
"parameters": {
"columns": {
"value": {
"Email": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Email', ``, 'string') }}",
"Notes": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Notes', ``, 'string') }}",
"Phone": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Phone', ``, 'string') }}",
"Gender": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Gender', ``, 'string') }}",
"Address": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Address', ``, 'string') }}",
"Full Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Full_Name', ``, 'string') }}",
"Patient ID": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Patient_ID', ``, 'string') }}",
"Date of Birth": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Date_of_Birth', ``, 'string') }}",
"Insurance Number": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Insurance_Number', ``, 'string') }}",
"Insurance Provider": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Insurance_Provider', ``, 'string') }}"
},
"schema": [
{
"id": "Patient ID",
"type": "string",
"display": true,
"required": false,
"displayName": "Patient ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Full Name",
"type": "string",
"display": true,
"required": false,
"displayName": "Full Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Date of Birth",
"type": "string",
"display": true,
"required": false,
"displayName": "Date of Birth",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Gender",
"type": "string",
"display": true,
"required": false,
"displayName": "Gender",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Phone",
"type": "string",
"display": true,
"required": false,
"displayName": "Phone",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Email",
"type": "string",
"display": true,
"required": false,
"displayName": "Email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Address",
"type": "string",
"display": true,
"required": false,
"displayName": "Address",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Insurance Provider",
"type": "string",
"display": true,
"required": false,
"displayName": "Insurance Provider",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Insurance Number",
"type": "string",
"display": true,
"required": false,
"displayName": "Insurance Number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Notes",
"type": "string",
"display": true,
"required": false,
"displayName": "Notes",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1589180996,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit#gid=1589180996",
"cachedResultName": "Patients"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "REPLACE_WITH_YOUR_GOOGLE_SHEET_ID",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit",
"cachedResultName": "Healthcare Demo Database"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "REPLACE_WITH_YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
"name": "Your Google Sheets OAuth2 API"
}
},
"typeVersion": 4.6
},
{
"id": "974011a8-1e55-421d-a8ac-c455998c3f5a",
"name": "计算器",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
1712,
320
],
"parameters": {},
"typeVersion": 1
},
{
"id": "2af83545-6277-4eeb-808a-6d7652c7e290",
"name": "获取最后患者ID",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
1840,
320
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1589180996,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit#gid=1589180996",
"cachedResultName": "Patients"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "REPLACE_WITH_YOUR_GOOGLE_SHEET_ID",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit",
"cachedResultName": "Healthcare Demo Database"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "REPLACE_WITH_YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
"name": "Your Google Sheets OAuth2 API"
}
},
"typeVersion": 4.6
},
{
"id": "6c10f0d4-d611-474d-af75-d7cf3e8a91e7",
"name": "记忆存储1",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
1456,
320
],
"parameters": {
"tableName": "demo_chat_histories",
"sessionKey": "={{ $('If').item.json.sessionId }}",
"sessionIdType": "customKey",
"contextWindowLength": 200
},
"credentials": {
"postgres": {
"id": "REPLACE_WITH_YOUR_POSTGRES_CREDENTIAL_ID",
"name": "Your PostgreSQL Database"
}
},
"typeVersion": 1.3
},
{
"id": "3ca96747-cdd2-4d83-81a3-a372db9944d4",
"name": "OpenAI1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1328,
320
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "REPLACE_WITH_YOUR_OPENAI_CREDENTIAL_ID",
"name": "Your OpenAI API Key"
}
},
"typeVersion": 1.2
},
{
"id": "00f712c0-ac42-4208-be4a-73cc9f8f8533",
"name": "患者注册工具",
"type": "@n8n/n8n-nodes-langchain.agentTool",
"position": [
1504,
112
],
"parameters": {
"text": "={{ $('If').item.json.chatInput }}",
"options": {
"systemMessage": "You are Medical Intake Assistant. Your job is to collect and confirm patient details for registration. You can only respond to registration-related queries.\n\nFlow\n\t1.\tCollect in order:\n\t•\tFull Name\n\t•\tDOB\n\t•\tGender (Male/Female/Other)\n\t•\tPhone\n\t•\tEmail\n\t•\tAddress\n\t•\tNotes (medical conditions, first-time visit, etc.)\n\t2.\tValidate & confirm details before saving.\n\t3.\tOn confirmation → Generate patient ID (using get_last_patient_id), then save via create_patient.\n\t4.\tAfter saving → Send a clear success message with a summary of stored details.\n\t5.\tGuardrails:\n\t•\tNo medical advice.\n\t•\tPolitely reject irrelevant/offensive content.\n\t•\tEnd session politely if the patient refuses."
},
"toolDescription": "Collects and verifies all required patient details, formats them correctly, and saves to the system using the create_patient tool."
},
"typeVersion": 2.2
},
{
"id": "74b8692f-1b12-41db-b594-7adf81b2c6ca",
"name": "预约排期工具",
"type": "@n8n/n8n-nodes-langchain.agentTool",
"position": [
2400,
112
],
"parameters": {
"text": "={{ $('If').item.json.chatInput }}",
"options": {
"systemMessage": "=You are Appointment Scheduling Assistant. Your job is to help patients book appointments by finding their record, showing available clinics and doctors, checking availability, and confirming bookings.\n\nFlow\n\t1.\tFind patient using find_patient with name + DOB.\n\t2.\tIf found → Continue. If not → Return “not found” to parent agent.\n\t3.\tAsk clinic preference → Use get_clinics to show list.\n\t4.\tAsk doctor preference → Use get_doctors for that clinic.\n\t5.\tAsk preferred date/time.\n\t•\tIf they ask for availability → Use get_availability to show slots.\n\t•\tIf chosen time is unavailable → Ask them to pick from available slots.\n\t6.\tConfirm appointment: Generate ID (find_last_entry_id), save via create_appointment.\n\t7.\tAfter saving → Send confirmation with clinic, doctor, date & time.\n\t8.\tGuardrails:\n\t•\tNo medical advice.\n\t•\tRedirect irrelevant queries back to appointment flow.\n\t9.\tTime awareness: Always use {{ $now }} to calculate future slots."
},
"toolDescription": "Finds existing patients, guides them through selecting clinic, doctor, and time slot, then saves the appointment."
},
"typeVersion": 2.2
},
{
"id": "35896748-805f-424f-9f8f-f3bbcc0c7e02",
"name": "获取诊所",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
2352,
320
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit#gid=0",
"cachedResultName": "Clinics"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "REPLACE_WITH_YOUR_GOOGLE_SHEET_ID",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit",
"cachedResultName": "Healthcare Demo Database"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "REPLACE_WITH_YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
"name": "Your Google Sheets OAuth2 API"
}
},
"typeVersion": 4.6
},
{
"id": "4916d7b8-0212-40d5-bc7b-fc586b7f6dfa",
"name": "获取医生",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
2480,
320
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 288581725,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit#gid=288581725",
"cachedResultName": "Doctors"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "REPLACE_WITH_YOUR_GOOGLE_SHEET_ID",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit",
"cachedResultName": "Healthcare Demo Database"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "REPLACE_WITH_YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
"name": "Your Google Sheets OAuth2 API"
}
},
"typeVersion": 4.6
},
{
"id": "47c02793-e83e-48a9-8cfe-fb0ed1e6bd31",
"name": "查找患者",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
2608,
320
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1589180996,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit#gid=1589180996",
"cachedResultName": "Patients"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "REPLACE_WITH_YOUR_GOOGLE_SHEET_ID",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit",
"cachedResultName": "Healthcare Demo Database"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "REPLACE_WITH_YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
"name": "Your Google Sheets OAuth2 API"
}
},
"typeVersion": 4.6
},
{
"id": "799a81f4-beea-494d-8ec0-9ac023d409c0",
"name": "创建预约",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
2736,
320
],
"parameters": {
"columns": {
"value": {
"Date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Date', ``, 'string') }}",
"Notes": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Notes', ``, 'string') }}",
"End Time": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End_Time', ``, 'string') }}",
"Entry ID": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Entry_ID', ``, 'string') }}",
"Clinic ID": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Clinic_ID', ``, 'string') }}",
"Doctor ID": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Doctor_ID', ``, 'string') }}",
"Patient ID": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Patient_ID', ``, 'string') }}",
"Start Time": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start_Time', ``, 'string') }}",
"Day of Week": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Day_of_Week', ``, 'string') }}",
"Doctor Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Doctor_Name', ``, 'string') }}",
"Patient Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Patient_Name', ``, 'string') }}",
"Appointment Status": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Appointment_Status', ``, 'string') }}"
},
"schema": [
{
"id": "Entry ID",
"type": "string",
"display": true,
"required": false,
"displayName": "Entry ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Date",
"type": "string",
"display": true,
"required": false,
"displayName": "Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Doctor ID",
"type": "string",
"display": true,
"required": false,
"displayName": "Doctor ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Doctor Name",
"type": "string",
"display": true,
"required": false,
"displayName": "Doctor Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Clinic ID",
"type": "string",
"display": true,
"required": false,
"displayName": "Clinic ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Day of Week",
"type": "string",
"display": true,
"required": false,
"displayName": "Day of Week",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Start Time",
"type": "string",
"display": true,
"required": false,
"displayName": "Start Time",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "End Time",
"type": "string",
"display": true,
"required": false,
"displayName": "End Time",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Patient ID",
"type": "string",
"display": true,
"required": false,
"displayName": "Patient ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Patient Name",
"type": "string",
"display": true,
"required": false,
"displayName": "Patient Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Appointment Status",
"type": "string",
"display": true,
"required": false,
"displayName": "Appointment Status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Notes",
"type": "string",
"display": true,
"required": false,
"displayName": "Notes",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 88166562,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit#gid=88166562",
"cachedResultName": "Appointments"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "REPLACE_WITH_YOUR_GOOGLE_SHEET_ID",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit",
"cachedResultName": "Healthcare Demo Database"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "REPLACE_WITH_YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
"name": "Your Google Sheets OAuth2 API"
}
},
"typeVersion": 4.6
},
{
"id": "4ffb9d02-8027-4ab4-9ea6-c7c55ec6dbb7",
"name": "获取可用时间",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
2864,
320
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1434233673,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit#gid=1434233673",
"cachedResultName": "Doctor Availability"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "REPLACE_WITH_YOUR_GOOGLE_SHEET_ID",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit",
"cachedResultName": "Healthcare Demo Database"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "REPLACE_WITH_YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
"name": "Your Google Sheets OAuth2 API"
}
},
"typeVersion": 4.6
},
{
"id": "c64ba23f-8f2d-4489-95bf-9ca9078e96f5",
"name": "查找最后条目ID",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
2992,
320
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 88166562,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit#gid=88166562",
"cachedResultName": "Appointments"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "REPLACE_WITH_YOUR_GOOGLE_SHEET_ID",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_YOUR_GOOGLE_SHEET_ID/edit",
"cachedResultName": "Healthcare Demo Database"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "REPLACE_WITH_YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
"name": "Your Google Sheets OAuth2 API"
}
},
"typeVersion": 4.6
},
{
"id": "8eba5511-ef63-40fe-aad5-90391d6bffc5",
"name": "Calculator1",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
2224,
320
],
"parameters": {},
"typeVersion": 1
},
{
"id": "c528d5e6-20c1-4a2a-99c9-63064184ad88",
"name": "记忆存储2",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
2096,
320
],
"parameters": {
"tableName": "demo_chat_histories",
"sessionKey": "={{ $('If').item.json.sessionId }}",
"sessionIdType": "customKey",
"contextWindowLength": 300
},
"credentials": {
"postgres": {
"id": "REPLACE_WITH_YOUR_POSTGRES_CREDENTIAL_ID",
"name": "Your PostgreSQL Database"
}
},
"typeVersion": 1.3
},
{
"id": "87aa4804-1771-4c16-80db-a43ee0b30080",
"name": "OpenAI2",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1968,
320
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "REPLACE_WITH_YOUR_OPENAI_CREDENTIAL_ID",
"name": "Your OpenAI API Key"
}
},
"typeVersion": 1.2
},
{
"id": "65936753-cf67-45a0-9acb-51e5ed679256",
"name": "条件判断",
"type": "n8n-nodes-base.if",
"position": [
1024,
-112
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "924ad748-14b9-4f08-a13b-c8b602c09e4a",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.chatInput }}",
"rightValue": "null"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "96fe8fb2-56ba-4be9-ac8c-62ac671bfba0",
"name": "条件分支",
"type": "n8n-nodes-base.switch",
"position": [
-320,
-144
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Image",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f2e2dbb1-7d6c-4592-a078-6541d92b871c",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.messages[0].image }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Document",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d97e949b-6df1-457b-9393-91726db54083",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.messages[0].document }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Audio",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f57a6d2f-97bf-4d0b-860f-3addbe4b91f7",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.messages[0].audio }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Text",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "741680c0-96e2-4845-b342-5d237c452011",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.messages[0].text }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "1c05dcc5-d95f-4c01-863f-13b0c030ee6c",
"name": "获取音频URL",
"type": "n8n-nodes-base.whatsApp",
"position": [
128,
-16
],
"webhookId": "REPLACE_WITH_YOUR_AUDIO_WEBHOOK_ID",
"parameters": {
"resource": "media",
"operation": "mediaUrlGet",
"mediaGetId": "={{ $json.messages[0].audio.id }}"
},
"credentials": {
"whatsAppApi": {
"id": "REPLACE_WITH_YOUR_WHATSAPP_API_CREDENTIAL_ID",
"name": "Your WhatsApp API Credentials"
}
},
"typeVersion": 1
},
{
"id": "cab87c78-2caf-4578-b299-a225227d7b0e",
"name": "下载音频",
"type": "n8n-nodes-base.httpRequest",
"position": [
352,
-16
],
"parameters": {
"url": "={{ $json.url }}",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "whatsAppApi"
},
"credentials": {
"whatsAppApi": {
"id": "REPLACE_WITH_YOUR_WHATSAPP_API_CREDENTIAL_ID",
"name": "Your WhatsApp API Credentials"
}
},
"typeVersion": 4.2
},
{
"id": "36c597ec-721b-49f3-aa88-033bec9a72cb",
"name": "转录音频",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
576,
-16
],
"parameters": {
"options": {},
"resource": "audio",
"operation": "transcribe"
},
"credentials": {
"openAiApi": {
"id": "REPLACE_WITH_YOUR_OPENAI_CREDENTIAL_ID",
"name": "Your OpenAI API Key"
}
},
"typeVersion": 1.8
},
{
"id": "773905d6-b2e0-4b23-a947-2afd2afec411",
"name": "音频提示",
"type": "n8n-nodes-base.set",
"position": [
800,
-16
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "7e03f0fa-b2ce-4a63-aaf1-b5a94ffec5a5",
"name": "sessionId",
"type": "string",
"value": "={{ $('WATrigger').item.json.contacts[0].wa_id }}"
},
{
"id": "491716ee-ed67-4440-aee5-28d808af85f2",
"name": "chatInput",
"type": "string",
"value": "={{ $json.text }}"
},
{
"id": "1fad22a7-35f1-48c5-b0a2-58a51d7a2537",
"name": "mode",
"type": "string",
"value": "audio"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "c0b6c4f4-e8e0-4269-acdc-9ddab6b1b355",
"name": "下载图像",
"type": "n8n-nodes-base.httpRequest",
"position": [
352,
-400
],
"parameters": {
"url": "={{ $json.url }}",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "whatsAppApi"
},
"credentials": {
"whatsAppApi": {
"id": "REPLACE_WITH_YOUR_WHATSAPP_API_CREDENTIAL_ID",
"name": "Your WhatsApp API Credentials"
}
},
"typeVersion": 4.2
},
{
"id": "58fc7e82-5b73-429e-9536-434d6ea908c3",
"name": "获取图像URL",
"type": "n8n-nodes-base.whatsApp",
"position": [
128,
-400
],
"webhookId": "REPLACE_WITH_YOUR_IMAGE_WEBHOOK_ID",
"parameters": {
"resource": "media",
"operation": "mediaUrlGet",
"mediaGetId": "={{ $('WhatsApp Trigger').item.json.messages[0].image.id }}"
},
"credentials": {
"whatsAppApi": {
"id": "REPLACE_WITH_YOUR_WHATSAPP_API_CREDENTIAL_ID",
"name": "Your WhatsApp API Credentials"
}
},
"typeVersion": 1
},
{
"id": "328f72a1-8491-4677-aff9-ba059f71c5dc",
"name": "分析图片",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
576,
-400
],
"parameters": {
"text": "=Please analyze this image and tell me what's in it. If it's a document, summarize the key details. If it's a photo, describe the contents.",
"modelId": {
"__rl": true,
"mode": "list",
"value": "chatgpt-4o-latest",
"cachedResultName": "CHATGPT-4O-LATEST"
},
"options": {},
"resource": "image",
"inputType": "base64",
"operation": "analyze"
},
"credentials": {
"openAiApi": {
"id": "REPLACE_WITH_YOUR_OPENAI_CREDENTIAL_ID",
"name": "Your OpenAI API Key"
}
},
"typeVersion": 1.8
},
{
"id": "f2abc060-ef0e-4ede-be37-4f515a760d7c",
"name": "文本提示",
"type": "n8n-nodes-base.set",
"position": [
800,
176
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "1bfd77fe-a9f8-4563-a948-924dc535d4eb",
"name": "sessionId",
"type": "string",
"value": "={{ $json.sessionId }}"
},
{
"id": "7b201648-2d56-462b-ba8c-21477353aad5",
"name": "action",
"type": "string",
"value": "sendMessage"
},
{
"id": "abb84573-fdf4-4f35-b58b-07c3a2fcecd6",
"name": "chatInput",
"type": "string",
"value": "={{ $json.chatInput }}"
},
{
"id": "993edb48-4b6d-485c-9777-c3ce279cba72",
"name": "mode",
"type": "string",
"value": "text"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "09a5bd9b-2ef6-466c-8270-52205681bf18",
"name": "生成音频",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
4048,
-208
],
"parameters": {
"input": "={{ $json.output }}",
"voice": "fable",
"options": {},
"resource": "audio"
},
"credentials": {
"openAiApi": {
"id": "REPLACE_WITH_YOUR_OPENAI_CREDENTIAL_ID",
"name": "Your OpenAI API Key"
}
},
"typeVersion": 1.8
},
{
"id": "85c9e073-9d6b-43b5-bbcb-74e8dc55b438",
"name": "响应",
"type": "n8n-nodes-base.if",
"position": [
3824,
-112
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9eda56be-322f-44cd-9baa-4bb1495aff14",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('If').item.json.mode }}",
"rightValue": "audio"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "39b15d2e-3a23-4085-8ba2-7411584c59dd",
"name": "文本消息",
"type": "n8n-nodes-base.whatsApp",
"position": [
4048,
-16
],
"webhookId": "REPLACE_WITH_YOUR_TEXT_MESSAGE_WEBHOOK_ID",
"parameters": {
"textBody": "={{ $json.output }}",
"operation": "send",
"phoneNumberId": "REPLACE_WITH_YOUR_PHONE_NUMBER_ID",
"additionalFields": {},
"recipientPhoneNumber": "={{ $('If').item.json.sessionId }}"
},
"credentials": {
"whatsAppApi": {
"id": "REPLACE_WITH_YOUR_WHATSAPP_API_CREDENTIAL_ID",
"name": "Your WhatsApp API Credentials"
}
},
"typeVersion": 1
},
{
"id": "8485cd52-a0c2-4645-b45a-c46f97ff1b6c",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
4272,
-208
],
"parameters": {
"jsCode": "// Loop over input items and change the MIME type of binary data\nfor (const item of $input.all()) {\n // Check if the item has binary data\n if (item.binary) {\n // Find the binary property name (assuming there's at least one)\n const binaryPropertyNames = Object.keys(item.binary);\n\n for (const propName of binaryPropertyNames) {\n // If the MIME type is 'audio/mp3', change it to 'audio/mpeg'\n if (item.binary[propName].mimeType === \"audio/mp3\") {\n item.binary[propName].mimeType = \"audio/mpeg\";\n }\n }\n }\n}\n\nreturn $input.all();"
},
"typeVersion": 2
},
{
"id": "4b0d7acc-abbf-494b-a282-e3c9654c19f2",
"name": "音频响应",
"type": "n8n-nodes-base.whatsApp",
"position": [
4496,
-208
],
"webhookId": "REPLACE_WITH_YOUR_AUDIO_RESPONSE_WEBHOOK_ID",
"parameters": {
"mediaPath": "useMedian8n",
"operation": "send",
"messageType": "audio",
"phoneNumberId": "REPLACE_WITH_YOUR_PHONE_NUMBER_ID",
"additionalFields": {},
"recipientPhoneNumber": "={{ $('If').item.json.sessionId }}"
},
"credentials": {
"whatsAppApi": {
"id": "REPLACE_WITH_YOUR_WHATSAPP_API_CREDENTIAL_ID",
"name": "Your WhatsApp API Credentials"
}
},
"typeVersion": 1
},
{
"id": "e35299b7-476d-4d28-a904-2ac061ab86c2",
"name": "获取文档",
"type": "n8n-nodes-base.whatsApp",
"position": [
-96,
-208
],
"webhookId": "REPLACE_WITH_YOUR_DOCUMENT_WEBHOOK_ID",
"parameters": {
"resource": "media",
"operation": "mediaUrlGet",
"mediaGetId": "={{ $json.messages[0].document.id }}"
},
"credentials": {
"whatsAppApi": {
"id": "REPLACE_WITH_YOUR_WHATSAPP_API_CREDENTIAL_ID",
"name": "Your WhatsApp API Credentials"
}
},
"typeVersion": 1
},
{
"id": "ac3fc974-139a-4d83-9edf-43e064586036",
"name": "下载文档",
"type": "n8n-nodes-base.httpRequest",
"position": [
128,
-208
],
"parameters": {
"url": "={{ $json.url }}",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "whatsAppApi"
},
"credentials": {
"whatsAppApi": {
"id": "REPLACE_WITH_YOUR_WHATSAPP_API_CREDENTIAL_ID",
"name": "Your WhatsApp API Credentials"
}
},
"typeVersion": 4.2
},
{
"id": "f0ac2007-3139-4ad9-8d1d-2882095e5208",
"name": "分析图像文本",
"type": "n8n-nodes-base.whatsApp",
"position": [
-96,
-400
],
"webhookId": "REPLACE_WITH_YOUR_IMAGE_ANALYSIS_WEBHOOK_ID",
"parameters": {
"textBody": "Analyzing image…",
"operation": "send",
"phoneNumberId": "REPLACE_WITH_YOUR_PHONE_NUMBER_ID",
"additionalFields": {},
"recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
},
"credentials": {
"whatsAppApi": {
"id": "REPLACE_WITH_YOUR_WHATSAPP_API_CREDENTIAL_ID",
"name": "Your WhatsApp API Credentials"
}
},
"typeVersion": 1
},
{
"id": "f271af84-88b8-4761-9402-14c86a1bf860",
"name": "如果是PDF文件",
"type": "n8n-nodes-base.if",
"position": [
352,
-208
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "03affec6-8e7b-459d-a08a-c9af2660e319",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.mime_type }}",
"rightValue": "application/pdf"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "4542ea3c-b4c6-49e6-abc1-254821dbf4fe",
"name": "从PDF文件提取",
"type": "n8n-nodes-base.extractFromFile",
"position": [
576,
-208
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "8de3dcbe-04f8-4668-8665-dfeee228926a",
"name": "文档提示",
"type": "n8n-nodes-base.set",
"position": [
800,
-208
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "7e03f0fa-b2ce-4a63-aaf1-b5a94ffec5a5",
"name": "sessionId",
"type": "string",
"value": "={{ $('WATrigger').item.json.contacts[0].wa_id }}"
},
{
"id": "491716ee-ed67-4440-aee5-28d808af85f2",
"name": "chatInput",
"type": "string",
"value": "={{ $json.text }}"
},
{
"id": "1fad22a7-35f1-48c5-b0a2-58a51d7a2537",
"name": "mode",
"type": "string",
"value": "document"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "a55056a0-b773-4c4c-aa01-b4a51bd6bde1",
"name": "图片提示",
"type": "n8n-nodes-base.set",
"position": [
800,
-400
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "7e03f0fa-b2ce-4a63-aaf1-b5a94ffec5a5",
"name": "sessionId",
"type": "string",
"value": "={{ $('WATrigger').item.json.contacts[0].wa_id }}"
},
{
"id": "491716ee-ed67-4440-aee5-28d808af85f2",
"name": "chatInput",
"type": "string",
"value": "={{ $json.content }}"
},
{
"id": "1fad22a7-35f1-48c5-b0a2-58a51d7a2537",
"name": "mode",
"type": "string",
"value": "image"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "efc85109-b38a-44d5-908d-9504dd026d95",
"name": "报告分析工具",
"type": "@n8n/n8n-nodes-langchain.agentTool",
"position": [
3168,
112
],
"parameters": {
"text": "={{ $('If').item.json.chatInput }}",
"options": {
"systemMessage": "=You are Medical Report Analyzer, a specialized AI assistant for analyzing medical reports and healthcare documents.\n\nYour job is to:\n\t1.\tAnalyze medical reports, lab results, X-rays, scans, and other healthcare documents\n\t2.\tProvide clear, understandable explanations of medical findings\n\t3.\tHighlight any abnormal values or concerning findings\n\t4.\tSuggest appropriate follow-up actions\n\t5.\tEducate patients about their health conditions in simple terms\n\nAnalysis Flow:\n\t1.\tCarefully review all provided medical documents\n\t2.\tIdentify key findings, test results, and measurements\n\t3.\tCompare values against normal reference ranges\n\t4.\tHighlight any abnormalities or areas of concern\n\t5.\tExplain findings in patient-friendly language\n\t6.\tProvide general health recommendations\n\t7.\tAlways recommend consulting healthcare providers for medical decisions\n\nReport Analysis Guidelines:\n\t•\tUse clear, non-medical language that patients can understand\n\t•\tExplain what each test measures and why it's important\n\t•\tHighlight abnormal values and explain their potential significance\n\t•\tProvide context for findings (mild, moderate, severe)\n\t•\tSuggest lifestyle modifications when appropriate\n\t•\tRecommend follow-up tests or consultations when needed\n\nImportant Disclaimers:\n\t•\tAlways include: \"This analysis is for informational purposes only\"\n\t•\tState: \"Please consult your healthcare provider for medical advice\"\n\t•\tEmphasize: \"Do not use this analysis to make medical decisions\"\n\t•\tClarify: \"Your doctor should interpret these results in context of your full medical history\"\n\nTone and Approach:\n\t•\tProfessional yet compassionate\n\t•\tEducational and informative\n\t•\tReassuring when appropriate\n\t•\tClear about limitations\n\t•\tEncouraging patients to seek professional medical care\n\nConstraints:\n\t•\tNo medical diagnosis or treatment recommendations\n\t•\tNo prescription advice\n\t•\tFocus on education and explanation only\n\t•\tAlways defer to healthcare professionals for medical decisions"
},
"toolDescription": "Analyzes medical reports, lab results, X-rays, and other healthcare documents to provide clear explanations of findings, highlight abnormalities, and suggest follow-up actions."
},
"typeVersion": 2.2
},
{
"id": "80503116-466c-4502-8a16-fea22b28c76a",
"name": "OpenAI3",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
3120,
320
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "REPLACE_WITH_YOUR_OPENAI_CREDENTIAL_ID",
"name": "Your OpenAI API Key"
}
},
"typeVersion": 1.2
},
{
"id": "9c833ba6-b715-4baa-a35c-adc4b14e7f5a",
"name": "记忆存储3",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
3264,
320
],
"parameters": {
"tableName": "demo_chat_histories",
"sessionKey": "={{ $('If').item.json.sessionId }}",
"sessionIdType": "customKey",
"contextWindowLength": 300
},
"credentials": {
"postgres": {
"id": "REPLACE_WITH_YOUR_POSTGRES_CREDENTIAL_ID",
"name": "Your PostgreSQL Database"
}
},
"typeVersion": 1.3
},
{
"id": "b6f91465-240d-46d5-8f88-151a92c2ffea",
"name": "处方药品分析工具",
"type": "@n8n/n8n-nodes-langchain.agentTool",
"position": [
3456,
112
],
"parameters": {
"text": "={{ $('If').item.json.chatInput }}",
"options": {
"systemMessage": "=You are Prescription Medicine Analyzer, a specialized AI assistant for analyzing doctor prescriptions and verifying medicine authenticity.\n\nYour job is to:\n\t1.\tAnalyze doctor prescriptions from PDF or image uploads\n\t2.\tExtract and list all prescribed medications with details\n\t3.\tVerify if uploaded medicine photos match the prescription\n\t4.\tAnswer questions about prescribed medications\n\t5.\tProvide medicine information and usage guidance\n\t6.\tEnsure patient safety by identifying discrepancies\n\nAnalysis Flow:\n\t1.\tCheck if patient has uploaded a prescription first\n\t2.\tIf no prescription → Request prescription upload before proceeding\n\t3.\tExtract all medicine details from prescription:\n\t\t•\tMedicine names (generic and brand)\n\t\t•\tDosage and strength\n\t\t•\tFrequency and duration\n\t\t•\tSpecial instructions\n\t\t•\tDoctor's notes\n\t4.\tWhen medicine photo is uploaded → Compare with prescription\n\t5.\tProvide detailed verification results\n\t6.\tAnswer specific questions about medications\n\nPrescription Requirements:\n\t•\tAlways ask for prescription upload first if not provided\n\t•\tSay: \"Please upload your doctor's prescription (PDF or image) before I can help verify your medicines\"\n\t•\tOnly proceed with medicine verification after prescription is analyzed\n\nMedicine Verification Process:\n\t1.\tCompare medicine name on package with prescribed name\n\t2.\tCheck dosage/strength matches prescription\n\t3.\tVerify manufacturer if visible\n\t4.\tCheck expiration date\n\t5.\tIdentify any discrepancies or concerns\n\t6.\tProvide clear match/no-match result\n\nInformation to Provide:\n\t•\tComplete list of prescribed medicines\n\t•\tDosage instructions for each medicine\n\t•\tTiming and frequency details\n\t•\tFood/meal instructions\n\t•\tDuration of treatment\n\t•\tSpecial precautions or warnings\n\t•\tMedicine verification results\n\nSafety Guidelines:\n\t•\tAlert if medicine doesn't match prescription\n\t•\tWarn about expired medications\n\t•\tHighlight dosage discrepancies\n\t•\tRecommend consulting pharmacist/doctor for concerns\n\t•\tNever recommend changing prescribed medications\n\nResponse Format for Medicine Verification:\n\t✅ MATCH: [Medicine name] matches your prescription\n\t❌ NO MATCH: [Medicine name] does not match - prescribed: [correct medicine]\n\t⚠️ WARNING: [Specific concern about the medicine]\n\nImportant Disclaimers:\n\t•\t\"Always verify medicines with your pharmacist\"\n\t•\t\"This analysis is for informational purposes only\"\n\t•\t\"Consult your doctor before making any changes\"\n\t•\t\"Double-check all medicines before taking them\"\n\nTone and Approach:\n\t•\tSafety-focused and cautious\n\t•\tClear and detailed explanations\n\t•\tHelpful in organizing medicine information\n\t•\tEncouraging verification with healthcare professionals\n\nConstraints:\n\t•\tRequire prescription upload before medicine verification\n\t•\tNo medical advice beyond prescription information\n\t•\tFocus on verification and information only\n\t•\tAlways prioritize patient safety"
},
"toolDescription": "Analyzes doctor prescriptions and verifies if uploaded medicine photos match prescribed medications. Provides detailed information about prescribed medicines and answers prescription-related questions."
},
"typeVersion": 2.2
},
{
"id": "12eb3668-a0c4-4ee0-9262-0404a68f3f0d",
"name": "OpenAI4",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
3392,
320
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "REPLACE_WITH_YOUR_OPENAI_CREDENTIAL_ID",
"name": "Your OpenAI API Key"
}
},
"typeVersion": 1.2
},
{
"id": "d1e82338-eccb-43f2-bbc3-dd1e4f86f0d8",
"name": "记忆存储4",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
3536,
320
],
"parameters": {
"tableName": "demo_chat_histories",
"sessionKey": "={{ $('If').item.json.sessionId }}",
"sessionIdType": "customKey",
"contextWindowLength": 300
},
"credentials": {
"postgres": {
"id": "REPLACE_WITH_YOUR_POSTGRES_CREDENTIAL_ID",
"name": "Your PostgreSQL Database"
}
},
"typeVersion": 1.3
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "demo-healthcare-assistant-v1.0",
"connections": {
"If": {
"main": [
[
{
"node": "Appointment System",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Audio Response",
"type": "main",
"index": 0
}
]
]
},
"Memory": {
"ai_memory": [
[
{
"node": "Appointment System",
"type": "ai_memory",
"index": 0
}
]
]
},
"OpenAI": {
"ai_languageModel": [
[
{
"node": "Appointment System",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Analyzing Image Text",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Document",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Audio URL",
"type": "main",
"index": 0
}
],
[
{
"node": "PrepareInput",
"type": "main",
"index": 0
}
]
]
},
"Memory1": {
"ai_memory": [
[
{
"node": "Register Patient Tool",
"type": "ai_memory",
"index": 0
}
]
]
},
"Memory2": {
"ai_memory": [
[
{
"node": "Appointment Scheduler Tool",
"type": "ai_memory",
"index": 0
}
]
]
},
"Memory3": {
"ai_memory": [
[
{
"node": "Report Analyzer Tool",
"type": "ai_memory",
"index": 0
}
]
]
},
"Memory4": {
"ai_memory": [
[
{
"node": "Prescription Medicine Analyzer Tool",
"type": "ai_memory",
"index": 0
}
]
]
},
"OpenAI1": {
"ai_languageModel": [
[
{
"node": "Register Patient Tool",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI2": {
"ai_languageModel": [
[
{
"node": "Appointment Scheduler Tool",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI3": {
"ai_languageModel": [
[
{
"node": "Report Analyzer Tool",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI4": {
"ai_languageModel": [
[
{
"node": "Prescription Medicine Analyzer Tool",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"response": {
"main": [
[
{
"node": "Generate Audio",
"type": "main",
"index": 0
}
],
[
{
"node": "Text Message",
"type": "main",
"index": 0
}
]
]
},
"WATrigger": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Calculator": {
"ai_tool": [
[
{
"node": "Register Patient Tool",
"type": "ai_tool",
"index": 0
}
]
]
},
"Calculator1": {
"ai_tool": [
[
{
"node": "Appointment Scheduler Tool",
"type": "ai_tool",
"index": 0
}
]
]
},
"If PDF File": {
"main": [
[
{
"node": "Extract from PDF File",
"type": "main",
"index": 0
}
]
]
},
"Text Prompt": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"get_clinics": {
"ai_tool": [
[
{
"node": "Appointment Scheduler Tool",
"type": "ai_tool",
"index": 0
}
]
]
},
"get_doctors": {
"ai_tool": [
[
{
"node": "Appointment Scheduler Tool",
"type": "ai_tool",
"index": 0
}
]
]
},
"Audio Prompt": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Get Document": {
"main": [
[
{
"node": "Download Document",
"type": "main",
"index": 0
}
]
]
},
"Image Prompt": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"PrepareInput": {
"main": [
[
{
"node": "Text Prompt",
"type": "main",
"index": 0
}
]
]
},
"Text Message": {
"main": [
[]
]
},
"find_patient": {
"ai_tool": [
[
{
"node": "Appointment Scheduler Tool",
"type": "ai_tool",
"index": 0
}
]
]
},
"Analyze Image": {
"main": [
[
{
"node": "Image Prompt",
"type": "main",
"index": 0
}
]
]
},
"Get Audio URL": {
"main": [
[
{
"node": "Download Audio",
"type": "main",
"index": 0
}
]
]
},
"Get Image URL": {
"main": [
[
{
"node": "Download Image",
"type": "main",
"index": 0
}
]
]
},
"Download Audio": {
"main": [
[
{
"node": "Transcribe Audio",
"type": "main",
"index": 0
}
]
]
},
"Download Image": {
"main": [
[
{
"node": "Analyze Image",
"type": "main",
"index": 0
}
]
]
},
"Generate Audio": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"create_patient": {
"ai_tool": [
[
{
"node": "Register Patient Tool",
"type": "ai_tool",
"index": 0
}
]
]
},
"Document Prompt": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Transcribe Audio": {
"main": [
[
{
"node": "Audio Prompt",
"type": "main",
"index": 0
}
]
]
},
"get_availability": {
"ai_tool": [
[
{
"node": "Appointment Scheduler Tool",
"type": "ai_tool",
"index": 0
}
]
]
},
"Download Document": {
"main": [
[
{
"node": "If PDF File",
"type": "main",
"index": 0
}
]
]
},
"Appointment System": {
"main": [
[
{
"node": "response",
"type": "main",
"index": 0
}
]
]
},
"create_appointment": {
"ai_tool": [
[
{
"node": "Appointment Scheduler Tool",
"type": "ai_tool",
"index": 0
}
]
]
},
"find_last_entry_id": {
"ai_tool": [
[
{
"node": "Appointment Scheduler Tool",
"type": "ai_tool",
"index": 0
}
]
]
},
"get_last_patient_id": {
"ai_tool": [
[
{
"node": "Register Patient Tool",
"type": "ai_tool",
"index": 0
}
]
]
},
"Analyzing Image Text": {
"main": [
[
{
"node": "Get Image URL",
"type": "main",
"index": 0
}
]
]
},
"Report Analyzer Tool": {
"ai_tool": [
[
{
"node": "Appointment System",
"type": "ai_tool",
"index": 0
}
]
]
},
"Extract from PDF File": {
"main": [
[
{
"node": "Document Prompt",
"type": "main",
"index": 0
}
]
]
},
"Register Patient Tool": {
"ai_tool": [
[
{
"node": "Appointment System",
"type": "ai_tool",
"index": 0
}
]
]
},
"Appointment Scheduler Tool": {
"ai_tool": [
[
{
"node": "Appointment System",
"type": "ai_tool",
"index": 0
}
]
]
},
"Prescription Medicine Analyzer Tool": {
"ai_tool": [
[
{
"node": "Appointment System",
"type": "ai_tool",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - AI 聊天机器人, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
商业AI指挥中心:Google Workspace模块化代理、向量搜索与多渠道报告
商业AI指挥中心:Google Workspace模块化代理、向量搜索与多渠道报告
Set
Gmail
Slack
+35
80 节点Paul
文档提取
餐厅 WhatsApp AI 助手(外卖服务)
餐厅订单与配送系统,基于WhatsApp、GPT-4o和Supabase
If
Set
Code
+13
55 节点Rodrigo
客服机器人
WhatsApp AI助手(使用Claude和GPT4O):多格式处理与生产力套件
WhatsApp AI助手(使用Claude和GPT4O):多格式处理与生产力套件
If
Set
Code
+17
51 节点Growth AI
内容创作
高级多代理AI个人助手(250+任务能力,WhatsApp + GPT)
高级多代理AI个人助手(250+任务能力,WhatsApp + GPT)
Set
Switch
Whats App
+26
213 节点Electrabot
个人效率
多服务任务自动化:基于GPT的代理系统通过WhatsApp
通过WhatsApp的基于GPT代理系统的多服务任务自动化
Set
Switch
Whats App
+25
214 节点Gain FLow AI
个人效率
基于AI的WhatsApp客户服务(GPT-4、智能路由与知识库)
基于AI的WhatsApp客户服务(GPT-4、智能路由与知识库)
Set
Gmail
Merge
+19
45 节点Paul
AI 聊天机器人
工作流信息
难度等级
高级
节点数量52
分类2
节点类型16
作者
Fakhar Khan
@fakharkhanAutomation expert specialized in n8n. I design and build AI-powered workflows that streamline operations, automate lead generation, and enhance customer engagement. Passionate about low-code automation and integrating tools like OpenAI, WhatsApp, Slack, and CRMs. Organizer of n8n events in Pakistan, helping businesses scale with smart, efficient automation systems.
外部链接
在 n8n.io 查看 →
分享此工作流