@ampath/esm-dha-workflow-app 4.0.0-next.15 → 4.0.0-next.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/1197.js +1 -0
- package/dist/1277.js +1 -0
- package/dist/1277.js.map +1 -0
- package/dist/1558.js +2 -0
- package/dist/1558.js.map +1 -0
- package/dist/1729.js +1 -0
- package/dist/1729.js.map +1 -0
- package/dist/182.js +1 -0
- package/dist/182.js.map +1 -0
- package/dist/1826.js +1 -0
- package/dist/1826.js.map +1 -0
- package/dist/1833.js +1 -0
- package/dist/1833.js.map +1 -0
- package/dist/1856.js +1 -0
- package/dist/1856.js.map +1 -0
- package/dist/1925.js +1 -0
- package/dist/1925.js.map +1 -0
- package/dist/2021.js +1 -0
- package/dist/2021.js.map +1 -0
- package/dist/2054.js +1 -0
- package/dist/2054.js.map +1 -0
- package/dist/2177.js +2 -0
- package/dist/2177.js.map +1 -0
- package/dist/2333.js +1 -0
- package/dist/2333.js.map +1 -0
- package/dist/2364.js +2 -0
- package/dist/{388.js.LICENSE.txt → 2364.js.LICENSE.txt} +15 -0
- package/dist/2364.js.map +1 -0
- package/dist/2801.js +1 -0
- package/dist/2801.js.map +1 -0
- package/dist/3041.js +1 -0
- package/dist/3041.js.map +1 -0
- package/dist/3099.js +1 -0
- package/dist/3184.js +2 -0
- package/dist/3184.js.map +1 -0
- package/dist/3654.js +1 -0
- package/dist/3654.js.map +1 -0
- package/dist/4055.js +1 -0
- package/dist/4205.js +1 -0
- package/dist/4205.js.map +1 -0
- package/dist/4225.js +1 -0
- package/dist/4225.js.map +1 -0
- package/dist/4300.js +1 -0
- package/dist/4335.js +1 -0
- package/dist/4353.js +1 -0
- package/dist/4353.js.map +1 -0
- package/dist/4517.js +1 -0
- package/dist/4517.js.map +1 -0
- package/dist/4652.js +1 -0
- package/dist/4674.js +1 -0
- package/dist/4674.js.map +1 -0
- package/dist/4947.js +1 -0
- package/dist/4947.js.map +1 -0
- package/dist/5015.js +1 -0
- package/dist/5015.js.map +1 -0
- package/dist/5422.js +1 -0
- package/dist/5422.js.map +1 -0
- package/dist/5428.js +1 -0
- package/dist/5428.js.map +1 -0
- package/dist/5752.js +1 -0
- package/dist/5752.js.map +1 -0
- package/dist/5851.js +1 -0
- package/dist/5851.js.map +1 -0
- package/dist/6260.js +1 -0
- package/dist/6260.js.map +1 -0
- package/dist/6264.js +1 -0
- package/dist/6264.js.map +1 -0
- package/dist/6540.js +2 -0
- package/dist/6540.js.map +1 -0
- package/dist/6606.js +1 -0
- package/dist/6606.js.map +1 -0
- package/dist/{709.js → 693.js} +1 -1
- package/dist/693.js.map +1 -0
- package/dist/6991.js +1 -0
- package/dist/6991.js.map +1 -0
- package/dist/7199.js +1 -0
- package/dist/7199.js.map +1 -0
- package/dist/7255.js +1 -0
- package/dist/7255.js.map +1 -0
- package/dist/7258.js +1 -0
- package/dist/7258.js.map +1 -0
- package/dist/7420.js +1 -0
- package/dist/7420.js.map +1 -0
- package/dist/8114.js +1 -0
- package/dist/8114.js.map +1 -0
- package/dist/8235.js +1 -0
- package/dist/8235.js.map +1 -0
- package/dist/8339.js +1 -0
- package/dist/8339.js.map +1 -0
- package/dist/8558.js +1 -0
- package/dist/8558.js.map +1 -0
- package/dist/8865.js +1 -0
- package/dist/8865.js.map +1 -0
- package/dist/8895.js +1 -0
- package/dist/8895.js.map +1 -0
- package/dist/9037.js +1 -0
- package/dist/9037.js.map +1 -0
- package/dist/9091.js +1 -0
- package/dist/9091.js.map +1 -0
- package/dist/9093.js +1 -0
- package/dist/9093.js.map +1 -0
- package/dist/9117.js +1 -0
- package/dist/9117.js.map +1 -0
- package/dist/9721.js +1 -0
- package/dist/9721.js.map +1 -0
- package/dist/esm-dha-workflow-app.js +1 -1
- package/dist/esm-dha-workflow-app.js.buildmanifest.json +990 -215
- package/dist/esm-dha-workflow-app.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +10 -3
- package/src/accounting/accounting.component.tsx +13 -0
- package/src/admissions/admission-request-list/admission-request-list.scss +0 -0
- package/src/admissions/admission-request-list/admission-request-list.tsx +134 -0
- package/src/admissions/admissions-dashboard.component.scss +15 -0
- package/src/admissions/admissions-dashboard.component.tsx +160 -0
- package/src/admissions/admissions.resource.ts +101 -0
- package/src/admissions/admitted-list/admitted-patients-list.tsx +141 -0
- package/src/admissions/constants/index.ts +33 -0
- package/src/admissions/discharged-list/discharged-list.scss +0 -0
- package/src/admissions/discharged-list/discharged-list.tsx +58 -0
- package/src/admissions/inpatient/admission-history/patient-admission-history.tsx +76 -0
- package/src/admissions/inpatient/admission-requests/patient-admission-requests.scss +19 -0
- package/src/admissions/inpatient/admission-requests/patient-admission-requests.tsx +72 -0
- package/src/admissions/inpatient/inpatient-admissions.component.scss +7 -0
- package/src/admissions/inpatient/inpatient-admissions.component.tsx +46 -0
- package/src/admissions/modal/admit-elsewhere/admit-elsewhere.modal.scss +23 -0
- package/src/admissions/modal/admit-elsewhere/admit-elsewhere.modal.tsx +156 -0
- package/src/admissions/modal/admit-patient/admit-patient.modal.scss +0 -0
- package/src/admissions/modal/admit-patient/admit-patient.modal.tsx +109 -0
- package/src/admissions/modal/bed-swap/bed-swap.modal.scss +0 -0
- package/src/admissions/modal/bed-swap/bed-swap.modal.tsx +102 -0
- package/src/admissions/modal/cancel-admission-request/cancel-admission-request.scss +11 -0
- package/src/admissions/modal/cancel-admission-request/cancel-admission-request.tsx +105 -0
- package/src/admissions/modal/discharge/discharge-patient.modal.scss +13 -0
- package/src/admissions/modal/discharge/discharge-patient.modal.tsx +84 -0
- package/src/admissions/types/index.ts +192 -0
- package/src/appointments/appointments.component.tsx +13 -0
- package/src/billing/api/billing.api.ts +107 -0
- package/src/billing/billing-root.tsx +20 -0
- package/src/billing/dashboard/billingDashboard.component.scss +0 -0
- package/src/billing/dashboard/billingDashboard.component.tsx +25 -0
- package/src/billing/extensions/visit-billing/visit-billing.extension.scss +0 -0
- package/src/billing/extensions/visit-billing/visit-billing.extension.tsx +508 -0
- package/src/billing/invoice/bill.resource.ts +47 -0
- package/src/billing/invoice/invoice-header/header-card/header-card.scss +17 -0
- package/src/billing/invoice/invoice-header/header-card/header-card.tsx +21 -0
- package/src/billing/invoice/invoice.scss +113 -0
- package/src/billing/invoice/invoice.tsx +1441 -0
- package/src/billing/invoice/line-items/line-items.scss +0 -0
- package/src/billing/invoice/line-items/line-items.tsx +120 -0
- package/src/billing/invoice/modal/delete-bill-item/delete-bill-item.modal.scss +23 -0
- package/src/billing/invoice/modal/delete-bill-item/delete-bill-item.modal.tsx +114 -0
- package/src/billing/invoice/modal/edit-bill-item/edit-bill-item.modal.scss +0 -0
- package/src/billing/invoice/modal/edit-bill-item/edit-bill-item.modal.tsx +122 -0
- package/src/billing/invoice/payment-details/payment-details.scss +0 -0
- package/src/billing/invoice/payment-details/payment-details.tsx +43 -0
- package/src/billing/invoice/print-invoice/print-receipt.component.tsx +44 -0
- package/src/billing/invoice/print-invoice/print-receipt.scss +14 -0
- package/src/billing/types/index.ts +84 -0
- package/src/billing/utils/index.ts +17 -0
- package/src/billing/widgets/billingTotalsRow.component.scss +0 -0
- package/src/billing/widgets/billingTotalsRow.component.tsx +712 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/create-order-bill-form.resource.ts +103 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/create-order-bill-form.scss +58 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/create-order-bill-form.workspace.tsx +349 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/schema.ts +11 -0
- package/src/bookings/bookings.component.scss +7 -0
- package/src/bookings/bookings.component.tsx +31 -0
- package/src/bookings/daily/daily-bookings.component.scss +38 -0
- package/src/bookings/daily/daily-bookings.component.tsx +138 -0
- package/src/bookings/daily/daily-bookings.resource.ts +28 -0
- package/src/bookings/daily/filters/daily-bookings-filter.component.scss +15 -0
- package/src/bookings/daily/filters/daily-bookings-filter.component.tsx +80 -0
- package/src/bookings/daily/patient-list/daily-bookings-patient-list.component.tsx +97 -0
- package/src/bookings/types/index.ts +68 -0
- package/src/config-schema.ts +91 -1
- package/src/createDashboardLink.tsx +9 -0
- package/src/dashboard/charts/chart.component.scss +13 -0
- package/src/dashboard/charts/chart.component.tsx +56 -0
- package/src/dashboard/dashboard.component.scss +7 -0
- package/src/dashboard/dashboard.component.tsx +51 -0
- package/src/dashboard/overview/overview.component.scss +150 -0
- package/src/dashboard/overview/overview.component.tsx +134 -0
- package/src/dashboard/patient-list/patient-list.component.tsx +41 -0
- package/src/dashboard-meta/accounting-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/admissions-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/billing-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/bookings-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/consultation-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/dha-workflow-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/inpatient-admissions.meta.ts +6 -0
- package/src/dashboard-meta/maternity-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/mch-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/pharmacy-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/queue-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/registers-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/registry-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/service-queue-admin.meta.ts +6 -0
- package/src/dashboard-meta/triage-dashboard.meta.ts +6 -0
- package/src/hooks/useActions.ts +19 -2
- package/src/index.ts +110 -15
- package/src/laboratory/laboratory.component.tsx +13 -0
- package/src/mnch/maternity/maternity-queues.component.scss +7 -0
- package/src/mnch/maternity/maternity-queues.component.tsx +28 -0
- package/src/mnch/maternity/queues/triage/maternity-triage.tsx +15 -0
- package/src/mnch/mch/mch-queues.component.scss +7 -0
- package/src/mnch/mch/mch-queues.component.tsx +32 -0
- package/src/mnch/mch/queues/consultation/mch-consultation.tsx +18 -0
- package/src/mnch/mch/queues/triage/mch-triage.tsx +15 -0
- package/src/mnch/mnch-root.tsx +17 -0
- package/src/mortuary/mortuary.component.tsx +13 -0
- package/src/pharmacy/pharmacy.component.tsx +13 -0
- package/src/registers/registers.component.tsx +8 -0
- package/src/registry/eligibility/eliigibility-tags/eligibility-tags.scss +6 -0
- package/src/registry/eligibility/eliigibility-tags/eligibility-tags.tsx +137 -0
- package/src/registry/eligibility/modal/eligibility-details.modal.scss +38 -0
- package/src/registry/eligibility/modal/eligibility-details.modal.tsx +131 -0
- package/src/registry/modal/client-details-modal/client-details-modal.tsx +9 -26
- package/src/registry/modal/otp-verification-modal/otp-verification-modal.scss +31 -1
- package/src/registry/modal/otp-verification-modal/otp-verification-modal.tsx +139 -54
- package/src/registry/modal/send-to-triage/send-to-triage.modal.scss +9 -1
- package/src/registry/modal/send-to-triage/send-to-triage.modal.tsx +665 -45
- package/src/registry/payment-details/payment-options/payment-options.scss +13 -0
- package/src/registry/payment-details/payment-options/payment-options.tsx +61 -14
- package/src/registry/registry.component.scss +6 -0
- package/src/registry/registry.component.tsx +94 -27
- package/src/registry/registry.resource.ts +10 -6
- package/src/registry/types/index.ts +120 -0
- package/src/registry/utils/hie-client-adapter.ts +3 -0
- package/src/registry/utils/mask-data.ts +11 -0
- package/src/resources/dashboard.resource.ts +20 -0
- package/src/resources/identifier-types.ts +2 -0
- package/src/resources/patient-resource.ts +3 -1
- package/src/resources/queue.resource.ts +24 -1
- package/src/resources/superset.resource.ts +21 -0
- package/src/resources/visit.resource.ts +19 -1
- package/src/root.component.tsx +27 -6
- package/src/routes.json +222 -15
- package/src/{consultation → service-queues}/action-button.component.tsx +2 -2
- package/src/{consultation → service-queues}/action-overflow-menu-item.component.tsx +2 -2
- package/src/service-queues/admin/queue/modal/create-queue/create-queue.modal.scss +31 -0
- package/src/service-queues/admin/queue/modal/create-queue/create-queue.modal.tsx +143 -0
- package/src/service-queues/admin/queue/modal/edit-queue/edit-queue.modal.scss +0 -0
- package/src/service-queues/admin/queue/modal/edit-queue/edit-queue.modal.tsx +154 -0
- package/src/service-queues/admin/queue/queue-list/queue-list.scss +33 -0
- package/src/service-queues/admin/queue/queue-list/queue-list.tsx +113 -0
- package/src/service-queues/admin/queue-entry/queue-entry-list.component.scss +6 -0
- package/src/service-queues/admin/queue-entry/queue-entry-list.component.tsx +137 -0
- package/src/service-queues/admin/queue-room/modal/create-queue-room/create-queue-room.modal.scss +31 -0
- package/src/service-queues/admin/queue-room/modal/create-queue-room/create-queue-room.modal.tsx +137 -0
- package/src/service-queues/admin/queue-room/modal/edit-queue-room/edit-queue-room.modal.scss +0 -0
- package/src/service-queues/admin/queue-room/modal/edit-queue-room/edit-queue-room.modal.tsx +146 -0
- package/src/service-queues/admin/queue-room/queue-room-list/queue-room-list.scss +22 -0
- package/src/service-queues/admin/queue-room/queue-room-list/queue-room-list.tsx +120 -0
- package/src/service-queues/admin/service-queue-admin-dashboard.component.scss +6 -0
- package/src/service-queues/admin/service-queue-admin-dashboard.component.tsx +34 -0
- package/src/service-queues/consultation/consultation.component.scss +7 -0
- package/src/service-queues/consultation/consultation.component.tsx +15 -0
- package/src/service-queues/extensions/service-queue-patient-banner/service-queue-patient-banner.scss +30 -0
- package/src/service-queues/extensions/service-queue-patient-banner/service-queue-patient-banner.tsx +108 -0
- package/src/service-queues/metrics/metrics-cards/attended-patients.extension.tsx +38 -0
- package/src/service-queues/metrics/metrics-cards/waiting-patients.extension.tsx +34 -0
- package/src/service-queues/metrics/metrics-container.component.tsx +23 -0
- package/src/{metrics → service-queues/metrics}/metrics.resource.ts +0 -36
- package/src/service-queues/modals/daily-report-patient-list/daily-report-patient-list.scss +26 -0
- package/src/service-queues/modals/daily-report-patient-list/daily-report-patient-list.tsx +108 -0
- package/src/service-queues/modals/move/move-patient.component.scss +35 -0
- package/src/service-queues/modals/move/move-patient.component.tsx +152 -0
- package/src/service-queues/modals/serve/serve-patient.comppnent.scss +0 -0
- package/src/service-queues/modals/serve/serve-patient.comppnent.tsx +80 -0
- package/src/service-queues/modals/sign-off/sign-off.modal.scss +0 -0
- package/src/service-queues/modals/sign-off/sign-off.modal.tsx +79 -0
- package/src/service-queues/modals/transition/transition-patient.component.scss +0 -0
- package/src/service-queues/modals/transition/transition-patient.component.tsx +122 -0
- package/src/service-queues/queue-list/check-in.service.ts +26 -0
- package/src/service-queues/queue-list/queue-list.component.scss +50 -0
- package/src/service-queues/queue-list/queue-list.component.tsx +302 -0
- package/src/service-queues/queue-room.component.tsx +39 -0
- package/src/service-queues/room/room.component.tsx +58 -0
- package/src/service-queues/service-queue/service-queue.component.scss +14 -0
- package/src/service-queues/service-queue/service-queue.component.tsx +399 -0
- package/src/service-queues/service-queue/stats/stat-details/stat-details.component.scss +12 -0
- package/src/service-queues/service-queue/stats/stat-details/stat-details.component.tsx +63 -0
- package/src/service-queues/service-queue.scss +27 -0
- package/src/service-queues/service-queue.tsx +37 -0
- package/src/service-queues/service-queues.resource.ts +303 -4
- package/src/service-queues/service.resource.ts +28 -0
- package/src/shared/constants/concepts.ts +18 -0
- package/src/shared/constants/index.ts +1 -2
- package/src/shared/constants/patient-category.ts +6 -0
- package/src/shared/constants/patient-type.ts +10 -0
- package/src/shared/constants/visit-types.ts +7 -0
- package/src/shared/services/billing.resource.ts +38 -0
- package/src/shared/services/client-payment-mode.resource.ts +27 -0
- package/src/shared/services/client-payment.resource.ts +17 -0
- package/src/shared/services/eligibility.resource.ts +19 -0
- package/src/shared/services/encounters.resource.ts +27 -0
- package/src/shared/services/location.resource.ts +9 -0
- package/src/shared/types/index.ts +152 -0
- package/src/shared/ui/aggregate-stat-card/aggregate-stat-card.scss +42 -0
- package/src/shared/ui/aggregate-stat-card/aggregate-stat-card.tsx +42 -0
- package/src/shared/ui/confirm-modal/confirm.modal.scss +18 -0
- package/src/shared/ui/confirm-modal/confirm.modal.tsx +38 -0
- package/src/shared/ui/otp-input/otp-input.component.scss +14 -0
- package/src/shared/ui/otp-input/otp-input.component.tsx +90 -0
- package/src/shared/ui/stat-card/stat-card.component.scss +10 -0
- package/src/shared/ui/stat-card/stat-card.component.tsx +26 -0
- package/src/shared/ui/timer/timer.component.scss +5 -0
- package/src/shared/ui/timer/timer.component.tsx +40 -0
- package/src/shared/utils/get-base-url.ts +27 -0
- package/src/shared/utils/get-tag-type.ts +66 -0
- package/src/side-nav-menu/mnch-nav-link-config.ts +16 -0
- package/src/side-nav-menu/mnch-nav-links.tsx +42 -0
- package/src/side-nav-menu/nav-link-config.ts +6 -4
- package/src/triage/metrics/attended-patients.extension.tsx +42 -0
- package/src/triage/metrics/metrics.scss +36 -0
- package/src/triage/metrics/triage-metrics.component.tsx +21 -0
- package/src/triage/metrics/waiting-patients.extension.tsx +39 -0
- package/src/triage/room/room.scss +29 -0
- package/src/triage/triage.component.tsx +15 -0
- package/src/triage/triage.resource.ts +19 -0
- package/src/triage/types.ts +16 -0
- package/src/types/types.ts +82 -2
- package/dist/104.js +0 -2
- package/dist/104.js.map +0 -1
- package/dist/184.js +0 -2
- package/dist/184.js.map +0 -1
- package/dist/197.js +0 -1
- package/dist/255.js +0 -1
- package/dist/255.js.map +0 -1
- package/dist/300.js +0 -1
- package/dist/306.js +0 -1
- package/dist/306.js.map +0 -1
- package/dist/335.js +0 -1
- package/dist/353.js +0 -1
- package/dist/353.js.map +0 -1
- package/dist/388.js +0 -2
- package/dist/388.js.map +0 -1
- package/dist/420.js +0 -1
- package/dist/420.js.map +0 -1
- package/dist/460.js +0 -1
- package/dist/460.js.map +0 -1
- package/dist/540.js +0 -2
- package/dist/540.js.map +0 -1
- package/dist/55.js +0 -1
- package/dist/560.js +0 -1
- package/dist/560.js.map +0 -1
- package/dist/635.js +0 -1
- package/dist/635.js.map +0 -1
- package/dist/652.js +0 -1
- package/dist/695.js +0 -1
- package/dist/695.js.map +0 -1
- package/dist/709.js.map +0 -1
- package/dist/710.js +0 -2
- package/dist/710.js.map +0 -1
- package/dist/91.js +0 -1
- package/dist/91.js.map +0 -1
- package/dist/93.js +0 -1
- package/dist/93.js.map +0 -1
- package/dist/978.js +0 -1
- package/dist/978.js.map +0 -1
- package/dist/99.js +0 -1
- package/src/consultation/consultation-room.component.tsx +0 -60
- package/src/consultation/consultation.scss +0 -5
- package/src/consultation/consultation.tsx +0 -14
- package/src/hooks/useQueueEntries.ts +0 -35
- package/src/metrics/metrics-cards/attended-patients.extension.tsx +0 -18
- package/src/metrics/metrics-cards/waiting-patients.extension.tsx +0 -18
- package/src/metrics/metrics-container.component.tsx +0 -16
- package/src/registry/mock-client.ts +0 -627
- /package/dist/{710.js.LICENSE.txt → 1558.js.LICENSE.txt} +0 -0
- /package/dist/{104.js.LICENSE.txt → 2177.js.LICENSE.txt} +0 -0
- /package/dist/{184.js.LICENSE.txt → 3184.js.LICENSE.txt} +0 -0
- /package/dist/{540.js.LICENSE.txt → 6540.js.LICENSE.txt} +0 -0
- /package/src/{metrics → service-queues/metrics}/metrics-cards/metrics-card.component.tsx +0 -0
- /package/src/{metrics → service-queues/metrics}/metrics-cards/metrics-card.scss +0 -0
- /package/src/{metrics → service-queues/metrics}/metrics-container.scss +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Button,
|
|
4
4
|
Checkbox,
|
|
5
|
-
|
|
5
|
+
ComboBox,
|
|
6
6
|
Modal,
|
|
7
7
|
ModalBody,
|
|
8
8
|
Select,
|
|
@@ -13,13 +13,45 @@ import {
|
|
|
13
13
|
TableHead,
|
|
14
14
|
TableHeader,
|
|
15
15
|
TableRow,
|
|
16
|
+
TextInput,
|
|
16
17
|
} from '@carbon/react';
|
|
17
18
|
import styles from './send-to-triage.modal.scss';
|
|
18
|
-
import { type Patient,
|
|
19
|
-
import {
|
|
20
|
-
|
|
19
|
+
import { type Patient, useSession, showSnackbar, type Visit, useConfig } from '@openmrs/esm-framework';
|
|
20
|
+
import {
|
|
21
|
+
type HieClient,
|
|
22
|
+
type CreateVisitDto,
|
|
23
|
+
type QueueEntryDto,
|
|
24
|
+
type ServiceQueue,
|
|
25
|
+
PaymentDetail,
|
|
26
|
+
type VisitAttribute,
|
|
27
|
+
} from '../../types';
|
|
28
|
+
import { createQueueEntry, getFacilityServiceQueues } from '../../../resources/queue.resource';
|
|
21
29
|
import { QUEUE_PRIORITIES_UUIDS, QUEUE_STATUS_UUIDS } from '../../../shared/constants/concepts';
|
|
22
30
|
import { createVisit } from '../../../resources/visit.resource';
|
|
31
|
+
import {
|
|
32
|
+
createBill,
|
|
33
|
+
fetchBillableServices,
|
|
34
|
+
fetchCashPoints,
|
|
35
|
+
fetchPaymentModes,
|
|
36
|
+
} from '../../../shared/services/billing.resource';
|
|
37
|
+
import {
|
|
38
|
+
type PayableBillableService,
|
|
39
|
+
type ServicePrice,
|
|
40
|
+
type BillableService,
|
|
41
|
+
type PaymentMode,
|
|
42
|
+
type CreateBillDto,
|
|
43
|
+
type CashPoint,
|
|
44
|
+
type CreateOrderEncounterDto,
|
|
45
|
+
} from '../../../shared/types';
|
|
46
|
+
import { PatientCategories } from '../../../shared/constants/patient-category';
|
|
47
|
+
import { VisitTypeUuids } from '../../../shared/constants/visit-types';
|
|
48
|
+
import { type Bill } from '../../../billing/types';
|
|
49
|
+
import { fetchPatientBills } from '../../../billing/invoice/bill.resource';
|
|
50
|
+
import { type QueueEntry } from '../../../types/types';
|
|
51
|
+
import { getActiveQueueEntryByPatientUuid } from '../../../service-queues/service-queues.resource';
|
|
52
|
+
import { createOrderEncounter } from '../../../shared/services/encounters.resource';
|
|
53
|
+
import { type ConfigObject } from '../../../config-schema';
|
|
54
|
+
import { PatientTypes } from '../../../shared/constants/patient-type';
|
|
23
55
|
|
|
24
56
|
interface SendToTriageModalProps {
|
|
25
57
|
patients: Patient[];
|
|
@@ -42,51 +74,243 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
42
74
|
}) => {
|
|
43
75
|
const [selectedPatient, setSelectedPatient] = useState<Patient>();
|
|
44
76
|
const [selectedVisitType, setSelectedVisitType] = useState<string>();
|
|
77
|
+
const [selectedPatientType, setSelectedPatientType] = useState<string>();
|
|
45
78
|
const [serviceQueues, setServiceQueues] = useState<ServiceQueue[]>();
|
|
46
79
|
const [selectedServiceQueue, setSelectedServiceQueue] = useState<string>();
|
|
80
|
+
const [paymentModes, setPaymentModes] = useState<PaymentMode[]>([]);
|
|
81
|
+
const [cashPoints, setCashPoints] = useState<CashPoint[]>([]);
|
|
82
|
+
const [selectedCashPoint, setSelectedCashPoint] = useState<CashPoint>(null);
|
|
83
|
+
const [selectedPaymentMode, setSelectedPaymentMode] = useState<PaymentMode>(null);
|
|
47
84
|
const [selectedPriority, setSelectedPriority] = useState<string>('');
|
|
85
|
+
const [selectedPaymentDetail, setSelectedPaymentDetail] = useState<string>();
|
|
86
|
+
const [billableServices, setBillableServices] = useState<BillableService[]>([]);
|
|
87
|
+
const [servicePrices, setServicePrices] = useState<ServicePrice[]>([]);
|
|
88
|
+
const [filteredBillableServices, setFilteredBillableServices] = useState<ServicePrice[]>(null);
|
|
89
|
+
const [selectedBillableService, setSelectedBillableService] = useState<ServicePrice | null>(null);
|
|
90
|
+
const [selectedInsuranceScheme, setSelectedInsuranceScheme] = useState<string>('');
|
|
91
|
+
const [selectedInsurancePolicy, setSelectedInsurancePolicy] = useState<string>('');
|
|
92
|
+
const [selectedPatientCategory, setSelectedPatientCategory] = useState<string>('');
|
|
93
|
+
const [currentQueueEntry, setCurrentQueueEntry] = useState<QueueEntry>();
|
|
94
|
+
const [patientBills, setPatientBills] = useState<Bill[]>([]);
|
|
95
|
+
const [billCreated, setBillCreated] = useState<boolean>(false);
|
|
96
|
+
const [disableSubmission, setDisableSubmission] = useState<boolean>(false);
|
|
48
97
|
const [loading, setLoading] = useState<boolean>(false);
|
|
49
|
-
const visitTypes = useVisitTypes();
|
|
50
98
|
const session = useSession();
|
|
51
99
|
const locationUuid = session.sessionLocation.uuid;
|
|
100
|
+
const {
|
|
101
|
+
registrationBillableServices,
|
|
102
|
+
cashConsulationConceptUuid,
|
|
103
|
+
shaConsulationConceptUuid,
|
|
104
|
+
outPatientCareSettingUuid,
|
|
105
|
+
orderEncounterTypeUuid,
|
|
106
|
+
registrationServicequeues
|
|
107
|
+
} = useConfig<ConfigObject>();
|
|
108
|
+
|
|
109
|
+
const facilityCashPoints = useMemo(() => getfacilityCashpoints(), [cashPoints, locationUuid]);
|
|
110
|
+
|
|
111
|
+
const visitTypeOptions = useMemo(
|
|
112
|
+
() => [
|
|
113
|
+
{
|
|
114
|
+
text: 'OPD',
|
|
115
|
+
id: VisitTypeUuids.OPD_VISIT_TYPE_UUID,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
text: 'Inpatient',
|
|
119
|
+
id: VisitTypeUuids.INPATIENT_VISIT_TYPE_UUID,
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
[client],
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const patientTypeOptions = useMemo(
|
|
126
|
+
() => [
|
|
127
|
+
{
|
|
128
|
+
text: 'Walk-In',
|
|
129
|
+
id: PatientTypes.WALK_IN_UUID,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
text: 'Self-Referral',
|
|
133
|
+
id: PatientTypes.SELF_RERERRAL_UUID,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
text: 'Referral from another Facility',
|
|
137
|
+
id: PatientTypes.REFERRAL_FROM_ANOTHER_FACILITY_UUID,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
text: 'Referral from Community',
|
|
141
|
+
id: PatientTypes.REFERRED_BY_COMMUNITY_HEALTH_WORKER_UUID,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
[client],
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const paymentDetails = Object.values(PaymentDetail).map((value) => {
|
|
148
|
+
return {
|
|
149
|
+
id: value,
|
|
150
|
+
label: value,
|
|
151
|
+
};
|
|
152
|
+
});
|
|
52
153
|
useEffect(() => {
|
|
53
154
|
getServiceQueues();
|
|
155
|
+
getPaymentMethods();
|
|
156
|
+
getBillableServices();
|
|
157
|
+
getCashPoints();
|
|
158
|
+
getPatientBills();
|
|
159
|
+
getPatientActiveQueue();
|
|
54
160
|
}, [patients]);
|
|
55
161
|
if (!patients) {
|
|
56
162
|
return <>No Client data</>;
|
|
57
163
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
164
|
+
|
|
165
|
+
async function getPatientActiveQueue() {
|
|
166
|
+
if (patients && patients.length > 0) {
|
|
167
|
+
const activePatient = patients[0];
|
|
168
|
+
try {
|
|
169
|
+
const resp = await getActiveQueueEntryByPatientUuid(activePatient.uuid);
|
|
170
|
+
setCurrentQueueEntry(resp.length > 0 ? resp[0] : null);
|
|
171
|
+
} catch (error) {
|
|
172
|
+
showAlert('error', 'Error getting patient active queue', '');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async function getPatientBills() {
|
|
178
|
+
if (patients) {
|
|
179
|
+
let bills: Bill[] = [];
|
|
180
|
+
setPatientBills([]);
|
|
181
|
+
for (let i = 0; i < patients.length; i++) {
|
|
182
|
+
const resp = await fetchPatientBills(patients[i].uuid);
|
|
183
|
+
const todaysBills = getTodaysBills(resp);
|
|
184
|
+
setPatientBills(todaysBills);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function getTodaysBills(bills: Bill[]) {
|
|
189
|
+
const today = new Date();
|
|
190
|
+
return bills.filter((b) => {
|
|
191
|
+
const billDate = new Date(b.dateCreated);
|
|
192
|
+
return (
|
|
193
|
+
billDate.getFullYear() === today.getFullYear() &&
|
|
194
|
+
billDate.getMonth() === today.getMonth() &&
|
|
195
|
+
billDate.getDate() === today.getDate()
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
61
199
|
const sendToTriage = async () => {
|
|
200
|
+
if (disableSubmission) {
|
|
201
|
+
showAlert(
|
|
202
|
+
'error',
|
|
203
|
+
'Form already Submitted',
|
|
204
|
+
'Form has already been submitted, please wait for the visit,queue and bill to be created',
|
|
205
|
+
);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
setDisableSubmission(true);
|
|
209
|
+
if (!validateVisitQueueBill()) {
|
|
210
|
+
setDisableSubmission(false);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
62
213
|
setLoading(true);
|
|
63
214
|
try {
|
|
64
|
-
const newVisit = await createPatientVisit();
|
|
215
|
+
const newVisit: Visit = await createPatientVisit();
|
|
65
216
|
if (newVisit) {
|
|
66
|
-
const addToTriageQueueDto: QueueEntryDto = generateAddToTriageDto(newVisit
|
|
217
|
+
const addToTriageQueueDto: QueueEntryDto = generateAddToTriageDto(newVisit);
|
|
67
218
|
const queueEntryResp = await createQueueEntry(addToTriageQueueDto);
|
|
219
|
+
|
|
68
220
|
if (queueEntryResp) {
|
|
69
221
|
showAlert('success', 'Patient has succesfully been moved to the Triage queue', '');
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// add bill if it was a paying client
|
|
225
|
+
let createBillResp = null;
|
|
226
|
+
if (selectedPaymentDetail === PaymentDetail.Paying) {
|
|
227
|
+
const createBillDto = generateCreateBillDto();
|
|
228
|
+
if (isValidCreateBillDto(createBillDto) && !billCreated) {
|
|
229
|
+
createBillResp = await createBill(createBillDto);
|
|
230
|
+
if (createBillResp) {
|
|
231
|
+
setBillCreated(true);
|
|
232
|
+
showAlert('success', 'Bill succesfully created', '');
|
|
233
|
+
}
|
|
234
|
+
// create consulation order
|
|
235
|
+
await createOrder(selectedPatient.uuid, newVisit.uuid);
|
|
236
|
+
} else {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (
|
|
242
|
+
(queueEntryResp && PaymentDetail.Paying && (createBillResp || billCreated)) ||
|
|
243
|
+
(queueEntryResp && PaymentDetail.NonPaying)
|
|
244
|
+
) {
|
|
70
245
|
onModalClose({ success: true });
|
|
71
246
|
}
|
|
72
247
|
}
|
|
73
248
|
} catch (error) {
|
|
74
|
-
|
|
249
|
+
setDisableSubmission(false);
|
|
250
|
+
showAlert('error', error.message ?? 'Error creating visit', '');
|
|
75
251
|
} finally {
|
|
76
252
|
setLoading(false);
|
|
77
253
|
}
|
|
78
254
|
};
|
|
79
|
-
|
|
255
|
+
function validateVisitQueueBill(): boolean {
|
|
256
|
+
if (!selectedPatient) {
|
|
257
|
+
showAlert('error', 'Please select a patient', '');
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
if (!selectedPaymentDetail) {
|
|
261
|
+
showAlert('error', 'Please select a paying or non paying option', '');
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (!isValidServiceQueueSelected()) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (selectedPaymentDetail === PaymentDetail.Paying) {
|
|
270
|
+
if (!selectedPaymentMode) {
|
|
271
|
+
showAlert('error', 'Please select a payment method', '');
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
if (!selectedBillableService) {
|
|
275
|
+
showAlert('error', 'Please select a billable service', '');
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
if (!selectedCashPoint) {
|
|
279
|
+
showAlert('error', 'Please select a cashpoint', '');
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (selectedPaymentDetail === PaymentDetail.NonPaying) {
|
|
284
|
+
if (!selectedPatientCategory) {
|
|
285
|
+
showAlert('error', 'Please select a patient category', '');
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (!selectedVisitType) {
|
|
290
|
+
showAlert('error', 'Please select a visit type', '');
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
if (!selectedServiceQueue) {
|
|
294
|
+
showAlert('error', 'Please select a service queue', '');
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
if (!selectedPriority) {
|
|
298
|
+
showAlert('error', 'Please select a service queue priority', '');
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
const generateAddToTriageDto = (newVisit: Visit): QueueEntryDto => {
|
|
80
304
|
const payload: QueueEntryDto = {
|
|
81
305
|
visit: {
|
|
82
|
-
uuid:
|
|
306
|
+
uuid: newVisit.uuid,
|
|
83
307
|
},
|
|
84
308
|
queueEntry: {
|
|
85
309
|
status: {
|
|
86
310
|
uuid: QUEUE_STATUS_UUIDS.WAITING_UUID,
|
|
87
311
|
},
|
|
88
312
|
priority: {
|
|
89
|
-
uuid: selectedPriority,
|
|
313
|
+
uuid: selectedPriority ?? QUEUE_PRIORITIES_UUIDS.NORMAL_PRIORITY_UUID,
|
|
90
314
|
},
|
|
91
315
|
queue: {
|
|
92
316
|
uuid: selectedServiceQueue,
|
|
@@ -94,7 +318,7 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
94
318
|
patient: {
|
|
95
319
|
uuid: selectedPatient.uuid,
|
|
96
320
|
},
|
|
97
|
-
startedAt:
|
|
321
|
+
startedAt: newVisit.startDatetime,
|
|
98
322
|
sortWeight: 0,
|
|
99
323
|
},
|
|
100
324
|
};
|
|
@@ -103,23 +327,104 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
103
327
|
const onPatientSelect = (patient: Patient) => {
|
|
104
328
|
setSelectedPatient(patient);
|
|
105
329
|
};
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
if (resp && resp.results) {
|
|
109
|
-
setServiceQueues(resp.results);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
const visitTypeChangeHandler = ($event: any) => {
|
|
113
|
-
const vt = $event.target.value as unknown as string;
|
|
330
|
+
const visitTypeChangeHandler = (selectedVisitType: { selectedItem: { id: string; text: string } }) => {
|
|
331
|
+
const vt = selectedVisitType.selectedItem.id;
|
|
114
332
|
setSelectedVisitType(vt);
|
|
115
333
|
};
|
|
334
|
+
const isValidServiceQueueSelected = () => {
|
|
335
|
+
if (!currentQueueEntry) {
|
|
336
|
+
return true;
|
|
337
|
+
}
|
|
338
|
+
if (currentQueueEntry.queue.uuid) {
|
|
339
|
+
showAlert(
|
|
340
|
+
'error',
|
|
341
|
+
'Patient already in queue',
|
|
342
|
+
`Patient is already in the ${currentQueueEntry.queue.display} queue, remove them first or contact support`,
|
|
343
|
+
);
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
return true;
|
|
347
|
+
};
|
|
116
348
|
const serviceChangeHandler = ($event: any) => {
|
|
117
|
-
|
|
118
|
-
|
|
349
|
+
if (isValidServiceQueueSelected()) {
|
|
350
|
+
const sq = $event.target.value as unknown as string;
|
|
351
|
+
setSelectedServiceQueue(sq);
|
|
352
|
+
}
|
|
119
353
|
};
|
|
120
354
|
const priorityChangeHandler = (priorityUuid: string) => {
|
|
121
355
|
setSelectedPriority(priorityUuid);
|
|
122
356
|
};
|
|
357
|
+
const paymentDetailsHandler = (paymentDetailSelected: string) => {
|
|
358
|
+
setSelectedPaymentDetail(paymentDetailSelected);
|
|
359
|
+
};
|
|
360
|
+
const paymentMethodHandler = (selectedPaymentModeUuid: string) => {
|
|
361
|
+
const selectedPaymentMode = paymentModes.find((pm) => {
|
|
362
|
+
return pm.uuid === selectedPaymentModeUuid;
|
|
363
|
+
});
|
|
364
|
+
setSelectedPaymentMode(selectedPaymentMode);
|
|
365
|
+
const paymentModeBillableServices = getBillableServiceByPaymentMode(selectedPaymentMode);
|
|
366
|
+
setFilteredBillableServices(paymentModeBillableServices);
|
|
367
|
+
setSelectedInsuranceScheme('');
|
|
368
|
+
setSelectedInsurancePolicy('');
|
|
369
|
+
setSelectedPriority('');
|
|
370
|
+
};
|
|
371
|
+
const getBillableServiceByPaymentMode = (paymentMode: PaymentMode): PayableBillableService[] => {
|
|
372
|
+
const paymentBillableServices: ServicePrice[] = [];
|
|
373
|
+
servicePrices.forEach((sp) => {
|
|
374
|
+
if (sp.paymentMode) {
|
|
375
|
+
if (
|
|
376
|
+
sp.paymentMode.uuid === paymentMode.uuid &&
|
|
377
|
+
registrationBillableServices.includes(sp.billableService.uuid)
|
|
378
|
+
) {
|
|
379
|
+
paymentBillableServices.push(sp);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
return paymentBillableServices;
|
|
384
|
+
};
|
|
385
|
+
const billableServicesHandler = (selectedBillableServiceUuid: string) => {
|
|
386
|
+
const selectedBillableService = servicePrices.find((sp) => {
|
|
387
|
+
return sp.uuid === selectedBillableServiceUuid;
|
|
388
|
+
});
|
|
389
|
+
if (isValidBillableService(selectedBillableService)) {
|
|
390
|
+
setSelectedBillableService(selectedBillableService);
|
|
391
|
+
} else {
|
|
392
|
+
setSelectedBillableService(null);
|
|
393
|
+
showAlert('error', 'Existing bill', 'Patient has a similar bill');
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
const isValidBillableService = (selectedService: ServicePrice) => {
|
|
397
|
+
// check if patient has been billed for similar service
|
|
398
|
+
let isValid = true;
|
|
399
|
+
patientBills.forEach((b) => {
|
|
400
|
+
const lineItems = b.lineItems;
|
|
401
|
+
lineItems.forEach((l) => {
|
|
402
|
+
if (l.billableService === selectedService.billableService.display) {
|
|
403
|
+
isValid = false;
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
return isValid;
|
|
408
|
+
};
|
|
409
|
+
const cashPointsHandler = (selectedCashPointUuid: string) => {
|
|
410
|
+
const selectedCashPoint = cashPoints.find((cp) => {
|
|
411
|
+
return cp.uuid === selectedCashPointUuid;
|
|
412
|
+
});
|
|
413
|
+
setSelectedCashPoint(selectedCashPoint);
|
|
414
|
+
};
|
|
415
|
+
const patientTypeHandler = (selectedPatientType: { selectedItem: { id: string; text: string } }) => {
|
|
416
|
+
const pt = selectedPatientType.selectedItem.id;
|
|
417
|
+
setSelectedPatientType(pt);
|
|
418
|
+
};
|
|
419
|
+
const insuranceSchemeHandler = (selectedInsuranceScheme: string) => {
|
|
420
|
+
setSelectedInsuranceScheme(selectedInsuranceScheme);
|
|
421
|
+
};
|
|
422
|
+
const insurancePolicyHandler = (selectedInsurancePolicy: string) => {
|
|
423
|
+
setSelectedInsurancePolicy(selectedInsurancePolicy);
|
|
424
|
+
};
|
|
425
|
+
const patientCategoryHandler = (categoryUuid: string) => {
|
|
426
|
+
setSelectedPatientCategory(categoryUuid);
|
|
427
|
+
};
|
|
123
428
|
const createPatientVisit = async () => {
|
|
124
429
|
const visitDto = getCreateVisitDto();
|
|
125
430
|
if (!isValidCreateVisitDto(visitDto)) {
|
|
@@ -149,16 +454,25 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
149
454
|
showAlert('error', 'Please select a visit', '');
|
|
150
455
|
return false;
|
|
151
456
|
}
|
|
457
|
+
if(!selectedPatientType){
|
|
458
|
+
showAlert('error', 'Please select a patient type', '');
|
|
459
|
+
return false;
|
|
460
|
+
}
|
|
152
461
|
return true;
|
|
153
462
|
};
|
|
154
463
|
const getCreateVisitDto = (): CreateVisitDto => {
|
|
155
|
-
|
|
464
|
+
const visitAttributes = getVisitAttributes();
|
|
465
|
+
const visitDto: CreateVisitDto = {
|
|
156
466
|
visitType: selectedVisitType,
|
|
157
467
|
location: locationUuid,
|
|
158
468
|
startDatetime: null,
|
|
159
469
|
stopDatetime: null,
|
|
160
|
-
patient: selectedPatient?.uuid
|
|
470
|
+
patient: selectedPatient?.uuid,
|
|
161
471
|
};
|
|
472
|
+
if (visitAttributes.length > 0) {
|
|
473
|
+
visitDto['attributes'] = visitAttributes;
|
|
474
|
+
}
|
|
475
|
+
return visitDto;
|
|
162
476
|
};
|
|
163
477
|
const showAlert = (alertType: 'error' | 'success', title: string, subtitle: string) => {
|
|
164
478
|
showSnackbar({
|
|
@@ -168,6 +482,192 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
168
482
|
});
|
|
169
483
|
};
|
|
170
484
|
|
|
485
|
+
function getVisitAttributes(): VisitAttribute[] {
|
|
486
|
+
const attributes: VisitAttribute[] = [];
|
|
487
|
+
if (selectedInsuranceScheme) {
|
|
488
|
+
attributes.push({
|
|
489
|
+
attributeType: '3a988e33-a6c0-4b76-b924-01abb998944b',
|
|
490
|
+
value: selectedInsuranceScheme,
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
if (selectedInsurancePolicy) {
|
|
494
|
+
attributes.push({
|
|
495
|
+
attributeType: 'aac48226-d143-4274-80e0-264db4e368ee',
|
|
496
|
+
value: selectedInsurancePolicy,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
if (selectedPaymentMode) {
|
|
500
|
+
attributes.push({
|
|
501
|
+
attributeType: '8553afa0-bdb9-4d3c-8a98-05fa9350aa85',
|
|
502
|
+
value: selectedPaymentMode.uuid,
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
if(selectedPatientType) {
|
|
506
|
+
attributes.push({
|
|
507
|
+
attributeType: 'fbc0702d-b4c9-4968-be63-af8ad3ad6239',
|
|
508
|
+
value: selectedPatientType,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
if(selectedPaymentDetail === PaymentDetail.NonPaying){
|
|
512
|
+
attributes.push({
|
|
513
|
+
attributeType: 'df0362f9-782e-4d92-8bb2-3112e9e9eb3c',
|
|
514
|
+
value: 'true',
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
return attributes;
|
|
518
|
+
}
|
|
519
|
+
async function getServiceQueues() {
|
|
520
|
+
try {
|
|
521
|
+
const sqs = await getFacilityServiceQueues(locationUuid);
|
|
522
|
+
if (sqs && sqs.length > 0) {
|
|
523
|
+
const triageServiceQueues = getTriageServiceQueues(sqs);
|
|
524
|
+
setServiceQueues(triageServiceQueues);
|
|
525
|
+
}
|
|
526
|
+
} catch (e) {
|
|
527
|
+
showSnackbar({
|
|
528
|
+
kind: 'error',
|
|
529
|
+
title: 'An error occurred while fetching service queues',
|
|
530
|
+
subtitle: e.message ?? 'An error occurred while fetching service queues, please try agin',
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function getTriageServiceQueues(serviceQueues: ServiceQueue[]){
|
|
535
|
+
return serviceQueues.filter((sq)=>{
|
|
536
|
+
return registrationServicequeues.includes(sq.uuid ?? '')
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
async function getPaymentMethods() {
|
|
541
|
+
const methods = await fetchPaymentModes();
|
|
542
|
+
setPaymentModes(methods);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
async function getBillableServices() {
|
|
546
|
+
const billableServices = await fetchBillableServices();
|
|
547
|
+
setBillableServices(billableServices);
|
|
548
|
+
generateServiceTypesList(billableServices);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
async function getCashPoints() {
|
|
552
|
+
const cp = await fetchCashPoints();
|
|
553
|
+
setCashPoints(cp);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function getfacilityCashpoints() {
|
|
557
|
+
return cashPoints.filter((cp) => {
|
|
558
|
+
return cp && cp.location?.uuid === locationUuid;
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function generateServiceTypesList(billableServices: BillableService[]) {
|
|
563
|
+
const sp: ServicePrice[] = [];
|
|
564
|
+
for (let bs of billableServices) {
|
|
565
|
+
if (bs.servicePrices) {
|
|
566
|
+
const servicePrices = bs.servicePrices;
|
|
567
|
+
for (let servicePrice of servicePrices) {
|
|
568
|
+
sp.push(servicePrice);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
setServicePrices(sp);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function generateCreateBillDto(): CreateBillDto {
|
|
576
|
+
const payload: CreateBillDto = {
|
|
577
|
+
lineItems: [
|
|
578
|
+
{
|
|
579
|
+
billableService: selectedBillableService.billableService.uuid,
|
|
580
|
+
quantity: 1,
|
|
581
|
+
price: selectedBillableService.price,
|
|
582
|
+
priceName: selectedBillableService.name,
|
|
583
|
+
priceUuid: selectedBillableService.uuid,
|
|
584
|
+
lineItemOrder: 0,
|
|
585
|
+
paymentStatus: 'PENDING',
|
|
586
|
+
},
|
|
587
|
+
],
|
|
588
|
+
cashPoint: selectedCashPoint.uuid,
|
|
589
|
+
patient: selectedPatient.uuid,
|
|
590
|
+
status: 'PENDING',
|
|
591
|
+
payments: [],
|
|
592
|
+
};
|
|
593
|
+
return payload;
|
|
594
|
+
}
|
|
595
|
+
function isValidCreateBillDto(createBillDto: CreateBillDto): boolean {
|
|
596
|
+
if (!createBillDto.patient) {
|
|
597
|
+
showAlert('error', 'Please select a patient', '');
|
|
598
|
+
return false;
|
|
599
|
+
}
|
|
600
|
+
if (!createBillDto.status) {
|
|
601
|
+
showAlert('error', 'Bill does not have a status', '');
|
|
602
|
+
return false;
|
|
603
|
+
}
|
|
604
|
+
if (!createBillDto.cashPoint) {
|
|
605
|
+
showAlert('error', 'Please select a valid cashpoint', '');
|
|
606
|
+
return false;
|
|
607
|
+
}
|
|
608
|
+
if (!createBillDto.lineItems || createBillDto.lineItems.length === 0) {
|
|
609
|
+
showAlert('error', 'Please select a valid billable service', '');
|
|
610
|
+
return false;
|
|
611
|
+
}
|
|
612
|
+
return true;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
function hasSelectedPaymentMode(paymentMode: string): boolean {
|
|
616
|
+
if (!selectedPaymentMode) {
|
|
617
|
+
return false;
|
|
618
|
+
}
|
|
619
|
+
return selectedPaymentMode.name.trim().toLowerCase().includes(paymentMode.trim().toLowerCase());
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
function generateOrderEncounterPayload(patientUuid: string, visitUuid: string): CreateOrderEncounterDto {
|
|
623
|
+
return {
|
|
624
|
+
patient: patientUuid,
|
|
625
|
+
location: locationUuid,
|
|
626
|
+
encounterType: orderEncounterTypeUuid,
|
|
627
|
+
visit: visitUuid,
|
|
628
|
+
obs: [],
|
|
629
|
+
orders: [
|
|
630
|
+
{
|
|
631
|
+
action: 'NEW',
|
|
632
|
+
type: 'order',
|
|
633
|
+
patient: patientUuid,
|
|
634
|
+
careSetting: outPatientCareSettingUuid,
|
|
635
|
+
orderer: session.currentProvider.uuid ?? 'pd25871c-1359-11df-a1f1-0026b9348838',
|
|
636
|
+
encounter: null,
|
|
637
|
+
concept: getOrderConcept(selectedPaymentMode),
|
|
638
|
+
accessionNumber: null,
|
|
639
|
+
urgency: 'ROUTINE',
|
|
640
|
+
scheduledDate: null,
|
|
641
|
+
},
|
|
642
|
+
],
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
function getOrderConcept(paymentMode: PaymentMode) {
|
|
646
|
+
const paymentModeName = paymentMode.name.toLowerCase().trim();
|
|
647
|
+
if (paymentModeName.includes('cash')) {
|
|
648
|
+
return cashConsulationConceptUuid;
|
|
649
|
+
} else if (paymentModeName.includes('sha')) {
|
|
650
|
+
return shaConsulationConceptUuid;
|
|
651
|
+
} else {
|
|
652
|
+
return '';
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
async function createOrder(patientUuid: string, visitUuid: string) {
|
|
656
|
+
const createOrderPayload = generateOrderEncounterPayload(patientUuid, visitUuid);
|
|
657
|
+
try {
|
|
658
|
+
const resp = await createOrderEncounter(createOrderPayload);
|
|
659
|
+
if (resp) {
|
|
660
|
+
showAlert('success', 'Consultation order created', 'Consultation order has been succesfully created');
|
|
661
|
+
}
|
|
662
|
+
} catch (error) {
|
|
663
|
+
showAlert(
|
|
664
|
+
'error',
|
|
665
|
+
'Error creating consulation order',
|
|
666
|
+
'An error occurred while generating the consultation order. Please contact support',
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
171
671
|
return (
|
|
172
672
|
<>
|
|
173
673
|
<Modal
|
|
@@ -175,8 +675,8 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
175
675
|
size="md"
|
|
176
676
|
onSecondarySubmit={() => onModalClose({ success: false })}
|
|
177
677
|
onRequestClose={() => onModalClose({ success: false })}
|
|
178
|
-
onRequestSubmit={
|
|
179
|
-
primaryButtonText=
|
|
678
|
+
onRequestSubmit={sendToTriage}
|
|
679
|
+
primaryButtonText={loading ? 'Sending...please wait' : 'Send to Triage'}
|
|
180
680
|
secondaryButtonText="Cancel"
|
|
181
681
|
>
|
|
182
682
|
<ModalBody>
|
|
@@ -212,21 +712,144 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
212
712
|
</div>
|
|
213
713
|
<div className={styles.formSection}>
|
|
214
714
|
<div className={styles.formRow}>
|
|
715
|
+
<div className={styles.formControl}>
|
|
716
|
+
<ComboBox
|
|
717
|
+
onChange={patientTypeHandler}
|
|
718
|
+
id="patient-type-combobox"
|
|
719
|
+
items={patientTypeOptions}
|
|
720
|
+
itemToString={(item) => (item ? item.text : '')}
|
|
721
|
+
titleText="Patient Type"
|
|
722
|
+
/>
|
|
723
|
+
</div>
|
|
215
724
|
<div className={styles.formControl}>
|
|
216
|
-
<Select
|
|
725
|
+
<Select
|
|
726
|
+
id="payment-details"
|
|
727
|
+
labelText="Payment Details"
|
|
728
|
+
onChange={($event) => paymentDetailsHandler($event.target.value)}
|
|
729
|
+
>
|
|
217
730
|
<SelectItem value="" text="Select" />;
|
|
218
|
-
{
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
})}
|
|
731
|
+
{paymentDetails.map((pd) => {
|
|
732
|
+
return <SelectItem value={pd.id} text={pd.label} />;
|
|
733
|
+
})}
|
|
222
734
|
</Select>
|
|
223
735
|
</div>
|
|
736
|
+
</div>
|
|
737
|
+
</div>
|
|
738
|
+
<div className={styles.formSection}>
|
|
739
|
+
{selectedPaymentDetail === PaymentDetail.Paying ? (
|
|
740
|
+
<>
|
|
741
|
+
<div className={styles.formRow}>
|
|
742
|
+
<div className={styles.formControl}>
|
|
743
|
+
<Select
|
|
744
|
+
id="payment-method"
|
|
745
|
+
labelText="Payment Method"
|
|
746
|
+
onChange={($event) => paymentMethodHandler($event.target.value)}
|
|
747
|
+
>
|
|
748
|
+
<SelectItem value="" text="Select" />;
|
|
749
|
+
{paymentModes &&
|
|
750
|
+
paymentModes.map((pm) => {
|
|
751
|
+
return <SelectItem value={pm.uuid} text={pm.name} />;
|
|
752
|
+
})}
|
|
753
|
+
</Select>
|
|
754
|
+
</div>
|
|
755
|
+
<div className={styles.formControl}>
|
|
756
|
+
<Select
|
|
757
|
+
id="billable-service"
|
|
758
|
+
labelText="Billable Services"
|
|
759
|
+
onChange={($event) => billableServicesHandler($event.target.value)}
|
|
760
|
+
>
|
|
761
|
+
<SelectItem value="" text="Select" />;
|
|
762
|
+
{filteredBillableServices &&
|
|
763
|
+
filteredBillableServices.map((sp) => {
|
|
764
|
+
return (
|
|
765
|
+
<SelectItem
|
|
766
|
+
value={sp.uuid}
|
|
767
|
+
text={`${sp.billableService.display}(${sp.name}:${sp.price})`}
|
|
768
|
+
/>
|
|
769
|
+
);
|
|
770
|
+
})}
|
|
771
|
+
</Select>
|
|
772
|
+
</div>
|
|
773
|
+
</div>
|
|
774
|
+
{hasSelectedPaymentMode('insurance') ? (
|
|
775
|
+
<>
|
|
776
|
+
<div className={styles.formRow}>
|
|
777
|
+
<div className={styles.formControl}>
|
|
778
|
+
<TextInput
|
|
779
|
+
id="insurance-scheme"
|
|
780
|
+
labelText="Insurance scheme"
|
|
781
|
+
onChange={(e) => insuranceSchemeHandler(e.target.value)}
|
|
782
|
+
/>
|
|
783
|
+
</div>
|
|
784
|
+
<div className={styles.formControl}>
|
|
785
|
+
<TextInput
|
|
786
|
+
id="policy-number"
|
|
787
|
+
labelText="Policy number"
|
|
788
|
+
onChange={(e) => insurancePolicyHandler(e.target.value)}
|
|
789
|
+
/>
|
|
790
|
+
</div>
|
|
791
|
+
</div>
|
|
792
|
+
</>
|
|
793
|
+
) : (
|
|
794
|
+
<></>
|
|
795
|
+
)}
|
|
796
|
+
<div className={styles.formRow}>
|
|
797
|
+
<div className={styles.formControl}>
|
|
798
|
+
<Select
|
|
799
|
+
id="cash-point"
|
|
800
|
+
labelText="Cash Point"
|
|
801
|
+
onChange={($event) => cashPointsHandler($event.target.value)}
|
|
802
|
+
>
|
|
803
|
+
<SelectItem value="" text="Select" />;
|
|
804
|
+
{facilityCashPoints &&
|
|
805
|
+
facilityCashPoints.map((cp) => {
|
|
806
|
+
return <SelectItem value={cp.uuid} text={cp.name} />;
|
|
807
|
+
})}
|
|
808
|
+
</Select>
|
|
809
|
+
</div>
|
|
810
|
+
</div>
|
|
811
|
+
</>
|
|
812
|
+
) : (
|
|
813
|
+
<></>
|
|
814
|
+
)}
|
|
815
|
+
|
|
816
|
+
{selectedPaymentDetail === PaymentDetail.NonPaying ? (
|
|
817
|
+
<>
|
|
818
|
+
<div className={styles.formRow}>
|
|
819
|
+
<div className={styles.formControl}>
|
|
820
|
+
<Select
|
|
821
|
+
id="patient-category"
|
|
822
|
+
labelText="Patient Category"
|
|
823
|
+
onChange={($event) => patientCategoryHandler($event.target.value)}
|
|
824
|
+
>
|
|
825
|
+
<SelectItem value="" text="Select" />;
|
|
826
|
+
<SelectItem value={PatientCategories.CCC_PATIENT_UUID} text="CCC" />;
|
|
827
|
+
<SelectItem value={PatientCategories.MCH_PATIENT_UUID} text="MCH" />;
|
|
828
|
+
</Select>
|
|
829
|
+
</div>
|
|
830
|
+
</div>
|
|
831
|
+
</>
|
|
832
|
+
) : (
|
|
833
|
+
<></>
|
|
834
|
+
)}
|
|
835
|
+
</div>
|
|
836
|
+
<div className={styles.formSection}>
|
|
837
|
+
<div className={styles.formRow}>
|
|
838
|
+
<div className={styles.formControl}>
|
|
839
|
+
<ComboBox
|
|
840
|
+
onChange={visitTypeChangeHandler}
|
|
841
|
+
id="visit-type-combobox"
|
|
842
|
+
items={visitTypeOptions}
|
|
843
|
+
itemToString={(item) => (item ? item.text : '')}
|
|
844
|
+
titleText="Visit Type"
|
|
845
|
+
/>
|
|
846
|
+
</div>
|
|
224
847
|
<div className={styles.formControl}>
|
|
225
|
-
<Select id="service" labelText="Select a Service" onChange={serviceChangeHandler}>
|
|
848
|
+
<Select id="service" labelText="Select a Queue Service" onChange={serviceChangeHandler}>
|
|
226
849
|
<SelectItem value="" text="Select" />;
|
|
227
850
|
{serviceQueues &&
|
|
228
851
|
serviceQueues.map((sq) => {
|
|
229
|
-
return <SelectItem value={sq.uuid} text={sq.display} />;
|
|
852
|
+
return <SelectItem value={sq.uuid} text={`${sq.display}`} />;
|
|
230
853
|
})}
|
|
231
854
|
</Select>
|
|
232
855
|
</div>
|
|
@@ -239,7 +862,8 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
239
862
|
onChange={($event) => priorityChangeHandler($event.target.value)}
|
|
240
863
|
>
|
|
241
864
|
<SelectItem value="" text="Select" />;
|
|
242
|
-
<SelectItem value={QUEUE_PRIORITIES_UUIDS.NORMAL_PRIORITY_UUID} text="
|
|
865
|
+
<SelectItem value={QUEUE_PRIORITIES_UUIDS.NORMAL_PRIORITY_UUID} text="PRIORITY" />;
|
|
866
|
+
<SelectItem value={QUEUE_PRIORITIES_UUIDS.NOT_URGENT_PRIORITY_UUID} text="NON URGENT" />;
|
|
243
867
|
<SelectItem value={QUEUE_PRIORITIES_UUIDS.EMERGENCY_PRIORITY_UUID} text="EMERGENCY" />;
|
|
244
868
|
</Select>
|
|
245
869
|
</div>
|
|
@@ -250,13 +874,7 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
250
874
|
<></>
|
|
251
875
|
)}
|
|
252
876
|
<div className={styles.actionSection}>
|
|
253
|
-
{patients.length
|
|
254
|
-
<div className={styles.btnContainer}>
|
|
255
|
-
<Button kind="primary" onClick={sendToTriage}>
|
|
256
|
-
{loading ? <InlineLoading description="Sending To Triage..." /> : 'Send To Triage'}
|
|
257
|
-
</Button>
|
|
258
|
-
</div>
|
|
259
|
-
) : (
|
|
877
|
+
{patients.length === 0 ? (
|
|
260
878
|
<>
|
|
261
879
|
<div className={styles.patientAction}>
|
|
262
880
|
<div className={styles.btnContainer}>
|
|
@@ -271,6 +889,8 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
271
889
|
</div>
|
|
272
890
|
</div>
|
|
273
891
|
</>
|
|
892
|
+
) : (
|
|
893
|
+
<></>
|
|
274
894
|
)}
|
|
275
895
|
</div>
|
|
276
896
|
</div>
|