@ampath/esm-dha-workflow-app 4.0.0-next.13 → 4.0.0-next.131
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/{198.js.LICENSE.txt → 1558.js.LICENSE.txt} +0 -10
- 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.LICENSE.txt +9 -0
- package/dist/2177.js.map +1 -0
- package/dist/2364.js +2 -0
- package/dist/{200.js.LICENSE.txt → 2364.js.LICENSE.txt} +15 -0
- package/dist/2364.js.map +1 -0
- package/dist/2566.js +1 -0
- package/dist/2566.js.map +1 -0
- package/dist/2801.js +1 -0
- package/dist/2801.js.map +1 -0
- package/dist/2975.js +1 -0
- package/dist/2975.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/3485.js +1 -0
- package/dist/3485.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/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/693.js +1 -0
- 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/8339.js +1 -0
- package/dist/8339.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 -0
- package/dist/esm-dha-workflow-app.js.buildmanifest.json +1546 -0
- package/dist/esm-dha-workflow-app.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +11 -4
- 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 +95 -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 +409 -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 +1371 -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 +85 -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 +330 -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 +186 -32
- package/src/createDashboardLink.tsx +9 -0
- package/src/dashboard/charts/chart.component.scss +13 -0
- package/src/dashboard/charts/chart.component.tsx +54 -0
- package/src/dashboard/dashboard.component.scss +7 -0
- package/src/dashboard/dashboard.component.tsx +51 -0
- package/src/dashboard/overview/overview.component.scss +147 -0
- package/src/dashboard/overview/overview.component.tsx +115 -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/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 +165 -0
- package/src/index.ts +113 -1
- package/src/laboratory/laboratory.component.tsx +13 -0
- package/src/left-panel/left-panel.component.tsx +0 -2
- package/src/mch/mch-queues.component.scss +7 -0
- package/src/mch/mch-queues.component.tsx +32 -0
- package/src/mch/queues/consultation/mch-consultation.tsx +18 -0
- package/src/mch/queues/triage/mch-triage.tsx +15 -0
- package/src/modals/sign-off-modal.scss +7 -0
- package/src/modals/sign-off-modal.tsx +52 -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 +145 -58
- package/src/registry/modal/send-to-triage/send-to-triage.modal.scss +16 -1
- package/src/registry/modal/send-to-triage/send-to-triage.modal.tsx +681 -97
- 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 +18 -1
- package/src/registry/registry.component.tsx +242 -111
- package/src/registry/registry.resource.ts +8 -5
- package/src/registry/types/index.ts +179 -1
- package/src/registry/utils/error-handler.ts +33 -0
- package/src/registry/utils/format-dependant-display-data.ts +8 -0
- package/src/registry/utils/hie-client-adapter.ts +312 -0
- package/src/registry/utils/mask-data.ts +11 -0
- package/src/resources/dashboard.resource.ts +20 -0
- package/src/resources/hie-amrs-automatic-registration.service.ts +16 -0
- package/src/resources/identifier-types.ts +29 -0
- package/src/resources/patient-resource.ts +62 -0
- package/src/resources/queue.resource.ts +23 -0
- package/src/resources/superset.resource.ts +20 -0
- package/src/resources/visit.resource.ts +19 -1
- package/src/root.component.tsx +32 -6
- package/src/routes.json +215 -7
- package/src/service-queues/action-button.component.tsx +34 -0
- package/src/service-queues/action-overflow-menu-item.component.tsx +34 -0
- 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 +142 -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 +150 -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/metrics-card.component.tsx +86 -0
- package/src/service-queues/metrics/metrics-cards/metrics-card.scss +106 -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/service-queues/metrics/metrics-container.scss +36 -0
- package/src/service-queues/metrics/metrics.resource.ts +65 -0
- 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 +36 -0
- package/src/service-queues/queue-list/queue-list.component.tsx +249 -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 +361 -0
- package/src/service-queues/service.resource.ts +28 -0
- package/src/shared/constants/civil-status.ts +29 -0
- package/src/shared/constants/concepts.ts +15 -0
- package/src/shared/constants/index.ts +1 -2
- package/src/shared/constants/patient-category.ts +6 -0
- package/src/shared/constants/person-attributes.ts +33 -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/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 +180 -0
- package/dist/16.js +0 -1
- package/dist/16.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/198.js +0 -2
- package/dist/198.js.map +0 -1
- package/dist/200.js +0 -2
- package/dist/200.js.map +0 -1
- package/dist/255.js +0 -1
- package/dist/255.js.map +0 -1
- package/dist/300.js +0 -1
- package/dist/335.js +0 -1
- package/dist/353.js +0 -1
- package/dist/353.js.map +0 -1
- package/dist/420.js +0 -1
- package/dist/420.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/652.js +0 -1
- package/dist/860.js +0 -1
- package/dist/860.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/99.js +0 -1
- package/dist/openmrs-esm-home-app.js +0 -1
- package/dist/openmrs-esm-home-app.js.buildmanifest.json +0 -626
- package/dist/openmrs-esm-home-app.js.map +0 -1
- package/src/consultation/consultation.tsx +0 -7
- /package/dist/{184.js.LICENSE.txt → 3184.js.LICENSE.txt} +0 -0
- /package/dist/{540.js.LICENSE.txt → 6540.js.LICENSE.txt} +0 -0
|
@@ -1,9 +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
|
-
|
|
6
|
-
InlineLoading,
|
|
5
|
+
ComboBox,
|
|
7
6
|
Modal,
|
|
8
7
|
ModalBody,
|
|
9
8
|
Select,
|
|
@@ -14,76 +13,278 @@ import {
|
|
|
14
13
|
TableHead,
|
|
15
14
|
TableHeader,
|
|
16
15
|
TableRow,
|
|
16
|
+
TextInput,
|
|
17
17
|
} from '@carbon/react';
|
|
18
18
|
import styles from './send-to-triage.modal.scss';
|
|
19
|
+
import { type Patient, useSession, showSnackbar, type Visit, useConfig } from '@openmrs/esm-framework';
|
|
19
20
|
import {
|
|
20
|
-
type
|
|
21
|
-
type
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
type
|
|
26
|
-
} from '
|
|
27
|
-
import {
|
|
28
|
-
import { createQueueEntry, fetchServiceQueuesByLocationUuid } from '../../../resources/queue.resource';
|
|
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';
|
|
29
29
|
import { QUEUE_PRIORITIES_UUIDS, QUEUE_STATUS_UUIDS } from '../../../shared/constants/concepts';
|
|
30
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';
|
|
31
53
|
|
|
32
54
|
interface SendToTriageModalProps {
|
|
33
55
|
patients: Patient[];
|
|
34
56
|
open: boolean;
|
|
35
57
|
onModalClose: (modalCloseResp?: { success: boolean }) => void;
|
|
36
58
|
onSubmit: () => void;
|
|
59
|
+
client: HieClient;
|
|
60
|
+
onCreateAmrsPatient: (client: HieClient) => void;
|
|
61
|
+
onManualRegistration: () => void;
|
|
37
62
|
}
|
|
38
63
|
|
|
39
|
-
const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
64
|
+
const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
65
|
+
patients,
|
|
66
|
+
open,
|
|
67
|
+
onModalClose,
|
|
68
|
+
onSubmit,
|
|
69
|
+
client,
|
|
70
|
+
onCreateAmrsPatient,
|
|
71
|
+
onManualRegistration,
|
|
72
|
+
}) => {
|
|
40
73
|
const [selectedPatient, setSelectedPatient] = useState<Patient>();
|
|
41
74
|
const [selectedVisitType, setSelectedVisitType] = useState<string>();
|
|
42
75
|
const [serviceQueues, setServiceQueues] = useState<ServiceQueue[]>();
|
|
43
76
|
const [selectedServiceQueue, setSelectedServiceQueue] = useState<string>();
|
|
77
|
+
const [paymentModes, setPaymentModes] = useState<PaymentMode[]>([]);
|
|
78
|
+
const [cashPoints, setCashPoints] = useState<CashPoint[]>([]);
|
|
79
|
+
const [selectedCashPoint, setSelectedCashPoint] = useState<CashPoint>(null);
|
|
80
|
+
const [selectedPaymentMode, setSelectedPaymentMode] = useState<PaymentMode>(null);
|
|
44
81
|
const [selectedPriority, setSelectedPriority] = useState<string>('');
|
|
82
|
+
const [selectedPaymentDetail, setSelectedPaymentDetail] = useState<string>();
|
|
83
|
+
const [billableServices, setBillableServices] = useState<BillableService[]>([]);
|
|
84
|
+
const [servicePrices, setServicePrices] = useState<ServicePrice[]>([]);
|
|
85
|
+
const [filteredBillableServices, setFilteredBillableServices] = useState<ServicePrice[]>(null);
|
|
86
|
+
const [selectedBillableService, setSelectedBillableService] = useState<ServicePrice | null>(null);
|
|
87
|
+
const [selectedInsuranceScheme, setSelectedInsuranceScheme] = useState<string>('');
|
|
88
|
+
const [selectedInsurancePolicy, setSelectedInsurancePolicy] = useState<string>('');
|
|
89
|
+
const [selectedPatientCategory, setSelectedPatientCategory] = useState<string>('');
|
|
90
|
+
const [currentQueueEntry, setCurrentQueueEntry] = useState<QueueEntry>();
|
|
91
|
+
const [patientBills, setPatientBills] = useState<Bill[]>([]);
|
|
92
|
+
const [billCreated, setBillCreated] = useState<boolean>(false);
|
|
93
|
+
const [disableSubmission, setDisableSubmission] = useState<boolean>(false);
|
|
45
94
|
const [loading, setLoading] = useState<boolean>(false);
|
|
46
|
-
const visitTypes = useVisitTypes();
|
|
47
95
|
const session = useSession();
|
|
48
96
|
const locationUuid = session.sessionLocation.uuid;
|
|
97
|
+
const {
|
|
98
|
+
registrationBillableServices,
|
|
99
|
+
cashConsulationConceptUuid,
|
|
100
|
+
shaConsulationConceptUuid,
|
|
101
|
+
outPatientCareSettingUuid,
|
|
102
|
+
orderEncounterTypeUuid,
|
|
103
|
+
} = useConfig();
|
|
104
|
+
|
|
105
|
+
const facilityCashPoints = useMemo(() => getfacilityCashpoints(), [cashPoints, locationUuid]);
|
|
106
|
+
|
|
107
|
+
const visitTypeOptions = useMemo(
|
|
108
|
+
() => [
|
|
109
|
+
{
|
|
110
|
+
text: 'OPD Visit',
|
|
111
|
+
id: VisitTypeUuids.OPD_VISIT_TYPE_UUID,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
text: 'Inpatient Visit',
|
|
115
|
+
id: VisitTypeUuids.INPATIENT_VISIT_TYPE_UUID,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
[client],
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const paymentDetails = Object.values(PaymentDetail).map((value) => {
|
|
122
|
+
return {
|
|
123
|
+
id: value,
|
|
124
|
+
label: value,
|
|
125
|
+
};
|
|
126
|
+
});
|
|
49
127
|
useEffect(() => {
|
|
50
128
|
getServiceQueues();
|
|
129
|
+
getPaymentMethods();
|
|
130
|
+
getBillableServices();
|
|
131
|
+
getCashPoints();
|
|
132
|
+
getPatientBills();
|
|
133
|
+
getPatientActiveQueue();
|
|
51
134
|
}, [patients]);
|
|
52
135
|
if (!patients) {
|
|
53
136
|
return <>No Client data</>;
|
|
54
137
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
138
|
+
|
|
139
|
+
async function getPatientActiveQueue() {
|
|
140
|
+
if (patients && patients.length > 0) {
|
|
141
|
+
const activePatient = patients[0];
|
|
142
|
+
try {
|
|
143
|
+
const resp = await getActiveQueueEntryByPatientUuid(activePatient.uuid);
|
|
144
|
+
setCurrentQueueEntry(resp.length > 0 ? resp[0] : null);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
showAlert('error', 'Error getting patient active queue', '');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async function getPatientBills() {
|
|
152
|
+
if (patients) {
|
|
153
|
+
let bills: Bill[] = [];
|
|
154
|
+
setPatientBills([]);
|
|
155
|
+
for (let i = 0; i < patients.length; i++) {
|
|
156
|
+
const resp = await fetchPatientBills(patients[i].uuid);
|
|
157
|
+
const todaysBills = getTodaysBills(resp);
|
|
158
|
+
setPatientBills(todaysBills);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function getTodaysBills(bills: Bill[]) {
|
|
163
|
+
const today = new Date();
|
|
164
|
+
return bills.filter((b) => {
|
|
165
|
+
const billDate = new Date(b.dateCreated);
|
|
166
|
+
return (
|
|
167
|
+
billDate.getFullYear() === today.getFullYear() &&
|
|
168
|
+
billDate.getMonth() === today.getMonth() &&
|
|
169
|
+
billDate.getDate() === today.getDate()
|
|
170
|
+
);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
58
173
|
const sendToTriage = async () => {
|
|
174
|
+
if (disableSubmission) {
|
|
175
|
+
showAlert(
|
|
176
|
+
'error',
|
|
177
|
+
'Form already Submitted',
|
|
178
|
+
'Form has already been submitted, please wait for the visit,queue and bill to be created',
|
|
179
|
+
);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
setDisableSubmission(true);
|
|
183
|
+
if (!validateVisitQueueBill()) {
|
|
184
|
+
setDisableSubmission(false);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
59
187
|
setLoading(true);
|
|
60
188
|
try {
|
|
61
|
-
const newVisit = await createPatientVisit();
|
|
189
|
+
const newVisit: Visit = await createPatientVisit();
|
|
62
190
|
if (newVisit) {
|
|
63
|
-
const addToTriageQueueDto: QueueEntryDto = generateAddToTriageDto(newVisit
|
|
191
|
+
const addToTriageQueueDto: QueueEntryDto = generateAddToTriageDto(newVisit);
|
|
64
192
|
const queueEntryResp = await createQueueEntry(addToTriageQueueDto);
|
|
193
|
+
|
|
65
194
|
if (queueEntryResp) {
|
|
66
195
|
showAlert('success', 'Patient has succesfully been moved to the Triage queue', '');
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// add bill if it was a paying client
|
|
199
|
+
let createBillResp = null;
|
|
200
|
+
if (selectedPaymentDetail === PaymentDetail.Paying) {
|
|
201
|
+
const createBillDto = generateCreateBillDto();
|
|
202
|
+
if (isValidCreateBillDto(createBillDto) && !billCreated) {
|
|
203
|
+
createBillResp = await createBill(createBillDto);
|
|
204
|
+
if (createBillResp) {
|
|
205
|
+
setBillCreated(true);
|
|
206
|
+
showAlert('success', 'Bill succesfully created', '');
|
|
207
|
+
}
|
|
208
|
+
// create consulation order
|
|
209
|
+
await createOrder(selectedPatient.uuid, newVisit.uuid);
|
|
210
|
+
} else {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (
|
|
216
|
+
(queueEntryResp && PaymentDetail.Paying && (createBillResp || billCreated)) ||
|
|
217
|
+
(queueEntryResp && PaymentDetail.NonPaying)
|
|
218
|
+
) {
|
|
67
219
|
onModalClose({ success: true });
|
|
68
220
|
}
|
|
69
221
|
}
|
|
70
222
|
} catch (error) {
|
|
71
|
-
|
|
223
|
+
setDisableSubmission(false);
|
|
224
|
+
showAlert('error', error.message ?? 'Error creating visit', '');
|
|
72
225
|
} finally {
|
|
73
226
|
setLoading(false);
|
|
74
227
|
}
|
|
75
228
|
};
|
|
76
|
-
|
|
229
|
+
function validateVisitQueueBill(): boolean {
|
|
230
|
+
if (!selectedPatient) {
|
|
231
|
+
showAlert('error', 'Please select a patient', '');
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
if (!selectedPaymentDetail) {
|
|
235
|
+
showAlert('error', 'Please select a paying or non paying option', '');
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (!isValidServiceQueueSelected()) {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (selectedPaymentDetail === PaymentDetail.Paying) {
|
|
244
|
+
if (!selectedPaymentMode) {
|
|
245
|
+
showAlert('error', 'Please select a payment method', '');
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
if (!selectedBillableService) {
|
|
249
|
+
showAlert('error', 'Please select a billable service', '');
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
if (!selectedCashPoint) {
|
|
253
|
+
showAlert('error', 'Please select a cashpoint', '');
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (selectedPaymentDetail === PaymentDetail.NonPaying) {
|
|
258
|
+
if (!selectedPatientCategory) {
|
|
259
|
+
showAlert('error', 'Please select a patient category', '');
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (!selectedVisitType) {
|
|
264
|
+
showAlert('error', 'Please select a visit type', '');
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
if (!selectedServiceQueue) {
|
|
268
|
+
showAlert('error', 'Please select a service queue', '');
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
if (!selectedPriority) {
|
|
272
|
+
showAlert('error', 'Please select a service queue priority', '');
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
const generateAddToTriageDto = (newVisit: Visit): QueueEntryDto => {
|
|
77
278
|
const payload: QueueEntryDto = {
|
|
78
279
|
visit: {
|
|
79
|
-
uuid:
|
|
280
|
+
uuid: newVisit.uuid,
|
|
80
281
|
},
|
|
81
282
|
queueEntry: {
|
|
82
283
|
status: {
|
|
83
284
|
uuid: QUEUE_STATUS_UUIDS.WAITING_UUID,
|
|
84
285
|
},
|
|
85
286
|
priority: {
|
|
86
|
-
uuid: selectedPriority,
|
|
287
|
+
uuid: selectedPriority ?? QUEUE_PRIORITIES_UUIDS.NORMAL_PRIORITY_UUID,
|
|
87
288
|
},
|
|
88
289
|
queue: {
|
|
89
290
|
uuid: selectedServiceQueue,
|
|
@@ -91,7 +292,7 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({ patients, open, o
|
|
|
91
292
|
patient: {
|
|
92
293
|
uuid: selectedPatient.uuid,
|
|
93
294
|
},
|
|
94
|
-
startedAt:
|
|
295
|
+
startedAt: newVisit.startDatetime,
|
|
95
296
|
sortWeight: 0,
|
|
96
297
|
},
|
|
97
298
|
};
|
|
@@ -100,23 +301,100 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({ patients, open, o
|
|
|
100
301
|
const onPatientSelect = (patient: Patient) => {
|
|
101
302
|
setSelectedPatient(patient);
|
|
102
303
|
};
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
if (resp && resp.results) {
|
|
106
|
-
setServiceQueues(resp.results);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
const visitTypeChangeHandler = ($event: any) => {
|
|
110
|
-
const vt = $event.target.value as unknown as string;
|
|
304
|
+
const visitTypeChangeHandler = (selectedVisitType: { selectedItem: { id: string; text: string } }) => {
|
|
305
|
+
const vt = selectedVisitType.selectedItem.id;
|
|
111
306
|
setSelectedVisitType(vt);
|
|
112
307
|
};
|
|
308
|
+
const isValidServiceQueueSelected = () => {
|
|
309
|
+
if (!currentQueueEntry) {
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
if (currentQueueEntry.queue.uuid) {
|
|
313
|
+
showAlert(
|
|
314
|
+
'error',
|
|
315
|
+
'Patient already in queue',
|
|
316
|
+
`Patient is already in the ${currentQueueEntry.queue.display} queue, remove them first or contact support`,
|
|
317
|
+
);
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
return true;
|
|
321
|
+
};
|
|
113
322
|
const serviceChangeHandler = ($event: any) => {
|
|
114
|
-
|
|
115
|
-
|
|
323
|
+
if (isValidServiceQueueSelected()) {
|
|
324
|
+
const sq = $event.target.value as unknown as string;
|
|
325
|
+
setSelectedServiceQueue(sq);
|
|
326
|
+
}
|
|
116
327
|
};
|
|
117
328
|
const priorityChangeHandler = (priorityUuid: string) => {
|
|
118
329
|
setSelectedPriority(priorityUuid);
|
|
119
330
|
};
|
|
331
|
+
const paymentDetailsHandler = (paymentDetailSelected: string) => {
|
|
332
|
+
setSelectedPaymentDetail(paymentDetailSelected);
|
|
333
|
+
};
|
|
334
|
+
const paymentMethodHandler = (selectedPaymentModeUuid: string) => {
|
|
335
|
+
const selectedPaymentMode = paymentModes.find((pm) => {
|
|
336
|
+
return pm.uuid === selectedPaymentModeUuid;
|
|
337
|
+
});
|
|
338
|
+
setSelectedPaymentMode(selectedPaymentMode);
|
|
339
|
+
const paymentModeBillableServices = getBillableServiceByPaymentMode(selectedPaymentMode);
|
|
340
|
+
setFilteredBillableServices(paymentModeBillableServices);
|
|
341
|
+
setSelectedInsuranceScheme('');
|
|
342
|
+
setSelectedInsurancePolicy('');
|
|
343
|
+
setSelectedPriority('');
|
|
344
|
+
};
|
|
345
|
+
const getBillableServiceByPaymentMode = (paymentMode: PaymentMode): PayableBillableService[] => {
|
|
346
|
+
const paymentBillableServices: ServicePrice[] = [];
|
|
347
|
+
servicePrices.forEach((sp) => {
|
|
348
|
+
if (sp.paymentMode) {
|
|
349
|
+
if (
|
|
350
|
+
sp.paymentMode.uuid === paymentMode.uuid &&
|
|
351
|
+
registrationBillableServices.includes(sp.billableService.uuid)
|
|
352
|
+
) {
|
|
353
|
+
paymentBillableServices.push(sp);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
return paymentBillableServices;
|
|
358
|
+
};
|
|
359
|
+
const billableServicesHandler = (selectedBillableServiceUuid: string) => {
|
|
360
|
+
const selectedBillableService = servicePrices.find((sp) => {
|
|
361
|
+
return sp.uuid === selectedBillableServiceUuid;
|
|
362
|
+
});
|
|
363
|
+
if (isValidBillableService(selectedBillableService)) {
|
|
364
|
+
setSelectedBillableService(selectedBillableService);
|
|
365
|
+
} else {
|
|
366
|
+
setSelectedBillableService(null);
|
|
367
|
+
showAlert('error', 'Existing bill', 'Patient has a similar bill');
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
const isValidBillableService = (selectedService: ServicePrice) => {
|
|
371
|
+
// check if patient has been billed for similar service
|
|
372
|
+
let isValid = true;
|
|
373
|
+
patientBills.forEach((b) => {
|
|
374
|
+
const lineItems = b.lineItems;
|
|
375
|
+
lineItems.forEach((l) => {
|
|
376
|
+
if (l.billableService === selectedService.billableService.display) {
|
|
377
|
+
isValid = false;
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
return isValid;
|
|
382
|
+
};
|
|
383
|
+
const cashPointsHandler = (selectedCashPointUuid: string) => {
|
|
384
|
+
const selectedCashPoint = cashPoints.find((cp) => {
|
|
385
|
+
return cp.uuid === selectedCashPointUuid;
|
|
386
|
+
});
|
|
387
|
+
setSelectedCashPoint(selectedCashPoint);
|
|
388
|
+
};
|
|
389
|
+
const insuranceSchemeHandler = (selectedInsuranceScheme: string) => {
|
|
390
|
+
setSelectedInsuranceScheme(selectedInsuranceScheme);
|
|
391
|
+
};
|
|
392
|
+
const insurancePolicyHandler = (selectedInsurancePolicy: string) => {
|
|
393
|
+
setSelectedInsurancePolicy(selectedInsurancePolicy);
|
|
394
|
+
};
|
|
395
|
+
const patientCategoryHandler = (categoryUuid: string) => {
|
|
396
|
+
setSelectedPatientCategory(categoryUuid);
|
|
397
|
+
};
|
|
120
398
|
const createPatientVisit = async () => {
|
|
121
399
|
const visitDto = getCreateVisitDto();
|
|
122
400
|
if (!isValidCreateVisitDto(visitDto)) {
|
|
@@ -149,13 +427,18 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({ patients, open, o
|
|
|
149
427
|
return true;
|
|
150
428
|
};
|
|
151
429
|
const getCreateVisitDto = (): CreateVisitDto => {
|
|
152
|
-
|
|
430
|
+
const visitAttributes = getVisitAttributes();
|
|
431
|
+
const visitDto: CreateVisitDto = {
|
|
153
432
|
visitType: selectedVisitType,
|
|
154
433
|
location: locationUuid,
|
|
155
434
|
startDatetime: null,
|
|
156
435
|
stopDatetime: null,
|
|
157
|
-
patient: selectedPatient?.uuid
|
|
436
|
+
patient: selectedPatient?.uuid,
|
|
158
437
|
};
|
|
438
|
+
if (visitAttributes.length > 0) {
|
|
439
|
+
visitDto['attributes'] = visitAttributes;
|
|
440
|
+
}
|
|
441
|
+
return visitDto;
|
|
159
442
|
};
|
|
160
443
|
const showAlert = (alertType: 'error' | 'success', title: string, subtitle: string) => {
|
|
161
444
|
showSnackbar({
|
|
@@ -164,6 +447,175 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({ patients, open, o
|
|
|
164
447
|
subtitle: subtitle,
|
|
165
448
|
});
|
|
166
449
|
};
|
|
450
|
+
|
|
451
|
+
function getVisitAttributes(): VisitAttribute[] {
|
|
452
|
+
const attributes: VisitAttribute[] = [];
|
|
453
|
+
if (selectedInsuranceScheme) {
|
|
454
|
+
attributes.push({
|
|
455
|
+
attributeType: '3a988e33-a6c0-4b76-b924-01abb998944b',
|
|
456
|
+
value: selectedInsuranceScheme,
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
if (selectedInsurancePolicy) {
|
|
460
|
+
attributes.push({
|
|
461
|
+
attributeType: 'aac48226-d143-4274-80e0-264db4e368ee',
|
|
462
|
+
value: selectedInsurancePolicy,
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
if (selectedPaymentMode) {
|
|
466
|
+
attributes.push({
|
|
467
|
+
attributeType: '8553afa0-bdb9-4d3c-8a98-05fa9350aa85',
|
|
468
|
+
value: selectedPaymentMode.uuid,
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
return attributes;
|
|
472
|
+
}
|
|
473
|
+
async function getServiceQueues() {
|
|
474
|
+
try {
|
|
475
|
+
const sqs = await getFacilityServiceQueues(locationUuid);
|
|
476
|
+
if (sqs.length > 0) {
|
|
477
|
+
setServiceQueues(sqs);
|
|
478
|
+
}
|
|
479
|
+
} catch (e) {
|
|
480
|
+
showSnackbar({
|
|
481
|
+
kind: 'error',
|
|
482
|
+
title: 'An error occurred while fetching service queues',
|
|
483
|
+
subtitle: e.message ?? 'An error occurred while fetching service queues, please try agin',
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
async function getPaymentMethods() {
|
|
489
|
+
const methods = await fetchPaymentModes();
|
|
490
|
+
setPaymentModes(methods);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
async function getBillableServices() {
|
|
494
|
+
const billableServices = await fetchBillableServices();
|
|
495
|
+
setBillableServices(billableServices);
|
|
496
|
+
generateServiceTypesList(billableServices);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
async function getCashPoints() {
|
|
500
|
+
const cp = await fetchCashPoints();
|
|
501
|
+
setCashPoints(cp);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function getfacilityCashpoints() {
|
|
505
|
+
return cashPoints.filter((cp) => {
|
|
506
|
+
return cp && cp.location?.uuid === locationUuid;
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function generateServiceTypesList(billableServices: BillableService[]) {
|
|
511
|
+
const sp: ServicePrice[] = [];
|
|
512
|
+
for (let bs of billableServices) {
|
|
513
|
+
if (bs.servicePrices) {
|
|
514
|
+
const servicePrices = bs.servicePrices;
|
|
515
|
+
for (let servicePrice of servicePrices) {
|
|
516
|
+
sp.push(servicePrice);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
setServicePrices(sp);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function generateCreateBillDto(): CreateBillDto {
|
|
524
|
+
const payload: CreateBillDto = {
|
|
525
|
+
lineItems: [
|
|
526
|
+
{
|
|
527
|
+
billableService: selectedBillableService.billableService.uuid,
|
|
528
|
+
quantity: 1,
|
|
529
|
+
price: selectedBillableService.price,
|
|
530
|
+
priceName: selectedBillableService.name,
|
|
531
|
+
priceUuid: selectedBillableService.uuid,
|
|
532
|
+
lineItemOrder: 0,
|
|
533
|
+
paymentStatus: 'PENDING',
|
|
534
|
+
},
|
|
535
|
+
],
|
|
536
|
+
cashPoint: selectedCashPoint.uuid,
|
|
537
|
+
patient: selectedPatient.uuid,
|
|
538
|
+
status: 'PENDING',
|
|
539
|
+
payments: [],
|
|
540
|
+
};
|
|
541
|
+
return payload;
|
|
542
|
+
}
|
|
543
|
+
function isValidCreateBillDto(createBillDto: CreateBillDto): boolean {
|
|
544
|
+
if (!createBillDto.patient) {
|
|
545
|
+
showAlert('error', 'Please select a patient', '');
|
|
546
|
+
return false;
|
|
547
|
+
}
|
|
548
|
+
if (!createBillDto.status) {
|
|
549
|
+
showAlert('error', 'Bill does not have a status', '');
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
if (!createBillDto.cashPoint) {
|
|
553
|
+
showAlert('error', 'Please select a valid cashpoint', '');
|
|
554
|
+
return false;
|
|
555
|
+
}
|
|
556
|
+
if (!createBillDto.lineItems || createBillDto.lineItems.length === 0) {
|
|
557
|
+
showAlert('error', 'Please select a valid billable service', '');
|
|
558
|
+
return false;
|
|
559
|
+
}
|
|
560
|
+
return true;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function hasSelectedPaymentMode(paymentMode: string): boolean {
|
|
564
|
+
if (!selectedPaymentMode) {
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
return selectedPaymentMode.name.trim().toLowerCase().includes(paymentMode.trim().toLowerCase());
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
function generateOrderEncounterPayload(patientUuid: string, visitUuid: string): CreateOrderEncounterDto {
|
|
571
|
+
return {
|
|
572
|
+
patient: patientUuid,
|
|
573
|
+
location: locationUuid,
|
|
574
|
+
encounterType: orderEncounterTypeUuid,
|
|
575
|
+
visit: visitUuid,
|
|
576
|
+
obs: [],
|
|
577
|
+
orders: [
|
|
578
|
+
{
|
|
579
|
+
action: 'NEW',
|
|
580
|
+
type: 'order',
|
|
581
|
+
patient: patientUuid,
|
|
582
|
+
careSetting: outPatientCareSettingUuid,
|
|
583
|
+
orderer: session.currentProvider.uuid ?? 'pd25871c-1359-11df-a1f1-0026b9348838',
|
|
584
|
+
encounter: null,
|
|
585
|
+
concept: getOrderConcept(selectedPaymentMode),
|
|
586
|
+
accessionNumber: null,
|
|
587
|
+
urgency: 'ROUTINE',
|
|
588
|
+
scheduledDate: null,
|
|
589
|
+
},
|
|
590
|
+
],
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
function getOrderConcept(paymentMode: PaymentMode) {
|
|
594
|
+
const paymentModeName = paymentMode.name.toLowerCase().trim();
|
|
595
|
+
if (paymentModeName.includes('cash')) {
|
|
596
|
+
return cashConsulationConceptUuid;
|
|
597
|
+
} else if (paymentModeName.includes('sha')) {
|
|
598
|
+
return shaConsulationConceptUuid;
|
|
599
|
+
} else {
|
|
600
|
+
return '';
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
async function createOrder(patientUuid: string, visitUuid: string) {
|
|
604
|
+
const createOrderPayload = generateOrderEncounterPayload(patientUuid, visitUuid);
|
|
605
|
+
try {
|
|
606
|
+
const resp = await createOrderEncounter(createOrderPayload);
|
|
607
|
+
if (resp) {
|
|
608
|
+
showAlert('success', 'Consultation order created', 'Consultation order has been succesfully created');
|
|
609
|
+
}
|
|
610
|
+
} catch (error) {
|
|
611
|
+
showAlert(
|
|
612
|
+
'error',
|
|
613
|
+
'Error creating consulation order',
|
|
614
|
+
'An error occurred while generating the consultation order. Please contact support',
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
167
619
|
return (
|
|
168
620
|
<>
|
|
169
621
|
<Modal
|
|
@@ -171,8 +623,8 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({ patients, open, o
|
|
|
171
623
|
size="md"
|
|
172
624
|
onSecondarySubmit={() => onModalClose({ success: false })}
|
|
173
625
|
onRequestClose={() => onModalClose({ success: false })}
|
|
174
|
-
onRequestSubmit={
|
|
175
|
-
primaryButtonText=
|
|
626
|
+
onRequestSubmit={sendToTriage}
|
|
627
|
+
primaryButtonText={loading ? 'Sending...please wait' : 'Send to Triage'}
|
|
176
628
|
secondaryButtonText="Cancel"
|
|
177
629
|
>
|
|
178
630
|
<ModalBody>
|
|
@@ -180,73 +632,205 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({ patients, open, o
|
|
|
180
632
|
<div className={styles.sectionHeader}>
|
|
181
633
|
<h4 className={styles.sectionTitle}>Send To Triage</h4>
|
|
182
634
|
</div>
|
|
183
|
-
|
|
184
|
-
<div className={styles.
|
|
185
|
-
<
|
|
186
|
-
<
|
|
187
|
-
<
|
|
188
|
-
<
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
</TableHead>
|
|
194
|
-
<TableBody>
|
|
195
|
-
{patients.map((p, index) => (
|
|
196
|
-
<TableRow key={p.uuid}>
|
|
197
|
-
<TableCell>{index + 1}</TableCell>
|
|
198
|
-
<TableCell>{p.person.preferredName.display}</TableCell>
|
|
199
|
-
<TableCell>{p.person.birthdate}</TableCell>
|
|
200
|
-
<TableCell>
|
|
201
|
-
<Checkbox id={p.uuid} labelText="" onChange={() => onPatientSelect(p)} />
|
|
202
|
-
</TableCell>
|
|
635
|
+
{patients.length > 0 ? (
|
|
636
|
+
<div className={styles.sectionContent}>
|
|
637
|
+
<div className={styles.patientSelect}>
|
|
638
|
+
<Table>
|
|
639
|
+
<TableHead>
|
|
640
|
+
<TableRow>
|
|
641
|
+
<TableHeader>No</TableHeader>
|
|
642
|
+
<TableHeader>Name</TableHeader>
|
|
643
|
+
<TableHeader>Gender</TableHeader>
|
|
644
|
+
<TableHeader>Select Patient</TableHeader>
|
|
203
645
|
</TableRow>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
646
|
+
</TableHead>
|
|
647
|
+
<TableBody>
|
|
648
|
+
{patients.map((p, index) => (
|
|
649
|
+
<TableRow key={p.uuid}>
|
|
650
|
+
<TableCell>{index + 1}</TableCell>
|
|
651
|
+
<TableCell>{p.person.preferredName.display}</TableCell>
|
|
652
|
+
<TableCell>{p.person.gender}</TableCell>
|
|
653
|
+
<TableCell>
|
|
654
|
+
<Checkbox id={p.uuid} labelText="" onChange={() => onPatientSelect(p)} />
|
|
655
|
+
</TableCell>
|
|
656
|
+
</TableRow>
|
|
657
|
+
))}
|
|
658
|
+
</TableBody>
|
|
659
|
+
</Table>
|
|
660
|
+
</div>
|
|
661
|
+
<div className={styles.formSection}>
|
|
662
|
+
<div className={styles.formRow}>
|
|
663
|
+
<div className={styles.formControl}>
|
|
664
|
+
<Select
|
|
665
|
+
id="payment-details"
|
|
666
|
+
labelText="Payment Details"
|
|
667
|
+
onChange={($event) => paymentDetailsHandler($event.target.value)}
|
|
668
|
+
>
|
|
669
|
+
<SelectItem value="" text="Select" />;
|
|
670
|
+
{paymentDetails.map((pd) => {
|
|
671
|
+
return <SelectItem value={pd.id} text={pd.label} />;
|
|
225
672
|
})}
|
|
226
|
-
|
|
673
|
+
</Select>
|
|
674
|
+
</div>
|
|
227
675
|
</div>
|
|
228
676
|
</div>
|
|
229
|
-
<div className={styles.
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
677
|
+
<div className={styles.formSection}>
|
|
678
|
+
{selectedPaymentDetail === PaymentDetail.Paying ? (
|
|
679
|
+
<>
|
|
680
|
+
<div className={styles.formRow}>
|
|
681
|
+
<div className={styles.formControl}>
|
|
682
|
+
<Select
|
|
683
|
+
id="payment-method"
|
|
684
|
+
labelText="Payment Method"
|
|
685
|
+
onChange={($event) => paymentMethodHandler($event.target.value)}
|
|
686
|
+
>
|
|
687
|
+
<SelectItem value="" text="Select" />;
|
|
688
|
+
{paymentModes &&
|
|
689
|
+
paymentModes.map((pm) => {
|
|
690
|
+
return <SelectItem value={pm.uuid} text={pm.name} />;
|
|
691
|
+
})}
|
|
692
|
+
</Select>
|
|
693
|
+
</div>
|
|
694
|
+
<div className={styles.formControl}>
|
|
695
|
+
<Select
|
|
696
|
+
id="billable-service"
|
|
697
|
+
labelText="Billable Services"
|
|
698
|
+
onChange={($event) => billableServicesHandler($event.target.value)}
|
|
699
|
+
>
|
|
700
|
+
<SelectItem value="" text="Select" />;
|
|
701
|
+
{filteredBillableServices &&
|
|
702
|
+
filteredBillableServices.map((sp) => {
|
|
703
|
+
return (
|
|
704
|
+
<SelectItem
|
|
705
|
+
value={sp.uuid}
|
|
706
|
+
text={`${sp.billableService.display}(${sp.name}:${sp.price})`}
|
|
707
|
+
/>
|
|
708
|
+
);
|
|
709
|
+
})}
|
|
710
|
+
</Select>
|
|
711
|
+
</div>
|
|
712
|
+
</div>
|
|
713
|
+
{hasSelectedPaymentMode('insurance') ? (
|
|
714
|
+
<>
|
|
715
|
+
<div className={styles.formRow}>
|
|
716
|
+
<div className={styles.formControl}>
|
|
717
|
+
<TextInput
|
|
718
|
+
id="insurance-scheme"
|
|
719
|
+
labelText="Insurance scheme"
|
|
720
|
+
onChange={(e) => insuranceSchemeHandler(e.target.value)}
|
|
721
|
+
/>
|
|
722
|
+
</div>
|
|
723
|
+
<div className={styles.formControl}>
|
|
724
|
+
<TextInput
|
|
725
|
+
id="policy-number"
|
|
726
|
+
labelText="Policy number"
|
|
727
|
+
onChange={(e) => insurancePolicyHandler(e.target.value)}
|
|
728
|
+
/>
|
|
729
|
+
</div>
|
|
730
|
+
</div>
|
|
731
|
+
</>
|
|
732
|
+
) : (
|
|
733
|
+
<></>
|
|
734
|
+
)}
|
|
735
|
+
<div className={styles.formRow}>
|
|
736
|
+
<div className={styles.formControl}>
|
|
737
|
+
<Select
|
|
738
|
+
id="cash-point"
|
|
739
|
+
labelText="Cash Point"
|
|
740
|
+
onChange={($event) => cashPointsHandler($event.target.value)}
|
|
741
|
+
>
|
|
742
|
+
<SelectItem value="" text="Select" />;
|
|
743
|
+
{facilityCashPoints &&
|
|
744
|
+
facilityCashPoints.map((cp) => {
|
|
745
|
+
return <SelectItem value={cp.uuid} text={cp.name} />;
|
|
746
|
+
})}
|
|
747
|
+
</Select>
|
|
748
|
+
</div>
|
|
749
|
+
</div>
|
|
750
|
+
</>
|
|
751
|
+
) : (
|
|
752
|
+
<></>
|
|
753
|
+
)}
|
|
754
|
+
|
|
755
|
+
{selectedPaymentDetail === PaymentDetail.NonPaying ? (
|
|
756
|
+
<>
|
|
757
|
+
<div className={styles.formRow}>
|
|
758
|
+
<div className={styles.formControl}>
|
|
759
|
+
<Select
|
|
760
|
+
id="patient-category"
|
|
761
|
+
labelText="Patient Category"
|
|
762
|
+
onChange={($event) => patientCategoryHandler($event.target.value)}
|
|
763
|
+
>
|
|
764
|
+
<SelectItem value="" text="Select" />;
|
|
765
|
+
<SelectItem value={PatientCategories.CCC_PATIENT_UUID} text="CCC" />;
|
|
766
|
+
<SelectItem value={PatientCategories.MCH_PATIENT_UUID} text="MCH" />;
|
|
767
|
+
</Select>
|
|
768
|
+
</div>
|
|
769
|
+
</div>
|
|
770
|
+
</>
|
|
771
|
+
) : (
|
|
772
|
+
<></>
|
|
773
|
+
)}
|
|
774
|
+
</div>
|
|
775
|
+
<div className={styles.formSection}>
|
|
776
|
+
<div className={styles.formRow}>
|
|
777
|
+
<div className={styles.formControl}>
|
|
778
|
+
<ComboBox
|
|
779
|
+
onChange={visitTypeChangeHandler}
|
|
780
|
+
id="visit-type-combobox"
|
|
781
|
+
items={visitTypeOptions}
|
|
782
|
+
itemToString={(item) => (item ? item.text : '')}
|
|
783
|
+
titleText="Select a Visit Type"
|
|
784
|
+
/>
|
|
785
|
+
</div>
|
|
786
|
+
<div className={styles.formControl}>
|
|
787
|
+
<Select id="service" labelText="Select a Queue Service" onChange={serviceChangeHandler}>
|
|
788
|
+
<SelectItem value="" text="Select" />;
|
|
789
|
+
{serviceQueues &&
|
|
790
|
+
serviceQueues.map((sq) => {
|
|
791
|
+
return <SelectItem value={sq.uuid} text={`${sq.display} (${sq.location.display ?? ''})`} />;
|
|
792
|
+
})}
|
|
793
|
+
</Select>
|
|
794
|
+
</div>
|
|
795
|
+
</div>
|
|
796
|
+
<div className={styles.formRow}>
|
|
797
|
+
<div className={styles.formControl}>
|
|
798
|
+
<Select
|
|
799
|
+
id="priority"
|
|
800
|
+
labelText="Select Priority"
|
|
801
|
+
onChange={($event) => priorityChangeHandler($event.target.value)}
|
|
802
|
+
>
|
|
803
|
+
<SelectItem value="" text="Select" />;
|
|
804
|
+
<SelectItem value={QUEUE_PRIORITIES_UUIDS.NORMAL_PRIORITY_UUID} text="PRIORITY" />;
|
|
805
|
+
<SelectItem value={QUEUE_PRIORITIES_UUIDS.NOT_URGENT_PRIORITY_UUID} text="NON URGENT" />;
|
|
806
|
+
<SelectItem value={QUEUE_PRIORITIES_UUIDS.EMERGENCY_PRIORITY_UUID} text="EMERGENCY" />;
|
|
807
|
+
</Select>
|
|
808
|
+
</div>
|
|
240
809
|
</div>
|
|
241
810
|
</div>
|
|
242
811
|
</div>
|
|
243
|
-
|
|
812
|
+
) : (
|
|
813
|
+
<></>
|
|
814
|
+
)}
|
|
244
815
|
<div className={styles.actionSection}>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
816
|
+
{patients.length === 0 ? (
|
|
817
|
+
<>
|
|
818
|
+
<div className={styles.patientAction}>
|
|
819
|
+
<div className={styles.btnContainer}>
|
|
820
|
+
<Button kind="primary" onClick={() => onCreateAmrsPatient(client)}>
|
|
821
|
+
Automatically Register in AMRS
|
|
822
|
+
</Button>
|
|
823
|
+
</div>
|
|
824
|
+
<div className={styles.btnContainer}>
|
|
825
|
+
<Button kind="secondary" onClick={onManualRegistration}>
|
|
826
|
+
Manually Register
|
|
827
|
+
</Button>
|
|
828
|
+
</div>
|
|
829
|
+
</div>
|
|
830
|
+
</>
|
|
831
|
+
) : (
|
|
832
|
+
<></>
|
|
833
|
+
)}
|
|
250
834
|
</div>
|
|
251
835
|
</div>
|
|
252
836
|
</ModalBody>
|