Générateur de rapports médicaux IA

Avancé

Ceci est unDocument Extraction, AI Summarizationworkflow d'automatisation du domainecontenant 21 nœuds.Utilise principalement des nœuds comme Set, Code, Gmail, GoogleDocs, GoogleDrive. Générer des rapports médicaux à partir d'e-mails avec Gemini AI et Google Workspace

Prérequis
  • Compte Google et informations d'identification Gmail API
  • Informations d'identification Google Drive API
  • Peut nécessiter les informations d'identification d'authentification de l'API cible
  • Informations d'identification Google Sheets API
  • Clé API Google Gemini
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "iKLz8kl2wKbZDjdk",
  "meta": {
    "instanceId": "7f1a0694161455be3a7e71f1e0dea04908b0376a1a81e3a0c1e5ac879d48f83a"
  },
  "name": "AI Medical Report Generator",
  "tags": [],
  "nodes": [
    {
      "id": "91a19c78-df6d-42b2-85d7-abc7869b8942",
      "name": "Gmail Trigger",
      "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": "Modifier les champs",
      "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": "Ajouter une ligne dans la feuille",
      "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": "Agent IA",
      "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 Chat Model",
      "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": "Code",
      "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": "Mettre à jour un document1",
      "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": "Copier le fichier",
      "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": "Envoyer un message",
      "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 Request",
      "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": "Code1",
      "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": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -160
      ],
      "parameters": {
        "color": 3,
        "content": "🔔 *Triggers* the workflow when a new email is received from a specific sender (e.g. a doctor)."
      },
      "typeVersion": 1
    },
    {
      "id": "14165e9d-eff7-40a6-b035-390de5c430b2",
      "name": "Note adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        -160
      ],
      "parameters": {
        "color": 5,
        "content": "🛠 *Extracts the raw email content* into a new field called `content` for AI processing."
      },
      "typeVersion": 1
    },
    {
      "id": "f2adb4f2-1fd2-4e91-99cc-929f3b158dcb",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -176
      ],
      "parameters": {
        "color": 4,
        "content": "🤖 *Processes the text using AI* to extract structured information like patient name, doctor name, etc."
      },
      "typeVersion": 1
    },
    {
      "id": "6f55af2f-ac25-4462-be9e-6284fd1fdbf6",
      "name": "Note adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -176
      ],
      "parameters": {
        "color": 3,
        "content": "🧹 *Cleans and parses* the AI response by removing markdown code formatting and turning it into usable JSON."
      },
      "typeVersion": 1
    },
    {
      "id": "d93463fb-9399-4c51-bec9-26d29bd161b0",
      "name": "Note adhésive4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        -176
      ],
      "parameters": {
        "color": 5,
        "content": "📄 *Adds the extracted data* (patient info, diagnosis, etc.) to a specific Google Sheet row."
      },
      "typeVersion": 1
    },
    {
      "id": "c8176919-4a09-4330-a481-6de25440845f",
      "name": "Note adhésive5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        -176
      ],
      "parameters": {
        "color": 3,
        "content": "📁 *Makes a copy* of the Google Docs medical report template for the current patient."
      },
      "typeVersion": 1
    },
    {
      "id": "28dd3b51-feba-4981-8b4b-156f3dedbb07",
      "name": "Note adhésive6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        -176
      ],
      "parameters": {
        "color": 5,
        "content": "📝 *Replaces placeholders* (like patient name/date) in the copied Google Doc with real data."
      },
      "typeVersion": 1
    },
    {
      "id": "a966576b-0bfe-4d03-acbe-8475c93c3a9e",
      "name": "Note adhésive7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1424,
        -176
      ],
      "parameters": {
        "color": 3,
        "content": "📤 *Exports the updated Google Doc* as a PDF via Google Drive API."
      },
      "typeVersion": 1
    },
    {
      "id": "7853e5d4-27e0-4b7e-beed-a85704f5fd4e",
      "name": "Note adhésive8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        -176
      ],
      "parameters": {
        "color": 5,
        "content": "📛 *Renames the PDF file* using patient name and date, and attaches metadata."
      },
      "typeVersion": 1
    },
    {
      "id": "f9504b84-ce1a-4dca-8378-fc8bf4183bfa",
      "name": "Note adhésive9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1936,
        -176
      ],
      "parameters": {
        "content": "✉️ *Sends the final PDF* (medical report) to the recipient via Gmail."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "389f4f89-16fb-4cce-8d2e-e4f031b7fdfc",
  "connections": {
    "63c7245b-1c50-45ad-a136-075e92eec522": {
      "main": [
        [
          {
            "node": "f4b76891-0cbe-4dab-a1f2-f2ce347f6d73",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6ac43c97-8545-4811-b304-44e053b61071": {
      "main": [
        [
          {
            "node": "472e8004-5605-4275-9975-e2bfe105a517",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f64e9b78-dc5d-4556-8322-1175a33dd062": {
      "main": [
        [
          {
            "node": "63c7245b-1c50-45ad-a136-075e92eec522",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ed90c89e-c092-4e07-95ae-a2a229bb994a": {
      "main": [
        [
          {
            "node": "8d11f752-f45c-4b55-b586-d16ad75ae194",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "baa74409-0c1a-4bc9-8f84-a4af654509ff": {
      "main": [
        [
          {
            "node": "f64e9b78-dc5d-4556-8322-1175a33dd062",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "52c9ce22-4874-4d5b-a75f-e620a4c0c6e0": {
      "main": [
        [
          {
            "node": "6ac43c97-8545-4811-b304-44e053b61071",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "91a19c78-df6d-42b2-85d7-abc7869b8942": {
      "main": [
        [
          {
            "node": "baa74409-0c1a-4bc9-8f84-a4af654509ff",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8d11f752-f45c-4b55-b586-d16ad75ae194": {
      "main": [
        [
          {
            "node": "52c9ce22-4874-4d5b-a75f-e620a4c0c6e0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f4b76891-0cbe-4dab-a1f2-f2ce347f6d73": {
      "main": [
        [
          {
            "node": "ed90c89e-c092-4e07-95ae-a2a229bb994a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d0efc2af-649e-40b8-8dd9-eeeecdfaf488": {
      "ai_languageModel": [
        [
          {
            "node": "f64e9b78-dc5d-4556-8322-1175a33dd062",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Extraction de documents, Résumé IA

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds21
Catégorie2
Types de nœuds11
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur
Abdullah Alshiekh

Abdullah Alshiekh

@abdullah01

🚀 Automation pro building AI-powered workflows with n8n. 💼 Special focus on real use cases 🔧 Love clean, flexible, and business-ready automations.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34