AI医疗报告生成器
高级
这是一个Document Extraction, AI Summarization领域的自动化工作流,包含 21 个节点。主要使用 Set, Code, Gmail, GoogleDocs, GoogleDrive 等节点。 使用Gemini AI和Google Workspace从电子邮件生成医疗报告
前置要求
- •Google 账号和 Gmail API 凭证
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
- •Google Gemini API Key
使用的节点 (21)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "iKLz8kl2wKbZDjdk",
"meta": {
"instanceId": "7f1a0694161455be3a7e71f1e0dea04908b0376a1a81e3a0c1e5ac879d48f83a"
},
"name": "AI医疗报告生成器",
"tags": [],
"nodes": [
{
"id": "91a19c78-df6d-42b2-85d7-abc7869b8942",
"name": "Gmail 触发器",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-528,
96
],
"parameters": {
"simple": false,
"filters": {
"sender": "your-doctor-email@example.com"
},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyHour"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "OVQrwg5oLZomwQcs",
"name": "Gmail account"
}
},
"typeVersion": 1.2
},
{
"id": "baa74409-0c1a-4bc9-8f84-a4af654509ff",
"name": "编辑字段",
"type": "n8n-nodes-base.set",
"notes": "🛠 *Extracts the raw email content* into a new field called `content` for AI processing.",
"position": [
-240,
96
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "d4b7d4b4-3daa-4804-bf99-fadfed1b7bb2",
"name": "content",
"type": "string",
"value": "={{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "f4b76891-0cbe-4dab-a1f2-f2ce347f6d73",
"name": "在表格中追加行",
"type": "n8n-nodes-base.googleSheets",
"position": [
656,
0
],
"parameters": {
"columns": {
"value": {
"Date": "={{ $json.date }}",
"Diagnoses": "={{ $json.diagnosis }}",
"Patient Name": "={{ $json.patient_name }}",
"Doctor's Name": "={{ $json.doctor_name }}",
"Patient Phone Num.": "={{ $json.phone_number }}"
},
"schema": [
{
"id": "Date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Patient Name",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Patient Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Patient Phone Num.",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Patient Phone Num.",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Doctor's Name",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Doctor's Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Diagnoses",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Diagnoses",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Description ",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Description ",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Attachments",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Attachments",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 12488983,
"cachedResultUrl": "https://your-google-sheet-url/d/1EZgjpZ2B1umVImyMItfaHRn7Gi2T-y9etYmUNQZNiRw/edit#gid=12488983",
"cachedResultName": "Sheet2"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1EZgjpZ2B1umVImyMItfaHRn7Gi2T-y9etYmUNQZNiRw",
"cachedResultUrl": "https://your-google-sheet-url/d/1EZgjpZ2B1umVImyMItfaHRn7Gi2T-y9etYmUNQZNiRw/edit?usp=drivesdk",
"cachedResultName": "your-sheet-name"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "f5DnmArZjB6jGZsb",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "f64e9b78-dc5d-4556-8322-1175a33dd062",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
0,
0
],
"parameters": {
"text": "=Extract the following details from the input below and return them in raw JSON format:\n\n- patient_name \n- doctor_name (if not found, return null) \n- diagnosis \n- phone_number (must start with 0111) \n- date (use today’s date in YYYY-MM-DD format)\n\nINPUT:\n{{ $json.content }}\n\nRespond ONLY with JSON like this:\n{\n \"patient_name\": \"john doe\",\n \"doctor_name\": null,\n \"diagnosis\": \"diaria\",\n \"phone_number\": \"0111xxxxxxx\",\n \"date\": \"2025-07-21\"\n}\n",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.1
},
{
"id": "d0efc2af-649e-40b8-8dd9-eeeecdfaf488",
"name": "Google Gemini聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"notes": "⚙️ *Specifies the AI model* (Gemini) used by the AI Agent for text understanding.",
"position": [
-48,
288
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.0-flash-lite"
},
"credentials": {
"googlePalmApi": {
"id": "sveFXq4gBIkY17aH",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "63c7245b-1c50-45ad-a136-075e92eec522",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
352,
0
],
"parameters": {
"jsCode": "const rawOutput = $json[\"output\"];\n\n// Remove ```json ... ``` if it exists\nconst cleaned = rawOutput.replace(/```json\\n?|```/g, \"\").trim();\n\nconst parsed = JSON.parse(cleaned);\n\nreturn [\n {\n json: parsed\n }\n];"
},
"typeVersion": 2
},
{
"id": "8d11f752-f45c-4b55-b586-d16ad75ae194",
"name": "更新文档1",
"type": "n8n-nodes-base.googleDocs",
"position": [
1216,
0
],
"parameters": {
"actionsUi": {
"actionFields": [
{
"rows": 2,
"action": "insert",
"object": "table",
"columns": 2
},
{
"text": "{{date}}",
"action": "replaceAll",
"replaceText": "={{ $('Append row in sheet').item.json.Date }}"
},
{
"rows": 3,
"action": "insert",
"object": "table",
"columns": 3
},
{
"text": "{{patient_name}}",
"action": "replaceAll",
"replaceText": "={{ $('Append row in sheet').item.json['Patient Name'] }}"
}
]
},
"operation": "update",
"documentURL": "https://your-google-doc-url/d/1UzqfWelQRYC_i9Q_7snYJ8h67b3-qfLK9YxGiKgl25k/edit?tab=t.0"
},
"credentials": {
"googleDocsOAuth2Api": {
"id": "rV6dJKMg47R7CTiD",
"name": "Google Docs account"
}
},
"typeVersion": 2
},
{
"id": "ed90c89e-c092-4e07-95ae-a2a229bb994a",
"name": "复制文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
960,
0
],
"parameters": {
"name": "=your-doc-template-name - {{ $json['Patient Name'] }}",
"fileId": {
"__rl": true,
"mode": "list",
"value": "1UzqfWelQRYC_i9Q_7snYJ8h67b3-qfLK9YxGiKgl25k",
"cachedResultUrl": "https://your-google-doc-url/d/1UzqfWelQRYC_i9Q_7snYJ8h67b3-qfLK9YxGiKgl25k/edit?usp=drivesdk",
"cachedResultName": "your-doc-template-name"
},
"options": {},
"operation": "copy"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "0BHskfXCrCwPuBL0",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "472e8004-5605-4275-9975-e2bfe105a517",
"name": "发送消息",
"type": "n8n-nodes-base.gmail",
"position": [
2016,
0
],
"webhookId": "16e8b9db-f57a-4f9b-80d8-1300f57fcdc3",
"parameters": {
"sendTo": "recipient@example.com",
"message": "Please find the your-doc-template-name attached",
"options": {
"attachmentsUi": {
"attachmentsBinary": [
{}
]
}
},
"subject": "=your-doc-template-name - {{ $('Code').item.json.patient_name }}",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"id": "OVQrwg5oLZomwQcs",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "52c9ce22-4874-4d5b-a75f-e620a4c0c6e0",
"name": "HTTP请求",
"type": "n8n-nodes-base.httpRequest",
"position": [
1504,
0
],
"parameters": {
"url": "=https://www.googleapis.com/drive/v3/files/{{ $node[\"Copy file\"].json[\"id\"] }}/export?mimeType=application/pdf\n",
"options": {},
"sendQuery": true,
"authentication": "predefinedCredentialType",
"queryParameters": {
"parameters": [
{}
]
},
"nodeCredentialType": "googleDriveOAuth2Api"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "0BHskfXCrCwPuBL0",
"name": "Google Drive account"
}
},
"typeVersion": 4.2
},
{
"id": "6ac43c97-8545-4811-b304-44e053b61071",
"name": "代码1",
"type": "n8n-nodes-base.code",
"position": [
1760,
0
],
"parameters": {
"jsCode": "const patientName = $node[\"HTTP Request\"].json.patientName;\nconst dateStr = new Date().toISOString().split('T')[0]; // e.g. \"2025-07-21\"\nitems[0].binary.data.fileName = `${$('Append row in sheet').first().json['Patient Name']}_${dateStr}.pdf`;\nitems[0].binary.data.mimeType = 'application/pdf';\nreturn items;"
},
"typeVersion": 2
},
{
"id": "6aa03f0e-dff0-4f33-943b-064c499863a9",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
-160
],
"parameters": {
"color": 3,
"content": "🔔 *触发* 工作流当收到来自特定发件人(如医生)的新邮件时"
},
"typeVersion": 1
},
{
"id": "14165e9d-eff7-40a6-b035-390de5c430b2",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-304,
-160
],
"parameters": {
"color": 5,
"content": "🛠 *提取原始邮件内容* 到名为`content`的新字段中供AI处理"
},
"typeVersion": 1
},
{
"id": "f2adb4f2-1fd2-4e91-99cc-929f3b158dcb",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
-176
],
"parameters": {
"color": 4,
"content": "🤖 *使用AI处理文本* 以提取结构化信息(如患者姓名、医生姓名等)"
},
"typeVersion": 1
},
{
"id": "6f55af2f-ac25-4462-be9e-6284fd1fdbf6",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
288,
-176
],
"parameters": {
"color": 3,
"content": "🧹 *清理和解析* AI响应,移除Markdown代码格式并转换为可用的JSON"
},
"typeVersion": 1
},
{
"id": "d93463fb-9399-4c51-bec9-26d29bd161b0",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
576,
-176
],
"parameters": {
"color": 5,
"content": "📄 *添加提取的数据*(患者信息、诊断结果等)到特定的Google Sheets行"
},
"typeVersion": 1
},
{
"id": "c8176919-4a09-4330-a481-6de25440845f",
"name": "便利贴5",
"type": "n8n-nodes-base.stickyNote",
"position": [
880,
-176
],
"parameters": {
"color": 3,
"content": "📁 *创建副本* 为当前患者复制Google Docs医疗报告模板"
},
"typeVersion": 1
},
{
"id": "28dd3b51-feba-4981-8b4b-156f3dedbb07",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1152,
-176
],
"parameters": {
"color": 5,
"content": "📝 *替换占位符*(如患者姓名/日期)在复制的Google Doc中使用真实数据"
},
"typeVersion": 1
},
{
"id": "a966576b-0bfe-4d03-acbe-8475c93c3a9e",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
1424,
-176
],
"parameters": {
"color": 3,
"content": "📤 *导出更新后的Google Doc* 通过Google Drive API转换为PDF"
},
"typeVersion": 1
},
{
"id": "7853e5d4-27e0-4b7e-beed-a85704f5fd4e",
"name": "便签8",
"type": "n8n-nodes-base.stickyNote",
"position": [
1680,
-176
],
"parameters": {
"color": 5,
"content": "📛 *重命名PDF文件* 使用患者姓名和日期,并附加元数据"
},
"typeVersion": 1
},
{
"id": "f9504b84-ce1a-4dca-8378-fc8bf4183bfa",
"name": "便签9",
"type": "n8n-nodes-base.stickyNote",
"position": [
1936,
-176
],
"parameters": {
"content": "✉️ *发送最终PDF*(医疗报告)通过Gmail给收件人"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "389f4f89-16fb-4cce-8d2e-e4f031b7fdfc",
"connections": {
"Code": {
"main": [
[
{
"node": "Append row in sheet",
"type": "main",
"index": 0
}
]
]
},
"Code1": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Copy file": {
"main": [
[
{
"node": "Update a document1",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Code1",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Update a document1": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"Append row in sheet": {
"main": [
[
{
"node": "Copy file",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 文档提取, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
HR简历筛选
使用Telegram、Gemini AI和Google Workspace自动化简历筛选与分析
If
Set
Merge
+9
23 节点Abdullah Alshiekh
人力资源
使用GPT-4o-mini自动化从Gmail到Google Sheets的酒店预订请求
通过GPT-4o-mini将Gmail中的酒店预订请求自动录入Google Sheets
If
Set
Code
+8
29 节点Gtaras
文档提取
使用 Gemini 和 Jina AI 自动化供应商尽职调查研究
使用 Gemini 和 Jina AI 自动化供应商尽职调查研究
If
Set
Code
+12
27 节点Adnan
文档提取
自动化学术论文元数据及变量提取,从Gemini到Google Sheets
自动化学术论文元数据及变量提取,从Gemini到Google Sheets
Set
Code
Wait
+14
39 节点OwenLee
文档提取
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
电子邮件扫描和Google表格采购订单创建
使用Gemini AI从Gmail提取采购订单并保存至Google表格
If
Set
Code
+8
15 节点Sayone Technologies
文档提取
工作流信息
难度等级
高级
节点数量21
分类2
节点类型11
作者
Abdullah Alshiekh
@abdullah01🚀 Automation pro building AI-powered workflows with n8n. 💼 Special focus on real use cases 🔧 Love clean, flexible, and business-ready automations.
外部链接
在 n8n.io 查看 →
分享此工作流