@kenyaemr/esm-service-queues-app 8.1.1-pre.129 → 8.1.2-pre.154
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 +26 -26
- package/dist/1006.js +1 -0
- package/dist/1006.js.map +1 -0
- package/dist/1060.js +1 -0
- package/dist/1060.js.map +1 -0
- package/dist/130.js +1 -1
- package/dist/130.js.map +1 -1
- package/dist/1325.js +1 -0
- package/dist/1325.js.map +1 -0
- package/dist/1644.js +1 -0
- package/dist/1727.js +1 -0
- package/dist/1727.js.map +1 -0
- package/dist/1800.js +1 -0
- package/dist/1800.js.map +1 -0
- package/dist/236.js +1 -1
- package/dist/2757.js +1 -0
- package/dist/{282.js → 2760.js} +1 -1
- package/dist/2760.js.map +1 -0
- package/dist/2784.js +2 -0
- package/dist/2784.js.map +1 -0
- package/dist/3199.js +1 -0
- package/dist/3199.js.map +1 -0
- package/dist/3372.js +2 -0
- package/dist/3372.js.map +1 -0
- package/dist/3574.js +1 -0
- package/dist/3604.js +1 -0
- package/dist/3604.js.map +1 -0
- package/dist/3652.js +1 -0
- package/dist/3760.js +1 -0
- package/dist/3760.js.map +1 -0
- package/dist/3818.js +1 -0
- package/dist/3818.js.map +1 -0
- package/dist/3828.js +1 -0
- package/dist/3828.js.map +1 -0
- package/dist/4272.js +1 -0
- package/dist/4378.js +1 -0
- package/dist/443.js +1 -0
- package/dist/443.js.map +1 -0
- package/dist/4460.js +1 -0
- package/dist/4705.js +1 -0
- package/dist/4911.js +1 -0
- package/dist/4911.js.map +1 -0
- package/dist/5236.js +1 -0
- package/dist/5236.js.map +1 -0
- package/dist/5240.js +1 -0
- package/dist/5282.js +1 -0
- package/dist/5282.js.map +1 -0
- package/dist/5336.js +1 -0
- package/dist/539.js +1 -0
- package/dist/5673.js +1 -0
- package/dist/5711.js +1 -0
- package/dist/5737.js +1 -0
- package/dist/5833.js +1 -0
- package/dist/6566.js +1 -0
- package/dist/6578.js +2 -0
- package/dist/{660.js.LICENSE.txt → 6578.js.LICENSE.txt} +5 -0
- package/dist/6578.js.map +1 -0
- package/dist/6591.js +2 -0
- package/dist/6591.js.map +1 -0
- package/dist/6670.js +1 -0
- package/dist/6670.js.map +1 -0
- package/dist/6727.js +1 -0
- package/dist/744.js +1 -0
- package/dist/752.js +1 -1
- package/dist/752.js.map +1 -1
- package/dist/7807.js +1 -0
- package/dist/8271.js +1 -0
- package/dist/8319.js +1 -0
- package/dist/8788.js +1 -0
- package/dist/899.js +1 -0
- package/dist/9261.js +1 -0
- package/dist/9392.js +1 -0
- package/dist/9392.js.map +1 -0
- package/dist/9993.js +1 -0
- package/dist/9993.js.map +1 -0
- package/dist/kenyaemr-esm-service-queues-app.js +1 -1
- package/dist/kenyaemr-esm-service-queues-app.js.buildmanifest.json +541 -234
- package/dist/kenyaemr-esm-service-queues-app.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.LICENSE.txt +5 -0
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package-lock.json +2 -2
- package/package.json +8 -5
- package/src/active-visits/active-visits-table.resource.ts +0 -62
- package/src/active-visits/change-status-dialog.component.tsx +10 -3
- package/src/active-visits/change-status-dialog.scss +29 -1
- package/src/active-visits/change-status-dialog.test.tsx +11 -3
- package/src/add-provider-queue-room/add-provider-queue-room.component.tsx +53 -54
- package/src/add-provider-queue-room/add-provider-queue-room.scss +28 -0
- package/src/add-provider-queue-room/add-provider-queue-room.test.tsx +1 -1
- package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.component.tsx +1 -0
- package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.scss +29 -0
- package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.test.tsx +4 -1
- package/src/config-schema.ts +28 -8
- package/src/create-queue-entry/create-queue-entry.workspace.tsx +99 -0
- package/src/create-queue-entry/existing-visit-form/existing-visit-form.component.tsx +73 -0
- package/src/{patient-search/visit-form-queue-fields/visit-form-queue-fields.component.tsx → create-queue-entry/queue-fields/queue-fields.component.tsx} +76 -50
- package/src/create-queue-entry/queue-fields/queue-fields.resource.ts +63 -0
- package/src/{patient-search/visit-form-queue-fields/visit-form-queue-fields.scss → create-queue-entry/queue-fields/queue-fields.scss} +0 -4
- package/src/{patient-search/visit-form-queue-fields/visit-form-queue-fields.test.tsx → create-queue-entry/queue-fields/queue-fields.test.tsx} +37 -17
- package/src/create-queue-entry/queue-fields/visit-form-queue-fields.extension.tsx +31 -0
- package/src/hooks/useQueueEntries.ts +13 -12
- package/src/index.ts +8 -14
- package/src/patient-info/patient-info.component.tsx +10 -8
- package/src/patient-queue-header/patient-queue-header.component.tsx +18 -13
- package/src/patient-queue-metrics/metrics-header.component.tsx +4 -4
- package/src/queue-entry-table-components/queue-priority.component.tsx +16 -11
- package/src/queue-entry-table-components/queue-priority.scss +5 -0
- package/src/queue-entry-table-components/transition-entry.component.tsx +1 -1
- package/src/queue-patient-linelists/queue-linelist-base-table.component.tsx +1 -1
- package/src/queue-patient-linelists/queue-linelist-filter.workspace.tsx +13 -12
- package/src/queue-patient-linelists/scheduled-appointments-table.component.tsx +1 -1
- package/src/queue-rooms/queue-room-form.test.tsx +2 -2
- package/src/queue-rooms/queue-room-form.workspace.tsx +1 -1
- package/src/queue-screen/queue-screen.test.tsx +11 -4
- package/src/queue-services/queue-service-form.test.tsx +76 -16
- package/src/queue-services/queue-service-form.workspace.tsx +131 -131
- package/src/queue-services/queue-service.resource.ts +7 -2
- package/src/queue-table/cells/columns.resource.ts +10 -7
- package/src/queue-table/cells/queue-table-visit-attribute-queue-number-cell.component.tsx +1 -0
- package/src/queue-table/default-queue-table.component.tsx +12 -13
- package/src/queue-table/default-queue-table.test.tsx +3 -3
- package/src/queue-table/queue-entry-actions/queue-entry-actions-modal.scss +28 -0
- package/src/queue-table/queue-entry-actions/queue-entry-actions.modal.tsx +8 -2
- package/src/queue-table/queue-entry-actions/queue-entry-confirm-action.modal.tsx +2 -1
- package/src/queue-table/queue-entry-actions/queue-entry-confirm-action.scss +29 -0
- package/src/queue-table/queue-table.component.tsx +1 -1
- package/src/queue-table/queue-table.scss +12 -2
- package/src/queue-table/queue-table.test.tsx +10 -1
- package/src/remove-queue-entry-dialog/remove-queue-entry.component.tsx +16 -4
- package/src/remove-queue-entry-dialog/remove-queue-entry.scss +29 -0
- package/src/routes.json +4 -8
- package/src/transition-latest-queue-entry/transition-latest-queue-entry.resource.ts +2 -10
- package/src/transition-queue-entry/transition-queue-entry-dialog.component.tsx +41 -32
- package/src/transition-queue-entry/transition-queue-entry-dialog.scss +28 -0
- package/src/types/index.ts +0 -8
- package/src/views/queue-tables-for-all-statuses.component.tsx +12 -15
- package/translations/am.json +5 -78
- package/translations/ar.json +5 -78
- package/translations/de.json +235 -0
- package/translations/en.json +9 -86
- package/translations/es.json +3 -76
- package/translations/fr.json +5 -78
- package/translations/he.json +5 -78
- package/translations/hi.json +235 -0
- package/translations/hi_IN.json +235 -0
- package/translations/id.json +235 -0
- package/translations/it.json +235 -0
- package/translations/km.json +5 -78
- package/translations/ne.json +235 -0
- package/translations/pt.json +235 -0
- package/translations/pt_BR.json +235 -0
- package/translations/qu.json +235 -0
- package/translations/si.json +235 -0
- package/translations/sw.json +235 -0
- package/translations/sw_KE.json +235 -0
- package/translations/tr.json +235 -0
- package/translations/tr_TR.json +235 -0
- package/translations/uk.json +235 -0
- package/translations/vi.json +235 -0
- package/translations/zh.json +6 -79
- package/translations/zh_CN.json +5 -78
- package/dist/169.js +0 -1
- package/dist/169.js.map +0 -1
- package/dist/199.js +0 -1
- package/dist/199.js.map +0 -1
- package/dist/236.js.map +0 -1
- package/dist/271.js +0 -1
- package/dist/282.js.map +0 -1
- package/dist/319.js +0 -1
- package/dist/325.js +0 -1
- package/dist/325.js.map +0 -1
- package/dist/366.js +0 -1
- package/dist/366.js.map +0 -1
- package/dist/372.js +0 -2
- package/dist/372.js.map +0 -1
- package/dist/392.js +0 -1
- package/dist/392.js.map +0 -1
- package/dist/460.js +0 -1
- package/dist/501.js +0 -1
- package/dist/501.js.map +0 -1
- package/dist/574.js +0 -1
- package/dist/591.js +0 -2
- package/dist/591.js.map +0 -1
- package/dist/6.js +0 -1
- package/dist/6.js.map +0 -1
- package/dist/60.js +0 -1
- package/dist/60.js.map +0 -1
- package/dist/604.js +0 -1
- package/dist/604.js.map +0 -1
- package/dist/644.js +0 -1
- package/dist/660.js +0 -2
- package/dist/660.js.map +0 -1
- package/dist/670.js +0 -1
- package/dist/670.js.map +0 -1
- package/dist/727.js +0 -1
- package/dist/727.js.map +0 -1
- package/dist/748.js +0 -1
- package/dist/748.js.map +0 -1
- package/dist/757.js +0 -1
- package/dist/760.js +0 -1
- package/dist/760.js.map +0 -1
- package/dist/784.js +0 -2
- package/dist/784.js.map +0 -1
- package/dist/788.js +0 -1
- package/dist/800.js +0 -1
- package/dist/800.js.map +0 -1
- package/dist/807.js +0 -1
- package/dist/818.js +0 -1
- package/dist/818.js.map +0 -1
- package/dist/828.js +0 -1
- package/dist/828.js.map +0 -1
- package/dist/833.js +0 -1
- package/dist/911.js +0 -1
- package/dist/911.js.map +0 -1
- package/dist/940.js +0 -1
- package/dist/940.js.map +0 -1
- package/src/add-patient-toqueue/add-patient-toqueue-dialog.component.tsx +0 -228
- package/src/add-patient-toqueue/add-patient-toqueue-dialog.scss +0 -32
- package/src/patient-search/advanced-search.component.tsx +0 -191
- package/src/patient-search/advanced-search.scss +0 -154
- package/src/patient-search/advanced-search.test.tsx +0 -26
- package/src/patient-search/basic-search.component.tsx +0 -112
- package/src/patient-search/basic-search.scss +0 -139
- package/src/patient-search/basic-search.test.tsx +0 -18
- package/src/patient-search/empty-data-illustration.component.tsx +0 -41
- package/src/patient-search/hooks/useActivePatientEnrollment.tsx +0 -29
- package/src/patient-search/hooks/useDefaultLocation.ts +0 -14
- package/src/patient-search/hooks/usePatients.tsx +0 -25
- package/src/patient-search/hooks/useRecommendedVisitTypes.tsx +0 -35
- package/src/patient-search/hooks/useScheduledVisits.ts +0 -52
- package/src/patient-search/patient-scheduled-visits.component.tsx +0 -315
- package/src/patient-search/patient-scheduled-visits.scss +0 -131
- package/src/patient-search/patient-scheduled-visits.test.tsx +0 -39
- package/src/patient-search/patient-search.workspace.tsx +0 -135
- package/src/patient-search/search-illustration.component.tsx +0 -27
- package/src/patient-search/search-results.component.tsx +0 -75
- package/src/patient-search/search-results.scss +0 -80
- package/src/patient-search/search-results.test.tsx +0 -69
- package/src/patient-search/search.resource.ts +0 -10
- package/src/patient-search/visit-form/existing-visit-form.component.tsx +0 -112
- package/src/patient-search/visit-form/queue.resource.ts +0 -64
- package/src/patient-search/visit-form/visit-form.component.tsx +0 -337
- package/src/patient-search/visit-form/visit-type-selector.component.tsx +0 -153
- package/src/patient-search/visit-form/visit-type-selector.scss +0 -100
- package/src/patient-search/visit-form/visit-type-selector.test.tsx +0 -84
- package/src/visits-missing-inqueue/visits-missing-inqueue.component.tsx +0 -277
- package/src/visits-missing-inqueue/visits-missing-inqueue.resource.ts +0 -93
- package/src/visits-missing-inqueue/visits-missing-inqueue.scss +0 -111
- /package/dist/{784.js.LICENSE.txt → 2784.js.LICENSE.txt} +0 -0
- /package/dist/{372.js.LICENSE.txt → 3372.js.LICENSE.txt} +0 -0
- /package/dist/{591.js.LICENSE.txt → 6591.js.LICENSE.txt} +0 -0
- /package/src/{patient-search/patient-search.scss → create-queue-entry/create-queue-entry.scss} +0 -0
- /package/src/{patient-search/visit-form/visit-form.scss → create-queue-entry/existing-visit-form/existing-visit-form.scss} +0 -0
- /package/src/{patient-search → create-queue-entry}/hooks/useQueueLocations.tsx +0 -0
|
@@ -1,75 +0,0 @@
|
|
|
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;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
@use '@carbon/layout';
|
|
2
|
-
@use '@carbon/type';
|
|
3
|
-
@use '@openmrs/esm-styleguide/src/vars' as *;
|
|
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: layout.$spacing-11;
|
|
29
|
-
height: layout.$spacing-11;
|
|
30
|
-
margin: layout.$spacing-05 layout.$spacing-05 0;
|
|
31
|
-
border-radius: 1px;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.patientInfo {
|
|
35
|
-
width: 100%;
|
|
36
|
-
display: flex;
|
|
37
|
-
flex-flow: column wrap;
|
|
38
|
-
margin: layout.$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: layout.$spacing-03;
|
|
55
|
-
margin-top: layout.$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: layout.$spacing-05;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
:global(.cds--list-box__menu) {
|
|
74
|
-
left: -7.5rem;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
:global(.cds--label) {
|
|
78
|
-
margin-right: layout.$spacing-02;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
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 = jest.mocked(age);
|
|
7
|
-
|
|
8
|
-
const patients = [
|
|
9
|
-
{
|
|
10
|
-
id: 'b73bee73-7bf0-4872-9657-ba9de0d93478',
|
|
11
|
-
name: [{ given: ['John'], family: 'Smith' }],
|
|
12
|
-
person: {
|
|
13
|
-
gender: 'Male',
|
|
14
|
-
age: 2,
|
|
15
|
-
birthdate: '2020-02-01T00:00:00.000+0000',
|
|
16
|
-
birthdateEstimated: true,
|
|
17
|
-
personName: {
|
|
18
|
-
display: 'John Smith',
|
|
19
|
-
uuid: '27698bff-4056-430c-824c-cb18cf9329d8',
|
|
20
|
-
givenName: 'John',
|
|
21
|
-
middleName: null,
|
|
22
|
-
familyName: 'Smith',
|
|
23
|
-
familyName2: null,
|
|
24
|
-
voided: false,
|
|
25
|
-
},
|
|
26
|
-
addresses: [
|
|
27
|
-
{
|
|
28
|
-
display: 'Bom Jesus Street',
|
|
29
|
-
uuid: '7eab94da-4b33-4da9-b352-da21a571221a',
|
|
30
|
-
preferred: true,
|
|
31
|
-
address1: 'Bom Jesus Street',
|
|
32
|
-
address2: null,
|
|
33
|
-
cityVillage: 'Recife',
|
|
34
|
-
stateProvince: 'Pernambuco',
|
|
35
|
-
country: 'Brazil',
|
|
36
|
-
postalCode: '50030-310',
|
|
37
|
-
countyDistrict: null,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
display: 'John Smith',
|
|
41
|
-
dead: false,
|
|
42
|
-
deathDate: null,
|
|
43
|
-
},
|
|
44
|
-
gender: 'Male',
|
|
45
|
-
birthDate: '2020-02-01T00:00:00.000+0000',
|
|
46
|
-
deceasedDateTime: null,
|
|
47
|
-
identifier: [{ value: '10001F0' }],
|
|
48
|
-
address: [{ city: 'Recife', country: 'Brazil', postalCode: '50030-310', state: 'Pernambuco', use: 'home' }],
|
|
49
|
-
telecom: [],
|
|
50
|
-
patientIdentifier: { identifier: [{ value: '10001F0' }] },
|
|
51
|
-
},
|
|
52
|
-
];
|
|
53
|
-
|
|
54
|
-
const mockToggleSearchType = jest.fn();
|
|
55
|
-
|
|
56
|
-
describe('Search Results', () => {
|
|
57
|
-
it('should search results page', () => {
|
|
58
|
-
mockAge.mockReturnValue('35');
|
|
59
|
-
renderSearchResults();
|
|
60
|
-
expect(screen.getByText(/John Smith/)).toBeInTheDocument();
|
|
61
|
-
expect(screen.getByText(/35/)).toBeInTheDocument();
|
|
62
|
-
expect(screen.getByText(/Male/)).toBeInTheDocument();
|
|
63
|
-
expect(screen.getByText(/01 — Feb — 2020/i)).toBeInTheDocument();
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
const renderSearchResults = () => {
|
|
68
|
-
render(<SearchResults patients={patients} toggleSearchType={mockToggleSearchType} />);
|
|
69
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
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;
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
}
|