@bahmni/widgets 0.0.1-dev.190 → 0.0.1-dev.192
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/DocumentsTable-DBGR411T.js +204 -0
- package/dist/FormsTable-BP08e4n9.js +423 -0
- package/dist/Observations-SiLS1rRQ.js +172 -0
- package/dist/appContext/AppContextProvider.d.ts +7 -0
- package/dist/appContext/AppContextProvider.d.ts.map +1 -0
- package/dist/appContext/index.d.ts +2 -0
- package/dist/appContext/index.d.ts.map +1 -0
- package/dist/appointments/AppointmentsTable.d.ts.map +1 -1
- package/dist/diagnoses/DiagnosesTable.d.ts.map +1 -1
- package/dist/documents/DocumentsTable.d.ts.map +1 -1
- package/dist/documents/utils.d.ts.map +1 -1
- package/dist/forms/FormsTable.d.ts.map +1 -1
- package/dist/forms/ObservationItem.d.ts.map +1 -1
- package/dist/genericServiceRequest/GenericServiceRequestTable.d.ts.map +1 -1
- package/dist/{index-p-FSqamS.js → index-B0cIttpN.js} +19411 -20645
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -22
- package/dist/labinvestigation/utils.d.ts.map +1 -1
- package/dist/medications/MedicationsTable.d.ts.map +1 -1
- package/dist/observations/utils.d.ts +2 -2
- package/dist/observations/utils.d.ts.map +1 -1
- package/dist/patientDetails/PatientDetails.d.ts.map +1 -1
- package/dist/patientPrograms/PatientProgramsTable.d.ts.map +1 -1
- package/dist/programDetails/ProgramDetails.d.ts.map +1 -1
- package/dist/radiologyInvestigation/RadiologyInvestigationTable.d.ts.map +1 -1
- package/dist/radiologyInvestigationReport/RadiologyInvestigationReport.d.ts.map +1 -1
- package/dist/searchPatient/strategies/AppointmentSearchStrategy.d.ts.map +1 -1
- package/dist/searchPatient/strategies/AttributeSearchStrategy.d.ts.map +1 -1
- package/dist/searchPatient/strategies/NameOrIdSearchStrategy.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/DocumentsTable-DvVXzGC-.js +0 -5431
- package/dist/FormsTable-DQOHUr73.js +0 -426
- package/dist/Observations-CLvr4ZXL.js +0 -172
|
@@ -1,426 +0,0 @@
|
|
|
1
|
-
import { jsxs as b, jsx as n, Fragment as H } from "react/jsx-runtime";
|
|
2
|
-
import { c as M, Z as re, X as te, e as ae, d as oe, f as se, J as ne, u as de, N as ie, q as le, g as ce, x as me, h as ue, j as pe, M as be, R as fe, t as P, B as _e, k as he, b as $e, _ as ye, T as U, i as ge } from "./index-p-FSqamS.js";
|
|
3
|
-
import { useQueryClient as ve, useQuery as F } from "@tanstack/react-query";
|
|
4
|
-
import { useState as k, useMemo as g, useCallback as L } from "react";
|
|
5
|
-
import { useTranslation as Ne } from "react-i18next";
|
|
6
|
-
const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le = "_formContent_1pd36_18", Me = "_formDetailsContainer_1pd36_25", Re = "_observation_1pd36_30", Ce = "_groupContainer_1pd36_39", we = "_rowContainer_1pd36_43", De = "_groupLabel_1pd36_48", Te = "_rowLabel_1pd36_58", Ve = "_rowValue_1pd36_67", Be = "_groupMembers_1pd36_75", Ie = "_memberRow_1pd36_81", Ae = "_memberLabel_1pd36_86", Ee = "_memberValue_1pd36_94", Ge = "_abnormalValue_1pd36_102", Se = "_commentSection_1pd36_110", qe = "_commentText_1pd36_116", xe = "_nestedGroup_1pd36_125", Pe = "_nestedGroupLabel_1pd36_132", Ue = "_nestedGroupMembers_1pd36_141", o = {
|
|
7
|
-
formsTableBody: Oe,
|
|
8
|
-
customAccordianItem: Fe,
|
|
9
|
-
formContent: Le,
|
|
10
|
-
formDetailsContainer: Me,
|
|
11
|
-
observation: Re,
|
|
12
|
-
groupContainer: Ce,
|
|
13
|
-
rowContainer: we,
|
|
14
|
-
groupLabel: De,
|
|
15
|
-
rowLabel: Te,
|
|
16
|
-
rowValue: Ve,
|
|
17
|
-
groupMembers: Be,
|
|
18
|
-
memberRow: Ie,
|
|
19
|
-
memberLabel: Ae,
|
|
20
|
-
memberValue: Ee,
|
|
21
|
-
abnormalValue: Ge,
|
|
22
|
-
commentSection: Se,
|
|
23
|
-
commentText: qe,
|
|
24
|
-
nestedGroup: xe,
|
|
25
|
-
nestedGroupLabel: Pe,
|
|
26
|
-
nestedGroupMembers: Ue
|
|
27
|
-
}, j = (e) => {
|
|
28
|
-
const r = re(e);
|
|
29
|
-
return r === "Image" ? /* @__PURE__ */ n(
|
|
30
|
-
te,
|
|
31
|
-
{
|
|
32
|
-
imageSrc: e,
|
|
33
|
-
alt: e,
|
|
34
|
-
id: `${e}-img`
|
|
35
|
-
}
|
|
36
|
-
) : r === "Video" ? /* @__PURE__ */ n(ae, { id: `${e}-video`, videoSrc: e }) : r === "PDF" ? /* @__PURE__ */ n(oe, { id: `${e}-pdf`, src: e }) : e;
|
|
37
|
-
}, K = (e) => {
|
|
38
|
-
const r = e.observationValue?.unit, a = e.observationValue?.referenceRange?.low?.value, d = e.observationValue?.referenceRange?.high?.value, s = a != null, c = d != null, i = s && c ? ` (${a} - ${d})` : s ? ` (>${a})` : c ? ` (<${d})` : "", t = e.observationValue?.isAbnormal === !0;
|
|
39
|
-
return { units: r, rangeString: i, isAbnormal: t };
|
|
40
|
-
}, Q = ({
|
|
41
|
-
member: e,
|
|
42
|
-
depth: r = 0,
|
|
43
|
-
memberIndex: a = 0,
|
|
44
|
-
formName: d = "",
|
|
45
|
-
comment: s
|
|
46
|
-
}) => {
|
|
47
|
-
const c = e.members && e.members.length > 0, i = e.display, t = d ? `${d}-` : "";
|
|
48
|
-
if (c)
|
|
49
|
-
return /* @__PURE__ */ b(
|
|
50
|
-
"div",
|
|
51
|
-
{
|
|
52
|
-
className: o.nestedGroup,
|
|
53
|
-
"data-testid": `${t}obs-nested-group-${i}-${a}`,
|
|
54
|
-
children: [
|
|
55
|
-
/* @__PURE__ */ n(
|
|
56
|
-
"div",
|
|
57
|
-
{
|
|
58
|
-
className: o.nestedGroupLabel,
|
|
59
|
-
"data-testid": `${t}obs-nested-group-label-${i}-${a}`,
|
|
60
|
-
style: { paddingLeft: `${r * 16}px` },
|
|
61
|
-
children: i
|
|
62
|
-
}
|
|
63
|
-
),
|
|
64
|
-
/* @__PURE__ */ n(
|
|
65
|
-
"div",
|
|
66
|
-
{
|
|
67
|
-
className: o.nestedGroupMembers,
|
|
68
|
-
"data-testid": `${t}obs-nested-group-members-${i}-${a}`,
|
|
69
|
-
children: e.members?.map((v, N) => /* @__PURE__ */ n(
|
|
70
|
-
Q,
|
|
71
|
-
{
|
|
72
|
-
member: v,
|
|
73
|
-
depth: r + 1,
|
|
74
|
-
memberIndex: N,
|
|
75
|
-
formName: d
|
|
76
|
-
},
|
|
77
|
-
`${v.id}`
|
|
78
|
-
))
|
|
79
|
-
}
|
|
80
|
-
)
|
|
81
|
-
]
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
const { units: p, rangeString: y, isAbnormal: f } = K(e), _ = e.observationValue?.value?.toString(), h = _ ? j(_) : null;
|
|
85
|
-
return /* @__PURE__ */ b(H, { children: [
|
|
86
|
-
/* @__PURE__ */ b(
|
|
87
|
-
"div",
|
|
88
|
-
{
|
|
89
|
-
className: o.memberRow,
|
|
90
|
-
"data-testid": `${t}obs-member-row-${i}-${a}`,
|
|
91
|
-
style: { paddingLeft: `${r * 16}px` },
|
|
92
|
-
children: [
|
|
93
|
-
/* @__PURE__ */ b(
|
|
94
|
-
"p",
|
|
95
|
-
{
|
|
96
|
-
className: M(
|
|
97
|
-
o.memberLabel,
|
|
98
|
-
f ? o.abnormalValue : ""
|
|
99
|
-
),
|
|
100
|
-
"data-testid": `${t}obs-member-label-${i}-${a}`,
|
|
101
|
-
children: [
|
|
102
|
-
i,
|
|
103
|
-
y
|
|
104
|
-
]
|
|
105
|
-
}
|
|
106
|
-
),
|
|
107
|
-
/* @__PURE__ */ b(
|
|
108
|
-
"div",
|
|
109
|
-
{
|
|
110
|
-
className: M(
|
|
111
|
-
o.memberValue,
|
|
112
|
-
f ? o.abnormalValue : ""
|
|
113
|
-
),
|
|
114
|
-
"data-testid": `${t}obs-member-value-${i}-${a}`,
|
|
115
|
-
children: [
|
|
116
|
-
h,
|
|
117
|
-
p && ` ${p}`
|
|
118
|
-
]
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
),
|
|
124
|
-
s && /* @__PURE__ */ n(
|
|
125
|
-
"div",
|
|
126
|
-
{
|
|
127
|
-
className: o.commentSection,
|
|
128
|
-
"data-testid": `${t}obs-member-comment-${i}-${a}`,
|
|
129
|
-
style: { paddingLeft: `${r * 16}px` },
|
|
130
|
-
children: /* @__PURE__ */ b("span", { className: o.commentText, children: [
|
|
131
|
-
s,
|
|
132
|
-
e.encounter?.provider && ` - by ${e.encounter.provider}`
|
|
133
|
-
] })
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
] });
|
|
137
|
-
}, ke = ({
|
|
138
|
-
observation: e,
|
|
139
|
-
index: r,
|
|
140
|
-
formName: a = "",
|
|
141
|
-
comment: d
|
|
142
|
-
}) => {
|
|
143
|
-
const s = e.members && e.members.length > 0, { units: c, rangeString: i, isAbnormal: t } = K(e), p = a ? `${a}-` : "", y = e.observationValue?.value?.toString(), f = y ? j(y) : null;
|
|
144
|
-
return /* @__PURE__ */ b(
|
|
145
|
-
"div",
|
|
146
|
-
{
|
|
147
|
-
className: o.observation,
|
|
148
|
-
"data-testid": `${p}observation-item-${e.display}-${r}`,
|
|
149
|
-
children: [
|
|
150
|
-
/* @__PURE__ */ b(
|
|
151
|
-
"div",
|
|
152
|
-
{
|
|
153
|
-
className: s ? o.groupContainer : o.rowContainer,
|
|
154
|
-
"data-testid": `${p}observation-container-${e.display}-${r}`,
|
|
155
|
-
children: [
|
|
156
|
-
/* @__PURE__ */ b(
|
|
157
|
-
"p",
|
|
158
|
-
{
|
|
159
|
-
className: M(
|
|
160
|
-
s ? o.groupLabel : o.rowLabel,
|
|
161
|
-
!s && t ? o.abnormalValue : ""
|
|
162
|
-
),
|
|
163
|
-
"data-testid": `${p}observation-label-${e.display}-${r}`,
|
|
164
|
-
children: [
|
|
165
|
-
e.display,
|
|
166
|
-
!s && i && /* @__PURE__ */ n("span", { className: o.rangeInfo, children: i })
|
|
167
|
-
]
|
|
168
|
-
}
|
|
169
|
-
),
|
|
170
|
-
s ? /* @__PURE__ */ n(
|
|
171
|
-
"div",
|
|
172
|
-
{
|
|
173
|
-
className: o.groupMembers,
|
|
174
|
-
"data-testid": `${p}observation-group-members-${e.display}-${r}`,
|
|
175
|
-
children: e.members?.map((_, h) => /* @__PURE__ */ n(
|
|
176
|
-
Q,
|
|
177
|
-
{
|
|
178
|
-
member: _,
|
|
179
|
-
depth: 0,
|
|
180
|
-
memberIndex: h,
|
|
181
|
-
formName: a
|
|
182
|
-
},
|
|
183
|
-
`${_.id}`
|
|
184
|
-
))
|
|
185
|
-
}
|
|
186
|
-
) : /* @__PURE__ */ b(
|
|
187
|
-
"div",
|
|
188
|
-
{
|
|
189
|
-
className: M(
|
|
190
|
-
o.rowValue,
|
|
191
|
-
t ? o.abnormalValue : ""
|
|
192
|
-
),
|
|
193
|
-
"data-testid": `${p}observation-value-${e.display}-${r}`,
|
|
194
|
-
children: [
|
|
195
|
-
f,
|
|
196
|
-
c && ` ${c}`
|
|
197
|
-
]
|
|
198
|
-
}
|
|
199
|
-
)
|
|
200
|
-
]
|
|
201
|
-
}
|
|
202
|
-
),
|
|
203
|
-
d && /* @__PURE__ */ n(
|
|
204
|
-
"div",
|
|
205
|
-
{
|
|
206
|
-
className: o.commentSection,
|
|
207
|
-
"data-testid": `${p}observation-comment-${e.display}-${r}`,
|
|
208
|
-
children: /* @__PURE__ */ b("span", { className: o.commentText, children: [
|
|
209
|
-
d,
|
|
210
|
-
e.encounter?.provider && ` - by ${e.encounter.provider}`
|
|
211
|
-
] })
|
|
212
|
-
}
|
|
213
|
-
)
|
|
214
|
-
]
|
|
215
|
-
},
|
|
216
|
-
`${e.id}-${r}`
|
|
217
|
-
);
|
|
218
|
-
}, He = (e) => e ? e.extension?.find(
|
|
219
|
-
(a) => a.url === ne
|
|
220
|
-
)?.valueString : void 0, je = (e) => {
|
|
221
|
-
if (e)
|
|
222
|
-
return e.note?.[0]?.text;
|
|
223
|
-
}, Ke = (e, r) => e.entry?.find((a) => a.resource?.id === r)?.resource, D = (e, r) => {
|
|
224
|
-
const a = Ke(e, r);
|
|
225
|
-
return a ? {
|
|
226
|
-
formFieldPath: He(a),
|
|
227
|
-
comment: je(a)
|
|
228
|
-
} : {};
|
|
229
|
-
}, Qe = (e, r) => {
|
|
230
|
-
if (!e?.entry || !r)
|
|
231
|
-
return [];
|
|
232
|
-
const a = se(e);
|
|
233
|
-
return [
|
|
234
|
-
...a.observations.map((s) => {
|
|
235
|
-
const { formFieldPath: c, comment: i } = D(
|
|
236
|
-
e,
|
|
237
|
-
s.id
|
|
238
|
-
);
|
|
239
|
-
return { obs: s, formFieldPath: c, comment: i };
|
|
240
|
-
}),
|
|
241
|
-
...a.groupedObservations.flatMap((s) => {
|
|
242
|
-
const { formFieldPath: c } = D(e, s.id);
|
|
243
|
-
return (s.members ?? []).map((i) => {
|
|
244
|
-
const { comment: t } = D(e, i.id);
|
|
245
|
-
return { obs: i, formFieldPath: c, comment: t };
|
|
246
|
-
});
|
|
247
|
-
})
|
|
248
|
-
].filter(
|
|
249
|
-
({ formFieldPath: s }) => !s || s.includes(r)
|
|
250
|
-
);
|
|
251
|
-
}, Ye = ({
|
|
252
|
-
episodeOfCareUuids: e,
|
|
253
|
-
encounterUuids: r,
|
|
254
|
-
config: a
|
|
255
|
-
}) => {
|
|
256
|
-
const { t: d } = Ne(), s = de(), [c, i] = k(!1), [t, p] = k(null), y = a?.numberOfVisits, f = ie(
|
|
257
|
-
e,
|
|
258
|
-
r
|
|
259
|
-
), _ = ve(), {
|
|
260
|
-
data: h = [],
|
|
261
|
-
isLoading: v,
|
|
262
|
-
isError: N,
|
|
263
|
-
error: X,
|
|
264
|
-
refetch: z
|
|
265
|
-
} = F({
|
|
266
|
-
queryKey: ["forms", s, e],
|
|
267
|
-
queryFn: () => le(s, void 0, y),
|
|
268
|
-
enabled: !!s && !f
|
|
269
|
-
}), T = g(() => !r || r.length === 0 ? h : h.filter(
|
|
270
|
-
(l) => r.includes(l.encounterUuid)
|
|
271
|
-
), [h, r]), { data: V = [] } = F({
|
|
272
|
-
queryKey: ["observationForms"],
|
|
273
|
-
queryFn: () => ce()
|
|
274
|
-
}), B = L(
|
|
275
|
-
(l) => V.find((m) => m.name === l)?.uuid,
|
|
276
|
-
[V]
|
|
277
|
-
), R = g(() => {
|
|
278
|
-
if (t)
|
|
279
|
-
return B(t.formName);
|
|
280
|
-
}, [t, B]), { isLoading: J, error: I } = F({
|
|
281
|
-
queryKey: ["formMetadata", R],
|
|
282
|
-
queryFn: () => me(R),
|
|
283
|
-
enabled: !!R && c
|
|
284
|
-
}), {
|
|
285
|
-
data: C,
|
|
286
|
-
isLoading: Z,
|
|
287
|
-
error: A
|
|
288
|
-
} = F({
|
|
289
|
-
queryKey: ["formsEncounterFHIR", t?.encounterUuid],
|
|
290
|
-
queryFn: () => ue(t.encounterUuid),
|
|
291
|
-
enabled: !!t?.encounterUuid && c
|
|
292
|
-
});
|
|
293
|
-
pe(
|
|
294
|
-
(l) => {
|
|
295
|
-
l.patientUUID === s && l.updatedConcepts.size > 0 && (z(), _.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
|
|
296
|
-
},
|
|
297
|
-
[s]
|
|
298
|
-
);
|
|
299
|
-
const E = g(() => !C || !t?.formName ? [] : Qe(
|
|
300
|
-
C,
|
|
301
|
-
t.formName
|
|
302
|
-
), [C, t?.formName]), G = g(
|
|
303
|
-
() => [
|
|
304
|
-
{ key: "recordedOn", header: d("FORM_RECORDED_ON") },
|
|
305
|
-
{ key: "recordedBy", header: d("FORM_RECORDED_BY") }
|
|
306
|
-
],
|
|
307
|
-
[d]
|
|
308
|
-
), W = g(
|
|
309
|
-
() => [
|
|
310
|
-
{ key: "recordedOn", sortable: !0 },
|
|
311
|
-
{ key: "recordedBy", sortable: !0 }
|
|
312
|
-
],
|
|
313
|
-
[]
|
|
314
|
-
), S = g(() => {
|
|
315
|
-
const l = T.reduce(
|
|
316
|
-
(m, u) => {
|
|
317
|
-
const O = u.formName;
|
|
318
|
-
m[O] ??= [];
|
|
319
|
-
const w = u.providers.map((ee) => ee.providerName).filter(Boolean).join(", ");
|
|
320
|
-
return m[O].push({
|
|
321
|
-
id: u.encounterUuid,
|
|
322
|
-
formName: u.formName,
|
|
323
|
-
recordedOn: be(u.encounterDateTime, d, ge).formattedResult,
|
|
324
|
-
recordedBy: w ?? "--",
|
|
325
|
-
encounterDateTime: u.encounterDateTime,
|
|
326
|
-
encounterUuid: u.encounterUuid
|
|
327
|
-
}), m;
|
|
328
|
-
},
|
|
329
|
-
{}
|
|
330
|
-
);
|
|
331
|
-
return Object.entries(l).map(
|
|
332
|
-
([m, u]) => ({
|
|
333
|
-
formName: m,
|
|
334
|
-
records: u.sort(
|
|
335
|
-
(O, w) => w.encounterDateTime - O.encounterDateTime
|
|
336
|
-
)
|
|
337
|
-
})
|
|
338
|
-
).sort((m, u) => m.formName.localeCompare(u.formName));
|
|
339
|
-
}, [T, d]), q = L((l) => {
|
|
340
|
-
p(l), i(!0);
|
|
341
|
-
}, []), Y = L(() => {
|
|
342
|
-
i(!1), p(null);
|
|
343
|
-
}, []), x = L(
|
|
344
|
-
(l, $) => {
|
|
345
|
-
switch ($) {
|
|
346
|
-
case "recordedOn":
|
|
347
|
-
return /* @__PURE__ */ n(fe, { onClick: () => q(l), children: l.recordedOn });
|
|
348
|
-
case "recordedBy":
|
|
349
|
-
return l.recordedBy;
|
|
350
|
-
default:
|
|
351
|
-
return null;
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
[q]
|
|
355
|
-
);
|
|
356
|
-
return /* @__PURE__ */ b(H, { children: [
|
|
357
|
-
/* @__PURE__ */ n("div", { "data-testid": "forms-table", children: v || N || S.length === 0 || f ? /* @__PURE__ */ n(
|
|
358
|
-
P,
|
|
359
|
-
{
|
|
360
|
-
headers: G,
|
|
361
|
-
ariaLabel: d("FORMS_HEADING"),
|
|
362
|
-
rows: [],
|
|
363
|
-
loading: v,
|
|
364
|
-
errorStateMessage: N ? X?.message : void 0,
|
|
365
|
-
emptyStateMessage: d("FORMS_UNAVAILABLE"),
|
|
366
|
-
renderCell: x,
|
|
367
|
-
className: o.formsTableBody,
|
|
368
|
-
dataTestId: "forms-table"
|
|
369
|
-
}
|
|
370
|
-
) : /* @__PURE__ */ n(_e, { align: "start", children: S.map((l, $) => {
|
|
371
|
-
const { formName: m, records: u } = l;
|
|
372
|
-
return /* @__PURE__ */ n(
|
|
373
|
-
he,
|
|
374
|
-
{
|
|
375
|
-
title: m,
|
|
376
|
-
className: o.customAccordianItem,
|
|
377
|
-
testId: `accordian-title-${m}`,
|
|
378
|
-
open: $ === 0,
|
|
379
|
-
children: /* @__PURE__ */ n(
|
|
380
|
-
P,
|
|
381
|
-
{
|
|
382
|
-
headers: G,
|
|
383
|
-
ariaLabel: d("FORMS_HEADING"),
|
|
384
|
-
rows: u,
|
|
385
|
-
loading: !1,
|
|
386
|
-
errorStateMessage: "",
|
|
387
|
-
sortable: W,
|
|
388
|
-
emptyStateMessage: d("FORMS_UNAVAILABLE"),
|
|
389
|
-
renderCell: x,
|
|
390
|
-
className: o.formsTableBody,
|
|
391
|
-
dataTestId: `forms-table-${m}`
|
|
392
|
-
}
|
|
393
|
-
)
|
|
394
|
-
},
|
|
395
|
-
m
|
|
396
|
-
);
|
|
397
|
-
}) }) }),
|
|
398
|
-
c && t && /* @__PURE__ */ n(
|
|
399
|
-
$e,
|
|
400
|
-
{
|
|
401
|
-
id: "modalIdForActionAreaLayout",
|
|
402
|
-
portalId: "main-display-area",
|
|
403
|
-
open: c,
|
|
404
|
-
onRequestClose: Y,
|
|
405
|
-
modalHeading: t.formName,
|
|
406
|
-
modalLabel: `${t.recordedOn} | ${t.recordedBy}`,
|
|
407
|
-
passiveModal: !0,
|
|
408
|
-
size: "md",
|
|
409
|
-
testId: "form-details-modal",
|
|
410
|
-
children: /* @__PURE__ */ n("div", { className: o.formContent, children: J || Z ? /* @__PURE__ */ n(ye, { width: "100%", lineCount: 3 }) : I ? /* @__PURE__ */ n("div", { children: U(I).message ?? d("ERROR_FETCHING_FORM_METADATA") }) : A ? /* @__PURE__ */ n("div", { children: U(A).message ?? d("ERROR_FETCHING_FORM_DATA") }) : E.length > 0 ? /* @__PURE__ */ n("div", { className: o.formDetailsContainer, children: E.map(({ obs: l, comment: $ }, m) => /* @__PURE__ */ n(
|
|
411
|
-
ke,
|
|
412
|
-
{
|
|
413
|
-
observation: l,
|
|
414
|
-
index: m,
|
|
415
|
-
formName: t.formName,
|
|
416
|
-
comment: $
|
|
417
|
-
},
|
|
418
|
-
`${l.id}`
|
|
419
|
-
)) }) : /* @__PURE__ */ n("div", { children: d("NO_FORM_DATA_AVAILABLE") }) })
|
|
420
|
-
}
|
|
421
|
-
)
|
|
422
|
-
] });
|
|
423
|
-
};
|
|
424
|
-
export {
|
|
425
|
-
Ye as default
|
|
426
|
-
};
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { jsx as l, jsxs as S } from "react/jsx-runtime";
|
|
2
|
-
import { l as M, m as C, n as Q, Z as V, G as k, X as q, e as G, d as K, u as j, a as P, o as H, p as X, j as Z, f as z, r as J, s as Y, v as W, t as x } from "./index-p-FSqamS.js";
|
|
3
|
-
import { useQueries as ee, useQuery as te } from "@tanstack/react-query";
|
|
4
|
-
import { useRef as se, useEffect as $, useMemo as E } from "react";
|
|
5
|
-
import { useTranslation as D } from "react-i18next";
|
|
6
|
-
const U = (t, c, i, d, a) => {
|
|
7
|
-
const s = Q(t, c), o = s.value, r = V(o);
|
|
8
|
-
let n = o;
|
|
9
|
-
r === "Image" && (n = /* @__PURE__ */ l(q, { imageSrc: o, alt: o, id: `${o}-img` })), r === "Video" && (n = /* @__PURE__ */ l(G, { id: `${o}-video`, videoSrc: o })), r === "PDF" && (n = /* @__PURE__ */ l(K, { id: `${o}-pdf`, src: o }));
|
|
10
|
-
const u = a("OBSERVATIONS_RECORDED_BY", {
|
|
11
|
-
provider: s.provider
|
|
12
|
-
}), b = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", f = d ? `${d}-${p}-${b}-${i}-${c}` : `${p}-${b}-${i}-${c}`;
|
|
13
|
-
return /* @__PURE__ */ l(
|
|
14
|
-
k,
|
|
15
|
-
{
|
|
16
|
-
header: s.header,
|
|
17
|
-
value: n,
|
|
18
|
-
info: u,
|
|
19
|
-
id: f,
|
|
20
|
-
testId: f,
|
|
21
|
-
ariaLabel: f
|
|
22
|
-
},
|
|
23
|
-
`obs-${t.id}`
|
|
24
|
-
);
|
|
25
|
-
}, oe = (t, c, i, d, a, s) => /* @__PURE__ */ l(
|
|
26
|
-
C,
|
|
27
|
-
{
|
|
28
|
-
title: t.display,
|
|
29
|
-
id: `grouped-obs-${t.display}-${d}`,
|
|
30
|
-
open: i,
|
|
31
|
-
children: t.members?.map(
|
|
32
|
-
(o, r) => U(o, r, a, s, c)
|
|
33
|
-
)
|
|
34
|
-
},
|
|
35
|
-
`grouped-obs-${t.id}`
|
|
36
|
-
), re = ({
|
|
37
|
-
groupedData: t,
|
|
38
|
-
title: c = ""
|
|
39
|
-
}) => {
|
|
40
|
-
const { t: i } = D(), d = (a, s, o) => {
|
|
41
|
-
const r = M(a.encounterDetails, i);
|
|
42
|
-
return /* @__PURE__ */ S(
|
|
43
|
-
C,
|
|
44
|
-
{
|
|
45
|
-
title: r,
|
|
46
|
-
id: `encounter-${a.encounterId}`,
|
|
47
|
-
open: s,
|
|
48
|
-
children: [
|
|
49
|
-
a.observations.map(
|
|
50
|
-
(n, u) => U(n, u, o, c, i)
|
|
51
|
-
),
|
|
52
|
-
a.groupedObservations.map(
|
|
53
|
-
(n, u) => oe(
|
|
54
|
-
n,
|
|
55
|
-
i,
|
|
56
|
-
s,
|
|
57
|
-
u,
|
|
58
|
-
o,
|
|
59
|
-
c
|
|
60
|
-
)
|
|
61
|
-
)
|
|
62
|
-
]
|
|
63
|
-
},
|
|
64
|
-
`encounter-${a.encounterId}`
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
return /* @__PURE__ */ l(
|
|
68
|
-
"div",
|
|
69
|
-
{
|
|
70
|
-
id: "obs-by-encounter",
|
|
71
|
-
"data-testid": "obs-by-encounter-test-id",
|
|
72
|
-
"aria-label": "obs-by-encounter-aria-label",
|
|
73
|
-
children: t.map(
|
|
74
|
-
(a, s) => d(a, s === 0, s)
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
}, ae = "_observations_kfbhq_1", ne = "_title_kfbhq_12", N = {
|
|
79
|
-
observations: ae,
|
|
80
|
-
title: ne
|
|
81
|
-
}, ie = (t) => ["conceptUuid", t], ce = (t, c) => ["observations", t, ...c], me = ({ config: t }) => {
|
|
82
|
-
const c = t, { conceptNames: i = [], conceptUuid: d = [] } = c, a = se(/* @__PURE__ */ new Set()), s = j(), { addNotification: o } = P(), { t: r } = D(), n = ee({
|
|
83
|
-
queries: i.map((e) => ({
|
|
84
|
-
queryKey: ie(e),
|
|
85
|
-
queryFn: () => H(e),
|
|
86
|
-
enabled: !!e
|
|
87
|
-
}))
|
|
88
|
-
});
|
|
89
|
-
$(() => {
|
|
90
|
-
n.forEach((e, m) => {
|
|
91
|
-
if (e.isError && !a.current.has(m)) {
|
|
92
|
-
const g = i[m];
|
|
93
|
-
o({
|
|
94
|
-
title: r("ERROR_DEFAULT_TITLE"),
|
|
95
|
-
message: r("ERROR_FETCHING_CONCEPT", { conceptName: g }),
|
|
96
|
-
type: "error"
|
|
97
|
-
}), a.current.add(m);
|
|
98
|
-
} else e.isError || a.current.delete(m);
|
|
99
|
-
});
|
|
100
|
-
}, [n, i]);
|
|
101
|
-
const u = E(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), b = E(() => [.../* @__PURE__ */ new Set([...u, ...d])], [u, d]), v = E(() => i.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, i.length]), {
|
|
102
|
-
data: p,
|
|
103
|
-
isLoading: f,
|
|
104
|
-
isError: O,
|
|
105
|
-
refetch: T
|
|
106
|
-
} = te({
|
|
107
|
-
queryKey: ce(s, b),
|
|
108
|
-
queryFn: () => X(s, b),
|
|
109
|
-
enabled: !!s && b.length > 0 && v
|
|
110
|
-
});
|
|
111
|
-
Z(
|
|
112
|
-
(e) => {
|
|
113
|
-
e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
|
|
114
|
-
(g) => b.includes(g)
|
|
115
|
-
) && T();
|
|
116
|
-
},
|
|
117
|
-
[s, T]
|
|
118
|
-
), $(() => {
|
|
119
|
-
O && o({
|
|
120
|
-
title: r("ERROR_DEFAULT_TITLE"),
|
|
121
|
-
message: r("ERROR_FETCHING_OBSERVATIONS"),
|
|
122
|
-
type: "error"
|
|
123
|
-
});
|
|
124
|
-
}, [O]);
|
|
125
|
-
const R = E(() => {
|
|
126
|
-
if (!p) return [];
|
|
127
|
-
const e = z(p), m = J(e);
|
|
128
|
-
return Y(m);
|
|
129
|
-
}, [p]), B = [
|
|
130
|
-
{ key: "name", header: "name" },
|
|
131
|
-
{ key: "value", header: "value" },
|
|
132
|
-
{ key: "form", header: "form" }
|
|
133
|
-
], I = f || !v, _ = O && v, A = (!p || p.entry?.length === 0 || b.length === 0) && v, F = _ ? r("ERROR_FETCHING_OBSERVATIONS") : null, L = A ? r("NO_OBSERVATIONS_FOUND") : void 0, w = R.length > 0 && !I && !_, y = c.titleTranslationKey, h = y ? r(y) : "";
|
|
134
|
-
return /* @__PURE__ */ S(
|
|
135
|
-
"div",
|
|
136
|
-
{
|
|
137
|
-
id: "observations",
|
|
138
|
-
"data-testid": y ? `observations-${h}` : "observations",
|
|
139
|
-
"aria-label": "observations-aria-label",
|
|
140
|
-
className: N.observations,
|
|
141
|
-
children: [
|
|
142
|
-
/* @__PURE__ */ l(
|
|
143
|
-
W,
|
|
144
|
-
{
|
|
145
|
-
id: "observations-title",
|
|
146
|
-
testId: y ? `observations-title-${h}` : "observations-title",
|
|
147
|
-
title: h,
|
|
148
|
-
className: N.title,
|
|
149
|
-
children: /* @__PURE__ */ l("p", { children: h })
|
|
150
|
-
}
|
|
151
|
-
),
|
|
152
|
-
w ? /* @__PURE__ */ l(re, { groupedData: R, title: h }) : /* @__PURE__ */ l(
|
|
153
|
-
x,
|
|
154
|
-
{
|
|
155
|
-
headers: B,
|
|
156
|
-
rows: [],
|
|
157
|
-
ariaLabel: r("OBSERVATIONS"),
|
|
158
|
-
loading: I,
|
|
159
|
-
errorStateMessage: F,
|
|
160
|
-
emptyStateMessage: L,
|
|
161
|
-
dataTestId: "observations-table"
|
|
162
|
-
}
|
|
163
|
-
)
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
);
|
|
167
|
-
};
|
|
168
|
-
export {
|
|
169
|
-
ie as conceptUuidQueryKeys,
|
|
170
|
-
me as default,
|
|
171
|
-
ce as observationsQueryKeys
|
|
172
|
-
};
|