@ampath/esm-patient-registration-app 6.0.1-pre.96 → 9.2.0-next.12
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/dist/1119.js +1 -0
- package/dist/1197.js +1 -0
- package/dist/21.js +1 -0
- package/dist/21.js.map +1 -0
- package/dist/2146.js +1 -0
- package/dist/2372.js +1 -0
- package/dist/2372.js.map +1 -0
- package/dist/2470.js +1 -0
- package/dist/2470.js.map +1 -0
- package/dist/2690.js +1 -0
- package/dist/2913.js +2 -0
- package/dist/{913.js.LICENSE.txt → 2913.js.LICENSE.txt} +3 -23
- package/dist/2913.js.map +1 -0
- package/dist/3093.js +1 -0
- package/dist/3093.js.map +1 -0
- package/dist/3099.js +1 -0
- package/dist/3144.js +2 -0
- package/dist/3144.js.LICENSE.txt +19 -0
- package/dist/3144.js.map +1 -0
- package/dist/320.js +2 -0
- package/dist/{876.js.LICENSE.txt → 320.js.LICENSE.txt} +2 -3
- package/dist/320.js.map +1 -0
- package/dist/3464.js +1 -0
- package/dist/3464.js.map +1 -0
- package/dist/3474.js +2 -0
- package/dist/3474.js.LICENSE.txt +8 -0
- package/dist/3474.js.map +1 -0
- package/dist/3584.js +1 -0
- package/dist/4041.js +2 -0
- package/dist/4041.js.map +1 -0
- package/dist/4055.js +1 -0
- package/dist/4132.js +1 -0
- package/dist/4300.js +1 -0
- package/dist/4335.js +1 -0
- package/dist/4463.js +1 -0
- package/dist/4463.js.map +1 -0
- package/dist/4618.js +1 -0
- package/dist/4652.js +1 -0
- package/dist/4944.js +1 -0
- package/dist/5173.js +1 -0
- package/dist/5220.js +2 -0
- package/dist/5220.js.LICENSE.txt +29 -0
- package/dist/5220.js.map +1 -0
- package/dist/5241.js +1 -0
- package/dist/5442.js +1 -0
- package/dist/5661.js +1 -0
- package/dist/6022.js +1 -0
- package/dist/6078.js +2 -0
- package/dist/6078.js.LICENSE.txt +9 -0
- package/dist/6078.js.map +1 -0
- package/dist/627.js +1 -0
- package/dist/627.js.map +1 -0
- package/dist/6276.js +1 -0
- package/dist/6276.js.map +1 -0
- package/dist/6468.js +1 -0
- package/dist/6679.js +1 -0
- package/dist/6737.js +2 -0
- package/dist/6737.js.LICENSE.txt +9 -0
- package/dist/6737.js.map +1 -0
- package/dist/6840.js +1 -0
- package/dist/6859.js +1 -0
- package/dist/7092.js +1 -0
- package/dist/7092.js.map +1 -0
- package/dist/7097.js +1 -0
- package/dist/7159.js +1 -0
- package/dist/723.js +1 -0
- package/dist/7495.js +2 -0
- package/dist/7495.js.LICENSE.txt +9 -0
- package/dist/7495.js.map +1 -0
- package/dist/7617.js +1 -0
- package/dist/795.js +1 -0
- package/dist/8163.js +1 -0
- package/dist/8349.js +1 -0
- package/dist/8404.js +2 -0
- package/dist/{629.js.LICENSE.txt → 8404.js.LICENSE.txt} +9 -3
- package/dist/8404.js.map +1 -0
- package/dist/8434.js +1 -0
- package/dist/8434.js.map +1 -0
- package/dist/8618.js +1 -0
- package/dist/89.js +2 -0
- package/dist/89.js.LICENSE.txt +9 -0
- package/dist/89.js.map +1 -0
- package/dist/890.js +1 -0
- package/dist/9214.js +1 -0
- package/dist/9538.js +1 -0
- package/dist/9569.js +1 -0
- package/dist/986.js +1 -0
- package/dist/9876.js +1 -0
- package/dist/9876.js.map +1 -0
- package/dist/9879.js +1 -0
- package/dist/9895.js +1 -0
- package/dist/9900.js +1 -0
- package/dist/9913.js +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.LICENSE.txt +36 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-patient-registration-app.js +1 -0
- package/dist/openmrs-esm-patient-registration-app.js.buildmanifest.json +1576 -0
- package/dist/openmrs-esm-patient-registration-app.js.map +1 -0
- package/dist/routes.json +1 -1
- package/package.json +16 -15
- package/src/{add-patient-link.tsx → add-patient-link.extension.tsx} +4 -2
- package/src/add-patient-link.test.tsx +6 -10
- package/src/config-schema.ts +109 -55
- package/src/constants.ts +1 -1
- package/src/declarations.d.ts +5 -4
- package/src/index.ts +10 -29
- package/src/nav-link.test.tsx +3 -3
- package/src/offline.resources.ts +26 -18
- package/src/patient-photo.extension.tsx +3 -1
- package/src/patient-registration/field/address/address-field.component.tsx +58 -37
- package/src/patient-registration/field/address/address-hierarchy-levels.component.tsx +16 -18
- package/src/patient-registration/field/address/address-hierarchy.resource.tsx +3 -3
- package/src/patient-registration/field/address/address-hierarchy.test.tsx +290 -0
- package/src/patient-registration/field/address/address-search.component.tsx +7 -5
- package/src/patient-registration/field/address/address-search.scss +5 -5
- package/src/patient-registration/field/address/address-search.test.tsx +140 -0
- package/src/patient-registration/field/cause-of-death/cause-of-death.component.tsx +98 -0
- package/src/patient-registration/field/custom-field.component.tsx +3 -9
- package/src/patient-registration/field/date-and-time-of-death/date-and-time-of-death.component.tsx +84 -0
- package/src/patient-registration/field/dob/dob.component.tsx +55 -50
- package/src/patient-registration/field/dob/dob.test.tsx +90 -0
- package/src/patient-registration/field/field.component.tsx +12 -6
- package/src/patient-registration/field/field.resource.ts +11 -4
- package/src/patient-registration/field/field.scss +69 -25
- package/src/patient-registration/field/field.test.tsx +329 -0
- package/src/patient-registration/field/gender/gender-field.component.tsx +14 -9
- package/src/patient-registration/field/gender/gender-field.test.tsx +73 -33
- package/src/patient-registration/field/id/id-field.component.tsx +24 -23
- package/src/patient-registration/field/id/id-field.test.tsx +147 -0
- package/src/patient-registration/field/id/identifier-selection-overlay.component.tsx +12 -10
- package/src/patient-registration/field/id/identifier-selection.scss +12 -8
- package/src/patient-registration/field/name/name-field.component.tsx +10 -5
- package/src/patient-registration/field/obs/obs-field.component.tsx +59 -2
- package/src/patient-registration/field/obs/obs-field.test.tsx +133 -39
- package/src/patient-registration/field/person-attributes/coded-person-attribute-field.component.tsx +3 -3
- package/src/patient-registration/field/person-attributes/coded-person-attribute-field.test.tsx +141 -0
- package/src/patient-registration/field/person-attributes/location-person-attribute-field.component.tsx +105 -0
- package/src/patient-registration/field/person-attributes/location-person-attribute-field.resource.tsx +48 -0
- package/src/patient-registration/field/person-attributes/person-attribute-field.component.tsx +19 -22
- package/src/patient-registration/field/person-attributes/person-attribute-field.test.tsx +193 -0
- package/src/patient-registration/field/person-attributes/text-person-attribute-field.test.tsx +90 -0
- package/src/patient-registration/form-manager.test.ts +91 -0
- package/src/patient-registration/form-manager.ts +49 -23
- package/src/patient-registration/input/basic-input/input/input.component.tsx +6 -2
- package/src/patient-registration/input/basic-input/select/select-input.test.tsx +49 -0
- package/src/patient-registration/input/custom-input/autosuggest/autosuggest.scss +5 -5
- package/src/patient-registration/input/custom-input/autosuggest/autosuggest.test.tsx +164 -0
- package/src/patient-registration/input/custom-input/identifier/identifier-input.component.tsx +73 -36
- package/src/patient-registration/input/custom-input/identifier/identifier-input.test.tsx +335 -0
- package/src/patient-registration/input/dummy-data/dummy-data-input.component.tsx +3 -0
- package/src/patient-registration/input/dummy-data/dummy-data-input.test.tsx +2 -11
- package/src/patient-registration/input/input.scss +17 -13
- package/src/patient-registration/patient-registration-context.ts +22 -11
- package/src/patient-registration/patient-registration-hooks.ts +158 -193
- package/src/patient-registration/patient-registration-utils.test.ts +33 -0
- package/src/patient-registration/patient-registration-utils.ts +11 -13
- package/src/patient-registration/patient-registration.component.tsx +87 -103
- package/src/patient-registration/{patient-registration.resource.testt.tsx → patient-registration.resource.test.tsx} +0 -4
- package/src/patient-registration/patient-registration.resource.ts +27 -3
- package/src/patient-registration/patient-registration.scss +27 -38
- package/src/patient-registration/patient-registration.test.tsx +579 -0
- package/src/patient-registration/patient-registration.types.ts +23 -25
- package/src/patient-registration/section/death-info/death-info-section.component.tsx +22 -17
- package/src/patient-registration/section/death-info/death-info-section.test.tsx +47 -0
- package/src/patient-registration/section/demographics/demographics-section.component.tsx +5 -5
- package/src/patient-registration/section/demographics/demographics-section.test.tsx +98 -0
- package/src/patient-registration/section/patient-relationships/relationships-section.component.tsx +8 -7
- package/src/patient-registration/section/patient-relationships/relationships-section.test.tsx +113 -0
- package/src/patient-registration/section/patient-relationships/relationships.resource.tsx +28 -28
- package/src/patient-registration/section/patient-relationships/relationships.scss +4 -4
- package/src/patient-registration/section/section-wrapper.component.tsx +1 -1
- package/src/patient-registration/section/section.component.tsx +1 -1
- package/src/patient-registration/section/section.scss +21 -1
- package/src/patient-registration/ui-components/overlay/overlay.scss +8 -8
- package/src/patient-registration/validation/{patient-registration-validation.test.tsx → patient-registration-validation.test.ts} +71 -23
- package/src/patient-registration/validation/patient-registration-validation.ts +123 -0
- package/src/resources-context.ts +14 -0
- package/src/root.component.tsx +3 -3
- package/src/routes.json +10 -24
- package/src/widgets/cancel-patient-edit.modal.tsx +33 -0
- package/src/widgets/cancel-patient-edit.test.tsx +22 -0
- package/src/widgets/delete-identifier-confirmation.modal.tsx +48 -0
- package/src/widgets/{delete-identifier-confirmation-modal.testt.tsx → delete-identifier-confirmation.test.tsx} +5 -7
- package/src/widgets/edit-patient-details-button.component.tsx +0 -1
- package/src/widgets/edit-patient-details-button.test.tsx +35 -0
- package/translations/am.json +43 -35
- package/translations/ar.json +41 -33
- package/translations/ar_SY.json +119 -0
- package/translations/bn.json +119 -0
- package/translations/de.json +119 -0
- package/translations/en.json +44 -42
- package/translations/en_US.json +119 -0
- package/translations/es.json +69 -57
- package/translations/es_MX.json +119 -0
- package/translations/fr.json +74 -58
- package/translations/he.json +44 -40
- package/translations/hi.json +119 -0
- package/translations/hi_IN.json +119 -0
- package/translations/id.json +119 -0
- package/translations/it.json +119 -0
- package/translations/ka.json +119 -0
- package/translations/km.json +44 -40
- package/translations/ku.json +119 -0
- package/translations/ky.json +119 -0
- package/translations/lg.json +119 -0
- package/translations/ne.json +119 -0
- package/translations/pl.json +119 -0
- package/translations/pt.json +119 -0
- package/translations/pt_BR.json +119 -0
- package/translations/qu.json +119 -0
- package/translations/ro_RO.json +119 -0
- package/translations/ru_RU.json +119 -0
- package/translations/si.json +119 -0
- package/translations/sw.json +119 -0
- package/translations/sw_KE.json +119 -0
- package/translations/tr.json +119 -0
- package/translations/tr_TR.json +119 -0
- package/translations/uk.json +119 -0
- package/translations/uz.json +119 -0
- package/translations/uz@Latn.json +119 -0
- package/translations/uz_UZ.json +119 -0
- package/translations/vi.json +119 -0
- package/translations/zh.json +45 -23
- package/translations/zh_CN.json +39 -17
- package/.turbo/turbo-build.log +0 -40
- package/dist/132.js +0 -1
- package/dist/197.js +0 -1
- package/dist/236.js +0 -1
- package/dist/236.js.map +0 -1
- package/dist/300.js +0 -1
- package/dist/335.js +0 -1
- package/dist/372.js +0 -1
- package/dist/372.js.map +0 -1
- package/dist/41.js +0 -2
- package/dist/41.js.map +0 -1
- package/dist/449.js +0 -1
- package/dist/449.js.map +0 -1
- package/dist/464.js +0 -1
- package/dist/464.js.map +0 -1
- package/dist/495.js +0 -1
- package/dist/495.js.map +0 -1
- package/dist/55.js +0 -1
- package/dist/56.js +0 -1
- package/dist/56.js.map +0 -1
- package/dist/621.js +0 -1
- package/dist/621.js.map +0 -1
- package/dist/629.js +0 -2
- package/dist/629.js.map +0 -1
- package/dist/652.js +0 -1
- package/dist/661.js +0 -1
- package/dist/757.js +0 -1
- package/dist/757.js.map +0 -1
- package/dist/828.js +0 -1
- package/dist/828.js.map +0 -1
- package/dist/830.js +0 -1
- package/dist/830.js.map +0 -1
- package/dist/831.js +0 -2
- package/dist/831.js.LICENSE.txt +0 -3
- package/dist/831.js.map +0 -1
- package/dist/876.js +0 -2
- package/dist/876.js.map +0 -1
- package/dist/879.js +0 -1
- package/dist/913.js +0 -2
- package/dist/913.js.map +0 -1
- package/dist/927.js +0 -1
- package/dist/927.js.map +0 -1
- package/dist/99.js +0 -1
- package/dist/ampath-esm-patient-registration-app.js +0 -1
- package/dist/ampath-esm-patient-registration-app.js.buildmanifest.json +0 -694
- package/dist/ampath-esm-patient-registration-app.js.map +0 -1
- package/src/patient-registration/date-util.ts +0 -52
- package/src/patient-registration/field/person-attributes/custom-person-attribute-field.component.tsx +0 -56
- package/src/patient-registration/validation/patient-registration-validation.tsx +0 -60
- package/src/patient-verification/assets/counties.json +0 -236
- package/src/patient-verification/assets/verification-assets.ts +0 -11
- package/src/patient-verification/patient-verification-hook.tsx +0 -176
- package/src/patient-verification/patient-verification-utils.ts +0 -179
- package/src/patient-verification/patient-verification.component.tsx +0 -124
- package/src/patient-verification/patient-verification.scss +0 -25
- package/src/patient-verification/verification-modal/confirm-prompt.component.tsx +0 -72
- package/src/patient-verification/verification-modal/empty-prompt.component.tsx +0 -35
- package/src/patient-verification/verification-types.ts +0 -50
- package/src/widgets/cancel-patient-edit.component.tsx +0 -37
- package/src/widgets/delete-identifier-confirmation-modal.tsx +0 -41
- package/src/widgets/delete-identifier-modal.scss +0 -34
- /package/dist/{41.js.LICENSE.txt → 4041.js.LICENSE.txt} +0 -0
- /package/src/patient-registration/input/custom-input/identifier/{utils.testt.ts → utils.test.ts} +0 -0
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { showModal } from '@openmrs/esm-framework';
|
|
2
|
-
import { type FormikProps } from 'formik';
|
|
3
|
-
import { type ClientRegistryPatient, type RegistryPatient } from './verification-types';
|
|
4
|
-
import counties from './assets/counties.json';
|
|
5
|
-
import { type FormValues } from '../patient-registration/patient-registration.types';
|
|
6
|
-
import { capitalize } from 'lodash-es';
|
|
7
|
-
|
|
8
|
-
export function handleClientRegistryResponse(
|
|
9
|
-
clientResponse: ClientRegistryPatient,
|
|
10
|
-
props: FormikProps<FormValues>,
|
|
11
|
-
searchTerm: string,
|
|
12
|
-
) {
|
|
13
|
-
if (clientResponse?.clientExists === false) {
|
|
14
|
-
const nupiIdentifiers = {
|
|
15
|
-
['nationalId']: {
|
|
16
|
-
initialValue: searchTerm,
|
|
17
|
-
identifierUuid: undefined,
|
|
18
|
-
selectedSource: { uuid: '', name: '' },
|
|
19
|
-
preferred: false,
|
|
20
|
-
required: false,
|
|
21
|
-
identifierTypeUuid: '58a47054-1359-11df-a1f1-0026b9348838',
|
|
22
|
-
identifierName: 'Kenyan National ID Number',
|
|
23
|
-
identifierValue: searchTerm,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
const dispose = showModal('empty-client-registry-modal', {
|
|
27
|
-
onConfirm: () => {
|
|
28
|
-
props.setValues({ ...props.values, identifiers: { ...props.values.identifiers, ...nupiIdentifiers } });
|
|
29
|
-
dispose();
|
|
30
|
-
},
|
|
31
|
-
close: () => dispose(),
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (clientResponse?.clientExists) {
|
|
36
|
-
const {
|
|
37
|
-
client: {
|
|
38
|
-
middleName,
|
|
39
|
-
lastName,
|
|
40
|
-
firstName,
|
|
41
|
-
contact,
|
|
42
|
-
country,
|
|
43
|
-
countyOfBirth,
|
|
44
|
-
residence,
|
|
45
|
-
identifications,
|
|
46
|
-
gender,
|
|
47
|
-
dateOfBirth,
|
|
48
|
-
isAlive,
|
|
49
|
-
clientNumber,
|
|
50
|
-
educationLevel,
|
|
51
|
-
occupation,
|
|
52
|
-
maritalStatus,
|
|
53
|
-
},
|
|
54
|
-
} = clientResponse;
|
|
55
|
-
|
|
56
|
-
const nupiIdentifiers = {
|
|
57
|
-
['nationalId']: {
|
|
58
|
-
initialValue: identifications !== undefined && identifications[0]?.identificationNumber,
|
|
59
|
-
identifierUuid: undefined,
|
|
60
|
-
selectedSource: { uuid: '', name: '' },
|
|
61
|
-
preferred: false,
|
|
62
|
-
required: false,
|
|
63
|
-
identifierTypeUuid: '58a47054-1359-11df-a1f1-0026b9348838',
|
|
64
|
-
identifierName: 'Kenyan National ID Number',
|
|
65
|
-
identifierValue: identifications !== undefined && identifications[0]?.identificationNumber,
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
['nationalUniquePatientIdentifier']: {
|
|
69
|
-
identifierTypeUuid: 'cba702b9-4664-4b43-83f1-9ab473cbd64d',
|
|
70
|
-
identifierName: 'National Unique Patient Identifier (NUPI)',
|
|
71
|
-
identifierValue: clientNumber,
|
|
72
|
-
initialValue: clientNumber,
|
|
73
|
-
identifierUuid: undefined,
|
|
74
|
-
selectedSource: { uuid: '', name: '' },
|
|
75
|
-
preferred: false,
|
|
76
|
-
required: false,
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const dispose = showModal('confirm-client-registry-modal', {
|
|
81
|
-
onConfirm: () => {
|
|
82
|
-
props.setValues({
|
|
83
|
-
...props.values,
|
|
84
|
-
familyName: lastName,
|
|
85
|
-
middleName: middleName,
|
|
86
|
-
givenName: firstName,
|
|
87
|
-
gender: clientResponse.client.gender,
|
|
88
|
-
birthdate: new Date(dateOfBirth),
|
|
89
|
-
isDead: !isAlive,
|
|
90
|
-
attributes: {
|
|
91
|
-
'72a759a8-1359-11df-a1f1-0026b9348838': contact?.primaryPhone,
|
|
92
|
-
'b0a08406-09c0-4f8b-8cb5-b22b6d4a8e46': contact?.secondaryPhone,
|
|
93
|
-
'2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa': contact?.emailAddress ?? '',
|
|
94
|
-
},
|
|
95
|
-
address: {
|
|
96
|
-
address1: residence?.address,
|
|
97
|
-
address2: '',
|
|
98
|
-
address4: capitalize(residence?.ward ?? ''),
|
|
99
|
-
cityVillage: residence?.village,
|
|
100
|
-
stateProvince: capitalize(residence?.subCounty ?? ''),
|
|
101
|
-
countyDistrict: counties.find((county) => county.code === parseInt(residence?.county))?.name,
|
|
102
|
-
country: 'Kenya',
|
|
103
|
-
postalCode: residence?.address,
|
|
104
|
-
},
|
|
105
|
-
identifiers: { ...props.values.identifiers, ...nupiIdentifiers },
|
|
106
|
-
obs: {
|
|
107
|
-
'a899a9f2-1350-11df-a1f1-0026b9348838':
|
|
108
|
-
props.values.concepts.find((concept) =>
|
|
109
|
-
concept.display?.toLowerCase()?.includes(clientResponse.client.maritalStatus?.toLowerCase()),
|
|
110
|
-
)?.uuid ?? '',
|
|
111
|
-
'a89e48ae-1350-11df-a1f1-0026b9348838':
|
|
112
|
-
props.values.concepts.find((concept) =>
|
|
113
|
-
concept.display?.toLowerCase()?.includes(clientResponse.client.educationLevel?.toLowerCase()),
|
|
114
|
-
)?.uuid ?? '',
|
|
115
|
-
'a8a0a00e-1350-11df-a1f1-0026b9348838':
|
|
116
|
-
clientResponse.client.occupation === undefined || clientResponse.client.occupation === null
|
|
117
|
-
? 'a899e0ac-1350-11df-a1f1-0026b9348838'
|
|
118
|
-
: props.values.concepts.find(
|
|
119
|
-
(concept) => concept.display?.toLowerCase() === clientResponse.client.occupation?.toLowerCase(),
|
|
120
|
-
)?.uuid ?? 'a8aaf3e2-1350-11df-a1f1-0026b9348838',
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
dispose();
|
|
124
|
-
},
|
|
125
|
-
close: () => dispose(),
|
|
126
|
-
patient: clientResponse.client,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export function generateNUPIPayload(formValues: FormValues): RegistryPatient {
|
|
132
|
-
const educationLevel = formValues.concepts.find(
|
|
133
|
-
(concept) => concept.uuid === formValues.obs['a89e48ae-1350-11df-a1f1-0026b9348838'],
|
|
134
|
-
);
|
|
135
|
-
const occupation = formValues.concepts.find(
|
|
136
|
-
(concept) => concept.uuid === formValues.obs['a8a0a00e-1350-11df-a1f1-0026b9348838'],
|
|
137
|
-
);
|
|
138
|
-
const maritalStatus = formValues.concepts.find(
|
|
139
|
-
(concept) => concept.uuid === formValues.obs['a899a9f2-1350-11df-a1f1-0026b9348838'],
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
let createRegistryPatient: RegistryPatient = {
|
|
143
|
-
firstName: formValues?.givenName,
|
|
144
|
-
middleName: formValues?.middleName,
|
|
145
|
-
lastName: formValues?.familyName,
|
|
146
|
-
gender: formValues?.gender === 'Male' ? 'male' : 'female',
|
|
147
|
-
dateOfBirth: new Date(formValues.birthdate).toISOString(),
|
|
148
|
-
isAlive: !formValues.isDead,
|
|
149
|
-
residence: {
|
|
150
|
-
county: `0${counties.find((county) => county.name.includes(formValues.address['countyDistrict']))?.code}`,
|
|
151
|
-
subCounty: formValues.address['stateProvince']?.toLocaleLowerCase(),
|
|
152
|
-
ward: formValues.address['address4']?.toLocaleLowerCase(),
|
|
153
|
-
village: formValues.address['cityVillage'],
|
|
154
|
-
landmark: formValues.address['address2'],
|
|
155
|
-
address: formValues.address['postalCode'],
|
|
156
|
-
},
|
|
157
|
-
nextOfKins: [],
|
|
158
|
-
contact: {
|
|
159
|
-
primaryPhone: formValues.attributes['72a759a8-1359-11df-a1f1-0026b9348838'],
|
|
160
|
-
secondaryPhone: formValues.attributes['b0a08406-09c0-4f8b-8cb5-b22b6d4a8e46'],
|
|
161
|
-
emailAddress: formValues.attributes['2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa'],
|
|
162
|
-
},
|
|
163
|
-
country: 'KE',
|
|
164
|
-
countyOfBirth: `0${counties.find((county) => county.name.includes(formValues.address['countyDistrict']))?.code}`,
|
|
165
|
-
educationLevel: educationLevel?.display?.toLowerCase() ?? '',
|
|
166
|
-
religion: '',
|
|
167
|
-
occupation: occupation?.display?.toLowerCase() ?? '',
|
|
168
|
-
maritalStatus: maritalStatus?.display?.toLowerCase() ?? '',
|
|
169
|
-
originFacilityKmflCode: '',
|
|
170
|
-
nascopCCCNumber: '',
|
|
171
|
-
identifications: [
|
|
172
|
-
{
|
|
173
|
-
identificationType: 'national-id',
|
|
174
|
-
identificationNumber: formValues.identifiers['nationalId']?.identifierValue,
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
};
|
|
178
|
-
return createRegistryPatient;
|
|
179
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { Tile, ComboBox, Layer, Button, Search, InlineLoading, InlineNotification } from '@carbon/react';
|
|
4
|
-
import styles from './patient-verification.scss';
|
|
5
|
-
import { countries, verificationIdentifierTypes } from './assets/verification-assets';
|
|
6
|
-
import { searchClientRegistry, useGlobalProperties } from './patient-verification-hook';
|
|
7
|
-
import { showSnackbar, showToast } from '@openmrs/esm-framework';
|
|
8
|
-
import { handleClientRegistryResponse } from './patient-verification-utils';
|
|
9
|
-
import { type FormikProps } from 'formik';
|
|
10
|
-
import { type FormValues } from '../patient-registration/patient-registration.types';
|
|
11
|
-
|
|
12
|
-
interface PatientVerificationProps {
|
|
13
|
-
props: FormikProps<FormValues>;
|
|
14
|
-
setInitialFormValues: React.Dispatch<FormValues>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
|
|
18
|
-
const { t } = useTranslation();
|
|
19
|
-
const { data, isLoading, error } = useGlobalProperties();
|
|
20
|
-
const [verificationCriteria, setVerificationCriteria] = useState({
|
|
21
|
-
searchTerm: '',
|
|
22
|
-
identifierType: '',
|
|
23
|
-
countryCode: 'KE',
|
|
24
|
-
});
|
|
25
|
-
const [isLoadingSearch, setIsLoadingSearch] = useState(false);
|
|
26
|
-
|
|
27
|
-
const handleSearch = async () => {
|
|
28
|
-
setIsLoadingSearch(true);
|
|
29
|
-
try {
|
|
30
|
-
const clientRegistryResponse = await searchClientRegistry(
|
|
31
|
-
verificationCriteria.identifierType,
|
|
32
|
-
verificationCriteria.searchTerm,
|
|
33
|
-
props.values.token,
|
|
34
|
-
verificationCriteria.countryCode,
|
|
35
|
-
);
|
|
36
|
-
setIsLoadingSearch(false);
|
|
37
|
-
|
|
38
|
-
handleClientRegistryResponse(clientRegistryResponse, props, verificationCriteria.searchTerm);
|
|
39
|
-
} catch (error) {
|
|
40
|
-
showSnackbar({
|
|
41
|
-
title: 'Client registry error',
|
|
42
|
-
subtitle: `Please reload the registration page and re-try again, if the issue persist contact system administrator`,
|
|
43
|
-
timeoutInMs: 10000,
|
|
44
|
-
kind: 'error',
|
|
45
|
-
isLowContrast: true,
|
|
46
|
-
});
|
|
47
|
-
setIsLoadingSearch(false);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<div id={'patientVerification'}>
|
|
53
|
-
<h3 className={styles.productiveHeading02} style={{ color: '#161616' }}>
|
|
54
|
-
{t('clientVerificationWithClientRegistry', 'Client verification with client registry')}
|
|
55
|
-
</h3>
|
|
56
|
-
<div style={{ margin: '1rem 0 1rem' }}>
|
|
57
|
-
<Layer>
|
|
58
|
-
{isLoading && <InlineLoading status="active" iconDescription="Loading" description="Loading data..." />}
|
|
59
|
-
</Layer>
|
|
60
|
-
{error && (
|
|
61
|
-
<InlineNotification
|
|
62
|
-
className={styles.errorWrapper}
|
|
63
|
-
aria-label="closes notification"
|
|
64
|
-
kind="error"
|
|
65
|
-
lowContrast
|
|
66
|
-
statusIconDescription="notification"
|
|
67
|
-
subtitle={t(
|
|
68
|
-
'clientRegistryErrorSubtitle',
|
|
69
|
-
'Please proceed with registration contact system admin and try again later',
|
|
70
|
-
)}
|
|
71
|
-
title={t('clientRegistryError', 'Error occurred while reaching the client registry')}
|
|
72
|
-
/>
|
|
73
|
-
)}
|
|
74
|
-
<Tile className={styles.verificationWrapper}>
|
|
75
|
-
<Layer>
|
|
76
|
-
<ComboBox
|
|
77
|
-
ariaLabel={t('selectCountry', 'Select country')}
|
|
78
|
-
id="selectCountry"
|
|
79
|
-
items={countries}
|
|
80
|
-
itemToString={(item) => item?.name ?? ''}
|
|
81
|
-
label="Select country"
|
|
82
|
-
titleText={t('selectCountry', 'Select country')}
|
|
83
|
-
initialSelectedItem={countries[0]}
|
|
84
|
-
onChange={({ selectedItem }) =>
|
|
85
|
-
setVerificationCriteria({ ...verificationCriteria, countryCode: selectedItem?.initials })
|
|
86
|
-
}
|
|
87
|
-
/>
|
|
88
|
-
</Layer>
|
|
89
|
-
<Layer>
|
|
90
|
-
<ComboBox
|
|
91
|
-
ariaLabel={t('selectIdentifierType', 'Select identifier type')}
|
|
92
|
-
id="selectIdentifierType"
|
|
93
|
-
items={verificationIdentifierTypes}
|
|
94
|
-
itemToString={(item) => item?.name ?? ''}
|
|
95
|
-
label="Select identifier type"
|
|
96
|
-
titleText={t('selectIdentifierType', 'Select identifier type')}
|
|
97
|
-
onChange={({ selectedItem }) =>
|
|
98
|
-
setVerificationCriteria({ ...verificationCriteria, identifierType: selectedItem?.value })
|
|
99
|
-
}
|
|
100
|
-
/>
|
|
101
|
-
</Layer>
|
|
102
|
-
<Layer>
|
|
103
|
-
<Search
|
|
104
|
-
id="clientRegistrySearch"
|
|
105
|
-
autoFocus
|
|
106
|
-
placeHolderText={t('searchClientRegistry', 'Search client registry')}
|
|
107
|
-
disabled={!verificationCriteria.identifierType}
|
|
108
|
-
onChange={(event) => setVerificationCriteria({ ...verificationCriteria, searchTerm: event.target.value })}
|
|
109
|
-
/>
|
|
110
|
-
</Layer>
|
|
111
|
-
{!isLoadingSearch ? (
|
|
112
|
-
<Button disabled={!verificationCriteria.identifierType && !isLoading} size="md" onClick={handleSearch}>
|
|
113
|
-
{t('validate', 'Validate')}
|
|
114
|
-
</Button>
|
|
115
|
-
) : (
|
|
116
|
-
<InlineLoading status="active" iconDescription="Loading" description="Searching client registry" />
|
|
117
|
-
)}
|
|
118
|
-
</Tile>
|
|
119
|
-
</div>
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export default PatientVerification;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
@use '@carbon/colors';
|
|
2
|
-
@import '../patient-registration/patient-registration.scss';
|
|
3
|
-
|
|
4
|
-
/* Desktop */
|
|
5
|
-
:global(.omrs-breakpoint-gt-tablet) {
|
|
6
|
-
.verificationWrapper {
|
|
7
|
-
display: grid;
|
|
8
|
-
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
9
|
-
column-gap: 0.325rem;
|
|
10
|
-
align-items: flex-end;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/* Tablet */
|
|
15
|
-
:global(.omrs-breakpoint-lt-desktop) {
|
|
16
|
-
.verificationWrapper {
|
|
17
|
-
row-gap: 0.5rem;
|
|
18
|
-
display: flex;
|
|
19
|
-
flex-direction: column;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.errorWrapper {
|
|
24
|
-
margin: 0 0 1rem 0;
|
|
25
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { Button } from '@carbon/react';
|
|
4
|
-
import { age, ExtensionSlot, formatDate } from '@openmrs/esm-framework';
|
|
5
|
-
import capitalize from 'lodash-es/capitalize';
|
|
6
|
-
import { useFacilityName } from '../patient-verification-hook';
|
|
7
|
-
|
|
8
|
-
const PatientInfo: React.FC<{ label: string; value: string }> = ({ label, value }) => {
|
|
9
|
-
return (
|
|
10
|
-
<div style={{ display: 'grid', gridTemplateColumns: '0.25fr 0.75fr', margin: '0.25rem' }}>
|
|
11
|
-
<span style={{ minWidth: '5rem', fontWeight: 'bold' }}>{label}</span>
|
|
12
|
-
<span>{value}</span>
|
|
13
|
-
</div>
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
interface ConfirmPromptProps {
|
|
18
|
-
onConfirm: void;
|
|
19
|
-
close: void;
|
|
20
|
-
patient: any;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const ConfirmPrompt: React.FC<ConfirmPromptProps> = ({ close, onConfirm, patient }) => {
|
|
24
|
-
const { t } = useTranslation();
|
|
25
|
-
return (
|
|
26
|
-
<>
|
|
27
|
-
<div className="cds--modal-header">
|
|
28
|
-
<h3 className="cds--modal-header__heading">
|
|
29
|
-
{t('clientRegistryEmpty', `Patient ${patient?.firstName} ${patient?.lastName} found`)}
|
|
30
|
-
</h3>
|
|
31
|
-
</div>
|
|
32
|
-
<div className="cds--modal-content">
|
|
33
|
-
<p>
|
|
34
|
-
{t(
|
|
35
|
-
'patientDetailsFound',
|
|
36
|
-
'Patient information found in the registry, do you want to use the information to continue with registration?',
|
|
37
|
-
)}
|
|
38
|
-
</p>
|
|
39
|
-
<div style={{ display: 'flex', margin: '1rem' }}>
|
|
40
|
-
<ExtensionSlot
|
|
41
|
-
style={{ display: 'flex', alignItems: 'center' }}
|
|
42
|
-
name="patient-photo-slot"
|
|
43
|
-
state={{ patientName: `${patient?.firstName} ${patient?.lastName}` }}
|
|
44
|
-
/>
|
|
45
|
-
<div style={{ width: '100%', marginLeft: '0.625rem' }}>
|
|
46
|
-
<PatientInfo
|
|
47
|
-
label={t('patientName', 'Patient name')}
|
|
48
|
-
value={`${patient?.firstName} ${patient?.lastName}`}
|
|
49
|
-
/>
|
|
50
|
-
<PatientInfo
|
|
51
|
-
label={t('nationalId', 'National ID')}
|
|
52
|
-
value={patient?.identifications[0]?.identificationNumber}
|
|
53
|
-
/>
|
|
54
|
-
<PatientInfo label={t('age', 'Age')} value={age(patient?.dateOfBirth)} />
|
|
55
|
-
<PatientInfo label={t('dateOfBirth', 'Date of birth')} value={formatDate(new Date(patient?.dateOfBirth))} />
|
|
56
|
-
<PatientInfo label={t('gender', 'Gender')} value={capitalize(patient?.gender)} />
|
|
57
|
-
<PatientInfo label={t('nupi', 'NUPI')} value={patient?.clientNumber} />
|
|
58
|
-
<PatientInfo label={t('shaNumber', 'SHA Number')} value={'--'} />
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
<div className="cds--modal-footer">
|
|
63
|
-
<Button kind="secondary" onClick={close}>
|
|
64
|
-
{t('cancel', 'Cancel')}
|
|
65
|
-
</Button>
|
|
66
|
-
<Button onClick={onConfirm}>{t('useValues', 'Use values')}</Button>
|
|
67
|
-
</div>
|
|
68
|
-
</>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default ConfirmPrompt;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { Button } from '@carbon/react';
|
|
4
|
-
|
|
5
|
-
interface EmptyPromptProps {
|
|
6
|
-
onConfirm: void;
|
|
7
|
-
close: void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const EmptyPrompt: React.FC<EmptyPromptProps> = ({ close, onConfirm }) => {
|
|
11
|
-
const { t } = useTranslation();
|
|
12
|
-
return (
|
|
13
|
-
<>
|
|
14
|
-
<div className="cds--modal-header">
|
|
15
|
-
<h3 className="cds--modal-header__heading">{t('clientRegistryEmpty', 'Create & Post Patient')}</h3>
|
|
16
|
-
</div>
|
|
17
|
-
<div className="cds--modal-content">
|
|
18
|
-
<p>
|
|
19
|
-
{t(
|
|
20
|
-
'patientNotFound',
|
|
21
|
-
'The patient records could not be found in Client registry, do you want to continue to create and post patient to registry',
|
|
22
|
-
)}
|
|
23
|
-
</p>
|
|
24
|
-
</div>
|
|
25
|
-
<div className="cds--modal-footer">
|
|
26
|
-
<Button kind="secondary" onClick={close}>
|
|
27
|
-
{t('cancel', 'Cancel')}
|
|
28
|
-
</Button>
|
|
29
|
-
<Button onClick={onConfirm}>{t('continue', 'Continue to registration')}</Button>
|
|
30
|
-
</div>
|
|
31
|
-
</>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default EmptyPrompt;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export interface ClientIdentification {
|
|
2
|
-
identificationType: string;
|
|
3
|
-
identificationNumber: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
interface ClientContact {
|
|
7
|
-
primaryPhone: string;
|
|
8
|
-
secondaryPhone?: string;
|
|
9
|
-
emailAddress?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface ClientRegistryPatient {
|
|
13
|
-
clientExists: boolean;
|
|
14
|
-
client?: RegistryPatient;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface RegistryPatient {
|
|
18
|
-
clientNumber?: string;
|
|
19
|
-
firstName: string;
|
|
20
|
-
middleName: string;
|
|
21
|
-
lastName: string;
|
|
22
|
-
dateOfBirth: string;
|
|
23
|
-
maritalStatus?: string;
|
|
24
|
-
gender: string;
|
|
25
|
-
occupation?: string;
|
|
26
|
-
religion?: string;
|
|
27
|
-
educationLevel?: string;
|
|
28
|
-
country: string;
|
|
29
|
-
countyOfBirth?: string;
|
|
30
|
-
isAlive: boolean;
|
|
31
|
-
originFacilityKmflCode?: string;
|
|
32
|
-
isOnART?: string;
|
|
33
|
-
nascopCCCNumber?: string;
|
|
34
|
-
residence: {
|
|
35
|
-
county: string;
|
|
36
|
-
subCounty: string;
|
|
37
|
-
ward: string;
|
|
38
|
-
village: string;
|
|
39
|
-
landmark: string;
|
|
40
|
-
address: string;
|
|
41
|
-
};
|
|
42
|
-
identifications: Array<ClientIdentification>;
|
|
43
|
-
contact: ClientContact;
|
|
44
|
-
nextOfKins: Array<{
|
|
45
|
-
name: string;
|
|
46
|
-
relationship: string;
|
|
47
|
-
residence: string;
|
|
48
|
-
contact: ClientContact;
|
|
49
|
-
}>;
|
|
50
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Button } from '@carbon/react';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
|
|
5
|
-
interface CancelPatientEditProps {
|
|
6
|
-
close(): void;
|
|
7
|
-
onConfirm(): void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const CancelPatientEdit: React.FC<CancelPatientEditProps> = ({ close, onConfirm }) => {
|
|
11
|
-
const { t } = useTranslation();
|
|
12
|
-
return (
|
|
13
|
-
<>
|
|
14
|
-
<div className="cds--modal-header">
|
|
15
|
-
<h3 className="cds--modal-header__heading">{t('discardModalHeader', 'Confirm Discard Changes')}</h3>
|
|
16
|
-
</div>
|
|
17
|
-
<div className="cds--modal-content">
|
|
18
|
-
<p>
|
|
19
|
-
{t(
|
|
20
|
-
'discardModalBody',
|
|
21
|
-
"The changes you made to this patient's details have not been saved. Discard changes?",
|
|
22
|
-
)}
|
|
23
|
-
</p>
|
|
24
|
-
</div>
|
|
25
|
-
<div className="cds--modal-footer">
|
|
26
|
-
<Button kind="secondary" onClick={close}>
|
|
27
|
-
{t('cancel', 'Cancel')}
|
|
28
|
-
</Button>
|
|
29
|
-
<Button kind="danger" onClick={onConfirm}>
|
|
30
|
-
{t('discard', 'Discard')}
|
|
31
|
-
</Button>
|
|
32
|
-
</div>
|
|
33
|
-
</>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default CancelPatientEdit;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import styles from './delete-identifier-modal.scss';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { Button } from '@carbon/react';
|
|
5
|
-
|
|
6
|
-
interface DeleteIdentifierConfirmationModalProps {
|
|
7
|
-
deleteIdentifier: (x: boolean) => void;
|
|
8
|
-
identifierName: string;
|
|
9
|
-
identifierValue: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const DeleteIdentifierConfirmationModal: React.FC<DeleteIdentifierConfirmationModalProps> = ({
|
|
13
|
-
deleteIdentifier,
|
|
14
|
-
identifierName,
|
|
15
|
-
identifierValue,
|
|
16
|
-
}) => {
|
|
17
|
-
const { t } = useTranslation();
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div className={styles.modalContent}>
|
|
21
|
-
<h1 className={styles.productiveHeading}>{t('deleteIdentifierModalHeading', 'Remove identifier?')}</h1>
|
|
22
|
-
<h3 className={styles.modalSubtitle}>
|
|
23
|
-
{identifierName}
|
|
24
|
-
{t('deleteIdentifierModalText', ' has a value of ')} {identifierValue}
|
|
25
|
-
</h3>
|
|
26
|
-
<p className={styles.modalBody}>
|
|
27
|
-
{t('confirmIdentifierDeletionText', 'Are you sure you want to remove this identifier?')}
|
|
28
|
-
</p>
|
|
29
|
-
<div className={styles.buttonSet}>
|
|
30
|
-
<Button kind="secondary" size="lg" onClick={() => deleteIdentifier(false)}>
|
|
31
|
-
{t('cancel', 'Cancel')}
|
|
32
|
-
</Button>
|
|
33
|
-
<Button kind="danger" size="lg" onClick={() => deleteIdentifier(true)}>
|
|
34
|
-
{t('removeIdentifierButton', 'Remove Identifier')}
|
|
35
|
-
</Button>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default DeleteIdentifierConfirmationModal;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
@use '@carbon/styles/scss/spacing';
|
|
2
|
-
@use '@carbon/styles/scss/type';
|
|
3
|
-
@import '../patient-registration/patient-registration.scss';
|
|
4
|
-
|
|
5
|
-
.productiveHeading {
|
|
6
|
-
@include type.type-style('heading-compact-02');
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.modalContent {
|
|
10
|
-
width: 100%;
|
|
11
|
-
background-color: $ui-01;
|
|
12
|
-
padding: spacing.$spacing-05;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.modalSubtitle {
|
|
16
|
-
@include type.type-style('body-compact-01');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.modalBody {
|
|
20
|
-
@include type.type-style('body-compact-01');
|
|
21
|
-
margin: spacing.$spacing-05 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.buttonSet {
|
|
25
|
-
display: grid;
|
|
26
|
-
grid-template-columns: 1fr 1fr;
|
|
27
|
-
margin-left: -(spacing.$spacing-05);
|
|
28
|
-
margin-right: -(spacing.$spacing-05);
|
|
29
|
-
margin-bottom: -(spacing.$spacing-05);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.buttonSet > button {
|
|
33
|
-
max-width: unset !important;
|
|
34
|
-
}
|
|
File without changes
|
/package/src/patient-registration/input/custom-input/identifier/{utils.testt.ts → utils.test.ts}
RENAMED
|
File without changes
|