@ampath/esm-dha-workflow-app 4.0.0-claim-workflows.159
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/.editorconfig +12 -0
- package/.eslintignore +2 -0
- package/.eslintrc +57 -0
- package/.husky/pre-commit +7 -0
- package/.husky/pre-push +6 -0
- package/.prettierignore +14 -0
- package/.turbo.json +18 -0
- package/.yarn/plugins/@yarnpkg/plugin-outdated.cjs +35 -0
- package/LICENSE +401 -0
- package/README.md +37 -0
- package/__mocks__/react-i18next.js +50 -0
- package/dist/1197.js +1 -0
- package/dist/1277.js +1 -0
- package/dist/1277.js.map +1 -0
- package/dist/1558.js +2 -0
- package/dist/1558.js.LICENSE.txt +14 -0
- package/dist/1558.js.map +1 -0
- package/dist/1729.js +1 -0
- package/dist/1729.js.map +1 -0
- package/dist/182.js +1 -0
- package/dist/182.js.map +1 -0
- package/dist/1826.js +1 -0
- package/dist/1826.js.map +1 -0
- package/dist/1833.js +1 -0
- package/dist/1833.js.map +1 -0
- package/dist/1856.js +1 -0
- package/dist/1856.js.map +1 -0
- package/dist/1925.js +1 -0
- package/dist/1925.js.map +1 -0
- package/dist/2021.js +1 -0
- package/dist/2021.js.map +1 -0
- package/dist/2054.js +1 -0
- package/dist/2054.js.map +1 -0
- package/dist/2177.js +2 -0
- package/dist/2177.js.LICENSE.txt +9 -0
- package/dist/2177.js.map +1 -0
- package/dist/2333.js +1 -0
- package/dist/2333.js.map +1 -0
- package/dist/2801.js +1 -0
- package/dist/2801.js.map +1 -0
- package/dist/282.js +2 -0
- package/dist/282.js.LICENSE.txt +32 -0
- package/dist/282.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.LICENSE.txt +14 -0
- package/dist/3184.js.map +1 -0
- package/dist/3654.js +1 -0
- package/dist/3654.js.map +1 -0
- package/dist/4055.js +1 -0
- package/dist/4205.js +1 -0
- package/dist/4205.js.map +1 -0
- package/dist/4225.js +1 -0
- package/dist/4225.js.map +1 -0
- package/dist/4300.js +1 -0
- package/dist/4335.js +1 -0
- package/dist/4353.js +1 -0
- package/dist/4353.js.map +1 -0
- package/dist/4517.js +1 -0
- package/dist/4517.js.map +1 -0
- package/dist/4652.js +1 -0
- package/dist/4674.js +1 -0
- package/dist/4674.js.map +1 -0
- package/dist/4947.js +1 -0
- package/dist/4947.js.map +1 -0
- package/dist/5015.js +1 -0
- package/dist/5015.js.map +1 -0
- package/dist/5422.js +1 -0
- package/dist/5422.js.map +1 -0
- package/dist/5428.js +1 -0
- package/dist/5428.js.map +1 -0
- package/dist/5752.js +1 -0
- package/dist/5752.js.map +1 -0
- package/dist/5851.js +1 -0
- package/dist/5851.js.map +1 -0
- package/dist/6260.js +1 -0
- package/dist/6260.js.map +1 -0
- package/dist/6264.js +1 -0
- package/dist/6264.js.map +1 -0
- package/dist/6540.js +2 -0
- package/dist/6540.js.LICENSE.txt +9 -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/8321.js +1 -0
- package/dist/8321.js.map +1 -0
- package/dist/8339.js +1 -0
- package/dist/8339.js.map +1 -0
- package/dist/8558.js +1 -0
- package/dist/8558.js.map +1 -0
- package/dist/8778.js +1 -0
- package/dist/8778.js.map +1 -0
- package/dist/8803.js +2 -0
- package/dist/8803.js.LICENSE.txt +54 -0
- package/dist/8803.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/961.js +2 -0
- package/dist/961.js.LICENSE.txt +19 -0
- package/dist/961.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 +1594 -0
- package/dist/esm-dha-workflow-app.js.map +1 -0
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/e2e/README.md +115 -0
- package/e2e/core/global-setup.ts +32 -0
- package/e2e/core/index.ts +1 -0
- package/e2e/core/test.ts +20 -0
- package/e2e/fixtures/api.ts +26 -0
- package/e2e/fixtures/index.ts +1 -0
- package/e2e/pages/index.ts +1 -0
- package/e2e/pages/root-page.ts +32 -0
- package/e2e/specs/template-app.spec.ts +23 -0
- package/e2e/support/github/Dockerfile +34 -0
- package/e2e/support/github/docker-compose.yml +24 -0
- package/e2e/support/github/run-e2e-docker-env.sh +37 -0
- package/example.env +6 -0
- package/jest.config.js +33 -0
- package/package.json +117 -0
- package/playwright.config.ts +32 -0
- package/prettier.config.js +8 -0
- package/src/accounting/accounting.component.tsx +13 -0
- package/src/admissions/admission-request-list/admission-request-list.scss +0 -0
- package/src/admissions/admission-request-list/admission-request-list.tsx +134 -0
- package/src/admissions/admissions-dashboard.component.scss +15 -0
- package/src/admissions/admissions-dashboard.component.tsx +160 -0
- package/src/admissions/admissions.resource.ts +101 -0
- package/src/admissions/admitted-list/admitted-patients-list.tsx +141 -0
- package/src/admissions/constants/index.ts +33 -0
- package/src/admissions/discharged-list/discharged-list.scss +0 -0
- package/src/admissions/discharged-list/discharged-list.tsx +58 -0
- package/src/admissions/inpatient/admission-history/patient-admission-history.tsx +76 -0
- package/src/admissions/inpatient/admission-requests/patient-admission-requests.scss +19 -0
- package/src/admissions/inpatient/admission-requests/patient-admission-requests.tsx +72 -0
- package/src/admissions/inpatient/inpatient-admissions.component.scss +7 -0
- package/src/admissions/inpatient/inpatient-admissions.component.tsx +46 -0
- package/src/admissions/modal/admit-elsewhere/admit-elsewhere.modal.scss +23 -0
- package/src/admissions/modal/admit-elsewhere/admit-elsewhere.modal.tsx +156 -0
- package/src/admissions/modal/admit-patient/admit-patient.modal.scss +0 -0
- package/src/admissions/modal/admit-patient/admit-patient.modal.tsx +109 -0
- package/src/admissions/modal/bed-swap/bed-swap.modal.scss +0 -0
- package/src/admissions/modal/bed-swap/bed-swap.modal.tsx +102 -0
- package/src/admissions/modal/cancel-admission-request/cancel-admission-request.scss +11 -0
- package/src/admissions/modal/cancel-admission-request/cancel-admission-request.tsx +105 -0
- package/src/admissions/modal/discharge/discharge-patient.modal.scss +13 -0
- package/src/admissions/modal/discharge/discharge-patient.modal.tsx +84 -0
- package/src/admissions/types/index.ts +192 -0
- package/src/appointments/appointments.component.tsx +13 -0
- package/src/billing/api/billing.api.ts +107 -0
- package/src/billing/billing-root.tsx +20 -0
- package/src/billing/dashboard/billingDashboard.component.scss +0 -0
- package/src/billing/dashboard/billingDashboard.component.tsx +25 -0
- package/src/billing/extensions/visit-billing/visit-billing.extension.scss +0 -0
- package/src/billing/extensions/visit-billing/visit-billing.extension.tsx +508 -0
- package/src/billing/invoice/bill.resource.ts +47 -0
- package/src/billing/invoice/invoice-header/header-card/header-card.scss +17 -0
- package/src/billing/invoice/invoice-header/header-card/header-card.tsx +21 -0
- package/src/billing/invoice/invoice.scss +113 -0
- package/src/billing/invoice/invoice.tsx +1441 -0
- package/src/billing/invoice/line-items/line-items.scss +0 -0
- package/src/billing/invoice/line-items/line-items.tsx +120 -0
- package/src/billing/invoice/modal/delete-bill-item/delete-bill-item.modal.scss +23 -0
- package/src/billing/invoice/modal/delete-bill-item/delete-bill-item.modal.tsx +114 -0
- package/src/billing/invoice/modal/edit-bill-item/edit-bill-item.modal.scss +0 -0
- package/src/billing/invoice/modal/edit-bill-item/edit-bill-item.modal.tsx +122 -0
- package/src/billing/invoice/payment-details/payment-details.scss +0 -0
- package/src/billing/invoice/payment-details/payment-details.tsx +43 -0
- package/src/billing/invoice/print-invoice/print-receipt.component.tsx +44 -0
- package/src/billing/invoice/print-invoice/print-receipt.scss +14 -0
- package/src/billing/types/index.ts +84 -0
- package/src/billing/utils/index.ts +17 -0
- package/src/billing/widgets/billingTotalsRow.component.scss +0 -0
- package/src/billing/widgets/billingTotalsRow.component.tsx +712 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/create-order-bill-form.resource.ts +103 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/create-order-bill-form.scss +58 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/create-order-bill-form.workspace.tsx +357 -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/claims/claims.component.tsx +142 -0
- package/src/claims/claims.resource.ts +168 -0
- package/src/claims/index.ts +206 -0
- package/src/claims/interventions.resource.ts +49 -0
- package/src/claims/utils.ts +59 -0
- package/src/config-schema.ts +215 -0
- package/src/createDashboardLink.tsx +9 -0
- package/src/dashboard/charts/chart.component.scss +13 -0
- package/src/dashboard/charts/chart.component.tsx +56 -0
- package/src/dashboard/dashboard.component.scss +7 -0
- package/src/dashboard/dashboard.component.tsx +51 -0
- package/src/dashboard/overview/overview.component.scss +150 -0
- package/src/dashboard/overview/overview.component.tsx +134 -0
- package/src/dashboard/patient-list/patient-list.component.tsx +41 -0
- package/src/dashboard-meta/accounting-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/admissions-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/billing-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/bookings-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/consultation-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/dha-workflow-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/inpatient-admissions.meta.ts +6 -0
- package/src/dashboard-meta/maternity-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/mch-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/pharmacy-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/queue-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/registers-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/registry-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/service-queue-admin.meta.ts +6 -0
- package/src/dashboard-meta/triage-dashboard.meta.ts +6 -0
- package/src/declarations.d.ts +5 -0
- package/src/hooks/useActions.ts +165 -0
- package/src/index.ts +161 -0
- package/src/laboratory/laboratory.component.tsx +13 -0
- package/src/left-panel/left-panel.component.tsx +20 -0
- package/src/left-panel/left-panel.scss +42 -0
- package/src/mnch/maternity/maternity-queues.component.scss +7 -0
- package/src/mnch/maternity/maternity-queues.component.tsx +28 -0
- package/src/mnch/maternity/queues/triage/maternity-triage.tsx +15 -0
- package/src/mnch/mch/mch-queues.component.scss +7 -0
- package/src/mnch/mch/mch-queues.component.tsx +32 -0
- package/src/mnch/mch/queues/consultation/mch-consultation.tsx +18 -0
- package/src/mnch/mch/queues/triage/mch-triage.tsx +15 -0
- package/src/mnch/mnch-root.tsx +17 -0
- package/src/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/client-details/client-details.tsx +40 -0
- package/src/registry/eligibility/eligibility-details/eligibility-details.scss +38 -0
- package/src/registry/eligibility/eligibility-details/eligibility-details.tsx +101 -0
- package/src/registry/eligibility/eliigibility-tags/eligibility-tags.scss +6 -0
- package/src/registry/eligibility/eliigibility-tags/eligibility-tags.tsx +120 -0
- package/src/registry/eligibility/modal/eligibility-details.modal.scss +0 -0
- package/src/registry/eligibility/modal/eligibility-details.modal.tsx +45 -0
- package/src/registry/modal/client-details-modal/client-details-modal.scss +28 -0
- package/src/registry/modal/client-details-modal/client-details-modal.tsx +119 -0
- package/src/registry/modal/otp-verification-modal/otp-verification-modal.scss +43 -0
- package/src/registry/modal/otp-verification-modal/otp-verification-modal.tsx +280 -0
- package/src/registry/modal/send-to-triage/send-to-triage.modal.scss +39 -0
- package/src/registry/modal/send-to-triage/send-to-triage.modal.tsx +921 -0
- package/src/registry/payment-details/payment-options/payment-options.scss +13 -0
- package/src/registry/payment-details/payment-options/payment-options.tsx +68 -0
- package/src/registry/registry.component.scss +89 -0
- package/src/registry/registry.component.tsx +490 -0
- package/src/registry/registry.resource.ts +62 -0
- package/src/registry/types/index.ts +401 -0
- package/src/registry/utils/error-handler.ts +37 -0
- package/src/registry/utils/format-dependant-display-data.ts +8 -0
- package/src/registry/utils/hie-adapter.ts +56 -0
- package/src/registry/utils/hie-client-adapter.ts +312 -0
- package/src/registry/utils/mask-data.ts +32 -0
- package/src/registry/utils/phone-number-formatter.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/patient-search.resource.ts +22 -0
- package/src/resources/queue.resource.ts +60 -0
- package/src/resources/superset.resource.ts +21 -0
- package/src/resources/visit.resource.ts +38 -0
- package/src/root.component.tsx +48 -0
- package/src/root.scss +11 -0
- package/src/root.test.tsx +51 -0
- package/src/routes.json +292 -0
- 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 +143 -0
- package/src/service-queues/admin/queue/modal/edit-queue/edit-queue.modal.scss +0 -0
- package/src/service-queues/admin/queue/modal/edit-queue/edit-queue.modal.tsx +154 -0
- package/src/service-queues/admin/queue/queue-list/queue-list.scss +33 -0
- package/src/service-queues/admin/queue/queue-list/queue-list.tsx +113 -0
- package/src/service-queues/admin/queue-entry/queue-entry-list.component.scss +6 -0
- package/src/service-queues/admin/queue-entry/queue-entry-list.component.tsx +137 -0
- package/src/service-queues/admin/queue-room/modal/create-queue-room/create-queue-room.modal.scss +31 -0
- package/src/service-queues/admin/queue-room/modal/create-queue-room/create-queue-room.modal.tsx +137 -0
- package/src/service-queues/admin/queue-room/modal/edit-queue-room/edit-queue-room.modal.scss +0 -0
- package/src/service-queues/admin/queue-room/modal/edit-queue-room/edit-queue-room.modal.tsx +146 -0
- package/src/service-queues/admin/queue-room/queue-room-list/queue-room-list.scss +22 -0
- package/src/service-queues/admin/queue-room/queue-room-list/queue-room-list.tsx +120 -0
- package/src/service-queues/admin/service-queue-admin-dashboard.component.scss +6 -0
- package/src/service-queues/admin/service-queue-admin-dashboard.component.tsx +34 -0
- package/src/service-queues/consultation/consultation.component.scss +7 -0
- package/src/service-queues/consultation/consultation.component.tsx +15 -0
- package/src/service-queues/extensions/service-queue-patient-banner/service-queue-patient-banner.scss +30 -0
- package/src/service-queues/extensions/service-queue-patient-banner/service-queue-patient-banner.tsx +108 -0
- package/src/service-queues/metrics/metrics-cards/attended-patients.extension.tsx +38 -0
- package/src/service-queues/metrics/metrics-cards/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 +110 -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 +56 -0
- package/src/service-queues/queue-list/queue-list.component.tsx +311 -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 +387 -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 +35 -0
- package/src/shared/constants/index.ts +1 -0
- package/src/shared/constants/patient-category.ts +6 -0
- package/src/shared/constants/patient-type.ts +10 -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 +20 -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 +153 -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/side-menu.scss +38 -0
- package/src/side-nav-menu/mnch-nav-link-config.ts +16 -0
- package/src/side-nav-menu/mnch-nav-links.tsx +42 -0
- package/src/side-nav-menu/nav-link-config.ts +78 -0
- package/src/side-nav-menu/nav-links.tsx +42 -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/src/widgets/workflow-registry-link.extension.tsx +12 -0
- package/tools/i18next-parser.config.js +89 -0
- package/tools/setup-tests.ts +1 -0
- package/tools/update-openmrs-deps.mjs +43 -0
- package/translations/am.json +24 -0
- package/translations/en.json +24 -0
- package/translations/es.json +24 -0
- package/translations/fr.json +24 -0
- package/translations/he.json +24 -0
- package/translations/km.json +24 -0
- package/tsconfig.json +24 -0
- package/webpack.config.js +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ampath/esm-dha-workflow-app",
|
|
3
|
+
"version": "4.0.0-claim-workflows.159",
|
|
4
|
+
"license": "MPL-2.0",
|
|
5
|
+
"description": "An OpenMRS seed application for building microfrontends",
|
|
6
|
+
"browser": "dist/esm-dha-workflow-app.js",
|
|
7
|
+
"main": "src/index.ts",
|
|
8
|
+
"source": true,
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "openmrs develop",
|
|
11
|
+
"dev": "openmrs develop --backend=https://staging.ampath.or.ke --api-url=/openmrs --config-url=https://ngx.ampath.or.ke/o3-config.json --port=9000",
|
|
12
|
+
"serve": "webpack serve --mode=development",
|
|
13
|
+
"build": "webpack --mode production",
|
|
14
|
+
"analyze": "webpack --mode=production --env analyze=true",
|
|
15
|
+
"lint": "eslint src --ext js,jsx,ts,tsx --max-warnings 0",
|
|
16
|
+
"prettier": "prettier --write \"src/**/*.{ts,tsx}\" --list-different",
|
|
17
|
+
"typescript": "tsc",
|
|
18
|
+
"test": "jest --config jest.config.js --passWithNoTests",
|
|
19
|
+
"verify": "turbo lint typescript coverage",
|
|
20
|
+
"coverage": "yarn test --coverage",
|
|
21
|
+
"prepare": "husky install",
|
|
22
|
+
"extract-translations": "i18next 'src/**/*.component.tsx' --config ./tools/i18next-parser.config.js",
|
|
23
|
+
"test-e2e": "playwright test"
|
|
24
|
+
},
|
|
25
|
+
"browserslist": [
|
|
26
|
+
"extends browserslist-config-openmrs"
|
|
27
|
+
],
|
|
28
|
+
"keywords": [
|
|
29
|
+
"openmrs",
|
|
30
|
+
"microfrontends"
|
|
31
|
+
],
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/openmrs/openmrs-esm-home-app.git"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/openmrs/openmrs-esm-home-app#readme",
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/openmrs/openmrs-esm-home-app/issues"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@carbon/react": "^1.83.0",
|
|
45
|
+
"@hookform/resolvers": "^3.1.1",
|
|
46
|
+
"@superset-ui/embedded-sdk": "^0.3.0",
|
|
47
|
+
"lodash-es": "^4.17.21",
|
|
48
|
+
"react-hook-form": "^7.45.1",
|
|
49
|
+
"react-to-print": "^3.1.1",
|
|
50
|
+
"zod": "^3.21.4"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@openmrs/esm-framework": "*",
|
|
54
|
+
"@openmrs/esm-patient-common-lib": "*",
|
|
55
|
+
"dayjs": "1.x",
|
|
56
|
+
"react": "18.x",
|
|
57
|
+
"react-i18next": "16.x",
|
|
58
|
+
"react-router-dom": "6.x",
|
|
59
|
+
"rxjs": "6.x",
|
|
60
|
+
"swr": "2.x"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@openmrs/esm-framework": "next",
|
|
64
|
+
"@openmrs/esm-patient-common-lib": "next",
|
|
65
|
+
"@openmrs/esm-styleguide": "next",
|
|
66
|
+
"@playwright/test": "^1.52.0",
|
|
67
|
+
"@swc/cli": "^0.3.12",
|
|
68
|
+
"@swc/core": "^1.3.68",
|
|
69
|
+
"@swc/jest": "^0.2.36",
|
|
70
|
+
"@testing-library/dom": "^10.1.0",
|
|
71
|
+
"@testing-library/jest-dom": "^6.4.5",
|
|
72
|
+
"@testing-library/react": "^15.0.6",
|
|
73
|
+
"@testing-library/user-event": "^14.5.2",
|
|
74
|
+
"@types/jest": "^29.5.12",
|
|
75
|
+
"@types/react": "^18.3.21",
|
|
76
|
+
"@types/react-dom": "^18.3.0",
|
|
77
|
+
"@types/react-router": "^5.1.20",
|
|
78
|
+
"@types/react-router-dom": "^5.3.3",
|
|
79
|
+
"@types/webpack-env": "^1.18.1",
|
|
80
|
+
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
|
81
|
+
"@typescript-eslint/parser": "^7.8.0",
|
|
82
|
+
"css-loader": "^6.8.1",
|
|
83
|
+
"dayjs": "^1.11.13",
|
|
84
|
+
"dotenv": "^16.0.3",
|
|
85
|
+
"eslint": "^8.50.0",
|
|
86
|
+
"eslint-config-prettier": "^8.8.0",
|
|
87
|
+
"eslint-plugin-jest-dom": "^5.4.0",
|
|
88
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
89
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
90
|
+
"husky": "^8.0.3",
|
|
91
|
+
"i18next": "^25.0.0",
|
|
92
|
+
"i18next-parser": "^9.3.0",
|
|
93
|
+
"identity-obj-proxy": "^3.0.0",
|
|
94
|
+
"jest": "^29.7.0",
|
|
95
|
+
"jest-cli": "^29.7.0",
|
|
96
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
97
|
+
"lint-staged": "^15.2.2",
|
|
98
|
+
"openmrs": "next",
|
|
99
|
+
"prettier": "^3.3.3",
|
|
100
|
+
"react": "^18.3.1",
|
|
101
|
+
"react-dom": "^18.3.1",
|
|
102
|
+
"react-i18next": "^16.0.0",
|
|
103
|
+
"react-router-dom": "^6.14.1",
|
|
104
|
+
"rxjs": "^6.6.7",
|
|
105
|
+
"swc-loader": "^0.2.3",
|
|
106
|
+
"swr": "^2.2.4",
|
|
107
|
+
"turbo": "^2.5.2",
|
|
108
|
+
"typescript": "^5.0.0",
|
|
109
|
+
"webpack": "^5.99.9",
|
|
110
|
+
"webpack-cli": "^6.0.1"
|
|
111
|
+
},
|
|
112
|
+
"lint-staged": {
|
|
113
|
+
"packages/**/src/**/*.{ts,tsx}": "eslint --cache --fix --max-warnings 0",
|
|
114
|
+
"*.{css,scss,ts,tsx}": "prettier --write --list-different"
|
|
115
|
+
},
|
|
116
|
+
"packageManager": "yarn@4.10.3"
|
|
117
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { devices, PlaywrightTestConfig } from '@playwright/test';
|
|
2
|
+
import * as dotenv from 'dotenv';
|
|
3
|
+
dotenv.config();
|
|
4
|
+
|
|
5
|
+
// See https://playwright.dev/docs/test-configuration.
|
|
6
|
+
const config: PlaywrightTestConfig = {
|
|
7
|
+
testDir: './e2e/specs',
|
|
8
|
+
timeout: 3 * 60 * 1000,
|
|
9
|
+
expect: {
|
|
10
|
+
timeout: 40 * 1000,
|
|
11
|
+
},
|
|
12
|
+
fullyParallel: true,
|
|
13
|
+
forbidOnly: !!process.env.CI,
|
|
14
|
+
retries: 0,
|
|
15
|
+
reporter: process.env.CI ? [['junit', { outputFile: 'results.xml' }], ['html']] : [['html']],
|
|
16
|
+
globalSetup: require.resolve('./e2e/core/global-setup'),
|
|
17
|
+
use: {
|
|
18
|
+
baseURL: `${process.env.E2E_BASE_URL}/spa/`,
|
|
19
|
+
storageState: 'e2e/storageState.json',
|
|
20
|
+
video: 'retain-on-failure',
|
|
21
|
+
},
|
|
22
|
+
projects: [
|
|
23
|
+
{
|
|
24
|
+
name: 'chromium',
|
|
25
|
+
use: {
|
|
26
|
+
...devices['Desktop Chrome'],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default config;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { ExtensionSlot, WorkspaceContainer } from '@openmrs/esm-framework';
|
|
3
|
+
|
|
4
|
+
const AccountingComponent: React.FC = () => {
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<ExtensionSlot name="poc-accounting-dashboard-slot" />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default AccountingComponent;
|
|
File without changes
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Button, OverflowMenu, OverflowMenuItem, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@carbon/react';
|
|
3
|
+
import { BedLayout, Disposition } from '../types';
|
|
4
|
+
import AdmitPatientModal from '../modal/admit-patient/admit-patient.modal';
|
|
5
|
+
import { formatDate, Patient } from '@openmrs/esm-framework';
|
|
6
|
+
import CancelAdmissionRequestModal from '../modal/cancel-admission-request/cancel-admission-request';
|
|
7
|
+
import AdmitElsewhereModal from '../modal/admit-elsewhere/admit-elsewhere.modal';
|
|
8
|
+
|
|
9
|
+
interface AdmissionListProps {
|
|
10
|
+
admissionListData: Disposition[];
|
|
11
|
+
bedLayouts: BedLayout[];
|
|
12
|
+
refresh: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const AdmissionsRequestList: React.FC<AdmissionListProps> = ({ admissionListData, bedLayouts, refresh }) => {
|
|
16
|
+
const [selectedPatient, setSelectedPatient] = useState<Patient>();
|
|
17
|
+
const [selectedDisposition, setSelectedDisposition] = useState<Disposition>();
|
|
18
|
+
const [showAdmitModal, setShowAdmitModal] = useState<boolean>(false);
|
|
19
|
+
const [showAdmitElsewhereModal, setShowAdmitElsewhereModal] = useState<boolean>(false);
|
|
20
|
+
const [showCancelAdmissionModal, setShowCancelAdmissionModal] = useState<boolean>(false);
|
|
21
|
+
if (!admissionListData || admissionListData.length === 0) {
|
|
22
|
+
return <>No Data</>;
|
|
23
|
+
}
|
|
24
|
+
const handleCancelRequest = (disposition: Disposition) => {
|
|
25
|
+
setSelectedDisposition(disposition);
|
|
26
|
+
setShowCancelAdmissionModal(true);
|
|
27
|
+
};
|
|
28
|
+
const handleAdmitPatient = (disposition: Disposition) => {
|
|
29
|
+
setShowAdmitModal(true);
|
|
30
|
+
setSelectedPatient(disposition.patient);
|
|
31
|
+
setSelectedDisposition(disposition);
|
|
32
|
+
};
|
|
33
|
+
const handleAdmitElsewhere = (disposition: Disposition) => {
|
|
34
|
+
setSelectedPatient(disposition.patient);
|
|
35
|
+
setSelectedDisposition(disposition);
|
|
36
|
+
setShowAdmitElsewhereModal(true);
|
|
37
|
+
};
|
|
38
|
+
const handleAdmitModalClose = () => {
|
|
39
|
+
setShowAdmitModal(false);
|
|
40
|
+
};
|
|
41
|
+
const handeSuccessfullAdmission = () => {
|
|
42
|
+
handleAdmitModalClose();
|
|
43
|
+
refresh();
|
|
44
|
+
};
|
|
45
|
+
const handleCancelAdmissionClose = () => {
|
|
46
|
+
setShowCancelAdmissionModal(false);
|
|
47
|
+
refresh();
|
|
48
|
+
};
|
|
49
|
+
const handleCancelAdmissionSuccess = () => {
|
|
50
|
+
handleCancelAdmissionClose();
|
|
51
|
+
};
|
|
52
|
+
const handleCancelAdmitElsewhere = () => {
|
|
53
|
+
setShowAdmitElsewhereModal(false);
|
|
54
|
+
};
|
|
55
|
+
const handleSuccessfullTransfer = () => {
|
|
56
|
+
handleCancelAdmitElsewhere();
|
|
57
|
+
refresh();
|
|
58
|
+
}
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
<Table>
|
|
62
|
+
<TableHead>
|
|
63
|
+
<TableRow>
|
|
64
|
+
<TableHeader>No</TableHeader>
|
|
65
|
+
<TableHeader>Date</TableHeader>
|
|
66
|
+
<TableHeader>Name</TableHeader>
|
|
67
|
+
<TableHeader>Gender</TableHeader>
|
|
68
|
+
<TableHeader>Age</TableHeader>
|
|
69
|
+
<TableHeader>Action</TableHeader>
|
|
70
|
+
</TableRow>
|
|
71
|
+
</TableHead>
|
|
72
|
+
|
|
73
|
+
<TableBody>
|
|
74
|
+
{admissionListData &&
|
|
75
|
+
admissionListData.map((val, index) => (
|
|
76
|
+
<TableRow key={val.dispositionLocation.uuid ?? index}>
|
|
77
|
+
<TableCell>{index + 1}</TableCell>
|
|
78
|
+
<TableCell>{formatDate(new Date(val.dispositionEncounter.encounterDatetime))}</TableCell>
|
|
79
|
+
<TableCell>{val.patient.person.display}</TableCell>
|
|
80
|
+
<TableCell>{val.patient.person.gender}</TableCell>
|
|
81
|
+
<TableCell>{val.patient.person.age}</TableCell>
|
|
82
|
+
<TableCell>
|
|
83
|
+
<>
|
|
84
|
+
<OverflowMenu aria-label="overflow-menu">
|
|
85
|
+
<OverflowMenuItem itemText="Cancel" onClick={() => handleCancelRequest(val)} />
|
|
86
|
+
<OverflowMenuItem itemText="Admit" onClick={() => handleAdmitPatient(val)} />
|
|
87
|
+
<OverflowMenuItem itemText="Admit Elsewhere" onClick={() => handleAdmitElsewhere(val)} />
|
|
88
|
+
</OverflowMenu>
|
|
89
|
+
</>
|
|
90
|
+
</TableCell>
|
|
91
|
+
</TableRow>
|
|
92
|
+
))}
|
|
93
|
+
</TableBody>
|
|
94
|
+
</Table>
|
|
95
|
+
{
|
|
96
|
+
showAdmitModal ? (<>
|
|
97
|
+
<AdmitPatientModal
|
|
98
|
+
onModalClose={handleAdmitModalClose}
|
|
99
|
+
open={showAdmitModal}
|
|
100
|
+
onSuccessfullAdmission={handeSuccessfullAdmission}
|
|
101
|
+
disposition={selectedDisposition}
|
|
102
|
+
bedLayouts={bedLayouts}
|
|
103
|
+
/>
|
|
104
|
+
</>) : (<></>)
|
|
105
|
+
}
|
|
106
|
+
{
|
|
107
|
+
showCancelAdmissionModal ? (<>
|
|
108
|
+
<CancelAdmissionRequestModal
|
|
109
|
+
open={showCancelAdmissionModal}
|
|
110
|
+
onModalClose={handleCancelAdmissionClose}
|
|
111
|
+
onCancelAdmission={handleCancelAdmissionSuccess}
|
|
112
|
+
admissionRequest={selectedDisposition}
|
|
113
|
+
|
|
114
|
+
/>
|
|
115
|
+
</>) : (<></>)
|
|
116
|
+
}
|
|
117
|
+
{
|
|
118
|
+
showAdmitElsewhereModal ? (<>
|
|
119
|
+
<AdmitElsewhereModal
|
|
120
|
+
open={showAdmitElsewhereModal}
|
|
121
|
+
onModalClose={handleCancelAdmitElsewhere}
|
|
122
|
+
patient={selectedPatient}
|
|
123
|
+
visit={selectedDisposition.visit}
|
|
124
|
+
onSuccessfullTransfer={handleSuccessfullTransfer} />
|
|
125
|
+
</>) : (<></>)
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
</>
|
|
130
|
+
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export default AdmissionsRequestList;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import styles from './admissions-dashboard.component.scss';
|
|
3
|
+
import StatCard from '../shared/ui/stat-card/stat-card.component';
|
|
4
|
+
import { InlineLoading, Tab, TabList, TabPanel, TabPanels, Tabs } from '@carbon/react';
|
|
5
|
+
import { useSession } from '@openmrs/esm-framework';
|
|
6
|
+
import {
|
|
7
|
+
getAdmissionLoactionData,
|
|
8
|
+
getAdmissionRequests,
|
|
9
|
+
getAdmittedPatientsData,
|
|
10
|
+
getDichargedEncounters,
|
|
11
|
+
} from './admissions.resource';
|
|
12
|
+
import {
|
|
13
|
+
type Disposition,
|
|
14
|
+
type AdmissionLocationData,
|
|
15
|
+
type BedLayout,
|
|
16
|
+
type FhirEncounter,
|
|
17
|
+
type FhirEncounterBundle,
|
|
18
|
+
} from './types';
|
|
19
|
+
import AdmittedPatientsList from './admitted-list/admitted-patients-list';
|
|
20
|
+
import AdmissionsRequestList from './admission-request-list/admission-request-list';
|
|
21
|
+
import { AdmissionEncounterTypeUuids } from './constants';
|
|
22
|
+
import DischargedList from './discharged-list/discharged-list';
|
|
23
|
+
|
|
24
|
+
const AdmissionsDashboard: React.FC = () => {
|
|
25
|
+
const [dashboardData, setDashboardData] = useState<AdmissionLocationData>(null);
|
|
26
|
+
const [admissionListData, setAdmissionListData] = useState<Disposition[]>([]);
|
|
27
|
+
const [admittedPatientsData, setAdmittedPatientsData] = useState<BedLayout[]>([]);
|
|
28
|
+
const [dischargeEncounterBundle, setDischargeEncounterBundle] = useState<FhirEncounterBundle>();
|
|
29
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
30
|
+
const session = useSession();
|
|
31
|
+
const locationUuid = session.sessionLocation.uuid;
|
|
32
|
+
const sortedDischargeEncounters = useMemo(() => generateDischargeEncounters(), [dischargeEncounterBundle]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
fetchData();
|
|
35
|
+
}, [locationUuid]);
|
|
36
|
+
const fetchData = () => {
|
|
37
|
+
setLoading(true);
|
|
38
|
+
getDashboardData();
|
|
39
|
+
getAdmissionListData();
|
|
40
|
+
getAdmittedPatients();
|
|
41
|
+
getDisachargedEncounters();
|
|
42
|
+
};
|
|
43
|
+
const getDashboardData = async () => {
|
|
44
|
+
const res = await getAdmissionLoactionData(locationUuid);
|
|
45
|
+
setDashboardData(res);
|
|
46
|
+
setLoading(false);
|
|
47
|
+
};
|
|
48
|
+
const getFreeBeds = (dashboardData: AdmissionLocationData): number => {
|
|
49
|
+
return (dashboardData?.totalBeds ?? 0) - (dashboardData.occupiedBeds ?? 0);
|
|
50
|
+
};
|
|
51
|
+
const getBedOccupancy = (dashboardData: AdmissionLocationData): number => {
|
|
52
|
+
return parseFloat(((dashboardData?.occupiedBeds / dashboardData.totalBeds) * 100).toFixed(2));
|
|
53
|
+
};
|
|
54
|
+
const getAdmissionListData = async () => {
|
|
55
|
+
const res = await getAdmissionRequests(locationUuid);
|
|
56
|
+
setAdmissionListData(res);
|
|
57
|
+
setLoading(false);
|
|
58
|
+
};
|
|
59
|
+
const getAdmittedPatients = async () => {
|
|
60
|
+
const res = await getAdmittedPatientsData(locationUuid);
|
|
61
|
+
setAdmittedPatientsData(res);
|
|
62
|
+
setLoading(false);
|
|
63
|
+
};
|
|
64
|
+
const getDisachargedEncounters = async () => {
|
|
65
|
+
const res = await getDichargedEncounters(AdmissionEncounterTypeUuids.DISCHARGE_ENCOUNTER_TYPE_UUID, locationUuid);
|
|
66
|
+
setDischargeEncounterBundle(res);
|
|
67
|
+
};
|
|
68
|
+
function generateDischargeEncounters(): FhirEncounter[] {
|
|
69
|
+
if (dischargeEncounterBundle && dischargeEncounterBundle.entry) {
|
|
70
|
+
const fhirEntries = dischargeEncounterBundle.entry ?? [];
|
|
71
|
+
let dischargeEncounters: FhirEncounter[] = [];
|
|
72
|
+
fhirEntries.forEach((fe) => {
|
|
73
|
+
const resource = fe.resource;
|
|
74
|
+
if (resource && resource.resourceType === 'Encounter') {
|
|
75
|
+
dischargeEncounters.push(resource);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
// order encounters in desc order
|
|
79
|
+
const sortedEnc = dischargeEncounters.sort((a, b) => {
|
|
80
|
+
return new Date(b.period.start).getTime() - new Date(a.period.start).getTime();
|
|
81
|
+
});
|
|
82
|
+
return sortedEnc;
|
|
83
|
+
} else {
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const handleRefresh = () => {
|
|
88
|
+
fetchData();
|
|
89
|
+
};
|
|
90
|
+
return (
|
|
91
|
+
<>
|
|
92
|
+
<div className={styles.admissionsLayout}>
|
|
93
|
+
<div className={styles.headerSection}>
|
|
94
|
+
<h4>Admissions</h4>
|
|
95
|
+
</div>
|
|
96
|
+
<div className={styles.statsSection}>
|
|
97
|
+
<>
|
|
98
|
+
{dashboardData ? (
|
|
99
|
+
<>
|
|
100
|
+
<StatCard title="Number of beds" count={dashboardData.totalBeds} />
|
|
101
|
+
<StatCard title="Admitted Patients" count={dashboardData.occupiedBeds} />
|
|
102
|
+
<StatCard title="Free Beds" count={getFreeBeds(dashboardData)} />
|
|
103
|
+
<StatCard title="Bed Occupancy" count={getBedOccupancy(dashboardData)} other="%" />
|
|
104
|
+
</>
|
|
105
|
+
) : (
|
|
106
|
+
<></>
|
|
107
|
+
)}
|
|
108
|
+
</>
|
|
109
|
+
</div>
|
|
110
|
+
<div className={styles.contentSection}>
|
|
111
|
+
{loading ? (
|
|
112
|
+
<>
|
|
113
|
+
<InlineLoading description="Fetching Data...please wait...." />
|
|
114
|
+
</>
|
|
115
|
+
) : (
|
|
116
|
+
<>
|
|
117
|
+
<Tabs>
|
|
118
|
+
<TabList contained>
|
|
119
|
+
<Tab>Admission Requests</Tab>
|
|
120
|
+
<Tab>Admitted</Tab>
|
|
121
|
+
<Tab>Discharged</Tab>
|
|
122
|
+
</TabList>
|
|
123
|
+
<TabPanels>
|
|
124
|
+
<TabPanel>
|
|
125
|
+
{admissionListData ? (
|
|
126
|
+
<AdmissionsRequestList
|
|
127
|
+
admissionListData={admissionListData}
|
|
128
|
+
bedLayouts={admittedPatientsData}
|
|
129
|
+
refresh={handleRefresh}
|
|
130
|
+
/>
|
|
131
|
+
) : (
|
|
132
|
+
<></>
|
|
133
|
+
)}
|
|
134
|
+
</TabPanel>
|
|
135
|
+
<TabPanel>
|
|
136
|
+
{admittedPatientsData ? (
|
|
137
|
+
<AdmittedPatientsList admittedPatientsData={admittedPatientsData} refresh={handleRefresh} />
|
|
138
|
+
) : (
|
|
139
|
+
<></>
|
|
140
|
+
)}
|
|
141
|
+
</TabPanel>
|
|
142
|
+
<TabPanel>
|
|
143
|
+
{sortedDischargeEncounters ? (
|
|
144
|
+
<>
|
|
145
|
+
<DischargedList dischargedEncounters={sortedDischargeEncounters} refresh={handleRefresh} />
|
|
146
|
+
</>
|
|
147
|
+
) : (
|
|
148
|
+
<></>
|
|
149
|
+
)}
|
|
150
|
+
</TabPanel>
|
|
151
|
+
</TabPanels>
|
|
152
|
+
</Tabs>
|
|
153
|
+
</>
|
|
154
|
+
)}
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
</>
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
export default AdmissionsDashboard;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Encounter, fhirBaseUrl, FHIRResource, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
import { AdmitPatientDto, AssignBedToPatientDto, BedLayout, BedSwapDto, CancelAdmissionDto, DischargePatientDto, Disposition, DispositionResponse, FhirEncounterBundle, TransferPatientDto, UnAssignBedDto, type AdmissionLocationData } from './types';
|
|
3
|
+
|
|
4
|
+
const customRep =
|
|
5
|
+
'custom:(ward,totalBeds,occupiedBeds,bedLayouts:(rowNumber,columnNumber,bedNumber,bedId,bedUuid,status,location,patients:(person:full,identifiers,uuid)))';
|
|
6
|
+
|
|
7
|
+
export async function getAdmissionLoactionData(locationUuid: string): Promise<AdmissionLocationData> {
|
|
8
|
+
const admissionLocationUrl = `${restBaseUrl}/admissionLocation/${locationUuid}?v=${customRep}`;
|
|
9
|
+
const response = await openmrsFetch(admissionLocationUrl);
|
|
10
|
+
const result = await response.json();
|
|
11
|
+
return result ?? null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function getAdmissionRequests(locationUuid: string): Promise<Disposition[]> {
|
|
15
|
+
const admissionRep = 'custom:(dispositionLocation,dispositionType,disposition,dispositionEncounter:full,patient:(uuid,identifiers,voided,person:(uuid,display,gender,age,birthdate,birthtime,preferredName,preferredAddress,dead,deathDate)),dispositionObsGroup,visit)';
|
|
16
|
+
const params = {
|
|
17
|
+
v: admissionRep,
|
|
18
|
+
dispositionLocation: locationUuid,
|
|
19
|
+
dispositionType: 'ADMIT,TRANSFER'
|
|
20
|
+
};
|
|
21
|
+
const queryString = new URLSearchParams(params).toString();
|
|
22
|
+
const admissionRequestUrl = `${restBaseUrl}/emrapi/inpatient/request?${queryString}`;
|
|
23
|
+
const response = await openmrsFetch(admissionRequestUrl);
|
|
24
|
+
const result = await response.json();
|
|
25
|
+
return result.results ?? null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function getAdmittedPatientsData(locationUuid: string): Promise<BedLayout[]> {
|
|
29
|
+
const admissionLocationData = await getAdmissionLoactionData(locationUuid);
|
|
30
|
+
if (admissionLocationData.bedLayouts && admissionLocationData.bedLayouts.length > 0) {
|
|
31
|
+
const bedLayouts = admissionLocationData.bedLayouts;
|
|
32
|
+
return bedLayouts;
|
|
33
|
+
} else {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export async function postRequest(url: string, dto: any) {
|
|
39
|
+
const resp = await openmrsFetch(url, {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
headers: { 'Content-Type': 'application/json' },
|
|
42
|
+
body: JSON.stringify(dto),
|
|
43
|
+
});
|
|
44
|
+
const result = await resp.json();
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export async function admitPatientToWard(admitPatientDto: AdmitPatientDto): Promise<Encounter> {
|
|
49
|
+
const admitPatientUrl = `${restBaseUrl}/encounter`;
|
|
50
|
+
return postRequest(admitPatientUrl, admitPatientDto);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export async function assignBedToPatient(bedId: number, assignBedToPatientDto: AssignBedToPatientDto) {
|
|
54
|
+
const assignBedUrl = `${restBaseUrl}/beds/${bedId}`;
|
|
55
|
+
return postRequest(assignBedUrl, assignBedToPatientDto);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export async function cancelAdmissionRequest(cancelAdmissionDto: CancelAdmissionDto) {
|
|
59
|
+
const cancelAdmissionUrl = `${restBaseUrl}/encounter`;
|
|
60
|
+
return postRequest(cancelAdmissionUrl, cancelAdmissionDto);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export async function bedSwapRequest(bedSwapDto: BedSwapDto) {
|
|
64
|
+
const cancelAdmissionUrl = `${restBaseUrl}/encounter`;
|
|
65
|
+
return postRequest(cancelAdmissionUrl, bedSwapDto);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export async function dischargePatientFromWard(dischargePatientDto: DischargePatientDto) {
|
|
69
|
+
const cancelAdmissionUrl = `${restBaseUrl}/encounter`;
|
|
70
|
+
return postRequest(cancelAdmissionUrl, dischargePatientDto);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function unassignBed(unAssignBedDto: UnAssignBedDto) {
|
|
74
|
+
const params = {
|
|
75
|
+
patientUuid: unAssignBedDto.patientUuid
|
|
76
|
+
};
|
|
77
|
+
const queryString = new URLSearchParams(params).toString();
|
|
78
|
+
const unassignBedUrl = `${restBaseUrl}/beds/${unAssignBedDto.bedId}?${queryString}`;
|
|
79
|
+
await openmrsFetch(unassignBedUrl, {
|
|
80
|
+
method: 'DELETE'
|
|
81
|
+
});
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
export async function admitPatientElseWhere(transferPatientDto: TransferPatientDto) {
|
|
85
|
+
const transferUrl = `${restBaseUrl}/encounter`;
|
|
86
|
+
return postRequest(transferUrl, transferPatientDto);
|
|
87
|
+
}
|
|
88
|
+
export async function getDichargedEncounters(encounterTypeUuid: string,locationUuid: string): Promise<FhirEncounterBundle>{
|
|
89
|
+
const params = {
|
|
90
|
+
_summary: 'data',
|
|
91
|
+
type: encounterTypeUuid,
|
|
92
|
+
location: locationUuid,
|
|
93
|
+
_count: '100',
|
|
94
|
+
_getpagesoffset: '0'
|
|
95
|
+
};
|
|
96
|
+
const queryString = new URLSearchParams(params).toString();
|
|
97
|
+
const encountersUrl = `${fhirBaseUrl}/Encounter?${queryString}`;
|
|
98
|
+
const resp = await openmrsFetch(encountersUrl);
|
|
99
|
+
const result = await resp.json();
|
|
100
|
+
return result;
|
|
101
|
+
}
|