@imranq2/fhirpatientsummary 1.0.15 → 1.0.16
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 +92 -27
- package/dist/index.js +92 -27
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -103,6 +103,11 @@ var SOCIAL_HISTORY_LOINC_CODES = {
|
|
|
103
103
|
"72166-2": "Tobacco Use",
|
|
104
104
|
"74013-4": "Alcohol Use"
|
|
105
105
|
};
|
|
106
|
+
var BLOOD_PRESSURE_LOINC_CODES = {
|
|
107
|
+
OBSERVATION: "85354-9",
|
|
108
|
+
SYSTOLIC: "8480-6",
|
|
109
|
+
DIASTOLIC: "8462-4"
|
|
110
|
+
};
|
|
106
111
|
|
|
107
112
|
// src/structures/ips_section_resource_map.ts
|
|
108
113
|
var IPSSectionResourceMap = {
|
|
@@ -530,6 +535,28 @@ var TemplateUtilities = class {
|
|
|
530
535
|
return "";
|
|
531
536
|
}
|
|
532
537
|
extractObservationValue(observation) {
|
|
538
|
+
if (observation.code && observation.code.coding && "component" in observation && Array.isArray(observation.component)) {
|
|
539
|
+
const bpCode = observation.code.coding.find(
|
|
540
|
+
(c) => c.code === BLOOD_PRESSURE_LOINC_CODES.OBSERVATION
|
|
541
|
+
);
|
|
542
|
+
if (bpCode) {
|
|
543
|
+
const systolicComponent = observation.component?.find(
|
|
544
|
+
(c) => c.code?.coding?.some(
|
|
545
|
+
(cc) => cc.code === BLOOD_PRESSURE_LOINC_CODES.SYSTOLIC
|
|
546
|
+
)
|
|
547
|
+
);
|
|
548
|
+
const diastolicComponent = observation.component?.find(
|
|
549
|
+
(c) => c.code?.coding?.some(
|
|
550
|
+
(cc) => cc.code === BLOOD_PRESSURE_LOINC_CODES.DIASTOLIC
|
|
551
|
+
)
|
|
552
|
+
);
|
|
553
|
+
if (systolicComponent && diastolicComponent) {
|
|
554
|
+
const systolic = this.extractObservationValue(systolicComponent);
|
|
555
|
+
const diastolic = this.extractObservationValue(diastolicComponent);
|
|
556
|
+
return `${systolic}/${diastolic}`;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
533
560
|
const valueFields = [
|
|
534
561
|
"valueString",
|
|
535
562
|
"valueInteger",
|
|
@@ -852,7 +879,9 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
852
879
|
patient.name.forEach((name) => {
|
|
853
880
|
if (name.use !== "old") {
|
|
854
881
|
const nameText = name.text || ((name.given || []).join(" ") + " " + (name.family || "")).trim();
|
|
855
|
-
|
|
882
|
+
if (nameText) {
|
|
883
|
+
uniqueNames.add(nameText);
|
|
884
|
+
}
|
|
856
885
|
}
|
|
857
886
|
});
|
|
858
887
|
return Array.from(uniqueNames).map((nameText) => `<ul><li>${nameText}</li></ul>`).join("");
|
|
@@ -882,9 +911,10 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
882
911
|
return "";
|
|
883
912
|
}
|
|
884
913
|
const systemPriority = ["email", "phone", "pager", "sms", "fax", "url", "other"];
|
|
914
|
+
const numberSystems = ["phone", "pager", "sms", "fax"];
|
|
885
915
|
const telecomBySystem = /* @__PURE__ */ new Map();
|
|
886
916
|
patient.telecom.forEach((telecom) => {
|
|
887
|
-
if (telecom.system && telecom.value) {
|
|
917
|
+
if (telecom.system && telecom.value && telecom.use !== "old") {
|
|
888
918
|
const system = telecom.system.toLowerCase();
|
|
889
919
|
if (!telecomBySystem.has(system)) {
|
|
890
920
|
telecomBySystem.set(system, /* @__PURE__ */ new Set());
|
|
@@ -892,6 +922,29 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
892
922
|
telecomBySystem.get(system).add(telecom.value);
|
|
893
923
|
}
|
|
894
924
|
});
|
|
925
|
+
for (const system of numberSystems) {
|
|
926
|
+
const currentNumbers = Array.from(telecomBySystem.get(system) || []);
|
|
927
|
+
if (currentNumbers.length <= 1) continue;
|
|
928
|
+
const numbersWithCleaned = currentNumbers.map((num) => ({
|
|
929
|
+
original: num,
|
|
930
|
+
cleaned: num.replace(/\D/g, "")
|
|
931
|
+
}));
|
|
932
|
+
const toRemove = /* @__PURE__ */ new Set();
|
|
933
|
+
for (let i = 0; i < numbersWithCleaned.length; i++) {
|
|
934
|
+
for (let j = i + 1; j < numbersWithCleaned.length; j++) {
|
|
935
|
+
const num1 = numbersWithCleaned[i];
|
|
936
|
+
const num2 = numbersWithCleaned[j];
|
|
937
|
+
if (num1.cleaned.endsWith(num2.cleaned)) {
|
|
938
|
+
toRemove.add(num2.original);
|
|
939
|
+
} else if (num2.cleaned.endsWith(num1.cleaned)) {
|
|
940
|
+
toRemove.add(num1.original);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
toRemove.forEach((numberToRemove) => {
|
|
945
|
+
telecomBySystem.get(system)?.delete(numberToRemove);
|
|
946
|
+
});
|
|
947
|
+
}
|
|
895
948
|
return Array.from(telecomBySystem.entries()).sort(([systemA], [systemB]) => {
|
|
896
949
|
const priorityA = systemPriority.indexOf(systemA);
|
|
897
950
|
const priorityB = systemPriority.indexOf(systemB);
|
|
@@ -918,7 +971,24 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
918
971
|
}
|
|
919
972
|
const uniqueAddresses = /* @__PURE__ */ new Set();
|
|
920
973
|
patient.address.forEach((address) => {
|
|
921
|
-
|
|
974
|
+
if (address.use === "old") {
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
const addressArray = [];
|
|
978
|
+
if (address.text) {
|
|
979
|
+
addressArray.push(address.text);
|
|
980
|
+
} else {
|
|
981
|
+
if (address.line) {
|
|
982
|
+
addressArray.push(...address.line);
|
|
983
|
+
}
|
|
984
|
+
if (address.city) {
|
|
985
|
+
addressArray.push(address.city);
|
|
986
|
+
}
|
|
987
|
+
if (address.country) {
|
|
988
|
+
addressArray.push(address.country);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
const addressText = addressArray.join(", ").trim();
|
|
922
992
|
if (addressText) {
|
|
923
993
|
uniqueAddresses.add(addressText);
|
|
924
994
|
}
|
|
@@ -949,12 +1019,18 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
949
1019
|
if (!patient.communication || patient.communication.length === 0) {
|
|
950
1020
|
return "";
|
|
951
1021
|
}
|
|
952
|
-
|
|
953
|
-
|
|
1022
|
+
const uniqueLanguages = /* @__PURE__ */ new Set();
|
|
1023
|
+
const preferredLanguages = /* @__PURE__ */ new Set();
|
|
1024
|
+
patient.communication.forEach((comm) => {
|
|
954
1025
|
const language = templateUtilities.codeableConcept(comm.language);
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
1026
|
+
if (language) {
|
|
1027
|
+
if (comm.preferred) {
|
|
1028
|
+
preferredLanguages.add(language);
|
|
1029
|
+
}
|
|
1030
|
+
uniqueLanguages.add(language);
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
1033
|
+
return Array.from(uniqueLanguages).map((language) => `<ul><li>${language}${preferredLanguages.has(language) ? " (preferred)" : ""}</li></ul>`).join("");
|
|
958
1034
|
}
|
|
959
1035
|
/**
|
|
960
1036
|
* Capitalizes first letter of a string
|
|
@@ -1020,7 +1096,6 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1020
1096
|
<th>Status</th>
|
|
1021
1097
|
<th>Category</th>
|
|
1022
1098
|
<th>Reaction</th>
|
|
1023
|
-
<th>Severity</th>
|
|
1024
1099
|
<th>Onset Date</th>
|
|
1025
1100
|
<th>Comments</th>
|
|
1026
1101
|
</tr>
|
|
@@ -1048,7 +1123,6 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1048
1123
|
<th>Status</th>
|
|
1049
1124
|
<th>Category</th>
|
|
1050
1125
|
<th>Reaction</th>
|
|
1051
|
-
<th>Severity</th>
|
|
1052
1126
|
<th>Onset Date</th>
|
|
1053
1127
|
<th>Comments</th>
|
|
1054
1128
|
<th>Resolved Date</th>
|
|
@@ -1086,7 +1160,6 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1086
1160
|
<td class="Status">${templateUtilities.codeableConcept(allergy.clinicalStatus) || "-"}</td>
|
|
1087
1161
|
<td class="Category">${templateUtilities.safeConcat(allergy.category) || "-"}</td>
|
|
1088
1162
|
<td class="Reaction">${templateUtilities.concatReactionManifestation(allergy.reaction) || "-"}</td>
|
|
1089
|
-
<td class="Severity">${templateUtilities.safeConcat(allergy.reaction, "severity") || "-"}</td>
|
|
1090
1163
|
<td class="OnsetDate">${templateUtilities.renderTime(allergy.onsetDateTime, timezone) || "-"}</td>
|
|
1091
1164
|
<td class="Comments">${templateUtilities.renderNotes(allergy.note, timezone, { styled: true, warning: true })}</td>`;
|
|
1092
1165
|
if (includeResolved) {
|
|
@@ -1236,11 +1309,11 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1236
1309
|
};
|
|
1237
1310
|
if (allActiveMedications.length > 0) {
|
|
1238
1311
|
sortMedications(allActiveMedications);
|
|
1239
|
-
html += this.renderCombinedMedications(templateUtilities, allActiveMedications,
|
|
1312
|
+
html += this.renderCombinedMedications(templateUtilities, allActiveMedications, true);
|
|
1240
1313
|
}
|
|
1241
1314
|
if (allInactiveMedications.length > 0) {
|
|
1242
1315
|
sortMedications(allInactiveMedications);
|
|
1243
|
-
html += this.renderCombinedMedications(templateUtilities, allInactiveMedications,
|
|
1316
|
+
html += this.renderCombinedMedications(templateUtilities, allInactiveMedications, false);
|
|
1244
1317
|
}
|
|
1245
1318
|
return html;
|
|
1246
1319
|
}
|
|
@@ -1281,9 +1354,9 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1281
1354
|
* @param sectionTitle - Title for the section
|
|
1282
1355
|
* @returns HTML string for rendering
|
|
1283
1356
|
*/
|
|
1284
|
-
static renderCombinedMedications(templateUtilities, medications,
|
|
1357
|
+
static renderCombinedMedications(templateUtilities, medications, isActiveSection) {
|
|
1285
1358
|
let html = `
|
|
1286
|
-
<h3>${
|
|
1359
|
+
<h3>${isActiveSection ? "Active Medications" : "Inactive Medications"}</h3>
|
|
1287
1360
|
<table>
|
|
1288
1361
|
<thead>
|
|
1289
1362
|
<tr>
|
|
@@ -1292,8 +1365,8 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1292
1365
|
<th>Sig</th>
|
|
1293
1366
|
<th>Dispense Quantity</th>
|
|
1294
1367
|
<th>Refills</th>
|
|
1295
|
-
<th>Start Date</th
|
|
1296
|
-
<th>End Date</th
|
|
1368
|
+
<th>Start Date</th>${isActiveSection ? "" : `
|
|
1369
|
+
<th>End Date</th>`}
|
|
1297
1370
|
<th>Status</th>
|
|
1298
1371
|
</tr>
|
|
1299
1372
|
</thead>
|
|
@@ -1351,8 +1424,8 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1351
1424
|
<td>${sig}</td>
|
|
1352
1425
|
<td>${dispenseQuantity}</td>
|
|
1353
1426
|
<td>${refills}</td>
|
|
1354
|
-
<td>${startDate}</td
|
|
1355
|
-
<td>${endDate}</td
|
|
1427
|
+
<td>${startDate}</td>${isActiveSection ? "" : `
|
|
1428
|
+
<td>${endDate}</td>`}
|
|
1356
1429
|
<td>${status}</td>
|
|
1357
1430
|
</tr>`;
|
|
1358
1431
|
}
|
|
@@ -1458,7 +1531,6 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
1458
1531
|
<thead>
|
|
1459
1532
|
<tr>
|
|
1460
1533
|
<th>Problem</th>
|
|
1461
|
-
<th>Severity</th>
|
|
1462
1534
|
<th>Onset Date</th>
|
|
1463
1535
|
<th>Recorded Date</th>
|
|
1464
1536
|
<th>Notes</th>
|
|
@@ -1468,7 +1540,6 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
1468
1540
|
for (const cond of activeConditions) {
|
|
1469
1541
|
html += `<tr id="${templateUtilities.narrativeLinkId(cond)}">
|
|
1470
1542
|
<td class="Name">${templateUtilities.codeableConcept(cond.code)}</td>
|
|
1471
|
-
<td class="Severity">${templateUtilities.codeableConcept(cond.severity)}</td>
|
|
1472
1543
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
1473
1544
|
<td class="RecordedDate">${templateUtilities.renderDate(cond.recordedDate)}</td>
|
|
1474
1545
|
<td class="Notes">${templateUtilities.renderNotes(cond.note, timezone)}</td>
|
|
@@ -1712,7 +1783,6 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
1712
1783
|
<thead>
|
|
1713
1784
|
<tr>
|
|
1714
1785
|
<th>Report</th>
|
|
1715
|
-
<th>Status</th>
|
|
1716
1786
|
<th>Category</th>
|
|
1717
1787
|
<th>Result</th>
|
|
1718
1788
|
<th>Issued</th>
|
|
@@ -1727,7 +1797,6 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
1727
1797
|
html += `
|
|
1728
1798
|
<tr id="${templateUtilities.narrativeLinkId(report)}">
|
|
1729
1799
|
<td>${templateUtilities.codeableConcept(report.code)}</td>
|
|
1730
|
-
<td>${report.status || ""}</td>
|
|
1731
1800
|
<td>${templateUtilities.firstFromCodeableConceptList(report.category)}</td>
|
|
1732
1801
|
<td>${resultCount}</td>
|
|
1733
1802
|
<td>${report.issued ? templateUtilities.renderTime(report.issued, timezone) : ""}</td>
|
|
@@ -1868,7 +1937,6 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
1868
1937
|
<thead>
|
|
1869
1938
|
<tr>
|
|
1870
1939
|
<th>Problem</th>
|
|
1871
|
-
<th>Severity</th>
|
|
1872
1940
|
<th>Onset Date</th>
|
|
1873
1941
|
<th>Recorded Date</th>
|
|
1874
1942
|
<th>Resolved Date</th>
|
|
@@ -1879,7 +1947,6 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
1879
1947
|
for (const cond of resolvedConditions) {
|
|
1880
1948
|
html += `<tr id="${templateUtilities.narrativeLinkId(cond)}">
|
|
1881
1949
|
<td class="Name">${templateUtilities.codeableConcept(cond.code)}</td>
|
|
1882
|
-
<td class="Severity">${templateUtilities.codeableConcept(cond.severity)}</td>
|
|
1883
1950
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
1884
1951
|
<td class="RecordedDate">${templateUtilities.renderDate(cond.recordedDate)}</td>
|
|
1885
1952
|
<td class="ResolvedDate">${templateUtilities.renderDate(cond.abatementDateTime)}</td>
|
|
@@ -1990,7 +2057,6 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
1990
2057
|
<thead>
|
|
1991
2058
|
<tr>
|
|
1992
2059
|
<th>Problem</th>
|
|
1993
|
-
<th>Severity</th>
|
|
1994
2060
|
<th>Onset Date</th>
|
|
1995
2061
|
<th>Recorded Date</th>
|
|
1996
2062
|
<th>Notes</th>
|
|
@@ -2000,7 +2066,6 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
2000
2066
|
for (const cond of activeConditions) {
|
|
2001
2067
|
html += `<tr id="${templateUtilities.narrativeLinkId(cond)}">
|
|
2002
2068
|
<td class="Name">${templateUtilities.codeableConcept(cond.code)}</td>
|
|
2003
|
-
<td class="Severity">${templateUtilities.codeableConcept(cond.severity)}</td>
|
|
2004
2069
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
2005
2070
|
<td class="RecordedDate">${templateUtilities.renderDate(cond.recordedDate)}</td>
|
|
2006
2071
|
<td class="Notes">${templateUtilities.renderNotes(cond.note, timezone, { styled: true, warning: true })}</td>
|
package/dist/index.js
CHANGED
|
@@ -75,6 +75,11 @@ var SOCIAL_HISTORY_LOINC_CODES = {
|
|
|
75
75
|
"72166-2": "Tobacco Use",
|
|
76
76
|
"74013-4": "Alcohol Use"
|
|
77
77
|
};
|
|
78
|
+
var BLOOD_PRESSURE_LOINC_CODES = {
|
|
79
|
+
OBSERVATION: "85354-9",
|
|
80
|
+
SYSTOLIC: "8480-6",
|
|
81
|
+
DIASTOLIC: "8462-4"
|
|
82
|
+
};
|
|
78
83
|
|
|
79
84
|
// src/structures/ips_section_resource_map.ts
|
|
80
85
|
var IPSSectionResourceMap = {
|
|
@@ -502,6 +507,28 @@ var TemplateUtilities = class {
|
|
|
502
507
|
return "";
|
|
503
508
|
}
|
|
504
509
|
extractObservationValue(observation) {
|
|
510
|
+
if (observation.code && observation.code.coding && "component" in observation && Array.isArray(observation.component)) {
|
|
511
|
+
const bpCode = observation.code.coding.find(
|
|
512
|
+
(c) => c.code === BLOOD_PRESSURE_LOINC_CODES.OBSERVATION
|
|
513
|
+
);
|
|
514
|
+
if (bpCode) {
|
|
515
|
+
const systolicComponent = observation.component?.find(
|
|
516
|
+
(c) => c.code?.coding?.some(
|
|
517
|
+
(cc) => cc.code === BLOOD_PRESSURE_LOINC_CODES.SYSTOLIC
|
|
518
|
+
)
|
|
519
|
+
);
|
|
520
|
+
const diastolicComponent = observation.component?.find(
|
|
521
|
+
(c) => c.code?.coding?.some(
|
|
522
|
+
(cc) => cc.code === BLOOD_PRESSURE_LOINC_CODES.DIASTOLIC
|
|
523
|
+
)
|
|
524
|
+
);
|
|
525
|
+
if (systolicComponent && diastolicComponent) {
|
|
526
|
+
const systolic = this.extractObservationValue(systolicComponent);
|
|
527
|
+
const diastolic = this.extractObservationValue(diastolicComponent);
|
|
528
|
+
return `${systolic}/${diastolic}`;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
505
532
|
const valueFields = [
|
|
506
533
|
"valueString",
|
|
507
534
|
"valueInteger",
|
|
@@ -824,7 +851,9 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
824
851
|
patient.name.forEach((name) => {
|
|
825
852
|
if (name.use !== "old") {
|
|
826
853
|
const nameText = name.text || ((name.given || []).join(" ") + " " + (name.family || "")).trim();
|
|
827
|
-
|
|
854
|
+
if (nameText) {
|
|
855
|
+
uniqueNames.add(nameText);
|
|
856
|
+
}
|
|
828
857
|
}
|
|
829
858
|
});
|
|
830
859
|
return Array.from(uniqueNames).map((nameText) => `<ul><li>${nameText}</li></ul>`).join("");
|
|
@@ -854,9 +883,10 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
854
883
|
return "";
|
|
855
884
|
}
|
|
856
885
|
const systemPriority = ["email", "phone", "pager", "sms", "fax", "url", "other"];
|
|
886
|
+
const numberSystems = ["phone", "pager", "sms", "fax"];
|
|
857
887
|
const telecomBySystem = /* @__PURE__ */ new Map();
|
|
858
888
|
patient.telecom.forEach((telecom) => {
|
|
859
|
-
if (telecom.system && telecom.value) {
|
|
889
|
+
if (telecom.system && telecom.value && telecom.use !== "old") {
|
|
860
890
|
const system = telecom.system.toLowerCase();
|
|
861
891
|
if (!telecomBySystem.has(system)) {
|
|
862
892
|
telecomBySystem.set(system, /* @__PURE__ */ new Set());
|
|
@@ -864,6 +894,29 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
864
894
|
telecomBySystem.get(system).add(telecom.value);
|
|
865
895
|
}
|
|
866
896
|
});
|
|
897
|
+
for (const system of numberSystems) {
|
|
898
|
+
const currentNumbers = Array.from(telecomBySystem.get(system) || []);
|
|
899
|
+
if (currentNumbers.length <= 1) continue;
|
|
900
|
+
const numbersWithCleaned = currentNumbers.map((num) => ({
|
|
901
|
+
original: num,
|
|
902
|
+
cleaned: num.replace(/\D/g, "")
|
|
903
|
+
}));
|
|
904
|
+
const toRemove = /* @__PURE__ */ new Set();
|
|
905
|
+
for (let i = 0; i < numbersWithCleaned.length; i++) {
|
|
906
|
+
for (let j = i + 1; j < numbersWithCleaned.length; j++) {
|
|
907
|
+
const num1 = numbersWithCleaned[i];
|
|
908
|
+
const num2 = numbersWithCleaned[j];
|
|
909
|
+
if (num1.cleaned.endsWith(num2.cleaned)) {
|
|
910
|
+
toRemove.add(num2.original);
|
|
911
|
+
} else if (num2.cleaned.endsWith(num1.cleaned)) {
|
|
912
|
+
toRemove.add(num1.original);
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
toRemove.forEach((numberToRemove) => {
|
|
917
|
+
telecomBySystem.get(system)?.delete(numberToRemove);
|
|
918
|
+
});
|
|
919
|
+
}
|
|
867
920
|
return Array.from(telecomBySystem.entries()).sort(([systemA], [systemB]) => {
|
|
868
921
|
const priorityA = systemPriority.indexOf(systemA);
|
|
869
922
|
const priorityB = systemPriority.indexOf(systemB);
|
|
@@ -890,7 +943,24 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
890
943
|
}
|
|
891
944
|
const uniqueAddresses = /* @__PURE__ */ new Set();
|
|
892
945
|
patient.address.forEach((address) => {
|
|
893
|
-
|
|
946
|
+
if (address.use === "old") {
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
const addressArray = [];
|
|
950
|
+
if (address.text) {
|
|
951
|
+
addressArray.push(address.text);
|
|
952
|
+
} else {
|
|
953
|
+
if (address.line) {
|
|
954
|
+
addressArray.push(...address.line);
|
|
955
|
+
}
|
|
956
|
+
if (address.city) {
|
|
957
|
+
addressArray.push(address.city);
|
|
958
|
+
}
|
|
959
|
+
if (address.country) {
|
|
960
|
+
addressArray.push(address.country);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
const addressText = addressArray.join(", ").trim();
|
|
894
964
|
if (addressText) {
|
|
895
965
|
uniqueAddresses.add(addressText);
|
|
896
966
|
}
|
|
@@ -921,12 +991,18 @@ var PatientTemplate = class _PatientTemplate {
|
|
|
921
991
|
if (!patient.communication || patient.communication.length === 0) {
|
|
922
992
|
return "";
|
|
923
993
|
}
|
|
924
|
-
|
|
925
|
-
|
|
994
|
+
const uniqueLanguages = /* @__PURE__ */ new Set();
|
|
995
|
+
const preferredLanguages = /* @__PURE__ */ new Set();
|
|
996
|
+
patient.communication.forEach((comm) => {
|
|
926
997
|
const language = templateUtilities.codeableConcept(comm.language);
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
998
|
+
if (language) {
|
|
999
|
+
if (comm.preferred) {
|
|
1000
|
+
preferredLanguages.add(language);
|
|
1001
|
+
}
|
|
1002
|
+
uniqueLanguages.add(language);
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
1005
|
+
return Array.from(uniqueLanguages).map((language) => `<ul><li>${language}${preferredLanguages.has(language) ? " (preferred)" : ""}</li></ul>`).join("");
|
|
930
1006
|
}
|
|
931
1007
|
/**
|
|
932
1008
|
* Capitalizes first letter of a string
|
|
@@ -992,7 +1068,6 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
992
1068
|
<th>Status</th>
|
|
993
1069
|
<th>Category</th>
|
|
994
1070
|
<th>Reaction</th>
|
|
995
|
-
<th>Severity</th>
|
|
996
1071
|
<th>Onset Date</th>
|
|
997
1072
|
<th>Comments</th>
|
|
998
1073
|
</tr>
|
|
@@ -1020,7 +1095,6 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1020
1095
|
<th>Status</th>
|
|
1021
1096
|
<th>Category</th>
|
|
1022
1097
|
<th>Reaction</th>
|
|
1023
|
-
<th>Severity</th>
|
|
1024
1098
|
<th>Onset Date</th>
|
|
1025
1099
|
<th>Comments</th>
|
|
1026
1100
|
<th>Resolved Date</th>
|
|
@@ -1058,7 +1132,6 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1058
1132
|
<td class="Status">${templateUtilities.codeableConcept(allergy.clinicalStatus) || "-"}</td>
|
|
1059
1133
|
<td class="Category">${templateUtilities.safeConcat(allergy.category) || "-"}</td>
|
|
1060
1134
|
<td class="Reaction">${templateUtilities.concatReactionManifestation(allergy.reaction) || "-"}</td>
|
|
1061
|
-
<td class="Severity">${templateUtilities.safeConcat(allergy.reaction, "severity") || "-"}</td>
|
|
1062
1135
|
<td class="OnsetDate">${templateUtilities.renderTime(allergy.onsetDateTime, timezone) || "-"}</td>
|
|
1063
1136
|
<td class="Comments">${templateUtilities.renderNotes(allergy.note, timezone, { styled: true, warning: true })}</td>`;
|
|
1064
1137
|
if (includeResolved) {
|
|
@@ -1208,11 +1281,11 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1208
1281
|
};
|
|
1209
1282
|
if (allActiveMedications.length > 0) {
|
|
1210
1283
|
sortMedications(allActiveMedications);
|
|
1211
|
-
html += this.renderCombinedMedications(templateUtilities, allActiveMedications,
|
|
1284
|
+
html += this.renderCombinedMedications(templateUtilities, allActiveMedications, true);
|
|
1212
1285
|
}
|
|
1213
1286
|
if (allInactiveMedications.length > 0) {
|
|
1214
1287
|
sortMedications(allInactiveMedications);
|
|
1215
|
-
html += this.renderCombinedMedications(templateUtilities, allInactiveMedications,
|
|
1288
|
+
html += this.renderCombinedMedications(templateUtilities, allInactiveMedications, false);
|
|
1216
1289
|
}
|
|
1217
1290
|
return html;
|
|
1218
1291
|
}
|
|
@@ -1253,9 +1326,9 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1253
1326
|
* @param sectionTitle - Title for the section
|
|
1254
1327
|
* @returns HTML string for rendering
|
|
1255
1328
|
*/
|
|
1256
|
-
static renderCombinedMedications(templateUtilities, medications,
|
|
1329
|
+
static renderCombinedMedications(templateUtilities, medications, isActiveSection) {
|
|
1257
1330
|
let html = `
|
|
1258
|
-
<h3>${
|
|
1331
|
+
<h3>${isActiveSection ? "Active Medications" : "Inactive Medications"}</h3>
|
|
1259
1332
|
<table>
|
|
1260
1333
|
<thead>
|
|
1261
1334
|
<tr>
|
|
@@ -1264,8 +1337,8 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1264
1337
|
<th>Sig</th>
|
|
1265
1338
|
<th>Dispense Quantity</th>
|
|
1266
1339
|
<th>Refills</th>
|
|
1267
|
-
<th>Start Date</th
|
|
1268
|
-
<th>End Date</th
|
|
1340
|
+
<th>Start Date</th>${isActiveSection ? "" : `
|
|
1341
|
+
<th>End Date</th>`}
|
|
1269
1342
|
<th>Status</th>
|
|
1270
1343
|
</tr>
|
|
1271
1344
|
</thead>
|
|
@@ -1323,8 +1396,8 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1323
1396
|
<td>${sig}</td>
|
|
1324
1397
|
<td>${dispenseQuantity}</td>
|
|
1325
1398
|
<td>${refills}</td>
|
|
1326
|
-
<td>${startDate}</td
|
|
1327
|
-
<td>${endDate}</td
|
|
1399
|
+
<td>${startDate}</td>${isActiveSection ? "" : `
|
|
1400
|
+
<td>${endDate}</td>`}
|
|
1328
1401
|
<td>${status}</td>
|
|
1329
1402
|
</tr>`;
|
|
1330
1403
|
}
|
|
@@ -1430,7 +1503,6 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
1430
1503
|
<thead>
|
|
1431
1504
|
<tr>
|
|
1432
1505
|
<th>Problem</th>
|
|
1433
|
-
<th>Severity</th>
|
|
1434
1506
|
<th>Onset Date</th>
|
|
1435
1507
|
<th>Recorded Date</th>
|
|
1436
1508
|
<th>Notes</th>
|
|
@@ -1440,7 +1512,6 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
1440
1512
|
for (const cond of activeConditions) {
|
|
1441
1513
|
html += `<tr id="${templateUtilities.narrativeLinkId(cond)}">
|
|
1442
1514
|
<td class="Name">${templateUtilities.codeableConcept(cond.code)}</td>
|
|
1443
|
-
<td class="Severity">${templateUtilities.codeableConcept(cond.severity)}</td>
|
|
1444
1515
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
1445
1516
|
<td class="RecordedDate">${templateUtilities.renderDate(cond.recordedDate)}</td>
|
|
1446
1517
|
<td class="Notes">${templateUtilities.renderNotes(cond.note, timezone)}</td>
|
|
@@ -1684,7 +1755,6 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
1684
1755
|
<thead>
|
|
1685
1756
|
<tr>
|
|
1686
1757
|
<th>Report</th>
|
|
1687
|
-
<th>Status</th>
|
|
1688
1758
|
<th>Category</th>
|
|
1689
1759
|
<th>Result</th>
|
|
1690
1760
|
<th>Issued</th>
|
|
@@ -1699,7 +1769,6 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
1699
1769
|
html += `
|
|
1700
1770
|
<tr id="${templateUtilities.narrativeLinkId(report)}">
|
|
1701
1771
|
<td>${templateUtilities.codeableConcept(report.code)}</td>
|
|
1702
|
-
<td>${report.status || ""}</td>
|
|
1703
1772
|
<td>${templateUtilities.firstFromCodeableConceptList(report.category)}</td>
|
|
1704
1773
|
<td>${resultCount}</td>
|
|
1705
1774
|
<td>${report.issued ? templateUtilities.renderTime(report.issued, timezone) : ""}</td>
|
|
@@ -1840,7 +1909,6 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
1840
1909
|
<thead>
|
|
1841
1910
|
<tr>
|
|
1842
1911
|
<th>Problem</th>
|
|
1843
|
-
<th>Severity</th>
|
|
1844
1912
|
<th>Onset Date</th>
|
|
1845
1913
|
<th>Recorded Date</th>
|
|
1846
1914
|
<th>Resolved Date</th>
|
|
@@ -1851,7 +1919,6 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
1851
1919
|
for (const cond of resolvedConditions) {
|
|
1852
1920
|
html += `<tr id="${templateUtilities.narrativeLinkId(cond)}">
|
|
1853
1921
|
<td class="Name">${templateUtilities.codeableConcept(cond.code)}</td>
|
|
1854
|
-
<td class="Severity">${templateUtilities.codeableConcept(cond.severity)}</td>
|
|
1855
1922
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
1856
1923
|
<td class="RecordedDate">${templateUtilities.renderDate(cond.recordedDate)}</td>
|
|
1857
1924
|
<td class="ResolvedDate">${templateUtilities.renderDate(cond.abatementDateTime)}</td>
|
|
@@ -1962,7 +2029,6 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
1962
2029
|
<thead>
|
|
1963
2030
|
<tr>
|
|
1964
2031
|
<th>Problem</th>
|
|
1965
|
-
<th>Severity</th>
|
|
1966
2032
|
<th>Onset Date</th>
|
|
1967
2033
|
<th>Recorded Date</th>
|
|
1968
2034
|
<th>Notes</th>
|
|
@@ -1972,7 +2038,6 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
1972
2038
|
for (const cond of activeConditions) {
|
|
1973
2039
|
html += `<tr id="${templateUtilities.narrativeLinkId(cond)}">
|
|
1974
2040
|
<td class="Name">${templateUtilities.codeableConcept(cond.code)}</td>
|
|
1975
|
-
<td class="Severity">${templateUtilities.codeableConcept(cond.severity)}</td>
|
|
1976
2041
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
1977
2042
|
<td class="RecordedDate">${templateUtilities.renderDate(cond.recordedDate)}</td>
|
|
1978
2043
|
<td class="Notes">${templateUtilities.renderNotes(cond.note, timezone, { styled: true, warning: true })}</td>
|