@imranq2/fhirpatientsummary 1.0.30 → 1.0.31
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/index.cjs +60 -32
- package/dist/index.js +60 -32
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1435,7 +1435,8 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
1435
1435
|
static generateStaticNarrative(resources, timezone) {
|
|
1436
1436
|
const templateUtilities = new TemplateUtilities(resources);
|
|
1437
1437
|
const combinedPatient = this.combinePatients(resources);
|
|
1438
|
-
|
|
1438
|
+
let html = `<p>This section merges all Patient resources into a single combined patient record, preferring non-empty values for each field.</p>`;
|
|
1439
|
+
html += `<div>
|
|
1439
1440
|
<ul>
|
|
1440
1441
|
<li><strong>Name(s):</strong>${this.renderNames(combinedPatient)}</li>
|
|
1441
1442
|
<li><strong>Gender:</strong>${combinedPatient.gender ? this.capitalize(combinedPatient.gender) : ""}</li>
|
|
@@ -1447,6 +1448,7 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
1447
1448
|
<li><strong>Language(s):</strong>${this.renderCommunication(templateUtilities, combinedPatient)}</li>
|
|
1448
1449
|
</ul>
|
|
1449
1450
|
</div>`;
|
|
1451
|
+
return html;
|
|
1450
1452
|
}
|
|
1451
1453
|
/**
|
|
1452
1454
|
* Combines multiple patient resources into a single patient object
|
|
@@ -1771,7 +1773,9 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1771
1773
|
generateSummaryNarrative(resources, timezone) {
|
|
1772
1774
|
const templateUtilities = new TemplateUtilities(resources);
|
|
1773
1775
|
let isSummaryCreated = false;
|
|
1774
|
-
let html =
|
|
1776
|
+
let html = `<p>This list includes all AllergyIntolerance resources, with no additional filtering, sorted as provided.</p>
|
|
1777
|
+
`;
|
|
1778
|
+
html += `
|
|
1775
1779
|
<div>
|
|
1776
1780
|
<table>
|
|
1777
1781
|
<thead>
|
|
@@ -1853,7 +1857,8 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1853
1857
|
const dateB = b.onsetDateTime;
|
|
1854
1858
|
return dateA && dateB ? new Date(dateB).getTime() - new Date(dateA).getTime() : 0;
|
|
1855
1859
|
});
|
|
1856
|
-
let html =
|
|
1860
|
+
let html = `<p>This list includes all AllergyIntolerance resources, with no additional filtering, sorted as provided.</p>
|
|
1861
|
+
`;
|
|
1857
1862
|
html += `
|
|
1858
1863
|
<div class="ActiveAllergies">
|
|
1859
1864
|
<h3>Active</h3>
|
|
@@ -1979,7 +1984,8 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1979
1984
|
let isSummaryCreated = false;
|
|
1980
1985
|
const currentDate = now || /* @__PURE__ */ new Date();
|
|
1981
1986
|
const twoYearsAgo = new Date(currentDate.getFullYear(), currentDate.getMonth() - 24, currentDate.getDate());
|
|
1982
|
-
let html =
|
|
1987
|
+
let html = "<p>This list includes all the medications that were ordered for the patient, the medications they filled from the pharmacy and the medications they reported, filtered to past 2 years and sorted by start date.</p>";
|
|
1988
|
+
html += `
|
|
1983
1989
|
<div>
|
|
1984
1990
|
<table>
|
|
1985
1991
|
<thead>
|
|
@@ -2305,6 +2311,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2305
2311
|
let isSummaryCreated = false;
|
|
2306
2312
|
let html = `
|
|
2307
2313
|
<div>
|
|
2314
|
+
<p>This list includes all vaccinations, sorted by occurrence date (most recent first).</p>
|
|
2308
2315
|
<table>
|
|
2309
2316
|
<thead>
|
|
2310
2317
|
<tr>
|
|
@@ -2387,7 +2394,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2387
2394
|
for (const resourceItem of immunizations) {
|
|
2388
2395
|
const imm = resourceItem;
|
|
2389
2396
|
html += `
|
|
2390
|
-
<tr
|
|
2397
|
+
<tr>
|
|
2391
2398
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.codeableConceptDisplay(imm.vaccineCode))}</td>
|
|
2392
2399
|
<td>${templateUtilities.codeableConceptCoding(imm.vaccineCode)}</td>
|
|
2393
2400
|
<td>${imm.status || ""}</td>
|
|
@@ -2427,7 +2434,8 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
2427
2434
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2428
2435
|
static generateStaticNarrative(resources, timezone) {
|
|
2429
2436
|
const templateUtilities = new TemplateUtilities(resources);
|
|
2430
|
-
let html =
|
|
2437
|
+
let html = `<p>This list includes patient problems, sorted by recorded date (most recent first)</p>
|
|
2438
|
+
`;
|
|
2431
2439
|
const activeConditions = resources.map((entry) => entry) || [];
|
|
2432
2440
|
activeConditions.sort((a, b) => {
|
|
2433
2441
|
if (!a.recordedDate && b.recordedDate) return -1;
|
|
@@ -2457,7 +2465,7 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
2457
2465
|
continue;
|
|
2458
2466
|
}
|
|
2459
2467
|
seenCodeAndSystems.add(codeAndSystem);
|
|
2460
|
-
html += `<tr
|
|
2468
|
+
html += `<tr>
|
|
2461
2469
|
<td class="Name">${conditionDisplay}</td>
|
|
2462
2470
|
<td class="CodeSystem">${codeAndSystem}</td>
|
|
2463
2471
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
@@ -2491,7 +2499,9 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2491
2499
|
generateSummaryNarrative(resources, timezone) {
|
|
2492
2500
|
const templateUtilities = new TemplateUtilities(resources);
|
|
2493
2501
|
let isSummaryCreated = false;
|
|
2494
|
-
let html =
|
|
2502
|
+
let html = `<p>This list includes the latest vital signs, sorted by effective date (most recent first).</p>
|
|
2503
|
+
`;
|
|
2504
|
+
html += `
|
|
2495
2505
|
<div>
|
|
2496
2506
|
<table>
|
|
2497
2507
|
<thead>
|
|
@@ -2564,7 +2574,9 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2564
2574
|
const dateB = b.effectiveDateTime || b.effectivePeriod?.start;
|
|
2565
2575
|
return dateA && dateB ? new Date(dateB).getTime() - new Date(dateA).getTime() : 0;
|
|
2566
2576
|
});
|
|
2567
|
-
let html =
|
|
2577
|
+
let html = `<p>This list includes the latest vital signs, sorted by effective date (most recent first).</p>
|
|
2578
|
+
`;
|
|
2579
|
+
html += `
|
|
2568
2580
|
<table>
|
|
2569
2581
|
<thead>
|
|
2570
2582
|
<tr>
|
|
@@ -2582,7 +2594,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2582
2594
|
<tbody>`;
|
|
2583
2595
|
for (const obs of observations) {
|
|
2584
2596
|
html += `
|
|
2585
|
-
<tr
|
|
2597
|
+
<tr>
|
|
2586
2598
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.codeableConceptDisplay(obs.code, "display"))}</td>
|
|
2587
2599
|
<td>${templateUtilities.codeableConceptCoding(obs.code)}</td>
|
|
2588
2600
|
<td>${templateUtilities.extractObservationValue(obs)}</td>
|
|
@@ -2620,7 +2632,7 @@ var MedicalDevicesTemplate = class _MedicalDevicesTemplate {
|
|
|
2620
2632
|
*/
|
|
2621
2633
|
static generateStaticNarrative(resources, timezone) {
|
|
2622
2634
|
const templateUtilities = new TemplateUtilities(resources);
|
|
2623
|
-
let html =
|
|
2635
|
+
let html = `<p>This list includes all DeviceUseStatement resources, sorted by recorded date (most recent first).</p>
|
|
2624
2636
|
<table>
|
|
2625
2637
|
<thead>
|
|
2626
2638
|
<tr>
|
|
@@ -2638,7 +2650,7 @@ var MedicalDevicesTemplate = class _MedicalDevicesTemplate {
|
|
|
2638
2650
|
});
|
|
2639
2651
|
for (const dus of deviceStatements) {
|
|
2640
2652
|
html += `
|
|
2641
|
-
<tr
|
|
2653
|
+
<tr>
|
|
2642
2654
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.renderDevice(dus.device))}</td>
|
|
2643
2655
|
<td>${templateUtilities.renderTextAsHtml(dus.status || "")}</td>
|
|
2644
2656
|
<td>${templateUtilities.renderNotes(dus.note, timezone)}</td>
|
|
@@ -2999,11 +3011,12 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
2999
3011
|
}
|
|
3000
3012
|
}
|
|
3001
3013
|
}
|
|
3002
|
-
let html =
|
|
3003
|
-
|
|
3014
|
+
let html = `<p>This section includes Observations from the last 2 years (one per lab name, using code mapping) and DiagnosticReports with status 'final' issued in the last 2 years. Both are sorted by date (most recent first). Older results are counted and noted below the tables.</p>
|
|
3015
|
+
`;
|
|
3004
3016
|
let observationhtml = `
|
|
3005
3017
|
<div>
|
|
3006
3018
|
<h3>Observations</h3>
|
|
3019
|
+
${html}
|
|
3007
3020
|
<table>
|
|
3008
3021
|
<thead>
|
|
3009
3022
|
<tr>
|
|
@@ -3019,6 +3032,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3019
3032
|
let diagnosticReporthtml = `
|
|
3020
3033
|
<div>
|
|
3021
3034
|
<h3>Diagnostic Reports</h3>
|
|
3035
|
+
${html}
|
|
3022
3036
|
<table>
|
|
3023
3037
|
<thead>
|
|
3024
3038
|
<tr>
|
|
@@ -3189,7 +3203,8 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3189
3203
|
const currentDate = now || /* @__PURE__ */ new Date();
|
|
3190
3204
|
const twoYearsAgo = new Date(currentDate);
|
|
3191
3205
|
twoYearsAgo.setFullYear(currentDate.getFullYear() - 2);
|
|
3192
|
-
let html =
|
|
3206
|
+
let html = `<p>This section includes Observations from the last 2 years (one per lab name, using code mapping) and DiagnosticReports with status 'final' issued in the last 2 years. Both are sorted by date (most recent first). Older results are counted and noted below the tables.</p>
|
|
3207
|
+
`;
|
|
3193
3208
|
let skippedObservations = 0;
|
|
3194
3209
|
let skippedDiagnosticReports = 0;
|
|
3195
3210
|
for (const resourceItem of resources) {
|
|
@@ -3451,7 +3466,9 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3451
3466
|
generateSummaryNarrative(resources, timezone) {
|
|
3452
3467
|
const templateUtilities = new TemplateUtilities(resources);
|
|
3453
3468
|
let isSummaryCreated = false;
|
|
3454
|
-
let html =
|
|
3469
|
+
let html = `<p>This list includes all Procedure resources, sorted by performed date (most recent first).</p>
|
|
3470
|
+
`;
|
|
3471
|
+
html += `
|
|
3455
3472
|
<div>
|
|
3456
3473
|
<table>
|
|
3457
3474
|
<thead>
|
|
@@ -3512,7 +3529,9 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3512
3529
|
*/
|
|
3513
3530
|
static generateStaticNarrative(resources, timezone) {
|
|
3514
3531
|
const templateUtilities = new TemplateUtilities(resources);
|
|
3515
|
-
let html =
|
|
3532
|
+
let html = `<p>This list includes all Procedure resources, sorted by performed date (most recent first).</p>
|
|
3533
|
+
`;
|
|
3534
|
+
html += `
|
|
3516
3535
|
<table>
|
|
3517
3536
|
<thead>
|
|
3518
3537
|
<tr>
|
|
@@ -3527,12 +3546,12 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3527
3546
|
for (const resourceItem of resources) {
|
|
3528
3547
|
const proc = resourceItem;
|
|
3529
3548
|
html += `
|
|
3530
|
-
<tr
|
|
3549
|
+
<tr>
|
|
3531
3550
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.codeableConceptDisplay(proc.code, "display"))}</td>
|
|
3532
|
-
|
|
3551
|
+
<td>${templateUtilities.codeableConceptCoding(proc.code)}</td>
|
|
3533
3552
|
<td>${templateUtilities.renderNotes(proc.note, timezone)}</td>
|
|
3534
|
-
<td>${
|
|
3535
|
-
|
|
3553
|
+
<td>${templateUtilities.renderTime(proc.performedDateTime || proc.performedPeriod?.start, timezone)}</td>
|
|
3554
|
+
<td>${templateUtilities.getOwnerTag(proc)}</td>
|
|
3536
3555
|
</tr>`;
|
|
3537
3556
|
}
|
|
3538
3557
|
html += `
|
|
@@ -3567,7 +3586,9 @@ var SocialHistoryTemplate = class _SocialHistoryTemplate {
|
|
|
3567
3586
|
const dateB = b.effectiveDateTime || b.effectivePeriod?.start;
|
|
3568
3587
|
return dateA && dateB ? new Date(dateB).getTime() - new Date(dateA).getTime() : 0;
|
|
3569
3588
|
});
|
|
3570
|
-
let html =
|
|
3589
|
+
let html = `<p>This list includes all information about the patient's social history, sorted by effective date (most recent first).</p>
|
|
3590
|
+
`;
|
|
3591
|
+
html += `
|
|
3571
3592
|
<table>
|
|
3572
3593
|
<thead>
|
|
3573
3594
|
<tr>
|
|
@@ -3583,7 +3604,7 @@ var SocialHistoryTemplate = class _SocialHistoryTemplate {
|
|
|
3583
3604
|
<tbody>`;
|
|
3584
3605
|
for (const obs of observations) {
|
|
3585
3606
|
html += `
|
|
3586
|
-
<tr
|
|
3607
|
+
<tr>
|
|
3587
3608
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.codeableConceptDisplay(obs.code))}</td>
|
|
3588
3609
|
<td>${templateUtilities.codeableConceptCoding(obs.code)}</td>
|
|
3589
3610
|
<td>${templateUtilities.extractObservationValue(obs)}</td>
|
|
@@ -3611,7 +3632,8 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
3611
3632
|
*/
|
|
3612
3633
|
generateNarrative(resources, timezone, now) {
|
|
3613
3634
|
const templateUtilities = new TemplateUtilities(resources);
|
|
3614
|
-
let html =
|
|
3635
|
+
let html = `<p>This list includes past problems for the patient with a recorded date within the last 5 years, sorted by recorded date (most recent first).</p>
|
|
3636
|
+
`;
|
|
3615
3637
|
const resolvedConditions = resources.map((entry) => entry) || [];
|
|
3616
3638
|
const currentDate = now || /* @__PURE__ */ new Date();
|
|
3617
3639
|
const fiveYearsAgo = new Date(currentDate);
|
|
@@ -3648,7 +3670,7 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
3648
3670
|
const conditionCode = templateUtilities.renderTextAsHtml(templateUtilities.codeableConceptDisplay(cond.code));
|
|
3649
3671
|
if (!addedConditionCodes.has(conditionCode)) {
|
|
3650
3672
|
addedConditionCodes.add(conditionCode);
|
|
3651
|
-
html += `<tr
|
|
3673
|
+
html += `<tr>
|
|
3652
3674
|
<td class="Name">${conditionCode}</td>
|
|
3653
3675
|
<td class="CodeSystem">${templateUtilities.codeableConceptCoding(cond.code)}</td>
|
|
3654
3676
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
@@ -3684,7 +3706,9 @@ var PlanOfCareTemplate = class {
|
|
|
3684
3706
|
const endB = b.period?.end ? new Date(b.period?.end).getTime() : 0;
|
|
3685
3707
|
return endB - endA;
|
|
3686
3708
|
});
|
|
3687
|
-
let html =
|
|
3709
|
+
let html = `<p>This list includes all CarePlan resources, sorted by planned end date (most recent first).</p>
|
|
3710
|
+
`;
|
|
3711
|
+
html += `
|
|
3688
3712
|
<table>
|
|
3689
3713
|
<thead>
|
|
3690
3714
|
<tr>
|
|
@@ -3722,7 +3746,9 @@ var PlanOfCareTemplate = class {
|
|
|
3722
3746
|
generateSummaryNarrative(resources, timezone) {
|
|
3723
3747
|
const templateUtilities = new TemplateUtilities(resources);
|
|
3724
3748
|
let isSummaryCreated = false;
|
|
3725
|
-
let html =
|
|
3749
|
+
let html = `<p>This list includes all CarePlan resources, sorted by planned end date (most recent first).</p>
|
|
3750
|
+
`;
|
|
3751
|
+
html += `
|
|
3726
3752
|
<div>
|
|
3727
3753
|
<table>
|
|
3728
3754
|
<thead>
|
|
@@ -3784,7 +3810,7 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
3784
3810
|
*/
|
|
3785
3811
|
static generateStaticNarrative(resources, timezone) {
|
|
3786
3812
|
const templateUtilities = new TemplateUtilities(resources);
|
|
3787
|
-
let html =
|
|
3813
|
+
let html = `<p>This section summarizes key observations and assessments related to the person's functional status and ability to perform daily activities.</p>`;
|
|
3788
3814
|
let functionalObservations = resources.filter((r) => r.resourceType === "Observation").filter((r) => {
|
|
3789
3815
|
const hasFunctionalLoinc = r.code?.coding?.some(
|
|
3790
3816
|
(c) => c.system?.toLowerCase().includes("loinc") && c.code === "47420-5"
|
|
@@ -3908,7 +3934,8 @@ var PregnancyTemplate = class _PregnancyTemplate {
|
|
|
3908
3934
|
if (!pregnancyStatusObs && !eddObs && historyObs.length === 0 && conditions.length === 0) {
|
|
3909
3935
|
return `<p>No history of pregnancy found.</p>`;
|
|
3910
3936
|
}
|
|
3911
|
-
let html =
|
|
3937
|
+
let html = `<p>This list includes Observation and Condition resources relevant to pregnancy, sorted by date (most recent first).</p>`;
|
|
3938
|
+
html += `
|
|
3912
3939
|
<table>
|
|
3913
3940
|
<thead>
|
|
3914
3941
|
<tr>
|
|
@@ -4013,8 +4040,9 @@ var AdvanceDirectivesTemplate = class _AdvanceDirectivesTemplate {
|
|
|
4013
4040
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4014
4041
|
static generateStaticNarrative(resources, timezone) {
|
|
4015
4042
|
const templateUtilities = new TemplateUtilities(resources);
|
|
4016
|
-
let html =
|
|
4017
|
-
|
|
4043
|
+
let html = `<p>This list includes all Consent resources, sorted by date (most recent first).</p>
|
|
4044
|
+
`;
|
|
4045
|
+
html += `<table>
|
|
4018
4046
|
<thead>
|
|
4019
4047
|
<tr>
|
|
4020
4048
|
<th>Scope</th>
|
|
@@ -4027,7 +4055,7 @@ var AdvanceDirectivesTemplate = class _AdvanceDirectivesTemplate {
|
|
|
4027
4055
|
for (const resourceItem of resources) {
|
|
4028
4056
|
const consent = resourceItem;
|
|
4029
4057
|
html += `
|
|
4030
|
-
<tr
|
|
4058
|
+
<tr>
|
|
4031
4059
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.codeableConceptDisplay(consent.scope, "display"))}</td>
|
|
4032
4060
|
<td>${consent.status || ""}</td>
|
|
4033
4061
|
<td>${consent.provision?.action ? templateUtilities.concatCodeableConcept(consent.provision.action) : ""}</td>
|
package/dist/index.js
CHANGED
|
@@ -1407,7 +1407,8 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
1407
1407
|
static generateStaticNarrative(resources, timezone) {
|
|
1408
1408
|
const templateUtilities = new TemplateUtilities(resources);
|
|
1409
1409
|
const combinedPatient = this.combinePatients(resources);
|
|
1410
|
-
|
|
1410
|
+
let html = `<p>This section merges all Patient resources into a single combined patient record, preferring non-empty values for each field.</p>`;
|
|
1411
|
+
html += `<div>
|
|
1411
1412
|
<ul>
|
|
1412
1413
|
<li><strong>Name(s):</strong>${this.renderNames(combinedPatient)}</li>
|
|
1413
1414
|
<li><strong>Gender:</strong>${combinedPatient.gender ? this.capitalize(combinedPatient.gender) : ""}</li>
|
|
@@ -1419,6 +1420,7 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
1419
1420
|
<li><strong>Language(s):</strong>${this.renderCommunication(templateUtilities, combinedPatient)}</li>
|
|
1420
1421
|
</ul>
|
|
1421
1422
|
</div>`;
|
|
1423
|
+
return html;
|
|
1422
1424
|
}
|
|
1423
1425
|
/**
|
|
1424
1426
|
* Combines multiple patient resources into a single patient object
|
|
@@ -1743,7 +1745,9 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1743
1745
|
generateSummaryNarrative(resources, timezone) {
|
|
1744
1746
|
const templateUtilities = new TemplateUtilities(resources);
|
|
1745
1747
|
let isSummaryCreated = false;
|
|
1746
|
-
let html =
|
|
1748
|
+
let html = `<p>This list includes all AllergyIntolerance resources, with no additional filtering, sorted as provided.</p>
|
|
1749
|
+
`;
|
|
1750
|
+
html += `
|
|
1747
1751
|
<div>
|
|
1748
1752
|
<table>
|
|
1749
1753
|
<thead>
|
|
@@ -1825,7 +1829,8 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1825
1829
|
const dateB = b.onsetDateTime;
|
|
1826
1830
|
return dateA && dateB ? new Date(dateB).getTime() - new Date(dateA).getTime() : 0;
|
|
1827
1831
|
});
|
|
1828
|
-
let html =
|
|
1832
|
+
let html = `<p>This list includes all AllergyIntolerance resources, with no additional filtering, sorted as provided.</p>
|
|
1833
|
+
`;
|
|
1829
1834
|
html += `
|
|
1830
1835
|
<div class="ActiveAllergies">
|
|
1831
1836
|
<h3>Active</h3>
|
|
@@ -1951,7 +1956,8 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1951
1956
|
let isSummaryCreated = false;
|
|
1952
1957
|
const currentDate = now || /* @__PURE__ */ new Date();
|
|
1953
1958
|
const twoYearsAgo = new Date(currentDate.getFullYear(), currentDate.getMonth() - 24, currentDate.getDate());
|
|
1954
|
-
let html =
|
|
1959
|
+
let html = "<p>This list includes all the medications that were ordered for the patient, the medications they filled from the pharmacy and the medications they reported, filtered to past 2 years and sorted by start date.</p>";
|
|
1960
|
+
html += `
|
|
1955
1961
|
<div>
|
|
1956
1962
|
<table>
|
|
1957
1963
|
<thead>
|
|
@@ -2277,6 +2283,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2277
2283
|
let isSummaryCreated = false;
|
|
2278
2284
|
let html = `
|
|
2279
2285
|
<div>
|
|
2286
|
+
<p>This list includes all vaccinations, sorted by occurrence date (most recent first).</p>
|
|
2280
2287
|
<table>
|
|
2281
2288
|
<thead>
|
|
2282
2289
|
<tr>
|
|
@@ -2359,7 +2366,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2359
2366
|
for (const resourceItem of immunizations) {
|
|
2360
2367
|
const imm = resourceItem;
|
|
2361
2368
|
html += `
|
|
2362
|
-
<tr
|
|
2369
|
+
<tr>
|
|
2363
2370
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.codeableConceptDisplay(imm.vaccineCode))}</td>
|
|
2364
2371
|
<td>${templateUtilities.codeableConceptCoding(imm.vaccineCode)}</td>
|
|
2365
2372
|
<td>${imm.status || ""}</td>
|
|
@@ -2399,7 +2406,8 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
2399
2406
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2400
2407
|
static generateStaticNarrative(resources, timezone) {
|
|
2401
2408
|
const templateUtilities = new TemplateUtilities(resources);
|
|
2402
|
-
let html =
|
|
2409
|
+
let html = `<p>This list includes patient problems, sorted by recorded date (most recent first)</p>
|
|
2410
|
+
`;
|
|
2403
2411
|
const activeConditions = resources.map((entry) => entry) || [];
|
|
2404
2412
|
activeConditions.sort((a, b) => {
|
|
2405
2413
|
if (!a.recordedDate && b.recordedDate) return -1;
|
|
@@ -2429,7 +2437,7 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
2429
2437
|
continue;
|
|
2430
2438
|
}
|
|
2431
2439
|
seenCodeAndSystems.add(codeAndSystem);
|
|
2432
|
-
html += `<tr
|
|
2440
|
+
html += `<tr>
|
|
2433
2441
|
<td class="Name">${conditionDisplay}</td>
|
|
2434
2442
|
<td class="CodeSystem">${codeAndSystem}</td>
|
|
2435
2443
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
@@ -2463,7 +2471,9 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2463
2471
|
generateSummaryNarrative(resources, timezone) {
|
|
2464
2472
|
const templateUtilities = new TemplateUtilities(resources);
|
|
2465
2473
|
let isSummaryCreated = false;
|
|
2466
|
-
let html =
|
|
2474
|
+
let html = `<p>This list includes the latest vital signs, sorted by effective date (most recent first).</p>
|
|
2475
|
+
`;
|
|
2476
|
+
html += `
|
|
2467
2477
|
<div>
|
|
2468
2478
|
<table>
|
|
2469
2479
|
<thead>
|
|
@@ -2536,7 +2546,9 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2536
2546
|
const dateB = b.effectiveDateTime || b.effectivePeriod?.start;
|
|
2537
2547
|
return dateA && dateB ? new Date(dateB).getTime() - new Date(dateA).getTime() : 0;
|
|
2538
2548
|
});
|
|
2539
|
-
let html =
|
|
2549
|
+
let html = `<p>This list includes the latest vital signs, sorted by effective date (most recent first).</p>
|
|
2550
|
+
`;
|
|
2551
|
+
html += `
|
|
2540
2552
|
<table>
|
|
2541
2553
|
<thead>
|
|
2542
2554
|
<tr>
|
|
@@ -2554,7 +2566,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2554
2566
|
<tbody>`;
|
|
2555
2567
|
for (const obs of observations) {
|
|
2556
2568
|
html += `
|
|
2557
|
-
<tr
|
|
2569
|
+
<tr>
|
|
2558
2570
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.codeableConceptDisplay(obs.code, "display"))}</td>
|
|
2559
2571
|
<td>${templateUtilities.codeableConceptCoding(obs.code)}</td>
|
|
2560
2572
|
<td>${templateUtilities.extractObservationValue(obs)}</td>
|
|
@@ -2592,7 +2604,7 @@ var MedicalDevicesTemplate = class _MedicalDevicesTemplate {
|
|
|
2592
2604
|
*/
|
|
2593
2605
|
static generateStaticNarrative(resources, timezone) {
|
|
2594
2606
|
const templateUtilities = new TemplateUtilities(resources);
|
|
2595
|
-
let html =
|
|
2607
|
+
let html = `<p>This list includes all DeviceUseStatement resources, sorted by recorded date (most recent first).</p>
|
|
2596
2608
|
<table>
|
|
2597
2609
|
<thead>
|
|
2598
2610
|
<tr>
|
|
@@ -2610,7 +2622,7 @@ var MedicalDevicesTemplate = class _MedicalDevicesTemplate {
|
|
|
2610
2622
|
});
|
|
2611
2623
|
for (const dus of deviceStatements) {
|
|
2612
2624
|
html += `
|
|
2613
|
-
<tr
|
|
2625
|
+
<tr>
|
|
2614
2626
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.renderDevice(dus.device))}</td>
|
|
2615
2627
|
<td>${templateUtilities.renderTextAsHtml(dus.status || "")}</td>
|
|
2616
2628
|
<td>${templateUtilities.renderNotes(dus.note, timezone)}</td>
|
|
@@ -2971,11 +2983,12 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
2971
2983
|
}
|
|
2972
2984
|
}
|
|
2973
2985
|
}
|
|
2974
|
-
let html =
|
|
2975
|
-
|
|
2986
|
+
let html = `<p>This section includes Observations from the last 2 years (one per lab name, using code mapping) and DiagnosticReports with status 'final' issued in the last 2 years. Both are sorted by date (most recent first). Older results are counted and noted below the tables.</p>
|
|
2987
|
+
`;
|
|
2976
2988
|
let observationhtml = `
|
|
2977
2989
|
<div>
|
|
2978
2990
|
<h3>Observations</h3>
|
|
2991
|
+
${html}
|
|
2979
2992
|
<table>
|
|
2980
2993
|
<thead>
|
|
2981
2994
|
<tr>
|
|
@@ -2991,6 +3004,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
2991
3004
|
let diagnosticReporthtml = `
|
|
2992
3005
|
<div>
|
|
2993
3006
|
<h3>Diagnostic Reports</h3>
|
|
3007
|
+
${html}
|
|
2994
3008
|
<table>
|
|
2995
3009
|
<thead>
|
|
2996
3010
|
<tr>
|
|
@@ -3161,7 +3175,8 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3161
3175
|
const currentDate = now || /* @__PURE__ */ new Date();
|
|
3162
3176
|
const twoYearsAgo = new Date(currentDate);
|
|
3163
3177
|
twoYearsAgo.setFullYear(currentDate.getFullYear() - 2);
|
|
3164
|
-
let html =
|
|
3178
|
+
let html = `<p>This section includes Observations from the last 2 years (one per lab name, using code mapping) and DiagnosticReports with status 'final' issued in the last 2 years. Both are sorted by date (most recent first). Older results are counted and noted below the tables.</p>
|
|
3179
|
+
`;
|
|
3165
3180
|
let skippedObservations = 0;
|
|
3166
3181
|
let skippedDiagnosticReports = 0;
|
|
3167
3182
|
for (const resourceItem of resources) {
|
|
@@ -3423,7 +3438,9 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3423
3438
|
generateSummaryNarrative(resources, timezone) {
|
|
3424
3439
|
const templateUtilities = new TemplateUtilities(resources);
|
|
3425
3440
|
let isSummaryCreated = false;
|
|
3426
|
-
let html =
|
|
3441
|
+
let html = `<p>This list includes all Procedure resources, sorted by performed date (most recent first).</p>
|
|
3442
|
+
`;
|
|
3443
|
+
html += `
|
|
3427
3444
|
<div>
|
|
3428
3445
|
<table>
|
|
3429
3446
|
<thead>
|
|
@@ -3484,7 +3501,9 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3484
3501
|
*/
|
|
3485
3502
|
static generateStaticNarrative(resources, timezone) {
|
|
3486
3503
|
const templateUtilities = new TemplateUtilities(resources);
|
|
3487
|
-
let html =
|
|
3504
|
+
let html = `<p>This list includes all Procedure resources, sorted by performed date (most recent first).</p>
|
|
3505
|
+
`;
|
|
3506
|
+
html += `
|
|
3488
3507
|
<table>
|
|
3489
3508
|
<thead>
|
|
3490
3509
|
<tr>
|
|
@@ -3499,12 +3518,12 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3499
3518
|
for (const resourceItem of resources) {
|
|
3500
3519
|
const proc = resourceItem;
|
|
3501
3520
|
html += `
|
|
3502
|
-
<tr
|
|
3521
|
+
<tr>
|
|
3503
3522
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.codeableConceptDisplay(proc.code, "display"))}</td>
|
|
3504
|
-
|
|
3523
|
+
<td>${templateUtilities.codeableConceptCoding(proc.code)}</td>
|
|
3505
3524
|
<td>${templateUtilities.renderNotes(proc.note, timezone)}</td>
|
|
3506
|
-
<td>${
|
|
3507
|
-
|
|
3525
|
+
<td>${templateUtilities.renderTime(proc.performedDateTime || proc.performedPeriod?.start, timezone)}</td>
|
|
3526
|
+
<td>${templateUtilities.getOwnerTag(proc)}</td>
|
|
3508
3527
|
</tr>`;
|
|
3509
3528
|
}
|
|
3510
3529
|
html += `
|
|
@@ -3539,7 +3558,9 @@ var SocialHistoryTemplate = class _SocialHistoryTemplate {
|
|
|
3539
3558
|
const dateB = b.effectiveDateTime || b.effectivePeriod?.start;
|
|
3540
3559
|
return dateA && dateB ? new Date(dateB).getTime() - new Date(dateA).getTime() : 0;
|
|
3541
3560
|
});
|
|
3542
|
-
let html =
|
|
3561
|
+
let html = `<p>This list includes all information about the patient's social history, sorted by effective date (most recent first).</p>
|
|
3562
|
+
`;
|
|
3563
|
+
html += `
|
|
3543
3564
|
<table>
|
|
3544
3565
|
<thead>
|
|
3545
3566
|
<tr>
|
|
@@ -3555,7 +3576,7 @@ var SocialHistoryTemplate = class _SocialHistoryTemplate {
|
|
|
3555
3576
|
<tbody>`;
|
|
3556
3577
|
for (const obs of observations) {
|
|
3557
3578
|
html += `
|
|
3558
|
-
<tr
|
|
3579
|
+
<tr>
|
|
3559
3580
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.codeableConceptDisplay(obs.code))}</td>
|
|
3560
3581
|
<td>${templateUtilities.codeableConceptCoding(obs.code)}</td>
|
|
3561
3582
|
<td>${templateUtilities.extractObservationValue(obs)}</td>
|
|
@@ -3583,7 +3604,8 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
3583
3604
|
*/
|
|
3584
3605
|
generateNarrative(resources, timezone, now) {
|
|
3585
3606
|
const templateUtilities = new TemplateUtilities(resources);
|
|
3586
|
-
let html =
|
|
3607
|
+
let html = `<p>This list includes past problems for the patient with a recorded date within the last 5 years, sorted by recorded date (most recent first).</p>
|
|
3608
|
+
`;
|
|
3587
3609
|
const resolvedConditions = resources.map((entry) => entry) || [];
|
|
3588
3610
|
const currentDate = now || /* @__PURE__ */ new Date();
|
|
3589
3611
|
const fiveYearsAgo = new Date(currentDate);
|
|
@@ -3620,7 +3642,7 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
3620
3642
|
const conditionCode = templateUtilities.renderTextAsHtml(templateUtilities.codeableConceptDisplay(cond.code));
|
|
3621
3643
|
if (!addedConditionCodes.has(conditionCode)) {
|
|
3622
3644
|
addedConditionCodes.add(conditionCode);
|
|
3623
|
-
html += `<tr
|
|
3645
|
+
html += `<tr>
|
|
3624
3646
|
<td class="Name">${conditionCode}</td>
|
|
3625
3647
|
<td class="CodeSystem">${templateUtilities.codeableConceptCoding(cond.code)}</td>
|
|
3626
3648
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
@@ -3656,7 +3678,9 @@ var PlanOfCareTemplate = class {
|
|
|
3656
3678
|
const endB = b.period?.end ? new Date(b.period?.end).getTime() : 0;
|
|
3657
3679
|
return endB - endA;
|
|
3658
3680
|
});
|
|
3659
|
-
let html =
|
|
3681
|
+
let html = `<p>This list includes all CarePlan resources, sorted by planned end date (most recent first).</p>
|
|
3682
|
+
`;
|
|
3683
|
+
html += `
|
|
3660
3684
|
<table>
|
|
3661
3685
|
<thead>
|
|
3662
3686
|
<tr>
|
|
@@ -3694,7 +3718,9 @@ var PlanOfCareTemplate = class {
|
|
|
3694
3718
|
generateSummaryNarrative(resources, timezone) {
|
|
3695
3719
|
const templateUtilities = new TemplateUtilities(resources);
|
|
3696
3720
|
let isSummaryCreated = false;
|
|
3697
|
-
let html =
|
|
3721
|
+
let html = `<p>This list includes all CarePlan resources, sorted by planned end date (most recent first).</p>
|
|
3722
|
+
`;
|
|
3723
|
+
html += `
|
|
3698
3724
|
<div>
|
|
3699
3725
|
<table>
|
|
3700
3726
|
<thead>
|
|
@@ -3756,7 +3782,7 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
3756
3782
|
*/
|
|
3757
3783
|
static generateStaticNarrative(resources, timezone) {
|
|
3758
3784
|
const templateUtilities = new TemplateUtilities(resources);
|
|
3759
|
-
let html =
|
|
3785
|
+
let html = `<p>This section summarizes key observations and assessments related to the person's functional status and ability to perform daily activities.</p>`;
|
|
3760
3786
|
let functionalObservations = resources.filter((r) => r.resourceType === "Observation").filter((r) => {
|
|
3761
3787
|
const hasFunctionalLoinc = r.code?.coding?.some(
|
|
3762
3788
|
(c) => c.system?.toLowerCase().includes("loinc") && c.code === "47420-5"
|
|
@@ -3880,7 +3906,8 @@ var PregnancyTemplate = class _PregnancyTemplate {
|
|
|
3880
3906
|
if (!pregnancyStatusObs && !eddObs && historyObs.length === 0 && conditions.length === 0) {
|
|
3881
3907
|
return `<p>No history of pregnancy found.</p>`;
|
|
3882
3908
|
}
|
|
3883
|
-
let html =
|
|
3909
|
+
let html = `<p>This list includes Observation and Condition resources relevant to pregnancy, sorted by date (most recent first).</p>`;
|
|
3910
|
+
html += `
|
|
3884
3911
|
<table>
|
|
3885
3912
|
<thead>
|
|
3886
3913
|
<tr>
|
|
@@ -3985,8 +4012,9 @@ var AdvanceDirectivesTemplate = class _AdvanceDirectivesTemplate {
|
|
|
3985
4012
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3986
4013
|
static generateStaticNarrative(resources, timezone) {
|
|
3987
4014
|
const templateUtilities = new TemplateUtilities(resources);
|
|
3988
|
-
let html =
|
|
3989
|
-
|
|
4015
|
+
let html = `<p>This list includes all Consent resources, sorted by date (most recent first).</p>
|
|
4016
|
+
`;
|
|
4017
|
+
html += `<table>
|
|
3990
4018
|
<thead>
|
|
3991
4019
|
<tr>
|
|
3992
4020
|
<th>Scope</th>
|
|
@@ -3999,7 +4027,7 @@ var AdvanceDirectivesTemplate = class _AdvanceDirectivesTemplate {
|
|
|
3999
4027
|
for (const resourceItem of resources) {
|
|
4000
4028
|
const consent = resourceItem;
|
|
4001
4029
|
html += `
|
|
4002
|
-
<tr
|
|
4030
|
+
<tr>
|
|
4003
4031
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.codeableConceptDisplay(consent.scope, "display"))}</td>
|
|
4004
4032
|
<td>${consent.status || ""}</td>
|
|
4005
4033
|
<td>${consent.provision?.action ? templateUtilities.concatCodeableConcept(consent.provision.action) : ""}</td>
|