使用PDF Vector和HIPAA合规从医疗文档提取临床数据
中级
这是一个Document Extraction, AI Summarization, Multimodal AI领域的自动化工作流,包含 9 个节点。主要使用 If, Code, Postgres, GoogleDrive, ManualTrigger 等节点。 使用PDF Vector和HIPAA合规从医疗文档提取临床数据
前置要求
- •PostgreSQL 数据库连接信息
- •Google Drive API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "placeholder"
},
"nodes": [
{
"id": "overview-note",
"name": "HIPAA概览",
"type": "n8n-nodes-base.stickyNote",
"position": [
50,
50
],
"parameters": {
"color": 1,
"width": 350,
"height": 200,
"content": "## 🏥 医疗记录处理器"
},
"typeVersion": 1
},
{
"id": "security-note",
"name": "安全要求",
"type": "n8n-nodes-base.stickyNote",
"position": [
50,
270
],
"parameters": {
"color": 1,
"width": 280,
"height": 180,
"content": "## 🔐 安全设置"
},
"typeVersion": 1
},
{
"id": "coding-note",
"name": "临床编码",
"type": "n8n-nodes-base.stickyNote",
"position": [
650,
450
],
"parameters": {
"width": 260,
"height": 150,
"content": "## 📋 临床编码"
},
"typeVersion": 1
},
{
"id": "manual-trigger",
"name": "手动触发器",
"type": "n8n-nodes-base.manualTrigger",
"notes": "Process medical record",
"position": [
250,
300
],
"parameters": {},
"typeVersion": 1
},
{
"id": "google-drive",
"name": "Google Drive - 获取医疗记录",
"type": "n8n-nodes-base.googleDrive",
"notes": "Retrieve record from Drive",
"position": [
450,
300
],
"parameters": {
"fileId": "={{ $json.fileId }}",
"operation": "download"
},
"typeVersion": 3
},
{
"id": "pdfvector-extract",
"name": "PDF向量 - 提取医疗数据",
"type": "n8n-nodes-pdfvector.pdfVector",
"notes": "Extract medical information",
"position": [
650,
300
],
"parameters": {
"prompt": "Extract medical information from this document or image including patient ID (not name), visit date, chief complaint, diagnoses with ICD codes, medications with dosages, vital signs, lab results with values and reference ranges, procedures performed, and follow-up instructions. Do not extract patient names, SSN, or other identifying information. Use OCR if this is a scanned document or medical image.",
"schema": "{\"type\":\"object\",\"properties\":{\"patientRecord\":{\"type\":\"object\",\"properties\":{\"patientId\":{\"type\":\"string\"},\"visitDate\":{\"type\":\"string\"},\"visitType\":{\"type\":\"string\"},\"provider\":{\"type\":\"string\"},\"facility\":{\"type\":\"string\"}}},\"clinicalData\":{\"type\":\"object\",\"properties\":{\"chiefComplaint\":{\"type\":\"string\"},\"historyOfPresentIllness\":{\"type\":\"string\"},\"reviewOfSystems\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}}},\"diagnoses\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"icdCode\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"},\"status\":{\"type\":\"string\"}}}},\"medications\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"dosage\":{\"type\":\"string\"},\"frequency\":{\"type\":\"string\"},\"route\":{\"type\":\"string\"},\"startDate\":{\"type\":\"string\"},\"status\":{\"type\":\"string\"}}}},\"vitalSigns\":{\"type\":\"object\",\"properties\":{\"bloodPressure\":{\"type\":\"string\"},\"heartRate\":{\"type\":\"string\"},\"temperature\":{\"type\":\"string\"},\"respiratoryRate\":{\"type\":\"string\"},\"oxygenSaturation\":{\"type\":\"string\"},\"weight\":{\"type\":\"string\"},\"height\":{\"type\":\"string\"},\"bmi\":{\"type\":\"string\"}}},\"labResults\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"testName\":{\"type\":\"string\"},\"value\":{\"type\":\"string\"},\"unit\":{\"type\":\"string\"},\"referenceRange\":{\"type\":\"string\"},\"flag\":{\"type\":\"string\"},\"collectionDate\":{\"type\":\"string\"}}}},\"procedures\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"cptCode\":{\"type\":\"string\"},\"date\":{\"type\":\"string\"}}}},\"plan\":{\"type\":\"object\",\"properties\":{\"followUp\":{\"type\":\"string\"},\"instructions\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"referrals\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}}}},\"required\":[\"patientRecord\",\"diagnoses\"],\"additionalProperties\":false}",
"resource": "document",
"inputType": "file",
"operation": "extract",
"binaryPropertyName": "data"
},
"typeVersion": 1
},
{
"id": "process-validate",
"name": "处理并验证数据",
"type": "n8n-nodes-base.code",
"notes": "Validate and prepare data",
"position": [
850,
300
],
"parameters": {
"jsCode": "// Process and validate medical data\nconst medicalData = $input.first().json.data;\n\n// Create audit log entry\nconst auditLog = {\n action: 'Medical Record Processed',\n timestamp: new Date().toISOString(),\n recordType: 'Clinical Document',\n patientId: medicalData.patientRecord.patientId,\n userId: 'system-automated',\n ipAddress: 'internal-process'\n};\n\n// Validate critical fields\nconst validationResults = {\n hasPatientId: !!medicalData.patientRecord?.patientId,\n hasVisitDate: !!medicalData.patientRecord?.visitDate,\n hasDiagnoses: medicalData.diagnoses?.length > 0,\n hasValidIcdCodes: true\n};\n\n// Validate ICD codes format\nif (medicalData.diagnoses) {\n medicalData.diagnoses.forEach(diagnosis => {\n if (diagnosis.icdCode && !diagnosis.icdCode.match(/^[A-Z][0-9]{2}(\\.[0-9]{1,2})?$/)) {\n validationResults.hasValidIcdCodes = false;\n }\n });\n}\n\n// Flag abnormal lab results\nconst abnormalLabs = [];\nif (medicalData.labResults) {\n medicalData.labResults.forEach(lab => {\n if (lab.flag && (lab.flag === 'H' || lab.flag === 'L' || lab.flag === 'Critical')) {\n abnormalLabs.push({\n test: lab.testName,\n value: lab.value,\n flag: lab.flag\n });\n }\n });\n}\n\n// Check for drug interactions (simplified)\nconst medications = medicalData.medications || [];\nconst potentialInteractions = [];\n// This is a simplified check - in production, use a proper drug interaction API\nif (medications.length > 1) {\n // Example: Check for common dangerous combinations\n const medNames = medications.map(m => m.name.toLowerCase());\n if (medNames.some(m => m.includes('warfarin')) && medNames.some(m => m.includes('aspirin'))) {\n potentialInteractions.push('Warfarin + Aspirin: Increased bleeding risk');\n }\n}\n\n// Prepare processed record\nconst processedRecord = {\n // Core data\n patientRecord: medicalData.patientRecord,\n clinicalData: medicalData.clinicalData,\n diagnoses: medicalData.diagnoses,\n medications: medicalData.medications,\n vitalSigns: medicalData.vitalSigns,\n labResults: medicalData.labResults,\n procedures: medicalData.procedures,\n plan: medicalData.plan,\n \n // Analysis results\n alerts: {\n abnormalLabs,\n potentialInteractions\n },\n \n // Metadata\n validation: validationResults,\n processedAt: new Date().toISOString(),\n dataClassification: 'PHI - Protected Health Information',\n retentionYears: 7,\n \n // Compliance\n auditLog\n};\n\nreturn [{ json: processedRecord }];"
},
"typeVersion": 2
},
{
"id": "check-valid",
"name": "有效记录?",
"type": "n8n-nodes-base.if",
"position": [
1050,
300
],
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $json.validation.hasPatientId }}",
"value2": true
},
{
"value1": "={{ $json.validation.hasDiagnoses }}",
"value2": true
}
]
},
"combineOperation": "all"
},
"typeVersion": 1
},
{
"id": "secure-storage",
"name": "存储到安全数据库",
"type": "n8n-nodes-base.postgres",
"notes": "HIPAA-compliant storage",
"position": [
1250,
250
],
"parameters": {
"table": "medical_records",
"columns": "patient_id,visit_date,diagnoses,medications,lab_results,processed_at,data_classification",
"operation": "insert"
},
"typeVersion": 1
}
],
"connections": {
"Valid Record?": {
"main": [
[
{
"node": "Store in Secure Database",
"type": "main",
"index": 0
}
],
[]
]
},
"Manual Trigger": {
"main": [
[
{
"node": "Google Drive - Get Medical Record",
"type": "main",
"index": 0
}
]
]
},
"Process & Validate Data": {
"main": [
[
{
"node": "Valid Record?",
"type": "main",
"index": 0
}
]
]
},
"Google Drive - Get Medical Record": {
"main": [
[
{
"node": "PDF Vector - Extract Medical Data",
"type": "main",
"index": 0
}
]
]
},
"PDF Vector - Extract Medical Data": {
"main": [
[
{
"node": "Process & Validate Data",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 文档提取, AI 摘要总结, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用PDF Vector进行OCR、分析和Google Drive的文档处理
使用PDF Vector进行OCR、分析和Google Drive的文档处理
Set
Code
Split Out
+6
13 节点PDF Vector
文档提取
使用PDF向量、Google Drive和数据库提取和存储发票数据
使用PDF向量、Google Drive和数据库提取和存储发票数据
If
Code
Slack
+7
26 节点PDF Vector
发票处理
使用 PDF 向量、OCR、GPT-4 和 Google Drive 的研究论文分析系统
使用 PDF 向量、OCR、GPT-4 和 Google Drive 的研究论文分析系统
Code
Open Ai
Postgres
+4
11 节点PDF Vector
文档提取
使用 PDF Vector 和 Google Drive 的自动化收据处理与税务分类
使用 PDF Vector 和 Google Drive 的自动化收据处理与税务分类
Code
Google Drive
Google Sheets
+3
9 节点PDF Vector
发票处理
企业合同生命周期管理与AI风险分析
企业合同生命周期管理与AI风险分析
If
Code
Merge
+8
20 节点PDF Vector
文档提取
使用PDF Vector AI从文档中提取和验证法律引用
使用PDF Vector AI从文档中提取和验证法律引用
If
Code
Google Drive
+3
8 节点PDF Vector
文档提取
工作流信息
难度等级
中级
节点数量9
分类3
节点类型7
作者
PDF Vector
@pdfvectorA fully featured PDF APIs for developers - Parse any PDF or Word document, extract structured data, and access millions of academic papers - all through simple APIs.
外部链接
在 n8n.io 查看 →
分享此工作流