invoices table
The invoices table in the Hospital Management System Database Schema schema has 11 columns, keyed by id, with 2 foreign keys to patients and encounters. 3 columns in invoice_lines, insurance_claims and payments reference it.
Totals are snapshotted at issue. A later price list change must never rewrite an issued invoice.
Columns (11)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| patient_id | uuid | not null, references patients.id | |
| encounter_id | uuid | references encounters.id | |
| number | varchar(40) | unique, not null | |
| status | invoice_status | not null | |
| subtotal_cents | integer | not null | |
| insurance_covered_cents | integer | not null | |
| patient_due_cents | integer | not null | |
| currency | char(3) | not null | |
| issued_at | timestamptz | not null | |
| due_at | timestamptz |
Indexes (2)
(patient_id, issued_at)(status)
Relationships
invoices.patient_idreferencespatients.idinvoices.encounter_idreferencesencounters.idinvoice_lines.invoice_idreferencesinvoicesinsurance_claims.invoice_idreferencesinvoicespayments.invoice_idreferencesinvoices