@kenyaemr/esm-morgue-app 5.4.2-pre.2283 → 5.4.2-pre.2288
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 +19 -19
- package/dist/109.js +2 -0
- package/dist/109.js.map +1 -0
- package/dist/201.js +1 -0
- package/dist/201.js.map +1 -0
- package/dist/293.js +1 -0
- package/dist/293.js.map +1 -0
- package/dist/300.js +1 -1
- package/dist/347.js +1 -2
- package/dist/347.js.map +1 -1
- package/dist/373.js +2 -0
- package/dist/373.js.map +1 -0
- package/dist/38.js +1 -0
- package/dist/38.js.map +1 -0
- package/dist/389.js +1 -0
- package/dist/389.js.map +1 -0
- package/dist/398.js +1 -0
- package/dist/398.js.map +1 -0
- package/dist/4.js +2 -0
- package/dist/4.js.map +1 -0
- package/dist/410.js +1 -0
- package/dist/410.js.map +1 -0
- package/dist/420.js +2 -0
- package/dist/420.js.map +1 -0
- package/dist/467.js +1 -0
- package/dist/467.js.map +1 -0
- package/dist/632.js +1 -0
- package/dist/632.js.map +1 -0
- package/dist/798.js +1 -0
- package/dist/798.js.map +1 -0
- package/dist/811.js +1 -0
- package/dist/811.js.map +1 -0
- package/dist/824.js +1 -0
- package/dist/824.js.map +1 -0
- package/dist/827.js +1 -0
- package/dist/827.js.map +1 -0
- package/dist/842.js +2 -0
- package/dist/842.js.LICENSE.txt +5 -0
- package/dist/842.js.map +1 -0
- package/dist/918.js +1 -1
- package/dist/918.js.map +1 -1
- package/dist/kenyaemr-esm-morgue-app.js +1 -1
- package/dist/kenyaemr-esm-morgue-app.js.buildmanifest.json +218 -291
- package/dist/kenyaemr-esm-morgue-app.js.map +1 -1
- package/dist/main.js +2 -1
- package/dist/main.js.LICENSE.txt +15 -0
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/bed/bed.component.tsx +164 -0
- package/src/bed/bed.scss +192 -0
- package/src/bed/divider/divider.component.tsx +18 -0
- package/src/bed/empty-bed.component.tsx +47 -0
- package/src/bed-layout/admitted/admitted-bed-layout.component.tsx +189 -0
- package/src/bed-layout/awaiting/awaiting-bed-layout.component.tsx +86 -0
- package/src/bed-layout/bed-layout.resource.ts +72 -0
- package/src/bed-layout/bed-layout.scss +55 -0
- package/src/bed-layout/discharged/discharged-bed-layout.component.tsx +109 -0
- package/src/bed-layout/discharged/discharged-bed-layout.resource.ts +99 -0
- package/src/bed-linelist-view/admitted/admitted-bed-linelist-view.component.tsx +420 -0
- package/src/bed-linelist-view/awaiting/awaiting-bed-linelist-view.component.tsx +224 -0
- package/src/bed-linelist-view/bed-linelist-view.scss +5 -0
- package/src/bed-linelist-view/discharged/discharged-bed-line-view.component.tsx +256 -0
- package/src/config-schema.ts +41 -9
- package/src/constants.ts +57 -0
- package/src/deceased-patient-header/deceased-patient-header.component.tsx +31 -0
- package/src/deceased-patient-header/deceased-patient-header.scss +50 -0
- package/src/{component → deceased-patient-header}/deceasedInfo/deceased-info.component.tsx +1 -1
- package/src/deceased-patient-header/deceasedInfo/deceased-info.resource.ts +11 -0
- package/src/extension/actionButton.component.tsx +5 -59
- package/src/extension/deceasedInfoBanner.component.tsx +5 -9
- package/src/{hook/useAdmitPatient.ts → forms/admit-deceased-person-workspace/admit-deceased-person.resource.ts} +177 -46
- package/src/forms/admit-deceased-person-workspace/admit-deceased-person.scss +143 -0
- package/src/forms/admit-deceased-person-workspace/admit-deceased-person.workspace.tsx +648 -0
- package/src/{hook/usePersonAttributes.ts → forms/discharge-deceased-person-workspace/discharge-body.resource.ts} +1 -1
- package/src/forms/discharge-deceased-person-workspace/discharge-body.scss +56 -0
- package/src/forms/discharge-deceased-person-workspace/discharge-body.workspace.tsx +362 -0
- package/src/forms/dispose-deceased-person-workspace/dispose-deceased-person.resource.ts +18 -0
- package/src/{workspaces/patientAdditionalInfoForm.scss → forms/dispose-deceased-person-workspace/dispose-deceased-person.scss} +46 -66
- package/src/forms/dispose-deceased-person-workspace/dispose-deceased-person.workspace.tsx +401 -0
- package/src/forms/form-entry-workspace/form-entry-workspace.workspace.tsx +62 -0
- package/src/forms/swap-compartment-workspace/swap-unit.scss +144 -0
- package/src/forms/swap-compartment-workspace/swap-unit.workspace.tsx +280 -0
- package/src/header/header.component.tsx +41 -0
- package/src/header/header.scss +58 -0
- package/src/home/home.component.tsx +87 -0
- package/src/home/home.resource.ts +261 -0
- package/src/home/home.scss +5 -0
- package/src/index.ts +18 -12
- package/src/metrics/metrics-card.component.tsx +31 -0
- package/src/metrics/metrics-card.scss +51 -0
- package/src/root.component.tsx +7 -3
- package/src/routes.json +25 -1
- package/src/schemas/index.ts +66 -0
- package/src/summary/summary.component.tsx +42 -0
- package/src/summary/summary.scss +10 -0
- package/src/switcher/content-switcher.component.tsx +220 -0
- package/src/switcher/content-switcher.scss +30 -0
- package/src/types/index.ts +336 -359
- package/src/utils/utils.ts +20 -2
- package/src/view-details/main/main.component.tsx +34 -0
- package/src/view-details/main/main.scss +45 -0
- package/src/view-details/panels/attachement.component.tsx +21 -0
- package/src/view-details/panels/autopsy.component.tsx +215 -0
- package/src/view-details/panels/billing-history.component.tsx +13 -0
- package/src/view-details/panels/observations/observation.component.tsx +57 -0
- package/src/view-details/panels/observations/observation.scss +24 -0
- package/src/view-details/panels/panels.scss +46 -0
- package/src/view-details/view-details.component.tsx +65 -0
- package/src/view-details/view-details.resource.ts +65 -0
- package/src/view-details/views-details.scss +82 -0
- package/translations/en.json +74 -21
- package/tsconfig.json +1 -1
- package/dist/113.js +0 -1
- package/dist/113.js.map +0 -1
- package/dist/160.js +0 -1
- package/dist/160.js.map +0 -1
- package/dist/299.js +0 -1
- package/dist/299.js.map +0 -1
- package/dist/433.js +0 -2
- package/dist/433.js.map +0 -1
- package/dist/441.js +0 -1
- package/dist/441.js.map +0 -1
- package/dist/496.js +0 -1
- package/dist/496.js.map +0 -1
- package/dist/511.js +0 -1
- package/dist/511.js.map +0 -1
- package/dist/603.js +0 -1
- package/dist/603.js.map +0 -1
- package/dist/610.js +0 -1
- package/dist/610.js.map +0 -1
- package/dist/612.js +0 -1
- package/dist/612.js.map +0 -1
- package/dist/656.js +0 -2
- package/dist/656.js.map +0 -1
- package/dist/752.js +0 -1
- package/dist/752.js.map +0 -1
- package/dist/754.js +0 -1
- package/dist/754.js.map +0 -1
- package/dist/781.js +0 -1
- package/dist/781.js.map +0 -1
- package/dist/801.js +0 -2
- package/dist/801.js.map +0 -1
- package/dist/817.js +0 -1
- package/dist/817.js.map +0 -1
- package/dist/877.js +0 -1
- package/dist/877.js.map +0 -1
- package/dist/924.js +0 -1
- package/dist/924.js.map +0 -1
- package/src/autosuggest/autosuggest.component.tsx +0 -162
- package/src/autosuggest/autosuggest.scss +0 -61
- package/src/autosuggest/patient-search-info.component.tsx +0 -75
- package/src/autosuggest/patient-search-info.scss +0 -62
- package/src/autosuggest/search-empty-state.component.tsx +0 -21
- package/src/autosuggest/search-empty-state.scss +0 -18
- package/src/card/avail-compartment.compartment.tsx +0 -94
- package/src/card/compartment-view.compartment.tsx +0 -62
- package/src/card/compartment.scss +0 -128
- package/src/card/compartmentSharing.component.tsx +0 -21
- package/src/card/compartmentSharing.scss +0 -24
- package/src/card/empty-compartment.component.tsx +0 -28
- package/src/card/empty-compartment.scss +0 -61
- package/src/component/main.component.tsx +0 -17
- package/src/component/next-of-kin-details/nextOfKinDetails.component.tsx +0 -50
- package/src/component/next-of-kin-details/nextOfKinDetails.scss +0 -37
- package/src/header/admitted-queue-header.component.tsx +0 -30
- package/src/header/admitted-queue-header.scss +0 -32
- package/src/header/morgue-header.component.tsx +0 -38
- package/src/header/morgue-header.scss +0 -95
- package/src/header/morgue-illustration.component.tsx +0 -13
- package/src/hook/useDeceasedPatients.ts +0 -12
- package/src/hook/useDischargedPatient.ts +0 -55
- package/src/hook/useMorgue.resource.ts +0 -163
- package/src/hook/useMortuaryAdmissionLocation.ts +0 -64
- package/src/tables/admitted-queue.component.tsx +0 -54
- package/src/tables/admitted-queue.scss +0 -62
- package/src/tables/discharge-queue.component.tsx +0 -87
- package/src/tables/generic-table.component.tsx +0 -140
- package/src/tables/generic-table.scss +0 -37
- package/src/tabs/tabs.component.tsx +0 -82
- package/src/tabs/tabs.scss +0 -15
- package/src/workspaces/admit-body.scss +0 -46
- package/src/workspaces/admit-body.workspace.tsx +0 -79
- package/src/workspaces/discharge-body.scss +0 -67
- package/src/workspaces/discharge-body.workspace.tsx +0 -329
- package/src/workspaces/patientAdditionalInfoForm.workspace.tsx +0 -562
- package/src/workspaces/swap-unit.scss +0 -46
- package/src/workspaces/swap-unit.workspace.tsx +0 -168
- /package/dist/{347.js.LICENSE.txt → 109.js.LICENSE.txt} +0 -0
- /package/dist/{656.js.LICENSE.txt → 373.js.LICENSE.txt} +0 -0
- /package/dist/{801.js.LICENSE.txt → 4.js.LICENSE.txt} +0 -0
- /package/dist/{433.js.LICENSE.txt → 420.js.LICENSE.txt} +0 -0
- /package/src/{component → deceased-patient-header}/deceasedInfo/deceased-info.scss +0 -0
|
@@ -1,31 +1,81 @@
|
|
|
1
1
|
import {
|
|
2
|
-
closeWorkspace,
|
|
3
2
|
FetchResponse,
|
|
4
3
|
openmrsFetch,
|
|
4
|
+
type OpenmrsResource,
|
|
5
5
|
restBaseUrl,
|
|
6
|
-
|
|
6
|
+
toDateObjectStrict,
|
|
7
|
+
toOmrsIsoString,
|
|
7
8
|
updateVisit,
|
|
8
9
|
useConfig,
|
|
9
10
|
useSession,
|
|
10
11
|
type Visit,
|
|
11
12
|
} from '@openmrs/esm-framework';
|
|
12
|
-
import dayjs from 'dayjs';
|
|
13
|
-
import { useCallback, useMemo } from 'react';
|
|
14
13
|
import useSWR from 'swr';
|
|
15
|
-
import useSWRImmutable from 'swr/immutable';
|
|
16
|
-
import { z } from 'zod';
|
|
17
|
-
import { ConfigObject } from '../config-schema';
|
|
18
14
|
import {
|
|
19
|
-
CurrentLocationEncounterResponse,
|
|
20
|
-
customRepProps,
|
|
21
15
|
EmrApiConfigurationResponse,
|
|
22
16
|
Encounter,
|
|
23
17
|
MappedVisitQueueEntry,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
18
|
+
type PaymentMethod,
|
|
19
|
+
type VisitTypeResponse,
|
|
20
|
+
} from '../../types';
|
|
21
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
22
|
+
import { deceasedPatientAdmitSchema, dischargeSchema, disposeSchema } from '../../schemas';
|
|
23
|
+
import useSWRImmutable from 'swr/immutable';
|
|
24
|
+
|
|
25
|
+
import { z } from 'zod';
|
|
26
|
+
import dayjs from 'dayjs';
|
|
27
|
+
import { customRepProps } from '../../constants';
|
|
28
|
+
import { BillingConfig, ConfigObject } from '../../config-schema';
|
|
29
|
+
|
|
30
|
+
export const useVisitType = () => {
|
|
31
|
+
const customRepresentation = 'custom:(uuid,display,name)';
|
|
32
|
+
const url = `${restBaseUrl}/visittype?v=${customRepresentation}`;
|
|
33
|
+
const { data, error, isLoading } = useSWR<FetchResponse<{ results: VisitTypeResponse[] }>>(url, openmrsFetch);
|
|
34
|
+
const visitType = data?.data?.results || null;
|
|
35
|
+
|
|
36
|
+
return { data: visitType, error, isLoading };
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const useBillableItems = () => {
|
|
40
|
+
const url = `${restBaseUrl}/cashier/billableService?v=custom:(uuid,name,shortName,serviceStatus,serviceType:(uuid,display),servicePrices:(uuid,name,price,paymentMode))`;
|
|
41
|
+
const { data, isLoading, error } = useSWR<{ data: { results: Array<OpenmrsResource> } }>(url, openmrsFetch);
|
|
42
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
43
|
+
const filteredItems =
|
|
44
|
+
data?.data?.results?.filter((item) => item.name.toLowerCase().includes(searchTerm.toLowerCase())) ?? [];
|
|
45
|
+
return {
|
|
46
|
+
lineItems: filteredItems,
|
|
47
|
+
isLoading,
|
|
48
|
+
error,
|
|
49
|
+
searchTerm,
|
|
50
|
+
setSearchTerm,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const useCashPoint = () => {
|
|
55
|
+
const url = `/ws/rest/v1/cashier/cashPoint`;
|
|
56
|
+
const { data, isLoading, error } = useSWR<{ data: { results: Array<OpenmrsResource> } }>(url, openmrsFetch);
|
|
57
|
+
|
|
58
|
+
return { isLoading, error, cashPoints: data?.data?.results ?? [] };
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const usePaymentModes = (excludeWaiver: boolean = true) => {
|
|
62
|
+
const { excludedPaymentMode } = useConfig<BillingConfig>();
|
|
63
|
+
const url = `${restBaseUrl}/cashier/paymentMode?v=full`;
|
|
64
|
+
const { data, isLoading, error, mutate } = useSWR<{ data: { results: Array<PaymentMethod> } }>(url, openmrsFetch, {
|
|
65
|
+
errorRetryCount: 2,
|
|
66
|
+
});
|
|
67
|
+
const allowedPaymentModes =
|
|
68
|
+
excludedPaymentMode?.length > 0
|
|
69
|
+
? data?.data?.results.filter((mode) => !excludedPaymentMode.some((excluded) => excluded.uuid === mode.uuid)) ?? []
|
|
70
|
+
: data?.data?.results ?? [];
|
|
71
|
+
return {
|
|
72
|
+
paymentModes: excludeWaiver ? allowedPaymentModes : data?.data?.results,
|
|
73
|
+
isLoading,
|
|
74
|
+
mutate,
|
|
75
|
+
error,
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
29
79
|
const customRep = `custom:${customRepProps.map((prop) => prop.join(':')).join(',')}`;
|
|
30
80
|
|
|
31
81
|
export default function useEmrConfiguration() {
|
|
@@ -46,8 +96,25 @@ export default function useEmrConfiguration() {
|
|
|
46
96
|
return results;
|
|
47
97
|
}
|
|
48
98
|
|
|
49
|
-
export
|
|
50
|
-
|
|
99
|
+
export function removeQueuedPatient(
|
|
100
|
+
queueUuid: string,
|
|
101
|
+
queueEntryUuid: string,
|
|
102
|
+
abortController: AbortController,
|
|
103
|
+
endedAt?: Date,
|
|
104
|
+
) {
|
|
105
|
+
return openmrsFetch(`${restBaseUrl}/queue/${queueUuid}/entry/${queueEntryUuid}`, {
|
|
106
|
+
method: 'POST',
|
|
107
|
+
headers: {
|
|
108
|
+
'Content-Type': 'application/json',
|
|
109
|
+
},
|
|
110
|
+
body: {
|
|
111
|
+
endedAt: toDateObjectStrict(toOmrsIsoString(endedAt) ?? toOmrsIsoString(new Date())),
|
|
112
|
+
},
|
|
113
|
+
signal: abortController.signal,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export const useMortuaryOperation = (location?: string) => {
|
|
51
118
|
const { currentProvider } = useSession();
|
|
52
119
|
const { emrConfiguration, isLoadingEmrConfiguration, errorFetchingEmrConfiguration } = useEmrConfiguration();
|
|
53
120
|
const {
|
|
@@ -58,6 +125,11 @@ export const useMortuaryOperation = () => {
|
|
|
58
125
|
policeNameUuid,
|
|
59
126
|
policeIDNumber,
|
|
60
127
|
dischargeAreaUuid,
|
|
128
|
+
serialNumberUuid,
|
|
129
|
+
nextOfKinNameUuid,
|
|
130
|
+
courtOrderCaseNumberUuid,
|
|
131
|
+
morgueDischargeEncounterTypeUuid,
|
|
132
|
+
morgueAdmissionEncounterTypeUuid,
|
|
61
133
|
} = useConfig<ConfigObject>();
|
|
62
134
|
|
|
63
135
|
const createMortuaryAdmissionEncounter = useCallback(
|
|
@@ -75,7 +147,7 @@ export const useMortuaryOperation = () => {
|
|
|
75
147
|
policeName,
|
|
76
148
|
tagNumber,
|
|
77
149
|
visitType,
|
|
78
|
-
}: z.infer<typeof
|
|
150
|
+
}: z.infer<typeof deceasedPatientAdmitSchema>,
|
|
79
151
|
) => {
|
|
80
152
|
const obs = [];
|
|
81
153
|
if (tagNumber) {
|
|
@@ -93,30 +165,28 @@ export const useMortuaryOperation = () => {
|
|
|
93
165
|
if (dischargeArea) {
|
|
94
166
|
obs.push({ concept: dischargeAreaUuid, value: dischargeArea });
|
|
95
167
|
}
|
|
168
|
+
|
|
169
|
+
const visitAttributes = [];
|
|
96
170
|
const encounterPayload = {
|
|
97
171
|
visit: {
|
|
98
172
|
patient: patientUuid,
|
|
99
173
|
startDatetime: dayjs(dateOfAdmission).toISOString(),
|
|
100
174
|
visitType: visitType,
|
|
101
|
-
location: location
|
|
102
|
-
attributes:
|
|
103
|
-
{
|
|
104
|
-
attributeType: visitPaymentMethodAttributeUuid,
|
|
105
|
-
value: paymentMethod,
|
|
106
|
-
},
|
|
107
|
-
],
|
|
175
|
+
location: location,
|
|
176
|
+
...(visitAttributes.length > 0 && { attributes: visitAttributes }),
|
|
108
177
|
},
|
|
109
178
|
patient: patientUuid,
|
|
110
|
-
encounterType:
|
|
111
|
-
location
|
|
179
|
+
encounterType: morgueAdmissionEncounterTypeUuid,
|
|
180
|
+
location,
|
|
112
181
|
encounterProviders: [
|
|
113
182
|
{
|
|
114
183
|
provider: currentProvider?.uuid,
|
|
115
184
|
encounterRole: emrConfiguration?.clinicianEncounterRole?.uuid,
|
|
116
185
|
},
|
|
117
186
|
],
|
|
118
|
-
obs
|
|
187
|
+
...(obs.length > 0 && { obs }),
|
|
119
188
|
};
|
|
189
|
+
|
|
120
190
|
return openmrsFetch<Encounter>(`${restBaseUrl}/encounter`, {
|
|
121
191
|
method: 'POST',
|
|
122
192
|
headers: {
|
|
@@ -130,15 +200,59 @@ export const useMortuaryOperation = () => {
|
|
|
130
200
|
dischargeAreaUuid,
|
|
131
201
|
emrConfiguration?.admissionEncounterType?.uuid,
|
|
132
202
|
emrConfiguration?.clinicianEncounterRole?.uuid,
|
|
133
|
-
location
|
|
203
|
+
location,
|
|
134
204
|
obNumberUuid,
|
|
135
205
|
policeIDNumber,
|
|
136
206
|
policeNameUuid,
|
|
137
207
|
tagNumberUuid,
|
|
208
|
+
morgueAdmissionEncounterTypeUuid,
|
|
209
|
+
nextOfKinNameUuid,
|
|
210
|
+
courtOrderCaseNumberUuid,
|
|
211
|
+
serialNumberUuid,
|
|
212
|
+
morgueDischargeEncounterTypeUuid,
|
|
138
213
|
visitPaymentMethodAttributeUuid,
|
|
214
|
+
burialPermitNumberUuid,
|
|
139
215
|
],
|
|
140
216
|
);
|
|
141
217
|
|
|
218
|
+
const createDisposalMortuaryEncounter = useCallback(
|
|
219
|
+
async (visit: Visit, data: z.infer<typeof disposeSchema>) => {
|
|
220
|
+
const obs = [];
|
|
221
|
+
if (data.nextOfKinNames) {
|
|
222
|
+
obs.push({ concept: nextOfKinNameUuid, value: data.nextOfKinNames });
|
|
223
|
+
}
|
|
224
|
+
if (data.courtOrderCaseNumber) {
|
|
225
|
+
obs.push({ concept: courtOrderCaseNumberUuid, value: data.courtOrderCaseNumber });
|
|
226
|
+
}
|
|
227
|
+
if (data.serialNumber) {
|
|
228
|
+
obs.push({ concept: serialNumberUuid, value: data.serialNumber });
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const encounterPayload = {
|
|
232
|
+
encounterDatetime: data?.dateOfDischarge,
|
|
233
|
+
patient: visit?.patient?.uuid,
|
|
234
|
+
encounterType: morgueDischargeEncounterTypeUuid,
|
|
235
|
+
location: visit?.location?.uuid,
|
|
236
|
+
encounterProviders: [
|
|
237
|
+
{
|
|
238
|
+
provider: currentProvider?.uuid,
|
|
239
|
+
encounterRole: emrConfiguration?.clinicianEncounterRole?.uuid,
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
visit: visit?.uuid,
|
|
243
|
+
obs: obs.length > 0 ? obs : undefined,
|
|
244
|
+
};
|
|
245
|
+
return openmrsFetch<Encounter>(`${restBaseUrl}/encounter`, {
|
|
246
|
+
method: 'POST',
|
|
247
|
+
headers: {
|
|
248
|
+
'content-type': 'application/json',
|
|
249
|
+
},
|
|
250
|
+
body: encounterPayload,
|
|
251
|
+
});
|
|
252
|
+
},
|
|
253
|
+
[burialPermitNumberUuid, currentProvider?.uuid, emrConfiguration?.clinicianEncounterRole?.uuid],
|
|
254
|
+
);
|
|
255
|
+
|
|
142
256
|
const assignDeceasedToCompartment = useCallback(
|
|
143
257
|
async (patientUuid: string, bedId: number, encounterUuid: string) =>
|
|
144
258
|
openmrsFetch(`${restBaseUrl}/beds/${bedId}`, {
|
|
@@ -155,14 +269,17 @@ export const useMortuaryOperation = () => {
|
|
|
155
269
|
);
|
|
156
270
|
|
|
157
271
|
const admitBody = useCallback(
|
|
158
|
-
async (patientUuid: string, data: z.infer<typeof
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
data
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
272
|
+
async (patientUuid: string, data: z.infer<typeof deceasedPatientAdmitSchema>) => {
|
|
273
|
+
try {
|
|
274
|
+
const admissionEncounter = await createMortuaryAdmissionEncounter(patientUuid, data);
|
|
275
|
+
|
|
276
|
+
const encounterUuid = admissionEncounter?.data?.uuid || admissionEncounter?.data?.uuid;
|
|
277
|
+
const compartment = await assignDeceasedToCompartment(patientUuid, data.availableCompartment, encounterUuid);
|
|
278
|
+
|
|
279
|
+
return { admissionEncounter, compartment };
|
|
280
|
+
} catch (error) {
|
|
281
|
+
throw error;
|
|
282
|
+
}
|
|
166
283
|
},
|
|
167
284
|
[assignDeceasedToCompartment, createMortuaryAdmissionEncounter],
|
|
168
285
|
);
|
|
@@ -177,8 +294,8 @@ export const useMortuaryOperation = () => {
|
|
|
177
294
|
const encounterPayload = {
|
|
178
295
|
encounterDatetime: data?.dateOfDischarge,
|
|
179
296
|
patient: visit?.patient?.uuid,
|
|
180
|
-
encounterType:
|
|
181
|
-
location: visit?.location
|
|
297
|
+
encounterType: morgueDischargeEncounterTypeUuid,
|
|
298
|
+
location: visit?.location,
|
|
182
299
|
encounterProviders: [
|
|
183
300
|
{
|
|
184
301
|
provider: currentProvider?.uuid,
|
|
@@ -196,13 +313,9 @@ export const useMortuaryOperation = () => {
|
|
|
196
313
|
body: encounterPayload,
|
|
197
314
|
});
|
|
198
315
|
},
|
|
199
|
-
[
|
|
200
|
-
burialPermitNumberUuid,
|
|
201
|
-
currentProvider?.uuid,
|
|
202
|
-
emrConfiguration?.clinicianEncounterRole?.uuid,
|
|
203
|
-
emrConfiguration?.exitFromInpatientEncounterType,
|
|
204
|
-
],
|
|
316
|
+
[burialPermitNumberUuid, currentProvider?.uuid, emrConfiguration?.clinicianEncounterRole?.uuid],
|
|
205
317
|
);
|
|
318
|
+
|
|
206
319
|
const removeDeceasedFromCompartment = useCallback(
|
|
207
320
|
async (patientUuid: string, bedId: number) =>
|
|
208
321
|
openmrsFetch(`${restBaseUrl}/beds/${bedId}?patientUuid=${patientUuid}`, {
|
|
@@ -243,6 +356,17 @@ export const useMortuaryOperation = () => {
|
|
|
243
356
|
},
|
|
244
357
|
[createDischargeMortuaryEncounter, endCurrentVisit, removeDeceasedFromCompartment],
|
|
245
358
|
);
|
|
359
|
+
|
|
360
|
+
const disposeBody = useCallback(
|
|
361
|
+
async (visit: Visit, queueEntry: MappedVisitQueueEntry, bedId: number, data: z.infer<typeof disposeSchema>) => {
|
|
362
|
+
const disposeEncounter = await createDischargeMortuaryEncounter(visit, data);
|
|
363
|
+
const compartment = await removeDeceasedFromCompartment(visit?.patient?.uuid, bedId);
|
|
364
|
+
await endCurrentVisit(visit, queueEntry, data);
|
|
365
|
+
return { disposeEncounter, compartment };
|
|
366
|
+
},
|
|
367
|
+
[createDisposalMortuaryEncounter, endCurrentVisit, removeDeceasedFromCompartment],
|
|
368
|
+
);
|
|
369
|
+
|
|
246
370
|
const createEncounterForCompartmentSwap = useCallback(
|
|
247
371
|
async (patientUuid: string, visitUuid: string) =>
|
|
248
372
|
openmrsFetch<Encounter>(`${restBaseUrl}/encounter`, {
|
|
@@ -254,7 +378,7 @@ export const useMortuaryOperation = () => {
|
|
|
254
378
|
encounterDatetime: new Date(),
|
|
255
379
|
patient: patientUuid,
|
|
256
380
|
encounterType: emrConfiguration?.bedAssignmentEncounterType,
|
|
257
|
-
location
|
|
381
|
+
location,
|
|
258
382
|
encounterProviders: [
|
|
259
383
|
{
|
|
260
384
|
provider: currentProvider?.uuid,
|
|
@@ -269,12 +393,14 @@ export const useMortuaryOperation = () => {
|
|
|
269
393
|
currentProvider?.uuid,
|
|
270
394
|
emrConfiguration?.bedAssignmentEncounterType,
|
|
271
395
|
emrConfiguration?.clinicianEncounterRole?.uuid,
|
|
272
|
-
location
|
|
396
|
+
location,
|
|
273
397
|
],
|
|
274
398
|
);
|
|
275
399
|
|
|
276
400
|
return {
|
|
277
401
|
admitBody,
|
|
402
|
+
disposeBody,
|
|
403
|
+
createDisposalMortuaryEncounter,
|
|
278
404
|
createEncounterForCompartmentSwap,
|
|
279
405
|
assignDeceasedToCompartment,
|
|
280
406
|
removeDeceasedFromCompartment,
|
|
@@ -283,3 +409,8 @@ export const useMortuaryOperation = () => {
|
|
|
283
409
|
errorFetchingEmrConfiguration,
|
|
284
410
|
};
|
|
285
411
|
};
|
|
412
|
+
|
|
413
|
+
export const createPatientBill = (payload) => {
|
|
414
|
+
const postUrl = `${restBaseUrl}/cashier/bill`;
|
|
415
|
+
return openmrsFetch(postUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: payload });
|
|
416
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
|
+
@use '@carbon/type';
|
|
4
|
+
|
|
5
|
+
.form {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
height: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.formContainer {
|
|
13
|
+
margin: layout.$spacing-05;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: layout.$spacing-05;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.tablet {
|
|
20
|
+
padding: layout.$spacing-06 layout.$spacing-05;
|
|
21
|
+
background-color: colors.$white;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.desktop {
|
|
25
|
+
padding: layout.$spacing-01 layout.$spacing-05;
|
|
26
|
+
}
|
|
27
|
+
.buttonContainer {
|
|
28
|
+
max-width: 50%;
|
|
29
|
+
}
|
|
30
|
+
.inlineLoading {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: layout.$spacing-03;
|
|
34
|
+
}
|
|
35
|
+
.formDeathTimepickerSelector {
|
|
36
|
+
min-width: layout.$spacing-05;
|
|
37
|
+
margin-top: layout.$spacing-06;
|
|
38
|
+
}
|
|
39
|
+
.formAdmissionTimepicker input {
|
|
40
|
+
min-width: 11rem;
|
|
41
|
+
}
|
|
42
|
+
.formAdmissionDatepicker input {
|
|
43
|
+
min-width: 24rem;
|
|
44
|
+
}
|
|
45
|
+
.dateTimeSection {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
gap: layout.$spacing-02;
|
|
49
|
+
align-items: center;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.radioButtonGroup {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
align-items: flex-start;
|
|
56
|
+
margin-top: layout.$spacing-03;
|
|
57
|
+
min-height: layout.$spacing-10;
|
|
58
|
+
width: 100%;
|
|
59
|
+
@include type.type-style('body-compact-01');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.radioButton {
|
|
63
|
+
padding: layout.$spacing-02 layout.$spacing-05;
|
|
64
|
+
margin: layout.$spacing-03 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.visitTypeOverviewWrapper {
|
|
68
|
+
margin: layout.$spacing-05 0;
|
|
69
|
+
border: 0.0625rem solid colors.$gray-30;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.visitTypeOverviewWrapper div:nth-child(3) > div:nth-child(2) {
|
|
73
|
+
position: relative;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.visitTypeOverviewWrapper div:nth-child(3) span * {
|
|
77
|
+
display: none;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.compartmentListContainer {
|
|
81
|
+
max-height: 15rem;
|
|
82
|
+
overflow-y: auto;
|
|
83
|
+
margin-top: layout.$spacing-03;
|
|
84
|
+
padding-right: layout.$spacing-03;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.radioButtonGroup {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
gap: layout.$spacing-03;
|
|
91
|
+
width: 100%;
|
|
92
|
+
padding-left: layout.$spacing-05;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.compartmentOption {
|
|
96
|
+
display: flex;
|
|
97
|
+
justify-content: space-between;
|
|
98
|
+
align-items: center;
|
|
99
|
+
width: 140%;
|
|
100
|
+
padding: layout.$spacing-03 0;
|
|
101
|
+
border-bottom: 1px solid colors.$gray-20;
|
|
102
|
+
|
|
103
|
+
&:last-child {
|
|
104
|
+
border-bottom: none;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.radioButtonWrapper {
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
gap: layout.$spacing-03;
|
|
112
|
+
flex: 1;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.compartmentTags {
|
|
116
|
+
display: flex;
|
|
117
|
+
gap: layout.$spacing-03;
|
|
118
|
+
align-items: center;
|
|
119
|
+
margin-left: auto;
|
|
120
|
+
}
|
|
121
|
+
.radioButton {
|
|
122
|
+
margin: 0;
|
|
123
|
+
padding: 0;
|
|
124
|
+
}
|
|
125
|
+
.emptyStateTile {
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
align-items: center;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
padding: layout.$spacing-06;
|
|
131
|
+
text-align: center;
|
|
132
|
+
margin: layout.$spacing-05 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.emptyStateContent {
|
|
136
|
+
@include type.type-style('body-01');
|
|
137
|
+
color: colors.$gray-70;
|
|
138
|
+
margin-top: layout.$spacing-05;
|
|
139
|
+
max-width: 20rem;
|
|
140
|
+
}
|
|
141
|
+
.sectionField {
|
|
142
|
+
padding-top: layout.$spacing-03;
|
|
143
|
+
}
|