Document Generation & Distribution Use Cases¶
Implementation Note: All generated documents support PDF, print-ready, and email formats. Documents include hospital branding, digital signatures, and QR codes for verification. India-specific formats comply with NABH, CGHS, and TPA requirements.
UC-DOC-001: Generate Patient Bill/Invoice¶
Purpose: Generate itemized patient bills in print/PDF/email format with GST compliance and payment breakdown.
| Property | Value |
|---|---|
| Actor | Billing Service |
| Trigger | Bill finalization or patient request |
| Priority | P0 |
Main Success Scenario:
1. Fetch billing data from HIS/Billing system:
- Patient demographics
- Line items (consultations, procedures, medications, tests)
- Discounts, advances, insurance adjustments
2. Apply billing template based on:
- Hospital branding (logo, letterhead)
- Language preference (English/Hindi)
3. Calculate totals:
- Subtotal, GST (CGST/SGST breakdown)
- Net payable, amount paid, balance due
4. Generate QR code with:
- Bill number, amount, payment link
5. Render document in requested format:
- PDF (digital delivery)
- Print-ready (thermal/A4)
- HTML (email embed)
6. Distribute via requested channel:
- Print to designated printer
- Email to patient
- SMS with PDF link
Acceptance Criteria: 1. [ ] GST-compliant format with SAC codes 2. [ ] Supports itemized and summary views 3. [ ] Digital signature for authenticity 4. [ ] QR code links to payment gateway 5. [ ] Multi-language support (English, Hindi)
India-Specific: - GST invoice format with GSTIN display - CGHS/ECHS rate breakdowns - PM-JAY package cost display - UPI payment QR code integration
UC-DOC-002: Generate Discharge Summary¶
Purpose: Create comprehensive discharge summary document for patient and referring physicians.
| Property | Value |
|---|---|
| Actor | Clinical Documentation Service |
| Trigger | Patient discharge or document request |
| Priority | P0 |
Main Success Scenario:
1. Aggregate clinical data:
- Admission details (date, diagnosis, MRD#)
- Treatment summary (procedures, medications)
- Investigation results (labs, imaging)
- Discharge medications with instructions
- Follow-up appointments
2. Apply discharge summary template:
- Hospital letterhead
- Structured sections (Chief Complaint, Course, Plan)
3. Include:
- Attending physician signature (digital)
- ICD-10 codes for diagnosis
- NABH-compliant format (if accredited)
4. Generate outputs:
- PDF for patient
- FHIR DocumentReference for ABDM
- Print copy for medical records
5. Distribute:
- Email to patient
- Upload to ABHA PHR (with consent)
- Print for patient handover
Acceptance Criteria: 1. [ ] NABH-compliant discharge summary format 2. [ ] ICD-10 coded diagnoses 3. [ ] Digital signature of attending physician 4. [ ] Bilingual option (English + regional language) 5. [ ] ABDM-ready FHIR DocumentReference
India-Specific: - NABH Section 5.3 discharge summary format - MLC (Medico-Legal Case) annotation if applicable - TPA pre-auth reference number inclusion - Regional language medication instructions
UC-DOC-003: Generate Lab Report PDF¶
Purpose: Create formatted lab report with hospital letterhead, reference ranges, and interpretations.
| Property | Value |
|---|---|
| Actor | LIS Integration Service |
| Trigger | Lab results finalized |
| Priority | P1 |
Main Success Scenario:
1. Fetch lab results from LIS:
- Test names, values, units
- Reference ranges
- Abnormal flags (H/L/Critical)
2. Apply lab report template:
- Hospital/Lab letterhead
- Patient demographics, sample details
- Pathologist signature block
3. Format results:
- Group by panel (CBC, LFT, RFT, etc.)
- Highlight abnormal values
- Include delta from previous (trending)
4. Add interpretive notes (if available)
5. Generate outputs:
- PDF with digital signature
- Print-ready (for collection counter)
- Email notification with secure link
6. Track delivery status
Acceptance Criteria: 1. [ ] NABL-compliant report format (if applicable) 2. [ ] Critical value highlighting 3. [ ] Pathologist digital signature 4. [ ] Secure PDF link (expiring, password-protected optional) 5. [ ] SMS notification on report ready
India-Specific: - NABL accreditation logo (if certified) - Sample collection location/time - Outsourced test lab attribution - Hindi test name translations (optional)
UC-DOC-004: Generate Prescription Document¶
Purpose: Create print/digital prescription with drug details, instructions, and verification QR code.
| Property | Value |
|---|---|
| Actor | Prescription Service |
| Trigger | Doctor finalizes prescription |
| Priority | P0 |
Main Success Scenario:
1. Fetch prescription data:
- Patient details
- Medications (name, dose, frequency, duration)
- Special instructions
- Diagnosis (optional display)
2. Apply prescription template:
- Hospital/Clinic letterhead
- Doctor credentials (MBBS, MD, Registration#)
- MCI/NMC registration number
3. Format medications:
- Generic name + Brand name
- Clear dosage instructions (Hindi/English)
- Duration and quantity
4. Add verification elements:
- QR code (prescription ID, doctor verification)
- Digital signature of prescribing physician
5. Generate outputs:
- PDF for patient record
- Print (thermal/A4)
- Email to patient
6. Log prescription in audit trail
Acceptance Criteria: 1. [ ] NMC-compliant prescription format 2. [ ] Doctor registration number visible 3. [ ] QR code for authenticity verification 4. [ ] Generic drug names included 5. [ ] Multi-language instructions
India-Specific: - NMC/MCI registration number mandatory - Generic name display (per NMC guidelines) - Schedule H/H1 drug annotations - Jan Aushadhi generic alternatives suggestion
UC-DOC-005: Generate Insurance Claim Form¶
Purpose: Auto-populate and generate insurance claim forms for TPA/insurer submission.
| Property | Value |
|---|---|
| Actor | Insurance Integration Service |
| Trigger | Claim initiation or discharge |
| Priority | P1 |
Main Success Scenario:
1. Identify insurance type:
- Private TPA (Star, ICICI, etc.)
- CGHS/ECHS
- PM-JAY (Ayushman Bharat)
- ESI
2. Fetch claim data:
- Patient demographics
- Policy details
- Admission/discharge dates
- Diagnosis (ICD-10)
- Procedures performed
- Itemized billing
3. Map to claim form:
- Pre-auth form (for planned admission)
- Final claim form (post-discharge)
- Enhancement request (if applicable)
4. Auto-populate form fields
5. Attach supporting documents:
- Discharge summary
- Investigation reports
- Bills and receipts
6. Generate outputs:
- PDF claim package
- JSON for API submission (if supported)
- Print for physical submission
Acceptance Criteria: 1. [ ] TPA-specific form templates (major insurers) 2. [ ] CGHS/ECHS claim format support 3. [ ] PM-JAY HBP package auto-selection 4. [ ] Document checklist verification 5. [ ] E-claim portal integration (where available)
India-Specific: - IRDAI-compliant claim formats - TPA-specific annexures (Star Health, ICICI Lombard, etc.) - CGHS Form 3/4/5 generation - PM-JAY claim package format
UC-DOC-006: Generate Payment Receipt¶
Purpose: Issue payment receipt for cash, card, or digital payments.
| Property | Value |
|---|---|
| Actor | Billing Service |
| Trigger | Payment recorded |
| Priority | P0 |
Main Success Scenario:
1. Fetch payment details:
- Amount received
- Payment mode (Cash/Card/UPI/NEFT)
- Reference number (transaction ID)
- Bill reference
2. Apply receipt template:
- Hospital letterhead
- Receipt number (sequential)
- Date and time
3. Include:
- Patient name, MRD#
- Amount in words
- Balance due (if partial payment)
- Cashier/Staff name
4. Generate outputs:
- Thermal print (80mm/58mm)
- A4 PDF
- Email receipt
5. Update payment ledger
Acceptance Criteria: 1. [ ] Sequential receipt numbering 2. [ ] Thermal and A4 print formats 3. [ ] Digital receipt via email/SMS 4. [ ] GST details on receipt 5. [ ] Payment mode and reference tracking
UC-DOC-007: Generate Referral Letter¶
Purpose: Create formal referral letter to specialist or higher center.
| Property | Value |
|---|---|
| Actor | Clinical Documentation Service |
| Trigger | Doctor initiates referral |
| Priority | P1 |
Main Success Scenario:
1. Fetch referral information:
- Patient summary
- Reason for referral
- Relevant investigations
- Current treatment
2. Apply referral template:
- Referring hospital letterhead
- Addressed to receiving institution/doctor
3. Include:
- Clinical summary (concise)
- Key investigation results
- Specific questions/requests
- Urgency indication
4. Attach supporting documents:
- Lab reports
- Imaging reports
- Previous notes
5. Generate outputs:
- PDF package
- FHIR Bundle (for digital referral)
- Print for patient to carry
Acceptance Criteria: 1. [ ] Structured referral format 2. [ ] Attachments bundled in single PDF 3. [ ] ABDM referral bundle support 4. [ ] Urgency flagging 5. [ ] Tracking of referral outcome
UC-DOC-008: Generate Medical Certificate¶
Purpose: Issue medical certificates (fitness, sick leave, disability) with verification.
| Property | Value |
|---|---|
| Actor | Clinical Documentation Service |
| Trigger | Patient/Employer request |
| Priority | P1 |
Main Success Scenario:
1. Determine certificate type:
- Fitness certificate
- Sick leave certificate
- Medical leave recommendation
- Disability certificate
2. Fetch relevant data:
- Patient demographics
- Diagnosis/condition
- Treatment period
- Recommendations
3. Apply certificate template:
- Hospital letterhead
- Doctor credentials and registration
- Purpose-specific format
4. Add verification:
- QR code (certificate ID, verification URL)
- Digital signature
- Unique certificate number
5. Generate outputs:
- PDF (tamper-evident)
- Print (with watermark)
- Verification API registration
Acceptance Criteria: 1. [ ] QR-verified authenticity 2. [ ] Doctor registration number visible 3. [ ] Tamper-evident PDF format 4. [ ] Online verification portal 5. [ ] Audit trail for certificates issued
Document Distribution Architecture¶
Output Formats¶
| Format | Use Case | Technology |
|---|---|---|
| Digital delivery, archival | WeasyPrint / Puppeteer | |
| Thermal Print | Receipts, tokens | ESC/POS commands |
| A4 Print | Reports, summaries | PDF + Print API |
| Patient communication | SMTP / SES | |
| SMS | Notifications, OTP | MSG91 / Twilio |
| FHIR | ABDM integration | HAPI FHIR |
Document Flow¶
flowchart TB
subgraph "Data Sources"
A["HIS/EMR"]
B["LIS"]
C["Billing System"]
end
subgraph "Document Engine"
D["Template Engine"]
E["Data Mapper"]
F["Renderer"]
G["Digital Signature"]
end
subgraph "Outputs"
H["PDF Generator"]
I["Print Queue"]
J["Email Service"]
K["FHIR Exporter"]
end
subgraph "Distribution"
L["Patient Portal"]
M["Printer"]
N["Email/SMS"]
O["ABDM Gateway"]
end
A --> E
B --> E
C --> E
E --> D
D --> F
F --> G
G --> H
G --> I
G --> J
G --> K
H --> L
I --> M
J --> N
K --> O
India Compliance Matrix¶
| Document | NABH | ABDM | GST | NMC | TPA |
|---|---|---|---|---|---|
| Patient Bill | — | — | ✅ | — | ✅ |
| Discharge Summary | ✅ | ✅ | — | — | ✅ |
| Lab Report | NABL | ✅ | — | — | ✅ |
| Prescription | — | ✅ | — | ✅ | — |
| Claim Form | — | — | — | — | ✅ |
| Receipt | — | — | ✅ | — | — |
| Referral Letter | — | ✅ | — | — | — |
| Medical Certificate | — | — | — | ✅ | — |
Document Owner: Integration Lead / Product Manager
Last Updated: 2024-12-09
Related: Billing | Notifications | EMR