Skip to content

Commit 936a50e

Browse files
committedJun 20, 2023
Sort immunizaitons by occurrenceDateTime
1 parent e2fb1aa commit 936a50e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed
 

‎static/ips/assets/js/renderIPS.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ $(document).ready(function () {
4040
});
4141
});
4242
}
43-
43+
4444
$('#FhirDropdown').on('click', () => updateDisplayMode('Entries'));
4545
$('#NarrativeDropdown').on('click', () => updateDisplayMode('Text'));
4646

@@ -274,6 +274,18 @@ const update = function (ips) {
274274
console.log(immunization.reference);
275275
section.immunizations.push(getEntry(ips, immunization.reference));
276276
});
277+
section.immunizations.sort((a, b) => {
278+
let fa = a.occurrenceDateTime,
279+
fb = b.occurrenceDateTime;
280+
281+
if (fa < fb) {
282+
return -1;
283+
}
284+
if (fa > fb) {
285+
return 1;
286+
}
287+
return 0;
288+
});
277289
render("Immunizations", section, "Immunizations");
278290
}
279291
else if (section.code.coding[0].code == "30954-2") {

0 commit comments

Comments
 (0)
Please sign in to comment.