Deploy Ladill Care / deploy (push) Successful in 26s
Keeps Fertility as a separate specialty, adds OB/GYN and fertility staff roles, and migrates live org settings from maternity → womens_health. Co-authored-by: Cursor <cursoragent@cursor.com>
308 lines
22 KiB
PHP
308 lines
22 KiB
PHP
<?php
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Ladill Care — Facility categories + workflow templates
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| The WORKFLOW is the primary configuration object in Ladill Care. A facility
|
|
| picks a Category (which modules to enable) and a Workflow Template (how
|
|
| patients actually move + where money is collected). Templates materialize
|
|
| into care_facility_workflows / care_workflow_stages and can be edited.
|
|
|
|
|
| Stage schema (per stage):
|
|
| code, name, type, queue_context (nullable Queue integration context),
|
|
| department_type (nullable), sort_order,
|
|
| requires_payment (bool), payment_timing (before|after|none),
|
|
| payment_modes (internal_cashier|external_bank|digital),
|
|
| insurance_eligible, credit_allowed, allow_override,
|
|
| charge_code (nullable service catalog key), charge_label, default_amount_minor,
|
|
| default_next (code|null), can_return, can_skip, optional,
|
|
| creates_child (bool — doctor decision branches).
|
|
|
|
|
| Payment timing:
|
|
| before → gate blocks the stage's queue until obligation clears
|
|
| after → service runs, settle later (e.g. pay at exit)
|
|
| none → no financial gate
|
|
*/
|
|
|
|
return [
|
|
|
|
'version' => 1,
|
|
|
|
'default_template' => 'legacy_clinic',
|
|
|
|
/*
|
|
| Facility category → which modules/features to surface. Category controls
|
|
| features, NOT patient flow (that is the workflow template's job).
|
|
*/
|
|
'categories' => [
|
|
'hospital' => [
|
|
'label' => 'Hospital',
|
|
'modules' => ['lab', 'pharmacy', 'imaging', 'billing'],
|
|
'default_template' => 'public_hospital_gh',
|
|
],
|
|
'clinic' => [
|
|
'label' => 'Clinic',
|
|
'modules' => ['pharmacy', 'billing'],
|
|
'default_template' => 'cashless_clinic',
|
|
],
|
|
'specialist' => [
|
|
'label' => 'Specialist practice',
|
|
'modules' => ['billing'],
|
|
'default_template' => 'specialist_practice',
|
|
],
|
|
'diagnostic' => [
|
|
'label' => 'Diagnostic laboratory',
|
|
'modules' => ['lab', 'billing'],
|
|
'default_template' => 'diagnostic_centre',
|
|
],
|
|
'imaging' => [
|
|
'label' => 'Imaging centre',
|
|
'modules' => ['imaging', 'billing'],
|
|
'default_template' => 'diagnostic_centre',
|
|
],
|
|
'pharmacy' => [
|
|
'label' => 'Pharmacy',
|
|
'modules' => ['pharmacy', 'billing'],
|
|
'default_template' => 'pharmacy_led',
|
|
],
|
|
'dental' => [
|
|
'label' => 'Dental clinic',
|
|
'modules' => ['pharmacy', 'billing'],
|
|
'default_template' => 'cashless_clinic',
|
|
],
|
|
'eye' => [
|
|
'label' => 'Eye clinic',
|
|
'modules' => ['pharmacy', 'billing'],
|
|
'default_template' => 'cashless_clinic',
|
|
],
|
|
'womens_health' => [
|
|
'label' => "Women's Health home",
|
|
'modules' => ['lab', 'pharmacy', 'billing'],
|
|
'default_template' => 'private_hospital',
|
|
],
|
|
'herbal_hospital' => [
|
|
'label' => 'Herbal hospital',
|
|
'modules' => ['lab', 'pharmacy', 'billing'],
|
|
'default_template' => 'herbal_hospital',
|
|
],
|
|
'herbal_clinic' => [
|
|
'label' => 'Herbal clinic',
|
|
'modules' => ['pharmacy', 'billing'],
|
|
'default_template' => 'herbal_clinic',
|
|
],
|
|
],
|
|
|
|
'payment_modes' => [
|
|
'internal_cashier' => 'Internal cashier',
|
|
'external_bank' => 'External bank / payment office',
|
|
'digital' => 'Digital (MoMo / card / Paystack)',
|
|
],
|
|
|
|
'clearance_methods' => [
|
|
'payment' => 'Payment received',
|
|
'bank_receipt' => 'External bank receipt verified',
|
|
'insurance' => 'Insurance authorization',
|
|
'credit' => 'Approved credit',
|
|
'waiver' => 'Waiver',
|
|
'override' => 'Authorized override',
|
|
],
|
|
|
|
'obligation_statuses' => [
|
|
'pending' => 'Pending',
|
|
'authorized' => 'Insurance authorized',
|
|
'paid' => 'Paid',
|
|
'waived' => 'Waived',
|
|
'deferred' => 'Deferred / credit',
|
|
'void' => 'Void',
|
|
],
|
|
|
|
'stage_types' => [
|
|
'registration' => 'Registration',
|
|
'payment' => 'Payment',
|
|
'triage' => 'Triage',
|
|
'consultation' => 'Consultation',
|
|
'laboratory' => 'Laboratory',
|
|
'imaging' => 'Imaging',
|
|
'procedure' => 'Procedure',
|
|
'pharmacy' => 'Pharmacy / dispensing',
|
|
'results' => 'Results',
|
|
'exit' => 'Exit',
|
|
'custom' => 'Custom',
|
|
],
|
|
|
|
'templates' => [
|
|
|
|
/*
|
|
| Legacy Clinic — mirrors Care's pre-workflow behavior. No financial
|
|
| gates. Used to migrate existing orgs so nothing changes for them.
|
|
*/
|
|
'legacy_clinic' => [
|
|
'label' => 'Legacy (no gates)',
|
|
'description' => 'Current Ladill Care behavior — reception, consultation, pharmacy with billing after service. No payment gates.',
|
|
'stages' => [
|
|
['code' => 'reception', 'name' => 'Reception', 'type' => 'registration', 'queue_context' => 'reception', 'department_type' => 'outpatient', 'default_next' => 'consultation'],
|
|
['code' => 'consultation', 'name' => 'Consultation', 'type' => 'consultation', 'queue_context' => 'consultation', 'department_type' => 'general', 'default_next' => 'pharmacy', 'can_return' => true, 'creates_child' => true],
|
|
['code' => 'pharmacy', 'name' => 'Pharmacy', 'type' => 'pharmacy', 'queue_context' => 'pharmacy', 'department_type' => 'pharmacy', 'optional' => true, 'default_next' => 'exit'],
|
|
['code' => 'exit', 'name' => 'Exit', 'type' => 'exit'],
|
|
],
|
|
],
|
|
|
|
/*
|
|
| Standard Public Hospital (Ghana) — cash-first with gates at every step.
|
|
*/
|
|
'public_hospital_gh' => [
|
|
'label' => 'Standard public hospital (Ghana)',
|
|
'description' => 'Registration and card purchase, consultation fee before the doctor, and pay-before-service for lab, imaging, and pharmacy. NHIS eligible.',
|
|
'stages' => [
|
|
['code' => 'registration', 'name' => 'Registration', 'type' => 'registration', 'queue_context' => 'reception', 'department_type' => 'outpatient', 'requires_payment' => true, 'payment_timing' => 'before', 'charge_code' => 'patient_card', 'charge_label' => 'Patient card / folder', 'insurance_eligible' => false, 'default_next' => 'triage'],
|
|
['code' => 'triage', 'name' => 'Triage', 'type' => 'triage', 'queue_context' => 'triage', 'department_type' => 'general', 'optional' => true, 'default_next' => 'consultation'],
|
|
['code' => 'consultation', 'name' => 'Consultation', 'type' => 'consultation', 'queue_context' => 'consultation', 'department_type' => 'general', 'requires_payment' => true, 'payment_timing' => 'before', 'charge_code' => 'consultation', 'charge_label' => 'Consultation fee', 'insurance_eligible' => true, 'can_return' => true, 'creates_child' => true, 'default_next' => 'pharmacy'],
|
|
['code' => 'laboratory', 'name' => 'Laboratory', 'type' => 'laboratory', 'queue_context' => 'laboratory', 'department_type' => 'laboratory', 'requires_payment' => true, 'payment_timing' => 'before', 'charge_code' => 'lab', 'charge_label' => 'Laboratory tests', 'insurance_eligible' => true, 'optional' => true, 'can_return' => true, 'default_next' => 'consultation'],
|
|
['code' => 'imaging', 'name' => 'Imaging', 'type' => 'imaging', 'queue_context' => 'imaging', 'department_type' => 'radiology', 'requires_payment' => true, 'payment_timing' => 'before', 'charge_code' => 'imaging', 'charge_label' => 'Imaging services', 'insurance_eligible' => true, 'optional' => true, 'can_return' => true, 'default_next' => 'consultation'],
|
|
['code' => 'pharmacy', 'name' => 'Pharmacy', 'type' => 'pharmacy', 'queue_context' => 'pharmacy', 'department_type' => 'pharmacy', 'requires_payment' => true, 'payment_timing' => 'before', 'charge_code' => 'pharmacy', 'charge_label' => 'Medication', 'insurance_eligible' => true, 'optional' => true, 'default_next' => 'exit'],
|
|
['code' => 'exit', 'name' => 'Exit', 'type' => 'exit'],
|
|
],
|
|
],
|
|
|
|
/*
|
|
| Private Hospital — digital/internal cashier, insurance + corporate.
|
|
*/
|
|
'private_hospital' => [
|
|
'label' => 'Private hospital',
|
|
'description' => 'Registration, consultation fee, and pay-before-service for lab/imaging/pharmacy. Card, MoMo, and insurance supported.',
|
|
'stages' => [
|
|
['code' => 'registration', 'name' => 'Registration', 'type' => 'registration', 'queue_context' => 'reception', 'department_type' => 'outpatient', 'requires_payment' => true, 'payment_timing' => 'before', 'payment_modes' => ['internal_cashier', 'digital'], 'charge_code' => 'registration', 'charge_label' => 'Registration', 'insurance_eligible' => true, 'default_next' => 'consultation'],
|
|
['code' => 'consultation', 'name' => 'Consultation', 'type' => 'consultation', 'queue_context' => 'consultation', 'department_type' => 'general', 'requires_payment' => true, 'payment_timing' => 'before', 'payment_modes' => ['internal_cashier', 'digital'], 'charge_code' => 'consultation', 'charge_label' => 'Consultation fee', 'insurance_eligible' => true, 'can_return' => true, 'creates_child' => true, 'default_next' => 'pharmacy'],
|
|
['code' => 'laboratory', 'name' => 'Laboratory', 'type' => 'laboratory', 'queue_context' => 'laboratory', 'department_type' => 'laboratory', 'requires_payment' => true, 'payment_timing' => 'before', 'payment_modes' => ['internal_cashier', 'digital'], 'charge_code' => 'lab', 'charge_label' => 'Laboratory tests', 'insurance_eligible' => true, 'optional' => true, 'can_return' => true, 'default_next' => 'consultation'],
|
|
['code' => 'imaging', 'name' => 'Imaging', 'type' => 'imaging', 'queue_context' => 'imaging', 'department_type' => 'radiology', 'requires_payment' => true, 'payment_timing' => 'before', 'payment_modes' => ['internal_cashier', 'digital'], 'charge_code' => 'imaging', 'charge_label' => 'Imaging services', 'insurance_eligible' => true, 'optional' => true, 'can_return' => true, 'default_next' => 'consultation'],
|
|
['code' => 'pharmacy', 'name' => 'Pharmacy', 'type' => 'pharmacy', 'queue_context' => 'pharmacy', 'department_type' => 'pharmacy', 'requires_payment' => true, 'payment_timing' => 'before', 'payment_modes' => ['internal_cashier', 'digital'], 'charge_code' => 'pharmacy', 'charge_label' => 'Medication', 'insurance_eligible' => true, 'optional' => true, 'default_next' => 'exit'],
|
|
['code' => 'exit', 'name' => 'Exit', 'type' => 'exit'],
|
|
],
|
|
],
|
|
|
|
/*
|
|
| NHIS Hospital — insurance-authorization first; cash fallback.
|
|
*/
|
|
'nhis_hospital' => [
|
|
'label' => 'NHIS hospital',
|
|
'description' => 'Insurance-authorization gates for consultation, lab, imaging, and pharmacy with cash fallback for non-covered services.',
|
|
'stages' => [
|
|
['code' => 'registration', 'name' => 'Registration', 'type' => 'registration', 'queue_context' => 'reception', 'department_type' => 'outpatient', 'requires_payment' => true, 'payment_timing' => 'before', 'charge_code' => 'registration', 'charge_label' => 'Registration / NHIS verification', 'insurance_eligible' => true, 'default_next' => 'triage'],
|
|
['code' => 'triage', 'name' => 'Triage', 'type' => 'triage', 'queue_context' => 'triage', 'department_type' => 'general', 'optional' => true, 'default_next' => 'consultation'],
|
|
['code' => 'consultation', 'name' => 'Consultation', 'type' => 'consultation', 'queue_context' => 'consultation', 'department_type' => 'general', 'requires_payment' => true, 'payment_timing' => 'before', 'charge_code' => 'consultation', 'charge_label' => 'Consultation', 'insurance_eligible' => true, 'can_return' => true, 'creates_child' => true, 'default_next' => 'pharmacy'],
|
|
['code' => 'laboratory', 'name' => 'Laboratory', 'type' => 'laboratory', 'queue_context' => 'laboratory', 'department_type' => 'laboratory', 'requires_payment' => true, 'payment_timing' => 'before', 'charge_code' => 'lab', 'charge_label' => 'Laboratory tests', 'insurance_eligible' => true, 'optional' => true, 'can_return' => true, 'default_next' => 'consultation'],
|
|
['code' => 'pharmacy', 'name' => 'Pharmacy', 'type' => 'pharmacy', 'queue_context' => 'pharmacy', 'department_type' => 'pharmacy', 'requires_payment' => true, 'payment_timing' => 'before', 'charge_code' => 'pharmacy', 'charge_label' => 'Medication', 'insurance_eligible' => true, 'optional' => true, 'default_next' => 'exit'],
|
|
['code' => 'exit', 'name' => 'Exit', 'type' => 'exit'],
|
|
],
|
|
],
|
|
|
|
/*
|
|
| Cashless private clinic — pay at exit (no gates before service).
|
|
*/
|
|
'cashless_clinic' => [
|
|
'label' => 'Cashless clinic (pay at exit)',
|
|
'description' => 'Reception, consultation, and pharmacy with a single payment at exit. No gates block clinical service.',
|
|
'stages' => [
|
|
['code' => 'reception', 'name' => 'Reception', 'type' => 'registration', 'queue_context' => 'reception', 'department_type' => 'outpatient', 'default_next' => 'consultation'],
|
|
['code' => 'consultation', 'name' => 'Consultation', 'type' => 'consultation', 'queue_context' => 'consultation', 'department_type' => 'general', 'can_return' => true, 'creates_child' => true, 'default_next' => 'pharmacy'],
|
|
['code' => 'pharmacy', 'name' => 'Pharmacy', 'type' => 'pharmacy', 'queue_context' => 'pharmacy', 'department_type' => 'pharmacy', 'optional' => true, 'default_next' => 'checkout'],
|
|
['code' => 'checkout', 'name' => 'Checkout', 'type' => 'payment', 'queue_context' => 'billing', 'requires_payment' => true, 'payment_timing' => 'after', 'charge_code' => 'visit_total', 'charge_label' => 'Visit total', 'insurance_eligible' => true, 'default_next' => 'exit'],
|
|
['code' => 'exit', 'name' => 'Exit', 'type' => 'exit'],
|
|
],
|
|
],
|
|
|
|
/*
|
|
| Diagnostic centre — reception → pay → sample → testing → results.
|
|
*/
|
|
'diagnostic_centre' => [
|
|
'label' => 'Diagnostic centre',
|
|
'description' => 'Reception, payment before sample collection, testing, and results delivery.',
|
|
'stages' => [
|
|
['code' => 'reception', 'name' => 'Reception', 'type' => 'registration', 'queue_context' => 'reception', 'department_type' => 'outpatient', 'default_next' => 'payment'],
|
|
['code' => 'payment', 'name' => 'Payment', 'type' => 'payment', 'queue_context' => 'billing', 'requires_payment' => true, 'payment_timing' => 'before', 'charge_code' => 'lab', 'charge_label' => 'Diagnostic tests', 'insurance_eligible' => true, 'default_next' => 'sample'],
|
|
['code' => 'sample', 'name' => 'Sample collection', 'type' => 'laboratory', 'queue_context' => 'laboratory', 'department_type' => 'laboratory', 'default_next' => 'testing'],
|
|
['code' => 'testing', 'name' => 'Testing', 'type' => 'laboratory', 'department_type' => 'laboratory', 'default_next' => 'results'],
|
|
['code' => 'results', 'name' => 'Results', 'type' => 'results', 'default_next' => 'exit'],
|
|
['code' => 'exit', 'name' => 'Exit', 'type' => 'exit'],
|
|
],
|
|
],
|
|
|
|
/*
|
|
| Specialist practice — appointment → consultation → pay → exit.
|
|
*/
|
|
'specialist_practice' => [
|
|
'label' => 'Specialist practice',
|
|
'description' => 'Appointment-led consultation with payment after service.',
|
|
'stages' => [
|
|
['code' => 'reception', 'name' => 'Reception', 'type' => 'registration', 'queue_context' => 'reception', 'department_type' => 'outpatient', 'default_next' => 'consultation'],
|
|
['code' => 'consultation', 'name' => 'Consultation', 'type' => 'consultation', 'queue_context' => 'consultation', 'department_type' => 'general', 'can_return' => true, 'creates_child' => true, 'default_next' => 'payment'],
|
|
['code' => 'payment', 'name' => 'Payment', 'type' => 'payment', 'queue_context' => 'billing', 'requires_payment' => true, 'payment_timing' => 'after', 'charge_code' => 'consultation', 'charge_label' => 'Consultation fee', 'insurance_eligible' => true, 'default_next' => 'exit'],
|
|
['code' => 'exit', 'name' => 'Exit', 'type' => 'exit'],
|
|
],
|
|
],
|
|
|
|
/*
|
|
| Pharmacy-led — dispensary counter with pay-before-dispense.
|
|
*/
|
|
'pharmacy_led' => [
|
|
'label' => 'Pharmacy / dispensary',
|
|
'description' => 'Prescription intake, billing, payment, and dispensing.',
|
|
'stages' => [
|
|
['code' => 'intake', 'name' => 'Prescription intake', 'type' => 'registration', 'queue_context' => 'reception', 'department_type' => 'pharmacy', 'default_next' => 'payment'],
|
|
['code' => 'payment', 'name' => 'Payment', 'type' => 'payment', 'queue_context' => 'billing', 'requires_payment' => true, 'payment_timing' => 'before', 'charge_code' => 'pharmacy', 'charge_label' => 'Medication', 'insurance_eligible' => true, 'default_next' => 'dispensing'],
|
|
['code' => 'dispensing', 'name' => 'Dispensing', 'type' => 'pharmacy', 'queue_context' => 'pharmacy', 'department_type' => 'pharmacy', 'default_next' => 'exit'],
|
|
['code' => 'exit', 'name' => 'Exit', 'type' => 'exit'],
|
|
],
|
|
],
|
|
|
|
/*
|
|
| Standard Herbal Hospital (Ghana) — herbal consultation + preparation
|
|
| and dispensing with cash/MoMo-first gates. Insurance usually N/A.
|
|
*/
|
|
'herbal_hospital' => [
|
|
'label' => 'Standard herbal hospital (Ghana)',
|
|
'description' => 'Registration, herbal consultation fee, and pay-before-service for herbal preparation and dispensing. Lab optional. Cash and MoMo first.',
|
|
'stages' => [
|
|
['code' => 'registration', 'name' => 'Registration', 'type' => 'registration', 'queue_context' => 'reception', 'department_type' => 'outpatient', 'requires_payment' => true, 'payment_timing' => 'before', 'payment_modes' => ['internal_cashier', 'external_bank', 'digital'], 'charge_code' => 'patient_card', 'charge_label' => 'Patient card / folder', 'insurance_eligible' => false, 'default_next' => 'consultation'],
|
|
['code' => 'consultation', 'name' => 'Herbal consultation', 'type' => 'consultation', 'queue_context' => 'consultation', 'department_type' => 'general', 'requires_payment' => true, 'payment_timing' => 'before', 'payment_modes' => ['internal_cashier', 'external_bank', 'digital'], 'charge_code' => 'consultation', 'charge_label' => 'Consultation fee', 'insurance_eligible' => false, 'can_return' => true, 'creates_child' => true, 'default_next' => 'dispensing'],
|
|
['code' => 'laboratory', 'name' => 'Laboratory', 'type' => 'laboratory', 'queue_context' => 'laboratory', 'department_type' => 'laboratory', 'requires_payment' => true, 'payment_timing' => 'before', 'charge_code' => 'lab', 'charge_label' => 'Laboratory tests', 'insurance_eligible' => false, 'optional' => true, 'can_return' => true, 'default_next' => 'consultation'],
|
|
['code' => 'preparation', 'name' => 'Herbal preparation', 'type' => 'pharmacy', 'department_type' => 'pharmacy', 'requires_payment' => true, 'payment_timing' => 'before', 'payment_modes' => ['internal_cashier', 'external_bank', 'digital'], 'charge_code' => 'pharmacy', 'charge_label' => 'Herbal medicine', 'insurance_eligible' => false, 'default_next' => 'dispensing'],
|
|
['code' => 'dispensing', 'name' => 'Dispensing', 'type' => 'pharmacy', 'queue_context' => 'pharmacy', 'department_type' => 'pharmacy', 'default_next' => 'exit'],
|
|
['code' => 'exit', 'name' => 'Exit', 'type' => 'exit'],
|
|
],
|
|
],
|
|
|
|
/*
|
|
| Herbal Clinic (simple) — reception → consult → pay → dispense.
|
|
*/
|
|
'herbal_clinic' => [
|
|
'label' => 'Herbal clinic (simple)',
|
|
'description' => 'Reception, herbal consultation, payment, then dispensing. Cash and MoMo first.',
|
|
'stages' => [
|
|
['code' => 'reception', 'name' => 'Reception', 'type' => 'registration', 'queue_context' => 'reception', 'department_type' => 'outpatient', 'default_next' => 'consultation'],
|
|
['code' => 'consultation', 'name' => 'Herbal consultation', 'type' => 'consultation', 'queue_context' => 'consultation', 'department_type' => 'general', 'can_return' => true, 'creates_child' => true, 'default_next' => 'payment'],
|
|
['code' => 'payment', 'name' => 'Payment', 'type' => 'payment', 'queue_context' => 'billing', 'requires_payment' => true, 'payment_timing' => 'before', 'payment_modes' => ['internal_cashier', 'digital'], 'charge_code' => 'pharmacy', 'charge_label' => 'Consultation + herbal medicine', 'insurance_eligible' => false, 'default_next' => 'dispensing'],
|
|
['code' => 'dispensing', 'name' => 'Dispensing', 'type' => 'pharmacy', 'queue_context' => 'pharmacy', 'department_type' => 'pharmacy', 'default_next' => 'exit'],
|
|
['code' => 'exit', 'name' => 'Exit', 'type' => 'exit'],
|
|
],
|
|
],
|
|
|
|
/*
|
|
| Custom — minimal starting point for the workflow builder.
|
|
*/
|
|
'custom' => [
|
|
'label' => 'Build custom',
|
|
'description' => 'Start with reception and consultation, then build your own stages.',
|
|
'stages' => [
|
|
['code' => 'reception', 'name' => 'Reception', 'type' => 'registration', 'queue_context' => 'reception', 'department_type' => 'outpatient', 'default_next' => 'consultation'],
|
|
['code' => 'consultation', 'name' => 'Consultation', 'type' => 'consultation', 'queue_context' => 'consultation', 'department_type' => 'general', 'can_return' => true, 'creates_child' => true, 'default_next' => 'exit'],
|
|
['code' => 'exit', 'name' => 'Exit', 'type' => 'exit'],
|
|
],
|
|
],
|
|
|
|
],
|
|
|
|
];
|