@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
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
OverflowMenu,
|
|
4
|
+
OverflowMenuItem,
|
|
5
|
+
Table,
|
|
6
|
+
TableBody,
|
|
7
|
+
TableCell,
|
|
8
|
+
TableHead,
|
|
9
|
+
TableHeader,
|
|
10
|
+
TableRow,
|
|
11
|
+
} from '@carbon/react';
|
|
12
|
+
import { type BedLayout } from '../types';
|
|
13
|
+
import BedSwapModal from '../modal/bed-swap/bed-swap.modal';
|
|
14
|
+
import DischargeModal from '../modal/discharge/discharge-patient.modal';
|
|
15
|
+
|
|
16
|
+
interface AdmittedPatientsListProps {
|
|
17
|
+
admittedPatientsData: BedLayout[];
|
|
18
|
+
refresh: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const AdmittedPatientsList: React.FC<AdmittedPatientsListProps> = ({ admittedPatientsData, refresh }) => {
|
|
22
|
+
const [showBedSwapModal, setShowBedSwapModal] = useState<boolean>(false);
|
|
23
|
+
const [showDischargeModal, setShowDischargeModal] = useState<boolean>(false);
|
|
24
|
+
const [selectedLayout, setSelectedLayout] = useState<any>();
|
|
25
|
+
if (!admittedPatientsData) {
|
|
26
|
+
return <>No data to display</>;
|
|
27
|
+
}
|
|
28
|
+
const handleTransferRequest = (layout: BedLayout) => {
|
|
29
|
+
setSelectedLayout(layout);
|
|
30
|
+
};
|
|
31
|
+
const handleBedSwapRequest = (layout: BedLayout) => {
|
|
32
|
+
setSelectedLayout(layout);
|
|
33
|
+
setShowBedSwapModal(true);
|
|
34
|
+
};
|
|
35
|
+
const handleDischargeRequest = (layout: BedLayout) => {
|
|
36
|
+
setSelectedLayout(layout);
|
|
37
|
+
setShowDischargeModal(true);
|
|
38
|
+
};
|
|
39
|
+
const handleBedSwapModalClose = () => {
|
|
40
|
+
setShowBedSwapModal(false);
|
|
41
|
+
refresh();
|
|
42
|
+
};
|
|
43
|
+
const handleDischargeModalClose = () => {
|
|
44
|
+
setShowDischargeModal(false);
|
|
45
|
+
};
|
|
46
|
+
const handleSuccessfullDischarge = () => {
|
|
47
|
+
handleBedSwapModalClose();
|
|
48
|
+
refresh();
|
|
49
|
+
};
|
|
50
|
+
const rows =
|
|
51
|
+
admittedPatientsData?.flatMap((layout) =>
|
|
52
|
+
(layout.patients ?? []).map((patient) => ({
|
|
53
|
+
key: `${layout.bedUuid}-${patient.uuid}`,
|
|
54
|
+
bedNumber: layout.bedNumber,
|
|
55
|
+
bedId: layout.bedId,
|
|
56
|
+
status: layout.status,
|
|
57
|
+
location: layout.location,
|
|
58
|
+
name: patient.person.display,
|
|
59
|
+
gender: patient.person.gender,
|
|
60
|
+
age: patient.person.age,
|
|
61
|
+
identifier: patient.identifiers?.[0]?.identifier ?? 'N/A',
|
|
62
|
+
person: patient.person,
|
|
63
|
+
})),
|
|
64
|
+
) ?? [];
|
|
65
|
+
|
|
66
|
+
if (!rows.length) {
|
|
67
|
+
return <>No Data</>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<>
|
|
72
|
+
<Table>
|
|
73
|
+
<TableHead>
|
|
74
|
+
<TableRow>
|
|
75
|
+
<TableHeader>No</TableHeader>
|
|
76
|
+
<TableHeader>Bed No</TableHeader>
|
|
77
|
+
<TableHeader>Patient Name</TableHeader>
|
|
78
|
+
<TableHeader>Gender</TableHeader>
|
|
79
|
+
<TableHeader>Age</TableHeader>
|
|
80
|
+
<TableHeader>Identifier</TableHeader>
|
|
81
|
+
<TableHeader>Status</TableHeader>
|
|
82
|
+
<TableHeader>Location</TableHeader>
|
|
83
|
+
<TableHeader>Action</TableHeader>
|
|
84
|
+
</TableRow>
|
|
85
|
+
</TableHead>
|
|
86
|
+
<TableBody>
|
|
87
|
+
{rows.map((row, index) => (
|
|
88
|
+
<TableRow key={row.key}>
|
|
89
|
+
<TableCell>{index + 1}</TableCell>
|
|
90
|
+
<TableCell>{row.bedNumber}</TableCell>
|
|
91
|
+
<TableCell>{row.name}</TableCell>
|
|
92
|
+
<TableCell>{row.gender}</TableCell>
|
|
93
|
+
<TableCell>{row.age}</TableCell>
|
|
94
|
+
<TableCell>{row.identifier}</TableCell>
|
|
95
|
+
<TableCell>{row.status}</TableCell>
|
|
96
|
+
<TableCell>{row.location}</TableCell>
|
|
97
|
+
<TableCell>
|
|
98
|
+
<>
|
|
99
|
+
<OverflowMenu aria-label="overflow-menu">
|
|
100
|
+
<OverflowMenuItem itemText="Transfer" onClick={() => handleTransferRequest(row as any)} />
|
|
101
|
+
<OverflowMenuItem itemText="Bed Swap" onClick={() => handleBedSwapRequest(row as any)} />
|
|
102
|
+
<OverflowMenuItem itemText="Discharge" onClick={() => handleDischargeRequest(row as any)} />
|
|
103
|
+
</OverflowMenu>
|
|
104
|
+
</>
|
|
105
|
+
</TableCell>
|
|
106
|
+
</TableRow>
|
|
107
|
+
))}
|
|
108
|
+
</TableBody>
|
|
109
|
+
</Table>
|
|
110
|
+
{showBedSwapModal && selectedLayout ? (
|
|
111
|
+
<>
|
|
112
|
+
<BedSwapModal
|
|
113
|
+
open={showBedSwapModal}
|
|
114
|
+
onModalClose={handleBedSwapModalClose}
|
|
115
|
+
onSuccessfullBedSwap={handleBedSwapModalClose}
|
|
116
|
+
disposition={null}
|
|
117
|
+
person={selectedLayout.person}
|
|
118
|
+
bedLayouts={admittedPatientsData}
|
|
119
|
+
/>
|
|
120
|
+
</>
|
|
121
|
+
) : (
|
|
122
|
+
<></>
|
|
123
|
+
)}
|
|
124
|
+
|
|
125
|
+
{showDischargeModal && selectedLayout ? (
|
|
126
|
+
<>
|
|
127
|
+
<DischargeModal
|
|
128
|
+
open={showDischargeModal}
|
|
129
|
+
onModalClose={handleDischargeModalClose}
|
|
130
|
+
onDischarge={handleSuccessfullDischarge}
|
|
131
|
+
admissionRequest={selectedLayout}
|
|
132
|
+
/>
|
|
133
|
+
</>
|
|
134
|
+
) : (
|
|
135
|
+
<></>
|
|
136
|
+
)}
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export default AdmittedPatientsList;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const ADMIT_ENCOUNTER_TYPE_UUID = 'e22e39fd-7db2-45e7-80f1-60fa0d5a4378';
|
|
2
|
+
const CANCEL_ADT_ENCOUNTER_TYPE_UUID = "550e8400-e29b-41d4-a716-446655440000";
|
|
3
|
+
const BED_ASSIGNMENT_ENCOUNTER_TYPE_UUID = 'f47ac10b-58cc-4372-a567-0e02b2c3d479';
|
|
4
|
+
const DISCHARGE_ENCOUNTER_TYPE_UUID = '181820aa-88c9-479b-9077-af92f5364329';
|
|
5
|
+
const TRANSFER_REQUEST_ENCOUNTER_TYPE_UUID = 'b2c4d5e6-7f8a-4e9b-8c1d-2e3f8e4a3b8f';
|
|
6
|
+
|
|
7
|
+
const ADMISSION_TO_HOSPITAL_DECISION_UUID = 'ac4d3e94-03f3-458a-9cb1-9c2ab3c3a3f7';
|
|
8
|
+
const ADMISSION_DENIED_UUID = 'cc6a6126-b8a1-4d2d-9a35-31f9be7c5e68';
|
|
9
|
+
const CLINICAL_IMPRESSION_UUID = '159395AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
|
|
10
|
+
const CLINICAL_NOTES_UUID = '5e4dc798-2cce-4a1a-97e9-bcf22d64b07c';
|
|
11
|
+
const INPATIENT_DISPOSITION_CONSTRUCT_UUID = '9ceedfb7-60e4-42ce-a11e-f2dbabc82112';
|
|
12
|
+
const INTERNAL_TRANSFER_LOCATION_UUID = '731318a6-9fa9-4f68-97a9-5bd4cbc707f7';
|
|
13
|
+
const INPATIENT_PATIENT_DISPOSITION_UUID = 'ce085d74-323c-4c9a-9fdf-051de81dd020';
|
|
14
|
+
const TRANSFER_OUT_UUID = '5520f234-258e-49f0-97ab-701b98fab608';
|
|
15
|
+
|
|
16
|
+
export const AdmissionEncounterTypeUuids = {
|
|
17
|
+
ADMIT_ENCOUNTER_TYPE_UUID,
|
|
18
|
+
CANCEL_ADT_ENCOUNTER_TYPE_UUID,
|
|
19
|
+
BED_ASSIGNMENT_ENCOUNTER_TYPE_UUID,
|
|
20
|
+
DISCHARGE_ENCOUNTER_TYPE_UUID,
|
|
21
|
+
TRANSFER_REQUEST_ENCOUNTER_TYPE_UUID
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const AdmissionConcepts = {
|
|
25
|
+
ADMISSION_TO_HOSPITAL_DECISION_UUID,
|
|
26
|
+
ADMISSION_DENIED_UUID,
|
|
27
|
+
CLINICAL_IMPRESSION_UUID,
|
|
28
|
+
CLINICAL_NOTES_UUID,
|
|
29
|
+
INPATIENT_DISPOSITION_CONSTRUCT_UUID,
|
|
30
|
+
INTERNAL_TRANSFER_LOCATION_UUID,
|
|
31
|
+
INPATIENT_PATIENT_DISPOSITION_UUID,
|
|
32
|
+
TRANSFER_OUT_UUID
|
|
33
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@carbon/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FhirEncounter } from "../types";
|
|
4
|
+
import { formatDate } from "@openmrs/esm-framework";
|
|
5
|
+
interface DischargedListProps{
|
|
6
|
+
dischargedEncounters: FhirEncounter[];
|
|
7
|
+
refresh: () => void;
|
|
8
|
+
}
|
|
9
|
+
const DischargedList: React.FC<DischargedListProps> = ({dischargedEncounters,refresh})=>{
|
|
10
|
+
if(!dischargedEncounters){
|
|
11
|
+
return <>No Data to display</>
|
|
12
|
+
}
|
|
13
|
+
const getPatientName = (display: string): string=>{
|
|
14
|
+
const splitString = display.split("(");
|
|
15
|
+
let names = '';
|
|
16
|
+
if(splitString.length > 0){
|
|
17
|
+
names = splitString[0];
|
|
18
|
+
}
|
|
19
|
+
return names;
|
|
20
|
+
};
|
|
21
|
+
const getPatientIdentifier = (display: string): string=>{
|
|
22
|
+
const splitString = display.split("(");
|
|
23
|
+
let identifier = '';
|
|
24
|
+
if(splitString.length > 1){
|
|
25
|
+
identifier = splitString[1];
|
|
26
|
+
}
|
|
27
|
+
return identifier;
|
|
28
|
+
}
|
|
29
|
+
return <>
|
|
30
|
+
<Table>
|
|
31
|
+
<TableHead>
|
|
32
|
+
<TableRow>
|
|
33
|
+
<TableHeader>No</TableHeader>
|
|
34
|
+
<TableHeader>Discharge Date</TableHeader>
|
|
35
|
+
<TableHeader>Name</TableHeader>
|
|
36
|
+
<TableHeader>Identifier</TableHeader>
|
|
37
|
+
</TableRow>
|
|
38
|
+
</TableHead>
|
|
39
|
+
|
|
40
|
+
<TableBody>
|
|
41
|
+
{
|
|
42
|
+
dischargedEncounters.map((val,index)=>{
|
|
43
|
+
return <>
|
|
44
|
+
<TableRow key={val.id}>
|
|
45
|
+
<TableCell>{index + 1}</TableCell>
|
|
46
|
+
<TableCell>{formatDate(new Date(val.period.start))}</TableCell>
|
|
47
|
+
<TableCell>{getPatientName(val.subject.display ?? '')}</TableCell>
|
|
48
|
+
<TableCell>{getPatientIdentifier(val.subject.display ?? '')}</TableCell>
|
|
49
|
+
</TableRow>
|
|
50
|
+
</>
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
</TableBody>
|
|
55
|
+
</Table>
|
|
56
|
+
</>
|
|
57
|
+
}
|
|
58
|
+
export default DischargedList;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { Table, TableHead, TableRow, TableHeader, TableBody, TableCell } from '@carbon/react';
|
|
3
|
+
import { getPatientEncounters } from '../../../shared/services/encounters.resource';
|
|
4
|
+
import { type Encounter, formatDate, parseDate } from '@openmrs/esm-framework';
|
|
5
|
+
import { AdmissionEncounterTypeUuids } from '../../constants';
|
|
6
|
+
interface PatientAdmissionHistoryProps {
|
|
7
|
+
patientUuid: string;
|
|
8
|
+
}
|
|
9
|
+
const PatientAdmissionHistory: React.FC<PatientAdmissionHistoryProps> = ({ patientUuid }) => {
|
|
10
|
+
const [encounters, setEncounters] = useState<Encounter[]>([]);
|
|
11
|
+
const admissionEncounterTypes = useMemo(
|
|
12
|
+
() =>
|
|
13
|
+
Object.keys(AdmissionEncounterTypeUuids).map((k) => {
|
|
14
|
+
return AdmissionEncounterTypeUuids[k];
|
|
15
|
+
}),
|
|
16
|
+
[patientUuid],
|
|
17
|
+
);
|
|
18
|
+
const admissionEncounters = useMemo(() => generateAdmissionEncounters(), [encounters, patientUuid]);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!patientUuid) return;
|
|
22
|
+
fetchPatientAdmissionHistory(patientUuid);
|
|
23
|
+
}, [patientUuid]);
|
|
24
|
+
|
|
25
|
+
async function fetchPatientAdmissionHistory(patientUuid: string) {
|
|
26
|
+
const resp = await getPatientEncounters(patientUuid);
|
|
27
|
+
setEncounters(resp);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function generateAdmissionEncounters(): Encounter[] {
|
|
31
|
+
return encounters
|
|
32
|
+
.filter((e) => {
|
|
33
|
+
return admissionEncounterTypes.includes(e.encounterType.uuid);
|
|
34
|
+
})
|
|
35
|
+
.sort((a, b) => {
|
|
36
|
+
return b.encounterDatetime.localeCompare(a.encounterDatetime);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!patientUuid) {
|
|
41
|
+
return <>No patient specified</>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<Table aria-label="sample table" size="lg">
|
|
47
|
+
<TableHead>
|
|
48
|
+
<TableRow>
|
|
49
|
+
<TableHeader>No</TableHeader>
|
|
50
|
+
<TableHeader>Encounter</TableHeader>
|
|
51
|
+
<TableHeader>Date</TableHeader>
|
|
52
|
+
<TableHeader>Location</TableHeader>
|
|
53
|
+
</TableRow>
|
|
54
|
+
</TableHead>
|
|
55
|
+
<TableBody>
|
|
56
|
+
{admissionEncounters ? (
|
|
57
|
+
admissionEncounters.map((encounter, index) => {
|
|
58
|
+
return (
|
|
59
|
+
<TableRow>
|
|
60
|
+
<TableCell>{index + 1}</TableCell>
|
|
61
|
+
<TableCell>{encounter?.display ?? ''}</TableCell>
|
|
62
|
+
<TableCell>{formatDate(parseDate(encounter.encounterDatetime))}</TableCell>
|
|
63
|
+
<TableCell>{encounter.location.display}</TableCell>
|
|
64
|
+
</TableRow>
|
|
65
|
+
);
|
|
66
|
+
})
|
|
67
|
+
) : (
|
|
68
|
+
<></>
|
|
69
|
+
)}
|
|
70
|
+
</TableBody>
|
|
71
|
+
</Table>
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default PatientAdmissionHistory;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.admissionLayout{
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 100%;
|
|
5
|
+
row-gap: 10px;
|
|
6
|
+
.actionSection{
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
column-gap: 10px;
|
|
10
|
+
margin: 10px 10px;
|
|
11
|
+
justify-content: flex-end;
|
|
12
|
+
}
|
|
13
|
+
.contentSection{
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
width: 100%;
|
|
17
|
+
row-gap: 10px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { DataTable, Table, TableHead, TableRow, TableHeader, TableBody, TableCell, Button } from '@carbon/react';
|
|
3
|
+
import { fetchPatientEncountersByType } from '../../../shared/services/encounters.resource';
|
|
4
|
+
import { formatDate, parseDate } from '@openmrs/esm-framework';
|
|
5
|
+
import styles from './patient-admission-requests.scss';
|
|
6
|
+
|
|
7
|
+
interface PatientAdmisssionRequestsProps {
|
|
8
|
+
patientUuid: string;
|
|
9
|
+
}
|
|
10
|
+
const PatientAdmisssionRequests: React.FC<PatientAdmisssionRequestsProps> = ({ patientUuid }) => {
|
|
11
|
+
const [encounters, setEncounters] = useState([]);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!patientUuid) return;
|
|
15
|
+
fetchPatientAdmissionRequests(patientUuid);
|
|
16
|
+
}, [patientUuid]);
|
|
17
|
+
|
|
18
|
+
async function fetchPatientAdmissionRequests(patientUuid: string) {
|
|
19
|
+
const resp = await fetchPatientEncountersByType(patientUuid, 'b2c4d5e6-7f8a-4e9b-8c1d-2e3f8e4a3b8f');
|
|
20
|
+
setEncounters(resp);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!patientUuid) {
|
|
24
|
+
return <>No patient specified</>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const recordAdmissionRequest = () => {};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
<div className={styles.admissionLayout}>
|
|
32
|
+
<div className={styles.actionSection}>
|
|
33
|
+
<Button kind="primary" onClick={recordAdmissionRequest} size="sm">
|
|
34
|
+
+ Record Admission Request
|
|
35
|
+
</Button>
|
|
36
|
+
</div>
|
|
37
|
+
<div className={styles.contentSection}>
|
|
38
|
+
<Table aria-label="sample table" size="lg">
|
|
39
|
+
<TableHead>
|
|
40
|
+
<TableRow>
|
|
41
|
+
<TableHeader>No</TableHeader>
|
|
42
|
+
<TableHeader>Form</TableHeader>
|
|
43
|
+
<TableHeader>Encounter</TableHeader>
|
|
44
|
+
<TableHeader>Date</TableHeader>
|
|
45
|
+
<TableHeader>Location</TableHeader>
|
|
46
|
+
</TableRow>
|
|
47
|
+
</TableHead>
|
|
48
|
+
<TableBody>
|
|
49
|
+
{encounters ? (
|
|
50
|
+
encounters.map((encounter, index) => {
|
|
51
|
+
return (
|
|
52
|
+
<TableRow>
|
|
53
|
+
<TableCell>{index + 1}</TableCell>
|
|
54
|
+
<TableCell>{encounter.form.display}</TableCell>
|
|
55
|
+
<TableCell>{encounter.display}</TableCell>
|
|
56
|
+
<TableCell>{formatDate(parseDate(encounter.encounterDatetime))}</TableCell>
|
|
57
|
+
<TableCell>{encounter.location.display}</TableCell>
|
|
58
|
+
</TableRow>
|
|
59
|
+
);
|
|
60
|
+
})
|
|
61
|
+
) : (
|
|
62
|
+
<></>
|
|
63
|
+
)}
|
|
64
|
+
</TableBody>
|
|
65
|
+
</Table>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export default PatientAdmisssionRequests;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tab, TabList, TabPanel, TabPanels, Tabs } from '@carbon/react';
|
|
3
|
+
import styles from './inpatient-admissions.component.scss';
|
|
4
|
+
import { usePatient } from '@openmrs/esm-framework';
|
|
5
|
+
import PatientAdmisssionRequests from './admission-requests/patient-admission-requests';
|
|
6
|
+
import PatientAdmissionHistory from './admission-history/patient-admission-history';
|
|
7
|
+
interface InpatientAdmissionsProps {}
|
|
8
|
+
const InpatientAdmissions: React.FC<InpatientAdmissionsProps> = () => {
|
|
9
|
+
const { isLoading, error, patient } = usePatient();
|
|
10
|
+
if (isLoading) return <div>Loading…</div>;
|
|
11
|
+
if (error) return <div>Error loading patient</div>;
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<div className={styles.admissionsLayout}>
|
|
15
|
+
<Tabs onTabCloseRequest={function rTe() {}}>
|
|
16
|
+
<TabList scrollDebounceWait={200}>
|
|
17
|
+
<Tab>Admission Requests</Tab>
|
|
18
|
+
<Tab>Inpatient History</Tab>
|
|
19
|
+
</TabList>
|
|
20
|
+
<TabPanels>
|
|
21
|
+
<TabPanel>
|
|
22
|
+
{patient ? (
|
|
23
|
+
<>
|
|
24
|
+
<PatientAdmisssionRequests patientUuid={patient.id} />
|
|
25
|
+
</>
|
|
26
|
+
) : (
|
|
27
|
+
<></>
|
|
28
|
+
)}
|
|
29
|
+
</TabPanel>
|
|
30
|
+
<TabPanel>
|
|
31
|
+
{patient ? (
|
|
32
|
+
<>
|
|
33
|
+
<PatientAdmissionHistory patientUuid={patient.id} />
|
|
34
|
+
</>
|
|
35
|
+
) : (
|
|
36
|
+
<></>
|
|
37
|
+
)}
|
|
38
|
+
</TabPanel>
|
|
39
|
+
</TabPanels>
|
|
40
|
+
</Tabs>
|
|
41
|
+
</div>
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default InpatientAdmissions;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.admitModalLayout{
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
row-gap: 15px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
.admitModalContentSection{
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
row-gap: 15px;
|
|
11
|
+
width: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.locationSelect{
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.formRow{
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
width: 100%;
|
|
22
|
+
column-gap: 5px;
|
|
23
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { ComboBox, Modal, ModalBody, Select, SelectItem, TextArea } from "@carbon/react";
|
|
2
|
+
import React, { useMemo, useRef, useState } from "react";
|
|
3
|
+
import styles from './admit-elsewhere.modal.scss'
|
|
4
|
+
import { Location, Patient, showSnackbar, useLocations, useSession, Visit } from "@openmrs/esm-framework";
|
|
5
|
+
import { AdmitPatientDto } from "../../types";
|
|
6
|
+
import { AdmissionConcepts, AdmissionEncounterTypeUuids } from "../../constants";
|
|
7
|
+
import { admitPatientElseWhere } from "../../admissions.resource";
|
|
8
|
+
interface AdmitElsewhereModalProps {
|
|
9
|
+
open: boolean;
|
|
10
|
+
patient: Patient;
|
|
11
|
+
visit: Visit;
|
|
12
|
+
onModalClose: () => void;
|
|
13
|
+
onSuccessfullTransfer: () => void;
|
|
14
|
+
}
|
|
15
|
+
const AdmitElsewhereModal: React.FC<AdmitElsewhereModalProps> = ({ open, onModalClose, onSuccessfullTransfer, patient, visit }) => {
|
|
16
|
+
const [transferLocation, setTransferLocation] = useState<string>();
|
|
17
|
+
const locations = useLocations();
|
|
18
|
+
const session = useSession();
|
|
19
|
+
const userLocation = session.sessionLocation;
|
|
20
|
+
const reasonRef = useRef<string>();
|
|
21
|
+
const locationsOptions = useMemo(() => generateLocationOption(), [locations]);
|
|
22
|
+
function generateLocationOption() {
|
|
23
|
+
return locations.filter((l)=>{
|
|
24
|
+
if(!userLocation){
|
|
25
|
+
return true;
|
|
26
|
+
}else{
|
|
27
|
+
return l.uuid !== userLocation.uuid;
|
|
28
|
+
}
|
|
29
|
+
}).map((l: Location) => {
|
|
30
|
+
return {
|
|
31
|
+
id: l.uuid,
|
|
32
|
+
text: l.display,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const handleTransfer = async () => {
|
|
37
|
+
if(!validateTransferPayload()){
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const transferPatientDto = generateAdmitPatientPayload();
|
|
42
|
+
await admitPatientElseWhere(transferPatientDto);
|
|
43
|
+
showSnackbar({
|
|
44
|
+
kind: 'success',
|
|
45
|
+
title: 'Transfer Request Successful',
|
|
46
|
+
subtitle: 'Patient Transfer Request was Successful',
|
|
47
|
+
});
|
|
48
|
+
onSuccessfullTransfer();
|
|
49
|
+
} catch (error) {
|
|
50
|
+
console.log({ error });
|
|
51
|
+
showSnackbar({
|
|
52
|
+
kind: 'error',
|
|
53
|
+
title: 'Transfer Request failed',
|
|
54
|
+
subtitle: error.message ?? 'Patient Transfer Request failed'
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
};
|
|
59
|
+
const validateTransferPayload = ():boolean=>{
|
|
60
|
+
if(!transferLocation){
|
|
61
|
+
showSnackbar({
|
|
62
|
+
kind: 'error',
|
|
63
|
+
title: 'Transfer Location missing',
|
|
64
|
+
subtitle: 'Please select the location to transfer patient'
|
|
65
|
+
});
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if(!reasonRef.current){
|
|
69
|
+
showSnackbar({
|
|
70
|
+
kind: 'error',
|
|
71
|
+
title: 'Missing Transfer reason',
|
|
72
|
+
subtitle: 'Please enter the transfer reason'
|
|
73
|
+
});
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
};
|
|
78
|
+
const generateAdmitPatientPayload = (): AdmitPatientDto => {
|
|
79
|
+
return {
|
|
80
|
+
patient: patient.uuid,
|
|
81
|
+
encounterType: {
|
|
82
|
+
uuid: AdmissionEncounterTypeUuids.TRANSFER_REQUEST_ENCOUNTER_TYPE_UUID
|
|
83
|
+
},
|
|
84
|
+
location: userLocation.uuid,
|
|
85
|
+
obs: [
|
|
86
|
+
{
|
|
87
|
+
"concept": AdmissionConcepts.INPATIENT_DISPOSITION_CONSTRUCT_UUID,
|
|
88
|
+
"groupMembers": [
|
|
89
|
+
{
|
|
90
|
+
"concept": AdmissionConcepts.INTERNAL_TRANSFER_LOCATION_UUID,
|
|
91
|
+
"value": transferLocation
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"concept": AdmissionConcepts.INPATIENT_PATIENT_DISPOSITION_UUID,
|
|
95
|
+
"value": AdmissionConcepts.TRANSFER_OUT_UUID
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"concept": AdmissionConcepts.CLINICAL_NOTES_UUID,
|
|
99
|
+
"value": reasonRef.current
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
visit: visit.uuid
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const handleReasonText = (reason: string) => {
|
|
108
|
+
reasonRef.current = reason;
|
|
109
|
+
};
|
|
110
|
+
const locationChangeHandler = (location: { selectedItem: { id: string; text: string } }) => {
|
|
111
|
+
const l = location.selectedItem.id;
|
|
112
|
+
setTransferLocation(l);
|
|
113
|
+
};
|
|
114
|
+
return <>
|
|
115
|
+
<Modal
|
|
116
|
+
modalHeading="Transfer Elsewhere"
|
|
117
|
+
open={open}
|
|
118
|
+
size="md"
|
|
119
|
+
onSecondarySubmit={() => onModalClose()}
|
|
120
|
+
onRequestClose={() => onModalClose()}
|
|
121
|
+
onRequestSubmit={handleTransfer}
|
|
122
|
+
primaryButtonText="Send Admission Request"
|
|
123
|
+
secondaryButtonText="Cancel"
|
|
124
|
+
>
|
|
125
|
+
<ModalBody>
|
|
126
|
+
<div className={styles.admitModalLayout}>
|
|
127
|
+
<div className={styles.admitModalContentSection}>
|
|
128
|
+
<div className={styles.formRow}>
|
|
129
|
+
<ComboBox
|
|
130
|
+
onChange={locationChangeHandler}
|
|
131
|
+
id="visit-type-combobox"
|
|
132
|
+
items={locationsOptions}
|
|
133
|
+
itemToString={(item) => (item ? item.text : '')}
|
|
134
|
+
titleText="Select Transfer Location"
|
|
135
|
+
className={styles.locationSelect}
|
|
136
|
+
/>
|
|
137
|
+
</div>
|
|
138
|
+
<div className={styles.formRow}>
|
|
139
|
+
<TextArea
|
|
140
|
+
enableCounter
|
|
141
|
+
helperText=""
|
|
142
|
+
id="transfer-reason"
|
|
143
|
+
labelText="Transfer Reason"
|
|
144
|
+
maxCount={500}
|
|
145
|
+
placeholder=""
|
|
146
|
+
rows={4}
|
|
147
|
+
onChange={(e) => handleReasonText(e.target.value)}
|
|
148
|
+
/>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</ModalBody>
|
|
153
|
+
</Modal>
|
|
154
|
+
</>
|
|
155
|
+
}
|
|
156
|
+
export default AdmitElsewhereModal;
|
|
File without changes
|