© 2024 IQVIA - All Rights Reserved

Compare lab collections with date/ time of last meal

Edit Check to compare lab collections with date/ time of last meal.

var ret = false; if ('Complete' == itemJson.item.dataCollectionStatus) { //make sure we're complete var fastingItem = findFirstItemByName(formJson, 'FastingDate'); if (fastingItem && fastingItem.dataCollectionStatus == 'Complete') { //now find fasting //get the date milliseconds of each var msInOneHour = (60*60*1000); varfastingDate = fastingItem.dateValueMs; var thisDate = itemJson.item.dateValueMs; var hourDelta = ((thisDate - fastingDate) / msInOneHour); ret = (hourDelta > 8); //need to be fasted for at least 8 hours } } return ret;

On line ‘3' is where we do the lookup of the fasting. Replace the second parameter (FastingDate) with the actual item name where you’re capturing the fasting datetime.

Line 10 is where we ensure they are fasting at least 8 hours.

Exported and Printed Copies Are Uncontrolled