@claudebernard/patient-profile-element 0.6.3 → 0.6.5
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 +3156 -2067
- package/dist/patient-profile.es.js +860 -796
- package/package.json +4 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SearchRequestBody } from "@claudebernard/types";
|
|
2
1
|
import "@claudebernard/design-system";
|
|
2
|
+
import { SearchRequestBody } from "@claudebernard/types";
|
|
3
3
|
const PREFIX = "claudebernard";
|
|
4
4
|
function calculateAgeFromBirthDate(birthDate, referenceDate = /* @__PURE__ */ new Date()) {
|
|
5
5
|
const yearsDiff = referenceDate.getFullYear() - birthDate.getFullYear();
|
|
@@ -106,6 +106,66 @@ function getPatientFullUrl(bundle) {
|
|
|
106
106
|
);
|
|
107
107
|
return patientEntry?.fullUrl ?? `Patient/${patientEntry?.resource?.id ?? bundle.id}`;
|
|
108
108
|
}
|
|
109
|
+
function findObservationByCode(bundle, codes) {
|
|
110
|
+
return bundle?.entry?.find(
|
|
111
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some((coding) => codes.includes(coding.code ?? ""))
|
|
112
|
+
)?.resource;
|
|
113
|
+
}
|
|
114
|
+
function findObservationByCodeAndValue(bundle, code, valueCode) {
|
|
115
|
+
return bundle?.entry?.find(
|
|
116
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some((coding) => coding.code === code) && entry.resource.valueCodeableConcept?.coding?.some((coding) => coding.code === valueCode)
|
|
117
|
+
)?.resource;
|
|
118
|
+
}
|
|
119
|
+
function findConditionByCode(bundle, code) {
|
|
120
|
+
return bundle?.entry?.find(
|
|
121
|
+
(entry) => entry.resource?.resourceType === "Condition" && entry.resource.code?.coding?.some((coding) => coding.code === code)
|
|
122
|
+
)?.resource;
|
|
123
|
+
}
|
|
124
|
+
function removeEntryById(bundle, resourceId) {
|
|
125
|
+
bundle.entry = bundle.entry?.filter((entry) => entry.resource?.id !== resourceId);
|
|
126
|
+
}
|
|
127
|
+
function removeObservationByCode(bundle, code) {
|
|
128
|
+
bundle.entry = bundle.entry?.filter((entry) => !(entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some((coding) => coding.code === code)));
|
|
129
|
+
}
|
|
130
|
+
function removeConditionByCode(bundle, code) {
|
|
131
|
+
bundle.entry = bundle.entry?.filter((entry) => !(entry.resource?.resourceType === "Condition" && entry.resource.code?.coding?.some((coding) => coding.code === code)));
|
|
132
|
+
}
|
|
133
|
+
function upsertQuantityObservation(bundle, codes, meta, quantity, removeIfZero) {
|
|
134
|
+
const obs = findObservationByCode(bundle, codes);
|
|
135
|
+
if (!obs) {
|
|
136
|
+
if (removeIfZero && quantity.value === 0) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const obsId = generateUUID();
|
|
140
|
+
const newObs = {
|
|
141
|
+
resourceType: "Observation",
|
|
142
|
+
id: obsId,
|
|
143
|
+
status: "final",
|
|
144
|
+
code: {
|
|
145
|
+
coding: [
|
|
146
|
+
{
|
|
147
|
+
system: meta.system ?? "http://loinc.org",
|
|
148
|
+
code: meta.code,
|
|
149
|
+
display: meta.display
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
text: meta.text
|
|
153
|
+
},
|
|
154
|
+
subject: {
|
|
155
|
+
reference: getPatientFullUrl(bundle)
|
|
156
|
+
},
|
|
157
|
+
valueQuantity: quantity
|
|
158
|
+
};
|
|
159
|
+
bundle.entry = bundle.entry || [];
|
|
160
|
+
bundle.entry.push({ fullUrl: `Observation/${obsId}`, resource: newObs });
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (removeIfZero && quantity.value === 0) {
|
|
164
|
+
removeEntryById(bundle, obs.id);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
obs.valueQuantity = quantity;
|
|
168
|
+
}
|
|
109
169
|
function setInitialPatientProfile() {
|
|
110
170
|
const compositionId = generateUUID();
|
|
111
171
|
return {
|
|
@@ -213,148 +273,52 @@ function setPatientAge(bundle, birthdate) {
|
|
|
213
273
|
}
|
|
214
274
|
patient.birthDate = birthdate;
|
|
215
275
|
}
|
|
276
|
+
const WEIGHT_LOINC_CODE = "29463-7";
|
|
216
277
|
function getPatientWeight(bundle) {
|
|
217
|
-
|
|
218
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
219
|
-
(coding) => coding.code === "29463-7"
|
|
220
|
-
)
|
|
221
|
-
)?.resource;
|
|
222
|
-
return obs?.valueQuantity?.value;
|
|
278
|
+
return findObservationByCode(bundle, [WEIGHT_LOINC_CODE])?.valueQuantity?.value;
|
|
223
279
|
}
|
|
224
280
|
function getPatientWeightWithUnit(bundle) {
|
|
225
|
-
const obs = bundle
|
|
226
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
227
|
-
(coding) => coding.code === "29463-7"
|
|
228
|
-
)
|
|
229
|
-
)?.resource;
|
|
281
|
+
const obs = findObservationByCode(bundle, [WEIGHT_LOINC_CODE]);
|
|
230
282
|
return (obs?.valueQuantity?.value ? obs.valueQuantity.value.toString() : "") + (obs?.valueQuantity?.unit ? ` ${obs.valueQuantity.unit}` : "");
|
|
231
283
|
}
|
|
232
284
|
function setPatientWeight(bundle, weight) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
code: "kg"
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
241
|
-
(coding) => coding.code === "29463-7"
|
|
242
|
-
)
|
|
243
|
-
)?.resource;
|
|
244
|
-
if (!obs) {
|
|
245
|
-
if (weight === 0) {
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
const obsId = generateUUID();
|
|
249
|
-
obs = {
|
|
250
|
-
resourceType: "Observation",
|
|
251
|
-
id: obsId,
|
|
252
|
-
status: "final",
|
|
253
|
-
code: {
|
|
254
|
-
coding: [
|
|
255
|
-
{
|
|
256
|
-
system: "http://loinc.org",
|
|
257
|
-
code: "29463-7",
|
|
258
|
-
display: "Body weight"
|
|
259
|
-
}
|
|
260
|
-
],
|
|
261
|
-
text: "Poids corporel"
|
|
262
|
-
},
|
|
263
|
-
subject: {
|
|
264
|
-
reference: getPatientFullUrl(bundle)
|
|
265
|
-
},
|
|
266
|
-
valueQuantity: newObsWeight
|
|
267
|
-
};
|
|
268
|
-
bundle.entry = bundle.entry || [];
|
|
269
|
-
bundle.entry.push({ fullUrl: `Observation/${obsId}`, resource: obs });
|
|
270
|
-
} else {
|
|
271
|
-
if (weight === 0) {
|
|
272
|
-
bundle.entry = bundle.entry?.filter((entry) => entry.resource?.id !== obs?.id);
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
obs.valueQuantity = newObsWeight;
|
|
276
|
-
}
|
|
285
|
+
upsertQuantityObservation(
|
|
286
|
+
bundle,
|
|
287
|
+
[WEIGHT_LOINC_CODE],
|
|
288
|
+
{ code: WEIGHT_LOINC_CODE, display: "Body weight", text: "Poids corporel" },
|
|
289
|
+
{ value: weight, unit: "kg", system: "http://unitsofmeasure.org", code: "kg" },
|
|
290
|
+
true
|
|
291
|
+
);
|
|
277
292
|
}
|
|
293
|
+
const HEIGHT_LOINC_CODE = "8302-2";
|
|
278
294
|
function getPatientHeight(bundle) {
|
|
279
|
-
|
|
280
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
281
|
-
(coding) => coding.code === "8302-2"
|
|
282
|
-
)
|
|
283
|
-
)?.resource;
|
|
284
|
-
return obs?.valueQuantity?.value;
|
|
295
|
+
return findObservationByCode(bundle, [HEIGHT_LOINC_CODE])?.valueQuantity?.value;
|
|
285
296
|
}
|
|
286
297
|
function getPatientHeightWithUnit(bundle) {
|
|
287
|
-
const obs = bundle
|
|
288
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
289
|
-
(coding) => coding.code === "8302-2"
|
|
290
|
-
)
|
|
291
|
-
)?.resource;
|
|
298
|
+
const obs = findObservationByCode(bundle, [HEIGHT_LOINC_CODE]);
|
|
292
299
|
return (obs?.valueQuantity?.value ? obs.valueQuantity.value.toString() : "") + (obs?.valueQuantity?.unit ? ` ${obs.valueQuantity.unit}` : "");
|
|
293
300
|
}
|
|
294
301
|
function setPatientHeight(bundle, height) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
code: "cm"
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
303
|
-
(coding) => coding.code === "8302-2"
|
|
304
|
-
)
|
|
305
|
-
)?.resource;
|
|
306
|
-
if (!obs) {
|
|
307
|
-
if (height === 0) {
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
const obsId = generateUUID();
|
|
311
|
-
obs = {
|
|
312
|
-
resourceType: "Observation",
|
|
313
|
-
id: obsId,
|
|
314
|
-
status: "final",
|
|
315
|
-
code: {
|
|
316
|
-
coding: [
|
|
317
|
-
{
|
|
318
|
-
system: "http://loinc.org",
|
|
319
|
-
code: "8302-2",
|
|
320
|
-
display: "Body height"
|
|
321
|
-
}
|
|
322
|
-
],
|
|
323
|
-
text: "Taille corporelle"
|
|
324
|
-
},
|
|
325
|
-
subject: {
|
|
326
|
-
reference: getPatientFullUrl(bundle)
|
|
327
|
-
},
|
|
328
|
-
valueQuantity: {
|
|
329
|
-
value: height,
|
|
330
|
-
unit: "cm",
|
|
331
|
-
system: "http://unitsofmeasure.org",
|
|
332
|
-
code: "cm"
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
bundle.entry = bundle.entry || [];
|
|
336
|
-
bundle.entry.push({ fullUrl: `Observation/${obsId}`, resource: obs });
|
|
337
|
-
} else {
|
|
338
|
-
if (height === 0) {
|
|
339
|
-
bundle.entry = bundle.entry?.filter((entry) => entry.resource?.id !== obs?.id);
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
obs.valueQuantity = newObsHeight;
|
|
343
|
-
}
|
|
302
|
+
upsertQuantityObservation(
|
|
303
|
+
bundle,
|
|
304
|
+
[HEIGHT_LOINC_CODE],
|
|
305
|
+
{ code: HEIGHT_LOINC_CODE, display: "Body height", text: "Taille corporelle" },
|
|
306
|
+
{ value: height, unit: "cm", system: "http://unitsofmeasure.org", code: "cm" },
|
|
307
|
+
true
|
|
308
|
+
);
|
|
344
309
|
}
|
|
310
|
+
const PREGNANCY_STATUS_LOINC_CODE = "82810-3";
|
|
311
|
+
const PREGNANT_SNOMED_CODE = "77386006";
|
|
345
312
|
function getPatientPregnancyStatus(bundle) {
|
|
346
|
-
const obsPreg = bundle
|
|
347
|
-
|
|
348
|
-
);
|
|
349
|
-
const condPreg = bundle?.entry?.find(
|
|
350
|
-
(entry) => entry.resource?.resourceType === "Condition" && entry.resource.code?.coding?.some((coding) => coding.code === "77386006")
|
|
351
|
-
);
|
|
313
|
+
const obsPreg = findObservationByCodeAndValue(bundle, PREGNANCY_STATUS_LOINC_CODE, PREGNANT_SNOMED_CODE);
|
|
314
|
+
const condPreg = findConditionByCode(bundle, PREGNANT_SNOMED_CODE);
|
|
352
315
|
return !!(obsPreg || condPreg);
|
|
353
316
|
}
|
|
354
317
|
function setPatientPregnancyStatus(bundle, isPregnant) {
|
|
355
318
|
if (getPatientPregnancyStatus(bundle)) {
|
|
356
319
|
if (!isPregnant) {
|
|
357
|
-
bundle
|
|
320
|
+
removeObservationByCode(bundle, PREGNANCY_STATUS_LOINC_CODE);
|
|
321
|
+
removeConditionByCode(bundle, PREGNANT_SNOMED_CODE);
|
|
358
322
|
}
|
|
359
323
|
} else if (isPregnant) {
|
|
360
324
|
const obsId = generateUUID();
|
|
@@ -366,7 +330,7 @@ function setPatientPregnancyStatus(bundle, isPregnant) {
|
|
|
366
330
|
coding: [
|
|
367
331
|
{
|
|
368
332
|
system: "http://loinc.org",
|
|
369
|
-
code:
|
|
333
|
+
code: PREGNANCY_STATUS_LOINC_CODE,
|
|
370
334
|
display: "Pregnancy status"
|
|
371
335
|
}
|
|
372
336
|
],
|
|
@@ -379,7 +343,7 @@ function setPatientPregnancyStatus(bundle, isPregnant) {
|
|
|
379
343
|
coding: [
|
|
380
344
|
{
|
|
381
345
|
system: "http://snomed.info/sct",
|
|
382
|
-
code:
|
|
346
|
+
code: PREGNANT_SNOMED_CODE,
|
|
383
347
|
display: "Pregnant"
|
|
384
348
|
}
|
|
385
349
|
],
|
|
@@ -390,73 +354,29 @@ function setPatientPregnancyStatus(bundle, isPregnant) {
|
|
|
390
354
|
bundle.entry.push({ fullUrl: `Observation/${obsId}`, resource: newObsPreg });
|
|
391
355
|
}
|
|
392
356
|
}
|
|
357
|
+
const AMENORRHEA_LOINC_CODE = "18185-9";
|
|
393
358
|
function getPatientAmenorrheaStatus(bundle) {
|
|
394
|
-
|
|
395
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
396
|
-
(coding) => coding.code === "18185-9"
|
|
397
|
-
)
|
|
398
|
-
)?.resource;
|
|
399
|
-
return obs?.valueQuantity?.value;
|
|
359
|
+
return findObservationByCode(bundle, [AMENORRHEA_LOINC_CODE])?.valueQuantity?.value;
|
|
400
360
|
}
|
|
401
361
|
function setPatientAmenorrheaStatus(bundle, weeks) {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
code: "wk"
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
410
|
-
(coding) => coding.code === "18185-9"
|
|
411
|
-
)
|
|
412
|
-
)?.resource;
|
|
413
|
-
if (!obs) {
|
|
414
|
-
const obsId = generateUUID();
|
|
415
|
-
obs = {
|
|
416
|
-
resourceType: "Observation",
|
|
417
|
-
id: obsId,
|
|
418
|
-
status: "final",
|
|
419
|
-
code: {
|
|
420
|
-
coding: [
|
|
421
|
-
{
|
|
422
|
-
system: "http://loinc.org",
|
|
423
|
-
code: "18185-9",
|
|
424
|
-
display: "Gestational age"
|
|
425
|
-
}
|
|
426
|
-
],
|
|
427
|
-
text: "Âge gestationnel"
|
|
428
|
-
},
|
|
429
|
-
subject: {
|
|
430
|
-
reference: getPatientFullUrl(bundle)
|
|
431
|
-
},
|
|
432
|
-
valueQuantity: newObsAmenorrhea
|
|
433
|
-
};
|
|
434
|
-
bundle.entry = bundle.entry || [];
|
|
435
|
-
bundle.entry.push({ fullUrl: `Observation/${obsId}`, resource: obs });
|
|
436
|
-
} else {
|
|
437
|
-
obs.valueQuantity = newObsAmenorrhea;
|
|
438
|
-
}
|
|
362
|
+
upsertQuantityObservation(
|
|
363
|
+
bundle,
|
|
364
|
+
[AMENORRHEA_LOINC_CODE],
|
|
365
|
+
{ code: AMENORRHEA_LOINC_CODE, display: "Gestational age", text: "Âge gestationnel" },
|
|
366
|
+
{ value: weeks, unit: "weeks", system: "http://unitsofmeasure.org", code: "wk" },
|
|
367
|
+
false
|
|
368
|
+
);
|
|
439
369
|
}
|
|
370
|
+
const BREASTFEEDING_LOINC_CODE = "63895-7";
|
|
371
|
+
const BREASTFEEDING_SNOMED_CODE = "69840006";
|
|
440
372
|
function getPatientBreastfeedingStatus(bundle) {
|
|
441
|
-
const obsBf = bundle
|
|
442
|
-
|
|
443
|
-
);
|
|
444
|
-
const condBf = bundle?.entry?.find(
|
|
445
|
-
(entry) => entry.resource?.resourceType === "Condition" && entry.resource.code?.coding?.some((coding) => coding.code === "69840006")
|
|
446
|
-
);
|
|
373
|
+
const obsBf = findObservationByCodeAndValue(bundle, BREASTFEEDING_LOINC_CODE, BREASTFEEDING_SNOMED_CODE);
|
|
374
|
+
const condBf = findConditionByCode(bundle, BREASTFEEDING_SNOMED_CODE);
|
|
447
375
|
return !!(obsBf || condBf);
|
|
448
376
|
}
|
|
449
377
|
function setPatientBreastfeedingStatus(bundle, isBreastfeeding) {
|
|
450
|
-
const obsBf = bundle
|
|
451
|
-
|
|
452
|
-
(coding) => coding.code === "63895-7"
|
|
453
|
-
)
|
|
454
|
-
)?.resource;
|
|
455
|
-
const condBf = bundle.entry?.find(
|
|
456
|
-
(entry) => entry.resource?.resourceType === "Condition" && entry.resource.code?.coding?.some(
|
|
457
|
-
(coding) => coding.code === "69840006"
|
|
458
|
-
)
|
|
459
|
-
)?.resource;
|
|
378
|
+
const obsBf = findObservationByCode(bundle, [BREASTFEEDING_LOINC_CODE]);
|
|
379
|
+
const condBf = findConditionByCode(bundle, BREASTFEEDING_SNOMED_CODE);
|
|
460
380
|
if (isBreastfeeding) {
|
|
461
381
|
if (!obsBf && !condBf) {
|
|
462
382
|
const obsId = generateUUID();
|
|
@@ -468,7 +388,7 @@ function setPatientBreastfeedingStatus(bundle, isBreastfeeding) {
|
|
|
468
388
|
coding: [
|
|
469
389
|
{
|
|
470
390
|
system: "http://loinc.org",
|
|
471
|
-
code:
|
|
391
|
+
code: BREASTFEEDING_LOINC_CODE,
|
|
472
392
|
display: "Breastfeeding status"
|
|
473
393
|
}
|
|
474
394
|
],
|
|
@@ -481,7 +401,7 @@ function setPatientBreastfeedingStatus(bundle, isBreastfeeding) {
|
|
|
481
401
|
coding: [
|
|
482
402
|
{
|
|
483
403
|
system: "http://snomed.info/sct",
|
|
484
|
-
code:
|
|
404
|
+
code: BREASTFEEDING_SNOMED_CODE,
|
|
485
405
|
display: "Breastfeeding"
|
|
486
406
|
}
|
|
487
407
|
],
|
|
@@ -493,25 +413,17 @@ function setPatientBreastfeedingStatus(bundle, isBreastfeeding) {
|
|
|
493
413
|
}
|
|
494
414
|
} else {
|
|
495
415
|
if (obsBf) {
|
|
496
|
-
bundle
|
|
416
|
+
removeEntryById(bundle, obsBf.id);
|
|
497
417
|
}
|
|
498
418
|
if (condBf) {
|
|
499
|
-
bundle
|
|
419
|
+
removeEntryById(bundle, condBf.id);
|
|
500
420
|
}
|
|
501
421
|
}
|
|
502
422
|
}
|
|
503
423
|
function getPatientRenalInsufficiencyStatus(bundle) {
|
|
504
|
-
const clearance = bundle
|
|
505
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
506
|
-
(coding) => acceptedLoincCodesForRenalClearance.includes(coding.code ?? "")
|
|
507
|
-
)
|
|
508
|
-
)?.resource;
|
|
424
|
+
const clearance = findObservationByCode(bundle, acceptedLoincCodesForRenalClearance);
|
|
509
425
|
let gfrValue;
|
|
510
|
-
const gfrByBsa = bundle
|
|
511
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
512
|
-
(coding) => acceptedLoincCodesForRenalGFRPerBSA.includes(coding.code ?? "")
|
|
513
|
-
)
|
|
514
|
-
)?.resource;
|
|
426
|
+
const gfrByBsa = findObservationByCode(bundle, acceptedLoincCodesForRenalGFRPerBSA);
|
|
515
427
|
if (gfrByBsa?.valueQuantity?.value) {
|
|
516
428
|
gfrValue = {
|
|
517
429
|
value: gfrByBsa.valueQuantity.value,
|
|
@@ -526,96 +438,26 @@ function getPatientRenalInsufficiencyStatus(bundle) {
|
|
|
526
438
|
};
|
|
527
439
|
}
|
|
528
440
|
function setPatientClearance(bundle, clearance) {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
code: "mL/min"
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
537
|
-
(coding) => acceptedLoincCodesForRenalClearance.includes(coding.code ?? "")
|
|
538
|
-
)
|
|
539
|
-
)?.resource;
|
|
540
|
-
if (!obs) {
|
|
541
|
-
if (clearance === 0) {
|
|
542
|
-
return;
|
|
543
|
-
}
|
|
544
|
-
const obsId = generateUUID();
|
|
545
|
-
obs = {
|
|
546
|
-
resourceType: "Observation",
|
|
547
|
-
id: obsId,
|
|
548
|
-
status: "final",
|
|
549
|
-
code: {
|
|
550
|
-
coding: [
|
|
551
|
-
{
|
|
552
|
-
system: "http://loinc.org",
|
|
553
|
-
code: acceptedLoincCodesForRenalClearance[0],
|
|
554
|
-
display: "Creatinine Clearance"
|
|
555
|
-
}
|
|
556
|
-
],
|
|
557
|
-
text: "Clairance de la créatinine"
|
|
558
|
-
},
|
|
559
|
-
subject: {
|
|
560
|
-
reference: getPatientFullUrl(bundle)
|
|
561
|
-
},
|
|
562
|
-
valueQuantity: newObsClearance
|
|
563
|
-
};
|
|
564
|
-
bundle.entry = bundle.entry || [];
|
|
565
|
-
bundle.entry.push({ fullUrl: `Observation/${obsId}`, resource: obs });
|
|
566
|
-
} else {
|
|
567
|
-
if (clearance === 0) {
|
|
568
|
-
bundle.entry = bundle.entry?.filter((entry) => entry.resource?.id !== obs?.id);
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
obs.valueQuantity = newObsClearance;
|
|
572
|
-
}
|
|
441
|
+
upsertQuantityObservation(
|
|
442
|
+
bundle,
|
|
443
|
+
acceptedLoincCodesForRenalClearance,
|
|
444
|
+
{ code: acceptedLoincCodesForRenalClearance[0], display: "Creatinine Clearance", text: "Clairance de la créatinine" },
|
|
445
|
+
{ value: clearance, unit: "mL/min", system: "http://unitsofmeasure.org", code: "mL/min" },
|
|
446
|
+
true
|
|
447
|
+
);
|
|
573
448
|
}
|
|
574
449
|
function setPatientGFRByBSA(bundle, gfr) {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
)
|
|
586
|
-
if (!obs) {
|
|
587
|
-
if (gfr === 0) {
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
const obsId = generateUUID();
|
|
591
|
-
obs = {
|
|
592
|
-
resourceType: "Observation",
|
|
593
|
-
id: obsId,
|
|
594
|
-
status: "final",
|
|
595
|
-
code: {
|
|
596
|
-
coding: [
|
|
597
|
-
{
|
|
598
|
-
system: "http://loinc.org",
|
|
599
|
-
code: "48642-3",
|
|
600
|
-
display: "Glomerular filtration rate [Volume Rate/Area] in Serum, Plasma or Blood by Creatinine-based formula (MDRD)/1.73 sq M"
|
|
601
|
-
}
|
|
602
|
-
],
|
|
603
|
-
text: "DFG"
|
|
604
|
-
},
|
|
605
|
-
subject: {
|
|
606
|
-
reference: getPatientFullUrl(bundle)
|
|
607
|
-
},
|
|
608
|
-
valueQuantity: newObsGFR
|
|
609
|
-
};
|
|
610
|
-
bundle.entry = bundle.entry || [];
|
|
611
|
-
bundle.entry.push({ fullUrl: `Observation/${obsId}`, resource: obs });
|
|
612
|
-
} else {
|
|
613
|
-
if (gfr === 0) {
|
|
614
|
-
bundle.entry = bundle.entry?.filter((entry) => entry.resource?.id !== obs?.id);
|
|
615
|
-
return;
|
|
616
|
-
}
|
|
617
|
-
obs.valueQuantity = newObsGFR;
|
|
618
|
-
}
|
|
450
|
+
upsertQuantityObservation(
|
|
451
|
+
bundle,
|
|
452
|
+
acceptedLoincCodesForRenalGFRPerBSA,
|
|
453
|
+
{
|
|
454
|
+
code: "48642-3",
|
|
455
|
+
display: "Glomerular filtration rate [Volume Rate/Area] in Serum, Plasma or Blood by Creatinine-based formula (MDRD)/1.73 sq M",
|
|
456
|
+
text: "DFG"
|
|
457
|
+
},
|
|
458
|
+
{ value: gfr, unit: "mL/min/1.73.m2", system: "http://unitsofmeasure.org", code: "mL/min/1.73.m2" },
|
|
459
|
+
true
|
|
460
|
+
);
|
|
619
461
|
}
|
|
620
462
|
function computeCreatinineFromClearance(clearance, age, weight, isFemale) {
|
|
621
463
|
const results = [];
|
|
@@ -677,9 +519,11 @@ function convertAndAddMissingUnits(results) {
|
|
|
677
519
|
});
|
|
678
520
|
}
|
|
679
521
|
}
|
|
522
|
+
const CREATININE_MASS_LOINC_CODE = "2160-0";
|
|
523
|
+
const CREATININE_MOLAR_LOINC_CODE = "15051-6";
|
|
680
524
|
function getCreatinine(bundle) {
|
|
681
525
|
const results = [];
|
|
682
|
-
const creatinineMassObs = bundle
|
|
526
|
+
const creatinineMassObs = findObservationByCode(bundle, [CREATININE_MASS_LOINC_CODE]);
|
|
683
527
|
if (creatinineMassObs?.valueQuantity?.value !== null && creatinineMassObs?.valueQuantity?.value !== void 0) {
|
|
684
528
|
const mgdl = creatinineMassObs.valueQuantity.value;
|
|
685
529
|
results.push({
|
|
@@ -689,7 +533,7 @@ function getCreatinine(bundle) {
|
|
|
689
533
|
code: "mg/L"
|
|
690
534
|
});
|
|
691
535
|
}
|
|
692
|
-
const creatinineMolObs = bundle
|
|
536
|
+
const creatinineMolObs = findObservationByCode(bundle, [CREATININE_MOLAR_LOINC_CODE]);
|
|
693
537
|
if (creatinineMolObs?.valueQuantity?.value !== null && creatinineMolObs?.valueQuantity?.value !== void 0) {
|
|
694
538
|
results.push({
|
|
695
539
|
value: creatinineMolObs.valueQuantity.value,
|
|
@@ -703,96 +547,22 @@ function getCreatinine(bundle) {
|
|
|
703
547
|
return results;
|
|
704
548
|
}
|
|
705
549
|
function setCreatinineBymgL(bundle, mgL) {
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
code: "mg/dL"
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
714
|
-
(coding) => coding.code === "2160-0"
|
|
715
|
-
)
|
|
716
|
-
)?.resource;
|
|
717
|
-
if (!obs) {
|
|
718
|
-
if (mgL === 0) {
|
|
719
|
-
return;
|
|
720
|
-
}
|
|
721
|
-
const obsId = generateUUID();
|
|
722
|
-
obs = {
|
|
723
|
-
resourceType: "Observation",
|
|
724
|
-
id: obsId,
|
|
725
|
-
status: "final",
|
|
726
|
-
code: {
|
|
727
|
-
coding: [
|
|
728
|
-
{
|
|
729
|
-
system: "http://loinc.org",
|
|
730
|
-
code: "2160-0",
|
|
731
|
-
display: "Creatinine [Mass/volume] in Serum or Plasma"
|
|
732
|
-
}
|
|
733
|
-
],
|
|
734
|
-
text: "Créatininémie"
|
|
735
|
-
},
|
|
736
|
-
subject: {
|
|
737
|
-
reference: getPatientFullUrl(bundle)
|
|
738
|
-
},
|
|
739
|
-
valueQuantity: newObsCreatinine
|
|
740
|
-
};
|
|
741
|
-
bundle.entry = bundle.entry || [];
|
|
742
|
-
bundle.entry.push({ fullUrl: `Observation/${obsId}`, resource: obs });
|
|
743
|
-
} else {
|
|
744
|
-
if (mgL === 0) {
|
|
745
|
-
bundle.entry = bundle.entry?.filter((entry) => entry.resource?.id !== obs?.id);
|
|
746
|
-
return;
|
|
747
|
-
}
|
|
748
|
-
obs.valueQuantity = newObsCreatinine;
|
|
749
|
-
}
|
|
550
|
+
upsertQuantityObservation(
|
|
551
|
+
bundle,
|
|
552
|
+
[CREATININE_MASS_LOINC_CODE],
|
|
553
|
+
{ code: CREATININE_MASS_LOINC_CODE, display: "Creatinine [Mass/volume] in Serum or Plasma", text: "Créatininémie" },
|
|
554
|
+
{ value: mgL / 10, unit: "mg/dL", system: "http://unitsofmeasure.org", code: "mg/dL" },
|
|
555
|
+
true
|
|
556
|
+
);
|
|
750
557
|
}
|
|
751
558
|
function setCreatinineByUmolL(bundle, umolL) {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
code: "umol/L"
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
760
|
-
(coding) => coding.code === "15051-6"
|
|
761
|
-
)
|
|
762
|
-
)?.resource;
|
|
763
|
-
if (!obs) {
|
|
764
|
-
if (umolL === 0) {
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
const obsId = generateUUID();
|
|
768
|
-
obs = {
|
|
769
|
-
resourceType: "Observation",
|
|
770
|
-
id: obsId,
|
|
771
|
-
status: "final",
|
|
772
|
-
code: {
|
|
773
|
-
coding: [
|
|
774
|
-
{
|
|
775
|
-
system: "http://loinc.org",
|
|
776
|
-
code: "15051-6",
|
|
777
|
-
display: "Creatinine [Moles/volume] in Serum or Plasma"
|
|
778
|
-
}
|
|
779
|
-
],
|
|
780
|
-
text: "Créatininémie"
|
|
781
|
-
},
|
|
782
|
-
subject: {
|
|
783
|
-
reference: getPatientFullUrl(bundle)
|
|
784
|
-
},
|
|
785
|
-
valueQuantity: newObsCreatinine
|
|
786
|
-
};
|
|
787
|
-
bundle.entry = bundle.entry || [];
|
|
788
|
-
bundle.entry.push({ fullUrl: `Observation/${obsId}`, resource: obs });
|
|
789
|
-
} else {
|
|
790
|
-
if (umolL === 0) {
|
|
791
|
-
bundle.entry = bundle.entry?.filter((entry) => entry.resource?.id !== obs?.id);
|
|
792
|
-
return;
|
|
793
|
-
}
|
|
794
|
-
obs.valueQuantity = newObsCreatinine;
|
|
795
|
-
}
|
|
559
|
+
upsertQuantityObservation(
|
|
560
|
+
bundle,
|
|
561
|
+
[CREATININE_MOLAR_LOINC_CODE],
|
|
562
|
+
{ code: CREATININE_MOLAR_LOINC_CODE, display: "Creatinine [Moles/volume] in Serum or Plasma", text: "Créatininémie" },
|
|
563
|
+
{ value: umolL, unit: "μmol/L", system: "http://unitsofmeasure.org", code: "umol/L" },
|
|
564
|
+
true
|
|
565
|
+
);
|
|
796
566
|
}
|
|
797
567
|
function mgdlToMgl(mgdl) {
|
|
798
568
|
return mgdl * 10;
|
|
@@ -809,12 +579,9 @@ function umolLToMgl(umolL) {
|
|
|
809
579
|
function round2(n3) {
|
|
810
580
|
return Math.round(n3 * 100) / 100;
|
|
811
581
|
}
|
|
582
|
+
const HEPATIC_INSUFFICIENCY_LOINC_CODE = "98152-2";
|
|
812
583
|
function getPatientHepaticInsufficiencyStade(bundle) {
|
|
813
|
-
const obs = bundle
|
|
814
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
815
|
-
(coding) => coding.code === "98152-2"
|
|
816
|
-
)
|
|
817
|
-
)?.resource;
|
|
584
|
+
const obs = findObservationByCode(bundle, [HEPATIC_INSUFFICIENCY_LOINC_CODE]);
|
|
818
585
|
if (obs?.valueQuantity?.value) {
|
|
819
586
|
return childPughScore(obs.valueQuantity.value);
|
|
820
587
|
} else if (obs?.valueCodeableConcept?.coding?.[0]?.code) {
|
|
@@ -827,11 +594,7 @@ function getPatientHepaticInsufficiencyStade(bundle) {
|
|
|
827
594
|
return "";
|
|
828
595
|
}
|
|
829
596
|
function setPatientHepaticInsufficiencyStatus(bundle, stade, score) {
|
|
830
|
-
let obs = bundle
|
|
831
|
-
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
832
|
-
(coding) => coding.code === "98152-2"
|
|
833
|
-
)
|
|
834
|
-
)?.resource;
|
|
597
|
+
let obs = findObservationByCode(bundle, [HEPATIC_INSUFFICIENCY_LOINC_CODE]);
|
|
835
598
|
if (stade) {
|
|
836
599
|
const snomedCode = childPughStadeToSnomedMap[stade];
|
|
837
600
|
if (!snomedCode) {
|
|
@@ -857,7 +620,7 @@ function setPatientHepaticInsufficiencyStatus(bundle, stade, score) {
|
|
|
857
620
|
coding: [
|
|
858
621
|
{
|
|
859
622
|
system: "http://loinc.org",
|
|
860
|
-
code:
|
|
623
|
+
code: HEPATIC_INSUFFICIENCY_LOINC_CODE,
|
|
861
624
|
display: "Child-Pugh score"
|
|
862
625
|
}
|
|
863
626
|
],
|
|
@@ -880,9 +643,7 @@ function setPatientHepaticInsufficiencyStatus(bundle, stade, score) {
|
|
|
880
643
|
}
|
|
881
644
|
}
|
|
882
645
|
function deletePatientHepaticInsufficiencyStatus(bundle) {
|
|
883
|
-
bundle
|
|
884
|
-
(coding) => coding.code === "98152-2"
|
|
885
|
-
)));
|
|
646
|
+
removeObservationByCode(bundle, HEPATIC_INSUFFICIENCY_LOINC_CODE);
|
|
886
647
|
}
|
|
887
648
|
function getPatientConditions(patient) {
|
|
888
649
|
if (!patient?.entry) {
|
|
@@ -946,7 +707,7 @@ function setPatientConditions(patient, conditions) {
|
|
|
946
707
|
code: {
|
|
947
708
|
coding: [
|
|
948
709
|
{
|
|
949
|
-
system: condition.category === "snomed" ? "http://snomed.info/sct" : condition.category === "CIM10" ? "http://hl7.org/fhir/sid/icd-10" : condition.category === "AMM" ? "
|
|
710
|
+
system: condition.category === "snomed" ? "http://snomed.info/sct" : condition.category === "CIM10" ? "http://hl7.org/fhir/sid/icd-10" : condition.category === "AMM" ? "https://platform.claudebernard.fr/fhir/CodeSystem/amm-pathologies" : "",
|
|
950
711
|
code: condition.value,
|
|
951
712
|
display: condition.label
|
|
952
713
|
}
|
|
@@ -1581,50 +1342,6 @@ function e$1(e2, r2) {
|
|
|
1581
1342
|
};
|
|
1582
1343
|
}
|
|
1583
1344
|
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 background-color: var(--bcbd-white-color, #FFFFFF);\n container-type: inline-size;\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile {\n font-size: 0.8rem;\n }\n}\n.claudebernard-patient-profile__no-profile {\n display: flex;\n flex-direction: column;\n gap: 0.3rem;\n}\n.claudebernard-patient-profile__no-profile__first {\n font-weight: bold;\n}\n.claudebernard-patient-profile__no-profile__second {\n color: var(--bcbd-gray-500-color, #64748B);\n font-size: 0.8rem;\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-wrap: wrap;\n gap: 1rem;\n align-items: center;\n }\n}\n@container (max-width: 320px) {\n .claudebernard-patient-profile__first-info-container {\n justify-content: 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@container (max-width: 450px) {\n .claudebernard-patient-profile__id-info-container {\n flex: 1;\n }\n}\n@container (max-width: 320px) {\n .claudebernard-patient-profile__id-info-container {\n flex: 0 0 auto;\n align-items: center;\n }\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 font-size: 1rem;\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@container (max-width: 450px) {\n .claudebernard-patient-profile__physical-info-container {\n order: 3;\n width: 100%;\n }\n}\n@container (max-width: 320px) {\n .claudebernard-patient-profile__physical-info-container {\n order: 2;\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 font-size: 1rem;\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@container (max-width: 450px) {\n .claudebernard-patient-profile__action-buttons-container {\n order: 2;\n margin: 0 auto;\n }\n}\n@container (max-width: 320px) {\n .claudebernard-patient-profile__action-buttons-container {\n order: 3;\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}';
|
|
1584
|
-
const sexOptions = [
|
|
1585
|
-
{ value: "male", label: "Masculin" },
|
|
1586
|
-
{ value: "female", label: "Féminin" },
|
|
1587
|
-
{ value: "unknown", label: "Inconnu" }
|
|
1588
|
-
];
|
|
1589
|
-
const hepaticStadeOptions = [
|
|
1590
|
-
{ value: "A", label: "Stade A" },
|
|
1591
|
-
{ value: "B", label: "Stade B" },
|
|
1592
|
-
{ value: "C", label: "Stade C" }
|
|
1593
|
-
];
|
|
1594
|
-
const convertRenalInsufficiency = async (type, value, patient, apiUrl) => {
|
|
1595
|
-
const response = await fetch(`${apiUrl}/prescription/patient/fhir/renal-insufficiency-conversion`, {
|
|
1596
|
-
method: "POST",
|
|
1597
|
-
headers: {
|
|
1598
|
-
"Content-Type": "application/json"
|
|
1599
|
-
},
|
|
1600
|
-
body: JSON.stringify({
|
|
1601
|
-
typeEntree: type,
|
|
1602
|
-
valeur: value,
|
|
1603
|
-
patient
|
|
1604
|
-
})
|
|
1605
|
-
});
|
|
1606
|
-
return response.json();
|
|
1607
|
-
};
|
|
1608
|
-
const fetchPathologiesByTerm = async (term, typePathology, params, apiUrl) => {
|
|
1609
|
-
const response = await fetch(`${apiUrl}/search/pathologies/?term=${term}&typePathology=${typePathology}`, {
|
|
1610
|
-
method: "POST",
|
|
1611
|
-
headers: {
|
|
1612
|
-
"Content-Type": "application/json"
|
|
1613
|
-
},
|
|
1614
|
-
body: JSON.stringify(params)
|
|
1615
|
-
});
|
|
1616
|
-
return response.json();
|
|
1617
|
-
};
|
|
1618
|
-
const fetchMoleculesByTerm = async (term, params, apiUrl) => {
|
|
1619
|
-
const response = await fetch(`${apiUrl}/search/molecules/?term=${term}`, {
|
|
1620
|
-
method: "POST",
|
|
1621
|
-
headers: {
|
|
1622
|
-
"Content-Type": "application/json"
|
|
1623
|
-
},
|
|
1624
|
-
body: JSON.stringify(params)
|
|
1625
|
-
});
|
|
1626
|
-
return response.json();
|
|
1627
|
-
};
|
|
1628
1345
|
const e = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
|
|
1629
1346
|
let i$1 = class i2 {
|
|
1630
1347
|
constructor(t2) {
|
|
@@ -1654,45 +1371,43 @@ const i3 = e(class extends i$1 {
|
|
|
1654
1371
|
return t2 !== this.key && (p(r2), this.key = t2), e2;
|
|
1655
1372
|
}
|
|
1656
1373
|
});
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1374
|
+
const sexOptions = [
|
|
1375
|
+
{ value: "male", label: "Masculin" },
|
|
1376
|
+
{ value: "female", label: "Féminin" },
|
|
1377
|
+
{ value: "unknown", label: "Inconnu" }
|
|
1378
|
+
];
|
|
1379
|
+
const hepaticStadeOptions = [
|
|
1380
|
+
{ value: "A", label: "Stade A" },
|
|
1381
|
+
{ value: "B", label: "Stade B" },
|
|
1382
|
+
{ value: "C", label: "Stade C" }
|
|
1383
|
+
];
|
|
1384
|
+
const patientDemographicsFormCSS = ".claudebernard-edition-modal {\n font-size: 0.9rem;\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 flex-wrap: wrap;\n}\n.claudebernard-edition-modal-information-section span {\n white-space: nowrap;\n}\n.claudebernard-edition-modal-information-section-secondary-group {\n display: flex;\n flex-direction: row;\n gap: 16px;\n flex: 3;\n flex-wrap: wrap;\n}\n@media (max-width: 950px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n flex-basis: 100%;\n }\n}\n@media (max-width: 600px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n display: contents;\n }\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@media (max-width: 600px) {\n .claudebernard-edition-modal-little-section {\n flex: 1 1 calc(50% - 8px);\n }\n .claudebernard-edition-modal-little-section span {\n white-space: nowrap;\n }\n}\n.claudebernard-edition-modal-subtitle {\n font-weight: 600;\n font-size: 1.1rem;\n color: var(--bcbd-primary-color, #0C75AD);\n}\n.claudebernard-edition-modal-error-message {\n color: var(--bcbd-danger-color, #CF406E);\n font-size: 0.8rem;\n}\n.claudebernard-edition-modal-fieldset {\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\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}\n\n.claudebernard-edition-modal-demographic-div {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}";
|
|
1385
|
+
var __defProp$7 = Object.defineProperty;
|
|
1386
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
1387
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
1388
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
1662
1389
|
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
1663
1390
|
if (decorator = decorators[i4])
|
|
1664
1391
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1665
|
-
if (kind && result) __defProp$
|
|
1392
|
+
if (kind && result) __defProp$7(target, key, result);
|
|
1666
1393
|
return result;
|
|
1667
1394
|
};
|
|
1668
|
-
let
|
|
1395
|
+
let PatientDemographicsForm = class extends i$2 {
|
|
1669
1396
|
constructor() {
|
|
1670
1397
|
super(...arguments);
|
|
1671
|
-
this.
|
|
1398
|
+
this.narrowViewportQuery = window.matchMedia(PatientDemographicsForm.NARROW_VIEWPORT_QUERY);
|
|
1399
|
+
this.datePickerPlacement = this.narrowViewportQuery.matches ? "bottom-right" : "bottom";
|
|
1400
|
+
this.updateDatePickerPlacement = (event) => {
|
|
1401
|
+
this.datePickerPlacement = event.matches ? "bottom-right" : "bottom";
|
|
1402
|
+
};
|
|
1672
1403
|
this.patientBirthDate = "";
|
|
1673
1404
|
this.patientAgeValue = void 0;
|
|
1674
1405
|
this.patientUnitAge = "ans";
|
|
1675
|
-
this.creatinineByMg = 0;
|
|
1676
|
-
this.creatinineByUmol = 0;
|
|
1677
|
-
this.clairanceCreatinine = 0;
|
|
1678
|
-
this.dfg = 0;
|
|
1679
1406
|
this.defaultPatientSex = {};
|
|
1680
|
-
this.defaultHepaticStade = {};
|
|
1681
|
-
this.isPregnancyDivVisible = false;
|
|
1682
|
-
this.isPregnant = false;
|
|
1683
|
-
this.breastfeeding = false;
|
|
1684
1407
|
this.ageErrorMessageInput = "";
|
|
1685
1408
|
this.sizeErrorMessageInput = "";
|
|
1686
1409
|
this.weightErrorMessageInput = "";
|
|
1687
|
-
this.pathologiesApiErrorMessage = "";
|
|
1688
|
-
this.allergiesApiErrorMessage = "";
|
|
1689
|
-
this.renalLackInformationErrorMessage = "";
|
|
1690
|
-
this.pathologyOptions = [];
|
|
1691
|
-
this.allergyOptions = [];
|
|
1692
|
-
this.selectedPathologyOptions = [];
|
|
1693
|
-
this.selectedAllergyOptions = [];
|
|
1694
1410
|
this.imc = 0;
|
|
1695
|
-
this.resetKey = 0;
|
|
1696
1411
|
}
|
|
1697
1412
|
get isAgeDisplay() {
|
|
1698
1413
|
return this.preferences?.forms?.age?.display ?? true;
|
|
@@ -1706,63 +1421,72 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1706
1421
|
get isSexeReadOnly() {
|
|
1707
1422
|
return this.preferences?.forms?.sexe?.readOnly ?? false;
|
|
1708
1423
|
}
|
|
1424
|
+
connectedCallback() {
|
|
1425
|
+
super.connectedCallback();
|
|
1426
|
+
this.narrowViewportQuery.addEventListener("change", this.updateDatePickerPlacement);
|
|
1427
|
+
}
|
|
1428
|
+
disconnectedCallback() {
|
|
1429
|
+
super.disconnectedCallback();
|
|
1430
|
+
this.narrowViewportQuery.removeEventListener("change", this.updateDatePickerPlacement);
|
|
1431
|
+
}
|
|
1709
1432
|
get patientAge() {
|
|
1710
1433
|
return this.patientAgeValue === void 0 ? "" : `${this.patientAgeValue} ${this.patientUnitAge}`;
|
|
1711
1434
|
}
|
|
1712
|
-
|
|
1713
|
-
this.
|
|
1435
|
+
get isPregnancyAge() {
|
|
1436
|
+
const age = this.patientAgeValue ?? 0;
|
|
1437
|
+
return this.patientUnitAge === "ans" && age >= 12 && age <= 55 && !!this.genderSelect?.value && this.genderSelect.value !== "male";
|
|
1714
1438
|
}
|
|
1715
|
-
|
|
1716
|
-
this.
|
|
1717
|
-
|
|
1439
|
+
emitChange(isPregnancyEligible, triggerRenalRecalculation) {
|
|
1440
|
+
this.dispatchEvent(new CustomEvent("demographics-change", {
|
|
1441
|
+
detail: {
|
|
1442
|
+
hasError: this.ageErrorMessageInput !== "" || this.sizeErrorMessageInput !== "" || this.weightErrorMessageInput !== "",
|
|
1443
|
+
isPregnancyEligible,
|
|
1444
|
+
triggerRenalRecalculation
|
|
1445
|
+
},
|
|
1446
|
+
bubbles: true,
|
|
1447
|
+
composed: true
|
|
1448
|
+
}));
|
|
1718
1449
|
}
|
|
1719
|
-
|
|
1450
|
+
getPatientSexFromProfile() {
|
|
1451
|
+
let gender = getPatientGender(this.patientProfile);
|
|
1452
|
+
switch (gender) {
|
|
1453
|
+
case "Homme":
|
|
1454
|
+
gender = "male";
|
|
1455
|
+
break;
|
|
1456
|
+
case "Femme":
|
|
1457
|
+
gender = "female";
|
|
1458
|
+
break;
|
|
1459
|
+
}
|
|
1460
|
+
const selectedOption = sexOptions.find((option) => option.value === gender);
|
|
1461
|
+
return selectedOption ? { value: selectedOption.value, label: selectedOption.label } : {};
|
|
1462
|
+
}
|
|
1463
|
+
resetFromProfile() {
|
|
1720
1464
|
this.imc = calculateBMI(getPatientWeight(this.patientProfile) ?? 0, getPatientHeight(this.patientProfile) ?? 0);
|
|
1721
1465
|
this.defaultPatientSex = this.getPatientSexFromProfile();
|
|
1722
|
-
this.defaultHepaticStade = this.getPatientHepaticStadeFromProfile();
|
|
1723
|
-
this.selectedPathologyOptions = getPatientConditionsWithCode(this.patientProfile);
|
|
1724
|
-
this.selectedAllergyOptions = getPatientAllergiesWithCode(this.patientProfile);
|
|
1725
1466
|
this.ageErrorMessageInput = "";
|
|
1726
1467
|
this.sizeErrorMessageInput = "";
|
|
1727
1468
|
this.weightErrorMessageInput = "";
|
|
1728
|
-
this.renalLackInformationErrorMessage = "";
|
|
1729
|
-
this.pathologyOptions = [];
|
|
1730
|
-
this.allergyOptions = [];
|
|
1731
|
-
this.breastfeeding = getPatientBreastfeedingStatus(this.patientProfile);
|
|
1732
|
-
this.isPregnant = getPatientPregnancyStatus(this.patientProfile);
|
|
1733
1469
|
const birthDate = getPatientBirthDate(this.patientProfile);
|
|
1734
1470
|
this.patientBirthDate = birthDate?.toISOString().split("T")[0] ?? "";
|
|
1735
|
-
|
|
1471
|
+
let isPregnancyEligible = false;
|
|
1736
1472
|
if (birthDate) {
|
|
1737
|
-
this.
|
|
1473
|
+
this.birthDateInput.setAttribute("warning-msg", "");
|
|
1738
1474
|
const { age, unit } = calculateAgeFromBirthDate(birthDate);
|
|
1739
1475
|
this.patientAgeValue = age;
|
|
1740
1476
|
this.patientUnitAge = unit;
|
|
1741
|
-
|
|
1477
|
+
isPregnancyEligible = unit === "ans" && this.defaultPatientSex.value !== "male";
|
|
1742
1478
|
} else {
|
|
1743
1479
|
this.patientAgeValue = void 0;
|
|
1744
1480
|
this.ageErrorMessageInput = "L'âge est requis";
|
|
1745
|
-
this.ageInputText.setAttribute("warning-msg",
|
|
1481
|
+
this.ageInputText.setAttribute("warning-msg", "");
|
|
1746
1482
|
}
|
|
1747
|
-
|
|
1748
|
-
const renalStatus = getPatientRenalInsufficiencyStatus(this.patientProfile);
|
|
1749
|
-
const creatinineByMg = creatinine.find((c2) => c2.unit?.toLowerCase() === "mg/l");
|
|
1750
|
-
const creatinineByUmol = creatinine.find((c2) => c2.unit === "μmol/L");
|
|
1751
|
-
this.clairanceCreatinine = renalStatus?.clearance?.value ?? 0;
|
|
1752
|
-
this.dfg = renalStatus?.gfr?.value ?? 0;
|
|
1753
|
-
this.creatinineByMg = creatinineByMg?.value ?? 0;
|
|
1754
|
-
this.creatinineByUmol = creatinineByUmol?.value ?? 0;
|
|
1483
|
+
this.emitChange(isPregnancyEligible, false);
|
|
1755
1484
|
}
|
|
1756
1485
|
updated(changedProperties) {
|
|
1757
1486
|
if (!changedProperties.has("patientProfile")) {
|
|
1758
1487
|
return;
|
|
1759
1488
|
}
|
|
1760
|
-
this.
|
|
1761
|
-
}
|
|
1762
|
-
handleCancel() {
|
|
1763
|
-
this.resetToProfileValues();
|
|
1764
|
-
this.resetKey++;
|
|
1765
|
-
this.editionModalElement.close();
|
|
1489
|
+
this.resetFromProfile();
|
|
1766
1490
|
}
|
|
1767
1491
|
getAgeErrorMessage(age) {
|
|
1768
1492
|
if (age > 150) {
|
|
@@ -1773,9 +1497,8 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1773
1497
|
}
|
|
1774
1498
|
return "";
|
|
1775
1499
|
}
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
return this.patientUnitAge === "ans" && age >= 12 && age <= 55 && !!this.genderSelect?.value && this.genderSelect.value !== "male";
|
|
1500
|
+
modifyGender() {
|
|
1501
|
+
this.emitChange(this.isPregnancyAge, true);
|
|
1779
1502
|
}
|
|
1780
1503
|
verifyAgeInput() {
|
|
1781
1504
|
const birthDateValue = String(this.birthDateInput?.value ?? "");
|
|
@@ -1783,9 +1506,9 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1783
1506
|
const today = /* @__PURE__ */ new Date();
|
|
1784
1507
|
if (!birthDateValue || isNaN(birthDate.getTime()) || birthDate > today) {
|
|
1785
1508
|
this.ageErrorMessageInput = "La date de naissance n'est pas valide";
|
|
1786
|
-
this.
|
|
1509
|
+
this.birthDateInput.setAttribute("warning-msg", this.ageErrorMessageInput);
|
|
1787
1510
|
this.patientAgeValue = void 0;
|
|
1788
|
-
this.
|
|
1511
|
+
this.emitChange(false, true);
|
|
1789
1512
|
return;
|
|
1790
1513
|
}
|
|
1791
1514
|
this.patientBirthDate = birthDateValue;
|
|
@@ -1793,9 +1516,8 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1793
1516
|
this.patientAgeValue = age;
|
|
1794
1517
|
this.patientUnitAge = unit;
|
|
1795
1518
|
this.ageErrorMessageInput = this.getAgeErrorMessage(age);
|
|
1796
|
-
this.
|
|
1797
|
-
this.
|
|
1798
|
-
this.recalculateRenalValues();
|
|
1519
|
+
this.birthDateInput.setAttribute("warning-msg", this.ageErrorMessageInput);
|
|
1520
|
+
this.emitChange(this.isPregnancyAge, true);
|
|
1799
1521
|
}
|
|
1800
1522
|
verifySizeInput() {
|
|
1801
1523
|
const size = Number(this.sizeInput?.value ?? 0);
|
|
@@ -1806,6 +1528,7 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1806
1528
|
}
|
|
1807
1529
|
this.sizeInput.setAttribute("warning-msg", this.sizeErrorMessageInput);
|
|
1808
1530
|
this.imc = calculateBMI(Number(this.weightInput?.value ?? 0), size);
|
|
1531
|
+
this.emitChange(this.isPregnancyAge, false);
|
|
1809
1532
|
}
|
|
1810
1533
|
verifyWeightInput() {
|
|
1811
1534
|
const weight = Number(this.weightInput?.value ?? 0);
|
|
@@ -1816,26 +1539,133 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1816
1539
|
}
|
|
1817
1540
|
this.weightInput.setAttribute("warning-msg", this.weightErrorMessageInput);
|
|
1818
1541
|
this.imc = calculateBMI(weight, Number(this.sizeInput?.value ?? 0));
|
|
1819
|
-
this.
|
|
1542
|
+
this.emitChange(this.isPregnancyAge, true);
|
|
1820
1543
|
}
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
gender = "female";
|
|
1829
|
-
break;
|
|
1830
|
-
}
|
|
1831
|
-
this.isPregnancyDivVisible = !!(gender && gender !== "Homme");
|
|
1832
|
-
const selectedOption = sexOptions.find((option) => option.value === gender);
|
|
1833
|
-
return selectedOption ? { value: selectedOption.value, label: selectedOption.label } : {};
|
|
1544
|
+
getValue() {
|
|
1545
|
+
return {
|
|
1546
|
+
gender: this.genderSelect?.value ?? "",
|
|
1547
|
+
birthDate: this.birthDateInput?.value ?? "",
|
|
1548
|
+
height: Number(this.sizeInput?.value ?? ""),
|
|
1549
|
+
weight: Number(this.weightInput?.value ?? "")
|
|
1550
|
+
};
|
|
1834
1551
|
}
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1552
|
+
render() {
|
|
1553
|
+
return b`
|
|
1554
|
+
<div class="${PREFIX}-edition-modal-demographic-div">
|
|
1555
|
+
<div class="${PREFIX}-edition-modal-large-section">
|
|
1556
|
+
<bcbd-select data-test-id="name-select" .selectedOptions=${{ value: "1", label: getPatientName(this.patientProfile) }} readonly></bcbd-select>
|
|
1557
|
+
</div>
|
|
1558
|
+
<div class="${PREFIX}-edition-modal-information-section">
|
|
1559
|
+
${this.isSexeDisplay ? b`
|
|
1560
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1561
|
+
<span>Sexe</span>
|
|
1562
|
+
<bcbd-select data-test-id="sex-select" id="genderSelect" ?disabled=${this.isSexeReadOnly} placeholder="Choisir" .options=${sexOptions} .selectedOptions=${this.defaultPatientSex} ?readonly=${this.isSexeReadOnly} @change=${this.modifyGender}></bcbd-select>
|
|
1563
|
+
</div>` : A}
|
|
1564
|
+
${this.isAgeDisplay ? b`
|
|
1565
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1566
|
+
<span>Date de naissance</span>
|
|
1567
|
+
<bcbd-input data-test-id="birth-date-input" id="birthDateInput" ?disabled=${this.isAgeReadOnly} .value=${this.patientBirthDate} type="date" date-picker-placement=${this.datePickerPlacement} aria-label="Date de naissance" warning-msg="" ?readonly=${this.isAgeReadOnly} @change=${this.verifyAgeInput}></bcbd-input>
|
|
1568
|
+
</div>
|
|
1569
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1570
|
+
<span>Age</span>
|
|
1571
|
+
<bcbd-input data-test-id="age-input-text" id="ageInputText" disabled type="text" aria-label="Age" .value=${this.patientAge} warning-msg="" readonly></bcbd-input>
|
|
1572
|
+
</div>` : A}
|
|
1573
|
+
<div class="${PREFIX}-edition-modal-information-section-secondary-group">
|
|
1574
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1575
|
+
<span>Taille (cm)</span>
|
|
1576
|
+
<bcbd-input data-test-id="size-input" id="sizeInput" type="number" aria-label="Taille (cm)" .value=${getPatientHeight(this.patientProfile) ?? ""} warning-msg="" @change=${this.verifySizeInput}></bcbd-input>
|
|
1577
|
+
</div>
|
|
1578
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1579
|
+
<span>Poids (kg)</span>
|
|
1580
|
+
<bcbd-input data-test-id="weight-input" id="weightInput" type="number" aria-label="Poids (kg)" .value=${getPatientWeight(this.patientProfile) ?? ""} warning-msg="" @change=${this.verifyWeightInput}></bcbd-input>
|
|
1581
|
+
</div>
|
|
1582
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1583
|
+
<span>IMC</span>
|
|
1584
|
+
<bcbd-input data-test-id="imc-input" id="imcInput" type="number" aria-label="IMC" disabled .value=${this.imc} warning-msg=""></bcbd-input>
|
|
1585
|
+
</div>
|
|
1586
|
+
</div>
|
|
1587
|
+
</div>
|
|
1588
|
+
</div>
|
|
1589
|
+
`;
|
|
1590
|
+
}
|
|
1591
|
+
};
|
|
1592
|
+
PatientDemographicsForm.NARROW_VIEWPORT_QUERY = "(max-width: 949px)";
|
|
1593
|
+
PatientDemographicsForm.styles = i$5`${r$4(patientDemographicsFormCSS)}`;
|
|
1594
|
+
__decorateClass$8([
|
|
1595
|
+
n2({ type: Object, attribute: "patient-profile" })
|
|
1596
|
+
], PatientDemographicsForm.prototype, "patientProfile", 2);
|
|
1597
|
+
__decorateClass$8([
|
|
1598
|
+
n2({ type: Object })
|
|
1599
|
+
], PatientDemographicsForm.prototype, "preferences", 2);
|
|
1600
|
+
__decorateClass$8([
|
|
1601
|
+
r()
|
|
1602
|
+
], PatientDemographicsForm.prototype, "datePickerPlacement", 2);
|
|
1603
|
+
__decorateClass$8([
|
|
1604
|
+
r()
|
|
1605
|
+
], PatientDemographicsForm.prototype, "patientBirthDate", 2);
|
|
1606
|
+
__decorateClass$8([
|
|
1607
|
+
r()
|
|
1608
|
+
], PatientDemographicsForm.prototype, "patientAgeValue", 2);
|
|
1609
|
+
__decorateClass$8([
|
|
1610
|
+
r()
|
|
1611
|
+
], PatientDemographicsForm.prototype, "patientUnitAge", 2);
|
|
1612
|
+
__decorateClass$8([
|
|
1613
|
+
r()
|
|
1614
|
+
], PatientDemographicsForm.prototype, "defaultPatientSex", 2);
|
|
1615
|
+
__decorateClass$8([
|
|
1616
|
+
r()
|
|
1617
|
+
], PatientDemographicsForm.prototype, "ageErrorMessageInput", 2);
|
|
1618
|
+
__decorateClass$8([
|
|
1619
|
+
r()
|
|
1620
|
+
], PatientDemographicsForm.prototype, "sizeErrorMessageInput", 2);
|
|
1621
|
+
__decorateClass$8([
|
|
1622
|
+
r()
|
|
1623
|
+
], PatientDemographicsForm.prototype, "weightErrorMessageInput", 2);
|
|
1624
|
+
__decorateClass$8([
|
|
1625
|
+
r()
|
|
1626
|
+
], PatientDemographicsForm.prototype, "imc", 2);
|
|
1627
|
+
__decorateClass$8([
|
|
1628
|
+
e$1("#sizeInput")
|
|
1629
|
+
], PatientDemographicsForm.prototype, "sizeInput", 2);
|
|
1630
|
+
__decorateClass$8([
|
|
1631
|
+
e$1("#ageInputText")
|
|
1632
|
+
], PatientDemographicsForm.prototype, "ageInputText", 2);
|
|
1633
|
+
__decorateClass$8([
|
|
1634
|
+
e$1("#birthDateInput")
|
|
1635
|
+
], PatientDemographicsForm.prototype, "birthDateInput", 2);
|
|
1636
|
+
__decorateClass$8([
|
|
1637
|
+
e$1("#weightInput")
|
|
1638
|
+
], PatientDemographicsForm.prototype, "weightInput", 2);
|
|
1639
|
+
__decorateClass$8([
|
|
1640
|
+
e$1("#genderSelect")
|
|
1641
|
+
], PatientDemographicsForm.prototype, "genderSelect", 2);
|
|
1642
|
+
PatientDemographicsForm = __decorateClass$8([
|
|
1643
|
+
t("bcb-patient-demographics-form")
|
|
1644
|
+
], PatientDemographicsForm);
|
|
1645
|
+
const patientReproductiveFormCSS = ".claudebernard-edition-modal {\n font-size: 0.9rem;\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 flex-wrap: wrap;\n}\n.claudebernard-edition-modal-information-section span {\n white-space: nowrap;\n}\n.claudebernard-edition-modal-information-section-secondary-group {\n display: flex;\n flex-direction: row;\n gap: 16px;\n flex: 3;\n flex-wrap: wrap;\n}\n@media (max-width: 950px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n flex-basis: 100%;\n }\n}\n@media (max-width: 600px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n display: contents;\n }\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@media (max-width: 600px) {\n .claudebernard-edition-modal-little-section {\n flex: 1 1 calc(50% - 8px);\n }\n .claudebernard-edition-modal-little-section span {\n white-space: nowrap;\n }\n}\n.claudebernard-edition-modal-subtitle {\n font-weight: 600;\n font-size: 1.1rem;\n color: var(--bcbd-primary-color, #0C75AD);\n}\n.claudebernard-edition-modal-error-message {\n color: var(--bcbd-danger-color, #CF406E);\n font-size: 0.8rem;\n}\n.claudebernard-edition-modal-fieldset {\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\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}\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}";
|
|
1646
|
+
var __defProp$6 = Object.defineProperty;
|
|
1647
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
1648
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
1649
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
1650
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
1651
|
+
if (decorator = decorators[i4])
|
|
1652
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1653
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
1654
|
+
return result;
|
|
1655
|
+
};
|
|
1656
|
+
let PatientReproductiveForm = class extends i$2 {
|
|
1657
|
+
constructor() {
|
|
1658
|
+
super(...arguments);
|
|
1659
|
+
this.visible = false;
|
|
1660
|
+
this.isPregnant = false;
|
|
1661
|
+
this.breastfeeding = false;
|
|
1662
|
+
}
|
|
1663
|
+
updated(changedProperties) {
|
|
1664
|
+
if (!changedProperties.has("patientProfile")) {
|
|
1665
|
+
return;
|
|
1666
|
+
}
|
|
1667
|
+
this.breastfeeding = getPatientBreastfeedingStatus(this.patientProfile);
|
|
1668
|
+
this.isPregnant = getPatientPregnancyStatus(this.patientProfile);
|
|
1839
1669
|
}
|
|
1840
1670
|
handlePregnancy(event) {
|
|
1841
1671
|
this.isPregnant = event.detail;
|
|
@@ -1843,6 +1673,292 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1843
1673
|
handleBreastfeeding(event) {
|
|
1844
1674
|
this.breastfeeding = event.detail;
|
|
1845
1675
|
}
|
|
1676
|
+
handleGestationalWeeksChange() {
|
|
1677
|
+
const gestationalWeeksValue = this.gestationalWeeksInput?.value ?? "";
|
|
1678
|
+
this.isPregnant = gestationalWeeksValue !== "";
|
|
1679
|
+
}
|
|
1680
|
+
getValue() {
|
|
1681
|
+
if (!this.visible) {
|
|
1682
|
+
return { isPregnant: false, breastfeeding: false, gestationalWeeks: 0 };
|
|
1683
|
+
}
|
|
1684
|
+
return {
|
|
1685
|
+
isPregnant: this.isPregnant,
|
|
1686
|
+
breastfeeding: this.breastfeeding,
|
|
1687
|
+
gestationalWeeks: Number(this.gestationalWeeksInput?.value ?? "")
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
render() {
|
|
1691
|
+
if (!this.visible) {
|
|
1692
|
+
return A;
|
|
1693
|
+
}
|
|
1694
|
+
return b`
|
|
1695
|
+
<div class="${PREFIX}-edition-modal-pregnant-div">
|
|
1696
|
+
<bcbd-checkbox data-test-id="pregnancy-checkbox" id="pregnancyCheckbox" .checked=${this.isPregnant} label="Grossesse" color="primary" @change=${this.handlePregnancy}></bcbd-checkbox>
|
|
1697
|
+
<bcbd-input data-test-id="gestational-input" id="gestationalWeeksInput" .value=${getPatientAmenorrheaStatus(this.patientProfile) ?? ""} type="number" warning-msg="" label="Nombre de semaines" placeholder="" @change=${this.handleGestationalWeeksChange}></bcbd-input>
|
|
1698
|
+
<bcbd-checkbox data-test-id="breastfeeding-checkbox" id="breastfeedingCheckbox" .checked=${this.breastfeeding} label="Allaitement" color="primary" @change=${this.handleBreastfeeding}></bcbd-checkbox>
|
|
1699
|
+
</div>`;
|
|
1700
|
+
}
|
|
1701
|
+
};
|
|
1702
|
+
PatientReproductiveForm.styles = i$5`${r$4(patientReproductiveFormCSS)}`;
|
|
1703
|
+
__decorateClass$7([
|
|
1704
|
+
n2({ type: Object, attribute: "patient-profile" })
|
|
1705
|
+
], PatientReproductiveForm.prototype, "patientProfile", 2);
|
|
1706
|
+
__decorateClass$7([
|
|
1707
|
+
n2({ type: Boolean })
|
|
1708
|
+
], PatientReproductiveForm.prototype, "visible", 2);
|
|
1709
|
+
__decorateClass$7([
|
|
1710
|
+
r()
|
|
1711
|
+
], PatientReproductiveForm.prototype, "isPregnant", 2);
|
|
1712
|
+
__decorateClass$7([
|
|
1713
|
+
r()
|
|
1714
|
+
], PatientReproductiveForm.prototype, "breastfeeding", 2);
|
|
1715
|
+
__decorateClass$7([
|
|
1716
|
+
e$1("#gestationalWeeksInput")
|
|
1717
|
+
], PatientReproductiveForm.prototype, "gestationalWeeksInput", 2);
|
|
1718
|
+
PatientReproductiveForm = __decorateClass$7([
|
|
1719
|
+
t("bcb-patient-reproductive-form")
|
|
1720
|
+
], PatientReproductiveForm);
|
|
1721
|
+
const fetchPathologiesByTerm = async (term, typePathology, params, apiUrl) => {
|
|
1722
|
+
const response = await fetch(`${apiUrl}/search/pathologies/?term=${term}&typePathology=${typePathology}`, {
|
|
1723
|
+
method: "POST",
|
|
1724
|
+
headers: {
|
|
1725
|
+
"Content-Type": "application/json"
|
|
1726
|
+
},
|
|
1727
|
+
body: JSON.stringify(params)
|
|
1728
|
+
});
|
|
1729
|
+
return response.json();
|
|
1730
|
+
};
|
|
1731
|
+
const fetchMoleculesByTerm = async (term, params, apiUrl) => {
|
|
1732
|
+
const response = await fetch(`${apiUrl}/search/molecules/?term=${term}`, {
|
|
1733
|
+
method: "POST",
|
|
1734
|
+
headers: {
|
|
1735
|
+
"Content-Type": "application/json"
|
|
1736
|
+
},
|
|
1737
|
+
body: JSON.stringify(params)
|
|
1738
|
+
});
|
|
1739
|
+
return response.json();
|
|
1740
|
+
};
|
|
1741
|
+
var __defProp$5 = Object.defineProperty;
|
|
1742
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
1743
|
+
var result = void 0;
|
|
1744
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
1745
|
+
if (decorator = decorators[i4])
|
|
1746
|
+
result = decorator(target, key, result) || result;
|
|
1747
|
+
if (result) __defProp$5(target, key, result);
|
|
1748
|
+
return result;
|
|
1749
|
+
};
|
|
1750
|
+
class PatientCodeSearchFormBase extends i$2 {
|
|
1751
|
+
constructor() {
|
|
1752
|
+
super(...arguments);
|
|
1753
|
+
this.apiUrl = "https://api-dev.claudebernard.fr";
|
|
1754
|
+
this.options = [];
|
|
1755
|
+
this.selected = [];
|
|
1756
|
+
this.apiErrorMessage = "";
|
|
1757
|
+
}
|
|
1758
|
+
updated(changedProperties) {
|
|
1759
|
+
if (!changedProperties.has("patientProfile")) {
|
|
1760
|
+
return;
|
|
1761
|
+
}
|
|
1762
|
+
this.selected = this.extractInitialSelection(this.patientProfile);
|
|
1763
|
+
this.apiErrorMessage = "";
|
|
1764
|
+
this.options = [];
|
|
1765
|
+
}
|
|
1766
|
+
apiReturnToSelectOption(item) {
|
|
1767
|
+
return { value: item.code, label: item.label, category: item.subType };
|
|
1768
|
+
}
|
|
1769
|
+
handleSearch(event) {
|
|
1770
|
+
if (!this.apiUrl) {
|
|
1771
|
+
return;
|
|
1772
|
+
}
|
|
1773
|
+
const valueSearch = event.detail.value;
|
|
1774
|
+
if (valueSearch.length > 2) {
|
|
1775
|
+
this.search(valueSearch).then((options) => {
|
|
1776
|
+
this.options = options;
|
|
1777
|
+
this.apiErrorMessage = "";
|
|
1778
|
+
}).catch(() => {
|
|
1779
|
+
this.apiErrorMessage = this.searchErrorMessage;
|
|
1780
|
+
this.options = [];
|
|
1781
|
+
});
|
|
1782
|
+
} else {
|
|
1783
|
+
this.options = [];
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
handleUpdateSelection(event) {
|
|
1787
|
+
const newValues = event.detail;
|
|
1788
|
+
const newSelections = newValues.filter((value) => !this.selected.some((option) => option.value === value)).map((value) => this.options.find((option) => option.value === value)).filter((option) => option !== void 0);
|
|
1789
|
+
const updatedSelections = this.selected.filter((option) => newValues.includes(option.value));
|
|
1790
|
+
this.selected = [...updatedSelections, ...newSelections];
|
|
1791
|
+
this.options = [];
|
|
1792
|
+
}
|
|
1793
|
+
getValue() {
|
|
1794
|
+
return this.selected;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
__decorateClass$6([
|
|
1798
|
+
n2({ type: Object, attribute: "patient-profile" })
|
|
1799
|
+
], PatientCodeSearchFormBase.prototype, "patientProfile");
|
|
1800
|
+
__decorateClass$6([
|
|
1801
|
+
n2({ type: String, attribute: "api-url" })
|
|
1802
|
+
], PatientCodeSearchFormBase.prototype, "apiUrl");
|
|
1803
|
+
__decorateClass$6([
|
|
1804
|
+
r()
|
|
1805
|
+
], PatientCodeSearchFormBase.prototype, "options");
|
|
1806
|
+
__decorateClass$6([
|
|
1807
|
+
r()
|
|
1808
|
+
], PatientCodeSearchFormBase.prototype, "selected");
|
|
1809
|
+
__decorateClass$6([
|
|
1810
|
+
r()
|
|
1811
|
+
], PatientCodeSearchFormBase.prototype, "apiErrorMessage");
|
|
1812
|
+
const patientCodeSearchFormCSS = ".claudebernard-edition-modal {\n font-size: 0.9rem;\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 flex-wrap: wrap;\n}\n.claudebernard-edition-modal-information-section span {\n white-space: nowrap;\n}\n.claudebernard-edition-modal-information-section-secondary-group {\n display: flex;\n flex-direction: row;\n gap: 16px;\n flex: 3;\n flex-wrap: wrap;\n}\n@media (max-width: 950px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n flex-basis: 100%;\n }\n}\n@media (max-width: 600px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n display: contents;\n }\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@media (max-width: 600px) {\n .claudebernard-edition-modal-little-section {\n flex: 1 1 calc(50% - 8px);\n }\n .claudebernard-edition-modal-little-section span {\n white-space: nowrap;\n }\n}\n.claudebernard-edition-modal-subtitle {\n font-weight: 600;\n font-size: 1.1rem;\n color: var(--bcbd-primary-color, #0C75AD);\n}\n.claudebernard-edition-modal-error-message {\n color: var(--bcbd-danger-color, #CF406E);\n font-size: 0.8rem;\n}\n.claudebernard-edition-modal-fieldset {\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\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}";
|
|
1813
|
+
var __defProp$4 = Object.defineProperty;
|
|
1814
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
1815
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
1816
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
1817
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
1818
|
+
if (decorator = decorators[i4])
|
|
1819
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1820
|
+
if (kind && result) __defProp$4(target, key, result);
|
|
1821
|
+
return result;
|
|
1822
|
+
};
|
|
1823
|
+
let PatientPathologiesForm = class extends PatientCodeSearchFormBase {
|
|
1824
|
+
get searchErrorMessage() {
|
|
1825
|
+
return "Erreur lors de la récupération des pathologies";
|
|
1826
|
+
}
|
|
1827
|
+
extractInitialSelection(patientProfile) {
|
|
1828
|
+
return getPatientConditionsWithCode(patientProfile);
|
|
1829
|
+
}
|
|
1830
|
+
async search(term) {
|
|
1831
|
+
const typePathology = this.preferences?.typePathology ?? "";
|
|
1832
|
+
const response = await fetchPathologiesByTerm(term, typePathology, new SearchRequestBody({}), this.apiUrl);
|
|
1833
|
+
return response.content.map((pathology) => this.apiReturnToSelectOption(pathology));
|
|
1834
|
+
}
|
|
1835
|
+
render() {
|
|
1836
|
+
return b`
|
|
1837
|
+
<div class="${PREFIX}-edition-modal-large-section">
|
|
1838
|
+
<span>Pathologies suivies</span>
|
|
1839
|
+
${this.apiErrorMessage !== "" ? b`<span class="${PREFIX}-edition-modal-error-message">${this.apiErrorMessage}</span>` : A}
|
|
1840
|
+
<bcbd-select data-test-id="pathologies-select" id="pathologiesSelect" use-input multiple aria-label="Pathologies suivies"
|
|
1841
|
+
.selectedOptions=${this.selected} .options=${this.options}
|
|
1842
|
+
@filter=${this.handleSearch} @change=${this.handleUpdateSelection}></bcbd-select>
|
|
1843
|
+
</div>
|
|
1844
|
+
`;
|
|
1845
|
+
}
|
|
1846
|
+
};
|
|
1847
|
+
PatientPathologiesForm.styles = i$5`${r$4(patientCodeSearchFormCSS)}`;
|
|
1848
|
+
__decorateClass$5([
|
|
1849
|
+
n2({ type: Object })
|
|
1850
|
+
], PatientPathologiesForm.prototype, "preferences", 2);
|
|
1851
|
+
PatientPathologiesForm = __decorateClass$5([
|
|
1852
|
+
t("bcb-patient-pathologies-form")
|
|
1853
|
+
], PatientPathologiesForm);
|
|
1854
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
1855
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
1856
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
1857
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
1858
|
+
if (decorator = decorators[i4])
|
|
1859
|
+
result = decorator(result) || result;
|
|
1860
|
+
return result;
|
|
1861
|
+
};
|
|
1862
|
+
let PatientAllergiesForm = class extends PatientCodeSearchFormBase {
|
|
1863
|
+
get searchErrorMessage() {
|
|
1864
|
+
return "Erreur lors de la récupération des allergies";
|
|
1865
|
+
}
|
|
1866
|
+
extractInitialSelection(patientProfile) {
|
|
1867
|
+
return getPatientAllergiesWithCode(patientProfile);
|
|
1868
|
+
}
|
|
1869
|
+
async search(term) {
|
|
1870
|
+
const response = await fetchMoleculesByTerm(term, new SearchRequestBody({}), this.apiUrl);
|
|
1871
|
+
return response.content.map((allergy) => this.apiReturnToSelectOption(allergy));
|
|
1872
|
+
}
|
|
1873
|
+
render() {
|
|
1874
|
+
return b`
|
|
1875
|
+
<div class="${PREFIX}-edition-modal-large-section">
|
|
1876
|
+
<span>Allergies</span>
|
|
1877
|
+
${this.apiErrorMessage !== "" ? b`<span class="${PREFIX}-edition-modal-error-message">${this.apiErrorMessage}</span>` : A}
|
|
1878
|
+
<bcbd-select data-test-id="allergies-select" id="allergiesSelect" use-input multiple aria-label="Allergies"
|
|
1879
|
+
.selectedOptions=${this.selected} .options=${this.options}
|
|
1880
|
+
@filter=${this.handleSearch} @change=${this.handleUpdateSelection}
|
|
1881
|
+
></bcbd-select>
|
|
1882
|
+
</div>
|
|
1883
|
+
`;
|
|
1884
|
+
}
|
|
1885
|
+
};
|
|
1886
|
+
PatientAllergiesForm.styles = i$5`${r$4(patientCodeSearchFormCSS)}`;
|
|
1887
|
+
PatientAllergiesForm = __decorateClass$4([
|
|
1888
|
+
t("bcb-patient-allergies-form")
|
|
1889
|
+
], PatientAllergiesForm);
|
|
1890
|
+
const convertRenalInsufficiency = async (type, value, patient, apiUrl) => {
|
|
1891
|
+
const response = await fetch(`${apiUrl}/prescription/patient/fhir/renal-insufficiency-conversion`, {
|
|
1892
|
+
method: "POST",
|
|
1893
|
+
headers: {
|
|
1894
|
+
"Content-Type": "application/json"
|
|
1895
|
+
},
|
|
1896
|
+
body: JSON.stringify({
|
|
1897
|
+
typeEntree: type,
|
|
1898
|
+
valeur: value,
|
|
1899
|
+
patient
|
|
1900
|
+
})
|
|
1901
|
+
});
|
|
1902
|
+
return response.json();
|
|
1903
|
+
};
|
|
1904
|
+
const patientRenalFormCSS = ".claudebernard-edition-modal {\n font-size: 0.9rem;\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 flex-wrap: wrap;\n}\n.claudebernard-edition-modal-information-section span {\n white-space: nowrap;\n}\n.claudebernard-edition-modal-information-section-secondary-group {\n display: flex;\n flex-direction: row;\n gap: 16px;\n flex: 3;\n flex-wrap: wrap;\n}\n@media (max-width: 950px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n flex-basis: 100%;\n }\n}\n@media (max-width: 600px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n display: contents;\n }\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@media (max-width: 600px) {\n .claudebernard-edition-modal-little-section {\n flex: 1 1 calc(50% - 8px);\n }\n .claudebernard-edition-modal-little-section span {\n white-space: nowrap;\n }\n}\n.claudebernard-edition-modal-subtitle {\n font-weight: 600;\n font-size: 1.1rem;\n color: var(--bcbd-primary-color, #0C75AD);\n}\n.claudebernard-edition-modal-error-message {\n color: var(--bcbd-danger-color, #CF406E);\n font-size: 0.8rem;\n}\n.claudebernard-edition-modal-fieldset {\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\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}";
|
|
1905
|
+
var __defProp$3 = Object.defineProperty;
|
|
1906
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
1907
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
1908
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
1909
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
1910
|
+
if (decorator = decorators[i4])
|
|
1911
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1912
|
+
if (kind && result) __defProp$3(target, key, result);
|
|
1913
|
+
return result;
|
|
1914
|
+
};
|
|
1915
|
+
let PatientRenalForm = class extends i$2 {
|
|
1916
|
+
constructor() {
|
|
1917
|
+
super(...arguments);
|
|
1918
|
+
this.apiUrl = "https://api-dev.claudebernard.fr";
|
|
1919
|
+
this.creatinineByMg = 0;
|
|
1920
|
+
this.creatinineByUmol = 0;
|
|
1921
|
+
this.clairanceCreatinine = 0;
|
|
1922
|
+
this.dfg = 0;
|
|
1923
|
+
this.renalLackInformationErrorMessage = "";
|
|
1924
|
+
}
|
|
1925
|
+
updated(changedProperties) {
|
|
1926
|
+
if (!changedProperties.has("patientProfile")) {
|
|
1927
|
+
return;
|
|
1928
|
+
}
|
|
1929
|
+
this.resetFromProfile();
|
|
1930
|
+
}
|
|
1931
|
+
resetFromProfile() {
|
|
1932
|
+
const creatinine = getCreatinine(this.patientProfile);
|
|
1933
|
+
const renalStatus = getPatientRenalInsufficiencyStatus(this.patientProfile);
|
|
1934
|
+
const creatinineByMg = creatinine.find((c2) => c2.unit?.toLowerCase() === "mg/l");
|
|
1935
|
+
const creatinineByUmol = creatinine.find((c2) => c2.unit === "μmol/L");
|
|
1936
|
+
this.renalLackInformationErrorMessage = "";
|
|
1937
|
+
this.clairanceCreatinine = renalStatus?.clearance?.value ?? 0;
|
|
1938
|
+
this.dfg = renalStatus?.gfr?.value ?? 0;
|
|
1939
|
+
this.creatinineByMg = creatinineByMg?.value ?? 0;
|
|
1940
|
+
this.creatinineByUmol = creatinineByUmol?.value ?? 0;
|
|
1941
|
+
}
|
|
1942
|
+
// Patch un clone du profil avec les valeurs démographiques en cours de saisie
|
|
1943
|
+
// (non encore validées, donc absentes de `this.patientProfile`) : l'API de
|
|
1944
|
+
// conversion rénale a besoin de l'âge/sexe/poids à jour pour calculer correctement.
|
|
1945
|
+
buildConversionPatient() {
|
|
1946
|
+
if (!this.patientProfile) {
|
|
1947
|
+
return this.patientProfile;
|
|
1948
|
+
}
|
|
1949
|
+
const patched = structuredClone(this.patientProfile);
|
|
1950
|
+
const demographics = this.demographics;
|
|
1951
|
+
if (demographics?.birthDate) {
|
|
1952
|
+
setPatientAge(patched, demographics.birthDate);
|
|
1953
|
+
}
|
|
1954
|
+
if (demographics?.gender === "male" || demographics?.gender === "female" || demographics?.gender === "unknown") {
|
|
1955
|
+
setPatientGender(patched, demographics.gender);
|
|
1956
|
+
}
|
|
1957
|
+
if (demographics && !isNaN(demographics.weight) && demographics.weight > 0) {
|
|
1958
|
+
setPatientWeight(patched, demographics.weight);
|
|
1959
|
+
}
|
|
1960
|
+
return patched;
|
|
1961
|
+
}
|
|
1846
1962
|
async handleRenalConversion(type, value) {
|
|
1847
1963
|
if (isNaN(value) || value <= 0) {
|
|
1848
1964
|
return;
|
|
@@ -1851,7 +1967,7 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1851
1967
|
const result = await convertRenalInsufficiency(
|
|
1852
1968
|
type,
|
|
1853
1969
|
value,
|
|
1854
|
-
this.
|
|
1970
|
+
this.buildConversionPatient(),
|
|
1855
1971
|
this.apiUrl
|
|
1856
1972
|
);
|
|
1857
1973
|
if (result.error) {
|
|
@@ -1875,7 +1991,7 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1875
1991
|
this.renalLackInformationErrorMessage = "Erreur lors de la conversion de l'insuffisance rénale";
|
|
1876
1992
|
}
|
|
1877
1993
|
}
|
|
1878
|
-
|
|
1994
|
+
recalculate() {
|
|
1879
1995
|
const creatinineUmol = Number(this.creatinineUmolInput?.value ?? "");
|
|
1880
1996
|
const creatinineMg = Number(this.creatinineMgLInput?.value ?? "");
|
|
1881
1997
|
const clairance = Number(this.clairanceCreatinineInput?.value ?? "");
|
|
@@ -1890,123 +2006,231 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1890
2006
|
this.handleRenalConversion(4, dfg);
|
|
1891
2007
|
}
|
|
1892
2008
|
}
|
|
1893
|
-
|
|
2009
|
+
getValue() {
|
|
1894
2010
|
return {
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
2011
|
+
creatinineByMg: Number(this.creatinineMgLInput?.value ?? ""),
|
|
2012
|
+
creatinineByUmol: Number(this.creatinineUmolInput?.value ?? ""),
|
|
2013
|
+
clairanceCreatinine: Number(this.clairanceCreatinineInput?.value ?? ""),
|
|
2014
|
+
dfg: Number(this.dfgInput?.value ?? "")
|
|
1898
2015
|
};
|
|
1899
2016
|
}
|
|
1900
|
-
|
|
1901
|
-
|
|
2017
|
+
render() {
|
|
2018
|
+
return b`
|
|
2019
|
+
<fieldset class="${PREFIX}-edition-modal-fieldset" data-test-id="renal-insufficiency-fieldset">
|
|
2020
|
+
<legend class="${PREFIX}-edition-modal-subtitle">
|
|
2021
|
+
<span>Insuffisance rénale</span>
|
|
2022
|
+
</legend>
|
|
2023
|
+
${this.renalLackInformationErrorMessage !== "" ? b`<span class="${PREFIX}-edition-modal-error-message">${this.renalLackInformationErrorMessage}</span>` : A}
|
|
2024
|
+
<div class="${PREFIX}-edition-modal-information-section">
|
|
2025
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
2026
|
+
<span>Créatininémie (μmol/L)</span>
|
|
2027
|
+
<bcbd-input data-test-id="creatinine-umol-input" id="creatinineUmolInput" type="number" aria-label="Créatininémie (μmol/L)" .value=${this.creatinineByUmol <= 0 ? "" : this.creatinineByUmol} warning-msg="" @change=${() => this.handleRenalConversion(1, Number(this.creatinineUmolInput?.value ?? 0))}></bcbd-input>
|
|
2028
|
+
</div>
|
|
2029
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
2030
|
+
<span>Créatininémie (mg/L)</span>
|
|
2031
|
+
<bcbd-input data-test-id="creatinine-mgl-input" id="creatininemgLInput" type="number" aria-label="Créatininémie (mg/L)" .value=${this.creatinineByMg <= 0 ? "" : this.creatinineByMg} warning-msg="" @change=${() => this.handleRenalConversion(2, Number(this.creatinineMgLInput?.value ?? 0))}></bcbd-input>
|
|
2032
|
+
</div>
|
|
2033
|
+
</div>
|
|
2034
|
+
<div class="${PREFIX}-edition-modal-information-section">
|
|
2035
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
2036
|
+
<span>Clairance créatinine (ml/min)</span>
|
|
2037
|
+
<bcbd-input data-test-id="clearance-input" id="clairanceCreatinineInput" type="number" aria-label="Clairance créatinine (ml/min)" .value=${this.clairanceCreatinine <= 0 ? "" : this.clairanceCreatinine} warning-msg="" @change=${() => this.handleRenalConversion(3, Number(this.clairanceCreatinineInput?.value ?? 0))}></bcbd-input>
|
|
2038
|
+
</div>
|
|
2039
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
2040
|
+
<span>DFG (mL/min/1.73.m2)</span>
|
|
2041
|
+
<bcbd-input data-test-id="dfg-input" id="dfgInput" type="number" aria-label="DFG (mL/min/1.73.m2)" .value=${this.dfg <= 0 ? "" : this.dfg} warning-msg="" @change=${() => this.handleRenalConversion(4, Number(this.dfgInput?.value ?? 0))}></bcbd-input>
|
|
2042
|
+
</div>
|
|
2043
|
+
</div>
|
|
2044
|
+
</fieldset>`;
|
|
2045
|
+
}
|
|
2046
|
+
};
|
|
2047
|
+
PatientRenalForm.styles = i$5`${r$4(patientRenalFormCSS)}`;
|
|
2048
|
+
__decorateClass$3([
|
|
2049
|
+
n2({ type: Object, attribute: "patient-profile" })
|
|
2050
|
+
], PatientRenalForm.prototype, "patientProfile", 2);
|
|
2051
|
+
__decorateClass$3([
|
|
2052
|
+
n2({ type: String, attribute: "api-url" })
|
|
2053
|
+
], PatientRenalForm.prototype, "apiUrl", 2);
|
|
2054
|
+
__decorateClass$3([
|
|
2055
|
+
n2({ type: Object })
|
|
2056
|
+
], PatientRenalForm.prototype, "demographics", 2);
|
|
2057
|
+
__decorateClass$3([
|
|
2058
|
+
r()
|
|
2059
|
+
], PatientRenalForm.prototype, "creatinineByMg", 2);
|
|
2060
|
+
__decorateClass$3([
|
|
2061
|
+
r()
|
|
2062
|
+
], PatientRenalForm.prototype, "creatinineByUmol", 2);
|
|
2063
|
+
__decorateClass$3([
|
|
2064
|
+
r()
|
|
2065
|
+
], PatientRenalForm.prototype, "clairanceCreatinine", 2);
|
|
2066
|
+
__decorateClass$3([
|
|
2067
|
+
r()
|
|
2068
|
+
], PatientRenalForm.prototype, "dfg", 2);
|
|
2069
|
+
__decorateClass$3([
|
|
2070
|
+
r()
|
|
2071
|
+
], PatientRenalForm.prototype, "renalLackInformationErrorMessage", 2);
|
|
2072
|
+
__decorateClass$3([
|
|
2073
|
+
e$1("#creatinineUmolInput")
|
|
2074
|
+
], PatientRenalForm.prototype, "creatinineUmolInput", 2);
|
|
2075
|
+
__decorateClass$3([
|
|
2076
|
+
e$1("#creatininemgLInput")
|
|
2077
|
+
], PatientRenalForm.prototype, "creatinineMgLInput", 2);
|
|
2078
|
+
__decorateClass$3([
|
|
2079
|
+
e$1("#clairanceCreatinineInput")
|
|
2080
|
+
], PatientRenalForm.prototype, "clairanceCreatinineInput", 2);
|
|
2081
|
+
__decorateClass$3([
|
|
2082
|
+
e$1("#dfgInput")
|
|
2083
|
+
], PatientRenalForm.prototype, "dfgInput", 2);
|
|
2084
|
+
PatientRenalForm = __decorateClass$3([
|
|
2085
|
+
t("bcb-patient-renal-form")
|
|
2086
|
+
], PatientRenalForm);
|
|
2087
|
+
const patientHepaticFormCSS = ".claudebernard-edition-modal {\n font-size: 0.9rem;\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 flex-wrap: wrap;\n}\n.claudebernard-edition-modal-information-section span {\n white-space: nowrap;\n}\n.claudebernard-edition-modal-information-section-secondary-group {\n display: flex;\n flex-direction: row;\n gap: 16px;\n flex: 3;\n flex-wrap: wrap;\n}\n@media (max-width: 950px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n flex-basis: 100%;\n }\n}\n@media (max-width: 600px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n display: contents;\n }\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@media (max-width: 600px) {\n .claudebernard-edition-modal-little-section {\n flex: 1 1 calc(50% - 8px);\n }\n .claudebernard-edition-modal-little-section span {\n white-space: nowrap;\n }\n}\n.claudebernard-edition-modal-subtitle {\n font-weight: 600;\n font-size: 1.1rem;\n color: var(--bcbd-primary-color, #0C75AD);\n}\n.claudebernard-edition-modal-error-message {\n color: var(--bcbd-danger-color, #CF406E);\n font-size: 0.8rem;\n}\n.claudebernard-edition-modal-fieldset {\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\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}";
|
|
2088
|
+
var __defProp$2 = Object.defineProperty;
|
|
2089
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
2090
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
2091
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
2092
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
2093
|
+
if (decorator = decorators[i4])
|
|
2094
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2095
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
2096
|
+
return result;
|
|
2097
|
+
};
|
|
2098
|
+
let PatientHepaticForm = class extends i$2 {
|
|
2099
|
+
constructor() {
|
|
2100
|
+
super(...arguments);
|
|
2101
|
+
this.defaultHepaticStade = {};
|
|
2102
|
+
}
|
|
2103
|
+
updated(changedProperties) {
|
|
2104
|
+
if (!changedProperties.has("patientProfile")) {
|
|
1902
2105
|
return;
|
|
1903
2106
|
}
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
2107
|
+
this.defaultHepaticStade = this.getPatientHepaticStadeFromProfile();
|
|
2108
|
+
}
|
|
2109
|
+
getPatientHepaticStadeFromProfile() {
|
|
2110
|
+
const renalStade = getPatientHepaticInsufficiencyStade(this.patientProfile);
|
|
2111
|
+
const selectedOption = hepaticStadeOptions.find((option) => option.label === renalStade);
|
|
2112
|
+
return selectedOption ? { value: selectedOption.value, label: selectedOption.label } : {};
|
|
2113
|
+
}
|
|
2114
|
+
getValue() {
|
|
2115
|
+
return { stade: this.hepaticStadeSelect?.value ?? "" };
|
|
2116
|
+
}
|
|
2117
|
+
render() {
|
|
2118
|
+
return b`
|
|
2119
|
+
<fieldset class="${PREFIX}-edition-modal-fieldset" data-test-id="hepatic-insufficiency-fieldset">
|
|
2120
|
+
<legend class="${PREFIX}-edition-modal-subtitle">
|
|
2121
|
+
<span>Insuffisance hépatique</span>
|
|
2122
|
+
</legend>
|
|
2123
|
+
<div class="${PREFIX}-edition-modal-information-section">
|
|
2124
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
2125
|
+
<span>Stade de l'insuffisance hépatique</span>
|
|
2126
|
+
<bcbd-select data-test-id="hepatic-stade-select" id="hepaticStadeSelect"
|
|
2127
|
+
.options=${hepaticStadeOptions} .selectedOptions=${this.defaultHepaticStade} clearable>
|
|
2128
|
+
</bcbd-select>
|
|
2129
|
+
</div>
|
|
2130
|
+
</div>
|
|
2131
|
+
</fieldset>
|
|
2132
|
+
`;
|
|
2133
|
+
}
|
|
2134
|
+
};
|
|
2135
|
+
PatientHepaticForm.styles = i$5`${r$4(patientHepaticFormCSS)}`;
|
|
2136
|
+
__decorateClass$2([
|
|
2137
|
+
n2({ type: Object, attribute: "patient-profile" })
|
|
2138
|
+
], PatientHepaticForm.prototype, "patientProfile", 2);
|
|
2139
|
+
__decorateClass$2([
|
|
2140
|
+
r()
|
|
2141
|
+
], PatientHepaticForm.prototype, "defaultHepaticStade", 2);
|
|
2142
|
+
__decorateClass$2([
|
|
2143
|
+
e$1("#hepaticStadeSelect")
|
|
2144
|
+
], PatientHepaticForm.prototype, "hepaticStadeSelect", 2);
|
|
2145
|
+
PatientHepaticForm = __decorateClass$2([
|
|
2146
|
+
t("bcb-patient-hepatic-form")
|
|
2147
|
+
], PatientHepaticForm);
|
|
2148
|
+
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-action-buttons {\n display: flex;\n justify-content: flex-end;\n height: 100%;\n gap: 16px;\n align-items: flex-end;\n}\n.claudebernard-edition-modal-disclaimer-section {\n padding-bottom: 10px;\n}";
|
|
2149
|
+
var __defProp$1 = Object.defineProperty;
|
|
2150
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
2151
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
2152
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
2153
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
2154
|
+
if (decorator = decorators[i4])
|
|
2155
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2156
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
2157
|
+
return result;
|
|
2158
|
+
};
|
|
2159
|
+
let PatientProfileEdition = class extends i$2 {
|
|
2160
|
+
constructor() {
|
|
2161
|
+
super(...arguments);
|
|
2162
|
+
this.apiUrl = "https://api-dev.claudebernard.fr";
|
|
2163
|
+
this.isPregnancyDivVisible = false;
|
|
2164
|
+
this.demographicsHasError = false;
|
|
2165
|
+
this.resetKey = 0;
|
|
2166
|
+
}
|
|
2167
|
+
open() {
|
|
2168
|
+
if (!this.patientProfile || Object.keys(this.patientProfile).length === 0) {
|
|
2169
|
+
this.patientProfile = setInitialPatientProfile();
|
|
1917
2170
|
}
|
|
2171
|
+
this.editionModalElement.open();
|
|
1918
2172
|
}
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
const updatedSelections = this.selectedPathologyOptions.filter((option) => newValues.includes(option.value));
|
|
1923
|
-
this.selectedPathologyOptions = [...updatedSelections, ...newSelections];
|
|
1924
|
-
this.pathologyOptions = [];
|
|
2173
|
+
handleCancel() {
|
|
2174
|
+
this.resetKey++;
|
|
2175
|
+
this.editionModalElement.close();
|
|
1925
2176
|
}
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
2177
|
+
handleDemographicsChange(event) {
|
|
2178
|
+
this.demographicsHasError = event.detail.hasError;
|
|
2179
|
+
this.isPregnancyDivVisible = event.detail.isPregnancyEligible;
|
|
2180
|
+
if (this.renalForm) {
|
|
2181
|
+
this.renalForm.demographics = this.demographicsForm.getValue();
|
|
1929
2182
|
}
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
fetchMoleculesByTerm(valueSearch, new SearchRequestBody({}), this.apiUrl).then((response) => {
|
|
1933
|
-
this.allergyOptions = [];
|
|
1934
|
-
this.allergyOptions = response.content.map((allergy) => this.apiReturntoSelectOption(allergy));
|
|
1935
|
-
this.allergiesApiErrorMessage = "";
|
|
1936
|
-
}).catch(() => {
|
|
1937
|
-
this.allergiesApiErrorMessage = "Erreur lors de la récupération des allergies";
|
|
1938
|
-
this.allergyOptions = [];
|
|
1939
|
-
});
|
|
1940
|
-
} else {
|
|
1941
|
-
this.allergyOptions = [];
|
|
2183
|
+
if (event.detail.triggerRenalRecalculation) {
|
|
2184
|
+
this.renalForm?.recalculate();
|
|
1942
2185
|
}
|
|
1943
2186
|
}
|
|
1944
|
-
updateAllergies(event) {
|
|
1945
|
-
const newValues = event.detail;
|
|
1946
|
-
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);
|
|
1947
|
-
const updatedSelections = this.selectedAllergyOptions.filter((option) => newValues.includes(option.value));
|
|
1948
|
-
this.selectedAllergyOptions = [...updatedSelections, ...newSelections];
|
|
1949
|
-
this.allergyOptions = [];
|
|
1950
|
-
}
|
|
1951
2187
|
// eslint-disable-next-line complexity
|
|
1952
2188
|
validateForm() {
|
|
1953
2189
|
if (!this.patientProfile || Object.keys(this.patientProfile).length === 0) {
|
|
1954
2190
|
this.patientProfile = setInitialPatientProfile();
|
|
1955
2191
|
}
|
|
1956
|
-
const
|
|
1957
|
-
const
|
|
1958
|
-
const
|
|
1959
|
-
const
|
|
1960
|
-
const
|
|
1961
|
-
const
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
const gestationalWeeks = Number(this.gestationalWeeksInput?.value ?? "");
|
|
1965
|
-
const hepaticStade = this.hepaticStadeSelect?.value ?? "";
|
|
1966
|
-
if (birthDate !== "") {
|
|
1967
|
-
setPatientAge(this.patientProfile, birthDate);
|
|
2192
|
+
const demographics = this.demographicsForm.getValue();
|
|
2193
|
+
const reproductive = this.reproductiveForm.getValue();
|
|
2194
|
+
const pathologies = this.pathologiesForm.getValue();
|
|
2195
|
+
const allergies = this.allergiesForm.getValue();
|
|
2196
|
+
const renal = this.renalForm.getValue();
|
|
2197
|
+
const hepatic = this.hepaticForm.getValue();
|
|
2198
|
+
if (demographics.birthDate !== "") {
|
|
2199
|
+
setPatientAge(this.patientProfile, demographics.birthDate);
|
|
1968
2200
|
}
|
|
1969
|
-
if (!isNaN(weight) || weight > 0) {
|
|
1970
|
-
setPatientWeight(this.patientProfile, weight);
|
|
2201
|
+
if (!isNaN(demographics.weight) || demographics.weight > 0) {
|
|
2202
|
+
setPatientWeight(this.patientProfile, demographics.weight);
|
|
1971
2203
|
}
|
|
1972
|
-
if (!isNaN(
|
|
1973
|
-
setPatientHeight(this.patientProfile,
|
|
2204
|
+
if (!isNaN(demographics.height) || demographics.height > 0) {
|
|
2205
|
+
setPatientHeight(this.patientProfile, demographics.height);
|
|
1974
2206
|
}
|
|
1975
|
-
if (gender === "male" || gender === "female" || gender === "unknown") {
|
|
1976
|
-
setPatientGender(this.patientProfile, gender);
|
|
2207
|
+
if (demographics.gender === "male" || demographics.gender === "female" || demographics.gender === "unknown") {
|
|
2208
|
+
setPatientGender(this.patientProfile, demographics.gender);
|
|
1977
2209
|
}
|
|
1978
|
-
if (!isNaN(
|
|
1979
|
-
setCreatinineByUmolL(this.patientProfile,
|
|
2210
|
+
if (!isNaN(renal.creatinineByUmol) || renal.creatinineByUmol > 0) {
|
|
2211
|
+
setCreatinineByUmolL(this.patientProfile, renal.creatinineByUmol);
|
|
1980
2212
|
}
|
|
1981
|
-
if (!isNaN(
|
|
1982
|
-
setCreatinineBymgL(this.patientProfile,
|
|
2213
|
+
if (!isNaN(renal.creatinineByMg) || renal.creatinineByMg > 0) {
|
|
2214
|
+
setCreatinineBymgL(this.patientProfile, renal.creatinineByMg);
|
|
1983
2215
|
}
|
|
1984
|
-
if (!isNaN(clairanceCreatinine) || clairanceCreatinine > 0) {
|
|
1985
|
-
setPatientClearance(this.patientProfile, clairanceCreatinine);
|
|
2216
|
+
if (!isNaN(renal.clairanceCreatinine) || renal.clairanceCreatinine > 0) {
|
|
2217
|
+
setPatientClearance(this.patientProfile, renal.clairanceCreatinine);
|
|
1986
2218
|
}
|
|
1987
|
-
if (!isNaN(dfg) || dfg > 0) {
|
|
1988
|
-
setPatientGFRByBSA(this.patientProfile, dfg);
|
|
2219
|
+
if (!isNaN(renal.dfg) || renal.dfg > 0) {
|
|
2220
|
+
setPatientGFRByBSA(this.patientProfile, renal.dfg);
|
|
1989
2221
|
}
|
|
1990
|
-
if (
|
|
1991
|
-
setPatientHepaticInsufficiencyStatus(this.patientProfile,
|
|
2222
|
+
if (hepatic.stade === "A" || hepatic.stade === "B" || hepatic.stade === "C") {
|
|
2223
|
+
setPatientHepaticInsufficiencyStatus(this.patientProfile, hepatic.stade);
|
|
1992
2224
|
} else {
|
|
1993
2225
|
deletePatientHepaticInsufficiencyStatus(this.patientProfile);
|
|
1994
2226
|
}
|
|
1995
|
-
if (
|
|
1996
|
-
this.
|
|
1997
|
-
this.breastfeeding = false;
|
|
2227
|
+
if (reproductive.isPregnant) {
|
|
2228
|
+
setPatientAmenorrheaStatus(this.patientProfile, isNaN(reproductive.gestationalWeeks) ? 0 : reproductive.gestationalWeeks);
|
|
1998
2229
|
}
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
setPatientAmenorrheaStatus(this.patientProfile, 0);
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
2006
|
-
setPatientBreastfeedingStatus(this.patientProfile, this.breastfeeding);
|
|
2007
|
-
setPatientPregnancyStatus(this.patientProfile, this.isPregnant);
|
|
2008
|
-
setPatientConditions(this.patientProfile, this.selectedPathologyOptions);
|
|
2009
|
-
setPatientAllergies(this.patientProfile, this.selectedAllergyOptions);
|
|
2230
|
+
setPatientBreastfeedingStatus(this.patientProfile, reproductive.breastfeeding);
|
|
2231
|
+
setPatientPregnancyStatus(this.patientProfile, reproductive.isPregnant);
|
|
2232
|
+
setPatientConditions(this.patientProfile, pathologies);
|
|
2233
|
+
setPatientAllergies(this.patientProfile, allergies);
|
|
2010
2234
|
const updatedProfile = {
|
|
2011
2235
|
...this.patientProfile,
|
|
2012
2236
|
entry: this.patientProfile?.entry ? [...this.patientProfile.entry] : void 0
|
|
@@ -2022,108 +2246,26 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
2022
2246
|
return b`
|
|
2023
2247
|
<bcbd-modal title="Édition du profil patient" persistent id="patient-profile-edition-modal" class="${PREFIX}-edition-modal" data-test-id="patient-profile-edition-modal" >
|
|
2024
2248
|
${i3(this.resetKey, b`<div class="${PREFIX}-edition-modal-content">
|
|
2025
|
-
<
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
<
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
<bcbd-input data-test-id="birth-date-input" id="birthDateInput" ?disabled=${this.isAgeReadOnly} .value=${this.patientBirthDate} type="date" aria-label="Date de naissance" warning-msg="" ?readonly=${this.isAgeReadOnly} @change=${this.verifyAgeInput}></bcbd-input>
|
|
2038
|
-
</div>
|
|
2039
|
-
<div class="${PREFIX}-edition-modal-little-section">
|
|
2040
|
-
<span>Age</span>
|
|
2041
|
-
<bcbd-input data-test-id="age-input-text" id="ageInputText" disabled type="text" aria-label="Age" .value=${this.patientAge} warning-msg="" readonly></bcbd-input>
|
|
2042
|
-
</div>` : A}
|
|
2043
|
-
<div class="${PREFIX}-edition-modal-information-section-secondary-group">
|
|
2044
|
-
<div class="${PREFIX}-edition-modal-little-section">
|
|
2045
|
-
<span>Taille (cm)</span>
|
|
2046
|
-
<bcbd-input data-test-id="size-input" id="sizeInput" type="number" aria-label="Taille (cm)" .value=${getPatientHeight(this.patientProfile) ?? ""} warning-msg="" @change=${this.verifySizeInput}></bcbd-input>
|
|
2047
|
-
</div>
|
|
2048
|
-
<div class="${PREFIX}-edition-modal-little-section">
|
|
2049
|
-
<span>Poids (kg)</span>
|
|
2050
|
-
<bcbd-input data-test-id="weight-input" id="weightInput" type="number" aria-label="Poids (kg)" .value=${getPatientWeight(this.patientProfile) ?? ""} warning-msg="" @change=${this.verifyWeightInput}></bcbd-input>
|
|
2051
|
-
</div>
|
|
2052
|
-
<div class="${PREFIX}-edition-modal-little-section">
|
|
2053
|
-
<span>IMC</span>
|
|
2054
|
-
<bcbd-input data-test-id="imc-input" id="imcInput" type="number" aria-label="IMC" disabled .value=${this.imc} warning-msg=""></bcbd-input>
|
|
2055
|
-
</div>
|
|
2056
|
-
</div>
|
|
2057
|
-
</div>
|
|
2058
|
-
${this.isPregnancyDivVisible ? b`
|
|
2059
|
-
<div class="${PREFIX}-edition-modal-pregnant-div">
|
|
2060
|
-
<bcbd-checkbox data-test-id="pregnancy-checkbox" id="pregnancyCheckbox" .checked=${this.isPregnant} label="Grossesse" color="primary" @change=${this.handlePregnancy}></bcbd-checkbox>
|
|
2061
|
-
<bcbd-input data-test-id="gestational-input" id="gestationalWeeksInput" .value=${getPatientAmenorrheaStatus(this.patientProfile) ?? 0} type="number" warning-msg="" label="Nombre de semaines" placeholder=""></bcbd-input>
|
|
2062
|
-
<bcbd-checkbox data-test-id="breastfeeding-checkbox" id="breastfeedingCheckbox" .checked=${this.breastfeeding} label="Allaitement" color="primary" @change=${this.handleBreastfeeding}></bcbd-checkbox>
|
|
2063
|
-
</div>` : b` `}
|
|
2064
|
-
|
|
2065
|
-
<div class="${PREFIX}-edition-modal-large-section">
|
|
2066
|
-
<span>Pathologies suivies</span>
|
|
2067
|
-
${this.pathologiesApiErrorMessage !== "" ? b`<span class="${PREFIX}-edition-modal-error-message">${this.pathologiesApiErrorMessage}</span>` : b` `}
|
|
2068
|
-
<bcbd-select data-test-id="pathologies-select" id="pathologiesSelect" use-input multiple aria-label="Pathologies suivies"
|
|
2069
|
-
.selectedOptions=${this.selectedPathologyOptions} .options=${this.pathologyOptions}
|
|
2070
|
-
@filter=${this.searchPathologies} @change=${this.updatePathologies}></bcbd-select>
|
|
2071
|
-
</div>
|
|
2072
|
-
<div class="${PREFIX}-edition-modal-large-section">
|
|
2073
|
-
<span>Allergies</span>
|
|
2074
|
-
${this.allergiesApiErrorMessage !== "" ? b`<span class="${PREFIX}-edition-modal-error-message">${this.allergiesApiErrorMessage}</span>` : b` `}
|
|
2075
|
-
<bcbd-select data-test-id="allergies-select" id="allergiesSelect" use-input multiple aria-label="Allergies"
|
|
2076
|
-
.selectedOptions=${this.selectedAllergyOptions} .options=${this.allergyOptions}
|
|
2077
|
-
@filter=${this.searchAllergies} @change=${this.updateAllergies}
|
|
2078
|
-
></bcbd-select>
|
|
2079
|
-
</div>
|
|
2080
|
-
<fieldset class="${PREFIX}-edition-modal-fieldset" data-test-id="renal-insufficiency-fieldset">
|
|
2081
|
-
<legend class="${PREFIX}-edition-modal-subtitle">
|
|
2082
|
-
<span>Insuffisance rénale</span>
|
|
2083
|
-
</legend>
|
|
2084
|
-
${this.renalLackInformationErrorMessage !== "" ? b`<span class="${PREFIX}-edition-modal-error-message">${this.renalLackInformationErrorMessage}</span>` : b` `}
|
|
2085
|
-
<div class="${PREFIX}-edition-modal-information-section">
|
|
2086
|
-
<div class="${PREFIX}-edition-modal-little-section">
|
|
2087
|
-
<span>Créatininémie (μmol/L)</span>
|
|
2088
|
-
<bcbd-input data-test-id="creatinine-umol-input" id="creatinineUmolInput" type="number" aria-label="Créatininémie (μmol/L)" .value=${this.creatinineByUmol <= 0 ? "" : this.creatinineByUmol} warning-msg="" @change=${() => this.handleRenalConversion(1, Number(this.creatinineUmolInput?.value ?? 0))}></bcbd-input>
|
|
2089
|
-
</div>
|
|
2090
|
-
<div class="${PREFIX}-edition-modal-little-section">
|
|
2091
|
-
<span>Créatininémie (mg/L)</span>
|
|
2092
|
-
<bcbd-input data-test-id="creatinine-mgl-input" id="creatininemgLInput" type="number" aria-label="Créatininémie (mg/L)" .value=${this.creatinineByMg <= 0 ? "" : this.creatinineByMg} warning-msg="" @change=${() => this.handleRenalConversion(2, Number(this.creatinineMgLInput?.value ?? 0))}></bcbd-input>
|
|
2093
|
-
</div>
|
|
2094
|
-
</div>
|
|
2095
|
-
<div class="${PREFIX}-edition-modal-information-section">
|
|
2096
|
-
<div class="${PREFIX}-edition-modal-little-section">
|
|
2097
|
-
<span>Clairance créatinine (ml/min)</span>
|
|
2098
|
-
<bcbd-input data-test-id="clearance-input" id="clairanceCreatinineInput" type="number" aria-label="Clairance créatinine (ml/min)" .value=${this.clairanceCreatinine <= 0 ? "" : this.clairanceCreatinine} warning-msg="" @change=${() => this.handleRenalConversion(3, Number(this.clairanceCreatinineInput?.value ?? 0))}></bcbd-input>
|
|
2099
|
-
</div>
|
|
2100
|
-
<div class="${PREFIX}-edition-modal-little-section">
|
|
2101
|
-
<span>DFG (mL/min/1.73.m2)</span>
|
|
2102
|
-
<bcbd-input data-test-id="dfg-input" id="dfgInput" type="number" aria-label="DFG (mL/min/1.73.m2)" .value=${this.dfg <= 0 ? "" : this.dfg} warning-msg="" @change=${() => this.handleRenalConversion(4, Number(this.dfgInput?.value ?? 0))}></bcbd-input>
|
|
2103
|
-
</div>
|
|
2104
|
-
</div>
|
|
2105
|
-
</fieldset>
|
|
2249
|
+
<bcb-patient-demographics-form .patientProfile=${this.patientProfile} .preferences=${this.preferences}
|
|
2250
|
+
@demographics-change=${this.handleDemographicsChange}></bcb-patient-demographics-form>
|
|
2251
|
+
|
|
2252
|
+
<bcb-patient-reproductive-form .patientProfile=${this.patientProfile} .visible=${this.isPregnancyDivVisible}></bcb-patient-reproductive-form>
|
|
2253
|
+
|
|
2254
|
+
<bcb-patient-pathologies-form .patientProfile=${this.patientProfile} .apiUrl=${this.apiUrl} .preferences=${this.preferences}></bcb-patient-pathologies-form>
|
|
2255
|
+
|
|
2256
|
+
<bcb-patient-allergies-form .patientProfile=${this.patientProfile} .apiUrl=${this.apiUrl}></bcb-patient-allergies-form>
|
|
2257
|
+
|
|
2258
|
+
<bcb-patient-renal-form .patientProfile=${this.patientProfile} .apiUrl=${this.apiUrl}></bcb-patient-renal-form>
|
|
2259
|
+
|
|
2260
|
+
<bcb-patient-hepatic-form .patientProfile=${this.patientProfile}></bcb-patient-hepatic-form>
|
|
2106
2261
|
|
|
2107
|
-
<fieldset class="${PREFIX}-edition-modal-fieldset" data-test-id="hepatic-insufficiency-fieldset">
|
|
2108
|
-
<legend class="${PREFIX}-edition-modal-subtitle">
|
|
2109
|
-
<span>Insuffisance hépatique</span>
|
|
2110
|
-
</legend>
|
|
2111
|
-
<div class="${PREFIX}-edition-modal-information-section">
|
|
2112
|
-
<div class="${PREFIX}-edition-modal-little-section">
|
|
2113
|
-
<span>Stade de l'insuffisance hépatique</span>
|
|
2114
|
-
<bcbd-select data-test-id="hepatic-stade-select" id="hepaticStadeSelect"
|
|
2115
|
-
.options=${hepaticStadeOptions} .selectedOptions=${this.defaultHepaticStade} clearable>
|
|
2116
|
-
</bcbd-select>
|
|
2117
|
-
</div>
|
|
2118
|
-
</div>
|
|
2119
|
-
</fieldset>
|
|
2120
2262
|
<div class="${PREFIX}-edition-modal-disclaimer-section">
|
|
2121
2263
|
<bcbd-alert description-message="La qualité des alertes générées dépend de l'exhaustivité des données patient renseignées. Des données incomplètes peuvent entraîner des alertes manquantes ou peu pertinentes. Il est recommandé de compléter l'ensemble des champs disponibles pour garantir une analyse pharmaceutique fiable." type="info">
|
|
2122
2264
|
</bcbd-alert>
|
|
2123
2265
|
</div>
|
|
2124
2266
|
</div>
|
|
2125
2267
|
<div slot="actions" class="${PREFIX}-edition-modal-action-buttons" data-test-id="action-buttons">
|
|
2126
|
-
<bcbd-button ?disabled=${this.
|
|
2268
|
+
<bcbd-button ?disabled=${this.demographicsHasError}
|
|
2127
2269
|
data-test-id="save-button" background-color="primary" @click=${this.validateForm}>Valider</bcbd-button>
|
|
2128
2270
|
<bcbd-button data-test-id="cancel-button" outlined background-color="primary" @click=${this.handleCancel}>Annuler</bcbd-button>
|
|
2129
2271
|
</div>
|
|
@@ -2144,114 +2286,36 @@ __decorateClass$1([
|
|
|
2144
2286
|
__decorateClass$1([
|
|
2145
2287
|
n2({ type: Object })
|
|
2146
2288
|
], PatientProfileEdition.prototype, "preferences", 2);
|
|
2147
|
-
__decorateClass$1([
|
|
2148
|
-
r()
|
|
2149
|
-
], PatientProfileEdition.prototype, "patientBirthDate", 2);
|
|
2150
|
-
__decorateClass$1([
|
|
2151
|
-
r()
|
|
2152
|
-
], PatientProfileEdition.prototype, "patientAgeValue", 2);
|
|
2153
|
-
__decorateClass$1([
|
|
2154
|
-
r()
|
|
2155
|
-
], PatientProfileEdition.prototype, "patientUnitAge", 2);
|
|
2156
|
-
__decorateClass$1([
|
|
2157
|
-
r()
|
|
2158
|
-
], PatientProfileEdition.prototype, "creatinineByMg", 2);
|
|
2159
|
-
__decorateClass$1([
|
|
2160
|
-
r()
|
|
2161
|
-
], PatientProfileEdition.prototype, "creatinineByUmol", 2);
|
|
2162
|
-
__decorateClass$1([
|
|
2163
|
-
r()
|
|
2164
|
-
], PatientProfileEdition.prototype, "clairanceCreatinine", 2);
|
|
2165
|
-
__decorateClass$1([
|
|
2166
|
-
r()
|
|
2167
|
-
], PatientProfileEdition.prototype, "dfg", 2);
|
|
2168
|
-
__decorateClass$1([
|
|
2169
|
-
r()
|
|
2170
|
-
], PatientProfileEdition.prototype, "defaultPatientSex", 2);
|
|
2171
|
-
__decorateClass$1([
|
|
2172
|
-
r()
|
|
2173
|
-
], PatientProfileEdition.prototype, "defaultHepaticStade", 2);
|
|
2174
2289
|
__decorateClass$1([
|
|
2175
2290
|
r()
|
|
2176
2291
|
], PatientProfileEdition.prototype, "isPregnancyDivVisible", 2);
|
|
2177
2292
|
__decorateClass$1([
|
|
2178
2293
|
r()
|
|
2179
|
-
], PatientProfileEdition.prototype, "
|
|
2180
|
-
__decorateClass$1([
|
|
2181
|
-
r()
|
|
2182
|
-
], PatientProfileEdition.prototype, "breastfeeding", 2);
|
|
2183
|
-
__decorateClass$1([
|
|
2184
|
-
r()
|
|
2185
|
-
], PatientProfileEdition.prototype, "ageErrorMessageInput", 2);
|
|
2186
|
-
__decorateClass$1([
|
|
2187
|
-
r()
|
|
2188
|
-
], PatientProfileEdition.prototype, "sizeErrorMessageInput", 2);
|
|
2189
|
-
__decorateClass$1([
|
|
2190
|
-
r()
|
|
2191
|
-
], PatientProfileEdition.prototype, "weightErrorMessageInput", 2);
|
|
2192
|
-
__decorateClass$1([
|
|
2193
|
-
r()
|
|
2194
|
-
], PatientProfileEdition.prototype, "pathologiesApiErrorMessage", 2);
|
|
2195
|
-
__decorateClass$1([
|
|
2196
|
-
r()
|
|
2197
|
-
], PatientProfileEdition.prototype, "allergiesApiErrorMessage", 2);
|
|
2198
|
-
__decorateClass$1([
|
|
2199
|
-
r()
|
|
2200
|
-
], PatientProfileEdition.prototype, "renalLackInformationErrorMessage", 2);
|
|
2201
|
-
__decorateClass$1([
|
|
2202
|
-
r()
|
|
2203
|
-
], PatientProfileEdition.prototype, "pathologyOptions", 2);
|
|
2204
|
-
__decorateClass$1([
|
|
2205
|
-
r()
|
|
2206
|
-
], PatientProfileEdition.prototype, "allergyOptions", 2);
|
|
2207
|
-
__decorateClass$1([
|
|
2208
|
-
r()
|
|
2209
|
-
], PatientProfileEdition.prototype, "selectedPathologyOptions", 2);
|
|
2210
|
-
__decorateClass$1([
|
|
2211
|
-
r()
|
|
2212
|
-
], PatientProfileEdition.prototype, "selectedAllergyOptions", 2);
|
|
2213
|
-
__decorateClass$1([
|
|
2214
|
-
r()
|
|
2215
|
-
], PatientProfileEdition.prototype, "imc", 2);
|
|
2294
|
+
], PatientProfileEdition.prototype, "demographicsHasError", 2);
|
|
2216
2295
|
__decorateClass$1([
|
|
2217
2296
|
r()
|
|
2218
2297
|
], PatientProfileEdition.prototype, "resetKey", 2);
|
|
2219
|
-
__decorateClass$1([
|
|
2220
|
-
e$1("#sizeInput")
|
|
2221
|
-
], PatientProfileEdition.prototype, "sizeInput", 2);
|
|
2222
|
-
__decorateClass$1([
|
|
2223
|
-
e$1("#ageInputText")
|
|
2224
|
-
], PatientProfileEdition.prototype, "ageInputText", 2);
|
|
2225
|
-
__decorateClass$1([
|
|
2226
|
-
e$1("#birthDateInput")
|
|
2227
|
-
], PatientProfileEdition.prototype, "birthDateInput", 2);
|
|
2228
|
-
__decorateClass$1([
|
|
2229
|
-
e$1("#weightInput")
|
|
2230
|
-
], PatientProfileEdition.prototype, "weightInput", 2);
|
|
2231
|
-
__decorateClass$1([
|
|
2232
|
-
e$1("#creatinineUmolInput")
|
|
2233
|
-
], PatientProfileEdition.prototype, "creatinineUmolInput", 2);
|
|
2234
|
-
__decorateClass$1([
|
|
2235
|
-
e$1("#creatininemgLInput")
|
|
2236
|
-
], PatientProfileEdition.prototype, "creatinineMgLInput", 2);
|
|
2237
|
-
__decorateClass$1([
|
|
2238
|
-
e$1("#clairanceCreatinineInput")
|
|
2239
|
-
], PatientProfileEdition.prototype, "clairanceCreatinineInput", 2);
|
|
2240
2298
|
__decorateClass$1([
|
|
2241
2299
|
e$1("#patient-profile-edition-modal")
|
|
2242
2300
|
], PatientProfileEdition.prototype, "editionModalElement", 2);
|
|
2243
2301
|
__decorateClass$1([
|
|
2244
|
-
e$1("
|
|
2245
|
-
], PatientProfileEdition.prototype, "
|
|
2302
|
+
e$1("bcb-patient-demographics-form")
|
|
2303
|
+
], PatientProfileEdition.prototype, "demographicsForm", 2);
|
|
2246
2304
|
__decorateClass$1([
|
|
2247
|
-
e$1("
|
|
2248
|
-
], PatientProfileEdition.prototype, "
|
|
2305
|
+
e$1("bcb-patient-reproductive-form")
|
|
2306
|
+
], PatientProfileEdition.prototype, "reproductiveForm", 2);
|
|
2249
2307
|
__decorateClass$1([
|
|
2250
|
-
e$1("
|
|
2251
|
-
], PatientProfileEdition.prototype, "
|
|
2308
|
+
e$1("bcb-patient-pathologies-form")
|
|
2309
|
+
], PatientProfileEdition.prototype, "pathologiesForm", 2);
|
|
2252
2310
|
__decorateClass$1([
|
|
2253
|
-
e$1("
|
|
2254
|
-
], PatientProfileEdition.prototype, "
|
|
2311
|
+
e$1("bcb-patient-allergies-form")
|
|
2312
|
+
], PatientProfileEdition.prototype, "allergiesForm", 2);
|
|
2313
|
+
__decorateClass$1([
|
|
2314
|
+
e$1("bcb-patient-renal-form")
|
|
2315
|
+
], PatientProfileEdition.prototype, "renalForm", 2);
|
|
2316
|
+
__decorateClass$1([
|
|
2317
|
+
e$1("bcb-patient-hepatic-form")
|
|
2318
|
+
], PatientProfileEdition.prototype, "hepaticForm", 2);
|
|
2255
2319
|
PatientProfileEdition = __decorateClass$1([
|
|
2256
2320
|
t("bcb-patient-profile-edition")
|
|
2257
2321
|
], PatientProfileEdition);
|