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