Overview
Order Split enables labs to separate tests from an insurance bill into a new bill, supporting claim workflows without breaking report continuity or financial integrity.
Order Split
Order Split allows lab staff to move selected tests or profiles from an existing insurance bill into a newly created bill. The split preserves all report relationships, recomputes financials proportionally for both bills, and keeps downstream systems in sync.
Related JIRA Tickets
Why this exists
In insurance billing, a single bill can contain a mix of tests โ some claimable by the payer, others not. When a claim is filed, non-claimable tests block or complicate the process. Labs need a way to cleanly separate those tests into a standalone bill so each bill follows the correct payment path independently.
Real-world scenarios
Claim rejection for specific tests A patient has 5 tests billed to insurance. The payer denies 2 as non-covered. Rather than holding up the entire bill, staff split those 2 into a self-pay bill and process the remaining 3 through the claim workflow uninterrupted.
Mixed payment responsibility Some tests are covered by the patient's primary insurance; others are paid out-of-pocket or by a secondary payer. Splitting separates the financial obligations without touching the underlying reports or sample data.
Org-pay vs self-pay separation A referral organisation covers certain tests but not others. The lab needs separate bills to correctly apply org-level discounts, ledger entries, and billing terms.
What it does
| Capability | Detail |
|---|---|
| Move tests | Shifts selected BillingInfo rows and their LabReportRelation entries to a new bill |
| Recompute financials | Distributes VAT, TDS, and additional charges proportionally based on the split base amount |
| Migrate test data | Shifts ICD codes, modifiers, AOE responses, and consent records for moved tests |
| Clone bill data | Copies bill-level approval status, missing details, attachments, and consents to the new bill |
| Preserve reports | LabReportRelation IDs are kept intact โ no report recreation, no attachment loss |
| Audit trail | Writes activity logs for both the parent and split bill |
| Stay in sync | Syncs moved reports to Elasticsearch and invalidates affected Redis cache keys post-commit |
Bill split โ before and after
Both bills get independently recalculated financials. Reports, attachments, and sample data remain intact on their respective bills.
Architecture
The feature is a two-layer backend exposed through a single API endpoint, consumed by a guided 3-step frontend modal. The same endpoint runs in different modes so the frontend can check eligibility and preview financials before committing any writes.
How it works
No data is written until the user confirms on Step 3. Each stepper step calls the same API endpoint with a different mode flag.
Execution phases
| Phase | API mode | What happens |
|---|---|---|
| Validate | is_validate=true | All bill and test eligibility checks run. Errors shown to user on Step 1 โ no writes, always HTTP 200. |
| Calculate | is_calculate=true | Financials computed in memory. Proportion = split_base_amount รท original_base_total applied to VAT, TDS, and additional charges. No writes. |
| Execute | (no flags) | Single transaction.atomic() โ creates the new bill, shifts and clones all related rows, updates parent. Full rollback on any failure. |
| Sync | (post-commit) | Elasticsearch re-indexed, Redis keys cleared, ledger entries posted, activity logs written. A sync failure does not reverse the split. |
Prerequisites
The enable_bill_split flag must be enabled on the lab's settings.
- Configurable in the Support Dashboard > Configurations under Workflow Configurations โ Enable Bill Splitting.
- Only lab-user logins can access the feature (not collection centre, referral, or doctor logins).
Scope (V1)
| In scope | Out of scope |
|---|---|
| Unpaid insurance bills only | Paid or partially paid bills |
| One bill โ one new bill | Splitting into more than two bills |
Org Pay or Self Pay as destination source | Non-insurance source bills |
| AOE and consent migration | Home collection and appointment workflows |
SmartReport and Image attachments | Claims-linked or invoiced bills |