# Pharmacy Dispensing Workflows ## Introduction HMIS supports end-to-end medication dispensing across all care settings — outpatient (OPD), inpatient (IP), and emergency (ETU). Electronic prescriptions created by clinicians flow directly into the pharmacy queue, where pharmacists review, verify, and dispense against the prescription record. Every dispense transaction is linked to the patient encounter, decrementing stock in real time and generating a billing record simultaneously. ## Navigation | Care Setting | Menu Path | |---|---| | OPD Retail Dispensing | Main Menu → Pharmacy → Dispensing → Retail Sale | | Inpatient Ward Issue | Main Menu → Pharmacy → Dispensing → Ward Issue (BHT) | | ETU / Direct Inpatient Issue | Main Menu → Pharmacy → Dispensing → Inpatient Direct Issue | | Prescription List | Main Menu → Pharmacy → Prescriptions → Prescription List | ## OPD Dispensing ### Workflow 1. The clinician creates a prescription from the OPD consultation screen, specifying drug, dose, frequency, duration, and route. 2. The pharmacist opens the **Retail Sale** page and searches for the patient by name, registration number, or mobile number. 3. The system displays active prescriptions for the patient. The pharmacist selects the prescription to dispense. 4. Drug items, quantities, dose instructions, and pricing are auto-populated from the prescription. 5. The pharmacist verifies stock availability and batch selection, then confirms the dispense. 6. A pharmacy bill is generated and payment is collected. The prescription is marked as dispensed. ### Multiple Paper Format Support The retail sale screen supports several dispensing interfaces: - **Standard** (`pharmacy_bill_retail_sale.xhtml`) — full feature, item search, prescription link - **Fast Retail** (`pharmacy_fast_retail_sale.xhtml`) — streamlined for high-volume counters - **Cashier-facing** (`pharmacy_bill_retail_sale_for_cashier.xhtml`) — cashier-only payment view ## Inpatient Ward Dispensing (BHT Issue) ### Workflow 1. The ward nurse or doctor creates a medication order linked to the patient's BHT (Bed Head Ticket). 2. The pharmacy receives the order and opens **Ward Issue (BHT)** (`pharmacy_issue.xhtml`). 3. The pharmacist searches by BHT number or patient name. 4. Ordered items are listed. The pharmacist verifies quantities, selects batches, and approves the issue. 5. Stock is decremented from the issuing pharmacy store. A BHT issue bill is created. 6. The ward receives the medication and records administration. ### BHT Pre-Billing For inpatient billing, pharmacy issues can be pre-billed (`PharmacyBhtPre` bill type) — charges accumulate on the BHT and are included in the final inpatient bill at discharge. ## ETU and Inpatient Direct Issue For emergency or high-volume inpatient dispensing, the **Inpatient Direct Issue** workflow (`InpatientDirectIssueNativeSqlController`) provides a performance-optimised path: 1. The pharmacist selects the patient encounter (ETU or ward admission). 2. Items are added manually or pulled from active prescription orders. 3. Issue is finalised with a single confirmation step. 4. Stock movement and billing are committed atomically. This controller uses optimised SQL for fast throughput under high concurrent load typical of emergency departments. ## Electronic Prescription Integration `Prescription` entity fields used in the dispensing workflow: | Field | Description | |---|---| | `item` | Drug item (linked to pharmacy item master) | | `dose` / `doseUnit` | Prescribed dose quantity and unit | | `frequency` / `frequencyUnit` | How often (e.g., 3 times daily) | | `duration` / `durationUnit` | Length of treatment (e.g., 5 days) | | `issueQty` | Total quantity to dispense | | `prescribedFrom` / `prescribedTo` | Treatment period | | `indoor` | True = inpatient prescription | Prescriptions link to the patient's `PatientEncounter`, ensuring the correct episode context for OPD, inpatient, and ETU encounters. ## Sale Returns If a dispensed item must be returned (unused medication, wrong item): - **OPD sale return**: Main Menu → Pharmacy → Returns → Sale Return (`SaleReturnController`) - **Ward issue return**: Main Menu → Pharmacy → Returns → Issue Return (`BhtIssueReturnController`) Returns reverse the stock movement and generate a credit bill. Original batch and pricing are preserved for accounting accuracy. ## Technical Reference | Item | Detail | |---|---| | OPD dispense controller | `PharmacySaleController`, `PharmacyFastRetailSaleController` | | Inpatient issue controller | `PharmacyIssueController`, `PharmacySaleBhtController` | | ETU/direct issue controller | `InpatientDirectIssueNativeSqlController` | | Prescription entity | `com.divudi.core.entity.clinical.Prescription` | | Bill types | `PharmacySale`, `PharmacyBhtPre`, `PharmacyIssue` | | Related | [Pharmacy Batch Management](Pharmacy-Batch-Management.md), [Pharmacy Billing](Pharmacy-Billing-and-Prior-Authorization.md) |