@claudebernard/patient-profile-element 0.6.3 → 0.6.4
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 +1722 -673
- package/dist/patient-profile.es.js +835 -792
- 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,38 @@ 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.apiUrl = "https://api-dev.claudebernard.fr";
|
|
1672
1398
|
this.patientBirthDate = "";
|
|
1673
1399
|
this.patientAgeValue = void 0;
|
|
1674
1400
|
this.patientUnitAge = "ans";
|
|
1675
|
-
this.creatinineByMg = 0;
|
|
1676
|
-
this.creatinineByUmol = 0;
|
|
1677
|
-
this.clairanceCreatinine = 0;
|
|
1678
|
-
this.dfg = 0;
|
|
1679
1401
|
this.defaultPatientSex = {};
|
|
1680
|
-
this.defaultHepaticStade = {};
|
|
1681
|
-
this.isPregnancyDivVisible = false;
|
|
1682
|
-
this.isPregnant = false;
|
|
1683
|
-
this.breastfeeding = false;
|
|
1684
1402
|
this.ageErrorMessageInput = "";
|
|
1685
1403
|
this.sizeErrorMessageInput = "";
|
|
1686
1404
|
this.weightErrorMessageInput = "";
|
|
1687
|
-
this.pathologiesApiErrorMessage = "";
|
|
1688
|
-
this.allergiesApiErrorMessage = "";
|
|
1689
|
-
this.renalLackInformationErrorMessage = "";
|
|
1690
|
-
this.pathologyOptions = [];
|
|
1691
|
-
this.allergyOptions = [];
|
|
1692
|
-
this.selectedPathologyOptions = [];
|
|
1693
|
-
this.selectedAllergyOptions = [];
|
|
1694
1405
|
this.imc = 0;
|
|
1695
|
-
this.resetKey = 0;
|
|
1696
1406
|
}
|
|
1697
1407
|
get isAgeDisplay() {
|
|
1698
1408
|
return this.preferences?.forms?.age?.display ?? true;
|
|
@@ -1709,60 +1419,61 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1709
1419
|
get patientAge() {
|
|
1710
1420
|
return this.patientAgeValue === void 0 ? "" : `${this.patientAgeValue} ${this.patientUnitAge}`;
|
|
1711
1421
|
}
|
|
1712
|
-
|
|
1713
|
-
this.
|
|
1422
|
+
get isPregnancyAge() {
|
|
1423
|
+
const age = this.patientAgeValue ?? 0;
|
|
1424
|
+
return this.patientUnitAge === "ans" && age >= 12 && age <= 55 && !!this.genderSelect?.value && this.genderSelect.value !== "male";
|
|
1714
1425
|
}
|
|
1715
|
-
|
|
1716
|
-
this.
|
|
1717
|
-
|
|
1426
|
+
emitChange(isPregnancyEligible, triggerRenalRecalculation) {
|
|
1427
|
+
this.dispatchEvent(new CustomEvent("demographics-change", {
|
|
1428
|
+
detail: {
|
|
1429
|
+
hasError: this.ageErrorMessageInput !== "" || this.sizeErrorMessageInput !== "" || this.weightErrorMessageInput !== "",
|
|
1430
|
+
isPregnancyEligible,
|
|
1431
|
+
triggerRenalRecalculation
|
|
1432
|
+
},
|
|
1433
|
+
bubbles: true,
|
|
1434
|
+
composed: true
|
|
1435
|
+
}));
|
|
1436
|
+
}
|
|
1437
|
+
getPatientSexFromProfile() {
|
|
1438
|
+
let gender = getPatientGender(this.patientProfile);
|
|
1439
|
+
switch (gender) {
|
|
1440
|
+
case "Homme":
|
|
1441
|
+
gender = "male";
|
|
1442
|
+
break;
|
|
1443
|
+
case "Femme":
|
|
1444
|
+
gender = "female";
|
|
1445
|
+
break;
|
|
1446
|
+
}
|
|
1447
|
+
const selectedOption = sexOptions.find((option) => option.value === gender);
|
|
1448
|
+
return selectedOption ? { value: selectedOption.value, label: selectedOption.label } : {};
|
|
1718
1449
|
}
|
|
1719
|
-
|
|
1450
|
+
resetFromProfile() {
|
|
1720
1451
|
this.imc = calculateBMI(getPatientWeight(this.patientProfile) ?? 0, getPatientHeight(this.patientProfile) ?? 0);
|
|
1721
1452
|
this.defaultPatientSex = this.getPatientSexFromProfile();
|
|
1722
|
-
this.defaultHepaticStade = this.getPatientHepaticStadeFromProfile();
|
|
1723
|
-
this.selectedPathologyOptions = getPatientConditionsWithCode(this.patientProfile);
|
|
1724
|
-
this.selectedAllergyOptions = getPatientAllergiesWithCode(this.patientProfile);
|
|
1725
1453
|
this.ageErrorMessageInput = "";
|
|
1726
1454
|
this.sizeErrorMessageInput = "";
|
|
1727
1455
|
this.weightErrorMessageInput = "";
|
|
1728
|
-
this.renalLackInformationErrorMessage = "";
|
|
1729
|
-
this.pathologyOptions = [];
|
|
1730
|
-
this.allergyOptions = [];
|
|
1731
|
-
this.breastfeeding = getPatientBreastfeedingStatus(this.patientProfile);
|
|
1732
|
-
this.isPregnant = getPatientPregnancyStatus(this.patientProfile);
|
|
1733
1456
|
const birthDate = getPatientBirthDate(this.patientProfile);
|
|
1734
1457
|
this.patientBirthDate = birthDate?.toISOString().split("T")[0] ?? "";
|
|
1735
|
-
|
|
1458
|
+
let isPregnancyEligible = false;
|
|
1736
1459
|
if (birthDate) {
|
|
1737
1460
|
this.ageInputText.setAttribute("warning-msg", "");
|
|
1738
1461
|
const { age, unit } = calculateAgeFromBirthDate(birthDate);
|
|
1739
1462
|
this.patientAgeValue = age;
|
|
1740
1463
|
this.patientUnitAge = unit;
|
|
1741
|
-
|
|
1464
|
+
isPregnancyEligible = unit === "ans" && this.defaultPatientSex.value !== "male";
|
|
1742
1465
|
} else {
|
|
1743
1466
|
this.patientAgeValue = void 0;
|
|
1744
1467
|
this.ageErrorMessageInput = "L'âge est requis";
|
|
1745
1468
|
this.ageInputText.setAttribute("warning-msg", this.ageErrorMessageInput);
|
|
1746
1469
|
}
|
|
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;
|
|
1470
|
+
this.emitChange(isPregnancyEligible, false);
|
|
1755
1471
|
}
|
|
1756
1472
|
updated(changedProperties) {
|
|
1757
1473
|
if (!changedProperties.has("patientProfile")) {
|
|
1758
1474
|
return;
|
|
1759
1475
|
}
|
|
1760
|
-
this.
|
|
1761
|
-
}
|
|
1762
|
-
handleCancel() {
|
|
1763
|
-
this.resetToProfileValues();
|
|
1764
|
-
this.resetKey++;
|
|
1765
|
-
this.editionModalElement.close();
|
|
1476
|
+
this.resetFromProfile();
|
|
1766
1477
|
}
|
|
1767
1478
|
getAgeErrorMessage(age) {
|
|
1768
1479
|
if (age > 150) {
|
|
@@ -1773,9 +1484,8 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1773
1484
|
}
|
|
1774
1485
|
return "";
|
|
1775
1486
|
}
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
return this.patientUnitAge === "ans" && age >= 12 && age <= 55 && !!this.genderSelect?.value && this.genderSelect.value !== "male";
|
|
1487
|
+
modifyGender() {
|
|
1488
|
+
this.emitChange(this.isPregnancyAge, true);
|
|
1779
1489
|
}
|
|
1780
1490
|
verifyAgeInput() {
|
|
1781
1491
|
const birthDateValue = String(this.birthDateInput?.value ?? "");
|
|
@@ -1785,7 +1495,7 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1785
1495
|
this.ageErrorMessageInput = "La date de naissance n'est pas valide";
|
|
1786
1496
|
this.ageInputText.setAttribute("warning-msg", this.ageErrorMessageInput);
|
|
1787
1497
|
this.patientAgeValue = void 0;
|
|
1788
|
-
this.
|
|
1498
|
+
this.emitChange(false, true);
|
|
1789
1499
|
return;
|
|
1790
1500
|
}
|
|
1791
1501
|
this.patientBirthDate = birthDateValue;
|
|
@@ -1794,8 +1504,7 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1794
1504
|
this.patientUnitAge = unit;
|
|
1795
1505
|
this.ageErrorMessageInput = this.getAgeErrorMessage(age);
|
|
1796
1506
|
this.ageInputText.setAttribute("warning-msg", this.ageErrorMessageInput);
|
|
1797
|
-
this.
|
|
1798
|
-
this.recalculateRenalValues();
|
|
1507
|
+
this.emitChange(this.isPregnancyAge, true);
|
|
1799
1508
|
}
|
|
1800
1509
|
verifySizeInput() {
|
|
1801
1510
|
const size = Number(this.sizeInput?.value ?? 0);
|
|
@@ -1806,6 +1515,7 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1806
1515
|
}
|
|
1807
1516
|
this.sizeInput.setAttribute("warning-msg", this.sizeErrorMessageInput);
|
|
1808
1517
|
this.imc = calculateBMI(Number(this.weightInput?.value ?? 0), size);
|
|
1518
|
+
this.emitChange(this.isPregnancyAge, false);
|
|
1809
1519
|
}
|
|
1810
1520
|
verifyWeightInput() {
|
|
1811
1521
|
const weight = Number(this.weightInput?.value ?? 0);
|
|
@@ -1816,26 +1526,129 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1816
1526
|
}
|
|
1817
1527
|
this.weightInput.setAttribute("warning-msg", this.weightErrorMessageInput);
|
|
1818
1528
|
this.imc = calculateBMI(weight, Number(this.sizeInput?.value ?? 0));
|
|
1819
|
-
this.
|
|
1529
|
+
this.emitChange(this.isPregnancyAge, true);
|
|
1820
1530
|
}
|
|
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 } : {};
|
|
1531
|
+
getValue() {
|
|
1532
|
+
return {
|
|
1533
|
+
gender: this.genderSelect?.value ?? "",
|
|
1534
|
+
birthDate: this.birthDateInput?.value ?? "",
|
|
1535
|
+
height: Number(this.sizeInput?.value ?? ""),
|
|
1536
|
+
weight: Number(this.weightInput?.value ?? "")
|
|
1537
|
+
};
|
|
1834
1538
|
}
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1539
|
+
render() {
|
|
1540
|
+
return b`
|
|
1541
|
+
<div class="${PREFIX}-edition-modal-demographic-div">
|
|
1542
|
+
<div class="${PREFIX}-edition-modal-large-section">
|
|
1543
|
+
<bcbd-select data-test-id="name-select" .selectedOptions=${{ value: "1", label: getPatientName(this.patientProfile) }} readonly></bcbd-select>
|
|
1544
|
+
</div>
|
|
1545
|
+
<div class="${PREFIX}-edition-modal-information-section">
|
|
1546
|
+
${this.isSexeDisplay ? b`
|
|
1547
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1548
|
+
<span>Sexe</span>
|
|
1549
|
+
<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>
|
|
1550
|
+
</div>` : A}
|
|
1551
|
+
${this.isAgeDisplay ? b`
|
|
1552
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1553
|
+
<span>Date de naissance</span>
|
|
1554
|
+
<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>
|
|
1555
|
+
</div>
|
|
1556
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1557
|
+
<span>Age</span>
|
|
1558
|
+
<bcbd-input data-test-id="age-input-text" id="ageInputText" disabled type="text" aria-label="Age" .value=${this.patientAge} warning-msg="" readonly></bcbd-input>
|
|
1559
|
+
</div>` : A}
|
|
1560
|
+
<div class="${PREFIX}-edition-modal-information-section-secondary-group">
|
|
1561
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1562
|
+
<span>Taille (cm)</span>
|
|
1563
|
+
<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>
|
|
1564
|
+
</div>
|
|
1565
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1566
|
+
<span>Poids (kg)</span>
|
|
1567
|
+
<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>
|
|
1568
|
+
</div>
|
|
1569
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
1570
|
+
<span>IMC</span>
|
|
1571
|
+
<bcbd-input data-test-id="imc-input" id="imcInput" type="number" aria-label="IMC" disabled .value=${this.imc} warning-msg=""></bcbd-input>
|
|
1572
|
+
</div>
|
|
1573
|
+
</div>
|
|
1574
|
+
</div>
|
|
1575
|
+
</div>
|
|
1576
|
+
`;
|
|
1577
|
+
}
|
|
1578
|
+
};
|
|
1579
|
+
PatientDemographicsForm.styles = i$5`${r$4(patientDemographicsFormCSS)}`;
|
|
1580
|
+
__decorateClass$8([
|
|
1581
|
+
n2({ type: Object, attribute: "patient-profile" })
|
|
1582
|
+
], PatientDemographicsForm.prototype, "patientProfile", 2);
|
|
1583
|
+
__decorateClass$8([
|
|
1584
|
+
n2({ type: Object })
|
|
1585
|
+
], PatientDemographicsForm.prototype, "preferences", 2);
|
|
1586
|
+
__decorateClass$8([
|
|
1587
|
+
r()
|
|
1588
|
+
], PatientDemographicsForm.prototype, "patientBirthDate", 2);
|
|
1589
|
+
__decorateClass$8([
|
|
1590
|
+
r()
|
|
1591
|
+
], PatientDemographicsForm.prototype, "patientAgeValue", 2);
|
|
1592
|
+
__decorateClass$8([
|
|
1593
|
+
r()
|
|
1594
|
+
], PatientDemographicsForm.prototype, "patientUnitAge", 2);
|
|
1595
|
+
__decorateClass$8([
|
|
1596
|
+
r()
|
|
1597
|
+
], PatientDemographicsForm.prototype, "defaultPatientSex", 2);
|
|
1598
|
+
__decorateClass$8([
|
|
1599
|
+
r()
|
|
1600
|
+
], PatientDemographicsForm.prototype, "ageErrorMessageInput", 2);
|
|
1601
|
+
__decorateClass$8([
|
|
1602
|
+
r()
|
|
1603
|
+
], PatientDemographicsForm.prototype, "sizeErrorMessageInput", 2);
|
|
1604
|
+
__decorateClass$8([
|
|
1605
|
+
r()
|
|
1606
|
+
], PatientDemographicsForm.prototype, "weightErrorMessageInput", 2);
|
|
1607
|
+
__decorateClass$8([
|
|
1608
|
+
r()
|
|
1609
|
+
], PatientDemographicsForm.prototype, "imc", 2);
|
|
1610
|
+
__decorateClass$8([
|
|
1611
|
+
e$1("#sizeInput")
|
|
1612
|
+
], PatientDemographicsForm.prototype, "sizeInput", 2);
|
|
1613
|
+
__decorateClass$8([
|
|
1614
|
+
e$1("#ageInputText")
|
|
1615
|
+
], PatientDemographicsForm.prototype, "ageInputText", 2);
|
|
1616
|
+
__decorateClass$8([
|
|
1617
|
+
e$1("#birthDateInput")
|
|
1618
|
+
], PatientDemographicsForm.prototype, "birthDateInput", 2);
|
|
1619
|
+
__decorateClass$8([
|
|
1620
|
+
e$1("#weightInput")
|
|
1621
|
+
], PatientDemographicsForm.prototype, "weightInput", 2);
|
|
1622
|
+
__decorateClass$8([
|
|
1623
|
+
e$1("#genderSelect")
|
|
1624
|
+
], PatientDemographicsForm.prototype, "genderSelect", 2);
|
|
1625
|
+
PatientDemographicsForm = __decorateClass$8([
|
|
1626
|
+
t("bcb-patient-demographics-form")
|
|
1627
|
+
], PatientDemographicsForm);
|
|
1628
|
+
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}";
|
|
1629
|
+
var __defProp$6 = Object.defineProperty;
|
|
1630
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
1631
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
1632
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
1633
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
1634
|
+
if (decorator = decorators[i4])
|
|
1635
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1636
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
1637
|
+
return result;
|
|
1638
|
+
};
|
|
1639
|
+
let PatientReproductiveForm = class extends i$2 {
|
|
1640
|
+
constructor() {
|
|
1641
|
+
super(...arguments);
|
|
1642
|
+
this.visible = false;
|
|
1643
|
+
this.isPregnant = false;
|
|
1644
|
+
this.breastfeeding = false;
|
|
1645
|
+
}
|
|
1646
|
+
updated(changedProperties) {
|
|
1647
|
+
if (!changedProperties.has("patientProfile")) {
|
|
1648
|
+
return;
|
|
1649
|
+
}
|
|
1650
|
+
this.breastfeeding = getPatientBreastfeedingStatus(this.patientProfile);
|
|
1651
|
+
this.isPregnant = getPatientPregnancyStatus(this.patientProfile);
|
|
1839
1652
|
}
|
|
1840
1653
|
handlePregnancy(event) {
|
|
1841
1654
|
this.isPregnant = event.detail;
|
|
@@ -1843,6 +1656,288 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1843
1656
|
handleBreastfeeding(event) {
|
|
1844
1657
|
this.breastfeeding = event.detail;
|
|
1845
1658
|
}
|
|
1659
|
+
getValue() {
|
|
1660
|
+
if (!this.visible) {
|
|
1661
|
+
return { isPregnant: false, breastfeeding: false, gestationalWeeks: 0 };
|
|
1662
|
+
}
|
|
1663
|
+
return {
|
|
1664
|
+
isPregnant: this.isPregnant,
|
|
1665
|
+
breastfeeding: this.breastfeeding,
|
|
1666
|
+
gestationalWeeks: Number(this.gestationalWeeksInput?.value ?? "")
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
render() {
|
|
1670
|
+
if (!this.visible) {
|
|
1671
|
+
return A;
|
|
1672
|
+
}
|
|
1673
|
+
return b`
|
|
1674
|
+
<div class="${PREFIX}-edition-modal-pregnant-div">
|
|
1675
|
+
<bcbd-checkbox data-test-id="pregnancy-checkbox" id="pregnancyCheckbox" .checked=${this.isPregnant} label="Grossesse" color="primary" @change=${this.handlePregnancy}></bcbd-checkbox>
|
|
1676
|
+
<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>
|
|
1677
|
+
<bcbd-checkbox data-test-id="breastfeeding-checkbox" id="breastfeedingCheckbox" .checked=${this.breastfeeding} label="Allaitement" color="primary" @change=${this.handleBreastfeeding}></bcbd-checkbox>
|
|
1678
|
+
</div>`;
|
|
1679
|
+
}
|
|
1680
|
+
};
|
|
1681
|
+
PatientReproductiveForm.styles = i$5`${r$4(patientReproductiveFormCSS)}`;
|
|
1682
|
+
__decorateClass$7([
|
|
1683
|
+
n2({ type: Object, attribute: "patient-profile" })
|
|
1684
|
+
], PatientReproductiveForm.prototype, "patientProfile", 2);
|
|
1685
|
+
__decorateClass$7([
|
|
1686
|
+
n2({ type: Boolean })
|
|
1687
|
+
], PatientReproductiveForm.prototype, "visible", 2);
|
|
1688
|
+
__decorateClass$7([
|
|
1689
|
+
r()
|
|
1690
|
+
], PatientReproductiveForm.prototype, "isPregnant", 2);
|
|
1691
|
+
__decorateClass$7([
|
|
1692
|
+
r()
|
|
1693
|
+
], PatientReproductiveForm.prototype, "breastfeeding", 2);
|
|
1694
|
+
__decorateClass$7([
|
|
1695
|
+
e$1("#gestationalWeeksInput")
|
|
1696
|
+
], PatientReproductiveForm.prototype, "gestationalWeeksInput", 2);
|
|
1697
|
+
PatientReproductiveForm = __decorateClass$7([
|
|
1698
|
+
t("bcb-patient-reproductive-form")
|
|
1699
|
+
], PatientReproductiveForm);
|
|
1700
|
+
const fetchPathologiesByTerm = async (term, typePathology, params, apiUrl) => {
|
|
1701
|
+
const response = await fetch(`${apiUrl}/search/pathologies/?term=${term}&typePathology=${typePathology}`, {
|
|
1702
|
+
method: "POST",
|
|
1703
|
+
headers: {
|
|
1704
|
+
"Content-Type": "application/json"
|
|
1705
|
+
},
|
|
1706
|
+
body: JSON.stringify(params)
|
|
1707
|
+
});
|
|
1708
|
+
return response.json();
|
|
1709
|
+
};
|
|
1710
|
+
const fetchMoleculesByTerm = async (term, params, apiUrl) => {
|
|
1711
|
+
const response = await fetch(`${apiUrl}/search/molecules/?term=${term}`, {
|
|
1712
|
+
method: "POST",
|
|
1713
|
+
headers: {
|
|
1714
|
+
"Content-Type": "application/json"
|
|
1715
|
+
},
|
|
1716
|
+
body: JSON.stringify(params)
|
|
1717
|
+
});
|
|
1718
|
+
return response.json();
|
|
1719
|
+
};
|
|
1720
|
+
var __defProp$5 = Object.defineProperty;
|
|
1721
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
1722
|
+
var result = void 0;
|
|
1723
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
1724
|
+
if (decorator = decorators[i4])
|
|
1725
|
+
result = decorator(target, key, result) || result;
|
|
1726
|
+
if (result) __defProp$5(target, key, result);
|
|
1727
|
+
return result;
|
|
1728
|
+
};
|
|
1729
|
+
class PatientCodeSearchFormBase extends i$2 {
|
|
1730
|
+
constructor() {
|
|
1731
|
+
super(...arguments);
|
|
1732
|
+
this.apiUrl = "https://api-dev.claudebernard.fr";
|
|
1733
|
+
this.options = [];
|
|
1734
|
+
this.selected = [];
|
|
1735
|
+
this.apiErrorMessage = "";
|
|
1736
|
+
}
|
|
1737
|
+
updated(changedProperties) {
|
|
1738
|
+
if (!changedProperties.has("patientProfile")) {
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1741
|
+
this.selected = this.extractInitialSelection(this.patientProfile);
|
|
1742
|
+
this.apiErrorMessage = "";
|
|
1743
|
+
this.options = [];
|
|
1744
|
+
}
|
|
1745
|
+
apiReturnToSelectOption(item) {
|
|
1746
|
+
return { value: item.code, label: item.label, category: item.subType };
|
|
1747
|
+
}
|
|
1748
|
+
handleSearch(event) {
|
|
1749
|
+
if (!this.apiUrl) {
|
|
1750
|
+
return;
|
|
1751
|
+
}
|
|
1752
|
+
const valueSearch = event.detail.value;
|
|
1753
|
+
if (valueSearch.length > 2) {
|
|
1754
|
+
this.search(valueSearch).then((options) => {
|
|
1755
|
+
this.options = options;
|
|
1756
|
+
this.apiErrorMessage = "";
|
|
1757
|
+
}).catch(() => {
|
|
1758
|
+
this.apiErrorMessage = this.searchErrorMessage;
|
|
1759
|
+
this.options = [];
|
|
1760
|
+
});
|
|
1761
|
+
} else {
|
|
1762
|
+
this.options = [];
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
handleUpdateSelection(event) {
|
|
1766
|
+
const newValues = event.detail;
|
|
1767
|
+
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);
|
|
1768
|
+
const updatedSelections = this.selected.filter((option) => newValues.includes(option.value));
|
|
1769
|
+
this.selected = [...updatedSelections, ...newSelections];
|
|
1770
|
+
this.options = [];
|
|
1771
|
+
}
|
|
1772
|
+
getValue() {
|
|
1773
|
+
return this.selected;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
__decorateClass$6([
|
|
1777
|
+
n2({ type: Object, attribute: "patient-profile" })
|
|
1778
|
+
], PatientCodeSearchFormBase.prototype, "patientProfile");
|
|
1779
|
+
__decorateClass$6([
|
|
1780
|
+
n2({ type: String, attribute: "api-url" })
|
|
1781
|
+
], PatientCodeSearchFormBase.prototype, "apiUrl");
|
|
1782
|
+
__decorateClass$6([
|
|
1783
|
+
r()
|
|
1784
|
+
], PatientCodeSearchFormBase.prototype, "options");
|
|
1785
|
+
__decorateClass$6([
|
|
1786
|
+
r()
|
|
1787
|
+
], PatientCodeSearchFormBase.prototype, "selected");
|
|
1788
|
+
__decorateClass$6([
|
|
1789
|
+
r()
|
|
1790
|
+
], PatientCodeSearchFormBase.prototype, "apiErrorMessage");
|
|
1791
|
+
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}";
|
|
1792
|
+
var __defProp$4 = Object.defineProperty;
|
|
1793
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
1794
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
1795
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
1796
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
1797
|
+
if (decorator = decorators[i4])
|
|
1798
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1799
|
+
if (kind && result) __defProp$4(target, key, result);
|
|
1800
|
+
return result;
|
|
1801
|
+
};
|
|
1802
|
+
let PatientPathologiesForm = class extends PatientCodeSearchFormBase {
|
|
1803
|
+
get searchErrorMessage() {
|
|
1804
|
+
return "Erreur lors de la récupération des pathologies";
|
|
1805
|
+
}
|
|
1806
|
+
extractInitialSelection(patientProfile) {
|
|
1807
|
+
return getPatientConditionsWithCode(patientProfile);
|
|
1808
|
+
}
|
|
1809
|
+
async search(term) {
|
|
1810
|
+
const typePathology = this.preferences?.typePathology ?? "";
|
|
1811
|
+
const response = await fetchPathologiesByTerm(term, typePathology, new SearchRequestBody({}), this.apiUrl);
|
|
1812
|
+
return response.content.map((pathology) => this.apiReturnToSelectOption(pathology));
|
|
1813
|
+
}
|
|
1814
|
+
render() {
|
|
1815
|
+
return b`
|
|
1816
|
+
<div class="${PREFIX}-edition-modal-large-section">
|
|
1817
|
+
<span>Pathologies suivies</span>
|
|
1818
|
+
${this.apiErrorMessage !== "" ? b`<span class="${PREFIX}-edition-modal-error-message">${this.apiErrorMessage}</span>` : A}
|
|
1819
|
+
<bcbd-select data-test-id="pathologies-select" id="pathologiesSelect" use-input multiple aria-label="Pathologies suivies"
|
|
1820
|
+
.selectedOptions=${this.selected} .options=${this.options}
|
|
1821
|
+
@filter=${this.handleSearch} @change=${this.handleUpdateSelection}></bcbd-select>
|
|
1822
|
+
</div>
|
|
1823
|
+
`;
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1826
|
+
PatientPathologiesForm.styles = i$5`${r$4(patientCodeSearchFormCSS)}`;
|
|
1827
|
+
__decorateClass$5([
|
|
1828
|
+
n2({ type: Object })
|
|
1829
|
+
], PatientPathologiesForm.prototype, "preferences", 2);
|
|
1830
|
+
PatientPathologiesForm = __decorateClass$5([
|
|
1831
|
+
t("bcb-patient-pathologies-form")
|
|
1832
|
+
], PatientPathologiesForm);
|
|
1833
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
1834
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
1835
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
1836
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
1837
|
+
if (decorator = decorators[i4])
|
|
1838
|
+
result = decorator(result) || result;
|
|
1839
|
+
return result;
|
|
1840
|
+
};
|
|
1841
|
+
let PatientAllergiesForm = class extends PatientCodeSearchFormBase {
|
|
1842
|
+
get searchErrorMessage() {
|
|
1843
|
+
return "Erreur lors de la récupération des allergies";
|
|
1844
|
+
}
|
|
1845
|
+
extractInitialSelection(patientProfile) {
|
|
1846
|
+
return getPatientAllergiesWithCode(patientProfile);
|
|
1847
|
+
}
|
|
1848
|
+
async search(term) {
|
|
1849
|
+
const response = await fetchMoleculesByTerm(term, new SearchRequestBody({}), this.apiUrl);
|
|
1850
|
+
return response.content.map((allergy) => this.apiReturnToSelectOption(allergy));
|
|
1851
|
+
}
|
|
1852
|
+
render() {
|
|
1853
|
+
return b`
|
|
1854
|
+
<div class="${PREFIX}-edition-modal-large-section">
|
|
1855
|
+
<span>Allergies</span>
|
|
1856
|
+
${this.apiErrorMessage !== "" ? b`<span class="${PREFIX}-edition-modal-error-message">${this.apiErrorMessage}</span>` : A}
|
|
1857
|
+
<bcbd-select data-test-id="allergies-select" id="allergiesSelect" use-input multiple aria-label="Allergies"
|
|
1858
|
+
.selectedOptions=${this.selected} .options=${this.options}
|
|
1859
|
+
@filter=${this.handleSearch} @change=${this.handleUpdateSelection}
|
|
1860
|
+
></bcbd-select>
|
|
1861
|
+
</div>
|
|
1862
|
+
`;
|
|
1863
|
+
}
|
|
1864
|
+
};
|
|
1865
|
+
PatientAllergiesForm.styles = i$5`${r$4(patientCodeSearchFormCSS)}`;
|
|
1866
|
+
PatientAllergiesForm = __decorateClass$4([
|
|
1867
|
+
t("bcb-patient-allergies-form")
|
|
1868
|
+
], PatientAllergiesForm);
|
|
1869
|
+
const convertRenalInsufficiency = async (type, value, patient, apiUrl) => {
|
|
1870
|
+
const response = await fetch(`${apiUrl}/prescription/patient/fhir/renal-insufficiency-conversion`, {
|
|
1871
|
+
method: "POST",
|
|
1872
|
+
headers: {
|
|
1873
|
+
"Content-Type": "application/json"
|
|
1874
|
+
},
|
|
1875
|
+
body: JSON.stringify({
|
|
1876
|
+
typeEntree: type,
|
|
1877
|
+
valeur: value,
|
|
1878
|
+
patient
|
|
1879
|
+
})
|
|
1880
|
+
});
|
|
1881
|
+
return response.json();
|
|
1882
|
+
};
|
|
1883
|
+
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}";
|
|
1884
|
+
var __defProp$3 = Object.defineProperty;
|
|
1885
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
1886
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
1887
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
1888
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
1889
|
+
if (decorator = decorators[i4])
|
|
1890
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1891
|
+
if (kind && result) __defProp$3(target, key, result);
|
|
1892
|
+
return result;
|
|
1893
|
+
};
|
|
1894
|
+
let PatientRenalForm = class extends i$2 {
|
|
1895
|
+
constructor() {
|
|
1896
|
+
super(...arguments);
|
|
1897
|
+
this.apiUrl = "https://api-dev.claudebernard.fr";
|
|
1898
|
+
this.creatinineByMg = 0;
|
|
1899
|
+
this.creatinineByUmol = 0;
|
|
1900
|
+
this.clairanceCreatinine = 0;
|
|
1901
|
+
this.dfg = 0;
|
|
1902
|
+
this.renalLackInformationErrorMessage = "";
|
|
1903
|
+
}
|
|
1904
|
+
updated(changedProperties) {
|
|
1905
|
+
if (!changedProperties.has("patientProfile")) {
|
|
1906
|
+
return;
|
|
1907
|
+
}
|
|
1908
|
+
this.resetFromProfile();
|
|
1909
|
+
}
|
|
1910
|
+
resetFromProfile() {
|
|
1911
|
+
const creatinine = getCreatinine(this.patientProfile);
|
|
1912
|
+
const renalStatus = getPatientRenalInsufficiencyStatus(this.patientProfile);
|
|
1913
|
+
const creatinineByMg = creatinine.find((c2) => c2.unit?.toLowerCase() === "mg/l");
|
|
1914
|
+
const creatinineByUmol = creatinine.find((c2) => c2.unit === "μmol/L");
|
|
1915
|
+
this.renalLackInformationErrorMessage = "";
|
|
1916
|
+
this.clairanceCreatinine = renalStatus?.clearance?.value ?? 0;
|
|
1917
|
+
this.dfg = renalStatus?.gfr?.value ?? 0;
|
|
1918
|
+
this.creatinineByMg = creatinineByMg?.value ?? 0;
|
|
1919
|
+
this.creatinineByUmol = creatinineByUmol?.value ?? 0;
|
|
1920
|
+
}
|
|
1921
|
+
// Patch un clone du profil avec les valeurs démographiques en cours de saisie
|
|
1922
|
+
// (non encore validées, donc absentes de `this.patientProfile`) : l'API de
|
|
1923
|
+
// conversion rénale a besoin de l'âge/sexe/poids à jour pour calculer correctement.
|
|
1924
|
+
buildConversionPatient() {
|
|
1925
|
+
if (!this.patientProfile) {
|
|
1926
|
+
return this.patientProfile;
|
|
1927
|
+
}
|
|
1928
|
+
const patched = structuredClone(this.patientProfile);
|
|
1929
|
+
const demographics = this.demographics;
|
|
1930
|
+
if (demographics?.birthDate) {
|
|
1931
|
+
setPatientAge(patched, demographics.birthDate);
|
|
1932
|
+
}
|
|
1933
|
+
if (demographics?.gender === "male" || demographics?.gender === "female" || demographics?.gender === "unknown") {
|
|
1934
|
+
setPatientGender(patched, demographics.gender);
|
|
1935
|
+
}
|
|
1936
|
+
if (demographics && !isNaN(demographics.weight) && demographics.weight > 0) {
|
|
1937
|
+
setPatientWeight(patched, demographics.weight);
|
|
1938
|
+
}
|
|
1939
|
+
return patched;
|
|
1940
|
+
}
|
|
1846
1941
|
async handleRenalConversion(type, value) {
|
|
1847
1942
|
if (isNaN(value) || value <= 0) {
|
|
1848
1943
|
return;
|
|
@@ -1851,7 +1946,7 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1851
1946
|
const result = await convertRenalInsufficiency(
|
|
1852
1947
|
type,
|
|
1853
1948
|
value,
|
|
1854
|
-
this.
|
|
1949
|
+
this.buildConversionPatient(),
|
|
1855
1950
|
this.apiUrl
|
|
1856
1951
|
);
|
|
1857
1952
|
if (result.error) {
|
|
@@ -1875,7 +1970,7 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1875
1970
|
this.renalLackInformationErrorMessage = "Erreur lors de la conversion de l'insuffisance rénale";
|
|
1876
1971
|
}
|
|
1877
1972
|
}
|
|
1878
|
-
|
|
1973
|
+
recalculate() {
|
|
1879
1974
|
const creatinineUmol = Number(this.creatinineUmolInput?.value ?? "");
|
|
1880
1975
|
const creatinineMg = Number(this.creatinineMgLInput?.value ?? "");
|
|
1881
1976
|
const clairance = Number(this.clairanceCreatinineInput?.value ?? "");
|
|
@@ -1890,123 +1985,231 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
1890
1985
|
this.handleRenalConversion(4, dfg);
|
|
1891
1986
|
}
|
|
1892
1987
|
}
|
|
1893
|
-
|
|
1988
|
+
getValue() {
|
|
1894
1989
|
return {
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1990
|
+
creatinineByMg: Number(this.creatinineMgLInput?.value ?? ""),
|
|
1991
|
+
creatinineByUmol: Number(this.creatinineUmolInput?.value ?? ""),
|
|
1992
|
+
clairanceCreatinine: Number(this.clairanceCreatinineInput?.value ?? ""),
|
|
1993
|
+
dfg: Number(this.dfgInput?.value ?? "")
|
|
1898
1994
|
};
|
|
1899
1995
|
}
|
|
1900
|
-
|
|
1901
|
-
|
|
1996
|
+
render() {
|
|
1997
|
+
return b`
|
|
1998
|
+
<fieldset class="${PREFIX}-edition-modal-fieldset" data-test-id="renal-insufficiency-fieldset">
|
|
1999
|
+
<legend class="${PREFIX}-edition-modal-subtitle">
|
|
2000
|
+
<span>Insuffisance rénale</span>
|
|
2001
|
+
</legend>
|
|
2002
|
+
${this.renalLackInformationErrorMessage !== "" ? b`<span class="${PREFIX}-edition-modal-error-message">${this.renalLackInformationErrorMessage}</span>` : A}
|
|
2003
|
+
<div class="${PREFIX}-edition-modal-information-section">
|
|
2004
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
2005
|
+
<span>Créatininémie (μmol/L)</span>
|
|
2006
|
+
<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>
|
|
2007
|
+
</div>
|
|
2008
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
2009
|
+
<span>Créatininémie (mg/L)</span>
|
|
2010
|
+
<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>
|
|
2011
|
+
</div>
|
|
2012
|
+
</div>
|
|
2013
|
+
<div class="${PREFIX}-edition-modal-information-section">
|
|
2014
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
2015
|
+
<span>Clairance créatinine (ml/min)</span>
|
|
2016
|
+
<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>
|
|
2017
|
+
</div>
|
|
2018
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
2019
|
+
<span>DFG (mL/min/1.73.m2)</span>
|
|
2020
|
+
<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>
|
|
2021
|
+
</div>
|
|
2022
|
+
</div>
|
|
2023
|
+
</fieldset>`;
|
|
2024
|
+
}
|
|
2025
|
+
};
|
|
2026
|
+
PatientRenalForm.styles = i$5`${r$4(patientRenalFormCSS)}`;
|
|
2027
|
+
__decorateClass$3([
|
|
2028
|
+
n2({ type: Object, attribute: "patient-profile" })
|
|
2029
|
+
], PatientRenalForm.prototype, "patientProfile", 2);
|
|
2030
|
+
__decorateClass$3([
|
|
2031
|
+
n2({ type: String, attribute: "api-url" })
|
|
2032
|
+
], PatientRenalForm.prototype, "apiUrl", 2);
|
|
2033
|
+
__decorateClass$3([
|
|
2034
|
+
n2({ type: Object })
|
|
2035
|
+
], PatientRenalForm.prototype, "demographics", 2);
|
|
2036
|
+
__decorateClass$3([
|
|
2037
|
+
r()
|
|
2038
|
+
], PatientRenalForm.prototype, "creatinineByMg", 2);
|
|
2039
|
+
__decorateClass$3([
|
|
2040
|
+
r()
|
|
2041
|
+
], PatientRenalForm.prototype, "creatinineByUmol", 2);
|
|
2042
|
+
__decorateClass$3([
|
|
2043
|
+
r()
|
|
2044
|
+
], PatientRenalForm.prototype, "clairanceCreatinine", 2);
|
|
2045
|
+
__decorateClass$3([
|
|
2046
|
+
r()
|
|
2047
|
+
], PatientRenalForm.prototype, "dfg", 2);
|
|
2048
|
+
__decorateClass$3([
|
|
2049
|
+
r()
|
|
2050
|
+
], PatientRenalForm.prototype, "renalLackInformationErrorMessage", 2);
|
|
2051
|
+
__decorateClass$3([
|
|
2052
|
+
e$1("#creatinineUmolInput")
|
|
2053
|
+
], PatientRenalForm.prototype, "creatinineUmolInput", 2);
|
|
2054
|
+
__decorateClass$3([
|
|
2055
|
+
e$1("#creatininemgLInput")
|
|
2056
|
+
], PatientRenalForm.prototype, "creatinineMgLInput", 2);
|
|
2057
|
+
__decorateClass$3([
|
|
2058
|
+
e$1("#clairanceCreatinineInput")
|
|
2059
|
+
], PatientRenalForm.prototype, "clairanceCreatinineInput", 2);
|
|
2060
|
+
__decorateClass$3([
|
|
2061
|
+
e$1("#dfgInput")
|
|
2062
|
+
], PatientRenalForm.prototype, "dfgInput", 2);
|
|
2063
|
+
PatientRenalForm = __decorateClass$3([
|
|
2064
|
+
t("bcb-patient-renal-form")
|
|
2065
|
+
], PatientRenalForm);
|
|
2066
|
+
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}";
|
|
2067
|
+
var __defProp$2 = Object.defineProperty;
|
|
2068
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
2069
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
2070
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
2071
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
2072
|
+
if (decorator = decorators[i4])
|
|
2073
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2074
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
2075
|
+
return result;
|
|
2076
|
+
};
|
|
2077
|
+
let PatientHepaticForm = class extends i$2 {
|
|
2078
|
+
constructor() {
|
|
2079
|
+
super(...arguments);
|
|
2080
|
+
this.defaultHepaticStade = {};
|
|
2081
|
+
}
|
|
2082
|
+
updated(changedProperties) {
|
|
2083
|
+
if (!changedProperties.has("patientProfile")) {
|
|
1902
2084
|
return;
|
|
1903
2085
|
}
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
2086
|
+
this.defaultHepaticStade = this.getPatientHepaticStadeFromProfile();
|
|
2087
|
+
}
|
|
2088
|
+
getPatientHepaticStadeFromProfile() {
|
|
2089
|
+
const renalStade = getPatientHepaticInsufficiencyStade(this.patientProfile);
|
|
2090
|
+
const selectedOption = hepaticStadeOptions.find((option) => option.label === renalStade);
|
|
2091
|
+
return selectedOption ? { value: selectedOption.value, label: selectedOption.label } : {};
|
|
2092
|
+
}
|
|
2093
|
+
getValue() {
|
|
2094
|
+
return { stade: this.hepaticStadeSelect?.value ?? "" };
|
|
2095
|
+
}
|
|
2096
|
+
render() {
|
|
2097
|
+
return b`
|
|
2098
|
+
<fieldset class="${PREFIX}-edition-modal-fieldset" data-test-id="hepatic-insufficiency-fieldset">
|
|
2099
|
+
<legend class="${PREFIX}-edition-modal-subtitle">
|
|
2100
|
+
<span>Insuffisance hépatique</span>
|
|
2101
|
+
</legend>
|
|
2102
|
+
<div class="${PREFIX}-edition-modal-information-section">
|
|
2103
|
+
<div class="${PREFIX}-edition-modal-little-section">
|
|
2104
|
+
<span>Stade de l'insuffisance hépatique</span>
|
|
2105
|
+
<bcbd-select data-test-id="hepatic-stade-select" id="hepaticStadeSelect"
|
|
2106
|
+
.options=${hepaticStadeOptions} .selectedOptions=${this.defaultHepaticStade} clearable>
|
|
2107
|
+
</bcbd-select>
|
|
2108
|
+
</div>
|
|
2109
|
+
</div>
|
|
2110
|
+
</fieldset>
|
|
2111
|
+
`;
|
|
2112
|
+
}
|
|
2113
|
+
};
|
|
2114
|
+
PatientHepaticForm.styles = i$5`${r$4(patientHepaticFormCSS)}`;
|
|
2115
|
+
__decorateClass$2([
|
|
2116
|
+
n2({ type: Object, attribute: "patient-profile" })
|
|
2117
|
+
], PatientHepaticForm.prototype, "patientProfile", 2);
|
|
2118
|
+
__decorateClass$2([
|
|
2119
|
+
r()
|
|
2120
|
+
], PatientHepaticForm.prototype, "defaultHepaticStade", 2);
|
|
2121
|
+
__decorateClass$2([
|
|
2122
|
+
e$1("#hepaticStadeSelect")
|
|
2123
|
+
], PatientHepaticForm.prototype, "hepaticStadeSelect", 2);
|
|
2124
|
+
PatientHepaticForm = __decorateClass$2([
|
|
2125
|
+
t("bcb-patient-hepatic-form")
|
|
2126
|
+
], PatientHepaticForm);
|
|
2127
|
+
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}";
|
|
2128
|
+
var __defProp$1 = Object.defineProperty;
|
|
2129
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
2130
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
2131
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
2132
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
2133
|
+
if (decorator = decorators[i4])
|
|
2134
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2135
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
2136
|
+
return result;
|
|
2137
|
+
};
|
|
2138
|
+
let PatientProfileEdition = class extends i$2 {
|
|
2139
|
+
constructor() {
|
|
2140
|
+
super(...arguments);
|
|
2141
|
+
this.apiUrl = "https://api-dev.claudebernard.fr";
|
|
2142
|
+
this.isPregnancyDivVisible = false;
|
|
2143
|
+
this.demographicsHasError = false;
|
|
2144
|
+
this.resetKey = 0;
|
|
2145
|
+
}
|
|
2146
|
+
open() {
|
|
2147
|
+
if (!this.patientProfile || Object.keys(this.patientProfile).length === 0) {
|
|
2148
|
+
this.patientProfile = setInitialPatientProfile();
|
|
1917
2149
|
}
|
|
2150
|
+
this.editionModalElement.open();
|
|
1918
2151
|
}
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
const updatedSelections = this.selectedPathologyOptions.filter((option) => newValues.includes(option.value));
|
|
1923
|
-
this.selectedPathologyOptions = [...updatedSelections, ...newSelections];
|
|
1924
|
-
this.pathologyOptions = [];
|
|
2152
|
+
handleCancel() {
|
|
2153
|
+
this.resetKey++;
|
|
2154
|
+
this.editionModalElement.close();
|
|
1925
2155
|
}
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
2156
|
+
handleDemographicsChange(event) {
|
|
2157
|
+
this.demographicsHasError = event.detail.hasError;
|
|
2158
|
+
this.isPregnancyDivVisible = event.detail.isPregnancyEligible;
|
|
2159
|
+
if (this.renalForm) {
|
|
2160
|
+
this.renalForm.demographics = this.demographicsForm.getValue();
|
|
1929
2161
|
}
|
|
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 = [];
|
|
2162
|
+
if (event.detail.triggerRenalRecalculation) {
|
|
2163
|
+
this.renalForm?.recalculate();
|
|
1942
2164
|
}
|
|
1943
2165
|
}
|
|
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
2166
|
// eslint-disable-next-line complexity
|
|
1952
2167
|
validateForm() {
|
|
1953
2168
|
if (!this.patientProfile || Object.keys(this.patientProfile).length === 0) {
|
|
1954
2169
|
this.patientProfile = setInitialPatientProfile();
|
|
1955
2170
|
}
|
|
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);
|
|
2171
|
+
const demographics = this.demographicsForm.getValue();
|
|
2172
|
+
const reproductive = this.reproductiveForm.getValue();
|
|
2173
|
+
const pathologies = this.pathologiesForm.getValue();
|
|
2174
|
+
const allergies = this.allergiesForm.getValue();
|
|
2175
|
+
const renal = this.renalForm.getValue();
|
|
2176
|
+
const hepatic = this.hepaticForm.getValue();
|
|
2177
|
+
if (demographics.birthDate !== "") {
|
|
2178
|
+
setPatientAge(this.patientProfile, demographics.birthDate);
|
|
1968
2179
|
}
|
|
1969
|
-
if (!isNaN(weight) || weight > 0) {
|
|
1970
|
-
setPatientWeight(this.patientProfile, weight);
|
|
2180
|
+
if (!isNaN(demographics.weight) || demographics.weight > 0) {
|
|
2181
|
+
setPatientWeight(this.patientProfile, demographics.weight);
|
|
1971
2182
|
}
|
|
1972
|
-
if (!isNaN(
|
|
1973
|
-
setPatientHeight(this.patientProfile,
|
|
2183
|
+
if (!isNaN(demographics.height) || demographics.height > 0) {
|
|
2184
|
+
setPatientHeight(this.patientProfile, demographics.height);
|
|
1974
2185
|
}
|
|
1975
|
-
if (gender === "male" || gender === "female" || gender === "unknown") {
|
|
1976
|
-
setPatientGender(this.patientProfile, gender);
|
|
2186
|
+
if (demographics.gender === "male" || demographics.gender === "female" || demographics.gender === "unknown") {
|
|
2187
|
+
setPatientGender(this.patientProfile, demographics.gender);
|
|
1977
2188
|
}
|
|
1978
|
-
if (!isNaN(
|
|
1979
|
-
setCreatinineByUmolL(this.patientProfile,
|
|
2189
|
+
if (!isNaN(renal.creatinineByUmol) || renal.creatinineByUmol > 0) {
|
|
2190
|
+
setCreatinineByUmolL(this.patientProfile, renal.creatinineByUmol);
|
|
1980
2191
|
}
|
|
1981
|
-
if (!isNaN(
|
|
1982
|
-
setCreatinineBymgL(this.patientProfile,
|
|
2192
|
+
if (!isNaN(renal.creatinineByMg) || renal.creatinineByMg > 0) {
|
|
2193
|
+
setCreatinineBymgL(this.patientProfile, renal.creatinineByMg);
|
|
1983
2194
|
}
|
|
1984
|
-
if (!isNaN(clairanceCreatinine) || clairanceCreatinine > 0) {
|
|
1985
|
-
setPatientClearance(this.patientProfile, clairanceCreatinine);
|
|
2195
|
+
if (!isNaN(renal.clairanceCreatinine) || renal.clairanceCreatinine > 0) {
|
|
2196
|
+
setPatientClearance(this.patientProfile, renal.clairanceCreatinine);
|
|
1986
2197
|
}
|
|
1987
|
-
if (!isNaN(dfg) || dfg > 0) {
|
|
1988
|
-
setPatientGFRByBSA(this.patientProfile, dfg);
|
|
2198
|
+
if (!isNaN(renal.dfg) || renal.dfg > 0) {
|
|
2199
|
+
setPatientGFRByBSA(this.patientProfile, renal.dfg);
|
|
1989
2200
|
}
|
|
1990
|
-
if (
|
|
1991
|
-
setPatientHepaticInsufficiencyStatus(this.patientProfile,
|
|
2201
|
+
if (hepatic.stade === "A" || hepatic.stade === "B" || hepatic.stade === "C") {
|
|
2202
|
+
setPatientHepaticInsufficiencyStatus(this.patientProfile, hepatic.stade);
|
|
1992
2203
|
} else {
|
|
1993
2204
|
deletePatientHepaticInsufficiencyStatus(this.patientProfile);
|
|
1994
2205
|
}
|
|
1995
|
-
if (
|
|
1996
|
-
this.
|
|
1997
|
-
this.breastfeeding = false;
|
|
1998
|
-
}
|
|
1999
|
-
if (this.isPregnant) {
|
|
2000
|
-
if (!isNaN(gestationalWeeks)) {
|
|
2001
|
-
setPatientAmenorrheaStatus(this.patientProfile, gestationalWeeks);
|
|
2002
|
-
} else {
|
|
2003
|
-
setPatientAmenorrheaStatus(this.patientProfile, 0);
|
|
2004
|
-
}
|
|
2206
|
+
if (reproductive.isPregnant) {
|
|
2207
|
+
setPatientAmenorrheaStatus(this.patientProfile, isNaN(reproductive.gestationalWeeks) ? 0 : reproductive.gestationalWeeks);
|
|
2005
2208
|
}
|
|
2006
|
-
setPatientBreastfeedingStatus(this.patientProfile,
|
|
2007
|
-
setPatientPregnancyStatus(this.patientProfile,
|
|
2008
|
-
setPatientConditions(this.patientProfile,
|
|
2009
|
-
setPatientAllergies(this.patientProfile,
|
|
2209
|
+
setPatientBreastfeedingStatus(this.patientProfile, reproductive.breastfeeding);
|
|
2210
|
+
setPatientPregnancyStatus(this.patientProfile, reproductive.isPregnant);
|
|
2211
|
+
setPatientConditions(this.patientProfile, pathologies);
|
|
2212
|
+
setPatientAllergies(this.patientProfile, allergies);
|
|
2010
2213
|
const updatedProfile = {
|
|
2011
2214
|
...this.patientProfile,
|
|
2012
2215
|
entry: this.patientProfile?.entry ? [...this.patientProfile.entry] : void 0
|
|
@@ -2022,108 +2225,26 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
2022
2225
|
return b`
|
|
2023
2226
|
<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
2227
|
${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>
|
|
2228
|
+
<bcb-patient-demographics-form .patientProfile=${this.patientProfile} .preferences=${this.preferences}
|
|
2229
|
+
@demographics-change=${this.handleDemographicsChange}></bcb-patient-demographics-form>
|
|
2230
|
+
|
|
2231
|
+
<bcb-patient-reproductive-form .patientProfile=${this.patientProfile} .visible=${this.isPregnancyDivVisible}></bcb-patient-reproductive-form>
|
|
2232
|
+
|
|
2233
|
+
<bcb-patient-pathologies-form .patientProfile=${this.patientProfile} .apiUrl=${this.apiUrl} .preferences=${this.preferences}></bcb-patient-pathologies-form>
|
|
2234
|
+
|
|
2235
|
+
<bcb-patient-allergies-form .patientProfile=${this.patientProfile} .apiUrl=${this.apiUrl}></bcb-patient-allergies-form>
|
|
2236
|
+
|
|
2237
|
+
<bcb-patient-renal-form .patientProfile=${this.patientProfile} .apiUrl=${this.apiUrl}></bcb-patient-renal-form>
|
|
2238
|
+
|
|
2239
|
+
<bcb-patient-hepatic-form .patientProfile=${this.patientProfile}></bcb-patient-hepatic-form>
|
|
2106
2240
|
|
|
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
2241
|
<div class="${PREFIX}-edition-modal-disclaimer-section">
|
|
2121
2242
|
<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
2243
|
</bcbd-alert>
|
|
2123
2244
|
</div>
|
|
2124
2245
|
</div>
|
|
2125
2246
|
<div slot="actions" class="${PREFIX}-edition-modal-action-buttons" data-test-id="action-buttons">
|
|
2126
|
-
<bcbd-button ?disabled=${this.
|
|
2247
|
+
<bcbd-button ?disabled=${this.demographicsHasError}
|
|
2127
2248
|
data-test-id="save-button" background-color="primary" @click=${this.validateForm}>Valider</bcbd-button>
|
|
2128
2249
|
<bcbd-button data-test-id="cancel-button" outlined background-color="primary" @click=${this.handleCancel}>Annuler</bcbd-button>
|
|
2129
2250
|
</div>
|
|
@@ -2144,114 +2265,36 @@ __decorateClass$1([
|
|
|
2144
2265
|
__decorateClass$1([
|
|
2145
2266
|
n2({ type: Object })
|
|
2146
2267
|
], 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
2268
|
__decorateClass$1([
|
|
2175
2269
|
r()
|
|
2176
2270
|
], PatientProfileEdition.prototype, "isPregnancyDivVisible", 2);
|
|
2177
2271
|
__decorateClass$1([
|
|
2178
2272
|
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);
|
|
2273
|
+
], PatientProfileEdition.prototype, "demographicsHasError", 2);
|
|
2216
2274
|
__decorateClass$1([
|
|
2217
2275
|
r()
|
|
2218
2276
|
], 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
2277
|
__decorateClass$1([
|
|
2241
2278
|
e$1("#patient-profile-edition-modal")
|
|
2242
2279
|
], PatientProfileEdition.prototype, "editionModalElement", 2);
|
|
2243
2280
|
__decorateClass$1([
|
|
2244
|
-
e$1("
|
|
2245
|
-
], PatientProfileEdition.prototype, "
|
|
2281
|
+
e$1("bcb-patient-demographics-form")
|
|
2282
|
+
], PatientProfileEdition.prototype, "demographicsForm", 2);
|
|
2246
2283
|
__decorateClass$1([
|
|
2247
|
-
e$1("
|
|
2248
|
-
], PatientProfileEdition.prototype, "
|
|
2284
|
+
e$1("bcb-patient-reproductive-form")
|
|
2285
|
+
], PatientProfileEdition.prototype, "reproductiveForm", 2);
|
|
2249
2286
|
__decorateClass$1([
|
|
2250
|
-
e$1("
|
|
2251
|
-
], PatientProfileEdition.prototype, "
|
|
2287
|
+
e$1("bcb-patient-pathologies-form")
|
|
2288
|
+
], PatientProfileEdition.prototype, "pathologiesForm", 2);
|
|
2252
2289
|
__decorateClass$1([
|
|
2253
|
-
e$1("
|
|
2254
|
-
], PatientProfileEdition.prototype, "
|
|
2290
|
+
e$1("bcb-patient-allergies-form")
|
|
2291
|
+
], PatientProfileEdition.prototype, "allergiesForm", 2);
|
|
2292
|
+
__decorateClass$1([
|
|
2293
|
+
e$1("bcb-patient-renal-form")
|
|
2294
|
+
], PatientProfileEdition.prototype, "renalForm", 2);
|
|
2295
|
+
__decorateClass$1([
|
|
2296
|
+
e$1("bcb-patient-hepatic-form")
|
|
2297
|
+
], PatientProfileEdition.prototype, "hepaticForm", 2);
|
|
2255
2298
|
PatientProfileEdition = __decorateClass$1([
|
|
2256
2299
|
t("bcb-patient-profile-edition")
|
|
2257
2300
|
], PatientProfileEdition);
|