@claudebernard/patient-profile-element 0.2.0 → 0.3.0
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/custom-elements.json +1763 -216
- package/dist/patient-profile.d.ts +9 -0
- package/dist/patient-profile.es.js +1384 -67
- package/package.json +7 -5
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SearchRequestBody } from "@claudebernard/types";
|
|
1
2
|
import "@claudebernard/design-system";
|
|
2
3
|
const PREFIX = "claudebernard";
|
|
3
4
|
const isStrTagged = (val) => typeof val !== "string" && "strTag" in val;
|
|
@@ -50,11 +51,9 @@ const acceptedLoincCodesForRenalClearance = [
|
|
|
50
51
|
"50381-3",
|
|
51
52
|
"104805-7"
|
|
52
53
|
];
|
|
53
|
-
const acceptedLoincCodesForRenalGFR = [
|
|
54
|
-
"69405-9",
|
|
55
|
-
"70969-1"
|
|
56
|
-
];
|
|
57
54
|
const acceptedLoincCodesForRenalGFRPerBSA = [
|
|
55
|
+
"69405-9",
|
|
56
|
+
"70969-1",
|
|
58
57
|
"48642-3",
|
|
59
58
|
"48643-1",
|
|
60
59
|
"50044-7",
|
|
@@ -72,6 +71,16 @@ const acceptedLoincCodesForRenalGFRPerBSA = [
|
|
|
72
71
|
"98980-6",
|
|
73
72
|
"102097-3"
|
|
74
73
|
];
|
|
74
|
+
const snomedToChildPughStadeMap = {
|
|
75
|
+
"710065009": "Stade A",
|
|
76
|
+
"710066005": "Stade B",
|
|
77
|
+
"710067001": "Stade C"
|
|
78
|
+
};
|
|
79
|
+
const childPughStadeToSnomedMap = {
|
|
80
|
+
"A": "710065009",
|
|
81
|
+
"B": "710066005",
|
|
82
|
+
"C": "710067001"
|
|
83
|
+
};
|
|
75
84
|
function calculateBMI(weight, height) {
|
|
76
85
|
if (height === 0 || weight === 0) {
|
|
77
86
|
return 0;
|
|
@@ -86,7 +95,16 @@ function getPatientGender(bundle) {
|
|
|
86
95
|
if (!patient?.gender) {
|
|
87
96
|
return void 0;
|
|
88
97
|
}
|
|
89
|
-
return patient.gender === "female" ? "Femme" : patient.gender === "male" ? "Homme" : patient.gender;
|
|
98
|
+
return patient.gender === "female" ? "Femme" : patient.gender === "male" ? "Homme" : patient.gender === "unknown" ? "Inconnu" : patient.gender;
|
|
99
|
+
}
|
|
100
|
+
function setPatientGender(bundle, gender) {
|
|
101
|
+
const patient = bundle.entry?.find(
|
|
102
|
+
(entry) => entry.resource?.resourceType === "Patient"
|
|
103
|
+
)?.resource;
|
|
104
|
+
if (!patient) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
patient.gender = gender;
|
|
90
108
|
}
|
|
91
109
|
function getPatientName(bundle) {
|
|
92
110
|
const patient = bundle?.entry?.find(
|
|
@@ -113,6 +131,32 @@ function getPatientAge(bundle) {
|
|
|
113
131
|
}
|
|
114
132
|
return age;
|
|
115
133
|
}
|
|
134
|
+
function getPatientBirthDate(bundle) {
|
|
135
|
+
const patient = bundle?.entry?.find(
|
|
136
|
+
(entry) => entry.resource?.resourceType === "Patient"
|
|
137
|
+
)?.resource;
|
|
138
|
+
if (!patient?.birthDate) {
|
|
139
|
+
return void 0;
|
|
140
|
+
}
|
|
141
|
+
return new Date(patient.birthDate);
|
|
142
|
+
}
|
|
143
|
+
function setPatientAge(bundle, age, ageUnit) {
|
|
144
|
+
const patient = bundle.entry?.find(
|
|
145
|
+
(entry) => entry.resource?.resourceType === "Patient"
|
|
146
|
+
)?.resource;
|
|
147
|
+
if (!patient) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const today = /* @__PURE__ */ new Date();
|
|
151
|
+
let birthDate;
|
|
152
|
+
if (ageUnit === "mois") {
|
|
153
|
+
birthDate = new Date(Date.UTC(today.getUTCFullYear(), today.getUTCMonth() - age, today.getUTCDate()));
|
|
154
|
+
} else {
|
|
155
|
+
const birthYear = today.getFullYear() - age;
|
|
156
|
+
birthDate = new Date(Date.UTC(birthYear, 0, 1));
|
|
157
|
+
}
|
|
158
|
+
patient.birthDate = birthDate.toISOString().split("T")[0];
|
|
159
|
+
}
|
|
116
160
|
function getPatientWeight(bundle) {
|
|
117
161
|
const obs = bundle?.entry?.find(
|
|
118
162
|
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
@@ -129,6 +173,44 @@ function getPatientWeightWithUnit(bundle) {
|
|
|
129
173
|
)?.resource;
|
|
130
174
|
return (obs?.valueQuantity?.value ? obs.valueQuantity.value.toString() : "") + (obs?.valueQuantity?.unit ? ` ${obs.valueQuantity.unit}` : "");
|
|
131
175
|
}
|
|
176
|
+
function setPatientWeight(bundle, weight) {
|
|
177
|
+
const newObsWeight = {
|
|
178
|
+
value: weight,
|
|
179
|
+
unit: "kg",
|
|
180
|
+
system: "http://unitsofmeasure.org",
|
|
181
|
+
code: "kg"
|
|
182
|
+
};
|
|
183
|
+
let obs = bundle.entry?.find(
|
|
184
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
185
|
+
(coding) => coding.code === "29463-7"
|
|
186
|
+
)
|
|
187
|
+
)?.resource;
|
|
188
|
+
if (!obs) {
|
|
189
|
+
obs = {
|
|
190
|
+
resourceType: "Observation",
|
|
191
|
+
id: "obs-body-weight",
|
|
192
|
+
status: "final",
|
|
193
|
+
code: {
|
|
194
|
+
coding: [
|
|
195
|
+
{
|
|
196
|
+
system: "http://loinc.org",
|
|
197
|
+
code: "29463-7",
|
|
198
|
+
display: "Body weight"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
text: "Poids corporel"
|
|
202
|
+
},
|
|
203
|
+
subject: {
|
|
204
|
+
reference: `Patient/${bundle.id}`
|
|
205
|
+
},
|
|
206
|
+
valueQuantity: newObsWeight
|
|
207
|
+
};
|
|
208
|
+
bundle.entry = bundle.entry || [];
|
|
209
|
+
bundle.entry.push({ resource: obs });
|
|
210
|
+
} else {
|
|
211
|
+
obs.valueQuantity = newObsWeight;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
132
214
|
function getPatientHeight(bundle) {
|
|
133
215
|
const obs = bundle?.entry?.find(
|
|
134
216
|
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
@@ -145,45 +227,323 @@ function getPatientHeightWithUnit(bundle) {
|
|
|
145
227
|
)?.resource;
|
|
146
228
|
return (obs?.valueQuantity?.value ? obs.valueQuantity.value.toString() : "") + (obs?.valueQuantity?.unit ? ` ${obs.valueQuantity.unit}` : "");
|
|
147
229
|
}
|
|
230
|
+
function setPatientHeight(bundle, height) {
|
|
231
|
+
const newObsHeight = {
|
|
232
|
+
value: height,
|
|
233
|
+
unit: "cm",
|
|
234
|
+
system: "http://unitsofmeasure.org",
|
|
235
|
+
code: "cm"
|
|
236
|
+
};
|
|
237
|
+
let obs = bundle.entry?.find(
|
|
238
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
239
|
+
(coding) => coding.code === "8302-2"
|
|
240
|
+
)
|
|
241
|
+
)?.resource;
|
|
242
|
+
if (!obs) {
|
|
243
|
+
obs = {
|
|
244
|
+
resourceType: "Observation",
|
|
245
|
+
id: "obs-body-height",
|
|
246
|
+
status: "final",
|
|
247
|
+
code: {
|
|
248
|
+
coding: [
|
|
249
|
+
{
|
|
250
|
+
system: "http://loinc.org",
|
|
251
|
+
code: "8302-2",
|
|
252
|
+
display: "Body height"
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
text: "Taille corporelle"
|
|
256
|
+
},
|
|
257
|
+
subject: {
|
|
258
|
+
reference: `Patient/${bundle.id}`
|
|
259
|
+
},
|
|
260
|
+
valueQuantity: {
|
|
261
|
+
value: height,
|
|
262
|
+
unit: "cm",
|
|
263
|
+
system: "http://unitsofmeasure.org",
|
|
264
|
+
code: "cm"
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
bundle.entry = bundle.entry || [];
|
|
268
|
+
bundle.entry.push({ resource: obs });
|
|
269
|
+
} else {
|
|
270
|
+
obs.valueQuantity = newObsHeight;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function getPatientPregnancyStatus(bundle) {
|
|
274
|
+
const obsPreg = bundle?.entry?.find(
|
|
275
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some((coding) => coding.code === "82810-3") && entry.resource.valueCodeableConcept?.coding?.some((coding) => coding.code === "77386006")
|
|
276
|
+
);
|
|
277
|
+
const condPreg = bundle?.entry?.find(
|
|
278
|
+
(entry) => entry.resource?.resourceType === "Condition" && entry.resource.code?.coding?.some((coding) => coding.code === "77386006")
|
|
279
|
+
);
|
|
280
|
+
return !!(obsPreg || condPreg);
|
|
281
|
+
}
|
|
282
|
+
function setPatientPregnancyStatus(bundle, isPregnant) {
|
|
283
|
+
if (getPatientPregnancyStatus(bundle)) {
|
|
284
|
+
if (!isPregnant) {
|
|
285
|
+
bundle.entry = bundle.entry?.filter((entry) => !(entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some((coding) => coding.code === "82810-3")) && !(entry.resource?.resourceType === "Condition" && entry.resource.code?.coding?.some((coding) => coding.code === "77386006")));
|
|
286
|
+
}
|
|
287
|
+
} else if (isPregnant) {
|
|
288
|
+
const newObsPreg = {
|
|
289
|
+
resourceType: "Observation",
|
|
290
|
+
id: "obs-pregnancy-status",
|
|
291
|
+
status: "final",
|
|
292
|
+
code: {
|
|
293
|
+
coding: [
|
|
294
|
+
{
|
|
295
|
+
system: "http://loinc.org",
|
|
296
|
+
code: "82810-3",
|
|
297
|
+
display: "Pregnancy status"
|
|
298
|
+
}
|
|
299
|
+
],
|
|
300
|
+
text: "Statut de grossesse"
|
|
301
|
+
},
|
|
302
|
+
subject: {
|
|
303
|
+
reference: `Patient/${bundle.id}`
|
|
304
|
+
},
|
|
305
|
+
valueCodeableConcept: {
|
|
306
|
+
coding: [
|
|
307
|
+
{
|
|
308
|
+
system: "http://snomed.info/sct",
|
|
309
|
+
code: "77386006",
|
|
310
|
+
display: "Pregnant"
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
text: "Grossesse"
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
bundle.entry = bundle.entry || [];
|
|
317
|
+
bundle.entry.push({ resource: newObsPreg });
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function getPatientAmenorrheaStatus(bundle) {
|
|
321
|
+
const obs = bundle?.entry?.find(
|
|
322
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
323
|
+
(coding) => coding.code === "18185-9"
|
|
324
|
+
)
|
|
325
|
+
)?.resource;
|
|
326
|
+
return obs?.valueQuantity?.value;
|
|
327
|
+
}
|
|
328
|
+
function setPatientAmenorrheaStatus(bundle, weeks) {
|
|
329
|
+
const newObsAmenorrhea = {
|
|
330
|
+
value: weeks,
|
|
331
|
+
unit: "weeks",
|
|
332
|
+
system: "http://unitsofmeasure.org",
|
|
333
|
+
code: "wk"
|
|
334
|
+
};
|
|
335
|
+
let obs = bundle.entry?.find(
|
|
336
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
337
|
+
(coding) => coding.code === "18185-9"
|
|
338
|
+
)
|
|
339
|
+
)?.resource;
|
|
340
|
+
if (!obs) {
|
|
341
|
+
obs = {
|
|
342
|
+
resourceType: "Observation",
|
|
343
|
+
id: "obs-gestational-age",
|
|
344
|
+
status: "final",
|
|
345
|
+
code: {
|
|
346
|
+
coding: [
|
|
347
|
+
{
|
|
348
|
+
system: "http://loinc.org",
|
|
349
|
+
code: "18185-9",
|
|
350
|
+
display: "Gestational age"
|
|
351
|
+
}
|
|
352
|
+
],
|
|
353
|
+
text: "Âge gestationnel"
|
|
354
|
+
},
|
|
355
|
+
subject: {
|
|
356
|
+
reference: `Patient/${bundle.id}`
|
|
357
|
+
},
|
|
358
|
+
valueQuantity: newObsAmenorrhea
|
|
359
|
+
};
|
|
360
|
+
bundle.entry = bundle.entry || [];
|
|
361
|
+
bundle.entry.push({ resource: obs });
|
|
362
|
+
} else {
|
|
363
|
+
obs.valueQuantity = newObsAmenorrhea;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
function getPatientBreastfeedingStatus(bundle) {
|
|
367
|
+
const obsBf = bundle?.entry?.find(
|
|
368
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some((coding) => coding.code === "63895-7") && entry.resource.valueCodeableConcept?.coding?.some((coding) => coding.code === "69840006")
|
|
369
|
+
);
|
|
370
|
+
const condBf = bundle?.entry?.find(
|
|
371
|
+
(entry) => entry.resource?.resourceType === "Condition" && entry.resource.code?.coding?.some((coding) => coding.code === "69840006")
|
|
372
|
+
);
|
|
373
|
+
return !!(obsBf || condBf);
|
|
374
|
+
}
|
|
375
|
+
function setPatientBreastfeedingStatus(bundle, isBreastfeeding) {
|
|
376
|
+
const obsBf = bundle.entry?.find(
|
|
377
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
378
|
+
(coding) => coding.code === "63895-7"
|
|
379
|
+
)
|
|
380
|
+
)?.resource;
|
|
381
|
+
const condBf = bundle.entry?.find(
|
|
382
|
+
(entry) => entry.resource?.resourceType === "Condition" && entry.resource.code?.coding?.some(
|
|
383
|
+
(coding) => coding.code === "69840006"
|
|
384
|
+
)
|
|
385
|
+
)?.resource;
|
|
386
|
+
if (isBreastfeeding) {
|
|
387
|
+
if (!obsBf && !condBf) {
|
|
388
|
+
const newObsBf = {
|
|
389
|
+
resourceType: "Observation",
|
|
390
|
+
id: "obs-breastfeeding-status",
|
|
391
|
+
status: "final",
|
|
392
|
+
code: {
|
|
393
|
+
coding: [
|
|
394
|
+
{
|
|
395
|
+
system: "http://loinc.org",
|
|
396
|
+
code: "63895-7",
|
|
397
|
+
display: "Breastfeeding status"
|
|
398
|
+
}
|
|
399
|
+
],
|
|
400
|
+
text: "Statut d'allaitement"
|
|
401
|
+
},
|
|
402
|
+
subject: {
|
|
403
|
+
reference: `Patient/${bundle.id}`
|
|
404
|
+
},
|
|
405
|
+
valueCodeableConcept: {
|
|
406
|
+
coding: [
|
|
407
|
+
{
|
|
408
|
+
system: "http://snomed.info/sct",
|
|
409
|
+
code: "69840006",
|
|
410
|
+
display: "Breastfeeding"
|
|
411
|
+
}
|
|
412
|
+
],
|
|
413
|
+
text: "Allaitement"
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
bundle.entry = bundle.entry || [];
|
|
417
|
+
bundle.entry.push({ resource: newObsBf });
|
|
418
|
+
}
|
|
419
|
+
} else {
|
|
420
|
+
if (obsBf) {
|
|
421
|
+
bundle.entry = bundle.entry?.filter((entry) => entry.resource?.id !== obsBf.id);
|
|
422
|
+
}
|
|
423
|
+
if (condBf) {
|
|
424
|
+
bundle.entry = bundle.entry?.filter((entry) => entry.resource?.id !== condBf.id);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
148
428
|
function getPatientRenalInsufficiencyStatus(bundle) {
|
|
149
429
|
const clearance = bundle?.entry?.find(
|
|
150
430
|
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
151
431
|
(coding) => acceptedLoincCodesForRenalClearance.includes(coding.code ?? "")
|
|
152
432
|
)
|
|
153
433
|
)?.resource;
|
|
154
|
-
|
|
434
|
+
let gfrValue;
|
|
435
|
+
const gfrByBsa = bundle?.entry?.find(
|
|
155
436
|
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
156
|
-
(coding) =>
|
|
437
|
+
(coding) => acceptedLoincCodesForRenalGFRPerBSA.includes(coding.code ?? "")
|
|
157
438
|
)
|
|
158
439
|
)?.resource;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
)
|
|
167
|
-
)?.resource;
|
|
168
|
-
if (gfrByBsa?.valueQuantity?.value) {
|
|
169
|
-
const weight = getPatientWeight(bundle);
|
|
170
|
-
const height = getPatientHeight(bundle);
|
|
171
|
-
if (weight && height) {
|
|
172
|
-
const bsa = calculateBSA(height, weight);
|
|
173
|
-
gfrValue = {
|
|
174
|
-
value: normalizedGFRtoAbsolute(gfrByBsa.valueQuantity.value, bsa),
|
|
175
|
-
unit: "mL/min",
|
|
176
|
-
system: "http://unitsofmeasure.org",
|
|
177
|
-
code: "mL/min"
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
}
|
|
440
|
+
if (gfrByBsa?.valueQuantity?.value) {
|
|
441
|
+
gfrValue = {
|
|
442
|
+
value: gfrByBsa.valueQuantity.value,
|
|
443
|
+
unit: "mL/min/1.73.m2",
|
|
444
|
+
system: "http://unitsofmeasure.org",
|
|
445
|
+
code: "mL/min/1.73.m2"
|
|
446
|
+
};
|
|
181
447
|
}
|
|
182
448
|
return {
|
|
183
449
|
clearance: clearance?.valueQuantity,
|
|
184
450
|
gfr: gfrValue
|
|
185
451
|
};
|
|
186
452
|
}
|
|
453
|
+
function setPatientClearance(bundle, clearance) {
|
|
454
|
+
const newObsClearance = {
|
|
455
|
+
value: clearance,
|
|
456
|
+
unit: "mL/min",
|
|
457
|
+
system: "http://unitsofmeasure.org",
|
|
458
|
+
code: "mL/min"
|
|
459
|
+
};
|
|
460
|
+
let obs = bundle?.entry?.find(
|
|
461
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
462
|
+
(coding) => acceptedLoincCodesForRenalClearance.includes(coding.code ?? "")
|
|
463
|
+
)
|
|
464
|
+
)?.resource;
|
|
465
|
+
if (!obs) {
|
|
466
|
+
obs = {
|
|
467
|
+
resourceType: "Observation",
|
|
468
|
+
id: "obs-creatinine-clearance",
|
|
469
|
+
status: "final",
|
|
470
|
+
code: {
|
|
471
|
+
coding: [
|
|
472
|
+
{
|
|
473
|
+
system: "http://loinc.org",
|
|
474
|
+
code: acceptedLoincCodesForRenalClearance[0],
|
|
475
|
+
display: "Creatinine Clearance"
|
|
476
|
+
}
|
|
477
|
+
],
|
|
478
|
+
text: "Clairance de la créatinine"
|
|
479
|
+
},
|
|
480
|
+
subject: {
|
|
481
|
+
reference: `Patient/${bundle.id}`
|
|
482
|
+
},
|
|
483
|
+
valueQuantity: newObsClearance
|
|
484
|
+
};
|
|
485
|
+
bundle.entry = bundle.entry || [];
|
|
486
|
+
bundle.entry.push({ resource: obs });
|
|
487
|
+
} else {
|
|
488
|
+
obs.valueQuantity = newObsClearance;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
function setPatientGFRByBSA(bundle, gfr) {
|
|
492
|
+
const newObsGFR = {
|
|
493
|
+
value: gfr,
|
|
494
|
+
unit: "mL/min/1.73.m2",
|
|
495
|
+
system: "http://unitsofmeasure.org",
|
|
496
|
+
code: "mL/min/1.73.m2"
|
|
497
|
+
};
|
|
498
|
+
let obs = bundle?.entry?.find(
|
|
499
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
500
|
+
(coding) => acceptedLoincCodesForRenalGFRPerBSA.includes(coding.code ?? "")
|
|
501
|
+
)
|
|
502
|
+
)?.resource;
|
|
503
|
+
if (!obs) {
|
|
504
|
+
obs = {
|
|
505
|
+
resourceType: "Observation",
|
|
506
|
+
id: "obs-gfr-bsa",
|
|
507
|
+
status: "final",
|
|
508
|
+
code: {
|
|
509
|
+
coding: [
|
|
510
|
+
{
|
|
511
|
+
system: "http://loinc.org",
|
|
512
|
+
code: acceptedLoincCodesForRenalGFRPerBSA[0],
|
|
513
|
+
display: "Glomerular filtration rate [Volume Rate/Area] in Serum, Plasma or Blood by Creatinine-based formula (MDRD)/1.73 sq M among black population"
|
|
514
|
+
}
|
|
515
|
+
],
|
|
516
|
+
text: "DFG"
|
|
517
|
+
},
|
|
518
|
+
subject: {
|
|
519
|
+
reference: `Patient/${bundle.id}`
|
|
520
|
+
},
|
|
521
|
+
valueQuantity: newObsGFR
|
|
522
|
+
};
|
|
523
|
+
bundle.entry = bundle.entry || [];
|
|
524
|
+
bundle.entry.push({ resource: obs });
|
|
525
|
+
} else {
|
|
526
|
+
obs.valueQuantity = newObsGFR;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
function computeCreatinineFromClearance(clearance, age, weight, isFemale) {
|
|
530
|
+
const results = [];
|
|
531
|
+
const sexFactor = isFemale ? 0.85 : 1;
|
|
532
|
+
const scrMgdl = round2((140 - age) * weight * sexFactor / (72 * clearance));
|
|
533
|
+
results.push({
|
|
534
|
+
value: round2(mgdlToMgl(scrMgdl)),
|
|
535
|
+
unit: "mg/L",
|
|
536
|
+
system: "http://unitsofmeasure.org",
|
|
537
|
+
code: "mg/L"
|
|
538
|
+
});
|
|
539
|
+
results.push({
|
|
540
|
+
value: round2(mgdlToUmolL(scrMgdl)),
|
|
541
|
+
unit: "μmol/L",
|
|
542
|
+
system: "http://unitsofmeasure.org",
|
|
543
|
+
code: "umol/L"
|
|
544
|
+
});
|
|
545
|
+
return results;
|
|
546
|
+
}
|
|
187
547
|
function calculateCreatinineFromClearance(bundle, results) {
|
|
188
548
|
if (results.length > 0) {
|
|
189
549
|
return;
|
|
@@ -194,22 +554,12 @@ function calculateCreatinineFromClearance(bundle, results) {
|
|
|
194
554
|
const patient = bundle?.entry?.find(
|
|
195
555
|
(e2) => e2.resource?.resourceType === "Patient"
|
|
196
556
|
)?.resource;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
const scrMgdl = round2((140 - age) * weight * sexFactor / (72 * clr));
|
|
200
|
-
results.push({
|
|
201
|
-
value: round2(mgdlToMgl(scrMgdl)),
|
|
202
|
-
unit: "mg/L",
|
|
203
|
-
system: "http://unitsofmeasure.org",
|
|
204
|
-
code: "mg/L"
|
|
205
|
-
});
|
|
206
|
-
results.push({
|
|
207
|
-
value: round2(mgdlToUmolL(scrMgdl)),
|
|
208
|
-
unit: "μmol/L",
|
|
209
|
-
system: "http://unitsofmeasure.org",
|
|
210
|
-
code: "umol/L"
|
|
211
|
-
});
|
|
557
|
+
if (!clr || !age || !weight || !patient?.gender) {
|
|
558
|
+
return;
|
|
212
559
|
}
|
|
560
|
+
const isFemale = patient.gender === "female";
|
|
561
|
+
const computed = computeCreatinineFromClearance(clr, age, weight, isFemale);
|
|
562
|
+
results.push(...computed);
|
|
213
563
|
}
|
|
214
564
|
function hasUnit(results, unitCode, unitSymbol) {
|
|
215
565
|
return results.some((q) => (q.code ?? q.unit) === unitCode) || (unitSymbol ? results.some((q) => q.unit === unitSymbol) : false);
|
|
@@ -261,6 +611,82 @@ function getCreatinine(bundle) {
|
|
|
261
611
|
calculateCreatinineFromClearance(bundle, results);
|
|
262
612
|
return results;
|
|
263
613
|
}
|
|
614
|
+
function setCreatinineBymgL(bundle, mgL) {
|
|
615
|
+
const newObsCreatinine = {
|
|
616
|
+
value: mgL / 10,
|
|
617
|
+
unit: "mg/dL",
|
|
618
|
+
system: "http://unitsofmeasure.org",
|
|
619
|
+
code: "mg/dL"
|
|
620
|
+
};
|
|
621
|
+
let obs = bundle?.entry?.find(
|
|
622
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
623
|
+
(coding) => coding.code === "2160-0"
|
|
624
|
+
)
|
|
625
|
+
)?.resource;
|
|
626
|
+
if (!obs) {
|
|
627
|
+
obs = {
|
|
628
|
+
resourceType: "Observation",
|
|
629
|
+
id: "obs-creatinine",
|
|
630
|
+
status: "final",
|
|
631
|
+
code: {
|
|
632
|
+
coding: [
|
|
633
|
+
{
|
|
634
|
+
system: "http://loinc.org",
|
|
635
|
+
code: "2160-0",
|
|
636
|
+
display: "Creatinine [Mass/volume] in Serum or Plasma"
|
|
637
|
+
}
|
|
638
|
+
],
|
|
639
|
+
text: "Créatininémie"
|
|
640
|
+
},
|
|
641
|
+
subject: {
|
|
642
|
+
reference: `Patient/${bundle.id}`
|
|
643
|
+
},
|
|
644
|
+
valueQuantity: newObsCreatinine
|
|
645
|
+
};
|
|
646
|
+
bundle.entry = bundle.entry || [];
|
|
647
|
+
bundle.entry.push({ resource: obs });
|
|
648
|
+
} else {
|
|
649
|
+
obs.valueQuantity = newObsCreatinine;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
function setCreatinineByUmolL(bundle, umolL) {
|
|
653
|
+
const newObsCreatinine = {
|
|
654
|
+
value: umolL,
|
|
655
|
+
unit: "μmol/L",
|
|
656
|
+
system: "http://unitsofmeasure.org",
|
|
657
|
+
code: "umol/L"
|
|
658
|
+
};
|
|
659
|
+
let obs = bundle?.entry?.find(
|
|
660
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
661
|
+
(coding) => coding.code === "15051-6"
|
|
662
|
+
)
|
|
663
|
+
)?.resource;
|
|
664
|
+
if (!obs) {
|
|
665
|
+
obs = {
|
|
666
|
+
resourceType: "Observation",
|
|
667
|
+
id: "obs-creatinine",
|
|
668
|
+
status: "final",
|
|
669
|
+
code: {
|
|
670
|
+
coding: [
|
|
671
|
+
{
|
|
672
|
+
system: "http://loinc.org",
|
|
673
|
+
code: "15051-6",
|
|
674
|
+
display: "Creatinine [Moles/volume] in Serum or Plasma"
|
|
675
|
+
}
|
|
676
|
+
],
|
|
677
|
+
text: "Créatininémie"
|
|
678
|
+
},
|
|
679
|
+
subject: {
|
|
680
|
+
reference: `Patient/${bundle.id}`
|
|
681
|
+
},
|
|
682
|
+
valueQuantity: newObsCreatinine
|
|
683
|
+
};
|
|
684
|
+
bundle.entry = bundle.entry || [];
|
|
685
|
+
bundle.entry.push({ resource: obs });
|
|
686
|
+
} else {
|
|
687
|
+
obs.valueQuantity = newObsCreatinine;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
264
690
|
function mgdlToMgl(mgdl) {
|
|
265
691
|
return mgdl * 10;
|
|
266
692
|
}
|
|
@@ -276,17 +702,150 @@ function umolLToMgl(umolL) {
|
|
|
276
702
|
function round2(n3) {
|
|
277
703
|
return Math.round(n3 * 100) / 100;
|
|
278
704
|
}
|
|
279
|
-
function
|
|
705
|
+
function getPatientHepaticInsufficiencyScore(bundle) {
|
|
280
706
|
const obs = bundle?.entry?.find(
|
|
281
707
|
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
282
708
|
(coding) => coding.code === "98152-2"
|
|
283
709
|
)
|
|
284
710
|
)?.resource;
|
|
285
711
|
if (obs?.valueQuantity?.value) {
|
|
286
|
-
return
|
|
712
|
+
return obs?.valueQuantity?.value;
|
|
713
|
+
}
|
|
714
|
+
return null;
|
|
715
|
+
}
|
|
716
|
+
function getPatientHepaticInsufficiencyStade(bundle) {
|
|
717
|
+
const obs = bundle?.entry?.find(
|
|
718
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
719
|
+
(coding) => coding.code === "98152-2"
|
|
720
|
+
)
|
|
721
|
+
)?.resource;
|
|
722
|
+
if (obs?.valueQuantity?.value) {
|
|
723
|
+
return childPughScore(obs.valueQuantity.value);
|
|
724
|
+
} else if (obs?.valueCodeableConcept?.coding?.[0]?.code) {
|
|
725
|
+
const snomedCode = obs.valueCodeableConcept.coding[0].code;
|
|
726
|
+
const mapped = snomedToChildPughStadeMap[snomedCode];
|
|
727
|
+
if (mapped) {
|
|
728
|
+
return mapped;
|
|
729
|
+
}
|
|
287
730
|
}
|
|
288
731
|
return "";
|
|
289
732
|
}
|
|
733
|
+
function setPatientHepaticInsufficiencyStatus(bundle, stade, score) {
|
|
734
|
+
let obs = bundle.entry?.find(
|
|
735
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
736
|
+
(coding) => coding.code === "98152-2"
|
|
737
|
+
)
|
|
738
|
+
)?.resource;
|
|
739
|
+
if (stade) {
|
|
740
|
+
const snomedCode = childPughStadeToSnomedMap[stade];
|
|
741
|
+
if (!snomedCode) {
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
const stadeConcept = {
|
|
745
|
+
coding: [
|
|
746
|
+
{
|
|
747
|
+
system: "http://snomed.info/sct",
|
|
748
|
+
code: snomedCode,
|
|
749
|
+
display: `Child-Pugh score class ${stade}`
|
|
750
|
+
}
|
|
751
|
+
],
|
|
752
|
+
text: `Stade ${stade}`
|
|
753
|
+
};
|
|
754
|
+
if (!obs) {
|
|
755
|
+
obs = {
|
|
756
|
+
resourceType: "Observation",
|
|
757
|
+
id: "obs-child-pugh",
|
|
758
|
+
status: "final",
|
|
759
|
+
code: {
|
|
760
|
+
coding: [
|
|
761
|
+
{
|
|
762
|
+
system: "http://loinc.org",
|
|
763
|
+
code: "98152-2",
|
|
764
|
+
display: "Child-Pugh score"
|
|
765
|
+
}
|
|
766
|
+
],
|
|
767
|
+
text: "Score de Child-Pugh"
|
|
768
|
+
},
|
|
769
|
+
subject: {
|
|
770
|
+
reference: `Patient/${bundle.id}`
|
|
771
|
+
},
|
|
772
|
+
valueCodeableConcept: stadeConcept
|
|
773
|
+
};
|
|
774
|
+
bundle.entry = bundle.entry || [];
|
|
775
|
+
bundle.entry.push({ resource: obs });
|
|
776
|
+
} else {
|
|
777
|
+
obs.valueCodeableConcept = stadeConcept;
|
|
778
|
+
if (!score) {
|
|
779
|
+
delete obs.valueQuantity;
|
|
780
|
+
} else {
|
|
781
|
+
const stadeOfScore = childPughScore(score).replace("Stade ", "");
|
|
782
|
+
if (stadeOfScore === stade) {
|
|
783
|
+
obs.valueQuantity = {
|
|
784
|
+
value: score,
|
|
785
|
+
unit: "score",
|
|
786
|
+
system: "http://unitsofmeasure.org",
|
|
787
|
+
code: "{score}"
|
|
788
|
+
};
|
|
789
|
+
} else {
|
|
790
|
+
delete obs.valueQuantity;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
if (typeof score === "number" && !isNaN(score)) {
|
|
797
|
+
const newObsValueQuantity = {
|
|
798
|
+
value: score,
|
|
799
|
+
unit: "score",
|
|
800
|
+
system: "http://unitsofmeasure.org",
|
|
801
|
+
code: "{score}"
|
|
802
|
+
};
|
|
803
|
+
const stadeLabel = childPughScore(score);
|
|
804
|
+
const stadeLetter = stadeLabel.replace("Stade ", "");
|
|
805
|
+
const snomedCode = childPughStadeToSnomedMap[stadeLetter];
|
|
806
|
+
const stadeConcept = snomedCode ? {
|
|
807
|
+
coding: [
|
|
808
|
+
{
|
|
809
|
+
system: "http://snomed.info/sct",
|
|
810
|
+
code: snomedCode,
|
|
811
|
+
display: `Child-Pugh score class ${stadeLetter}`
|
|
812
|
+
}
|
|
813
|
+
],
|
|
814
|
+
text: `Stade ${stadeLetter}`
|
|
815
|
+
} : void 0;
|
|
816
|
+
if (!obs) {
|
|
817
|
+
obs = {
|
|
818
|
+
resourceType: "Observation",
|
|
819
|
+
id: "obs-child-pugh",
|
|
820
|
+
status: "final",
|
|
821
|
+
code: {
|
|
822
|
+
coding: [
|
|
823
|
+
{
|
|
824
|
+
system: "http://loinc.org",
|
|
825
|
+
code: "98152-2",
|
|
826
|
+
display: "Child-Pugh score"
|
|
827
|
+
}
|
|
828
|
+
],
|
|
829
|
+
text: "Score de Child-Pugh"
|
|
830
|
+
},
|
|
831
|
+
subject: {
|
|
832
|
+
reference: `Patient/${bundle.id}`
|
|
833
|
+
},
|
|
834
|
+
valueQuantity: newObsValueQuantity,
|
|
835
|
+
...stadeConcept ? { valueCodeableConcept: stadeConcept } : {}
|
|
836
|
+
};
|
|
837
|
+
bundle.entry = bundle.entry || [];
|
|
838
|
+
bundle.entry.push({ resource: obs });
|
|
839
|
+
} else {
|
|
840
|
+
obs.valueQuantity = newObsValueQuantity;
|
|
841
|
+
if (stadeConcept) {
|
|
842
|
+
obs.valueCodeableConcept = stadeConcept;
|
|
843
|
+
} else {
|
|
844
|
+
delete obs.valueCodeableConcept;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
290
849
|
function getPatientConditions(patient) {
|
|
291
850
|
if (!patient?.entry) {
|
|
292
851
|
return [];
|
|
@@ -303,6 +862,66 @@ function getPatientConditions(patient) {
|
|
|
303
862
|
}
|
|
304
863
|
return conditions;
|
|
305
864
|
}
|
|
865
|
+
function getPatientConditionsWithCode(patient) {
|
|
866
|
+
if (!patient?.entry) {
|
|
867
|
+
return [];
|
|
868
|
+
}
|
|
869
|
+
const conditions = [];
|
|
870
|
+
for (const entry of patient.entry) {
|
|
871
|
+
if (entry.resource?.resourceType === "Condition") {
|
|
872
|
+
let condition;
|
|
873
|
+
let subType = "";
|
|
874
|
+
if (entry.resource.code?.coding?.[0].system) {
|
|
875
|
+
if (entry.resource.code.coding[0].system.includes("snomed")) {
|
|
876
|
+
subType = "snomed";
|
|
877
|
+
} else if (entry.resource.code.coding[0].system.includes("icd-10")) {
|
|
878
|
+
subType = "CIM10";
|
|
879
|
+
} else if (entry.resource.code.coding[0].system.includes("amm")) {
|
|
880
|
+
subType = "AMM";
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
if (entry.resource.code?.text) {
|
|
884
|
+
condition = { value: entry.resource.code?.coding?.[0].code ?? "", label: entry.resource.code.text, subType };
|
|
885
|
+
} else {
|
|
886
|
+
condition = { value: entry.resource.code?.coding?.[0].code ?? "", label: entry.resource.code?.coding?.[0].display ?? "", subType };
|
|
887
|
+
}
|
|
888
|
+
conditions.push(condition);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
return conditions;
|
|
892
|
+
}
|
|
893
|
+
function setPatientConditions(patient, conditions) {
|
|
894
|
+
patient.entry = patient.entry?.filter((entry) => entry.resource?.resourceType !== "Condition");
|
|
895
|
+
for (const condition of conditions) {
|
|
896
|
+
const newCondition = {
|
|
897
|
+
resourceType: "Condition",
|
|
898
|
+
id: `cond-${condition.value}-patient-${patient.id}`,
|
|
899
|
+
clinicalStatus: {
|
|
900
|
+
coding: [
|
|
901
|
+
{
|
|
902
|
+
system: "http://terminology.hl7.org/CodeSystem/condition-clinical",
|
|
903
|
+
code: "active"
|
|
904
|
+
}
|
|
905
|
+
]
|
|
906
|
+
},
|
|
907
|
+
code: {
|
|
908
|
+
coding: [
|
|
909
|
+
{
|
|
910
|
+
system: condition.subType === "snomed" ? "http://snomed.info/sct" : condition.subType === "CIM10" ? "http://hl7.org/fhir/sid/icd-10" : condition.subType === "AMM" ? "http://example.org/fhir/amm-codes" : "",
|
|
911
|
+
code: condition.value,
|
|
912
|
+
display: condition.label
|
|
913
|
+
}
|
|
914
|
+
],
|
|
915
|
+
text: condition.label
|
|
916
|
+
},
|
|
917
|
+
subject: {
|
|
918
|
+
reference: `Patient/${patient.id}`
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
patient.entry = patient.entry || [];
|
|
922
|
+
patient.entry.push({ resource: newCondition });
|
|
923
|
+
}
|
|
924
|
+
}
|
|
306
925
|
function getPatientAllergies(patient) {
|
|
307
926
|
if (!patient?.entry) {
|
|
308
927
|
return [];
|
|
@@ -319,6 +938,56 @@ function getPatientAllergies(patient) {
|
|
|
319
938
|
}
|
|
320
939
|
return allergies;
|
|
321
940
|
}
|
|
941
|
+
function getPatientAllergiesWithCode(patient) {
|
|
942
|
+
if (!patient?.entry) {
|
|
943
|
+
return [];
|
|
944
|
+
}
|
|
945
|
+
const allergies = [];
|
|
946
|
+
for (const entry of patient.entry) {
|
|
947
|
+
if (entry.resource?.resourceType === "AllergyIntolerance") {
|
|
948
|
+
let allergy;
|
|
949
|
+
if (entry.resource.code?.text) {
|
|
950
|
+
allergy = { value: entry.resource.code?.coding?.[0].code ?? "", label: entry.resource.code.text, subType: "" };
|
|
951
|
+
} else {
|
|
952
|
+
allergy = { value: entry.resource.code?.coding?.[0].code ?? "", label: entry.resource.code?.coding?.[0].display ?? "", subType: "" };
|
|
953
|
+
}
|
|
954
|
+
allergies.push(allergy);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
return allergies;
|
|
958
|
+
}
|
|
959
|
+
function setPatientAllergies(patient, allergies) {
|
|
960
|
+
patient.entry = patient.entry?.filter((entry) => entry.resource?.resourceType !== "AllergyIntolerance");
|
|
961
|
+
for (const allergy of allergies) {
|
|
962
|
+
const newAllergy = {
|
|
963
|
+
resourceType: "AllergyIntolerance",
|
|
964
|
+
id: `allergy-${allergy.value}-patient-${patient.id}`,
|
|
965
|
+
clinicalStatus: {
|
|
966
|
+
coding: [
|
|
967
|
+
{
|
|
968
|
+
system: "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
|
|
969
|
+
code: "active"
|
|
970
|
+
}
|
|
971
|
+
]
|
|
972
|
+
},
|
|
973
|
+
code: {
|
|
974
|
+
coding: [
|
|
975
|
+
{
|
|
976
|
+
system: "http://claudebernard.fr/fhir/CodeSystem/bcb-active-ingredients-codes",
|
|
977
|
+
code: allergy.value,
|
|
978
|
+
display: allergy.label
|
|
979
|
+
}
|
|
980
|
+
],
|
|
981
|
+
text: allergy.label
|
|
982
|
+
},
|
|
983
|
+
patient: {
|
|
984
|
+
reference: `Patient/${patient.id}`
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
patient.entry = patient.entry || [];
|
|
988
|
+
patient.entry.push({ resource: newAllergy });
|
|
989
|
+
}
|
|
990
|
+
}
|
|
322
991
|
function childPughScore(score) {
|
|
323
992
|
if (score < 7) {
|
|
324
993
|
return msg("Stade A");
|
|
@@ -327,13 +996,7 @@ function childPughScore(score) {
|
|
|
327
996
|
}
|
|
328
997
|
return msg("Stade C");
|
|
329
998
|
}
|
|
330
|
-
|
|
331
|
-
return Math.sqrt(height * weight / 3600);
|
|
332
|
-
}
|
|
333
|
-
function normalizedGFRtoAbsolute(normalizedGFR, bsa) {
|
|
334
|
-
return Math.round(normalizedGFR * (bsa / 1.73) * 100) / 100;
|
|
335
|
-
}
|
|
336
|
-
const t$2 = globalThis, e$2 = t$2.ShadowRoot && (void 0 === t$2.ShadyCSS || t$2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$2 = Symbol(), o$4 = /* @__PURE__ */ new WeakMap();
|
|
999
|
+
const t$2 = globalThis, e$4 = t$2.ShadowRoot && (void 0 === t$2.ShadyCSS || t$2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$2 = /* @__PURE__ */ Symbol(), o$4 = /* @__PURE__ */ new WeakMap();
|
|
337
1000
|
let n$3 = class n {
|
|
338
1001
|
constructor(t2, e2, o2) {
|
|
339
1002
|
if (this._$cssResult$ = true, o2 !== s$2) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
@@ -342,7 +1005,7 @@ let n$3 = class n {
|
|
|
342
1005
|
get styleSheet() {
|
|
343
1006
|
let t2 = this.o;
|
|
344
1007
|
const s2 = this.t;
|
|
345
|
-
if (e$
|
|
1008
|
+
if (e$4 && void 0 === t2) {
|
|
346
1009
|
const e2 = void 0 !== s2 && 1 === s2.length;
|
|
347
1010
|
e2 && (t2 = o$4.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$4.set(s2, t2));
|
|
348
1011
|
}
|
|
@@ -360,17 +1023,17 @@ const r$4 = (t2) => new n$3("string" == typeof t2 ? t2 : t2 + "", void 0, s$2),
|
|
|
360
1023
|
})(s2) + t2[o3 + 1]), t2[0]);
|
|
361
1024
|
return new n$3(o2, t2, s$2);
|
|
362
1025
|
}, S$1 = (s2, o2) => {
|
|
363
|
-
if (e$
|
|
1026
|
+
if (e$4) s2.adoptedStyleSheets = o2.map(((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet));
|
|
364
1027
|
else for (const e2 of o2) {
|
|
365
1028
|
const o3 = document.createElement("style"), n3 = t$2.litNonce;
|
|
366
1029
|
void 0 !== n3 && o3.setAttribute("nonce", n3), o3.textContent = e2.cssText, s2.appendChild(o3);
|
|
367
1030
|
}
|
|
368
|
-
}, c$2 = e$
|
|
1031
|
+
}, c$2 = e$4 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
|
|
369
1032
|
let e2 = "";
|
|
370
1033
|
for (const s2 of t3.cssRules) e2 += s2.cssText;
|
|
371
1034
|
return r$4(e2);
|
|
372
1035
|
})(t2) : t2;
|
|
373
|
-
const { is: i$2, defineProperty: e$
|
|
1036
|
+
const { is: i$2, defineProperty: e$3, getOwnPropertyDescriptor: h$1, getOwnPropertyNames: r$3, getOwnPropertySymbols: o$3, getPrototypeOf: n$2 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (t2, s2) => t2, u$1 = { toAttribute(t2, s2) {
|
|
374
1037
|
switch (s2) {
|
|
375
1038
|
case Boolean:
|
|
376
1039
|
t2 = t2 ? l$1 : null;
|
|
@@ -399,7 +1062,7 @@ const { is: i$2, defineProperty: e$1, getOwnPropertyDescriptor: h$1, getOwnPrope
|
|
|
399
1062
|
}
|
|
400
1063
|
return i2;
|
|
401
1064
|
} }, f$1 = (t2, s2) => !i$2(t2, s2), b = { attribute: true, type: String, converter: u$1, reflect: false, useDefault: false, hasChanged: f$1 };
|
|
402
|
-
Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
1065
|
+
Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), a$1.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
403
1066
|
let y$1 = class y extends HTMLElement {
|
|
404
1067
|
static addInitializer(t2) {
|
|
405
1068
|
this._$Ei(), (this.l ??= []).push(t2);
|
|
@@ -409,8 +1072,8 @@ let y$1 = class y extends HTMLElement {
|
|
|
409
1072
|
}
|
|
410
1073
|
static createProperty(t2, s2 = b) {
|
|
411
1074
|
if (s2.state && (s2.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t2) && ((s2 = Object.create(s2)).wrapped = true), this.elementProperties.set(t2, s2), !s2.noAccessor) {
|
|
412
|
-
const i2 = Symbol(), h2 = this.getPropertyDescriptor(t2, i2, s2);
|
|
413
|
-
void 0 !== h2 && e$
|
|
1075
|
+
const i2 = /* @__PURE__ */ Symbol(), h2 = this.getPropertyDescriptor(t2, i2, s2);
|
|
1076
|
+
void 0 !== h2 && e$3(this.prototype, t2, h2);
|
|
414
1077
|
}
|
|
415
1078
|
}
|
|
416
1079
|
static getPropertyDescriptor(t2, s2, i2) {
|
|
@@ -582,8 +1245,8 @@ let y$1 = class y extends HTMLElement {
|
|
|
582
1245
|
}
|
|
583
1246
|
};
|
|
584
1247
|
y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$1("elementProperties")] = /* @__PURE__ */ new Map(), y$1[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1?.({ ReactiveElement: y$1 }), (a$1.reactiveElementVersions ??= []).push("2.1.1");
|
|
585
|
-
const t$1 = globalThis, i$1 = t$1.trustedTypes, s$1 = i$1 ? i$1.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$2 = "?" + h, n$1 = `<${o$2}>`, r$2 = document, l = () => r$2.createComment(""), c = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a = Array.isArray, u = (t2) => a(t2) || "function" == typeof t2?.[Symbol.iterator], d = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
|
|
586
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y2 = (t2) => (i2, ...s2) => ({ _$litType$: t2, strings: i2, values: s2 }), x = y2(1), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r$2.createTreeWalker(r$2, 129);
|
|
1248
|
+
const t$1 = globalThis, i$1 = t$1.trustedTypes, s$1 = i$1 ? i$1.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e$2 = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$2 = "?" + h, n$1 = `<${o$2}>`, r$2 = document, l = () => r$2.createComment(""), c = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a = Array.isArray, u = (t2) => a(t2) || "function" == typeof t2?.[Symbol.iterator], d = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
|
|
1249
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y2 = (t2) => (i2, ...s2) => ({ _$litType$: t2, strings: i2, values: s2 }), x = y2(1), T = /* @__PURE__ */ Symbol.for("lit-noChange"), E = /* @__PURE__ */ Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r$2.createTreeWalker(r$2, 129);
|
|
587
1250
|
function P(t2, i2) {
|
|
588
1251
|
if (!a(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
589
1252
|
return void 0 !== s$1 ? s$1.createHTML(i2) : i2;
|
|
@@ -596,7 +1259,7 @@ const V = (t2, i2) => {
|
|
|
596
1259
|
let a2, u2, d2 = -1, y3 = 0;
|
|
597
1260
|
for (; y3 < s3.length && (c2.lastIndex = y3, u2 = c2.exec(s3), null !== u2); ) y3 = c2.lastIndex, c2 === f ? "!--" === u2[1] ? c2 = v : void 0 !== u2[1] ? c2 = _ : void 0 !== u2[2] ? ($.test(u2[2]) && (r2 = RegExp("</" + u2[2], "g")), c2 = m) : void 0 !== u2[3] && (c2 = m) : c2 === m ? ">" === u2[0] ? (c2 = r2 ?? f, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? m : '"' === u2[3] ? g : p) : c2 === g || c2 === p ? c2 = m : c2 === v || c2 === _ ? c2 = f : (c2 = m, r2 = void 0);
|
|
598
1261
|
const x2 = c2 === m && t2[i3 + 1].startsWith("/>") ? " " : "";
|
|
599
|
-
l2 += c2 === f ? s3 + n$1 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e + s3.slice(d2) + h + x2) : s3 + h + (-2 === d2 ? i3 : x2);
|
|
1262
|
+
l2 += c2 === f ? s3 + n$1 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e$2 + s3.slice(d2) + h + x2) : s3 + h + (-2 === d2 ? i3 : x2);
|
|
600
1263
|
}
|
|
601
1264
|
return [P(t2, l2 + (t2[s2] || "<?>") + (2 === i2 ? "</svg>" : 3 === i2 ? "</math>" : "")), o2];
|
|
602
1265
|
};
|
|
@@ -612,7 +1275,7 @@ class N {
|
|
|
612
1275
|
}
|
|
613
1276
|
for (; null !== (r2 = C.nextNode()) && d2.length < u2; ) {
|
|
614
1277
|
if (1 === r2.nodeType) {
|
|
615
|
-
if (r2.hasAttributes()) for (const t3 of r2.getAttributeNames()) if (t3.endsWith(e)) {
|
|
1278
|
+
if (r2.hasAttributes()) for (const t3 of r2.getAttributeNames()) if (t3.endsWith(e$2)) {
|
|
616
1279
|
const i2 = v2[a2++], s3 = r2.getAttribute(t3).split(h), e2 = /([.?@])?(.*)/.exec(i2);
|
|
617
1280
|
d2.push({ type: 1, index: c2, name: e2[2], strings: s3, ctor: "." === e2[1] ? H : "?" === e2[1] ? I : "@" === e2[1] ? L : k }), r2.removeAttribute(t3);
|
|
618
1281
|
} else t3.startsWith(h) && (d2.push({ type: 6, index: c2 }), r2.removeAttribute(t3));
|
|
@@ -868,7 +1531,622 @@ function n2(t2) {
|
|
|
868
1531
|
function r(r2) {
|
|
869
1532
|
return n2({ ...r2, state: true, attribute: false });
|
|
870
1533
|
}
|
|
1534
|
+
const e$1 = (e2, t2, c2) => (c2.configurable = true, c2.enumerable = true, Reflect.decorate && "object" != typeof t2 && Object.defineProperty(e2, t2, c2), c2);
|
|
1535
|
+
function e(e2, r2) {
|
|
1536
|
+
return (n3, s2, i2) => {
|
|
1537
|
+
const o2 = (t2) => t2.renderRoot?.querySelector(e2) ?? null;
|
|
1538
|
+
return e$1(n3, s2, { get() {
|
|
1539
|
+
return o2(this);
|
|
1540
|
+
} });
|
|
1541
|
+
};
|
|
1542
|
+
}
|
|
871
1543
|
const patientProfileCSS = '@charset "UTF-8";\n.claudebernard-patient-profile {\n font-family: var(--custom-font-family, "Ubuntu"), sans-serif;\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n padding: 1rem;\n border-radius: 0.5rem;\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile {\n font-size: 0.8rem;\n }\n}\n.claudebernard-patient-profile__separator {\n border-right: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n}\n.claudebernard-patient-profile__first-info-container {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n gap: 0.5rem;\n}\n@container (max-width: 450px) {\n .claudebernard-patient-profile__first-info-container {\n flex-direction: column;\n gap: 1rem;\n align-items: center;\n }\n}\n.claudebernard-patient-profile__id-info-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 0.5rem;\n}\n.claudebernard-patient-profile__name-info {\n font-size: 1rem;\n}\n.claudebernard-patient-profile__id-info {\n width: fit-content;\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n border-radius: 1rem;\n display: flex;\n flex-direction: row;\n padding: 0 0.8rem;\n gap: 0.5rem;\n}\n.claudebernard-patient-profile__id-info-info {\n padding: 0.2rem 0;\n white-space: nowrap;\n}\n.claudebernard-patient-profile__physical-info-container {\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 1rem;\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile__physical-info-container {\n gap: 0.5rem;\n }\n}\n.claudebernard-patient-profile__physical-info {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n padding: 1rem 0;\n}\n.claudebernard-patient-profile__physical-info-result {\n white-space: nowrap;\n}\n.claudebernard-patient-profile__physical-info-label {\n color: var(--bcbd-gray-600-color, #475569);\n}\n.claudebernard-patient-profile__action-buttons-container {\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-content: center;\n flex-wrap: wrap;\n gap: 1rem;\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile__action-buttons-container {\n gap: 0.5rem;\n }\n}\n.claudebernard-patient-profile__second-info-container {\n margin-top: 1rem;\n display: none;\n}\n.claudebernard-patient-profile__second-info-container.active {\n display: flex;\n flex-direction: column;\n}\n.claudebernard-patient-profile__second-info {\n margin-top: 1rem;\n}\n.claudebernard-patient-profile__second-info bcbd-tooltip {\n display: inline-block;\n}\n.claudebernard-patient-profile__second-info bcbd-tooltip > span {\n font-size: 1rem;\n}\n.claudebernard-patient-profile__second-info-label {\n padding-right: 0.5rem;\n color: var(--bcbd-primary-color, #0C75AD);\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile__second-info-label {\n font-size: 0.8rem;\n }\n}\n.claudebernard-patient-profile__second-info-result.sep-dots > * + *::before {\n content: "•";\n margin: 0 0.5rem;\n}';
|
|
1544
|
+
const sexOptions = [
|
|
1545
|
+
{ value: "male", label: "Masculin" },
|
|
1546
|
+
{ value: "female", label: "Féminin" },
|
|
1547
|
+
{ value: "unknown", label: "Inconnu" }
|
|
1548
|
+
];
|
|
1549
|
+
const hepaticStadeOptions = [
|
|
1550
|
+
{ value: "A", label: "Stade A" },
|
|
1551
|
+
{ value: "B", label: "Stade B" },
|
|
1552
|
+
{ value: "C", label: "Stade C" }
|
|
1553
|
+
];
|
|
1554
|
+
const ageOptions = [
|
|
1555
|
+
{ value: "ans", label: "Ans" },
|
|
1556
|
+
{ value: "mois", label: "Mois" }
|
|
1557
|
+
];
|
|
1558
|
+
const fetchPathologiesByTerm = async (term, params, apiUrl) => {
|
|
1559
|
+
const response = await fetch(`${apiUrl}/search/pathologies/?term=${term}`, {
|
|
1560
|
+
method: "POST",
|
|
1561
|
+
headers: {
|
|
1562
|
+
"Content-Type": "application/json"
|
|
1563
|
+
},
|
|
1564
|
+
body: JSON.stringify(params)
|
|
1565
|
+
});
|
|
1566
|
+
return response.json();
|
|
1567
|
+
};
|
|
1568
|
+
const fetchMoleculesByTerm = async (term, params, apiUrl) => {
|
|
1569
|
+
const response = await fetch(`${apiUrl}/search/molecules/?term=${term}`, {
|
|
1570
|
+
method: "POST",
|
|
1571
|
+
headers: {
|
|
1572
|
+
"Content-Type": "application/json"
|
|
1573
|
+
},
|
|
1574
|
+
body: JSON.stringify(params)
|
|
1575
|
+
});
|
|
1576
|
+
return response.json();
|
|
1577
|
+
};
|
|
1578
|
+
const patientProfileEditionCSS = ".claudebernard-edition-modal {\n font-size: 0.9rem;\n}\n.claudebernard-edition-modal-content {\n display: flex;\n flex-direction: column;\n width: 100%;\n min-width: 60vw;\n height: 100%;\n max-height: 60vh;\n gap: 16px;\n}\n.claudebernard-edition-modal-large-section {\n display: flex;\n flex-direction: column;\n gap: 5px;\n width: 100%;\n}\n.claudebernard-edition-modal-information-section {\n display: flex;\n flex-direction: row;\n gap: 16px;\n}\n.claudebernard-edition-modal-little-section {\n display: flex;\n flex-direction: column;\n gap: 5px;\n flex: 1;\n min-width: 0;\n}\n.claudebernard-edition-modal-little-section bcbd-input {\n height: 100%;\n}\n.claudebernard-edition-modal-pregnant-div {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n.claudebernard-edition-modal-pregnant-div bcbd-input {\n width: 40% !important;\n}\n.claudebernard-edition-modal-action-buttons {\n display: flex;\n justify-content: flex-end;\n height: 100%;\n gap: 16px;\n padding-top: 10px;\n padding-bottom: 30px;\n align-items: flex-end;\n}\n.claudebernard-edition-modal-subtitle {\n font-weight: 600;\n font-size: 1.1rem;\n color: var(--bcbd-primary-color);\n}\n.claudebernard-edition-modal-error-message {\n color: var(--bcbd-danger-color);\n font-size: 0.8rem;\n}\n.claudebernard-edition-modal-age-input-group {\n display: flex;\n gap: 8px;\n}\n.claudebernard-edition-modal-age-input-group bcbd-input {\n width: 50% !important;\n}\n.claudebernard-edition-modal-age-input-group bcbd-select {\n width: 50% !important;\n}\n.claudebernard-edition-modal-fieldset {\n border: 1px solid var(--bcbd-border-gray-color);\n margin-inline: 0;\n border-radius: 4px;\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\nbcbd-checkbox {\n --bcbd-checkbox-font-size: .9rem;\n}";
|
|
1579
|
+
var __defProp$1 = Object.defineProperty;
|
|
1580
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
1581
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
1582
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
1583
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1584
|
+
if (decorator = decorators[i2])
|
|
1585
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1586
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
1587
|
+
return result;
|
|
1588
|
+
};
|
|
1589
|
+
let PatientProfileEdition = class extends i {
|
|
1590
|
+
constructor() {
|
|
1591
|
+
super(...arguments);
|
|
1592
|
+
this.patientAge = 0;
|
|
1593
|
+
this.patientUnitAge = "ans";
|
|
1594
|
+
this.patientWeight = 0;
|
|
1595
|
+
this.patientHeight = 0;
|
|
1596
|
+
this.creatinineByMg = 0;
|
|
1597
|
+
this.creatinineByUmol = 0;
|
|
1598
|
+
this.clairanceCreatinine = 0;
|
|
1599
|
+
this.dfg = 0;
|
|
1600
|
+
this.defaultPatientUnitAge = {};
|
|
1601
|
+
this.defaultPatientSex = {};
|
|
1602
|
+
this.defaultHepaticStade = {};
|
|
1603
|
+
this.isPregnancyDivVisible = false;
|
|
1604
|
+
this.isPregnant = false;
|
|
1605
|
+
this.breastfeeding = false;
|
|
1606
|
+
this.ageErrorMessageInput = "";
|
|
1607
|
+
this.sizeErrorMessageInput = "";
|
|
1608
|
+
this.weightErrorMessageInput = "";
|
|
1609
|
+
this.pathologiesApiErrorMessage = "";
|
|
1610
|
+
this.allergiesApiErrorMessage = "";
|
|
1611
|
+
this.pathologyOptions = [];
|
|
1612
|
+
this.allergyOptions = [];
|
|
1613
|
+
this.selectedPathologyOptions = [];
|
|
1614
|
+
this.selectedAllergyOptions = [];
|
|
1615
|
+
}
|
|
1616
|
+
open() {
|
|
1617
|
+
this.editionModalElement.open();
|
|
1618
|
+
}
|
|
1619
|
+
modifyGender() {
|
|
1620
|
+
if (this.genderSelect?.value === "male") {
|
|
1621
|
+
this.isPregnancyDivVisible = false;
|
|
1622
|
+
} else {
|
|
1623
|
+
const age = Number(this.ageInput?.value ?? 0);
|
|
1624
|
+
this.isPregnancyDivVisible = this.patientUnitAge === "ans" && (age >= 12 && age <= 55);
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
firstUpdated() {
|
|
1628
|
+
this.defaultPatientSex = this.getPatientSexFromProfile();
|
|
1629
|
+
this.defaultHepaticStade = this.getPatientHepaticStadeFromProfile();
|
|
1630
|
+
this.selectedPathologyOptions = getPatientConditionsWithCode(this.patientProfile);
|
|
1631
|
+
this.selectedAllergyOptions = getPatientAllergiesWithCode(this.patientProfile);
|
|
1632
|
+
this.breastfeeding = getPatientBreastfeedingStatus(this.patientProfile);
|
|
1633
|
+
this.isPregnant = getPatientPregnancyStatus(this.patientProfile);
|
|
1634
|
+
const birthDate = getPatientBirthDate(this.patientProfile);
|
|
1635
|
+
if (birthDate) {
|
|
1636
|
+
const today = /* @__PURE__ */ new Date();
|
|
1637
|
+
const yearsDiff = today.getFullYear() - birthDate.getFullYear();
|
|
1638
|
+
const monthsDiff = today.getMonth() - birthDate.getMonth();
|
|
1639
|
+
const monthsDifference = yearsDiff * 12 + monthsDiff;
|
|
1640
|
+
if (monthsDifference < 24) {
|
|
1641
|
+
this.patientAge = monthsDifference;
|
|
1642
|
+
this.patientUnitAge = "mois";
|
|
1643
|
+
this.isPregnancyDivVisible = false;
|
|
1644
|
+
} else {
|
|
1645
|
+
this.patientAge = Math.floor(monthsDifference / 12);
|
|
1646
|
+
this.patientUnitAge = "ans";
|
|
1647
|
+
this.isPregnancyDivVisible = true;
|
|
1648
|
+
}
|
|
1649
|
+
this.defaultPatientUnitAge = {
|
|
1650
|
+
value: this.patientUnitAge,
|
|
1651
|
+
label: ageOptions.find((option) => option.value === this.patientUnitAge)?.label
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
const creatinine = getCreatinine(this.patientProfile);
|
|
1655
|
+
const renalStatus = getPatientRenalInsufficiencyStatus(this.patientProfile);
|
|
1656
|
+
const creatinineByMg = creatinine.find((c2) => c2.unit?.toLowerCase() === "mg/l");
|
|
1657
|
+
const creatinineByUmol = creatinine.find((c2) => c2.unit === "μmol/L");
|
|
1658
|
+
this.clairanceCreatinine = renalStatus?.clearance?.value ?? 0;
|
|
1659
|
+
this.dfg = renalStatus?.gfr?.value ?? 0;
|
|
1660
|
+
this.creatinineByMg = creatinineByMg?.value ?? 0;
|
|
1661
|
+
this.creatinineByUmol = creatinineByUmol?.value ?? 0;
|
|
1662
|
+
}
|
|
1663
|
+
verifyAgeInput() {
|
|
1664
|
+
const age = Number(this.ageInput?.value ?? 0);
|
|
1665
|
+
if (age < 2 && this.patientUnitAge === "ans") {
|
|
1666
|
+
this.ageErrorMessageInput = "L'âge doit être exprimé en mois si inférieur à 2 ans";
|
|
1667
|
+
} else if (age > 150 && this.patientUnitAge === "ans") {
|
|
1668
|
+
this.ageErrorMessageInput = "L'âge ne doit pas dépasser 150 ans";
|
|
1669
|
+
} else if (age > 23 && this.patientUnitAge === "mois") {
|
|
1670
|
+
this.ageErrorMessageInput = "L'âge en mois ne doit pas dépasser 23 mois, veuillez compter en années";
|
|
1671
|
+
} else {
|
|
1672
|
+
this.ageErrorMessageInput = "";
|
|
1673
|
+
}
|
|
1674
|
+
this.ageInput.setAttribute("warning-msg", this.ageErrorMessageInput);
|
|
1675
|
+
if (this.patientUnitAge === "ans" && (age >= 12 && age <= 55)) {
|
|
1676
|
+
if (this.genderSelect?.value !== "male") {
|
|
1677
|
+
this.isPregnancyDivVisible = true;
|
|
1678
|
+
}
|
|
1679
|
+
} else {
|
|
1680
|
+
this.isPregnancyDivVisible = false;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
handleAgeUnit() {
|
|
1684
|
+
this.patientUnitAge = this.ageUnitSelect?.value ?? "ans";
|
|
1685
|
+
this.verifyAgeInput();
|
|
1686
|
+
}
|
|
1687
|
+
verifySizeInput() {
|
|
1688
|
+
const size = Number(this.sizeInput?.value ?? 0);
|
|
1689
|
+
if (size < 1 || size > 399) {
|
|
1690
|
+
this.sizeErrorMessageInput = "La taille n'est pas valide";
|
|
1691
|
+
} else {
|
|
1692
|
+
this.sizeErrorMessageInput = "";
|
|
1693
|
+
}
|
|
1694
|
+
this.sizeInput.setAttribute("warning-msg", this.sizeErrorMessageInput);
|
|
1695
|
+
}
|
|
1696
|
+
verifyWeightInput() {
|
|
1697
|
+
const weight = Number(this.weightInput?.value ?? 0);
|
|
1698
|
+
if (weight > 300) {
|
|
1699
|
+
this.weightErrorMessageInput = "Le poids ne doit pas dépasser 300kg";
|
|
1700
|
+
} else {
|
|
1701
|
+
this.weightErrorMessageInput = "";
|
|
1702
|
+
}
|
|
1703
|
+
this.weightInput.setAttribute("warning-msg", this.weightErrorMessageInput);
|
|
1704
|
+
}
|
|
1705
|
+
getPatientSexFromProfile() {
|
|
1706
|
+
let gender = getPatientGender(this.patientProfile);
|
|
1707
|
+
switch (gender) {
|
|
1708
|
+
case "Homme":
|
|
1709
|
+
gender = "male";
|
|
1710
|
+
break;
|
|
1711
|
+
case "Femme":
|
|
1712
|
+
gender = "female";
|
|
1713
|
+
break;
|
|
1714
|
+
}
|
|
1715
|
+
this.isPregnancyDivVisible = gender !== "Homme";
|
|
1716
|
+
const selectedOption = sexOptions.find((option) => option.value === gender);
|
|
1717
|
+
return selectedOption ? { value: selectedOption.value, label: selectedOption.label } : {};
|
|
1718
|
+
}
|
|
1719
|
+
getPatientHepaticStadeFromProfile() {
|
|
1720
|
+
const renalStade = getPatientHepaticInsufficiencyStade(this.patientProfile);
|
|
1721
|
+
const selectedOption = hepaticStadeOptions.find((option) => option.label === renalStade);
|
|
1722
|
+
return selectedOption ? { value: selectedOption.value, label: selectedOption.label } : {};
|
|
1723
|
+
}
|
|
1724
|
+
handlePregnancy(event) {
|
|
1725
|
+
this.isPregnant = event.detail;
|
|
1726
|
+
}
|
|
1727
|
+
handleBreastfeeding(event) {
|
|
1728
|
+
this.breastfeeding = event.detail;
|
|
1729
|
+
}
|
|
1730
|
+
setFormWithCreatinineUmol() {
|
|
1731
|
+
const inputValue = Number(this.creatinineUmolInput?.value ?? "");
|
|
1732
|
+
if (isNaN(inputValue) || inputValue <= 0) {
|
|
1733
|
+
return;
|
|
1734
|
+
}
|
|
1735
|
+
this.creatinineByUmol = inputValue;
|
|
1736
|
+
const scrMgdl = inputValue / 88.4;
|
|
1737
|
+
if (scrMgdl <= 0) {
|
|
1738
|
+
return;
|
|
1739
|
+
}
|
|
1740
|
+
const age = getPatientAge(this.patientProfile);
|
|
1741
|
+
const weight = getPatientWeight(this.patientProfile);
|
|
1742
|
+
const gender = getPatientGender(this.patientProfile);
|
|
1743
|
+
const isFemale = gender === "Femme";
|
|
1744
|
+
const sexFactor = isFemale ? 0.85 : 1;
|
|
1745
|
+
if (!age || !weight || !gender) {
|
|
1746
|
+
this.clairanceCreatinine = 0;
|
|
1747
|
+
this.creatinineByMg = 0;
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
const clearance = (140 - age) * weight * sexFactor / (72 * scrMgdl);
|
|
1751
|
+
this.clairanceCreatinine = Math.round(clearance);
|
|
1752
|
+
const scrMgl = scrMgdl * 10;
|
|
1753
|
+
this.creatinineByMg = Math.round(scrMgl);
|
|
1754
|
+
}
|
|
1755
|
+
setFormWithCreatinineMgL() {
|
|
1756
|
+
const inputValue = Number(this.creatinineMgLInput?.value ?? "");
|
|
1757
|
+
if (isNaN(inputValue) || inputValue <= 0) {
|
|
1758
|
+
return;
|
|
1759
|
+
}
|
|
1760
|
+
this.creatinineByMg = inputValue;
|
|
1761
|
+
const scrMgdl = inputValue / 10;
|
|
1762
|
+
if (scrMgdl <= 0) {
|
|
1763
|
+
return;
|
|
1764
|
+
}
|
|
1765
|
+
const age = getPatientAge(this.patientProfile);
|
|
1766
|
+
const weight = getPatientWeight(this.patientProfile);
|
|
1767
|
+
const gender = getPatientGender(this.patientProfile);
|
|
1768
|
+
const isFemale = gender === "Femme";
|
|
1769
|
+
const sexFactor = isFemale ? 0.85 : 1;
|
|
1770
|
+
if (!age || !weight || !gender) {
|
|
1771
|
+
this.clairanceCreatinine = 0;
|
|
1772
|
+
this.creatinineByUmol = 0;
|
|
1773
|
+
return;
|
|
1774
|
+
}
|
|
1775
|
+
const clearance = (140 - age) * weight * sexFactor / (72 * scrMgdl);
|
|
1776
|
+
this.clairanceCreatinine = Math.round(clearance);
|
|
1777
|
+
const scrUmolL = scrMgdl * 88.4;
|
|
1778
|
+
this.creatinineByUmol = Math.round(scrUmolL);
|
|
1779
|
+
}
|
|
1780
|
+
setFormWithClairance() {
|
|
1781
|
+
const inputValue = Number(this.clairanceCreatinineInput?.value ?? "");
|
|
1782
|
+
if (isNaN(inputValue) || inputValue <= 0) {
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
this.clairanceCreatinine = inputValue;
|
|
1786
|
+
const age = getPatientAge(this.patientProfile);
|
|
1787
|
+
const weight = getPatientWeight(this.patientProfile);
|
|
1788
|
+
const gender = getPatientGender(this.patientProfile);
|
|
1789
|
+
if (!age || !weight || !gender) {
|
|
1790
|
+
this.creatinineByMg = 0;
|
|
1791
|
+
this.creatinineByUmol = 0;
|
|
1792
|
+
return;
|
|
1793
|
+
}
|
|
1794
|
+
const isFemale = gender === "Femme";
|
|
1795
|
+
const computed = computeCreatinineFromClearance(inputValue, age, weight, isFemale);
|
|
1796
|
+
const creatinineByMg = computed.find((c2) => c2.unit?.toLowerCase() === "mg/l");
|
|
1797
|
+
const creatinineByUmol = computed.find((c2) => c2.unit === "μmol/L");
|
|
1798
|
+
this.creatinineByMg = creatinineByMg?.value ?? 0;
|
|
1799
|
+
this.creatinineByMg = Math.round(this.creatinineByMg);
|
|
1800
|
+
this.creatinineByUmol = creatinineByUmol?.value ?? 0;
|
|
1801
|
+
this.creatinineByUmol = Math.round(this.creatinineByUmol);
|
|
1802
|
+
}
|
|
1803
|
+
apiReturntoSelectOption(pathology) {
|
|
1804
|
+
return {
|
|
1805
|
+
value: pathology.code,
|
|
1806
|
+
label: pathology.label,
|
|
1807
|
+
subType: pathology.subType
|
|
1808
|
+
};
|
|
1809
|
+
}
|
|
1810
|
+
searchPathologies(event) {
|
|
1811
|
+
if (!this.apiUrl) {
|
|
1812
|
+
return;
|
|
1813
|
+
}
|
|
1814
|
+
const valueSearch = event.detail.value;
|
|
1815
|
+
if (valueSearch.length > 2) {
|
|
1816
|
+
fetchPathologiesByTerm(valueSearch, new SearchRequestBody({}), this.apiUrl).then((response) => {
|
|
1817
|
+
this.pathologyOptions = [];
|
|
1818
|
+
this.pathologyOptions = response.content.map((pathology) => this.apiReturntoSelectOption(pathology));
|
|
1819
|
+
this.pathologiesApiErrorMessage = "";
|
|
1820
|
+
}).catch(() => {
|
|
1821
|
+
this.pathologiesApiErrorMessage = "Erreur lors de la récupération des pathologies";
|
|
1822
|
+
this.pathologyOptions = [];
|
|
1823
|
+
});
|
|
1824
|
+
} else {
|
|
1825
|
+
this.pathologyOptions = [];
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
updatePathologies(event) {
|
|
1829
|
+
const newValues = event.detail;
|
|
1830
|
+
const newSelections = newValues.filter((value) => !this.selectedPathologyOptions.some((option) => option.value === value)).map((value) => this.pathologyOptions.find((option) => option.value === value)).filter((option) => option !== void 0);
|
|
1831
|
+
const updatedSelections = this.selectedPathologyOptions.filter((option) => newValues.includes(option.value));
|
|
1832
|
+
this.selectedPathologyOptions = [...updatedSelections, ...newSelections];
|
|
1833
|
+
this.pathologyOptions = [];
|
|
1834
|
+
}
|
|
1835
|
+
searchAllergies(event) {
|
|
1836
|
+
if (!this.apiUrl) {
|
|
1837
|
+
return;
|
|
1838
|
+
}
|
|
1839
|
+
const valueSearch = event.detail.value;
|
|
1840
|
+
if (valueSearch.length > 2) {
|
|
1841
|
+
fetchMoleculesByTerm(valueSearch, new SearchRequestBody({}), this.apiUrl).then((response) => {
|
|
1842
|
+
this.allergyOptions = [];
|
|
1843
|
+
this.allergyOptions = response.content.map((allergy) => this.apiReturntoSelectOption(allergy));
|
|
1844
|
+
this.allergiesApiErrorMessage = "";
|
|
1845
|
+
}).catch(() => {
|
|
1846
|
+
this.allergiesApiErrorMessage = "Erreur lors de la récupération des allergies";
|
|
1847
|
+
this.allergyOptions = [];
|
|
1848
|
+
});
|
|
1849
|
+
} else {
|
|
1850
|
+
this.allergyOptions = [];
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
updateAllergies(event) {
|
|
1854
|
+
const newValues = event.detail;
|
|
1855
|
+
const newSelections = newValues.filter((value) => !this.selectedAllergyOptions.some((option) => option.value === value)).map((value) => this.allergyOptions.find((option) => option.value === value)).filter((option) => option !== void 0);
|
|
1856
|
+
const updatedSelections = this.selectedAllergyOptions.filter((option) => newValues.includes(option.value));
|
|
1857
|
+
this.selectedAllergyOptions = [...updatedSelections, ...newSelections];
|
|
1858
|
+
this.allergyOptions = [];
|
|
1859
|
+
}
|
|
1860
|
+
// eslint-disable-next-line complexity
|
|
1861
|
+
validateForm() {
|
|
1862
|
+
if (!this.patientProfile) {
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
const size = Number(this.sizeInput?.value ?? "");
|
|
1866
|
+
const age = Number(this.ageInput?.value ?? "");
|
|
1867
|
+
const ageUnit = this.ageUnitSelect?.value ?? "ans";
|
|
1868
|
+
const weight = Number(this.weightInput?.value ?? "");
|
|
1869
|
+
const gender = this.genderSelect?.value ?? "";
|
|
1870
|
+
const creatinineUmol = Number(this.creatinineUmolInput?.value ?? "");
|
|
1871
|
+
const creatinineMg = Number(this.creatinineMgLInput?.value ?? "");
|
|
1872
|
+
const clairanceCreatinine = Number(this.clairanceCreatinineInput?.value ?? "");
|
|
1873
|
+
const dfg = Number(this.dfgInput?.value ?? "");
|
|
1874
|
+
const gestationalWeeks = Number(this.gestationalWeeksInput?.value ?? "");
|
|
1875
|
+
const hepaticStade = this.hepaticStadeSelect?.value ?? "";
|
|
1876
|
+
const childPughScore2 = Number(this.childPughInput?.value ?? "");
|
|
1877
|
+
if (!isNaN(age) || age > 0) {
|
|
1878
|
+
setPatientAge(this.patientProfile, age, ageUnit);
|
|
1879
|
+
}
|
|
1880
|
+
if (!isNaN(weight) || weight > 0) {
|
|
1881
|
+
setPatientWeight(this.patientProfile, weight);
|
|
1882
|
+
}
|
|
1883
|
+
if (!isNaN(size) || size > 0) {
|
|
1884
|
+
setPatientHeight(this.patientProfile, size);
|
|
1885
|
+
}
|
|
1886
|
+
if (gender === "male" || gender === "female" || gender === "unknown") {
|
|
1887
|
+
setPatientGender(this.patientProfile, gender);
|
|
1888
|
+
}
|
|
1889
|
+
if (!isNaN(creatinineUmol) || creatinineUmol > 0) {
|
|
1890
|
+
setCreatinineByUmolL(this.patientProfile, creatinineUmol);
|
|
1891
|
+
}
|
|
1892
|
+
if (!isNaN(creatinineMg) || creatinineMg > 0) {
|
|
1893
|
+
setCreatinineBymgL(this.patientProfile, creatinineMg);
|
|
1894
|
+
}
|
|
1895
|
+
if (!isNaN(clairanceCreatinine) || clairanceCreatinine > 0) {
|
|
1896
|
+
setPatientClearance(this.patientProfile, clairanceCreatinine);
|
|
1897
|
+
}
|
|
1898
|
+
if (!isNaN(dfg) || dfg > 0) {
|
|
1899
|
+
setPatientGFRByBSA(this.patientProfile, dfg);
|
|
1900
|
+
}
|
|
1901
|
+
if (hepaticStade === "A" || hepaticStade === "B" || hepaticStade === "C") {
|
|
1902
|
+
setPatientHepaticInsufficiencyStatus(this.patientProfile, hepaticStade, childPughScore2);
|
|
1903
|
+
}
|
|
1904
|
+
if (!this.isPregnancyDivVisible) {
|
|
1905
|
+
this.isPregnant = false;
|
|
1906
|
+
this.breastfeeding = false;
|
|
1907
|
+
}
|
|
1908
|
+
if (!this.isPregnant) {
|
|
1909
|
+
setPatientAmenorrheaStatus(this.patientProfile, 0);
|
|
1910
|
+
} else if (!isNaN(gestationalWeeks)) {
|
|
1911
|
+
setPatientAmenorrheaStatus(this.patientProfile, gestationalWeeks);
|
|
1912
|
+
}
|
|
1913
|
+
setPatientBreastfeedingStatus(this.patientProfile, this.breastfeeding);
|
|
1914
|
+
setPatientPregnancyStatus(this.patientProfile, this.isPregnant);
|
|
1915
|
+
setPatientConditions(this.patientProfile, this.selectedPathologyOptions);
|
|
1916
|
+
setPatientAllergies(this.patientProfile, this.selectedAllergyOptions);
|
|
1917
|
+
const updatedProfile = {
|
|
1918
|
+
...this.patientProfile,
|
|
1919
|
+
entry: this.patientProfile?.entry ? [...this.patientProfile.entry] : void 0
|
|
1920
|
+
};
|
|
1921
|
+
this.dispatchEvent(new CustomEvent("editPatientProfile", {
|
|
1922
|
+
detail: { patientProfile: updatedProfile },
|
|
1923
|
+
bubbles: true,
|
|
1924
|
+
composed: true
|
|
1925
|
+
}));
|
|
1926
|
+
this.editionModalElement.close();
|
|
1927
|
+
}
|
|
1928
|
+
render() {
|
|
1929
|
+
return x`
|
|
1930
|
+
<bcbd-modal title="Édition du profil patient" persistent id="patient-profile-edition-modal" class="${PREFIX}-edition-modal" data-test-id="patient-profile-edition-modal" >
|
|
1931
|
+
<div class="${PREFIX}-edition-modal-content">
|
|
1932
|
+
<div class="${PREFIX}-edition-modal-large-section">
|
|
1933
|
+
<bcbd-select data-test-id="name-select" .selectedOptions=${{ value: "1", label: getPatientName(this.patientProfile) }} readonly></bcbd-select>
|
|
1934
|
+
</div>
|
|
1935
|
+
<div class="${PREFIX}-edition-modal-information-section">
|
|
1936
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1937
|
+
<span>Sexe</span>
|
|
1938
|
+
<bcbd-select data-test-id="sex-select" id="genderSelect" placeholder="Choisir" .options=${sexOptions} .selectedOptions=${this.defaultPatientSex} @change=${this.modifyGender}></bcbd-select>
|
|
1939
|
+
</div>
|
|
1940
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1941
|
+
<span>Taille (cm)</span>
|
|
1942
|
+
<bcbd-input data-test-id="size-input" id="sizeInput" type="number" .value=${getPatientHeight(this.patientProfile) ?? ""} warning-msg="" @input=${this.verifySizeInput}></bcbd-input>
|
|
1943
|
+
</div>
|
|
1944
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1945
|
+
<span>Age</span>
|
|
1946
|
+
<div class="${PREFIX}-edition-modal-age-input-group">
|
|
1947
|
+
<bcbd-input data-test-id="age-input" id="ageInput" type="number" .value=${this.patientAge} warning-msg="" @input=${this.verifyAgeInput}></bcbd-input>
|
|
1948
|
+
<bcbd-select data-test-id="age-unit-select" id="ageUnitSelect" .options=${ageOptions} .selectedOptions=${this.defaultPatientUnitAge} @change=${this.handleAgeUnit}></bcbd-select>
|
|
1949
|
+
</div>
|
|
1950
|
+
</div>
|
|
1951
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1952
|
+
<span>Poids (kg)</span>
|
|
1953
|
+
<bcbd-input data-test-id="weight-input" id="weightInput" type="number" .value=${getPatientWeight(this.patientProfile) ?? ""} warning-msg="" @input=${this.verifyWeightInput}></bcbd-input>
|
|
1954
|
+
</div>
|
|
1955
|
+
</div>
|
|
1956
|
+
${this.isPregnancyDivVisible ? x`
|
|
1957
|
+
<div class="${PREFIX}-edition-modal-pregnant-div">
|
|
1958
|
+
<bcbd-checkbox data-test-id="pregnancy-checkbox" id="pregnancyCheckbox" .checked=${this.isPregnant} label="Grossesse" color="primary" @change=${this.handlePregnancy}></bcbd-checkbox>
|
|
1959
|
+
<bcbd-input data-test-id="gestational-input" id="gestationalWeeksInput" .value=${getPatientAmenorrheaStatus(this.patientProfile)} type="number" warning-msg="" label="Nombre de semaines" placeholder=""></bcbd-input>
|
|
1960
|
+
<bcbd-checkbox data-test-id="breastfeeding-checkbox" id="breastfeedingCheckbox" .checked=${this.breastfeeding} label="Allaitement" color="primary" @change=${this.handleBreastfeeding}></bcbd-checkbox>
|
|
1961
|
+
</div>` : x` `}
|
|
1962
|
+
|
|
1963
|
+
<div class="${PREFIX}-edition-modal-large-section">
|
|
1964
|
+
<span>Pathologies suivies</span>
|
|
1965
|
+
${this.pathologiesApiErrorMessage !== "" ? x`<span class="${PREFIX}-edition-modal-error-message">${this.pathologiesApiErrorMessage}</span>` : x` `}
|
|
1966
|
+
<bcbd-select data-test-id="pathologies-select" id="pathologiesSelect" use-input multiple
|
|
1967
|
+
.selectedOptions=${this.selectedPathologyOptions} .options=${this.pathologyOptions}
|
|
1968
|
+
@filter=${this.searchPathologies} @change=${this.updatePathologies}></bcbd-select>
|
|
1969
|
+
</div>
|
|
1970
|
+
<div class="${PREFIX}-edition-modal-large-section">
|
|
1971
|
+
<span>Allergies</span>
|
|
1972
|
+
${this.allergiesApiErrorMessage !== "" ? x`<span class="${PREFIX}-edition-modal-error-message">${this.allergiesApiErrorMessage}</span>` : x` `}
|
|
1973
|
+
<bcbd-select data-test-id="allergies-select" id="allergiesSelect" use-input multiple
|
|
1974
|
+
.selectedOptions=${this.selectedAllergyOptions} .options=${this.allergyOptions}
|
|
1975
|
+
@filter=${this.searchAllergies} @change=${this.updateAllergies}
|
|
1976
|
+
></bcbd-select>
|
|
1977
|
+
</div>
|
|
1978
|
+
<fieldset class="${PREFIX}-edition-modal-fieldset" data-test-id="renal-insufficiency-fieldset">
|
|
1979
|
+
<legend class="${PREFIX}-edition-modal-subtitle">
|
|
1980
|
+
<span>Insuffisance rénale</span>
|
|
1981
|
+
</legend>
|
|
1982
|
+
<div class="${PREFIX}-edition-modal-information-section">
|
|
1983
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1984
|
+
<span>Créatininémie (μmol/L)</span>
|
|
1985
|
+
<bcbd-input data-test-id="creatinine-umol-input" id="creatinineUmolInput" type="number" .value=${this.creatinineByUmol <= 0 ? "" : this.creatinineByUmol} warning-msg="" @input=${this.setFormWithCreatinineUmol}></bcbd-input>
|
|
1986
|
+
</div>
|
|
1987
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1988
|
+
<span>Créatininémie (mg/L)</span>
|
|
1989
|
+
<bcbd-input data-test-id="creatinine-mgl-input" id="creatininemgLInput" type="number" .value=${this.creatinineByMg <= 0 ? "" : this.creatinineByMg} warning-msg="" @input=${this.setFormWithCreatinineMgL}></bcbd-input>
|
|
1990
|
+
</div>
|
|
1991
|
+
</div>
|
|
1992
|
+
<div class="${PREFIX}-edition-modal-information-section">
|
|
1993
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1994
|
+
<span>Clairance créatinine (ml/min)</span>
|
|
1995
|
+
<bcbd-input data-test-id="clearance-input" id="clairanceCreatinineInput" type="number" .value=${this.clairanceCreatinine <= 0 ? "" : this.clairanceCreatinine} warning-msg="" @input=${this.setFormWithClairance}></bcbd-input>
|
|
1996
|
+
</div>
|
|
1997
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1998
|
+
<span>DFG (mL/min/1.73.m2)</span>
|
|
1999
|
+
<bcbd-input data-test-id="dfg-input" id="dfgInput" type="number" .value=${this.dfg <= 0 ? "" : this.dfg} warning-msg=""></bcbd-input>
|
|
2000
|
+
</div>
|
|
2001
|
+
</div>
|
|
2002
|
+
</fieldset>
|
|
2003
|
+
|
|
2004
|
+
<fieldset class="${PREFIX}-edition-modal-fieldset" data-test-id="hepatic-insufficiency-fieldset">
|
|
2005
|
+
<legend class="${PREFIX}-edition-modal-subtitle">
|
|
2006
|
+
<span>Insuffisance hépatique</span>
|
|
2007
|
+
</legend>
|
|
2008
|
+
<div class="${PREFIX}-edition-modal-information-section">
|
|
2009
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
2010
|
+
<span>Stade de l'insuffisance hépatique</span>
|
|
2011
|
+
<bcbd-select data-test-id="hepatic-stade-select" id="hepaticStadeSelect" .options=${hepaticStadeOptions} .selectedOptions=${this.defaultHepaticStade}></bcbd-select>
|
|
2012
|
+
</div>
|
|
2013
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
2014
|
+
<span>Score de Child-Pugh</span>
|
|
2015
|
+
<bcbd-input data-test-id="hepatic-score-input" id="childPughInput" type="number" warning-msg="" .value=${getPatientHepaticInsufficiencyScore(this.patientProfile)}></bcbd-input>
|
|
2016
|
+
</div>
|
|
2017
|
+
</div>
|
|
2018
|
+
</fieldset>
|
|
2019
|
+
|
|
2020
|
+
<div class="${PREFIX}-edition-modal-action-buttons" data-test-id="action-buttons">
|
|
2021
|
+
<bcbd-button ?disabled=${this.ageErrorMessageInput !== "" || this.sizeErrorMessageInput !== "" || this.weightErrorMessageInput !== ""}
|
|
2022
|
+
data-test-id="save-button" background-color="primary" @click=${this.validateForm}>Valider</bcbd-button>
|
|
2023
|
+
<bcbd-button data-test-id="cancel-button" outlined background-color="black" @click=${() => this.editionModalElement.close()}>Annuler</bcbd-button>
|
|
2024
|
+
</div>
|
|
2025
|
+
</div>
|
|
2026
|
+
</bcbd-modal>`;
|
|
2027
|
+
}
|
|
2028
|
+
};
|
|
2029
|
+
PatientProfileEdition.styles = i$3`${r$4(patientProfileEditionCSS)}`;
|
|
2030
|
+
__decorateClass$1([
|
|
2031
|
+
n2({ type: Object, attribute: "patient-profile" })
|
|
2032
|
+
], PatientProfileEdition.prototype, "patientProfile", 2);
|
|
2033
|
+
__decorateClass$1([
|
|
2034
|
+
n2({ type: String, attribute: "api-url" })
|
|
2035
|
+
], PatientProfileEdition.prototype, "apiUrl", 2);
|
|
2036
|
+
__decorateClass$1([
|
|
2037
|
+
n2({ type: String, attribute: "api-key" })
|
|
2038
|
+
], PatientProfileEdition.prototype, "apiKey", 2);
|
|
2039
|
+
__decorateClass$1([
|
|
2040
|
+
r()
|
|
2041
|
+
], PatientProfileEdition.prototype, "patientAge", 2);
|
|
2042
|
+
__decorateClass$1([
|
|
2043
|
+
r()
|
|
2044
|
+
], PatientProfileEdition.prototype, "patientUnitAge", 2);
|
|
2045
|
+
__decorateClass$1([
|
|
2046
|
+
r()
|
|
2047
|
+
], PatientProfileEdition.prototype, "patientWeight", 2);
|
|
2048
|
+
__decorateClass$1([
|
|
2049
|
+
r()
|
|
2050
|
+
], PatientProfileEdition.prototype, "patientHeight", 2);
|
|
2051
|
+
__decorateClass$1([
|
|
2052
|
+
r()
|
|
2053
|
+
], PatientProfileEdition.prototype, "creatinineByMg", 2);
|
|
2054
|
+
__decorateClass$1([
|
|
2055
|
+
r()
|
|
2056
|
+
], PatientProfileEdition.prototype, "creatinineByUmol", 2);
|
|
2057
|
+
__decorateClass$1([
|
|
2058
|
+
r()
|
|
2059
|
+
], PatientProfileEdition.prototype, "clairanceCreatinine", 2);
|
|
2060
|
+
__decorateClass$1([
|
|
2061
|
+
r()
|
|
2062
|
+
], PatientProfileEdition.prototype, "dfg", 2);
|
|
2063
|
+
__decorateClass$1([
|
|
2064
|
+
r()
|
|
2065
|
+
], PatientProfileEdition.prototype, "defaultPatientUnitAge", 2);
|
|
2066
|
+
__decorateClass$1([
|
|
2067
|
+
r()
|
|
2068
|
+
], PatientProfileEdition.prototype, "defaultPatientSex", 2);
|
|
2069
|
+
__decorateClass$1([
|
|
2070
|
+
r()
|
|
2071
|
+
], PatientProfileEdition.prototype, "defaultHepaticStade", 2);
|
|
2072
|
+
__decorateClass$1([
|
|
2073
|
+
r()
|
|
2074
|
+
], PatientProfileEdition.prototype, "isPregnancyDivVisible", 2);
|
|
2075
|
+
__decorateClass$1([
|
|
2076
|
+
r()
|
|
2077
|
+
], PatientProfileEdition.prototype, "isPregnant", 2);
|
|
2078
|
+
__decorateClass$1([
|
|
2079
|
+
r()
|
|
2080
|
+
], PatientProfileEdition.prototype, "breastfeeding", 2);
|
|
2081
|
+
__decorateClass$1([
|
|
2082
|
+
r()
|
|
2083
|
+
], PatientProfileEdition.prototype, "ageErrorMessageInput", 2);
|
|
2084
|
+
__decorateClass$1([
|
|
2085
|
+
r()
|
|
2086
|
+
], PatientProfileEdition.prototype, "sizeErrorMessageInput", 2);
|
|
2087
|
+
__decorateClass$1([
|
|
2088
|
+
r()
|
|
2089
|
+
], PatientProfileEdition.prototype, "weightErrorMessageInput", 2);
|
|
2090
|
+
__decorateClass$1([
|
|
2091
|
+
r()
|
|
2092
|
+
], PatientProfileEdition.prototype, "pathologiesApiErrorMessage", 2);
|
|
2093
|
+
__decorateClass$1([
|
|
2094
|
+
r()
|
|
2095
|
+
], PatientProfileEdition.prototype, "allergiesApiErrorMessage", 2);
|
|
2096
|
+
__decorateClass$1([
|
|
2097
|
+
r()
|
|
2098
|
+
], PatientProfileEdition.prototype, "pathologyOptions", 2);
|
|
2099
|
+
__decorateClass$1([
|
|
2100
|
+
r()
|
|
2101
|
+
], PatientProfileEdition.prototype, "allergyOptions", 2);
|
|
2102
|
+
__decorateClass$1([
|
|
2103
|
+
r()
|
|
2104
|
+
], PatientProfileEdition.prototype, "selectedPathologyOptions", 2);
|
|
2105
|
+
__decorateClass$1([
|
|
2106
|
+
r()
|
|
2107
|
+
], PatientProfileEdition.prototype, "selectedAllergyOptions", 2);
|
|
2108
|
+
__decorateClass$1([
|
|
2109
|
+
e("#sizeInput")
|
|
2110
|
+
], PatientProfileEdition.prototype, "sizeInput", 2);
|
|
2111
|
+
__decorateClass$1([
|
|
2112
|
+
e("#ageInput")
|
|
2113
|
+
], PatientProfileEdition.prototype, "ageInput", 2);
|
|
2114
|
+
__decorateClass$1([
|
|
2115
|
+
e("#weightInput")
|
|
2116
|
+
], PatientProfileEdition.prototype, "weightInput", 2);
|
|
2117
|
+
__decorateClass$1([
|
|
2118
|
+
e("#creatinineUmolInput")
|
|
2119
|
+
], PatientProfileEdition.prototype, "creatinineUmolInput", 2);
|
|
2120
|
+
__decorateClass$1([
|
|
2121
|
+
e("#creatininemgLInput")
|
|
2122
|
+
], PatientProfileEdition.prototype, "creatinineMgLInput", 2);
|
|
2123
|
+
__decorateClass$1([
|
|
2124
|
+
e("#clairanceCreatinineInput")
|
|
2125
|
+
], PatientProfileEdition.prototype, "clairanceCreatinineInput", 2);
|
|
2126
|
+
__decorateClass$1([
|
|
2127
|
+
e("#patient-profile-edition-modal")
|
|
2128
|
+
], PatientProfileEdition.prototype, "editionModalElement", 2);
|
|
2129
|
+
__decorateClass$1([
|
|
2130
|
+
e("#dfgInput")
|
|
2131
|
+
], PatientProfileEdition.prototype, "dfgInput", 2);
|
|
2132
|
+
__decorateClass$1([
|
|
2133
|
+
e("#genderSelect")
|
|
2134
|
+
], PatientProfileEdition.prototype, "genderSelect", 2);
|
|
2135
|
+
__decorateClass$1([
|
|
2136
|
+
e("#gestationalWeeksInput")
|
|
2137
|
+
], PatientProfileEdition.prototype, "gestationalWeeksInput", 2);
|
|
2138
|
+
__decorateClass$1([
|
|
2139
|
+
e("#hepaticStadeSelect")
|
|
2140
|
+
], PatientProfileEdition.prototype, "hepaticStadeSelect", 2);
|
|
2141
|
+
__decorateClass$1([
|
|
2142
|
+
e("#childPughInput")
|
|
2143
|
+
], PatientProfileEdition.prototype, "childPughInput", 2);
|
|
2144
|
+
__decorateClass$1([
|
|
2145
|
+
e("#ageUnitSelect")
|
|
2146
|
+
], PatientProfileEdition.prototype, "ageUnitSelect", 2);
|
|
2147
|
+
PatientProfileEdition = __decorateClass$1([
|
|
2148
|
+
t("bcb-patient-profile-edition")
|
|
2149
|
+
], PatientProfileEdition);
|
|
872
2150
|
var __defProp = Object.defineProperty;
|
|
873
2151
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
874
2152
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -883,7 +2161,9 @@ let PatientProfile = class extends i {
|
|
|
883
2161
|
constructor() {
|
|
884
2162
|
super(...arguments);
|
|
885
2163
|
this.editButtonVisible = true;
|
|
2164
|
+
this.apiUrl = "https://api-dev.claudebernard.fr";
|
|
886
2165
|
this.moreInformationVisible = false;
|
|
2166
|
+
this.patientAgeUnit = "ans";
|
|
887
2167
|
}
|
|
888
2168
|
handleMoreInformation() {
|
|
889
2169
|
this.moreInformationVisible = !this.moreInformationVisible;
|
|
@@ -974,6 +2254,29 @@ let PatientProfile = class extends i {
|
|
|
974
2254
|
});
|
|
975
2255
|
return x`${items}`;
|
|
976
2256
|
}
|
|
2257
|
+
openEditionModal() {
|
|
2258
|
+
this.editionModalElement.open();
|
|
2259
|
+
}
|
|
2260
|
+
editProfilePatient(event) {
|
|
2261
|
+
this.patientProfile = event.detail.patientProfile;
|
|
2262
|
+
this.dispatchEvent(new CustomEvent("patientProfileUpdated", { detail: { patientProfile: this.patientProfile } }));
|
|
2263
|
+
}
|
|
2264
|
+
getPatientAge() {
|
|
2265
|
+
const age = getPatientBirthDate(this.patientProfile);
|
|
2266
|
+
if (age) {
|
|
2267
|
+
const today = /* @__PURE__ */ new Date();
|
|
2268
|
+
const yearsDiff = today.getFullYear() - age.getFullYear();
|
|
2269
|
+
const monthsDiff = today.getMonth() - age.getMonth();
|
|
2270
|
+
const monthsDifference = yearsDiff * 12 + monthsDiff;
|
|
2271
|
+
if (monthsDifference < 24) {
|
|
2272
|
+
this.patientAgeUnit = "mois";
|
|
2273
|
+
return monthsDifference <= 0 ? 0 : monthsDifference;
|
|
2274
|
+
}
|
|
2275
|
+
this.patientAgeUnit = "ans";
|
|
2276
|
+
return Math.floor(monthsDifference / 12);
|
|
2277
|
+
}
|
|
2278
|
+
return null;
|
|
2279
|
+
}
|
|
977
2280
|
render() {
|
|
978
2281
|
return x`
|
|
979
2282
|
<div class="${PREFIX}-patient-profile">
|
|
@@ -989,7 +2292,7 @@ let PatientProfile = class extends i {
|
|
|
989
2292
|
<div class="${PREFIX}-patient-profile__separator">
|
|
990
2293
|
</div>
|
|
991
2294
|
<div class="${PREFIX}-patient-profile__id-info-info" data-test-id="patient-age">
|
|
992
|
-
${getPatientAge(this.
|
|
2295
|
+
${this.getPatientAge()} ${this.patientAgeUnit}
|
|
993
2296
|
</div>
|
|
994
2297
|
</div>
|
|
995
2298
|
</div>
|
|
@@ -1026,7 +2329,7 @@ let PatientProfile = class extends i {
|
|
|
1026
2329
|
</div>
|
|
1027
2330
|
|
|
1028
2331
|
<div class="${PREFIX}-patient-profile__action-buttons-container" data-test-id="action-buttons">
|
|
1029
|
-
${this.editButtonVisible || this.editButtonVisible === void 0 ? x`<bcbd-button icon="pencil" size="medium" background-color="black"
|
|
2332
|
+
${this.editButtonVisible || this.editButtonVisible === void 0 ? x`<bcbd-button icon="pencil" size="medium" background-color="black" outlined data-test-id="modify-button" @click=${this.openEditionModal}></bcbd-button>` : E}
|
|
1030
2333
|
<bcbd-button icon=${this.moreInformationVisible ? "chevron-up" : "chevron-down"} size="medium" background-color="primary" @click=${this.handleMoreInformation} data-test-id="visible-button"></bcbd-button>
|
|
1031
2334
|
</div>
|
|
1032
2335
|
</div>
|
|
@@ -1046,9 +2349,11 @@ let PatientProfile = class extends i {
|
|
|
1046
2349
|
|
|
1047
2350
|
<div class="${PREFIX}-patient-profile__second-info" data-test-id="hepatic-insufficiency-section">
|
|
1048
2351
|
<span class="${PREFIX}-patient-profile__second-info-label">Insuffisance hépatique </span>
|
|
1049
|
-
<span class="${PREFIX}-patient-profile__second-info-result">${
|
|
2352
|
+
<span class="${PREFIX}-patient-profile__second-info-result">${getPatientHepaticInsufficiencyStade(this.patientProfile)} </span>
|
|
1050
2353
|
</div>
|
|
1051
2354
|
</div>
|
|
2355
|
+
<bcb-patient-profile-edition .patientProfile=${this.patientProfile} .apiUrl=${this.apiUrl} .apiKey=${this.apiKey}
|
|
2356
|
+
@editPatientProfile=${this.editProfilePatient}></bcb-patient-profile-edition>
|
|
1052
2357
|
</div>
|
|
1053
2358
|
`;
|
|
1054
2359
|
}
|
|
@@ -1060,9 +2365,21 @@ __decorateClass([
|
|
|
1060
2365
|
__decorateClass([
|
|
1061
2366
|
n2({ type: Boolean, attribute: "edit-button-visible" })
|
|
1062
2367
|
], PatientProfile.prototype, "editButtonVisible", 2);
|
|
2368
|
+
__decorateClass([
|
|
2369
|
+
n2({ type: String, attribute: "api-url" })
|
|
2370
|
+
], PatientProfile.prototype, "apiUrl", 2);
|
|
2371
|
+
__decorateClass([
|
|
2372
|
+
n2({ type: String, attribute: "api-key" })
|
|
2373
|
+
], PatientProfile.prototype, "apiKey", 2);
|
|
1063
2374
|
__decorateClass([
|
|
1064
2375
|
r()
|
|
1065
2376
|
], PatientProfile.prototype, "moreInformationVisible", 2);
|
|
2377
|
+
__decorateClass([
|
|
2378
|
+
r()
|
|
2379
|
+
], PatientProfile.prototype, "patientAgeUnit", 2);
|
|
2380
|
+
__decorateClass([
|
|
2381
|
+
e("bcb-patient-profile-edition")
|
|
2382
|
+
], PatientProfile.prototype, "editionModalElement", 2);
|
|
1066
2383
|
PatientProfile = __decorateClass([
|
|
1067
2384
|
t("bcb-patient-profile")
|
|
1068
2385
|
], PatientProfile);
|