ARVEXA
← WorkAI Automation

OPD Reimbursement Workflow

An n8n automation that turns a photographed or scanned medical bill, typed or handwritten, into a calculated, audited OPD reimbursement claim, with a human review step for anything OCR can't read confidently.

Client
An employer's HR/Finance department (name withheld pending publishing confirmation)
n8nOCR (handwriting-capable)LLM extractionPostgreSQLPDF generation
OPD Reimbursement Workflow screenshot
01

The Problem

OPD (Outpatient Department) medical bill reimbursement is normally a manual HR/Finance process. An employee submits a photo or scan of a bill, sometimes handwritten, and someone has to read it, check it against that employee's remaining annual OPD limit and policy rules, and calculate what's actually payable. That's slow, inconsistent between reviewers, and leaves no audit trail for why a claim was approved at a given amount.

02

The Starting Point

No existing system. Built from scratch as an n8n workflow rather than a custom backend service, so HR/Finance can inspect and adjust the policy logic without needing a developer for every rule change.

03

The Solution

A single n8n workflow takes a bill upload (image or PDF) plus employee ID through a webhook, routes it through OCR, a handwriting-capable path for handwritten slips and a standard path for printed ones, then an AI/LLM node turns the raw OCR text into a structured record (employee, patient, hospital, bill number, line items, amounts). A validation step checks the extraction is actually usable: employee exists, date is valid, amount is numeric, bill number isn't a duplicate, and OCR confidence clears a threshold, before a calculation stage applies the real OPD policy, where the eligible amount is the minimum of the bill amount, the employee's remaining OPD limit, and any policy-specific cap. Anything that fails validation, or where OCR confidence is low (most commonly on handwritten bills), routes to a manual HR review step instead of being auto-approved, so a misread handwritten amount can never turn into an incorrect payout on its own.

04

Architecture

n8n Webhook: bill upload (image/PDF) + employee ID
File validation for type, size, and quality
OCR with automated vs. handwritten bill paths
AI/LLM extraction: OCR text → structured record
Validation for completeness, duplicate bill, OCR confidence
Low-confidence branch routed to manual HR review
OPD eligibility & calculation engine (MIN of bill / remaining limit / policy cap)
Database for employees, bills, OPD claims
PDF OPD statement, generated and stored
Notifications & approvals for employee, HR/Admin, Finance
05

Engineering Work

The calculation stage is isolated in its own step so the eligibility formula (bill amount, remaining annual/monthly limit, policy-specific maximum, prior claims) is auditable on its own, independent of whatever the OCR/AI step extracted. Every bill, its raw OCR text, and its resulting claim are persisted as separate records, employee, bill, and OPD claim, so an approved or rejected amount can always be traced back to the source document rather than just a number in an approval email. The confidence-gated manual-review branch was a deliberate addition beyond the base extraction pipeline: any bill the OCR/AI step isn't confident about goes to a human before a claim amount is calculated from it, rather than trusting an automated read of a handwritten figure.

06

AI Contribution

OCR reads raw text off the uploaded bill, a handwriting-capable path for handwritten slips and a standard path for printed ones, then an AI/LLM node parses that raw text into the structured bill record (employee, patient, hospital, line items, amounts) the rest of the workflow calculates against. AI is used for extraction only; the reimbursement calculation and approval routing run on deterministic rules, not model output.

07

Results

A single workflow now handles bill intake, OCR, structured extraction, OPD policy calculation, database recordkeeping, PDF statement generation, and HR/Finance notification end to end, with confidence-based manual review as the safety net for handwritten bills instead of every bill needing a fully manual read.

08

Final Product

OPD Reimbursement Workflow screenshot

Have a project like this one?