@bathiran212/esm-patient-chart-app 7.0.0
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/README.md +3 -0
- package/dist/108.js +1 -0
- package/dist/108.js.map +1 -0
- package/dist/1339.js +1 -0
- package/dist/1339.js.map +1 -0
- package/dist/1480.js +1 -0
- package/dist/1480.js.map +1 -0
- package/dist/1543.js +1 -0
- package/dist/1543.js.map +1 -0
- package/dist/1582.js +1 -0
- package/dist/1582.js.map +1 -0
- package/dist/1646.js +1 -0
- package/dist/1646.js.map +1 -0
- package/dist/1797.js +1 -0
- package/dist/1797.js.map +1 -0
- package/dist/1869.js +1 -0
- package/dist/1869.js.map +1 -0
- package/dist/1877.js +1 -0
- package/dist/1877.js.map +1 -0
- package/dist/2020.js +1 -0
- package/dist/2020.js.map +1 -0
- package/dist/2246.js +1 -0
- package/dist/2246.js.map +1 -0
- package/dist/2317.js +1 -0
- package/dist/2317.js.map +1 -0
- package/dist/2416.js +1 -0
- package/dist/2416.js.map +1 -0
- package/dist/2790.js +1 -0
- package/dist/2790.js.map +1 -0
- package/dist/282.js +1 -0
- package/dist/282.js.map +1 -0
- package/dist/2881.js +1 -0
- package/dist/2881.js.map +1 -0
- package/dist/3137.js +1 -0
- package/dist/3137.js.map +1 -0
- package/dist/3378.js +1 -0
- package/dist/3378.js.map +1 -0
- package/dist/3390.js +1 -0
- package/dist/3390.js.map +1 -0
- package/dist/3536.js +1 -0
- package/dist/3536.js.map +1 -0
- package/dist/3720.js +1 -0
- package/dist/3720.js.map +1 -0
- package/dist/3857.js +1 -0
- package/dist/3857.js.map +1 -0
- package/dist/3925.js +1 -0
- package/dist/3925.js.map +1 -0
- package/dist/3963.js +1 -0
- package/dist/3963.js.map +1 -0
- package/dist/3989.js +1 -0
- package/dist/3989.js.map +1 -0
- package/dist/4092.js +1 -0
- package/dist/4092.js.map +1 -0
- package/dist/4106.js +1 -0
- package/dist/4106.js.map +1 -0
- package/dist/4111.js +1 -0
- package/dist/4111.js.map +1 -0
- package/dist/4145.js +1 -0
- package/dist/4145.js.map +1 -0
- package/dist/434.js +1 -0
- package/dist/434.js.map +1 -0
- package/dist/4348.js +1 -0
- package/dist/4348.js.map +1 -0
- package/dist/4383.js +1 -0
- package/dist/4383.js.map +1 -0
- package/dist/4540.js +1 -0
- package/dist/4540.js.map +1 -0
- package/dist/4658.js +1 -0
- package/dist/4658.js.map +1 -0
- package/dist/466.js +1 -0
- package/dist/466.js.map +1 -0
- package/dist/4913.js +1 -0
- package/dist/4913.js.map +1 -0
- package/dist/4928.js +1 -0
- package/dist/4928.js.map +1 -0
- package/dist/5069.js +1 -0
- package/dist/5069.js.map +1 -0
- package/dist/5117.js +1 -0
- package/dist/5117.js.map +1 -0
- package/dist/5132.js +1 -0
- package/dist/5132.js.map +1 -0
- package/dist/5145.js +1 -0
- package/dist/5145.js.map +1 -0
- package/dist/52.js +1 -0
- package/dist/52.js.map +1 -0
- package/dist/5422.js +1 -0
- package/dist/5422.js.map +1 -0
- package/dist/5503.js +1 -0
- package/dist/5503.js.map +1 -0
- package/dist/5549.js +1 -0
- package/dist/5549.js.map +1 -0
- package/dist/556.js +1 -0
- package/dist/556.js.map +1 -0
- package/dist/5644.js +1 -0
- package/dist/5644.js.map +1 -0
- package/dist/5697.js +1 -0
- package/dist/5697.js.map +1 -0
- package/dist/5793.js +1 -0
- package/dist/5793.js.map +1 -0
- package/dist/5940.js +1 -0
- package/dist/5940.js.map +1 -0
- package/dist/5952.js +1 -0
- package/dist/5952.js.map +1 -0
- package/dist/6047.js +1 -0
- package/dist/6047.js.map +1 -0
- package/dist/6371.js +1 -0
- package/dist/6371.js.map +1 -0
- package/dist/6377.js +1 -0
- package/dist/6377.js.map +1 -0
- package/dist/6444.js +1 -0
- package/dist/6444.js.map +1 -0
- package/dist/6479.js +1 -0
- package/dist/6479.js.map +1 -0
- package/dist/6508.js +1 -0
- package/dist/6508.js.map +1 -0
- package/dist/6724.js +1 -0
- package/dist/6724.js.map +1 -0
- package/dist/6759.js +27 -0
- package/dist/6759.js.map +1 -0
- package/dist/689.js +1 -0
- package/dist/689.js.map +1 -0
- package/dist/6904.js +1 -0
- package/dist/6904.js.map +1 -0
- package/dist/7045.js +1 -0
- package/dist/7045.js.map +1 -0
- package/dist/7175.js +1 -0
- package/dist/7175.js.map +1 -0
- package/dist/7182.js +1 -0
- package/dist/7182.js.map +1 -0
- package/dist/7302.js +1 -0
- package/dist/7302.js.map +1 -0
- package/dist/7646.js +17 -0
- package/dist/7646.js.map +1 -0
- package/dist/7742.js +1 -0
- package/dist/7742.js.map +1 -0
- package/dist/7912.js +1 -0
- package/dist/7912.js.map +1 -0
- package/dist/8105.js +21 -0
- package/dist/8105.js.map +1 -0
- package/dist/8202.js +1 -0
- package/dist/8202.js.map +1 -0
- package/dist/8349.js +1 -0
- package/dist/8349.js.map +1 -0
- package/dist/8358.js +1 -0
- package/dist/8358.js.map +1 -0
- package/dist/8359.js +1 -0
- package/dist/8359.js.map +1 -0
- package/dist/8695.js +1 -0
- package/dist/8695.js.map +1 -0
- package/dist/8702.js +1 -0
- package/dist/8702.js.map +1 -0
- package/dist/8894.js +1 -0
- package/dist/8894.js.map +1 -0
- package/dist/8958.js +1 -0
- package/dist/8958.js.map +1 -0
- package/dist/903.js +1 -0
- package/dist/903.js.map +1 -0
- package/dist/9061.js +1 -0
- package/dist/9061.js.map +1 -0
- package/dist/9072.js +1 -0
- package/dist/9072.js.map +1 -0
- package/dist/9105.js +1 -0
- package/dist/9105.js.map +1 -0
- package/dist/9107.js +1 -0
- package/dist/9107.js.map +1 -0
- package/dist/9456.js +1 -0
- package/dist/9456.js.map +1 -0
- package/dist/9586.js +1 -0
- package/dist/9586.js.map +1 -0
- package/dist/9712.js +1 -0
- package/dist/9712.js.map +1 -0
- package/dist/9771.js +1 -0
- package/dist/9771.js.map +1 -0
- package/dist/9806.js +1 -0
- package/dist/9806.js.map +1 -0
- package/dist/9873.js +1 -0
- package/dist/9873.js.map +1 -0
- package/dist/9927.js +1 -0
- package/dist/9927.js.map +1 -0
- package/dist/main.js +6 -0
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-patient-chart-app.js +6 -0
- package/dist/openmrs-esm-patient-chart-app.js.buildmanifest.json +2386 -0
- package/dist/openmrs-esm-patient-chart-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/package.json +63 -0
- package/rspack.config.js +1 -0
- package/src/actions-buttons/action-button.scss +3 -0
- package/src/actions-buttons/delete-visit.component.tsx +41 -0
- package/src/actions-buttons/delete-visit.test.tsx +26 -0
- package/src/actions-buttons/mark-patient-alive.component.tsx +42 -0
- package/src/actions-buttons/mark-patient-deceased.component.tsx +35 -0
- package/src/actions-buttons/start-visit.component.tsx +41 -0
- package/src/actions-buttons/start-visit.test.tsx +44 -0
- package/src/actions-buttons/stop-visit.component.tsx +39 -0
- package/src/actions-buttons/stop-visit.test.tsx +27 -0
- package/src/clinical-views/encounter-list/encounter-list-tabs.extension.tsx +78 -0
- package/src/clinical-views/encounter-list/encounter-list-tabs.scss +7 -0
- package/src/clinical-views/encounter-list/encounter-list.component.tsx +306 -0
- package/src/clinical-views/encounter-list/encounter-list.scss +36 -0
- package/src/clinical-views/encounter-list/table.component.tsx +63 -0
- package/src/clinical-views/encounter-list/table.scss +11 -0
- package/src/clinical-views/encounter-list/tag.component.test.tsx +307 -0
- package/src/clinical-views/encounter-list/tag.component.tsx +43 -0
- package/src/clinical-views/encounter-tile/clinical-views-summary.component.tsx +40 -0
- package/src/clinical-views/encounter-tile/encounter-tile.component.tsx +94 -0
- package/src/clinical-views/encounter-tile/tile.scss +82 -0
- package/src/clinical-views/hooks/index.ts +3 -0
- package/src/clinical-views/hooks/useEncounterRows.ts +60 -0
- package/src/clinical-views/hooks/useEncountersByVisit.ts +13 -0
- package/src/clinical-views/hooks/useFormsJson.ts +15 -0
- package/src/clinical-views/hooks/useLastEncounter.ts +29 -0
- package/src/clinical-views/types.ts +305 -0
- package/src/clinical-views/utils/concept-utils.ts +24 -0
- package/src/clinical-views/utils/encounter-list-config-builder.ts +160 -0
- package/src/clinical-views/utils/encounter-list.resource.ts +26 -0
- package/src/clinical-views/utils/helpers.ts +226 -0
- package/src/clinical-views/utils/index.ts +90 -0
- package/src/config-schema.ts +235 -0
- package/src/constants.ts +11 -0
- package/src/dashboard.meta.ts +15 -0
- package/src/data.resource.ts +117 -0
- package/src/declarations.d.ts +4 -0
- package/src/index.ts +204 -0
- package/src/loader/loader.component.tsx +11 -0
- package/src/loader/loader.scss +9 -0
- package/src/mark-patient-alive/mark-patient-alive.modal.tsx +54 -0
- package/src/mark-patient-deceased/mark-patient-deceased-form.scss +175 -0
- package/src/mark-patient-deceased/mark-patient-deceased-form.test.tsx +203 -0
- package/src/mark-patient-deceased/mark-patient-deceased-form.workspace.tsx +295 -0
- package/src/offline.ts +41 -0
- package/src/patient-banner-tags/visit-attribute-tags.extension.tsx +62 -0
- package/src/patient-banner-tags/visit-attribute-tags.scss +8 -0
- package/src/patient-chart/chart-review/chart-review.component.tsx +138 -0
- package/src/patient-chart/chart-review/chart-review.test.tsx +77 -0
- package/src/patient-chart/chart-review/dashboard-view.component.tsx +85 -0
- package/src/patient-chart/chart-review/dashboard-view.scss +84 -0
- package/src/patient-chart/patient-chart.component.tsx +71 -0
- package/src/patient-chart/patient-chart.resources.test.ts +238 -0
- package/src/patient-chart/patient-chart.resources.ts +231 -0
- package/src/patient-chart/patient-chart.scss +65 -0
- package/src/patient-details-tile/patient-details-tile.component.tsx +25 -0
- package/src/patient-details-tile/patient-details-tile.scss +24 -0
- package/src/root.component.tsx +35 -0
- package/src/root.scss +54 -0
- package/src/routes.json +267 -0
- package/src/side-nav/side-menu.component.tsx +10 -0
- package/src/side-nav/side-menu.scss +38 -0
- package/src/side-nav/side-menu.test.tsx +27 -0
- package/src/utils.test.ts +17 -0
- package/src/utils.ts +5 -0
- package/src/visit/hooks/useDefaultFacilityLocation.tsx +15 -0
- package/src/visit/hooks/useDefaultVisitLocation.tsx +24 -0
- package/src/visit/hooks/useDeleteVisit.test.tsx +267 -0
- package/src/visit/hooks/useDeleteVisit.tsx +103 -0
- package/src/visit/hooks/useOfflineVisitType.tsx +18 -0
- package/src/visit/hooks/useRecommendedVisitTypes.tsx +34 -0
- package/src/visit/hooks/useVisitAttributeType.tsx +102 -0
- package/src/visit/start-visit-button.component.tsx +47 -0
- package/src/visit/start-visit-button.test.tsx +32 -0
- package/src/visit/visit-action-items/delete-visit-action-item.component.tsx +60 -0
- package/src/visit/visit-action-items/delete-visit-action-item.test.tsx +48 -0
- package/src/visit/visit-action-items/edit-visit-details.component.tsx +79 -0
- package/src/visit/visit-form/base-visit-type.component.tsx +121 -0
- package/src/visit/visit-form/base-visit-type.scss +75 -0
- package/src/visit/visit-form/base-visit-type.test.tsx +153 -0
- package/src/visit/visit-form/exported-visit-form.workspace.tsx +755 -0
- package/src/visit/visit-form/location-selector.component.tsx +86 -0
- package/src/visit/visit-form/location-selector.test.tsx +146 -0
- package/src/visit/visit-form/recommended-visit-type.component.tsx +32 -0
- package/src/visit/visit-form/visit-attribute-type.component.tsx +258 -0
- package/src/visit/visit-form/visit-attribute-type.scss +5 -0
- package/src/visit/visit-form/visit-date-time.component.tsx +206 -0
- package/src/visit/visit-form/visit-form.resource.ts +401 -0
- package/src/visit/visit-form/visit-form.scss +167 -0
- package/src/visit/visit-form/visit-form.test.tsx +1233 -0
- package/src/visit/visit-form/visit-form.workspace.tsx +61 -0
- package/src/visit/visit-form/visit-type.test.tsx +88 -0
- package/src/visit/visit-history-table/visit-actions-cell.component.tsx +20 -0
- package/src/visit/visit-history-table/visit-actions-cell.scss +4 -0
- package/src/visit/visit-history-table/visit-date-cell.component.tsx +19 -0
- package/src/visit/visit-history-table/visit-diagnoses-cell.component.tsx +18 -0
- package/src/visit/visit-history-table/visit-history-table.component.tsx +145 -0
- package/src/visit/visit-history-table/visit-history-table.scss +25 -0
- package/src/visit/visit-history-table/visit-type-cell.component.tsx +15 -0
- package/src/visit/visit-prompt/delete-visit-dialog.modal.tsx +46 -0
- package/src/visit/visit-prompt/delete-visit-dialog.test.tsx +79 -0
- package/src/visit/visit-prompt/end-visit-dialog.modal.tsx +82 -0
- package/src/visit/visit-prompt/end-visit-dialog.scss +7 -0
- package/src/visit/visit-prompt/end-visit-dialog.test.tsx +131 -0
- package/src/visit/visit-prompt/modify-visit-date.modal.tsx +40 -0
- package/src/visit/visit-prompt/start-visit-dialog.modal.tsx +64 -0
- package/src/visit/visit-prompt/start-visit-dialog.scss +10 -0
- package/src/visit/visit-prompt/start-visit-dialog.test.tsx +40 -0
- package/src/visit/visits-widget/active-visit-buttons/active-visit-buttons.scss +7 -0
- package/src/visit/visits-widget/active-visit-buttons/active-visit-buttons.tsx +178 -0
- package/src/visit/visits-widget/current-visit-summary.extension.tsx +48 -0
- package/src/visit/visits-widget/current-visit-summary.scss +10 -0
- package/src/visit/visits-widget/current-visit-summary.test.tsx +85 -0
- package/src/visit/visits-widget/encounter-observations/encounter-observations.component.tsx +67 -0
- package/src/visit/visits-widget/encounter-observations/index.ts +3 -0
- package/src/visit/visits-widget/encounter-observations/styles.scss +22 -0
- package/src/visit/visits-widget/past-visits-components/delete-encounter.modal.tsx +47 -0
- package/src/visit/visits-widget/past-visits-components/delete-encounter.scss +9 -0
- package/src/visit/visits-widget/past-visits-components/encounters-table/all-encounters-table.component.tsx +49 -0
- package/src/visit/visits-widget/past-visits-components/encounters-table/completed-forms-table.component.tsx +67 -0
- package/src/visit/visits-widget/past-visits-components/encounters-table/completed-forms-table.test.tsx +146 -0
- package/src/visit/visits-widget/past-visits-components/encounters-table/encounters-table.component.tsx +452 -0
- package/src/visit/visits-widget/past-visits-components/encounters-table/encounters-table.resource.test.ts +156 -0
- package/src/visit/visits-widget/past-visits-components/encounters-table/encounters-table.resource.ts +215 -0
- package/src/visit/visits-widget/past-visits-components/encounters-table/encounters-table.scss +113 -0
- package/src/visit/visits-widget/past-visits-components/encounters-table/encounters-table.test.tsx +432 -0
- package/src/visit/visits-widget/past-visits-components/encounters-table/visit-completed-forms-table.component.tsx +61 -0
- package/src/visit/visits-widget/past-visits-components/encounters-table/visit-completed-forms-table.test.tsx +125 -0
- package/src/visit/visits-widget/past-visits-components/encounters-table/visit-encounters-table.component.tsx +47 -0
- package/src/visit/visits-widget/past-visits-components/medications-summary.component.tsx +163 -0
- package/src/visit/visits-widget/past-visits-components/notes-summary.component.tsx +66 -0
- package/src/visit/visits-widget/past-visits-components/patient-notes-summary.component.tsx +318 -0
- package/src/visit/visits-widget/past-visits-components/tests-summary.component.tsx +16 -0
- package/src/visit/visits-widget/past-visits-components/visit-summary.component.tsx +192 -0
- package/src/visit/visits-widget/past-visits-components/visit-summary.scss +72 -0
- package/src/visit/visits-widget/past-visits-components/visit-summary.test.tsx +105 -0
- package/src/visit/visits-widget/single-visit-details/visit-timeline/visit-timeline.component.tsx +94 -0
- package/src/visit/visits-widget/single-visit-details/visit-timeline/visit-timeline.scss +60 -0
- package/src/visit/visits-widget/visit-context/retrospective-data-date-time-picker/restrospective-date-time-picker.scss +35 -0
- package/src/visit/visits-widget/visit-context/retrospective-data-date-time-picker/retrospective-date-time-picker.component.tsx +140 -0
- package/src/visit/visits-widget/visit-context/visit-context-header.extension.tsx +61 -0
- package/src/visit/visits-widget/visit-context/visit-context-header.scss +45 -0
- package/src/visit/visits-widget/visit-context/visit-context-header.test.tsx +59 -0
- package/src/visit/visits-widget/visit-context/visit-context-info.component.tsx +37 -0
- package/src/visit/visits-widget/visit-context/visit-context-info.scss +12 -0
- package/src/visit/visits-widget/visit-context/visit-context-switcher.modal.tsx +166 -0
- package/src/visit/visits-widget/visit-context/visit-context-switcher.scss +83 -0
- package/src/visit/visits-widget/visit-context/visit-context-switcher.test.tsx +79 -0
- package/src/visit/visits-widget/visit-detail-overview.component.tsx +67 -0
- package/src/visit/visits-widget/visit-detail-overview.scss +301 -0
- package/src/visit/visits-widget/visit-detail-overview.test.tsx +205 -0
- package/src/visit/visits-widget/visit.resource.tsx +146 -0
- package/translations/am.json +209 -0
- package/translations/ar.json +209 -0
- package/translations/ar_SY.json +209 -0
- package/translations/bn.json +209 -0
- package/translations/cs.json +209 -0
- package/translations/de.json +209 -0
- package/translations/en.json +209 -0
- package/translations/en_US.json +209 -0
- package/translations/es.json +209 -0
- package/translations/es_MX.json +209 -0
- package/translations/fr.json +209 -0
- package/translations/he.json +209 -0
- package/translations/hi.json +209 -0
- package/translations/hi_IN.json +209 -0
- package/translations/id.json +209 -0
- package/translations/it.json +209 -0
- package/translations/ka.json +209 -0
- package/translations/km.json +209 -0
- package/translations/ku.json +209 -0
- package/translations/ky.json +209 -0
- package/translations/lg.json +209 -0
- package/translations/ne.json +209 -0
- package/translations/pl.json +209 -0
- package/translations/pt.json +209 -0
- package/translations/pt_BR.json +209 -0
- package/translations/qu.json +209 -0
- package/translations/ro_RO.json +209 -0
- package/translations/ru_RU.json +209 -0
- package/translations/si.json +209 -0
- package/translations/sq.json +209 -0
- package/translations/sw.json +209 -0
- package/translations/sw_KE.json +209 -0
- package/translations/tr.json +209 -0
- package/translations/tr_TR.json +209 -0
- package/translations/uk.json +209 -0
- package/translations/uz.json +209 -0
- package/translations/uz@Latn.json +209 -0
- package/translations/uz_UZ.json +209 -0
- package/translations/vi.json +209 -0
- package/translations/zh.json +209 -0
- package/translations/zh_CN.json +209 -0
- package/translations/zh_TW.json +209 -0
- package/tsconfig.json +4 -0
- package/vitest.config.ts +4 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Tab, TabList, TabPanel, TabPanels, Tabs } from '@carbon/react';
|
|
4
|
+
import { useConfig } from '@openmrs/esm-framework';
|
|
5
|
+
import type { ChartConfig } from '../../config-schema';
|
|
6
|
+
import AllEncountersTable from './past-visits-components/encounters-table/all-encounters-table.component';
|
|
7
|
+
import CompletedFormsTable from './past-visits-components/encounters-table/completed-forms-table.component';
|
|
8
|
+
import PatientNotesSummary from './past-visits-components/patient-notes-summary.component';
|
|
9
|
+
import VisitHistoryTable from '../visit-history-table/visit-history-table.component';
|
|
10
|
+
import styles from './visit-detail-overview.scss';
|
|
11
|
+
|
|
12
|
+
interface VisitOverviewComponentProps {
|
|
13
|
+
patientUuid: string;
|
|
14
|
+
patient: fhir.Patient;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function VisitDetailOverviewComponent({ patientUuid, patient }: VisitOverviewComponentProps) {
|
|
18
|
+
const { t } = useTranslation();
|
|
19
|
+
const [tabIndex, setTabIndex] = useState(0);
|
|
20
|
+
const { showAllEncountersTab } = useConfig<ChartConfig>();
|
|
21
|
+
|
|
22
|
+
const completedFormsTabIndex = showAllEncountersTab ? 2 : 1;
|
|
23
|
+
const notesTabIndex = showAllEncountersTab ? 3 : 2;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={styles.tabs}>
|
|
27
|
+
<Tabs onChange={({ selectedIndex }) => setTabIndex(selectedIndex)} selectedIndex={tabIndex}>
|
|
28
|
+
<TabList aria-label="Visit detail tabs" className={styles.tabList}>
|
|
29
|
+
<Tab className={styles.tab} id="visit-summaries-tab">
|
|
30
|
+
{t('Visits', 'Visits')}
|
|
31
|
+
</Tab>
|
|
32
|
+
{showAllEncountersTab ? (
|
|
33
|
+
<Tab className={styles.tab} id="all-encounters-tab">
|
|
34
|
+
{t('allEncounters', 'All encounters')}
|
|
35
|
+
</Tab>
|
|
36
|
+
) : (
|
|
37
|
+
<></>
|
|
38
|
+
)}
|
|
39
|
+
<Tab className={styles.tab} id="completed-forms-tab">
|
|
40
|
+
{t('completedForms', 'Completed forms')}
|
|
41
|
+
</Tab>
|
|
42
|
+
<Tab className={styles.tab} id="patient-notes-tab">
|
|
43
|
+
{t('notes', 'Notes')}
|
|
44
|
+
</Tab>
|
|
45
|
+
</TabList>
|
|
46
|
+
<TabPanels>
|
|
47
|
+
<TabPanel>
|
|
48
|
+
<VisitHistoryTable patientUuid={patientUuid} patient={patient} />
|
|
49
|
+
</TabPanel>
|
|
50
|
+
{showAllEncountersTab && (
|
|
51
|
+
<TabPanel>
|
|
52
|
+
<AllEncountersTable patientUuid={patientUuid} />
|
|
53
|
+
</TabPanel>
|
|
54
|
+
)}
|
|
55
|
+
<TabPanel>
|
|
56
|
+
<CompletedFormsTable patientUuid={patientUuid} isTabActive={tabIndex === completedFormsTabIndex} />
|
|
57
|
+
</TabPanel>
|
|
58
|
+
<TabPanel>
|
|
59
|
+
<PatientNotesSummary patientUuid={patientUuid} isTabActive={tabIndex === notesTabIndex} />
|
|
60
|
+
</TabPanel>
|
|
61
|
+
</TabPanels>
|
|
62
|
+
</Tabs>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default VisitDetailOverviewComponent;
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
|
+
@use '@carbon/type';
|
|
4
|
+
@use '@openmrs/esm-styleguide/src/vars' as *;
|
|
5
|
+
|
|
6
|
+
.visitType {
|
|
7
|
+
@include type.type-style('heading-compact-02');
|
|
8
|
+
color: $text-02;
|
|
9
|
+
margin-bottom: 5px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.date {
|
|
13
|
+
@include type.type-style('body-compact-01');
|
|
14
|
+
color: $text-02;
|
|
15
|
+
padding-right: 0.625rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dateLabel {
|
|
19
|
+
padding-right: 0.313rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.displayFlex {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: left;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.container {
|
|
29
|
+
background-color: $ui-background;
|
|
30
|
+
border: 1px solid $grey-2;
|
|
31
|
+
padding: layout.$spacing-05;
|
|
32
|
+
margin: layout.$spacing-05 0 layout.$spacing-05;
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.tabs > :global(.cds--tab-content) {
|
|
37
|
+
padding: 0 0 !important;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.tabList {
|
|
41
|
+
position: sticky;
|
|
42
|
+
top: 3rem;
|
|
43
|
+
z-index: 10;
|
|
44
|
+
background-color: $ui-01;
|
|
45
|
+
box-shadow: inset 0 -2px 0 0 $ui-03;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.tab {
|
|
49
|
+
height: 2.5rem;
|
|
50
|
+
|
|
51
|
+
&:active,
|
|
52
|
+
&:focus {
|
|
53
|
+
outline: none !important;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:global(.cds--tabs__nav-item--selected) {
|
|
57
|
+
border-bottom-color: var(--brand-03);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.patientNotesTabList {
|
|
62
|
+
background-color: $ui-01;
|
|
63
|
+
box-shadow: inset 0 -1px 0 0 $ui-03;
|
|
64
|
+
|
|
65
|
+
:global(.cds--tab--list) {
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.patientNotesTab {
|
|
71
|
+
height: 2.5rem;
|
|
72
|
+
|
|
73
|
+
&:active,
|
|
74
|
+
&:focus {
|
|
75
|
+
outline: none !important;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&:global(.cds--tabs__nav-item--selected) {
|
|
79
|
+
border-bottom-color: var(--brand-03);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.header {
|
|
84
|
+
.visitInfo {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: space-between;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.header::after {
|
|
92
|
+
content: '';
|
|
93
|
+
display: block;
|
|
94
|
+
width: layout.$spacing-07;
|
|
95
|
+
padding-top: 0.188rem;
|
|
96
|
+
border-bottom: 0.375rem solid var(--brand-03);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.toggleButtons {
|
|
100
|
+
margin: 0 layout.$spacing-05;
|
|
101
|
+
height: layout.$spacing-08;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.toggle {
|
|
105
|
+
border: 1px solid colors.$blue-30;
|
|
106
|
+
|
|
107
|
+
&:hover {
|
|
108
|
+
background-color: $color-blue-10;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&:active,
|
|
112
|
+
&:focus {
|
|
113
|
+
box-shadow: none;
|
|
114
|
+
background-color: $color-blue-10;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&:first-of-type {
|
|
118
|
+
border-radius: layout.$spacing-02 0 0 layout.$spacing-02;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&:last-of-type {
|
|
122
|
+
border-radius: 0 layout.$spacing-02 layout.$spacing-02 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.emptyStateContainer {
|
|
127
|
+
text-align: center;
|
|
128
|
+
margin: layout.$spacing-05 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.observation {
|
|
132
|
+
display: grid;
|
|
133
|
+
grid-template-columns: 1fr 1fr;
|
|
134
|
+
grid-gap: layout.$spacing-03;
|
|
135
|
+
margin: layout.$spacing-05 layout.$spacing-05 0 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.observation > span {
|
|
139
|
+
align-self: center;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.flexSections {
|
|
143
|
+
display: flex;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.desktopTabs {
|
|
147
|
+
button {
|
|
148
|
+
height: layout.$spacing-07;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.tabletTabs {
|
|
153
|
+
button {
|
|
154
|
+
height: layout.$spacing-09;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.tabContent {
|
|
159
|
+
border-top: 1px solid $ui-03;
|
|
160
|
+
padding: layout.$spacing-05 0;
|
|
161
|
+
width: 70%;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.medicationRecord {
|
|
165
|
+
display: flex;
|
|
166
|
+
flex-direction: column;
|
|
167
|
+
justify-content: space-between;
|
|
168
|
+
|
|
169
|
+
.bodyLong01 {
|
|
170
|
+
gap: layout.$spacing-02;
|
|
171
|
+
margin: layout.$spacing-02 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.medicationContainer {
|
|
176
|
+
background-color: $ui-01;
|
|
177
|
+
padding: layout.$spacing-05;
|
|
178
|
+
width: 100% !important;
|
|
179
|
+
display: flex;
|
|
180
|
+
flex-direction: column;
|
|
181
|
+
align-items: flex-start;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.medicationContainer > div {
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
align-items: flex-start;
|
|
188
|
+
width: 100%;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.medicationContainer p {
|
|
192
|
+
margin: layout.$spacing-02 0;
|
|
193
|
+
display: flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
flex-wrap: wrap;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.dosage {
|
|
199
|
+
@include type.type-style('heading-compact-01');
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.toggleSwitch {
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-direction: row;
|
|
205
|
+
justify-content: flex-end;
|
|
206
|
+
margin-bottom: layout.$spacing-02;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.toggleSwitch div {
|
|
210
|
+
width: 30%;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.noteText {
|
|
214
|
+
background-color: $ui-01;
|
|
215
|
+
padding: layout.$spacing-05;
|
|
216
|
+
width: 100% !important;
|
|
217
|
+
white-space: pre-wrap;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.currentUserNoteText {
|
|
221
|
+
background-color: colors.$blue-10;
|
|
222
|
+
color: colors.$blue-70;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.currentUserNoteMetadata {
|
|
226
|
+
color: colors.$blue-70;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.notePreview {
|
|
230
|
+
display: block;
|
|
231
|
+
max-inline-size: 32rem;
|
|
232
|
+
overflow: hidden;
|
|
233
|
+
text-overflow: ellipsis;
|
|
234
|
+
white-space: nowrap;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.noteTableDetails {
|
|
238
|
+
padding: layout.$spacing-05 0;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.metadata {
|
|
242
|
+
@include type.type-style('label-01');
|
|
243
|
+
color: $text-02;
|
|
244
|
+
margin: layout.$spacing-03 0 layout.$spacing-05;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.observationsEmptyState {
|
|
248
|
+
margin-top: layout.$spacing-06;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.loader {
|
|
252
|
+
margin: 0 auto;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.notesContainer {
|
|
256
|
+
margin-bottom: layout.$spacing-07;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.visitDetailOverviewActions {
|
|
260
|
+
display: flex;
|
|
261
|
+
justify-content: flex-end;
|
|
262
|
+
align-items: center;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.loadMoreButton {
|
|
266
|
+
:global(.cds--inline-loading) {
|
|
267
|
+
min-height: layout.$spacing-05 !important;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
:global(.cds--inline-loading__text) {
|
|
271
|
+
font-size: unset !important;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.label01 {
|
|
276
|
+
@include type.type-style('label-01');
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.tag {
|
|
280
|
+
margin: 0 layout.$spacing-02 0 !important;
|
|
281
|
+
text-transform: uppercase;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.text02 {
|
|
285
|
+
color: colors.$gray-70;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.bodyLong01 {
|
|
289
|
+
@include type.type-style('body-01');
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Overriding styles for RTL support
|
|
293
|
+
html[dir='rtl'] {
|
|
294
|
+
.header {
|
|
295
|
+
.visitInfo {
|
|
296
|
+
display: flex;
|
|
297
|
+
align-items: center;
|
|
298
|
+
justify-content: space-between;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { vi, describe, it, expect, type Mock } from 'vitest';
|
|
3
|
+
import { screen, within } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import { getConfig, getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
|
|
6
|
+
import { mockEncounterTypes, visitOverviewDetailMockData } from '__mocks__';
|
|
7
|
+
import { mockPatient, renderWithSwr, waitForLoadingToFinish } from 'tools';
|
|
8
|
+
import { esmPatientChartSchema, type ChartConfig } from '../../config-schema';
|
|
9
|
+
import VisitDetailOverview from './visit-detail-overview.component';
|
|
10
|
+
import { usePaginatedVisits } from './visit.resource';
|
|
11
|
+
import {
|
|
12
|
+
useEncounterTypes,
|
|
13
|
+
usePaginatedEncounters,
|
|
14
|
+
useAllEncounters,
|
|
15
|
+
} from './past-visits-components/encounters-table/encounters-table.resource';
|
|
16
|
+
|
|
17
|
+
const mockGetConfig = getConfig as Mock;
|
|
18
|
+
const mockUseConfig = vi.mocked(useConfig<ChartConfig>);
|
|
19
|
+
|
|
20
|
+
const mockUseAllEncounters = vi.fn(useAllEncounters).mockReturnValue({
|
|
21
|
+
data: [],
|
|
22
|
+
isLoading: false,
|
|
23
|
+
error: undefined,
|
|
24
|
+
} as any);
|
|
25
|
+
|
|
26
|
+
const mockPaginatedVisitsData: ReturnType<typeof usePaginatedVisits> = {
|
|
27
|
+
data: visitOverviewDetailMockData.data.results,
|
|
28
|
+
error: null,
|
|
29
|
+
mutate: vi.fn(),
|
|
30
|
+
isValidating: false,
|
|
31
|
+
isLoading: false,
|
|
32
|
+
totalPages: 1,
|
|
33
|
+
totalCount: 1,
|
|
34
|
+
currentPage: 1,
|
|
35
|
+
currentPageSize: { current: 10 },
|
|
36
|
+
paginated: false,
|
|
37
|
+
showNextButton: false,
|
|
38
|
+
showPreviousButton: false,
|
|
39
|
+
goTo: vi.fn(),
|
|
40
|
+
goToNext: vi.fn(),
|
|
41
|
+
goToPrevious: vi.fn(),
|
|
42
|
+
};
|
|
43
|
+
vi.mock('./visit.resource', async () => ({
|
|
44
|
+
...((await vi.importActual('./visit.resource')) as object),
|
|
45
|
+
usePaginatedVisits: vi.fn().mockImplementation(() => mockPaginatedVisitsData),
|
|
46
|
+
}));
|
|
47
|
+
const mockUsePaginatedVisits = vi.mocked(usePaginatedVisits);
|
|
48
|
+
|
|
49
|
+
const mockUsePaginatedEncounters = vi.fn(usePaginatedEncounters).mockReturnValue({
|
|
50
|
+
error: null,
|
|
51
|
+
mutate: vi.fn(),
|
|
52
|
+
isValidating: false,
|
|
53
|
+
isLoading: false,
|
|
54
|
+
data: [],
|
|
55
|
+
totalPages: 0,
|
|
56
|
+
totalCount: 0,
|
|
57
|
+
currentPage: 0,
|
|
58
|
+
currentPageSize: undefined,
|
|
59
|
+
paginated: false,
|
|
60
|
+
showNextButton: false,
|
|
61
|
+
showPreviousButton: false,
|
|
62
|
+
goTo: undefined,
|
|
63
|
+
goToNext: undefined,
|
|
64
|
+
goToPrevious: undefined,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const mockUseEncounterTypes = vi.fn(useEncounterTypes).mockReturnValue({
|
|
68
|
+
data: mockEncounterTypes,
|
|
69
|
+
totalCount: mockEncounterTypes.length,
|
|
70
|
+
hasMore: false,
|
|
71
|
+
loadMore: vi.fn(),
|
|
72
|
+
error: undefined,
|
|
73
|
+
mutate: vi.fn(),
|
|
74
|
+
isValidating: false,
|
|
75
|
+
isLoading: false,
|
|
76
|
+
nextUri: '',
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
vi.mock('./past-visits-components/encounters-table/encounters-table.resource', async () => ({
|
|
80
|
+
...((await vi.importActual('./past-visits-components/encounters-table/encounters-table.resource')) as object),
|
|
81
|
+
usePaginatedEncounters: () => mockUsePaginatedEncounters('patient-uuid', null, 10),
|
|
82
|
+
useAllEncounters: () => mockUseAllEncounters('patient-uuid', null),
|
|
83
|
+
useEncounterTypes: () => mockUseEncounterTypes(),
|
|
84
|
+
}));
|
|
85
|
+
|
|
86
|
+
describe('VisitDetailOverview', () => {
|
|
87
|
+
it('renders an empty state view if encounters data is unavailable', async () => {
|
|
88
|
+
mockUsePaginatedVisits.mockReturnValueOnce({
|
|
89
|
+
...mockPaginatedVisitsData,
|
|
90
|
+
data: [],
|
|
91
|
+
});
|
|
92
|
+
mockGetConfig.mockResolvedValue({ htmlFormEntryForms: [] });
|
|
93
|
+
|
|
94
|
+
renderWithSwr(<VisitDetailOverview patientUuid={mockPatient.id} patient={mockPatient} />);
|
|
95
|
+
|
|
96
|
+
await waitForLoadingToFinish();
|
|
97
|
+
|
|
98
|
+
// visits table view
|
|
99
|
+
expect(screen.getByRole('heading', { name: /past visits/i })).toBeInTheDocument();
|
|
100
|
+
expect(screen.getAllByTitle(/Empty data illustration/i)[0]).toBeInTheDocument();
|
|
101
|
+
expect(screen.getAllByText(/There are no visits to display for this patient/i)[0]).toBeInTheDocument();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('renders an error state view if there was a problem fetching visit data', async () => {
|
|
105
|
+
const error = {
|
|
106
|
+
message: 'Unauthorized',
|
|
107
|
+
response: {
|
|
108
|
+
status: 401,
|
|
109
|
+
statusText: 'Unauthorized',
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
mockUsePaginatedVisits.mockReturnValue({
|
|
113
|
+
...mockPaginatedVisitsData,
|
|
114
|
+
data: null,
|
|
115
|
+
error,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
renderWithSwr(<VisitDetailOverview patientUuid={mockPatient.id} patient={mockPatient} />);
|
|
119
|
+
|
|
120
|
+
await waitForLoadingToFinish();
|
|
121
|
+
|
|
122
|
+
// visits table view
|
|
123
|
+
expect(screen.queryByRole('table')).not.toBeInTheDocument();
|
|
124
|
+
expect(screen.getAllByText(/visits/i)[0]).toBeInTheDocument();
|
|
125
|
+
expect(screen.getByText(/Error State/i)).toBeInTheDocument();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it(`renders a summary of the patient's visits and encounters when data is available and showAllEncountersTab is true`, async () => {
|
|
129
|
+
const user = userEvent.setup();
|
|
130
|
+
mockGetConfig.mockResolvedValue({ htmlFormEntryForms: [] });
|
|
131
|
+
mockUseConfig.mockReturnValue({
|
|
132
|
+
...getDefaultsFromConfigSchema(esmPatientChartSchema),
|
|
133
|
+
showAllEncountersTab: true,
|
|
134
|
+
});
|
|
135
|
+
mockUsePaginatedVisits.mockReturnValue(mockPaginatedVisitsData);
|
|
136
|
+
|
|
137
|
+
renderWithSwr(<VisitDetailOverview patientUuid={mockPatient.id} patient={mockPatient} />);
|
|
138
|
+
|
|
139
|
+
await waitForLoadingToFinish();
|
|
140
|
+
|
|
141
|
+
const allEncountersTab = screen.getByRole('tab', { name: /All encounters/i });
|
|
142
|
+
const visitsTab = screen.getByRole('tab', { name: /visit/i });
|
|
143
|
+
const visitDetailTabs = screen.getByRole('tablist', { name: /visit detail tabs/i });
|
|
144
|
+
const notesTab = within(visitDetailTabs).getByRole('tab', { name: /notes/i });
|
|
145
|
+
|
|
146
|
+
expect(visitsTab).toBeInTheDocument();
|
|
147
|
+
expect(allEncountersTab).toBeInTheDocument();
|
|
148
|
+
expect(notesTab).toBeInTheDocument();
|
|
149
|
+
expect(visitsTab).toHaveAttribute('aria-selected', 'true');
|
|
150
|
+
expect(allEncountersTab).toHaveAttribute('aria-selected', 'false');
|
|
151
|
+
|
|
152
|
+
await user.click(notesTab);
|
|
153
|
+
expect(screen.getByRole('tab', { name: /all notes/i })).toBeInTheDocument();
|
|
154
|
+
expect(screen.getByRole('tab', { name: /my notes/i })).toBeInTheDocument();
|
|
155
|
+
|
|
156
|
+
await user.click(visitsTab);
|
|
157
|
+
await screen.getByRole('button', { name: /expand current row/i }).click();
|
|
158
|
+
const visitSummaryTabs = screen.getByRole('tablist', { name: /visit summary tabs/i });
|
|
159
|
+
expect(within(visitSummaryTabs).getByRole('tab', { name: /notes/i })).toBeInTheDocument();
|
|
160
|
+
expect(within(visitSummaryTabs).getByRole('tab', { name: /tests/i })).toBeInTheDocument();
|
|
161
|
+
expect(within(visitSummaryTabs).getByRole('tab', { name: /medications/i })).toBeInTheDocument();
|
|
162
|
+
expect(within(visitSummaryTabs).getByRole('tab', { name: /^encounters$/i })).toBeInTheDocument();
|
|
163
|
+
|
|
164
|
+
expect(screen.getByText(/no diagnoses found/i)).toBeInTheDocument();
|
|
165
|
+
expect(screen.getByText(/There are no notes to display for this patient/i)).toBeInTheDocument();
|
|
166
|
+
expect(screen.getByText(/There are no medications to display for this patient/i)).toBeInTheDocument();
|
|
167
|
+
|
|
168
|
+
await user.click(allEncountersTab);
|
|
169
|
+
|
|
170
|
+
expect(allEncountersTab).toHaveAttribute('aria-selected', 'true');
|
|
171
|
+
expect(visitsTab).toHaveAttribute('aria-selected', 'false');
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it('should render only the visit summary tab when showAllEncountersTab is false', async () => {
|
|
175
|
+
mockGetConfig.mockResolvedValue({ htmlFormEntryForms: [] });
|
|
176
|
+
mockUseConfig.mockReturnValue({
|
|
177
|
+
...getDefaultsFromConfigSchema(esmPatientChartSchema),
|
|
178
|
+
showAllEncountersTab: false,
|
|
179
|
+
});
|
|
180
|
+
mockUsePaginatedVisits.mockReturnValue(mockPaginatedVisitsData);
|
|
181
|
+
|
|
182
|
+
renderWithSwr(<VisitDetailOverview patientUuid={mockPatient.id} patient={mockPatient} />);
|
|
183
|
+
|
|
184
|
+
await waitForLoadingToFinish();
|
|
185
|
+
|
|
186
|
+
const visitsTab = screen.getByRole('tab', { name: /visits/i });
|
|
187
|
+
const visitDetailTabs = screen.getByRole('tablist', { name: /visit detail tabs/i });
|
|
188
|
+
|
|
189
|
+
expect(visitsTab).toBeInTheDocument();
|
|
190
|
+
expect(within(visitDetailTabs).getByRole('tab', { name: /notes/i })).toBeInTheDocument();
|
|
191
|
+
expect(visitsTab).toHaveAttribute('aria-selected', 'true');
|
|
192
|
+
expect(screen.queryByText('/All encounters/i')).not.toBeInTheDocument();
|
|
193
|
+
|
|
194
|
+
await screen.getByRole('button', { name: /expand current row/i }).click();
|
|
195
|
+
const visitSummaryTabs = screen.getByRole('tablist', { name: /visit summary tabs/i });
|
|
196
|
+
expect(within(visitSummaryTabs).getByRole('tab', { name: /notes/i })).toBeInTheDocument();
|
|
197
|
+
expect(within(visitSummaryTabs).getByRole('tab', { name: /tests/i })).toBeInTheDocument();
|
|
198
|
+
expect(within(visitSummaryTabs).getByRole('tab', { name: /medications/i })).toBeInTheDocument();
|
|
199
|
+
expect(within(visitSummaryTabs).getByRole('tab', { name: /^encounters$/i })).toBeInTheDocument();
|
|
200
|
+
|
|
201
|
+
expect(screen.getByText(/no diagnoses found/i)).toBeInTheDocument();
|
|
202
|
+
expect(screen.getByText(/There are no notes to display for this patient/i)).toBeInTheDocument();
|
|
203
|
+
expect(screen.getByText(/There are no medications to display for this patient/i)).toBeInTheDocument();
|
|
204
|
+
});
|
|
205
|
+
});
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import {
|
|
2
|
+
openmrsFetch,
|
|
3
|
+
restBaseUrl,
|
|
4
|
+
type OpenmrsResource,
|
|
5
|
+
type Visit,
|
|
6
|
+
useOpenmrsInfinite,
|
|
7
|
+
useOpenmrsPagination,
|
|
8
|
+
} from '@openmrs/esm-framework';
|
|
9
|
+
|
|
10
|
+
const customRepresentation =
|
|
11
|
+
'custom:(uuid,location,encounters:(uuid,diagnoses:(uuid,display,rank,diagnosis,voided),form:(uuid,display,name,description,encounterType,version,resources:(uuid,display,name,valueReference)),encounterDatetime,orders:full,obs:(uuid,concept:(uuid,display,conceptClass:(uuid,display)),display,groupMembers:(uuid,concept:(uuid,display),value:(uuid,display),display),value,obsDatetime),encounterType:(uuid,display,viewPrivilege,editPrivilege),encounterProviders:(uuid,display,encounterRole:(uuid,display),provider:(uuid,person:(uuid,display)))),visitType:(uuid,name,display),startDatetime,stopDatetime,patient,attributes:(attributeType:ref,display,uuid,value)';
|
|
12
|
+
|
|
13
|
+
export function useInfiniteVisits(
|
|
14
|
+
patientUuid: string,
|
|
15
|
+
params: Record<string, number | string> = {},
|
|
16
|
+
rep: string = customRepresentation,
|
|
17
|
+
) {
|
|
18
|
+
const url = new URL(
|
|
19
|
+
`${window.openmrsBase}/${restBaseUrl}/visit?patient=${patientUuid}&v=${rep}`,
|
|
20
|
+
window.location.toString(),
|
|
21
|
+
);
|
|
22
|
+
for (const key in params) {
|
|
23
|
+
url.searchParams.set(key, '' + params[key]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const { data, mutate, ...rest } = useOpenmrsInfinite<Visit>(patientUuid ? url : null);
|
|
27
|
+
|
|
28
|
+
return { visits: data, mutate, ...rest };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function usePaginatedVisits(
|
|
32
|
+
patientUuid: string,
|
|
33
|
+
pageSize: number,
|
|
34
|
+
params: Record<string, number | string> = {},
|
|
35
|
+
) {
|
|
36
|
+
const url = new URL(
|
|
37
|
+
`${window.openmrsBase}/${restBaseUrl}/visit?patient=${patientUuid}&v=${customRepresentation}`,
|
|
38
|
+
window.location.toString(),
|
|
39
|
+
);
|
|
40
|
+
for (const key in params) {
|
|
41
|
+
url.searchParams.set(key, '' + params[key]);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const ret = useOpenmrsPagination<Visit>(url, pageSize);
|
|
45
|
+
|
|
46
|
+
return ret;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function deleteVisit(visitUuid: string) {
|
|
50
|
+
return openmrsFetch(`${restBaseUrl}/visit/${visitUuid}`, {
|
|
51
|
+
method: 'DELETE',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function restoreVisit(visitUuid: string) {
|
|
56
|
+
return openmrsFetch<Visit>(`${restBaseUrl}/visit/${visitUuid}`, {
|
|
57
|
+
headers: {
|
|
58
|
+
'content-type': 'application/json',
|
|
59
|
+
},
|
|
60
|
+
method: 'POST',
|
|
61
|
+
body: { voided: false },
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface Order {
|
|
66
|
+
uuid: string;
|
|
67
|
+
action?: string | null;
|
|
68
|
+
autoExpireDate?: Date | null;
|
|
69
|
+
dateActivated: string;
|
|
70
|
+
dateStopped?: Date | null;
|
|
71
|
+
fulfillerStatus?: string | null;
|
|
72
|
+
dose: number;
|
|
73
|
+
dosingInstructions: string | null;
|
|
74
|
+
dosingType?: 'org.openmrs.FreeTextDosingInstructions' | 'org.openmrs.SimpleDosingInstructions';
|
|
75
|
+
doseUnits: {
|
|
76
|
+
uuid: string;
|
|
77
|
+
display: string;
|
|
78
|
+
};
|
|
79
|
+
drug: {
|
|
80
|
+
uuid: string;
|
|
81
|
+
name: string;
|
|
82
|
+
strength: string;
|
|
83
|
+
display: string;
|
|
84
|
+
};
|
|
85
|
+
duration: number;
|
|
86
|
+
durationUnits: {
|
|
87
|
+
uuid: string;
|
|
88
|
+
display: string;
|
|
89
|
+
};
|
|
90
|
+
frequency: {
|
|
91
|
+
uuid: string;
|
|
92
|
+
display: string;
|
|
93
|
+
};
|
|
94
|
+
numRefills: number;
|
|
95
|
+
orderNumber: string;
|
|
96
|
+
orderReason: string | null;
|
|
97
|
+
orderReasonNonCoded: string | null;
|
|
98
|
+
orderer: OpenmrsResource;
|
|
99
|
+
orderType: {
|
|
100
|
+
uuid: string;
|
|
101
|
+
display: string;
|
|
102
|
+
};
|
|
103
|
+
route: {
|
|
104
|
+
uuid: string;
|
|
105
|
+
display: string;
|
|
106
|
+
};
|
|
107
|
+
quantity: number;
|
|
108
|
+
quantityUnits: OpenmrsResource;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface Note {
|
|
112
|
+
authorNames?: Array<string>;
|
|
113
|
+
authorUuids?: Array<string>;
|
|
114
|
+
concept: OpenmrsResource;
|
|
115
|
+
note: string;
|
|
116
|
+
provider: {
|
|
117
|
+
name: string;
|
|
118
|
+
role: string;
|
|
119
|
+
};
|
|
120
|
+
time: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface OrderItem {
|
|
124
|
+
order: Order;
|
|
125
|
+
provider: {
|
|
126
|
+
name: string;
|
|
127
|
+
role: string;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface Diagnosis {
|
|
132
|
+
certainty: string;
|
|
133
|
+
display: string;
|
|
134
|
+
encounter: OpenmrsResource;
|
|
135
|
+
links: Array<any>;
|
|
136
|
+
patient: OpenmrsResource;
|
|
137
|
+
rank: number;
|
|
138
|
+
resourceVersion: string;
|
|
139
|
+
uuid: string;
|
|
140
|
+
voided: boolean;
|
|
141
|
+
diagnosis: {
|
|
142
|
+
coded: {
|
|
143
|
+
display: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
}
|