Skip to content

Commit

Permalink
Sort immunizaitons by occurrenceDateTime
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellrgn committed Jun 20, 2023
1 parent e2fb1aa commit 936a50e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion static/ips/assets/js/renderIPS.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $(document).ready(function () {
});
});
}

$('#FhirDropdown').on('click', () => updateDisplayMode('Entries'));
$('#NarrativeDropdown').on('click', () => updateDisplayMode('Text'));

Expand Down Expand Up @@ -274,6 +274,18 @@ const update = function (ips) {
console.log(immunization.reference);
section.immunizations.push(getEntry(ips, immunization.reference));
});
section.immunizations.sort((a, b) => {
let fa = a.occurrenceDateTime,
fb = b.occurrenceDateTime;

if (fa < fb) {
return -1;
}
if (fa > fb) {
return 1;
}
return 0;
});
render("Immunizations", section, "Immunizations");
}
else if (section.code.coding[0].code == "30954-2") {
Expand Down

0 comments on commit 936a50e

Please sign in to comment.