@kenyaemr/esm-morgue-app 5.4.2-pre.2279 → 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.
Files changed (193) hide show
  1. package/.turbo/turbo-build.log +19 -19
  2. package/dist/109.js +2 -0
  3. package/dist/109.js.map +1 -0
  4. package/dist/201.js +1 -0
  5. package/dist/201.js.map +1 -0
  6. package/dist/293.js +1 -0
  7. package/dist/293.js.map +1 -0
  8. package/dist/300.js +1 -1
  9. package/dist/347.js +1 -2
  10. package/dist/347.js.map +1 -1
  11. package/dist/373.js +2 -0
  12. package/dist/373.js.map +1 -0
  13. package/dist/38.js +1 -0
  14. package/dist/38.js.map +1 -0
  15. package/dist/389.js +1 -0
  16. package/dist/389.js.map +1 -0
  17. package/dist/398.js +1 -0
  18. package/dist/398.js.map +1 -0
  19. package/dist/4.js +2 -0
  20. package/dist/4.js.map +1 -0
  21. package/dist/410.js +1 -0
  22. package/dist/410.js.map +1 -0
  23. package/dist/420.js +2 -0
  24. package/dist/420.js.map +1 -0
  25. package/dist/467.js +1 -0
  26. package/dist/467.js.map +1 -0
  27. package/dist/632.js +1 -0
  28. package/dist/632.js.map +1 -0
  29. package/dist/798.js +1 -0
  30. package/dist/798.js.map +1 -0
  31. package/dist/811.js +1 -0
  32. package/dist/811.js.map +1 -0
  33. package/dist/824.js +1 -0
  34. package/dist/824.js.map +1 -0
  35. package/dist/827.js +1 -0
  36. package/dist/827.js.map +1 -0
  37. package/dist/842.js +2 -0
  38. package/dist/842.js.LICENSE.txt +5 -0
  39. package/dist/842.js.map +1 -0
  40. package/dist/918.js +1 -1
  41. package/dist/918.js.map +1 -1
  42. package/dist/kenyaemr-esm-morgue-app.js +1 -1
  43. package/dist/kenyaemr-esm-morgue-app.js.buildmanifest.json +218 -291
  44. package/dist/kenyaemr-esm-morgue-app.js.map +1 -1
  45. package/dist/main.js +2 -1
  46. package/dist/main.js.LICENSE.txt +15 -0
  47. package/dist/main.js.map +1 -1
  48. package/dist/routes.json +1 -1
  49. package/package.json +1 -1
  50. package/src/bed/bed.component.tsx +164 -0
  51. package/src/bed/bed.scss +192 -0
  52. package/src/bed/divider/divider.component.tsx +18 -0
  53. package/src/bed/empty-bed.component.tsx +47 -0
  54. package/src/bed-layout/admitted/admitted-bed-layout.component.tsx +189 -0
  55. package/src/bed-layout/awaiting/awaiting-bed-layout.component.tsx +86 -0
  56. package/src/bed-layout/bed-layout.resource.ts +72 -0
  57. package/src/bed-layout/bed-layout.scss +55 -0
  58. package/src/bed-layout/discharged/discharged-bed-layout.component.tsx +109 -0
  59. package/src/bed-layout/discharged/discharged-bed-layout.resource.ts +99 -0
  60. package/src/bed-linelist-view/admitted/admitted-bed-linelist-view.component.tsx +420 -0
  61. package/src/bed-linelist-view/awaiting/awaiting-bed-linelist-view.component.tsx +224 -0
  62. package/src/bed-linelist-view/bed-linelist-view.scss +5 -0
  63. package/src/bed-linelist-view/discharged/discharged-bed-line-view.component.tsx +256 -0
  64. package/src/config-schema.ts +41 -9
  65. package/src/constants.ts +57 -0
  66. package/src/deceased-patient-header/deceased-patient-header.component.tsx +31 -0
  67. package/src/deceased-patient-header/deceased-patient-header.scss +50 -0
  68. package/src/{component → deceased-patient-header}/deceasedInfo/deceased-info.component.tsx +1 -1
  69. package/src/deceased-patient-header/deceasedInfo/deceased-info.resource.ts +11 -0
  70. package/src/extension/actionButton.component.tsx +5 -59
  71. package/src/extension/deceasedInfoBanner.component.tsx +5 -9
  72. package/src/{hook/useAdmitPatient.ts → forms/admit-deceased-person-workspace/admit-deceased-person.resource.ts} +177 -46
  73. package/src/forms/admit-deceased-person-workspace/admit-deceased-person.scss +143 -0
  74. package/src/forms/admit-deceased-person-workspace/admit-deceased-person.workspace.tsx +648 -0
  75. package/src/{hook/usePersonAttributes.ts → forms/discharge-deceased-person-workspace/discharge-body.resource.ts} +1 -1
  76. package/src/forms/discharge-deceased-person-workspace/discharge-body.scss +56 -0
  77. package/src/forms/discharge-deceased-person-workspace/discharge-body.workspace.tsx +362 -0
  78. package/src/forms/dispose-deceased-person-workspace/dispose-deceased-person.resource.ts +18 -0
  79. package/src/{workspaces/patientAdditionalInfoForm.scss → forms/dispose-deceased-person-workspace/dispose-deceased-person.scss} +46 -66
  80. package/src/forms/dispose-deceased-person-workspace/dispose-deceased-person.workspace.tsx +401 -0
  81. package/src/forms/form-entry-workspace/form-entry-workspace.workspace.tsx +62 -0
  82. package/src/forms/swap-compartment-workspace/swap-unit.scss +144 -0
  83. package/src/forms/swap-compartment-workspace/swap-unit.workspace.tsx +280 -0
  84. package/src/header/header.component.tsx +41 -0
  85. package/src/header/header.scss +58 -0
  86. package/src/home/home.component.tsx +87 -0
  87. package/src/home/home.resource.ts +261 -0
  88. package/src/home/home.scss +5 -0
  89. package/src/index.ts +18 -12
  90. package/src/metrics/metrics-card.component.tsx +31 -0
  91. package/src/metrics/metrics-card.scss +51 -0
  92. package/src/root.component.tsx +7 -3
  93. package/src/routes.json +25 -1
  94. package/src/schemas/index.ts +66 -0
  95. package/src/summary/summary.component.tsx +42 -0
  96. package/src/summary/summary.scss +10 -0
  97. package/src/switcher/content-switcher.component.tsx +220 -0
  98. package/src/switcher/content-switcher.scss +30 -0
  99. package/src/types/index.ts +336 -359
  100. package/src/utils/utils.ts +20 -2
  101. package/src/view-details/main/main.component.tsx +34 -0
  102. package/src/view-details/main/main.scss +45 -0
  103. package/src/view-details/panels/attachement.component.tsx +21 -0
  104. package/src/view-details/panels/autopsy.component.tsx +215 -0
  105. package/src/view-details/panels/billing-history.component.tsx +13 -0
  106. package/src/view-details/panels/observations/observation.component.tsx +57 -0
  107. package/src/view-details/panels/observations/observation.scss +24 -0
  108. package/src/view-details/panels/panels.scss +46 -0
  109. package/src/view-details/view-details.component.tsx +65 -0
  110. package/src/view-details/view-details.resource.ts +65 -0
  111. package/src/view-details/views-details.scss +82 -0
  112. package/translations/en.json +67 -25
  113. package/tsconfig.json +1 -1
  114. package/dist/113.js +0 -1
  115. package/dist/113.js.map +0 -1
  116. package/dist/160.js +0 -1
  117. package/dist/160.js.map +0 -1
  118. package/dist/299.js +0 -1
  119. package/dist/299.js.map +0 -1
  120. package/dist/433.js +0 -2
  121. package/dist/433.js.map +0 -1
  122. package/dist/441.js +0 -1
  123. package/dist/441.js.map +0 -1
  124. package/dist/496.js +0 -1
  125. package/dist/496.js.map +0 -1
  126. package/dist/511.js +0 -1
  127. package/dist/511.js.map +0 -1
  128. package/dist/603.js +0 -1
  129. package/dist/603.js.map +0 -1
  130. package/dist/610.js +0 -1
  131. package/dist/610.js.map +0 -1
  132. package/dist/612.js +0 -1
  133. package/dist/612.js.map +0 -1
  134. package/dist/656.js +0 -2
  135. package/dist/656.js.map +0 -1
  136. package/dist/752.js +0 -1
  137. package/dist/752.js.map +0 -1
  138. package/dist/754.js +0 -1
  139. package/dist/754.js.map +0 -1
  140. package/dist/781.js +0 -1
  141. package/dist/781.js.map +0 -1
  142. package/dist/801.js +0 -2
  143. package/dist/801.js.map +0 -1
  144. package/dist/817.js +0 -1
  145. package/dist/817.js.map +0 -1
  146. package/dist/877.js +0 -1
  147. package/dist/877.js.map +0 -1
  148. package/dist/924.js +0 -1
  149. package/dist/924.js.map +0 -1
  150. package/src/autosuggest/autosuggest.component.tsx +0 -162
  151. package/src/autosuggest/autosuggest.scss +0 -61
  152. package/src/autosuggest/patient-search-info.component.tsx +0 -75
  153. package/src/autosuggest/patient-search-info.scss +0 -62
  154. package/src/autosuggest/search-empty-state.component.tsx +0 -21
  155. package/src/autosuggest/search-empty-state.scss +0 -18
  156. package/src/card/avail-compartment.compartment.tsx +0 -94
  157. package/src/card/compartment-view.compartment.tsx +0 -62
  158. package/src/card/compartment.scss +0 -128
  159. package/src/card/compartmentSharing.component.tsx +0 -21
  160. package/src/card/compartmentSharing.scss +0 -24
  161. package/src/card/empty-compartment.component.tsx +0 -28
  162. package/src/card/empty-compartment.scss +0 -61
  163. package/src/component/main.component.tsx +0 -17
  164. package/src/component/next-of-kin-details/nextOfKinDetails.component.tsx +0 -50
  165. package/src/component/next-of-kin-details/nextOfKinDetails.scss +0 -37
  166. package/src/header/admitted-queue-header.component.tsx +0 -30
  167. package/src/header/admitted-queue-header.scss +0 -32
  168. package/src/header/morgue-header.component.tsx +0 -38
  169. package/src/header/morgue-header.scss +0 -95
  170. package/src/header/morgue-illustration.component.tsx +0 -13
  171. package/src/hook/useDeceasedPatients.ts +0 -12
  172. package/src/hook/useDischargedPatient.ts +0 -55
  173. package/src/hook/useMorgue.resource.ts +0 -163
  174. package/src/hook/useMortuaryAdmissionLocation.ts +0 -64
  175. package/src/tables/admitted-queue.component.tsx +0 -54
  176. package/src/tables/admitted-queue.scss +0 -62
  177. package/src/tables/discharge-queue.component.tsx +0 -87
  178. package/src/tables/generic-table.component.tsx +0 -140
  179. package/src/tables/generic-table.scss +0 -37
  180. package/src/tabs/tabs.component.tsx +0 -82
  181. package/src/tabs/tabs.scss +0 -15
  182. package/src/workspaces/admit-body.scss +0 -46
  183. package/src/workspaces/admit-body.workspace.tsx +0 -79
  184. package/src/workspaces/discharge-body.scss +0 -67
  185. package/src/workspaces/discharge-body.workspace.tsx +0 -329
  186. package/src/workspaces/patientAdditionalInfoForm.workspace.tsx +0 -562
  187. package/src/workspaces/swap-unit.scss +0 -46
  188. package/src/workspaces/swap-unit.workspace.tsx +0 -168
  189. /package/dist/{347.js.LICENSE.txt → 109.js.LICENSE.txt} +0 -0
  190. /package/dist/{656.js.LICENSE.txt → 373.js.LICENSE.txt} +0 -0
  191. /package/dist/{801.js.LICENSE.txt → 4.js.LICENSE.txt} +0 -0
  192. /package/dist/{433.js.LICENSE.txt → 420.js.LICENSE.txt} +0 -0
  193. /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
- showSnackbar,
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
- VisitQueueEntry,
25
- } from '../types';
26
- import { dischargeSchema, patientInfoSchema } from '../utils/utils';
27
- import { useMortuaryLocation } from './useMortuaryAdmissionLocation';
28
- import { removeQueuedPatient } from './useMorgue.resource';
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 const useMortuaryOperation = () => {
50
- const { location } = useMortuaryLocation();
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 patientInfoSchema>,
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?.uuid,
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: emrConfiguration?.admissionEncounterType?.uuid,
111
- location: location?.uuid,
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: obs.length > 0 ? obs : undefined,
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?.uuid,
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 patientInfoSchema>) => {
159
- const admissionEncounter = await createMortuaryAdmissionEncounter(patientUuid, data);
160
- const compartment = await assignDeceasedToCompartment(
161
- patientUuid,
162
- data.availableCompartment,
163
- admissionEncounter.data.uuid,
164
- );
165
- return { admissionEncounter, compartment };
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: emrConfiguration?.exitFromInpatientEncounterType,
181
- location: visit?.location?.uuid,
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: location?.uuid,
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?.uuid,
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
+ }