@ampath/esm-dha-workflow-app 4.0.0-next.12 → 4.0.0-next.14
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/198.js +1 -1
- package/dist/198.js.map +1 -1
- package/dist/200.js +2 -0
- package/dist/200.js.map +1 -0
- package/dist/306.js +1 -0
- package/dist/306.js.map +1 -0
- package/dist/860.js +1 -1
- package/dist/860.js.map +1 -1
- package/dist/91.js +1 -1
- package/dist/91.js.map +1 -1
- package/dist/93.js +1 -2
- package/dist/93.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-home-app.js +1 -1
- package/dist/openmrs-esm-home-app.js.buildmanifest.json +65 -65
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/left-panel/left-panel.component.tsx +0 -2
- package/src/registry/mock-client.ts +627 -0
- package/src/registry/modal/otp-verification-modal/otp-verification-modal.tsx +13 -11
- package/src/registry/modal/send-to-triage/send-to-triage.modal.scss +7 -0
- package/src/registry/modal/send-to-triage/send-to-triage.modal.tsx +97 -72
- package/src/registry/registry.component.scss +12 -1
- package/src/registry/registry.component.tsx +168 -104
- package/src/registry/types/index.ts +59 -1
- package/src/registry/utils/error-handler.ts +33 -0
- package/src/registry/utils/format-dependant-display-data.ts +8 -0
- package/src/registry/utils/hie-client-adapter.ts +309 -0
- package/src/resources/hie-amrs-automatic-registration.service.ts +16 -0
- package/src/resources/identifier-types.ts +27 -0
- package/src/resources/patient-resource.ts +60 -0
- package/src/shared/constants/civil-status.ts +29 -0
- package/src/shared/constants/person-attributes.ts +33 -0
- package/src/side-nav-menu/nav-link-config.ts +40 -6
- package/src/side-nav-menu/nav-links.tsx +26 -8
- package/dist/16.js +0 -1
- package/dist/16.js.map +0 -1
- package/dist/93.js.LICENSE.txt +0 -5
- package/dist/970.js +0 -2
- package/dist/970.js.map +0 -1
- /package/dist/{970.js.LICENSE.txt → 200.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { IdentifierTypesUuids } from '../../resources/identifier-types';
|
|
2
|
+
import { CivilStatusUids } from '../../shared/constants/civil-status';
|
|
3
|
+
import { PersonAttributeTypeUuids } from '../../shared/constants/person-attributes';
|
|
4
|
+
import {
|
|
5
|
+
type AlternateContact,
|
|
6
|
+
type CreatePersonDto,
|
|
7
|
+
type HieClient,
|
|
8
|
+
type HieIdentifications,
|
|
9
|
+
HieIdentificationType,
|
|
10
|
+
} from '../types';
|
|
11
|
+
|
|
12
|
+
const clientDatailsFields = [
|
|
13
|
+
'id',
|
|
14
|
+
'other_identifications',
|
|
15
|
+
'first_name',
|
|
16
|
+
'middle_name',
|
|
17
|
+
'last_name',
|
|
18
|
+
'gender',
|
|
19
|
+
'date_of_birth',
|
|
20
|
+
'is_alive',
|
|
21
|
+
'deceased_datetime',
|
|
22
|
+
'phone',
|
|
23
|
+
'email',
|
|
24
|
+
'civil_status',
|
|
25
|
+
'place_of_birth',
|
|
26
|
+
'citizenship',
|
|
27
|
+
'country',
|
|
28
|
+
'county',
|
|
29
|
+
'sub_county',
|
|
30
|
+
'ward',
|
|
31
|
+
'village_estate',
|
|
32
|
+
'longitude',
|
|
33
|
+
'latitude',
|
|
34
|
+
'identification_type',
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const nameFields = ['first_name', 'middle_name', 'last_name'];
|
|
38
|
+
const otherPersonFields = ['gender', 'date_of_birth', 'is_alive', 'deceased_datetime'];
|
|
39
|
+
const attributeFields = ['phone', 'email', 'civil_status', 'place_of_birth', 'citizenship'];
|
|
40
|
+
const addressFields = ['country', 'county', 'sub_county', 'ward', 'village_estate', 'longitude', 'latitude'];
|
|
41
|
+
const otherFields = ['gender', 'date_of_birth'];
|
|
42
|
+
const identifierFields = [
|
|
43
|
+
HieIdentificationType.Cr,
|
|
44
|
+
HieIdentificationType.SHANumber,
|
|
45
|
+
HieIdentificationType.HouseholdNumber,
|
|
46
|
+
HieIdentificationType.RefugeeID,
|
|
47
|
+
HieIdentificationType.MandateNumber,
|
|
48
|
+
HieIdentificationType.AlienID,
|
|
49
|
+
HieIdentificationType.NationalID,
|
|
50
|
+
HieIdentificationType.TemporaryDependantID,
|
|
51
|
+
];
|
|
52
|
+
const hieAmrsSyncFields = [
|
|
53
|
+
...identifierFields,
|
|
54
|
+
...nameFields,
|
|
55
|
+
...otherPersonFields,
|
|
56
|
+
...attributeFields,
|
|
57
|
+
...addressFields,
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
export function generateHieClientDetails(hieClient: HieClient) {
|
|
61
|
+
let data = {};
|
|
62
|
+
Object.keys(hieClient)
|
|
63
|
+
.filter((key) => {
|
|
64
|
+
return clientDatailsFields.includes(key);
|
|
65
|
+
})
|
|
66
|
+
.forEach((key) => {
|
|
67
|
+
if (key === 'other_identifications') {
|
|
68
|
+
const otherIds = generateOtherIdentifications(hieClient[key]);
|
|
69
|
+
data = {
|
|
70
|
+
...data,
|
|
71
|
+
...otherIds,
|
|
72
|
+
};
|
|
73
|
+
} else if (key === 'identification_type') {
|
|
74
|
+
data[hieClient['identification_type']] = hieClient.identification_number;
|
|
75
|
+
} else {
|
|
76
|
+
const value = hieClient[key];
|
|
77
|
+
data[key] = value;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return data;
|
|
81
|
+
}
|
|
82
|
+
function generateOtherIdentifications(hieIdentifications: HieIdentifications[]) {
|
|
83
|
+
const other = {};
|
|
84
|
+
hieIdentifications.forEach((id) => {
|
|
85
|
+
other[id.identification_type] = id.identification_number;
|
|
86
|
+
});
|
|
87
|
+
return other;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function generateAmrsPersonPayload(hieClient: HieClient): CreatePersonDto {
|
|
91
|
+
const createPersonPayload: CreatePersonDto = {};
|
|
92
|
+
const namesAttribute = {};
|
|
93
|
+
const addresses = {};
|
|
94
|
+
let attributes = [];
|
|
95
|
+
hieAmrsSyncFields.forEach((d) => {
|
|
96
|
+
if (d === 'first_name') {
|
|
97
|
+
namesAttribute['givenName'] = hieClient.first_name;
|
|
98
|
+
}
|
|
99
|
+
if (d === 'middle_name') {
|
|
100
|
+
namesAttribute['middleName'] = hieClient.middle_name;
|
|
101
|
+
}
|
|
102
|
+
if (d === 'last_name') {
|
|
103
|
+
namesAttribute['familyName'] = hieClient.last_name;
|
|
104
|
+
}
|
|
105
|
+
if (d === 'gender') {
|
|
106
|
+
createPersonPayload['gender'] = hieClient.gender === 'Male' ? 'M' : 'F';
|
|
107
|
+
}
|
|
108
|
+
if (d === 'date_of_birth') {
|
|
109
|
+
createPersonPayload['birthdate'] = hieClient.date_of_birth;
|
|
110
|
+
createPersonPayload['birthdateEstimated'] = false;
|
|
111
|
+
}
|
|
112
|
+
if (d === 'is_alive') {
|
|
113
|
+
createPersonPayload['dead'] = hieClient.is_alive === 0 ? true : false;
|
|
114
|
+
}
|
|
115
|
+
if (d === 'deceased_datetime') {
|
|
116
|
+
if (hieClient.deceased_datetime.length > 0) {
|
|
117
|
+
createPersonPayload['deathDate'] = hieClient.deceased_datetime;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (d === 'country' && hieClient.country.length > 0) {
|
|
121
|
+
addresses['country'] = hieClient.country;
|
|
122
|
+
addresses['address1'] = hieClient.country;
|
|
123
|
+
}
|
|
124
|
+
if (d === 'place_of_birth' && hieClient.place_of_birth.length > 0) {
|
|
125
|
+
addresses['address10'] = hieClient.place_of_birth;
|
|
126
|
+
}
|
|
127
|
+
if (d === 'county' && hieClient.county.length > 0) {
|
|
128
|
+
addresses['countyDistrict'] = hieClient.county;
|
|
129
|
+
}
|
|
130
|
+
if (d === 'sub_county' && hieClient.sub_county.length > 0) {
|
|
131
|
+
addresses['address2'] = hieClient.sub_county;
|
|
132
|
+
addresses['stateProvince'] = hieClient.sub_county;
|
|
133
|
+
}
|
|
134
|
+
if (d === 'ward' && hieClient.sub_county.length > 0) {
|
|
135
|
+
addresses['address7'] = hieClient.sub_county;
|
|
136
|
+
addresses['address4'] = hieClient.sub_county;
|
|
137
|
+
}
|
|
138
|
+
if (d === 'village_estate' && hieClient.village_estate.length > 0) {
|
|
139
|
+
addresses['cityVillage'] = hieClient.village_estate;
|
|
140
|
+
}
|
|
141
|
+
if (d === 'longitude' && hieClient.longitude.length > 0) {
|
|
142
|
+
addresses['longitude'] = hieClient.longitude;
|
|
143
|
+
}
|
|
144
|
+
if (d === 'latitude' && hieClient.latitude.length > 0) {
|
|
145
|
+
addresses['latitude'] = hieClient.latitude;
|
|
146
|
+
}
|
|
147
|
+
if (d === 'place_of_birth' && hieClient.place_of_birth.length > 0) {
|
|
148
|
+
attributes.push({
|
|
149
|
+
value: hieClient.place_of_birth,
|
|
150
|
+
attributeType: PersonAttributeTypeUuids.PLACE_OF_BIRTH_UUID,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (d === 'phone' && hieClient.phone.length > 0) {
|
|
154
|
+
attributes.push({
|
|
155
|
+
value: hieClient.phone,
|
|
156
|
+
attributeType: PersonAttributeTypeUuids.CONTACT_PHONE_NUMBER_UUID,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (d === 'email' && hieClient.email.length > 0) {
|
|
160
|
+
attributes.push({
|
|
161
|
+
value: hieClient.email,
|
|
162
|
+
attributeType: PersonAttributeTypeUuids.CONTACT_EMAIL_ADDRESS_UUID,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (d === 'civil_status' && hieClient.civil_status.length > 0) {
|
|
166
|
+
attributes.push({
|
|
167
|
+
value: getAmrsConceptUuidFromField(hieClient.civil_status),
|
|
168
|
+
attributeType: PersonAttributeTypeUuids.CIVIL_STATUS_UUID,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
if (d === 'id' && hieClient.id) {
|
|
172
|
+
attributes.push({
|
|
173
|
+
value: hieClient.id,
|
|
174
|
+
attributeType: PersonAttributeTypeUuids.CLIENT_REGISTRY_ID_UUID,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
if (d === 'citizenship' && hieClient.citizenship) {
|
|
178
|
+
attributes.push({
|
|
179
|
+
value: hieClient.citizenship,
|
|
180
|
+
attributeType: PersonAttributeTypeUuids.CITIZENSHIP_UUID,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
// Add next of kin details
|
|
185
|
+
const nextOfKinAndAlternativeAttributes = generateNextOfKinAndAlternateContactDetails(hieClient.alternative_contacts);
|
|
186
|
+
attributes = [...attributes, ...nextOfKinAndAlternativeAttributes];
|
|
187
|
+
if (Object.keys(namesAttribute).length > 0) {
|
|
188
|
+
createPersonPayload['names'] = [namesAttribute];
|
|
189
|
+
}
|
|
190
|
+
if (Object.keys(addresses).length > 0) {
|
|
191
|
+
createPersonPayload['addresses'] = [addresses];
|
|
192
|
+
}
|
|
193
|
+
if (attributes.length > 0) {
|
|
194
|
+
createPersonPayload['attributes'] = attributes;
|
|
195
|
+
}
|
|
196
|
+
return createPersonPayload;
|
|
197
|
+
}
|
|
198
|
+
function generateNextOfKinAndAlternateContactDetails(alternativeContacts: AlternateContact[]) {
|
|
199
|
+
const attributes = [];
|
|
200
|
+
const alterNativeClientContact = alternativeContacts.find((a) => {
|
|
201
|
+
return a.relationship === 'Alternative Phone Number';
|
|
202
|
+
});
|
|
203
|
+
const nextOfKinContact = alternativeContacts.find((a) => {
|
|
204
|
+
return a.remarks === 'Next Of Kin';
|
|
205
|
+
});
|
|
206
|
+
if (alterNativeClientContact) {
|
|
207
|
+
if (alterNativeClientContact.contact_type === 'Phone') {
|
|
208
|
+
attributes.push({
|
|
209
|
+
value: alterNativeClientContact.contact_id,
|
|
210
|
+
attributeType: PersonAttributeTypeUuids.ALTERNATIVE_CONTACT_PHONE_NUMBER_UUID,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (nextOfKinContact) {
|
|
215
|
+
if (nextOfKinContact.contact_type === 'Phone') {
|
|
216
|
+
attributes.push({
|
|
217
|
+
value: nextOfKinContact.contact_id,
|
|
218
|
+
attributeType: PersonAttributeTypeUuids.NEXT_OF_KIN_CONTACT_PHONE_NUMBER_UUID,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
attributes.push({
|
|
222
|
+
value: nextOfKinContact.relationship,
|
|
223
|
+
attributeType: PersonAttributeTypeUuids.NEXT_OF_KIN_RELATIONSHIP_UUID,
|
|
224
|
+
});
|
|
225
|
+
attributes.push({
|
|
226
|
+
value: nextOfKinContact.contact_name,
|
|
227
|
+
attributeType: PersonAttributeTypeUuids.NEXT_OF_KIN_NAME_UUID,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return attributes;
|
|
231
|
+
}
|
|
232
|
+
function getAmrsConceptUuidFromField(fieldName: string): string {
|
|
233
|
+
let conceptUuid = '';
|
|
234
|
+
switch (fieldName) {
|
|
235
|
+
case 'Divorced':
|
|
236
|
+
conceptUuid = CivilStatusUids.DIVORCED_UUID;
|
|
237
|
+
break;
|
|
238
|
+
case 'Married':
|
|
239
|
+
conceptUuid = CivilStatusUids.MARRIED_UUID;
|
|
240
|
+
break;
|
|
241
|
+
case 'Single':
|
|
242
|
+
conceptUuid = CivilStatusUids.SINGLE_UUID;
|
|
243
|
+
break;
|
|
244
|
+
default:
|
|
245
|
+
conceptUuid = CivilStatusUids.NOT_APPLICABLE_UUID;
|
|
246
|
+
}
|
|
247
|
+
return conceptUuid;
|
|
248
|
+
}
|
|
249
|
+
export function generateAmrsCreatePatientIdentifiersPayload(hieClient: HieClient, identifierLocation: string) {
|
|
250
|
+
const identifiers = [];
|
|
251
|
+
// add CR number
|
|
252
|
+
identifiers.push({
|
|
253
|
+
identifierType: getAmrsIdentifierTypeUuid(HieIdentificationType.Cr),
|
|
254
|
+
identifier: hieClient.id,
|
|
255
|
+
location: identifierLocation,
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// add main identifier
|
|
259
|
+
identifiers.push({
|
|
260
|
+
identifierType: getAmrsIdentifierTypeUuid(hieClient.identification_type),
|
|
261
|
+
identifier: hieClient.identification_number,
|
|
262
|
+
location: identifierLocation,
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// add other idenfications
|
|
266
|
+
hieClient.other_identifications.forEach((id) => {
|
|
267
|
+
identifiers.push({
|
|
268
|
+
identifierType: getAmrsIdentifierTypeUuid(id.identification_type),
|
|
269
|
+
identifier: id.identification_number,
|
|
270
|
+
location: identifierLocation,
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
return identifiers;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export function getAmrsIdentifierTypeUuid(hieIdentifierName: string) {
|
|
278
|
+
let idTypeUuid;
|
|
279
|
+
switch (hieIdentifierName) {
|
|
280
|
+
case HieIdentificationType.NationalID:
|
|
281
|
+
idTypeUuid = IdentifierTypesUuids.NATIONAL_ID_UUID;
|
|
282
|
+
break;
|
|
283
|
+
case HieIdentificationType.HouseholdNumber:
|
|
284
|
+
idTypeUuid = IdentifierTypesUuids.HOUSE_HOLD_NUMBER_UUID;
|
|
285
|
+
break;
|
|
286
|
+
case HieIdentificationType.AlienID:
|
|
287
|
+
idTypeUuid = IdentifierTypesUuids.ALIEN_ID_UUID;
|
|
288
|
+
break;
|
|
289
|
+
case HieIdentificationType.SHANumber:
|
|
290
|
+
idTypeUuid = IdentifierTypesUuids.SHA_UUID;
|
|
291
|
+
break;
|
|
292
|
+
case HieIdentificationType.MandateNumber:
|
|
293
|
+
idTypeUuid = IdentifierTypesUuids.MANDATE_NUMBER_UUID;
|
|
294
|
+
break;
|
|
295
|
+
case HieIdentificationType.RefugeeID:
|
|
296
|
+
idTypeUuid = IdentifierTypesUuids.REFUGEE_ID_UUID;
|
|
297
|
+
break;
|
|
298
|
+
case HieIdentificationType.Cr:
|
|
299
|
+
idTypeUuid = IdentifierTypesUuids.CLIENT_REGISTRY_NO_UUID;
|
|
300
|
+
break;
|
|
301
|
+
case HieIdentificationType.BirthCertificate:
|
|
302
|
+
idTypeUuid = IdentifierTypesUuids.BIRTH_CERTIFICATE_NUMBER_UUID;
|
|
303
|
+
break;
|
|
304
|
+
case HieIdentificationType.TemporaryDependantID:
|
|
305
|
+
idTypeUuid = IdentifierTypesUuids.TEMPORARY_DEPENDANT_ID_UUID;
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
return idTypeUuid;
|
|
309
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Patient } from '@openmrs/esm-framework';
|
|
2
|
+
import { type HieClient } from '../registry/types';
|
|
3
|
+
import { generateAmrsPersonPayload } from '../registry/utils/hie-client-adapter';
|
|
4
|
+
import { createPatient, generatePatientIdentifiers } from './patient-resource';
|
|
5
|
+
|
|
6
|
+
export async function registerHieClientInAmrs(client: HieClient, identifierLocation: string): Promise<Patient> {
|
|
7
|
+
const createPersonPayload = generateAmrsPersonPayload(client);
|
|
8
|
+
const identifiers = await generatePatientIdentifiers(identifierLocation, client);
|
|
9
|
+
const resp = await createPatient({
|
|
10
|
+
person: createPersonPayload,
|
|
11
|
+
identifiers: identifiers,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const res = await resp.json();
|
|
15
|
+
return res;
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const HOUSE_HOLD_NUMBER_UUID = 'bb74b20e-dcee-4f59-bdf1-2dffc3abf106';
|
|
2
|
+
const SHA_UUID = 'cf5362b2-8049-4442-b3c6-36f870e320cb';
|
|
3
|
+
const CLIENT_REGISTRY_NO_UUID = 'e88dc246-3614-4ee3-8141-1f2a83054e72';
|
|
4
|
+
const NATIONAL_ID_UUID = '58a47054-1359-11df-a1f1-0026b9348838';
|
|
5
|
+
const PROVIDER_NATIONAL_ID_UUID = '4550df92-c684-4597-8ab8-d6b10eabdcfb';
|
|
6
|
+
const REFUGEE_ID_UUID = '465e81af-8d69-47e9-9127-53a94adc75fb';
|
|
7
|
+
const MANDATE_NUMBER_UUID = 'aae2d097-20ba-43ca-9b71-fd8296068f39';
|
|
8
|
+
const ALIEN_ID_UUID = '12f5b147-3403-4a73-913d-7ded9ffec094';
|
|
9
|
+
const TEMPORARY_DEPENDANT_ID_UUID = 'a3d34214-93e8-4faf-bf4d-0272eee079eb';
|
|
10
|
+
const AMRS_UNIVERSAL_ID_UUID = '58a4732e-1359-11df-a1f1-0026b9348838';
|
|
11
|
+
const UPI_NUMBER_UUID = 'cba702b9-4664-4b43-83f1-9ab473cbd64d';
|
|
12
|
+
const BIRTH_CERTIFICATE_NUMBER_UUID = '7924e13b-131a-4da8-8efa-e294184a1b0d';
|
|
13
|
+
|
|
14
|
+
export const IdentifierTypesUuids = {
|
|
15
|
+
HOUSE_HOLD_NUMBER_UUID,
|
|
16
|
+
SHA_UUID,
|
|
17
|
+
CLIENT_REGISTRY_NO_UUID,
|
|
18
|
+
NATIONAL_ID_UUID,
|
|
19
|
+
PROVIDER_NATIONAL_ID_UUID,
|
|
20
|
+
REFUGEE_ID_UUID,
|
|
21
|
+
MANDATE_NUMBER_UUID,
|
|
22
|
+
ALIEN_ID_UUID,
|
|
23
|
+
TEMPORARY_DEPENDANT_ID_UUID,
|
|
24
|
+
AMRS_UNIVERSAL_ID_UUID,
|
|
25
|
+
UPI_NUMBER_UUID,
|
|
26
|
+
BIRTH_CERTIFICATE_NUMBER_UUID,
|
|
27
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
import { type HieClient, type CreatePatientDto, HieIdentificationType } from '../registry/types';
|
|
3
|
+
import { IdentifierTypesUuids } from './identifier-types';
|
|
4
|
+
import { getAmrsIdentifierTypeUuid } from '../registry/utils/hie-client-adapter';
|
|
5
|
+
|
|
6
|
+
export async function createPatient(payload: CreatePatientDto) {
|
|
7
|
+
return await openmrsFetch(`${restBaseUrl}/patient`, {
|
|
8
|
+
method: 'POST',
|
|
9
|
+
headers: {
|
|
10
|
+
'Content-Type': 'application/json',
|
|
11
|
+
},
|
|
12
|
+
body: payload,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const generatePatientIdentifiers = async (identifierLocation: string, client: HieClient) => {
|
|
17
|
+
const amrsUniverSalId = await generateAmrsUniversalIdentifier();
|
|
18
|
+
const identifiers = generateAmrsCreatePatientIdentifiersPayload(client, identifierLocation);
|
|
19
|
+
identifiers.push({
|
|
20
|
+
identifierType: IdentifierTypesUuids.AMRS_UNIVERSAL_ID_UUID,
|
|
21
|
+
identifier: amrsUniverSalId,
|
|
22
|
+
location: identifierLocation,
|
|
23
|
+
preferred: true,
|
|
24
|
+
});
|
|
25
|
+
return identifiers;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export function generateAmrsCreatePatientIdentifiersPayload(hieClient: HieClient, identifierLocation: string) {
|
|
29
|
+
const identifiers = [];
|
|
30
|
+
// add CR number
|
|
31
|
+
identifiers.push({
|
|
32
|
+
identifierType: getAmrsIdentifierTypeUuid(HieIdentificationType.Cr),
|
|
33
|
+
identifier: hieClient.id,
|
|
34
|
+
location: identifierLocation,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// add main identifier
|
|
38
|
+
identifiers.push({
|
|
39
|
+
identifierType: getAmrsIdentifierTypeUuid(hieClient.identification_type),
|
|
40
|
+
identifier: hieClient.identification_number,
|
|
41
|
+
location: identifierLocation,
|
|
42
|
+
});
|
|
43
|
+
return identifiers;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function generateAmrsUniversalIdentifier() {
|
|
47
|
+
const abortController = new AbortController();
|
|
48
|
+
const resp = await openmrsFetch(`https://staging.ampath.or.ke/amrs-id-generator/generateidentifier`, {
|
|
49
|
+
headers: {
|
|
50
|
+
'Content-Type': 'application/json',
|
|
51
|
+
},
|
|
52
|
+
method: 'POST',
|
|
53
|
+
body: {
|
|
54
|
+
user: 1,
|
|
55
|
+
},
|
|
56
|
+
signal: abortController.signal,
|
|
57
|
+
});
|
|
58
|
+
const data = await resp.json();
|
|
59
|
+
return data['identifier'] ?? '';
|
|
60
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const SEPARATED_UUID = 'a899aba0-1350-11df-a1f1-0026b9348838';
|
|
2
|
+
const NEVER_MARRIED_UUID = 'a899ac7c-1350-11df-a1f1-0026b9348838';
|
|
3
|
+
const DIVORCED_UUID = 'a899ad58-1350-11df-a1f1-0026b9348838';
|
|
4
|
+
const WIDOWED_UUID = 'a899ae34-1350-11df-a1f1-0026b9348838';
|
|
5
|
+
const MARRIED_UUID = 'a8aa76b0-1350-11df-a1f1-0026b9348838';
|
|
6
|
+
const LIVING_WITH_PARTNER_UUID = 'a899af10-1350-11df-a1f1-0026b9348838';
|
|
7
|
+
const FRIEND_UUID = 'a8aaf07c-1350-11df-a1f1-0026b9348838';
|
|
8
|
+
const NOT_APPLICABLE_UUID = 'a89ad3a4-1350-11df-a1f1-0026b9348838';
|
|
9
|
+
const POLYGAMOUS_UUID = 'a8b03712-1350-11df-a1f1-0026b9348838';
|
|
10
|
+
const PARTNER_UUID = 'a89ebd3e-1350-11df-a1f1-0026b9348838';
|
|
11
|
+
const CASUAL_SEX_PARTNER_UUID = '7831f002-331d-4f07-bf91-6bb65cd31050';
|
|
12
|
+
const OTHER_UUID = 'a8aaf3e2-1350-11df-a1f1-0026b9348838';
|
|
13
|
+
const SINGLE_UUID = 'a899ac7c-1350-11df-a1f1-0026b9348838';
|
|
14
|
+
|
|
15
|
+
export const CivilStatusUids = {
|
|
16
|
+
SEPARATED_UUID,
|
|
17
|
+
NEVER_MARRIED_UUID,
|
|
18
|
+
DIVORCED_UUID,
|
|
19
|
+
WIDOWED_UUID,
|
|
20
|
+
MARRIED_UUID,
|
|
21
|
+
LIVING_WITH_PARTNER_UUID,
|
|
22
|
+
FRIEND_UUID,
|
|
23
|
+
NOT_APPLICABLE_UUID,
|
|
24
|
+
POLYGAMOUS_UUID,
|
|
25
|
+
PARTNER_UUID,
|
|
26
|
+
CASUAL_SEX_PARTNER_UUID,
|
|
27
|
+
SINGLE_UUID,
|
|
28
|
+
OTHER_UUID,
|
|
29
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const CONTACT_PHONE_NUMBER_UUID = '72a759a8-1359-11df-a1f1-0026b9348838';
|
|
2
|
+
const CITIZENSHIP_UUID = '8d871afc-c2cc-11de-8d13-0010c6dffd0f';
|
|
3
|
+
const CONTACT_EMAIL_ADDRESS_UUID = '2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa';
|
|
4
|
+
const ALTERNATIVE_CONTACT_PHONE_NUMBER_UUID = 'c725f524-c14a-4468-ac19-4a0e6661c930';
|
|
5
|
+
const KRA_PIN_UUID = 'ae683747-b3fc-4e5c-bad3-c3be743b248f';
|
|
6
|
+
const CIVIL_STATUS_UUID = '8d871f2a-c2cc-11de-8d13-0010c6dffd0f';
|
|
7
|
+
const CLIENT_REGISTRY_ID_UUID = 'e068e02b-faac-4baf-bd58-fe6e0c29a81f';
|
|
8
|
+
const PLACE_OF_BIRTH_UUID = '8d8718c2-c2cc-11de-8d13-0010c6dffd0f';
|
|
9
|
+
const EMAIL_UUID = '2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa';
|
|
10
|
+
const HIGHEST_LEVEL_OF_EDUCATION_UUID = '352b0d51-63c6-47d0-a295-156bebee4fd5';
|
|
11
|
+
const RELIGION_UUID = '4ae16101-cfba-4c08-9c9c-d848e6f609aa';
|
|
12
|
+
const OCCUPATION_UUID = '9e86409f-9c20-42d0-aeb3-f29a4ca0a7a0';
|
|
13
|
+
const NEXT_OF_KIN_CONTACT_PHONE_NUMBER_UUID = 'a657a4f1-9c0f-444b-a1fd-445bb91dd12d';
|
|
14
|
+
const NEXT_OF_KIN_NAME_UUID = '72a75bec-1359-11df-a1f1-0026b9348838';
|
|
15
|
+
const NEXT_OF_KIN_RELATIONSHIP_UUID = '5730994e-c267-426b-87b6-c152b606973d';
|
|
16
|
+
|
|
17
|
+
export const PersonAttributeTypeUuids = {
|
|
18
|
+
CONTACT_PHONE_NUMBER_UUID,
|
|
19
|
+
CITIZENSHIP_UUID,
|
|
20
|
+
CONTACT_EMAIL_ADDRESS_UUID,
|
|
21
|
+
ALTERNATIVE_CONTACT_PHONE_NUMBER_UUID,
|
|
22
|
+
KRA_PIN_UUID,
|
|
23
|
+
CIVIL_STATUS_UUID,
|
|
24
|
+
CLIENT_REGISTRY_ID_UUID,
|
|
25
|
+
PLACE_OF_BIRTH_UUID,
|
|
26
|
+
EMAIL_UUID,
|
|
27
|
+
HIGHEST_LEVEL_OF_EDUCATION_UUID,
|
|
28
|
+
RELIGION_UUID,
|
|
29
|
+
OCCUPATION_UUID,
|
|
30
|
+
NEXT_OF_KIN_CONTACT_PHONE_NUMBER_UUID,
|
|
31
|
+
NEXT_OF_KIN_NAME_UUID,
|
|
32
|
+
NEXT_OF_KIN_RELATIONSHIP_UUID,
|
|
33
|
+
};
|
|
@@ -19,24 +19,58 @@ export const navLinksConfig = [
|
|
|
19
19
|
to: 'consultation',
|
|
20
20
|
title: 'Consultation',
|
|
21
21
|
},
|
|
22
|
+
{
|
|
23
|
+
to: 'mch',
|
|
24
|
+
title: 'MCH',
|
|
25
|
+
children: [
|
|
26
|
+
{
|
|
27
|
+
to: 'triage',
|
|
28
|
+
title: 'Triage',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
to: 'consultation',
|
|
32
|
+
title: 'Consultation',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
to: 'admissions',
|
|
38
|
+
title: 'Admissions',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
to: 'procedures',
|
|
42
|
+
title: 'Procedures',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
to: 'radiology-imaging',
|
|
46
|
+
title: 'Radiology and Imaging',
|
|
47
|
+
},
|
|
22
48
|
{
|
|
23
49
|
to: 'laboratory',
|
|
24
50
|
title: 'Laboratory',
|
|
25
51
|
},
|
|
26
52
|
{
|
|
27
|
-
to: '
|
|
28
|
-
title: '
|
|
53
|
+
to: 'pharmacy',
|
|
54
|
+
title: 'Pharmacy',
|
|
29
55
|
},
|
|
30
56
|
{
|
|
31
|
-
to: '
|
|
32
|
-
title: '
|
|
57
|
+
to: 'mortuary',
|
|
58
|
+
title: 'Mortuary',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
to: 'accounting',
|
|
62
|
+
title: 'Accounting',
|
|
33
63
|
},
|
|
34
64
|
{
|
|
35
65
|
to: 'registers',
|
|
36
66
|
title: 'Registers',
|
|
37
67
|
},
|
|
38
68
|
{
|
|
39
|
-
to: '
|
|
40
|
-
title: '
|
|
69
|
+
to: 'reports',
|
|
70
|
+
title: 'Reports',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
to: 'bookings',
|
|
74
|
+
title: 'Bookings',
|
|
41
75
|
},
|
|
42
76
|
];
|
|
@@ -2,20 +2,38 @@ import React from 'react';
|
|
|
2
2
|
import { ConfigurableLink } from '@openmrs/esm-framework';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { navLinksConfig } from './nav-link-config';
|
|
5
|
+
import { SideNavMenu } from '@carbon/react';
|
|
5
6
|
|
|
6
7
|
interface NavLinksProps {}
|
|
7
8
|
const NavLinks: React.FC<NavLinksProps> = () => {
|
|
8
9
|
return (
|
|
9
10
|
<>
|
|
10
11
|
{navLinksConfig.map((n) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
if (n.children && n.children.length > 0) {
|
|
13
|
+
return (
|
|
14
|
+
<SideNavMenu title={n.title}>
|
|
15
|
+
{n.children.map((c) => {
|
|
16
|
+
return (
|
|
17
|
+
<ConfigurableLink
|
|
18
|
+
to={`${window.getOpenmrsSpaBase()}home/${n.to}/${c.to}`}
|
|
19
|
+
className={classNames('cds--side-nav__link', '')}
|
|
20
|
+
>
|
|
21
|
+
{c.title}
|
|
22
|
+
</ConfigurableLink>
|
|
23
|
+
);
|
|
24
|
+
})}
|
|
25
|
+
</SideNavMenu>
|
|
26
|
+
);
|
|
27
|
+
} else {
|
|
28
|
+
return (
|
|
29
|
+
<ConfigurableLink
|
|
30
|
+
to={`${window.getOpenmrsSpaBase()}home/${n.to}`}
|
|
31
|
+
className={classNames('cds--side-nav__link', '')}
|
|
32
|
+
>
|
|
33
|
+
{n.title}
|
|
34
|
+
</ConfigurableLink>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
19
37
|
})}
|
|
20
38
|
</>
|
|
21
39
|
);
|