# Route patients to the best nearby hospital with Google Maps: n8n workflow

> Started by another system calling it. It calls services over plain HTTP rather than through connectors. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/route-patients-to-the-best-nearby-hospital-with-google-maps (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [AI assistants](https://millionrounds.com/workflows?category=AI+assistants#library)

# Route patients to the best nearby hospital with Google Maps

Started by another system calling it. It calls services over plain HTTP rather than through connectors. It hands the judgement calls to OpenAI. 23 steps, 2 loops or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Froute-patients-to-the-best-nearby-hospital-with-google-maps)

**23 steps** Large: read it before trusting it with anything live

**0** Branches: places the flow splits

**2** Loops or waits

**0** Services by connector: it calls them over plain HTTP

## The flow

Starts it 4 Model 2 Logic 11 Service 6

The steps in the order they run, from what starts it.

- 1 **Webhook - Emergency Request** Webhook *Starts it*
- 2 **Poll - Periodic Facility Refresh** Schedule trigger *Starts it*
- 3 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 4 **Prepare Location Context** Set *Logic*
- 5 **AI - Generate Routing Message** Agent *Model*
- 6 **Python - Validate & Score Severity** Code *Logic*
- 7 **JS - Format Final Output** Code *Logic*
- 8 **Filter - Valid Location** Filter *Logic*
- 9 **Wait - Review Buffer** Wait *Logic*
- 10 **Fetch Nearby Hospitals** Http Request *Service*
- 11 **Fetch Nearby Clinics** Http Request *Service*
- 12 **Error - Invalid Location** Code *Logic*
- 13 **Send SMS Routing Alert** Http Request *Service*
- 14 **Log to Google Sheet Tracker** Http Request *Service*
- 15 **JS - Merge & Deduplicate Facilities** Code *Logic*
- 16 **Wait For Result** Wait *Logic*
- 17 **Webhook Response - Send Result** Respond To Webhook *Starts it*
- 18 **Fetch Facility Capacity** Http Request *Service*
- 19 **Webhook Response - Error** Respond To Webhook *Starts it*
- 20 **JS - Enrich with Capacity** Code *Logic*
- 21 **Fetch Travel Time** Http Request *Service*
- 22 **Python - Score Facilities** Code *Logic*
- 23 **JS - Select Best Facility** Code *Logic*

## How it's built

- **Starts on:** Another system calling it
- **Steps:** 23, 2 loops or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Nothing by connector; it calls services over plain HTTP
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 23 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 23 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Froute-patients-to-the-best-nearby-hospital-with-google-maps)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Workflows like it

Also ai assistants, with the same services where possible, closest in size first.

- [**Auto Generate Descriptive Node Names with OpenRouter** 23 steps · calls a model](https://millionrounds.com/workflow/auto-generate-descriptive-node-names-with-openrouter)
- [**Build a multi-agent system with Qdrant and Gmail** 23 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/build-a-multi-agent-system-with-qdrant-and-gmail)
- [**Build a product catalog chatbot with Mistral and Google Drive** 23 steps · calls a model · Google Drive, Supabase vectors](https://millionrounds.com/workflow/build-a-product-catalog-chatbot-with-mistral-and-google-driv)
- [**Coach students and generate notes, quizzes, and roadmaps** 23 steps · calls a model](https://millionrounds.com/workflow/coach-students-and-generate-notes-quizzes-and-roadmaps)
- [**Filter AI slop from your LinkedIn feed** 23 steps · calls a model · Qdrant](https://millionrounds.com/workflow/filter-ai-slop-from-your-linkedin-feed)
- [**Generate professional product images | AI marketing campaign** 23 steps · calls a model · Google Drive](https://millionrounds.com/workflow/generate-professional-product-images-ai-marketing-campaign)
