放射線画像から詳細なレポートへの変換ツール

中級

これはDocument Extraction, Multimodal AI分野の自動化ワークフローで、12個のノードを含みます。主にCode, Wait, Gmail, Webhook, HttpRequestなどのノードを使用。 GPT-4 VisionとPDFメールを使用して放射線画像を患者フレンドリーなレポートに変換

前提条件
  • Googleアカウント + Gmail API認証情報
  • HTTP Webhookエンドポイント(n8nが自動生成)
  • ターゲットAPIの認証情報が必要な場合あり
  • Google Sheets API認証情報
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "8DYI99J1q8APXjWY",
  "meta": {
    "instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
    "templateCredsSetupCompleted": true
  },
  "name": "Radiology Image to Detailed Report Converter",
  "tags": [],
  "nodes": [
    {
      "id": "89d05f4e-32c8-4ce2-aabb-26068052a70b",
      "name": "画像アップロードトリガー",
      "type": "n8n-nodes-base.webhook",
      "position": [
        180,
        -120
      ],
      "webhookId": "radiology-upload-webhook",
      "parameters": {
        "path": "radiology-upload",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "395b8ea6-f7aa-4d47-a73c-22ab891674ec",
      "name": "画像データ抽出",
      "type": "n8n-nodes-base.code",
      "position": [
        400,
        -120
      ],
      "parameters": {
        "jsCode": "// Extract image and patient data from webhook\nconst data = $input.first().json;\n\nreturn [{\n  json: {\n    patient_name: data.patient_name || 'Patient',\n    patient_id: data.patient_id || 'N/A',\n    scan_type: data.scan_type || 'X-Ray',\n    body_part: data.body_part || 'Chest',\n    image_url: data.image_url,\n    image_base64: data.image_base64,\n    doctor_name: data.doctor_name || 'Dr. Smith',\n    scan_date: data.scan_date || new Date().toISOString().split('T')[0],\n    urgency: data.urgency || 'routine'\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "090ab8d4-4e1c-4c23-9fe8-f6c74b850a8a",
      "name": "AIによる放射線画像分析",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        620,
        -120
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"gpt-4-vision-preview\",\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"You are a radiology expert who explains medical scans in simple, patient-friendly language. Analyze the radiology image and provide: 1) What the scan shows in simple terms 2) Any notable findings 3) What this means for the patient 4) Next steps if any. Be reassuring and avoid medical jargon. Always recommend consulting with their doctor.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"Please analyze this {{ $json.scan_type }} scan of the {{ $json.body_part }} and explain the findings in patient-friendly terms.\"\n        },\n        {\n          \"type\": \"image_url\",\n          \"image_url\": {\n            \"url\": \"{{ $json.image_base64 ? 'data:image/jpeg;base64,' + $json.image_base64 : $json.image_url }}\"\n          }\n        }\n      ]\n    }\n  ],\n  \"max_tokens\": 1000,\n  \"temperature\": 0.3\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer {{ $credentials.openaiApi.apiKey }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "47095b28-484a-47ce-b450-6dd0d719d989",
      "name": "AI分析処理",
      "type": "n8n-nodes-base.code",
      "position": [
        840,
        -120
      ],
      "parameters": {
        "jsCode": "// Process OpenAI response and structure the report data\nconst aiResponse = $input.first().json;\nconst patientData = $('Extract Image Data').first().json;\n\nconst aiAnalysis = aiResponse.choices[0].message.content;\n\n// Structure the analysis into sections\nconst sections = aiAnalysis.split('\\n\\n');\nlet findings = '';\nlet explanation = '';\nlet nextSteps = '';\n\n// Try to parse the AI response into structured sections\nsections.forEach(section => {\n  if (section.toLowerCase().includes('findings') || section.toLowerCase().includes('shows')) {\n    findings += section + ' ';\n  } else if (section.toLowerCase().includes('means') || section.toLowerCase().includes('indicates')) {\n    explanation += section + ' ';\n  } else if (section.toLowerCase().includes('next') || section.toLowerCase().includes('recommend')) {\n    nextSteps += section + ' ';\n  }\n});\n\n// If structured parsing didn't work well, use the full response\nif (!findings && !explanation) {\n  findings = aiAnalysis.substring(0, aiAnalysis.length / 2);\n  explanation = aiAnalysis.substring(aiAnalysis.length / 2);\n}\n\nreturn [{\n  json: {\n    ...patientData,\n    ai_analysis: aiAnalysis,\n    findings: findings.trim() || 'Analysis completed',\n    explanation: explanation.trim() || 'Please consult with your doctor for detailed explanation',\n    next_steps: nextSteps.trim() || 'Follow up with your healthcare provider as recommended',\n    report_generated: new Date().toISOString(),\n    confidence_note: 'This AI analysis is for informational purposes only. Always consult your doctor for medical advice.'\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "223aebb0-5f1e-40fb-bc00-ed70a4cba515",
      "name": "PDFレポート生成",
      "type": "n8n-nodes-base.code",
      "position": [
        1060,
        -120
      ],
      "parameters": {
        "jsCode": "// Generate HTML template for PDF conversion\nconst data = $input.first().json;\n\nconst htmlReport = `\n<!DOCTYPE html>\n<html>\n<head>\n    <style>\n        body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; margin: 40px; }\n        .header { text-align: center; border-bottom: 3px solid #4CAF50; padding-bottom: 20px; margin-bottom: 30px; }\n        .logo { font-size: 24px; font-weight: bold; color: #4CAF50; }\n        .patient-info { background-color: #f8f9fa; padding: 20px; border-radius: 8px; margin: 20px 0; }\n        .section { margin: 25px 0; }\n        .section-title { font-size: 18px; font-weight: bold; color: #2c3e50; border-left: 4px solid #4CAF50; padding-left: 15px; margin-bottom: 15px; }\n        .findings { background-color: #e8f5e8; padding: 20px; border-radius: 8px; border-left: 4px solid #4CAF50; }\n        .explanation { background-color: #fff3e0; padding: 20px; border-radius: 8px; border-left: 4px solid #ff9800; }\n        .next-steps { background-color: #e3f2fd; padding: 20px; border-radius: 8px; border-left: 4px solid #2196f3; }\n        .disclaimer { background-color: #ffebee; padding: 15px; border-radius: 8px; font-size: 14px; border: 1px solid #f44336; margin-top: 30px; }\n        .footer { text-align: center; margin-top: 40px; font-size: 12px; color: #666; }\n        .date { color: #666; font-size: 14px; }\n    </style>\n</head>\n<body>\n    <div class=\"header\">\n        <div class=\"logo\">🏥 Medical Imaging Report</div>\n        <h2>Patient-Friendly Radiology Report</h2>\n        <div class=\"date\">Generated: ${new Date(data.report_generated).toLocaleDateString()}</div>\n    </div>\n    \n    <div class=\"patient-info\">\n        <h3>👤 Patient Information</h3>\n        <p><strong>Patient Name:</strong> ${data.patient_name}</p>\n        <p><strong>Patient ID:</strong> ${data.patient_id}</p>\n        <p><strong>Scan Type:</strong> ${data.scan_type}</p>\n        <p><strong>Body Part:</strong> ${data.body_part}</p>\n        <p><strong>Scan Date:</strong> ${data.scan_date}</p>\n        <p><strong>Ordering Doctor:</strong> ${data.doctor_name}</p>\n    </div>\n    \n    <div class=\"section\">\n        <div class=\"section-title\">🔍 What We Found</div>\n        <div class=\"findings\">\n            <p>${data.findings}</p>\n        </div>\n    </div>\n    \n    <div class=\"section\">\n        <div class=\"section-title\">💡 What This Means</div>\n        <div class=\"explanation\">\n            <p>${data.explanation}</p>\n        </div>\n    </div>\n    \n    <div class=\"section\">\n        <div class=\"section-title\">📋 Next Steps</div>\n        <div class=\"next-steps\">\n            <p>${data.next_steps}</p>\n        </div>\n    </div>\n    \n    <div class=\"disclaimer\">\n        <h4>⚠️ Important Disclaimer</h4>\n        <p>${data.confidence_note}</p>\n        <p>This report is generated by AI technology to help you understand your scan results. It should not replace professional medical consultation. Please discuss these findings with your healthcare provider.</p>\n    </div>\n    \n    <div class=\"footer\">\n        <p>Report generated by AI-Powered Radiology Assistant</p>\n        <p>For medical questions, contact your healthcare provider</p>\n    </div>\n</body>\n</html>\n`;\n\nreturn [{\n  json: {\n    ...data,\n    html_report: htmlReport,\n    report_filename: `Radiology_Report_${data.patient_name.replace(/\\s+/g, '_')}_${data.scan_date}.pdf`\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "4deecdc3-3b5a-4987-a62d-43f7034431c2",
      "name": "PDFへの変換",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1280,
        -120
      ],
      "parameters": {
        "url": "https://api.html-css-to-pdf.com/v1/generate",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"html\": \"{{ $json.html_report }}\",\n  \"options\": {\n    \"format\": \"A4\",\n    \"margin\": {\n      \"top\": \"20mm\",\n      \"right\": \"15mm\",\n      \"bottom\": \"20mm\",\n      \"left\": \"15mm\"\n    },\n    \"displayHeaderFooter\": false\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer {{ $credentials.pdfApi.apiKey }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "581fef88-4096-4193-b71e-9893fd684d1f",
      "name": "レポートをデータベースに保存",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1720,
        -120
      ],
      "parameters": {
        "columns": {
          "value": {
            "pdf_url": "={{ $json.download_url }}",
            "body_part": "={{ $('Generate PDF Report').first().json.body_part }}",
            "scan_date": "={{ $('Generate PDF Report').first().json.scan_date }}",
            "scan_type": "={{ $('Generate PDF Report').first().json.scan_type }}",
            "timestamp": "={{ $now.toISO() }}",
            "patient_id": "={{ $('Generate PDF Report').first().json.patient_id }}",
            "patient_name": "={{ $('Generate PDF Report').first().json.patient_name }}",
            "report_status": "Generated Successfully"
          },
          "schema": [
            {
              "id": "timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "patient_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Patient Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "patient_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Patient ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "scan_type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Scan Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "body_part",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Body Part",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "scan_date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Scan Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "report_status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Report Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pdf_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "PDF URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Reports_Log",
          "cachedResultName": "Reports Log"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_REPORTS_SHEET_ID",
          "cachedResultName": "Radiology Reports"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "ScSS2KxGQULuPtdy",
          "name": "Google Sheets- test"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "f2025595-5b43-48dd-a586-351054d7d6d3",
      "name": "患者へのメール送信",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1940,
        -120
      ],
      "webhookId": "4a00c62f-eac2-46c6-9013-61a94e903084",
      "parameters": {
        "sendTo": "={{ $('Extract Image Data').first().json.patient_email || 'patient@example.com' }}",
        "message": "=<h2>Your Radiology Report is Ready! 🏥</h2><br><br>Dear {{ $('Generate PDF Report').first().json.patient_name }},<br><br>Your {{ $('Generate PDF Report').first().json.scan_type }} scan report is now available. This patient-friendly report explains your scan results in easy-to-understand language.<br><br><strong>Scan Details:</strong><br>• Type: {{ $('Generate PDF Report').first().json.scan_type }}<br>• Body Part: {{ $('Generate PDF Report').first().json.body_part }}<br>• Date: {{ $('Generate PDF Report').first().json.scan_date }}<br><br><strong>Key Findings:</strong><br>{{ $('Process AI Analysis').first().json.findings }}<br><br>📎 <strong>Your complete report is attached as a PDF.</strong><br><br>❗ <strong>Important:</strong> This AI-generated report is for informational purposes. Please discuss these results with {{ $('Generate PDF Report').first().json.doctor_name }} or your healthcare provider.<br><br>If you have any questions, please contact your healthcare provider.<br><br>Best regards,<br>Medical Imaging Department",
        "options": {},
        "subject": "🏥 Your Radiology Report is Ready - {{ $('Generate PDF Report').first().json.patient_name }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "PcTqvGU9uCunfltE",
          "name": "Gmail account - test"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "badb5a4d-2b43-47a9-b1c8-12db0f4e7a5b",
      "name": "レスポンスを返す",
      "type": "n8n-nodes-base.code",
      "position": [
        2160,
        -120
      ],
      "parameters": {
        "jsCode": "// Return success response with report details\nconst reportData = $('Generate PDF Report').first().json;\nconst pdfData = $('Convert to PDF').first().json;\n\nreturn [{\n  json: {\n    status: 'success',\n    message: 'Radiology report generated successfully',\n    patient_name: reportData.patient_name,\n    scan_type: reportData.scan_type,\n    body_part: reportData.body_part,\n    report_generated: reportData.report_generated,\n    pdf_url: pdfData.download_url,\n    findings_summary: reportData.findings.substring(0, 200) + '...',\n    next_steps: reportData.next_steps,\n    disclaimer: reportData.confidence_note\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "7b5c9eb3-37c2-43f8-a0f1-f95554b6c9ef",
      "name": "ワークフロー概要",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        340,
        -600
      ],
      "parameters": {
        "width": 400,
        "height": 340,
        "content": "## 🏥 Radiology Image to Report Converter\n\n### Features:\n• AI-powered image analysis\n• Patient-friendly language\n• Professional PDF reports\n• Email delivery\n• Database logging\n• Webhook triggered\n\n### How to use:\nSend POST to webhook with image data"
      },
      "typeVersion": 1
    },
    {
      "id": "925f5199-dbac-427b-a896-228e864f524b",
      "name": "必要な設定",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        -540
      ],
      "parameters": {
        "color": 3,
        "width": 300,
        "height": 200,
        "content": "## ⚙️ Setup Required\n\n1. OpenAI API credentials (GPT-4 Vision)\n2. PDF conversion service\n3. Gmail account for sending\n4. Google Sheets for logging\n5. Update YOUR_REPORTS_SHEET_ID"
      },
      "typeVersion": 1
    },
    {
      "id": "e5159a65-1ba2-4bc0-99dc-d89cef310932",
      "name": "PDFを待機",
      "type": "n8n-nodes-base.wait",
      "position": [
        1500,
        -120
      ],
      "webhookId": "25e9fc56-abe3-4dbc-9d2d-edcf098f8ecc",
      "parameters": {},
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "307925d2-0fa2-459f-a60c-af7b0ae0bbb3",
  "connections": {
    "e5159a65-1ba2-4bc0-99dc-d89cef310932": {
      "main": [
        [
          {
            "node": "581fef88-4096-4193-b71e-9893fd684d1f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4deecdc3-3b5a-4987-a62d-43f7034431c2": {
      "main": [
        [
          {
            "node": "e5159a65-1ba2-4bc0-99dc-d89cef310932",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "395b8ea6-f7aa-4d47-a73c-22ab891674ec": {
      "main": [
        [
          {
            "node": "090ab8d4-4e1c-4c23-9fe8-f6c74b850a8a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "223aebb0-5f1e-40fb-bc00-ed70a4cba515": {
      "main": [
        [
          {
            "node": "4deecdc3-3b5a-4987-a62d-43f7034431c2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "47095b28-484a-47ce-b450-6dd0d719d989": {
      "main": [
        [
          {
            "node": "223aebb0-5f1e-40fb-bc00-ed70a4cba515",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "89d05f4e-32c8-4ce2-aabb-26068052a70b": {
      "main": [
        [
          {
            "node": "395b8ea6-f7aa-4d47-a73c-22ab891674ec",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f2025595-5b43-48dd-a586-351054d7d6d3": {
      "main": [
        [
          {
            "node": "badb5a4d-2b43-47a9-b1c8-12db0f4e7a5b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "581fef88-4096-4193-b71e-9893fd684d1f": {
      "main": [
        [
          {
            "node": "f2025595-5b43-48dd-a586-351054d7d6d3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "090ab8d4-4e1c-4c23-9fe8-f6c74b850a8a": {
      "main": [
        [
          {
            "node": "47095b28-484a-47ce-b450-6dd0d719d989",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - 文書抽出, マルチモーダルAI

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数12
カテゴリー2
ノードタイプ7
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
Oneclick AI Squad

Oneclick AI Squad

@oneclick-ai

The AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34