@kenyaemr/esm-service-queues-app 7.0.2-pre.65
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/.turbo/turbo-build.log +40 -0
- package/README.md +20 -0
- package/dist/130.js +2 -0
- package/dist/130.js.LICENSE.txt +3 -0
- package/dist/130.js.map +1 -0
- package/dist/152.js +1 -0
- package/dist/152.js.map +1 -0
- package/dist/169.js +1 -0
- package/dist/169.js.map +1 -0
- package/dist/185.js +1 -0
- package/dist/185.js.map +1 -0
- package/dist/233.js +1 -0
- package/dist/233.js.map +1 -0
- package/dist/237.js +1 -0
- package/dist/237.js.map +1 -0
- package/dist/255.js +2 -0
- package/dist/255.js.LICENSE.txt +9 -0
- package/dist/255.js.map +1 -0
- package/dist/271.js +1 -0
- package/dist/276.js +1 -0
- package/dist/276.js.map +1 -0
- package/dist/303.js +1 -0
- package/dist/303.js.map +1 -0
- package/dist/319.js +1 -0
- package/dist/401.js +1 -0
- package/dist/401.js.map +1 -0
- package/dist/430.js +2 -0
- package/dist/430.js.LICENSE.txt +50 -0
- package/dist/430.js.map +1 -0
- package/dist/460.js +1 -0
- package/dist/501.js +1 -0
- package/dist/501.js.map +1 -0
- package/dist/574.js +1 -0
- package/dist/591.js +2 -0
- package/dist/591.js.LICENSE.txt +32 -0
- package/dist/591.js.map +1 -0
- package/dist/644.js +1 -0
- package/dist/647.js +1 -0
- package/dist/647.js.map +1 -0
- package/dist/650.js +1 -0
- package/dist/650.js.map +1 -0
- package/dist/669.js +1 -0
- package/dist/669.js.map +1 -0
- package/dist/696.js +1 -0
- package/dist/696.js.map +1 -0
- package/dist/703.js +1 -0
- package/dist/703.js.map +1 -0
- package/dist/729.js +1 -0
- package/dist/729.js.map +1 -0
- package/dist/738.js +1 -0
- package/dist/738.js.map +1 -0
- package/dist/757.js +1 -0
- package/dist/764.js +1 -0
- package/dist/764.js.map +1 -0
- package/dist/784.js +2 -0
- package/dist/784.js.LICENSE.txt +9 -0
- package/dist/784.js.map +1 -0
- package/dist/788.js +1 -0
- package/dist/806.js +1 -0
- package/dist/806.js.map +1 -0
- package/dist/807.js +1 -0
- package/dist/833.js +1 -0
- package/dist/877.js +1 -0
- package/dist/877.js.map +1 -0
- package/dist/917.js +1 -0
- package/dist/917.js.map +1 -0
- package/dist/940.js +1 -0
- package/dist/940.js.map +1 -0
- package/dist/981.js +1 -0
- package/dist/981.js.map +1 -0
- package/dist/kenyaemr-esm-service-queues-app.js +1 -0
- package/dist/kenyaemr-esm-service-queues-app.js.buildmanifest.json +965 -0
- package/dist/kenyaemr-esm-service-queues-app.js.map +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +60 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/jest.config.js +3 -0
- package/package.json +54 -0
- package/src/active-visits/active-visits-row-actions.component.tsx +25 -0
- package/src/active-visits/active-visits-row-actions.scss +4 -0
- package/src/active-visits/active-visits-table.resource.ts +273 -0
- package/src/active-visits/change-status-dialog.component.tsx +272 -0
- package/src/active-visits/change-status-dialog.scss +47 -0
- package/src/active-visits/change-status-dialog.test.tsx +154 -0
- package/src/add-patient-toqueue/add-patient-toqueue-dialog.component.tsx +228 -0
- package/src/add-patient-toqueue/add-patient-toqueue-dialog.scss +32 -0
- package/src/add-provider-queue-room/add-provider-queue-room.component.tsx +238 -0
- package/src/add-provider-queue-room/add-provider-queue-room.resource.ts +76 -0
- package/src/add-provider-queue-room/add-provider-queue-room.scss +17 -0
- package/src/add-provider-queue-room/add-provider-queue-room.test.tsx +105 -0
- package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.component.tsx +76 -0
- package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.resource.ts +7 -0
- package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.scss +8 -0
- package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.test.tsx +43 -0
- package/src/clear-queue-entries-dialog/clear-queue-entries.component.tsx +43 -0
- package/src/config-schema.ts +465 -0
- package/src/constants.ts +10 -0
- package/src/createDashboardLink.component.tsx +39 -0
- package/src/current-visit/current-visit-summary.component.tsx +38 -0
- package/src/current-visit/current-visit-summary.test.tsx +43 -0
- package/src/current-visit/current-visit.resource.ts +84 -0
- package/src/current-visit/current-visit.scss +34 -0
- package/src/current-visit/hooks/useVitalsConceptMetadata.tsx +101 -0
- package/src/current-visit/visit-details/biometrics-config-schema.ts +14 -0
- package/src/current-visit/visit-details/current-visit-details.component.tsx +96 -0
- package/src/current-visit/visit-details/triage-note.component.tsx +53 -0
- package/src/current-visit/visit-details/triage-note.scss +89 -0
- package/src/current-visit/visit-details/vitals-config-schema.ts +17 -0
- package/src/current-visit/visit-details/vitals.component.tsx +165 -0
- package/src/dashboard.meta.ts +5 -0
- package/src/declarations.d.ts +4 -0
- package/src/helpers/functions.ts +28 -0
- package/src/helpers/helpers.ts +177 -0
- package/src/helpers/time-helpers.ts +15 -0
- package/src/home.component.tsx +16 -0
- package/src/home.test.tsx +48 -0
- package/src/hooks/useConcept.ts +13 -0
- package/src/hooks/useQueue.ts +10 -0
- package/src/hooks/useQueueEntries.ts +187 -0
- package/src/hooks/useQueues.ts +22 -0
- package/src/hooks/useSystemSetting.ts +18 -0
- package/src/index.ts +172 -0
- package/src/past-visit/past-visit-details/encounter-list.component.tsx +54 -0
- package/src/past-visit/past-visit-details/medications-list.component.tsx +98 -0
- package/src/past-visit/past-visit-details/notes-list.component.tsx +41 -0
- package/src/past-visit/past-visit-details/past-visit-summary.component.tsx +181 -0
- package/src/past-visit/past-visit-details/past-visit-summary.scss +58 -0
- package/src/past-visit/past-visit.component.tsx +37 -0
- package/src/past-visit/past-visit.resource.ts +83 -0
- package/src/past-visit/past-visit.scss +126 -0
- package/src/past-visit/past-visit.test.tsx +41 -0
- package/src/patient-info/appointment-details.component.tsx +98 -0
- package/src/patient-info/appointment-details.scss +34 -0
- package/src/patient-info/appointment-details.test.tsx +36 -0
- package/src/patient-info/appointments.resource.ts +43 -0
- package/src/patient-info/hooks/usePatientAttributes.tsx +42 -0
- package/src/patient-info/patient-info.component.tsx +82 -0
- package/src/patient-info/patient-info.scss +60 -0
- package/src/patient-info/patient-info.test.tsx +43 -0
- package/src/patient-queue-header/patient-queue-header.component.tsx +99 -0
- package/src/patient-queue-header/patient-queue-header.scss +90 -0
- package/src/patient-queue-header/patient-queue-illustration.component.tsx +22 -0
- package/src/patient-queue-metrics/clinic-metrics.component.tsx +98 -0
- package/src/patient-queue-metrics/clinic-metrics.resource.ts +58 -0
- package/src/patient-queue-metrics/clinic-metrics.scss +11 -0
- package/src/patient-queue-metrics/clinic-metrics.test.tsx +76 -0
- package/src/patient-queue-metrics/metrics-card.component.tsx +68 -0
- package/src/patient-queue-metrics/metrics-card.scss +80 -0
- package/src/patient-queue-metrics/metrics-header.component.tsx +61 -0
- package/src/patient-queue-metrics/metrics-header.scss +26 -0
- package/src/patient-queue-metrics/queue-metrics.resource.ts +42 -0
- package/src/patient-search/advanced-search.component.tsx +191 -0
- package/src/patient-search/advanced-search.scss +154 -0
- package/src/patient-search/advanced-search.test.tsx +29 -0
- package/src/patient-search/basic-search.component.tsx +112 -0
- package/src/patient-search/basic-search.scss +139 -0
- package/src/patient-search/basic-search.test.tsx +23 -0
- package/src/patient-search/empty-data-illustration.component.tsx +41 -0
- package/src/patient-search/hooks/useActivePatientEnrollment.tsx +29 -0
- package/src/patient-search/hooks/useDefaultLocation.ts +14 -0
- package/src/patient-search/hooks/usePatients.tsx +25 -0
- package/src/patient-search/hooks/useQueueLocations.tsx +23 -0
- package/src/patient-search/hooks/useRecommendedVisitTypes.tsx +35 -0
- package/src/patient-search/hooks/useScheduledVisits.ts +52 -0
- package/src/patient-search/patient-scheduled-visits.component.tsx +324 -0
- package/src/patient-search/patient-scheduled-visits.scss +131 -0
- package/src/patient-search/patient-scheduled-visits.test.tsx +44 -0
- package/src/patient-search/patient-search.scss +43 -0
- package/src/patient-search/patient-search.workspace.tsx +135 -0
- package/src/patient-search/search-illustration.component.tsx +27 -0
- package/src/patient-search/search-results.component.tsx +75 -0
- package/src/patient-search/search-results.scss +80 -0
- package/src/patient-search/search-results.test.tsx +77 -0
- package/src/patient-search/search.resource.ts +10 -0
- package/src/patient-search/visit-form/existing-visit-form.component.tsx +112 -0
- package/src/patient-search/visit-form/queue.resource.ts +64 -0
- package/src/patient-search/visit-form/visit-form.component.tsx +344 -0
- package/src/patient-search/visit-form/visit-form.scss +73 -0
- package/src/patient-search/visit-form/visit-type-selector.component.tsx +155 -0
- package/src/patient-search/visit-form/visit-type-selector.scss +100 -0
- package/src/patient-search/visit-form/visit-type-selector.test.tsx +83 -0
- package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.component.tsx +178 -0
- package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.scss +19 -0
- package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.test.tsx +63 -0
- package/src/queue-entry-table-components/edit-entry.scss +14 -0
- package/src/queue-entry-table-components/queue-duration.component.tsx +41 -0
- package/src/queue-entry-table-components/queue-priority.component.tsx +38 -0
- package/src/queue-entry-table-components/queue-priority.scss +12 -0
- package/src/queue-entry-table-components/queue-status.component.tsx +39 -0
- package/src/queue-entry-table-components/transition-entry.component.tsx +55 -0
- package/src/queue-entry-table-components/transition-entry.scss +22 -0
- package/src/queue-patient-linelists/queue-linelist-base-table.component.tsx +241 -0
- package/src/queue-patient-linelists/queue-linelist-base-table.scss +110 -0
- package/src/queue-patient-linelists/queue-linelist-base-table.test.tsx +93 -0
- package/src/queue-patient-linelists/queue-linelist-filter.scss +63 -0
- package/src/queue-patient-linelists/queue-linelist-filter.test.tsx +94 -0
- package/src/queue-patient-linelists/queue-linelist-filter.workspace.tsx +185 -0
- package/src/queue-patient-linelists/queue-linelist.resource.ts +84 -0
- package/src/queue-patient-linelists/queue-services-table.component.tsx +63 -0
- package/src/queue-patient-linelists/scheduled-appointments-table.component.tsx +305 -0
- package/src/queue-patient-linelists/scheduled-appointments-table.test.tsx +41 -0
- package/src/queue-rooms/queue-room-form.scss +56 -0
- package/src/queue-rooms/queue-room-form.test.tsx +80 -0
- package/src/queue-rooms/queue-room-form.workspace.tsx +169 -0
- package/src/queue-rooms/queue-room.resource.ts +20 -0
- package/src/queue-screen/queue-screen.component.tsx +47 -0
- package/src/queue-screen/queue-screen.scss +39 -0
- package/src/queue-screen/queue-screen.test.tsx +51 -0
- package/src/queue-screen/useActiveTickets.tsx +13 -0
- package/src/queue-services/queue-service-form.scss +61 -0
- package/src/queue-services/queue-service-form.test.tsx +60 -0
- package/src/queue-services/queue-service-form.workspace.tsx +179 -0
- package/src/queue-services/queue-service.resource.ts +33 -0
- package/src/queue-table/cells/columns.resource.ts +135 -0
- package/src/queue-table/cells/queue-table-action-cell.component.tsx +88 -0
- package/src/queue-table/cells/queue-table-action-cell.scss +7 -0
- package/src/queue-table/cells/queue-table-coming-from-cell.component.tsx +13 -0
- package/src/queue-table/cells/queue-table-extension-cell.component.tsx +16 -0
- package/src/queue-table/cells/queue-table-name-cell.component.tsx +20 -0
- package/src/queue-table/cells/queue-table-patient-age-cell.component.tsx +18 -0
- package/src/queue-table/cells/queue-table-patient-identifier-cell.component.tsx +25 -0
- package/src/queue-table/cells/queue-table-priority-cell.component.tsx +23 -0
- package/src/queue-table/cells/queue-table-queue-name-cell.component.tsx +14 -0
- package/src/queue-table/cells/queue-table-status-cell.component.tsx +18 -0
- package/src/queue-table/cells/queue-table-visit-attribute-queue-number-cell.component.tsx +37 -0
- package/src/queue-table/cells/queue-table-visit-start-time-cell.component.tsx +20 -0
- package/src/queue-table/cells/queue-table-wait-time-cell.component.tsx +17 -0
- package/src/queue-table/default-queue-table.component.tsx +174 -0
- package/src/queue-table/default-queue-table.test.tsx +131 -0
- package/src/queue-table/queue-entry-actions/edit-queue-entry-modal.component.tsx +52 -0
- package/src/queue-table/queue-entry-actions/end-queue-entry-modal.component.tsx +39 -0
- package/src/queue-table/queue-entry-actions/queue-entry-actions-modal.component.tsx +362 -0
- package/src/queue-table/queue-entry-actions/queue-entry-actions-modal.test.tsx +152 -0
- package/src/queue-table/queue-entry-actions/queue-entry-actions.resource.ts +83 -0
- package/src/queue-table/queue-entry-actions/queue-entry-actons-modal.scss +36 -0
- package/src/queue-table/queue-entry-actions/queue-entry-confirm-action-modal.component.tsx +97 -0
- package/src/queue-table/queue-entry-actions/queue-entry-confirm-action-modal.test.tsx +106 -0
- package/src/queue-table/queue-entry-actions/queue-entry-undo-actions-modal.test.tsx +76 -0
- package/src/queue-table/queue-entry-actions/transition-queue-entry-modal.component.tsx +51 -0
- package/src/queue-table/queue-entry-actions/undo-transition-queue-entry-modal.component.tsx +58 -0
- package/src/queue-table/queue-entry-actions/void-queue-entry-modal.component.tsx +34 -0
- package/src/queue-table/queue-table-by-status-menu.component.tsx +42 -0
- package/src/queue-table/queue-table-by-status-menu.scss +11 -0
- package/src/queue-table/queue-table-by-status-skeleton.component.tsx +32 -0
- package/src/queue-table/queue-table-by-status.component.tsx +96 -0
- package/src/queue-table/queue-table-expanded-row.component.tsx +29 -0
- package/src/queue-table/queue-table-metrics-card.component.tsx +50 -0
- package/src/queue-table/queue-table-metrics-card.scss +48 -0
- package/src/queue-table/queue-table-metrics.component.tsx +30 -0
- package/src/queue-table/queue-table-metrics.scss +11 -0
- package/src/queue-table/queue-table.component.tsx +179 -0
- package/src/queue-table/queue-table.scss +192 -0
- package/src/queue-table/queue-table.test.tsx +210 -0
- package/src/remove-queue-entry-dialog/remove-queue-entry.component.tsx +87 -0
- package/src/remove-queue-entry-dialog/remove-queue-entry.resource.ts +93 -0
- package/src/remove-queue-entry-dialog/remove-queue-entry.scss +7 -0
- package/src/remove-queue-entry-dialog/remove-queue-entry.test.tsx +45 -0
- package/src/root.component.tsx +28 -0
- package/src/root.scss +15 -0
- package/src/root.test.tsx +24 -0
- package/src/routes.json +133 -0
- package/src/side-menu/nav-group/createNavGroup.tsx +17 -0
- package/src/side-menu/nav-group/nav-group.component.tsx +24 -0
- package/src/side-menu/nav-group/nav-group.test.tsx +32 -0
- package/src/side-menu/nav-group/nav-group.ts +10 -0
- package/src/side-menu/side-menu.component.tsx +6 -0
- package/src/side-menu/side-menu.test.tsx +17 -0
- package/src/transition-queue-entry/transition-queue-entry-dialog.component.tsx +134 -0
- package/src/transition-queue-entry/transition-queue-entry-dialog.scss +12 -0
- package/src/transition-queue-entry/transition-queue-entry-dialog.test.tsx +102 -0
- package/src/transition-queue-entry/transition-queue-entry.resource.ts +16 -0
- package/src/types/index.ts +494 -0
- package/src/views/queue-table-by-status-view.component.tsx +25 -0
- package/src/views/queue-tables-for-all-statuses.component.tsx +150 -0
- package/src/visits-missing-inqueue/visits-missing-inqueue.component.tsx +277 -0
- package/src/visits-missing-inqueue/visits-missing-inqueue.resource.ts +93 -0
- package/src/visits-missing-inqueue/visits-missing-inqueue.scss +108 -0
- package/translations/am.json +295 -0
- package/translations/ar.json +295 -0
- package/translations/en.json +305 -0
- package/translations/es.json +295 -0
- package/translations/fr.json +295 -0
- package/translations/he.json +295 -0
- package/translations/km.json +295 -0
- package/translations/zh.json +295 -0
- package/translations/zh_CN.json +295 -0
- package/tsconfig.json +5 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
4
|
+
|
|
5
|
+
.patientBannerContainer {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
background-color: $ui-01;
|
|
9
|
+
border-top: 1px solid $ui-03;
|
|
10
|
+
border-bottom: 1px solid $ui-03;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.patientBanner {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.patientPhoto {
|
|
19
|
+
margin: 1rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.backButton {
|
|
23
|
+
align-items: center;
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: flex-start;
|
|
26
|
+
margin: spacing.$spacing-03 0;
|
|
27
|
+
padding: 0;
|
|
28
|
+
@include type.type-style('body-compact-01');
|
|
29
|
+
|
|
30
|
+
button {
|
|
31
|
+
display: flex;
|
|
32
|
+
|
|
33
|
+
svg {
|
|
34
|
+
order: 1;
|
|
35
|
+
margin-right: spacing.$spacing-03;
|
|
36
|
+
margin-left: 0rem !important;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
span {
|
|
40
|
+
order: 2;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { SearchTypes } from '../types';
|
|
4
|
+
import PatientScheduledVisits from './patient-scheduled-visits.component';
|
|
5
|
+
import VisitForm from './visit-form/visit-form.component';
|
|
6
|
+
import {
|
|
7
|
+
ArrowLeftIcon,
|
|
8
|
+
type DefaultWorkspaceProps,
|
|
9
|
+
displayName,
|
|
10
|
+
ErrorState,
|
|
11
|
+
PatientBannerContactDetails,
|
|
12
|
+
PatientBannerPatientInfo,
|
|
13
|
+
PatientBannerToggleContactDetailsButton,
|
|
14
|
+
PatientPhoto,
|
|
15
|
+
usePatient,
|
|
16
|
+
useVisit,
|
|
17
|
+
} from '@openmrs/esm-framework';
|
|
18
|
+
import ExistingVisitFormComponent from './visit-form/existing-visit-form.component';
|
|
19
|
+
import styles from './patient-search.scss';
|
|
20
|
+
import { Button, DataTableSkeleton } from '@carbon/react';
|
|
21
|
+
import { useScheduledVisits } from './hooks/useScheduledVisits';
|
|
22
|
+
import isNil from 'lodash-es/isNil';
|
|
23
|
+
import { useTranslation } from 'react-i18next';
|
|
24
|
+
|
|
25
|
+
interface PatientSearchProps extends DefaultWorkspaceProps {
|
|
26
|
+
selectedPatientUuid: string;
|
|
27
|
+
currentServiceQueueUuid?: string;
|
|
28
|
+
handleBackToSearchList?: () => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const AddPatientToQueueContext = React.createContext({
|
|
32
|
+
currentServiceQueueUuid: '',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const PatientSearch: React.FC<PatientSearchProps> = ({
|
|
36
|
+
closeWorkspace,
|
|
37
|
+
selectedPatientUuid,
|
|
38
|
+
currentServiceQueueUuid,
|
|
39
|
+
handleBackToSearchList,
|
|
40
|
+
}) => {
|
|
41
|
+
const { t } = useTranslation();
|
|
42
|
+
const { patient } = usePatient(selectedPatientUuid);
|
|
43
|
+
const { activeVisit } = useVisit(selectedPatientUuid);
|
|
44
|
+
const [searchType, setSearchType] = useState<SearchTypes>(SearchTypes.SCHEDULED_VISITS);
|
|
45
|
+
const [showContactDetails, setContactDetails] = useState(false);
|
|
46
|
+
const { appointments, isLoading, isError } = useScheduledVisits(selectedPatientUuid);
|
|
47
|
+
|
|
48
|
+
const hasAppointments = !(isNil(appointments?.futureVisits) && isNil(appointments?.recentVisits));
|
|
49
|
+
|
|
50
|
+
const backButtonDescription =
|
|
51
|
+
searchType === SearchTypes.VISIT_FORM && hasAppointments
|
|
52
|
+
? t('backToScheduledVisits', 'Back to scheduled visits')
|
|
53
|
+
: t('backToSearchResults', 'Back to search results');
|
|
54
|
+
|
|
55
|
+
const toggleSearchType = (searchType: SearchTypes) => {
|
|
56
|
+
setSearchType(searchType);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handleBackToAction = () => {
|
|
60
|
+
if (searchType === SearchTypes.VISIT_FORM && hasAppointments) {
|
|
61
|
+
setSearchType(SearchTypes.SCHEDULED_VISITS);
|
|
62
|
+
} else {
|
|
63
|
+
setSearchType(SearchTypes.SEARCH_RESULTS);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (searchType === SearchTypes.SCHEDULED_VISITS && appointments && !hasAppointments) {
|
|
69
|
+
setSearchType(SearchTypes.VISIT_FORM);
|
|
70
|
+
}
|
|
71
|
+
}, [hasAppointments, appointments]);
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (searchType === SearchTypes.SEARCH_RESULTS) {
|
|
75
|
+
handleBackToSearchList && handleBackToSearchList();
|
|
76
|
+
}
|
|
77
|
+
}, [searchType, handleBackToSearchList]);
|
|
78
|
+
|
|
79
|
+
const patientName = patient && displayName(patient);
|
|
80
|
+
return patient ? (
|
|
81
|
+
<AddPatientToQueueContext.Provider value={{ currentServiceQueueUuid }}>
|
|
82
|
+
<div className={styles.patientBannerContainer}>
|
|
83
|
+
<div className={styles.patientBanner}>
|
|
84
|
+
<div className={styles.patientPhoto}>
|
|
85
|
+
<PatientPhoto patientUuid={patient.id} patientName={patientName} />
|
|
86
|
+
</div>
|
|
87
|
+
<PatientBannerPatientInfo patient={patient} />
|
|
88
|
+
<PatientBannerToggleContactDetailsButton
|
|
89
|
+
showContactDetails={showContactDetails}
|
|
90
|
+
toggleContactDetails={() => setContactDetails(!showContactDetails)}
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
{showContactDetails ? (
|
|
94
|
+
<PatientBannerContactDetails patientId={patient.id} deceased={patient.deceasedBoolean} />
|
|
95
|
+
) : null}
|
|
96
|
+
</div>
|
|
97
|
+
<div className={styles.backButton}>
|
|
98
|
+
<Button
|
|
99
|
+
kind="ghost"
|
|
100
|
+
renderIcon={(props) => <ArrowLeftIcon size={24} {...props} />}
|
|
101
|
+
iconDescription={backButtonDescription}
|
|
102
|
+
size="sm"
|
|
103
|
+
onClick={() => handleBackToAction()}>
|
|
104
|
+
<span>{backButtonDescription}</span>
|
|
105
|
+
</Button>
|
|
106
|
+
</div>
|
|
107
|
+
<div>
|
|
108
|
+
{activeVisit ? (
|
|
109
|
+
<ExistingVisitFormComponent visit={activeVisit} closeWorkspace={closeWorkspace} />
|
|
110
|
+
) : (
|
|
111
|
+
<>
|
|
112
|
+
{isError ? (
|
|
113
|
+
<ErrorState headerTitle={t('errorFetchingAppointments', 'Error fetching appointments')} error={isError} />
|
|
114
|
+
) : null}
|
|
115
|
+
|
|
116
|
+
{isLoading && !isError ? (
|
|
117
|
+
<DataTableSkeleton role="progressbar" />
|
|
118
|
+
) : searchType === SearchTypes.SCHEDULED_VISITS && hasAppointments ? (
|
|
119
|
+
<PatientScheduledVisits
|
|
120
|
+
appointments={appointments}
|
|
121
|
+
patientUuid={selectedPatientUuid}
|
|
122
|
+
toggleSearchType={toggleSearchType}
|
|
123
|
+
closeWorkspace={closeWorkspace}
|
|
124
|
+
/>
|
|
125
|
+
) : searchType === SearchTypes.VISIT_FORM ? (
|
|
126
|
+
<VisitForm patientUuid={selectedPatientUuid} closeWorkspace={closeWorkspace} />
|
|
127
|
+
) : null}
|
|
128
|
+
</>
|
|
129
|
+
)}
|
|
130
|
+
</div>
|
|
131
|
+
</AddPatientToQueueContext.Provider>
|
|
132
|
+
) : null;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export default PatientSearch;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export default function SearchIllustration({ width = '62', height = '48' }) {
|
|
4
|
+
return (
|
|
5
|
+
<svg width={width} height={height} xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">
|
|
6
|
+
<defs>
|
|
7
|
+
<path
|
|
8
|
+
d="M36.001 3.218C47.482 9.838 51.403 24.52 44.782 36 38.162 47.482 23.48 51.403 12 44.782.518 38.162-3.403 23.48 3.218 12 9.838.518 24.52-3.403 36 3.218z"
|
|
9
|
+
id="a"
|
|
10
|
+
/>
|
|
11
|
+
</defs>
|
|
12
|
+
<g fill="none" fillRule="evenodd">
|
|
13
|
+
<path d="M36.001 3.218C47.482 9.838 51.403 24.52 44.782 36 38.162 47.482 23.48 51.403 12 44.782.518 38.162-3.403 23.48 3.218 12 9.838.518 24.52-3.403 36 3.218z" />
|
|
14
|
+
<mask id="b" fill="#fff">
|
|
15
|
+
<use xlinkHref="#a" />
|
|
16
|
+
</mask>
|
|
17
|
+
<use fill="#CEE6E5" xlinkHref="#a" />
|
|
18
|
+
<path
|
|
19
|
+
d="M38 48v-2.618c0-6.696-4.58-12.296-10.72-13.798a8.159 8.159 0 0 0 4.76-7.427C32.04 19.653 28.44 16 24 16c-4.44 0-8.04 3.653-8.04 8.157a8.159 8.159 0 0 0 4.76 7.427C14.58 33.086 10 38.686 10 45.382v2.598"
|
|
20
|
+
fill="#9ACBCA"
|
|
21
|
+
mask="url(#b)"
|
|
22
|
+
/>
|
|
23
|
+
<path fill="#9ACBCA" d="m45.34 35 17.124 10.33-1.55 2.57L43.79 37.568z" />
|
|
24
|
+
</g>
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { Dropdown } from '@carbon/react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { SearchTypes } from '../types';
|
|
5
|
+
import PatientInfo from '../patient-info/patient-info.component';
|
|
6
|
+
import styles from './search-results.scss';
|
|
7
|
+
|
|
8
|
+
interface SearchResultsProps {
|
|
9
|
+
patients: Array<fhir.Patient>;
|
|
10
|
+
hidePanel?: any;
|
|
11
|
+
toggleSearchType: (searchMode: SearchTypes, patientUuid: string) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type SortingCriteria = 'firstNameFirst' | 'lastNameFirst' | 'oldest' | 'youngest';
|
|
15
|
+
|
|
16
|
+
const SearchResults: React.FC<SearchResultsProps> = ({ patients, toggleSearchType }) => {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const [selectedSortingCriteria, setSelectedSortingCriteria] = useState<SortingCriteria>('firstNameFirst');
|
|
19
|
+
|
|
20
|
+
const sortedPatient = useMemo(() => {
|
|
21
|
+
return patients.sort((patientA, patientB) => {
|
|
22
|
+
if (selectedSortingCriteria === 'oldest') {
|
|
23
|
+
return new Date(patientA.birthDate).getTime() - new Date(patientB.birthDate).getTime();
|
|
24
|
+
}
|
|
25
|
+
if (selectedSortingCriteria === 'youngest') {
|
|
26
|
+
return new Date(patientB.birthDate).getTime() - new Date(patientA.birthDate).getTime();
|
|
27
|
+
}
|
|
28
|
+
if (selectedSortingCriteria === 'firstNameFirst') {
|
|
29
|
+
return patientA.name?.[0].given?.join('') < patientB.name?.[0].given?.join('') ? -1 : 0;
|
|
30
|
+
}
|
|
31
|
+
if (selectedSortingCriteria === 'lastNameFirst') {
|
|
32
|
+
return patientA?.name?.[0].family < patientB?.name?.[0].family ? -1 : 0;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}, [patients, selectedSortingCriteria]);
|
|
36
|
+
|
|
37
|
+
const sortingCriteria = [
|
|
38
|
+
{ id: 'firstNameFirst', label: t('firstNameSort', 'First name (a-z)') },
|
|
39
|
+
{ id: 'lastNameFirst', label: t('lastNameSort', 'Last name (a-z)') },
|
|
40
|
+
{ id: 'oldest', label: t('oldest', 'Oldest first') },
|
|
41
|
+
{ id: 'youngest', label: t('youngest', 'Youngest first') },
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<div className={styles.sortingCriteriaSelect}>
|
|
47
|
+
<Dropdown
|
|
48
|
+
aria-label="sortBy"
|
|
49
|
+
id="sortingCriteriaDropdown"
|
|
50
|
+
items={sortingCriteria}
|
|
51
|
+
initialSelectedItem={sortingCriteria[0]}
|
|
52
|
+
label={`${t('sortBy', 'Sort by')}:`}
|
|
53
|
+
titleText={`${t('sortBy', 'Sort by')}:`}
|
|
54
|
+
type="inline"
|
|
55
|
+
size="sm"
|
|
56
|
+
onChange={({ selectedItem }) => setSelectedSortingCriteria(selectedItem.id as SortingCriteria)}
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
{sortedPatient.map((patient, index) => (
|
|
60
|
+
<div key={`search-result-${index}`} className={styles.patientChart}>
|
|
61
|
+
<div className={styles.container}>
|
|
62
|
+
<PatientInfo
|
|
63
|
+
patient={patient}
|
|
64
|
+
handlePatientInfoClick={() => {
|
|
65
|
+
toggleSearchType(SearchTypes.SCHEDULED_VISITS, patient.id);
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
))}
|
|
71
|
+
</>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default SearchResults;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
4
|
+
|
|
5
|
+
.patientChart {
|
|
6
|
+
text-decoration: none;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:global(.omrs-breakpoint-gt-tablet) .patientChart {
|
|
10
|
+
background-color: $ui-02;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.container {
|
|
14
|
+
& .patientBanner {
|
|
15
|
+
background-color: red !important;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.patientBanner {
|
|
20
|
+
display: flex;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.patientName {
|
|
24
|
+
@include type.type-style('heading-03');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.patientAvatar {
|
|
28
|
+
width: spacing.$spacing-11;
|
|
29
|
+
height: spacing.$spacing-11;
|
|
30
|
+
margin: spacing.$spacing-05 spacing.$spacing-05 0;
|
|
31
|
+
border-radius: 1px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.patientInfo {
|
|
35
|
+
width: 100%;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-flow: column wrap;
|
|
38
|
+
margin: spacing.$spacing-05 0;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.demographics {
|
|
43
|
+
@include type.type-style('body-compact-02');
|
|
44
|
+
color: $text-02;
|
|
45
|
+
margin: 0.3rem 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.identifiers {
|
|
49
|
+
@include type.type-style('body-compact-02');
|
|
50
|
+
color: $ui-04;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.actionsContainer {
|
|
54
|
+
padding-top: spacing.$spacing-03;
|
|
55
|
+
margin-top: spacing.$spacing-05;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.sortingCriteriaSelect {
|
|
59
|
+
display: flex;
|
|
60
|
+
width: 100%;
|
|
61
|
+
justify-content: flex-end;
|
|
62
|
+
@include type.type-style('body-compact-02');
|
|
63
|
+
width: 100%;
|
|
64
|
+
|
|
65
|
+
:global(.cds--dropdown__wrapper--inline) {
|
|
66
|
+
gap: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:global(.cds--list-box__menu-icon) {
|
|
70
|
+
height: spacing.$spacing-05;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:global(.cds--list-box__menu) {
|
|
74
|
+
left: -7.5rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:global(.cds--label) {
|
|
78
|
+
margin-right: spacing.$spacing-02;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { screen, render } from '@testing-library/react';
|
|
3
|
+
import { age } from '@openmrs/esm-framework';
|
|
4
|
+
import SearchResults from './search-results.component';
|
|
5
|
+
|
|
6
|
+
const mockAge = age as jest.Mock;
|
|
7
|
+
|
|
8
|
+
jest.mock('@openmrs/esm-framework', () => {
|
|
9
|
+
const originalModule = jest.requireActual('@openmrs/esm-framework');
|
|
10
|
+
return {
|
|
11
|
+
...originalModule,
|
|
12
|
+
age: jest.fn(),
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const patients = [
|
|
17
|
+
{
|
|
18
|
+
id: 'b73bee73-7bf0-4872-9657-ba9de0d93478',
|
|
19
|
+
name: [{ given: ['John'], family: 'Smith' }],
|
|
20
|
+
person: {
|
|
21
|
+
gender: 'Male',
|
|
22
|
+
age: 2,
|
|
23
|
+
birthdate: '2020-02-01T00:00:00.000+0000',
|
|
24
|
+
birthdateEstimated: true,
|
|
25
|
+
personName: {
|
|
26
|
+
display: 'John Smith',
|
|
27
|
+
uuid: '27698bff-4056-430c-824c-cb18cf9329d8',
|
|
28
|
+
givenName: 'John',
|
|
29
|
+
middleName: null,
|
|
30
|
+
familyName: 'Smith',
|
|
31
|
+
familyName2: null,
|
|
32
|
+
voided: false,
|
|
33
|
+
},
|
|
34
|
+
addresses: [
|
|
35
|
+
{
|
|
36
|
+
display: 'Bom Jesus Street',
|
|
37
|
+
uuid: '7eab94da-4b33-4da9-b352-da21a571221a',
|
|
38
|
+
preferred: true,
|
|
39
|
+
address1: 'Bom Jesus Street',
|
|
40
|
+
address2: null,
|
|
41
|
+
cityVillage: 'Recife',
|
|
42
|
+
stateProvince: 'Pernambuco',
|
|
43
|
+
country: 'Brazil',
|
|
44
|
+
postalCode: '50030-310',
|
|
45
|
+
countyDistrict: null,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
display: 'John Smith',
|
|
49
|
+
dead: false,
|
|
50
|
+
deathDate: null,
|
|
51
|
+
},
|
|
52
|
+
gender: 'Male',
|
|
53
|
+
birthDate: '2020-02-01T00:00:00.000+0000',
|
|
54
|
+
deceasedDateTime: null,
|
|
55
|
+
identifier: [{ value: '10001F0' }],
|
|
56
|
+
address: [{ city: 'Recife', country: 'Brazil', postalCode: '50030-310', state: 'Pernambuco', use: 'home' }],
|
|
57
|
+
telecom: [],
|
|
58
|
+
patientIdentifier: { identifier: [{ value: '10001F0' }] },
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
const mockToggleSearchType = jest.fn();
|
|
63
|
+
|
|
64
|
+
describe('Search Results', () => {
|
|
65
|
+
it('should search results page', () => {
|
|
66
|
+
mockAge.mockReturnValue(35);
|
|
67
|
+
renderSearchResults();
|
|
68
|
+
expect(screen.getByText(/John Smith/)).toBeInTheDocument();
|
|
69
|
+
expect(screen.getByText(/35/)).toBeInTheDocument();
|
|
70
|
+
expect(screen.getByText(/Male/)).toBeInTheDocument();
|
|
71
|
+
expect(screen.getByText(/01 — Feb — 2020/i)).toBeInTheDocument();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const renderSearchResults = () => {
|
|
76
|
+
render(<SearchResults patients={patients} toggleSearchType={mockToggleSearchType} />);
|
|
77
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
|
|
3
|
+
export function findPatients(query: string, objectVersion: string, controller: AbortController, includeDead: boolean) {
|
|
4
|
+
const url = `${restBaseUrl}/patient?q=${query}&v=${objectVersion}&includeDead=${includeDead}`;
|
|
5
|
+
|
|
6
|
+
return openmrsFetch(url, {
|
|
7
|
+
method: 'GET',
|
|
8
|
+
signal: controller.signal,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import { Button, ButtonSet, Form, Row } from '@carbon/react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import {
|
|
5
|
+
type ConfigObject,
|
|
6
|
+
ExtensionSlot,
|
|
7
|
+
showSnackbar,
|
|
8
|
+
useConfig,
|
|
9
|
+
useLayoutType,
|
|
10
|
+
type Visit,
|
|
11
|
+
} from '@openmrs/esm-framework';
|
|
12
|
+
import { postQueueEntry } from '../../active-visits/active-visits-table.resource';
|
|
13
|
+
import { useMutateQueueEntries } from '../../hooks/useQueueEntries';
|
|
14
|
+
import styles from './visit-form.scss';
|
|
15
|
+
import classNames from 'classnames';
|
|
16
|
+
import VisitFormQueueFields from '../visit-form-queue-fields/visit-form-queue-fields.component';
|
|
17
|
+
|
|
18
|
+
interface ExistingVisitFormProps {
|
|
19
|
+
closeWorkspace: () => void;
|
|
20
|
+
visit: Visit;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const ExistingVisitForm: React.FC<ExistingVisitFormProps> = ({ visit, closeWorkspace }) => {
|
|
24
|
+
const { t } = useTranslation();
|
|
25
|
+
const isTablet = useLayoutType() === 'tablet';
|
|
26
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
27
|
+
|
|
28
|
+
const config = useConfig<ConfigObject>();
|
|
29
|
+
const visitQueueNumberAttributeUuid = config.visitQueueNumberAttributeUuid;
|
|
30
|
+
const { mutateQueueEntries } = useMutateQueueEntries();
|
|
31
|
+
const [{ service, priority, status, sortWeight, queueLocation }, setVisitFormFields] = useState({
|
|
32
|
+
service: null,
|
|
33
|
+
priority: null,
|
|
34
|
+
status: null,
|
|
35
|
+
sortWeight: null,
|
|
36
|
+
queueLocation: null,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const handleSubmit = useCallback(
|
|
40
|
+
(event) => {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
|
|
43
|
+
setIsSubmitting(true);
|
|
44
|
+
|
|
45
|
+
postQueueEntry(
|
|
46
|
+
visit.uuid,
|
|
47
|
+
service,
|
|
48
|
+
visit.patient.uuid,
|
|
49
|
+
priority,
|
|
50
|
+
status,
|
|
51
|
+
sortWeight,
|
|
52
|
+
queueLocation,
|
|
53
|
+
visitQueueNumberAttributeUuid,
|
|
54
|
+
).then(
|
|
55
|
+
({ status }) => {
|
|
56
|
+
if (status === 201) {
|
|
57
|
+
showSnackbar({
|
|
58
|
+
kind: 'success',
|
|
59
|
+
isLowContrast: true,
|
|
60
|
+
title: t('addPatientToQueue', 'Add patient to queue'),
|
|
61
|
+
subtitle: t('queueEntryAddedSuccessfully', 'Queue entry added successfully'),
|
|
62
|
+
});
|
|
63
|
+
closeWorkspace();
|
|
64
|
+
setIsSubmitting(false);
|
|
65
|
+
mutateQueueEntries();
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
(error) => {
|
|
69
|
+
let subtitle = error?.message;
|
|
70
|
+
const err = error?.responseBody?.error?.message;
|
|
71
|
+
if (err && err === '[queue.entry.duplicate.patient]') {
|
|
72
|
+
subtitle = t('patientAlreadyInQueue', 'Patient is already in the queue');
|
|
73
|
+
}
|
|
74
|
+
showSnackbar({
|
|
75
|
+
title: t('queueEntryError', 'Error adding patient to the queue'),
|
|
76
|
+
kind: 'error',
|
|
77
|
+
subtitle,
|
|
78
|
+
});
|
|
79
|
+
setIsSubmitting(false);
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
[closeWorkspace, mutateQueueEntries, visit, t, visitQueueNumberAttributeUuid],
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
return visit ? (
|
|
87
|
+
<>
|
|
88
|
+
{isTablet && (
|
|
89
|
+
<Row className={styles.headerGridRow}>
|
|
90
|
+
<ExtensionSlot
|
|
91
|
+
name="visit-form-header-slot"
|
|
92
|
+
className={styles.dataGridRow}
|
|
93
|
+
state={{ patientUuid: visit.patient.uuid }}
|
|
94
|
+
/>
|
|
95
|
+
</Row>
|
|
96
|
+
)}
|
|
97
|
+
<Form className={classNames(styles.form, styles.container)} onSubmit={handleSubmit}>
|
|
98
|
+
<VisitFormQueueFields setFormFields={setVisitFormFields} />
|
|
99
|
+
<ButtonSet className={isTablet ? styles.tablet : styles.desktop}>
|
|
100
|
+
<Button className={styles.button} kind="secondary" onClick={closeWorkspace}>
|
|
101
|
+
{t('discard', 'Discard')}
|
|
102
|
+
</Button>
|
|
103
|
+
<Button className={styles.button} disabled={isSubmitting} kind="primary" type="submit">
|
|
104
|
+
{t('addPatientToQueue', 'Add patient to queue')}
|
|
105
|
+
</Button>
|
|
106
|
+
</ButtonSet>
|
|
107
|
+
</Form>
|
|
108
|
+
</>
|
|
109
|
+
) : null;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export default ExistingVisitForm;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { openmrsFetch, restBaseUrl, toDateObjectStrict, toOmrsIsoString } from '@openmrs/esm-framework';
|
|
2
|
+
import { generateVisitQueueNumber } from '../../active-visits/active-visits-table.resource';
|
|
3
|
+
import { type Appointment } from '../../types';
|
|
4
|
+
|
|
5
|
+
export async function postQueueEntry(
|
|
6
|
+
visitUuid: string,
|
|
7
|
+
patientUuid: string,
|
|
8
|
+
priority: string,
|
|
9
|
+
status: string,
|
|
10
|
+
queueServiceUuid: string,
|
|
11
|
+
appointment: Appointment,
|
|
12
|
+
locationUuid: string,
|
|
13
|
+
visitQueueNumberAttributeUuid: string,
|
|
14
|
+
) {
|
|
15
|
+
const abortController = new AbortController();
|
|
16
|
+
|
|
17
|
+
await Promise.all([
|
|
18
|
+
saveAppointment(appointment),
|
|
19
|
+
generateVisitQueueNumber(locationUuid, visitUuid, queueServiceUuid, visitQueueNumberAttributeUuid),
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
return openmrsFetch(`${restBaseUrl}/visit-queue-entry`, {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers: {
|
|
25
|
+
'Content-Type': 'application/json',
|
|
26
|
+
},
|
|
27
|
+
signal: abortController.signal,
|
|
28
|
+
body: {
|
|
29
|
+
visit: visitUuid,
|
|
30
|
+
queueEntry: {
|
|
31
|
+
status: status,
|
|
32
|
+
priority: priority,
|
|
33
|
+
queue: queueServiceUuid,
|
|
34
|
+
patient: patientUuid,
|
|
35
|
+
startedAt: new Date(),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function saveAppointment(appointment: Appointment) {
|
|
42
|
+
const abortController = new AbortController();
|
|
43
|
+
|
|
44
|
+
await openmrsFetch(`${restBaseUrl}/appointment`, {
|
|
45
|
+
method: 'POST',
|
|
46
|
+
signal: abortController.signal,
|
|
47
|
+
headers: {
|
|
48
|
+
'Content-Type': 'application/json',
|
|
49
|
+
},
|
|
50
|
+
body: {
|
|
51
|
+
patientUuid: appointment?.patient.uuid,
|
|
52
|
+
serviceUuid: appointment?.service?.uuid,
|
|
53
|
+
startDateTime: appointment?.startDateTime,
|
|
54
|
+
endDateTime: appointment?.endDateTime,
|
|
55
|
+
appointmentKind: appointment?.appointmentKind,
|
|
56
|
+
locationUuid: appointment?.location?.uuid,
|
|
57
|
+
comments: appointment?.comments,
|
|
58
|
+
status: 'CheckedIn',
|
|
59
|
+
appointmentNumber: appointment?.appointmentNumber,
|
|
60
|
+
uuid: appointment?.uuid,
|
|
61
|
+
providerUuid: appointment?.provider?.uuid,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|