@ampath/esm-dha-workflow-app 4.0.0-next.13 → 4.0.0-next.130
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/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/7076.js +1 -0
- package/dist/7076.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/7523.js +1 -0
- package/dist/7523.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 +1570 -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 +118 -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 +232 -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 -0
- 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
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { type Encounter, formatDate, openmrsFetch, parseDate, restBaseUrl, useSession } from '@openmrs/esm-framework';
|
|
2
|
+
import {
|
|
3
|
+
type QueueEntryResponse,
|
|
4
|
+
type Identifer,
|
|
5
|
+
type MappedEncounter,
|
|
6
|
+
type MappedVisitQueueEntry,
|
|
7
|
+
type QueueEntry,
|
|
8
|
+
type Queue,
|
|
9
|
+
type CreateQueueDto,
|
|
10
|
+
type QueueRoom,
|
|
11
|
+
type CreateQueueRoomDto,
|
|
12
|
+
} from '../types/types';
|
|
13
|
+
import dayjs from 'dayjs';
|
|
14
|
+
import useSWR from 'swr';
|
|
15
|
+
import { useMemo } from 'react';
|
|
16
|
+
import { type QueueEntryResult } from '../registry/types';
|
|
17
|
+
import { getEtlBaseUrl } from '../shared/utils/get-base-url';
|
|
18
|
+
import {
|
|
19
|
+
type ServiceQueueDailyPatientListReportResp,
|
|
20
|
+
type ServiceQueueDailyReport,
|
|
21
|
+
type ServiceQueueDailyReportResp,
|
|
22
|
+
type ServiceQueueReportPatientList,
|
|
23
|
+
} from '../shared/types';
|
|
24
|
+
|
|
25
|
+
export function serveQueueEntry(servicePointName: string, ticketNumber: string, status: string) {
|
|
26
|
+
const abortController = new AbortController();
|
|
27
|
+
|
|
28
|
+
return openmrsFetch(`${restBaseUrl}/queueutil/assignticket`, {
|
|
29
|
+
method: 'POST',
|
|
30
|
+
headers: {
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
},
|
|
33
|
+
signal: abortController.signal,
|
|
34
|
+
body: {
|
|
35
|
+
servicePointName,
|
|
36
|
+
ticketNumber,
|
|
37
|
+
status,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const mapEncounterProperties = (encounter: Encounter): MappedEncounter => ({
|
|
43
|
+
diagnoses: encounter.diagnoses,
|
|
44
|
+
encounterDatetime: encounter.encounterDatetime,
|
|
45
|
+
encounterType: encounter.encounterType.display,
|
|
46
|
+
obs: encounter.obs,
|
|
47
|
+
provider: encounter.encounterProviders[0]?.provider?.person?.display,
|
|
48
|
+
uuid: encounter.uuid,
|
|
49
|
+
voided: encounter.voided,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const mapVisitQueueEntryProperties = (
|
|
53
|
+
queueEntry: QueueEntry,
|
|
54
|
+
visitQueueNumberAttributeUuid: string,
|
|
55
|
+
): MappedVisitQueueEntry => ({
|
|
56
|
+
id: queueEntry.uuid,
|
|
57
|
+
encounters: queueEntry.visit?.encounters?.map(mapEncounterProperties),
|
|
58
|
+
name: queueEntry.display,
|
|
59
|
+
patientUuid: queueEntry.patient.uuid,
|
|
60
|
+
patientAge: queueEntry.patient.person?.age + '',
|
|
61
|
+
patientDob: queueEntry?.patient?.person?.birthdate
|
|
62
|
+
? formatDate(parseDate(queueEntry.patient.person.birthdate), { time: false })
|
|
63
|
+
: '--',
|
|
64
|
+
patientGender: queueEntry.patient.person.gender,
|
|
65
|
+
queue: queueEntry.queue,
|
|
66
|
+
priority: queueEntry.priority,
|
|
67
|
+
priorityComment: queueEntry.priorityComment,
|
|
68
|
+
status: queueEntry.status,
|
|
69
|
+
startedAt: dayjs(queueEntry.startedAt).toDate(),
|
|
70
|
+
endedAt: queueEntry.endedAt ? dayjs(queueEntry.endedAt).toDate() : null,
|
|
71
|
+
visitType: queueEntry.visit?.visitType?.display,
|
|
72
|
+
queueLocation: (queueEntry?.queue as any)?.location?.uuid,
|
|
73
|
+
visitTypeUuid: queueEntry.visit?.visitType?.uuid,
|
|
74
|
+
visitUuid: queueEntry.visit?.uuid,
|
|
75
|
+
queueUuid: queueEntry.queue.uuid,
|
|
76
|
+
queueEntryUuid: queueEntry.uuid,
|
|
77
|
+
sortWeight: queueEntry.sortWeight,
|
|
78
|
+
visitQueueNumber: queueEntry.visit?.attributes?.find((e) => e?.attributeType?.uuid === visitQueueNumberAttributeUuid)
|
|
79
|
+
?.value,
|
|
80
|
+
identifiers: queueEntry.patient?.identifiers as Identifer[],
|
|
81
|
+
queueComingFrom: queueEntry?.queueComingFrom?.name,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export function useQueueEntries(queue: string) {
|
|
85
|
+
// const queueEntryBaseUrl = `${restBaseUrl}/queue-entry?` +
|
|
86
|
+
// `isEnded=false&service=7f7ec7ad-cdd7-4ed9-bc2e-5c5bd9f065b2&location=18c343eb-b353-462a-9139-b16606e6b6c2`;
|
|
87
|
+
const queueEntryBaseUrl = `${restBaseUrl}/queue-entry?` + `isEnded=false&queue=${queue}`;
|
|
88
|
+
const {
|
|
89
|
+
data,
|
|
90
|
+
isValidating,
|
|
91
|
+
isLoading,
|
|
92
|
+
error: pageError,
|
|
93
|
+
} = useSWR<QueueEntryResponse, Error>(queueEntryBaseUrl, openmrsFetch);
|
|
94
|
+
|
|
95
|
+
const queueEntries = useMemo(() => data, [data]);
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
queueEntries,
|
|
99
|
+
isLoading,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function useQueues(service: string = '7f7ec7ad-cdd7-4ed9-bc2e-5c5bd9f065b2') {
|
|
104
|
+
const currentUserSession = useSession();
|
|
105
|
+
const location = currentUserSession?.sessionLocation?.uuid;
|
|
106
|
+
|
|
107
|
+
const customRepresentation = 'custom:(uuid,display,name)';
|
|
108
|
+
|
|
109
|
+
const apiUrl =
|
|
110
|
+
`${restBaseUrl}/queue?&service=${service}` +
|
|
111
|
+
(location ? `&location=${location}` : '') +
|
|
112
|
+
`&v=${customRepresentation}`;
|
|
113
|
+
|
|
114
|
+
const { data, isLoading } = useSWR<
|
|
115
|
+
{
|
|
116
|
+
data: {
|
|
117
|
+
results: Array<{
|
|
118
|
+
uuid: string;
|
|
119
|
+
display: string;
|
|
120
|
+
name: string;
|
|
121
|
+
}>;
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
Error
|
|
125
|
+
>(service ? apiUrl : null, openmrsFetch);
|
|
126
|
+
|
|
127
|
+
return { data, isLoading };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function useQueue(service: string = '7f7ec7ad-cdd7-4ed9-bc2e-5c5bd9f065b2') {
|
|
131
|
+
const currentUserSession = useSession();
|
|
132
|
+
const location = currentUserSession?.sessionLocation?.uuid;
|
|
133
|
+
|
|
134
|
+
const customRepresentation = 'custom:(uuid,display,name)';
|
|
135
|
+
|
|
136
|
+
const apiUrl =
|
|
137
|
+
`${restBaseUrl}/queue?&service=${service}` +
|
|
138
|
+
(location ? `&location=${location}` : '') +
|
|
139
|
+
`&v=${customRepresentation}`;
|
|
140
|
+
|
|
141
|
+
const { data, isLoading } = useSWR<
|
|
142
|
+
{
|
|
143
|
+
data: {
|
|
144
|
+
results: Array<{
|
|
145
|
+
uuid: string;
|
|
146
|
+
display: string;
|
|
147
|
+
name: string;
|
|
148
|
+
}>;
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
Error
|
|
152
|
+
>(service ? apiUrl : null, openmrsFetch);
|
|
153
|
+
|
|
154
|
+
return { data, isLoading };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export async function getServiceQueueByLocationUuid(
|
|
158
|
+
serviceUuid: string,
|
|
159
|
+
locationUuid: string,
|
|
160
|
+
): Promise<QueueEntryResult[]> {
|
|
161
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
162
|
+
const queueEntryUrl = `${etlBaseUrl}/queue-entry`;
|
|
163
|
+
const params = {
|
|
164
|
+
locationUuid: locationUuid,
|
|
165
|
+
serviceUuid: serviceUuid,
|
|
166
|
+
};
|
|
167
|
+
const queryString = new URLSearchParams(params).toString();
|
|
168
|
+
const response = await openmrsFetch(`${queueEntryUrl}?${queryString}`);
|
|
169
|
+
const result = await response.json();
|
|
170
|
+
return result.data;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export async function closeQueueEntry(entryQueueUuid: string): Promise<QueueEntryResult[]> {
|
|
174
|
+
const queueEntryUrl = `${restBaseUrl}/queue-entry/${entryQueueUuid}`;
|
|
175
|
+
const params = {
|
|
176
|
+
endedAt: new Date().toISOString(),
|
|
177
|
+
};
|
|
178
|
+
const response = await openmrsFetch(queueEntryUrl, {
|
|
179
|
+
method: 'POST',
|
|
180
|
+
headers: {
|
|
181
|
+
'content-type': 'application/json',
|
|
182
|
+
},
|
|
183
|
+
body: JSON.stringify(params),
|
|
184
|
+
});
|
|
185
|
+
const result = await response.json();
|
|
186
|
+
return result.data;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export async function getQueuesByLocationUuid(locationUuid: string): Promise<Queue[]> {
|
|
190
|
+
const queueUrl = `${restBaseUrl}/queue`;
|
|
191
|
+
const params = {
|
|
192
|
+
location: locationUuid,
|
|
193
|
+
v: 'full',
|
|
194
|
+
};
|
|
195
|
+
const queryString = new URLSearchParams(params).toString();
|
|
196
|
+
const response = await openmrsFetch(`${queueUrl}?${queryString}`);
|
|
197
|
+
const result = await response.json();
|
|
198
|
+
return result.results;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export async function deleteQueue(queueUuid: string): Promise<any> {
|
|
202
|
+
const queueUrl = `${restBaseUrl}/queue/${queueUuid}?!purge`;
|
|
203
|
+
const response = await openmrsFetch(queueUrl, {
|
|
204
|
+
method: 'DELETE',
|
|
205
|
+
});
|
|
206
|
+
return response;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export async function createQueue(createQueueDto: CreateQueueDto): Promise<Queue> {
|
|
210
|
+
const createQueueUrl = `${restBaseUrl}/queue/`;
|
|
211
|
+
const response = await openmrsFetch(createQueueUrl, {
|
|
212
|
+
method: 'POST',
|
|
213
|
+
headers: {
|
|
214
|
+
'content-type': 'application/json',
|
|
215
|
+
},
|
|
216
|
+
body: JSON.stringify(createQueueDto),
|
|
217
|
+
});
|
|
218
|
+
const result = await response.json();
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export async function editQueue(queueUuid: string, editQueueDto: CreateQueueDto): Promise<Queue> {
|
|
223
|
+
const editQueueUrl = `${restBaseUrl}/queue/${queueUuid}`;
|
|
224
|
+
const response = await openmrsFetch(editQueueUrl, {
|
|
225
|
+
method: 'POST',
|
|
226
|
+
headers: {
|
|
227
|
+
'content-type': 'application/json',
|
|
228
|
+
},
|
|
229
|
+
body: JSON.stringify(editQueueDto),
|
|
230
|
+
});
|
|
231
|
+
const result = await response.json();
|
|
232
|
+
return result;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export async function getQueueRoomsByLocationUuid(locationUuid: string): Promise<QueueRoom[]> {
|
|
236
|
+
const queueUrl = `${restBaseUrl}/queue-room`;
|
|
237
|
+
const v =
|
|
238
|
+
'custom:(uuid,display,name,description,queue:(uuid,display,location:(uuid,display),service:(uuid,display)))';
|
|
239
|
+
const params = {
|
|
240
|
+
location: locationUuid,
|
|
241
|
+
v: v,
|
|
242
|
+
};
|
|
243
|
+
const queryString = new URLSearchParams(params).toString();
|
|
244
|
+
const response = await openmrsFetch(`${queueUrl}?${queryString}`);
|
|
245
|
+
const result = await response.json();
|
|
246
|
+
return result.results;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export async function createQueueRoom(createQueueRoomDto: CreateQueueRoomDto): Promise<QueueRoom> {
|
|
250
|
+
const createQueueUrl = `${restBaseUrl}/queue-room/`;
|
|
251
|
+
const response = await openmrsFetch(createQueueUrl, {
|
|
252
|
+
method: 'POST',
|
|
253
|
+
headers: {
|
|
254
|
+
'content-type': 'application/json',
|
|
255
|
+
},
|
|
256
|
+
body: JSON.stringify(createQueueRoomDto),
|
|
257
|
+
});
|
|
258
|
+
const result = await response.json();
|
|
259
|
+
return result;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export async function deleteQueueRoom(queueRoomUuid: string): Promise<any> {
|
|
263
|
+
const queueUrl = `${restBaseUrl}/queue-room/${queueRoomUuid}?!purge`;
|
|
264
|
+
const response = await openmrsFetch(queueUrl, {
|
|
265
|
+
method: 'DELETE',
|
|
266
|
+
});
|
|
267
|
+
return response;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export async function editQueueRoom(queueRoomUuid: string, editQueueRoomDto: CreateQueueRoomDto): Promise<QueueRoom> {
|
|
271
|
+
const editQueueUrl = `${restBaseUrl}/queue-room/${queueRoomUuid}`;
|
|
272
|
+
const response = await openmrsFetch(editQueueUrl, {
|
|
273
|
+
method: 'POST',
|
|
274
|
+
headers: {
|
|
275
|
+
'content-type': 'application/json',
|
|
276
|
+
},
|
|
277
|
+
body: JSON.stringify(editQueueRoomDto),
|
|
278
|
+
});
|
|
279
|
+
const result = await response.json();
|
|
280
|
+
return result;
|
|
281
|
+
}
|
|
282
|
+
export async function getActiveQueueEntryByPatientUuid(patientUuid: string): Promise<QueueEntry[]> {
|
|
283
|
+
const queueUrl = `${restBaseUrl}/queue-entry`;
|
|
284
|
+
const v =
|
|
285
|
+
'custom:(uuid,display,queue,status,patient:(uuid,display,person,identifiers:(uuid,display,identifier,identifierType)),visit:(uuid,display,startDatetime,encounters:(uuid,display,diagnoses,encounterDatetime,encounterType,obs,encounterProviders,voided),attributes:(uuid,display,value,attributeType)),priority,priorityComment,sortWeight,startedAt,endedAt,locationWaitingFor,queueComingFrom,providerWaitingFor,previousQueueEntry)';
|
|
286
|
+
const params = {
|
|
287
|
+
patient: patientUuid,
|
|
288
|
+
v: v,
|
|
289
|
+
isEnded: 'false',
|
|
290
|
+
totalCount: 'true',
|
|
291
|
+
};
|
|
292
|
+
const queryString = new URLSearchParams(params).toString();
|
|
293
|
+
const response = await openmrsFetch(`${queueUrl}?${queryString}`);
|
|
294
|
+
const result = await response.json();
|
|
295
|
+
return result.results;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export async function getServiceQueueDailyReport(
|
|
299
|
+
serviceUuid: string,
|
|
300
|
+
locationUuid: string,
|
|
301
|
+
): Promise<ServiceQueueDailyReport[]> {
|
|
302
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
303
|
+
const reportUrl = `${etlBaseUrl}/service-queue-daily-report?serviceUuid=${serviceUuid}&locationUuid=${locationUuid}`;
|
|
304
|
+
const response = await openmrsFetch<ServiceQueueDailyReportResp>(reportUrl);
|
|
305
|
+
const result = await response.json();
|
|
306
|
+
return result.result;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export async function getServiceQueueDailyPatientListReport(
|
|
310
|
+
serviceUuid: string,
|
|
311
|
+
locationUuid: string,
|
|
312
|
+
): Promise<ServiceQueueReportPatientList[]> {
|
|
313
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
314
|
+
const reportUrl = `${etlBaseUrl}/service-queue-daily-report/patient-list?serviceUuid=${serviceUuid}&locationUuid=${locationUuid}`;
|
|
315
|
+
const response = await openmrsFetch<ServiceQueueDailyPatientListReportResp>(reportUrl);
|
|
316
|
+
const result: ServiceQueueDailyPatientListReportResp = await response.json();
|
|
317
|
+
if (result && result.results) {
|
|
318
|
+
return result.results.results ?? [];
|
|
319
|
+
} else {
|
|
320
|
+
return [];
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
export async function getQueueEntryByLocationUuid(locationUuid: string): Promise<QueueEntry[]> {
|
|
324
|
+
const queueUrl = `${restBaseUrl}/queue-entry`;
|
|
325
|
+
const v =
|
|
326
|
+
'custom:(uuid,display,queue,status,patient:(uuid,display,person),visit:(uuid,display,startDatetime,stopDatetime),priority,priorityComment,sortWeight,startedAt,endedAt,locationWaitingFor,queueComingFrom,providerWaitingFor,previousQueueEntry)';
|
|
327
|
+
const params = {
|
|
328
|
+
location: locationUuid,
|
|
329
|
+
v: v,
|
|
330
|
+
isEnded: 'false',
|
|
331
|
+
totalCount: 'true',
|
|
332
|
+
};
|
|
333
|
+
const queryString = new URLSearchParams(params).toString();
|
|
334
|
+
const response = await openmrsFetch(`${queueUrl}?${queryString}`);
|
|
335
|
+
const result = await response.json();
|
|
336
|
+
return result.results;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export async function deleteQueueEntry(queueEntryUuid: string): Promise<any> {
|
|
340
|
+
const queueUrl = `${restBaseUrl}/queue-entry/${queueEntryUuid}?!purge`;
|
|
341
|
+
const response = await openmrsFetch(queueUrl, {
|
|
342
|
+
method: 'DELETE',
|
|
343
|
+
});
|
|
344
|
+
return response;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export async function endQueueEntry(entryQueueUuid: string, endedAt: string): Promise<QueueEntryResult[]> {
|
|
348
|
+
const queueEntryUrl = `${restBaseUrl}/queue-entry/${entryQueueUuid}`;
|
|
349
|
+
const params = {
|
|
350
|
+
endedAt: endedAt,
|
|
351
|
+
};
|
|
352
|
+
const response = await openmrsFetch(queueEntryUrl, {
|
|
353
|
+
method: 'POST',
|
|
354
|
+
headers: {
|
|
355
|
+
'content-type': 'application/json',
|
|
356
|
+
},
|
|
357
|
+
body: JSON.stringify(params),
|
|
358
|
+
});
|
|
359
|
+
const result = await response.json();
|
|
360
|
+
return result.data;
|
|
361
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
import { type ServiceQueue } from '../registry/types';
|
|
3
|
+
import { type TransitionQueueEntryDto } from '../types/types';
|
|
4
|
+
|
|
5
|
+
export async function getServiceQueueByLocation(locationUuid: string): Promise<ServiceQueue[]> {
|
|
6
|
+
const params = {
|
|
7
|
+
v: 'custom:(uuid,name,location:(uuid,display))',
|
|
8
|
+
location: locationUuid,
|
|
9
|
+
};
|
|
10
|
+
const queryString = new URLSearchParams(params).toString();
|
|
11
|
+
const queueEntryUrl = `${restBaseUrl}/queue`;
|
|
12
|
+
const response = await openmrsFetch(`${queueEntryUrl}?${queryString}`);
|
|
13
|
+
const result = await response.json();
|
|
14
|
+
return result.results;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function transitionQueueEntry(transitionQueueEntryDto: TransitionQueueEntryDto) {
|
|
18
|
+
const url = `${restBaseUrl}/queue-entry/transition`;
|
|
19
|
+
const resp = await openmrsFetch(url, {
|
|
20
|
+
method: 'POST',
|
|
21
|
+
headers: {
|
|
22
|
+
'content-type': 'application/json',
|
|
23
|
+
},
|
|
24
|
+
body: JSON.stringify(transitionQueueEntryDto),
|
|
25
|
+
});
|
|
26
|
+
const res = await resp.json();
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const SEPARATED_UUID = 'a899aba0-1350-11df-a1f1-0026b9348838';
|
|
2
|
+
const NEVER_MARRIED_UUID = 'a899ac7c-1350-11df-a1f1-0026b9348838';
|
|
3
|
+
const DIVORCED_UUID = 'a899ad58-1350-11df-a1f1-0026b9348838';
|
|
4
|
+
const WIDOWED_UUID = 'a899ae34-1350-11df-a1f1-0026b9348838';
|
|
5
|
+
const MARRIED_UUID = 'a8aa76b0-1350-11df-a1f1-0026b9348838';
|
|
6
|
+
const LIVING_WITH_PARTNER_UUID = 'a899af10-1350-11df-a1f1-0026b9348838';
|
|
7
|
+
const FRIEND_UUID = 'a8aaf07c-1350-11df-a1f1-0026b9348838';
|
|
8
|
+
const NOT_APPLICABLE_UUID = 'a89ad3a4-1350-11df-a1f1-0026b9348838';
|
|
9
|
+
const POLYGAMOUS_UUID = 'a8b03712-1350-11df-a1f1-0026b9348838';
|
|
10
|
+
const PARTNER_UUID = 'a89ebd3e-1350-11df-a1f1-0026b9348838';
|
|
11
|
+
const CASUAL_SEX_PARTNER_UUID = '7831f002-331d-4f07-bf91-6bb65cd31050';
|
|
12
|
+
const OTHER_UUID = 'a8aaf3e2-1350-11df-a1f1-0026b9348838';
|
|
13
|
+
const SINGLE_UUID = 'a899ac7c-1350-11df-a1f1-0026b9348838';
|
|
14
|
+
|
|
15
|
+
export const CivilStatusUids = {
|
|
16
|
+
SEPARATED_UUID,
|
|
17
|
+
NEVER_MARRIED_UUID,
|
|
18
|
+
DIVORCED_UUID,
|
|
19
|
+
WIDOWED_UUID,
|
|
20
|
+
MARRIED_UUID,
|
|
21
|
+
LIVING_WITH_PARTNER_UUID,
|
|
22
|
+
FRIEND_UUID,
|
|
23
|
+
NOT_APPLICABLE_UUID,
|
|
24
|
+
POLYGAMOUS_UUID,
|
|
25
|
+
PARTNER_UUID,
|
|
26
|
+
CASUAL_SEX_PARTNER_UUID,
|
|
27
|
+
SINGLE_UUID,
|
|
28
|
+
OTHER_UUID,
|
|
29
|
+
};
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
const NORMAL_PRIORITY_UUID = 'bbd99c12-67e9-4381-8b4c-1f231e86f8e2';
|
|
2
2
|
const EMERGENCY_PRIORITY_UUID = '8e86ff12-ec83-41e8-a534-bb410739d880';
|
|
3
|
+
const NOT_URGENT_PRIORITY_UUID = '26995049-fc00-43f4-a725-851fd517a1ac';
|
|
3
4
|
|
|
4
5
|
const WAITING_UUID = '89d01aa5-0ab0-4626-934b-37766b4cd779';
|
|
5
6
|
const IN_SERVICE_UUID = 'f9cf5768-508f-45de-8d40-eaf6ea3f3b02';
|
|
6
7
|
const COMPLETED_UUID = 'a89c1ef8-1350-11df-a1f1-0026b9348838';
|
|
7
8
|
|
|
9
|
+
const TRIAGE_SERVICE_UUID = '2d4472e2-d7ab-4430-8e0e-a9ffcd809bf4';
|
|
10
|
+
const CLINICAL_CONSULTATION_SERVICE_UUID = '7f7ec7ad-cdd7-4ed9-bc2e-5c5bd9f065b2';
|
|
11
|
+
|
|
12
|
+
const MCH_TRIAGE_SERVICE_UUID = '7e4452bf-f9b7-4977-a21f-1c8b94831bac';
|
|
13
|
+
const MCH_CLINICAL_CONSULTATION_SERVICE_UUID = '0026e273-5f8c-46b5-8bb4-0d8301d50321';
|
|
14
|
+
|
|
8
15
|
export const QUEUE_PRIORITIES_UUIDS = {
|
|
9
16
|
NORMAL_PRIORITY_UUID,
|
|
10
17
|
EMERGENCY_PRIORITY_UUID,
|
|
18
|
+
NOT_URGENT_PRIORITY_UUID,
|
|
11
19
|
};
|
|
12
20
|
|
|
13
21
|
export const QUEUE_STATUS_UUIDS = {
|
|
@@ -15,3 +23,10 @@ export const QUEUE_STATUS_UUIDS = {
|
|
|
15
23
|
IN_SERVICE_UUID,
|
|
16
24
|
COMPLETED_UUID,
|
|
17
25
|
};
|
|
26
|
+
|
|
27
|
+
export const QUEUE_SERVICE_UUIDS = {
|
|
28
|
+
TRIAGE_SERVICE_UUID,
|
|
29
|
+
CLINICAL_CONSULTATION_SERVICE_UUID,
|
|
30
|
+
MCH_TRIAGE_SERVICE_UUID,
|
|
31
|
+
MCH_CLINICAL_CONSULTATION_SERVICE_UUID,
|
|
32
|
+
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const OPENMRS_BASE_URL = 'https://staging.ampath.or.ke/openmrs/ws/rest/v1';
|
|
1
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const CONTACT_PHONE_NUMBER_UUID = '72a759a8-1359-11df-a1f1-0026b9348838';
|
|
2
|
+
const CITIZENSHIP_UUID = '8d871afc-c2cc-11de-8d13-0010c6dffd0f';
|
|
3
|
+
const CONTACT_EMAIL_ADDRESS_UUID = '2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa';
|
|
4
|
+
const ALTERNATIVE_CONTACT_PHONE_NUMBER_UUID = 'c725f524-c14a-4468-ac19-4a0e6661c930';
|
|
5
|
+
const KRA_PIN_UUID = 'ae683747-b3fc-4e5c-bad3-c3be743b248f';
|
|
6
|
+
const CIVIL_STATUS_UUID = '8d871f2a-c2cc-11de-8d13-0010c6dffd0f';
|
|
7
|
+
const CLIENT_REGISTRY_ID_UUID = 'e068e02b-faac-4baf-bd58-fe6e0c29a81f';
|
|
8
|
+
const PLACE_OF_BIRTH_UUID = '8d8718c2-c2cc-11de-8d13-0010c6dffd0f';
|
|
9
|
+
const EMAIL_UUID = '2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa';
|
|
10
|
+
const HIGHEST_LEVEL_OF_EDUCATION_UUID = '352b0d51-63c6-47d0-a295-156bebee4fd5';
|
|
11
|
+
const RELIGION_UUID = '4ae16101-cfba-4c08-9c9c-d848e6f609aa';
|
|
12
|
+
const OCCUPATION_UUID = '9e86409f-9c20-42d0-aeb3-f29a4ca0a7a0';
|
|
13
|
+
const NEXT_OF_KIN_CONTACT_PHONE_NUMBER_UUID = 'a657a4f1-9c0f-444b-a1fd-445bb91dd12d';
|
|
14
|
+
const NEXT_OF_KIN_NAME_UUID = '72a75bec-1359-11df-a1f1-0026b9348838';
|
|
15
|
+
const NEXT_OF_KIN_RELATIONSHIP_UUID = '5730994e-c267-426b-87b6-c152b606973d';
|
|
16
|
+
|
|
17
|
+
export const PersonAttributeTypeUuids = {
|
|
18
|
+
CONTACT_PHONE_NUMBER_UUID,
|
|
19
|
+
CITIZENSHIP_UUID,
|
|
20
|
+
CONTACT_EMAIL_ADDRESS_UUID,
|
|
21
|
+
ALTERNATIVE_CONTACT_PHONE_NUMBER_UUID,
|
|
22
|
+
KRA_PIN_UUID,
|
|
23
|
+
CIVIL_STATUS_UUID,
|
|
24
|
+
CLIENT_REGISTRY_ID_UUID,
|
|
25
|
+
PLACE_OF_BIRTH_UUID,
|
|
26
|
+
EMAIL_UUID,
|
|
27
|
+
HIGHEST_LEVEL_OF_EDUCATION_UUID,
|
|
28
|
+
RELIGION_UUID,
|
|
29
|
+
OCCUPATION_UUID,
|
|
30
|
+
NEXT_OF_KIN_CONTACT_PHONE_NUMBER_UUID,
|
|
31
|
+
NEXT_OF_KIN_NAME_UUID,
|
|
32
|
+
NEXT_OF_KIN_RELATIONSHIP_UUID,
|
|
33
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
import { type CreateBillDto, type BillableService, type PaymentMode, type CashPoint } from '../types';
|
|
3
|
+
|
|
4
|
+
export async function fetchPaymentModes(): Promise<PaymentMode[]> {
|
|
5
|
+
const paymentModeUrl = `${restBaseUrl}/billing/paymentMode`;
|
|
6
|
+
const resp = await openmrsFetch(paymentModeUrl);
|
|
7
|
+
const data = await resp.json();
|
|
8
|
+
return data.results ?? [];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function fetchBillableServices(): Promise<BillableService[]> {
|
|
12
|
+
const v = 'full';
|
|
13
|
+
const billableServiceUrl = `${restBaseUrl}/billing/billableService`;
|
|
14
|
+
const resp = await openmrsFetch(`${billableServiceUrl}?v=${v}`);
|
|
15
|
+
const data = await resp.json();
|
|
16
|
+
return data.results ?? [];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function createBill(createBillDto: CreateBillDto) {
|
|
20
|
+
const createBillUrl = `${restBaseUrl}/billing/bill`;
|
|
21
|
+
const response = await openmrsFetch(createBillUrl, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
headers: {
|
|
24
|
+
'content-type': 'application/json',
|
|
25
|
+
},
|
|
26
|
+
body: JSON.stringify(createBillDto),
|
|
27
|
+
});
|
|
28
|
+
const result = await response.json();
|
|
29
|
+
return result.results ?? [];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function fetchCashPoints(): Promise<CashPoint[]> {
|
|
33
|
+
const v = 'full';
|
|
34
|
+
const cashPointUrl = `${restBaseUrl}/billing/cashPoint?v=${v}`;
|
|
35
|
+
const resp = await openmrsFetch(cashPointUrl);
|
|
36
|
+
const data = await resp.json();
|
|
37
|
+
return data.results ?? [];
|
|
38
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type HieClientPaymentMode, type CreateClientPaymentModeDto } from '../types';
|
|
2
|
+
import { getHieBaseUrl } from '../utils/get-base-url';
|
|
3
|
+
|
|
4
|
+
export async function createClientPaymentMode(
|
|
5
|
+
createClientPaymentModeDto: CreateClientPaymentModeDto,
|
|
6
|
+
): Promise<HieClientPaymentMode> {
|
|
7
|
+
const hieBaseUrl = await getHieBaseUrl();
|
|
8
|
+
const url = `${hieBaseUrl}/client-payment-mode`;
|
|
9
|
+
const response = await fetch(url, {
|
|
10
|
+
method: 'POST',
|
|
11
|
+
headers: {
|
|
12
|
+
'Content-Type': 'application/json',
|
|
13
|
+
},
|
|
14
|
+
body: JSON.stringify(createClientPaymentModeDto),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const data = response.json();
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function fetchClientPaymentMode(clientId: string): Promise<HieClientPaymentMode> {
|
|
22
|
+
const hieBaseUrl = await getHieBaseUrl();
|
|
23
|
+
const url = `${hieBaseUrl}/client-payment-mode?clientId=${clientId}`;
|
|
24
|
+
const response = await fetch(url);
|
|
25
|
+
const data = response.json();
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type HieBillPayment } from '../types';
|
|
2
|
+
import { getHieBaseUrl } from '../utils/get-base-url';
|
|
3
|
+
|
|
4
|
+
export async function createClientPayment(createClientBillPaymentDto: HieBillPayment): Promise<HieBillPayment> {
|
|
5
|
+
const hieBaseUrl = await getHieBaseUrl();
|
|
6
|
+
const url = `${hieBaseUrl}/payment`;
|
|
7
|
+
const response = await fetch(url, {
|
|
8
|
+
method: 'POST',
|
|
9
|
+
headers: {
|
|
10
|
+
'Content-Type': 'application/json',
|
|
11
|
+
},
|
|
12
|
+
body: JSON.stringify(createClientBillPaymentDto),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const data = response.json();
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type HieClientEligibility, type EligibilityFilterDto } from '../../registry/types';
|
|
2
|
+
import { getHieBaseUrl } from '../utils/get-base-url';
|
|
3
|
+
|
|
4
|
+
export async function getClientEligibityStatus(
|
|
5
|
+
eligibilityFilterDto: EligibilityFilterDto,
|
|
6
|
+
): Promise<HieClientEligibility> {
|
|
7
|
+
const hieBaseUrl = await getHieBaseUrl();
|
|
8
|
+
const url = `${hieBaseUrl}/eligibility`;
|
|
9
|
+
const response = await fetch(url, {
|
|
10
|
+
method: 'POST',
|
|
11
|
+
headers: {
|
|
12
|
+
'Content-Type': 'application/json',
|
|
13
|
+
},
|
|
14
|
+
body: JSON.stringify(eligibilityFilterDto),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const data = response.json();
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Encounter, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
import { type CreateOrderEncounterDto } from '../types';
|
|
3
|
+
|
|
4
|
+
export async function fetchPatientEncountersByType(patientUuid: string, encounterTypeUuid: string) {
|
|
5
|
+
const res = await openmrsFetch(
|
|
6
|
+
`${restBaseUrl}/encounter?patient=${patientUuid}&encounterType=${encounterTypeUuid}&v=full`,
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
return res.data.results ?? [];
|
|
10
|
+
}
|
|
11
|
+
export async function getPatientEncounters(patientUuid: string) {
|
|
12
|
+
const res = await openmrsFetch(`${restBaseUrl}/encounter?patient=${patientUuid}&v=full`);
|
|
13
|
+
|
|
14
|
+
return res.data.results ?? [];
|
|
15
|
+
}
|
|
16
|
+
export async function createOrderEncounter(createOrderEncounterDto: CreateOrderEncounterDto): Promise<Encounter> {
|
|
17
|
+
const encounterUrl = `${restBaseUrl}/encounter`;
|
|
18
|
+
const response = await openmrsFetch(encounterUrl, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
headers: {
|
|
21
|
+
'content-type': 'application/json',
|
|
22
|
+
},
|
|
23
|
+
body: JSON.stringify(createOrderEncounterDto),
|
|
24
|
+
});
|
|
25
|
+
const result = await response.json();
|
|
26
|
+
return result ?? null;
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Location, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
|
|
3
|
+
export async function getLocationByUuid(locationUuid: string): Promise<Location> {
|
|
4
|
+
const locationBaseUrl = `${restBaseUrl}/location`;
|
|
5
|
+
const locationUrl = `${locationBaseUrl}/${locationUuid}`;
|
|
6
|
+
const resp = await openmrsFetch(locationUrl);
|
|
7
|
+
const data = await resp.json();
|
|
8
|
+
return data ?? null;
|
|
9
|
+
}
|