diff --git a/onprc_ehr/resources/queries/study/DVMAlertForAlopeciaCases.sql b/onprc_ehr/resources/queries/study/DVMAlertForAlopeciaCases.sql index e99e6ed0d..f248fc189 100644 --- a/onprc_ehr/resources/queries/study/DVMAlertForAlopeciaCases.sql +++ b/onprc_ehr/resources/queries/study/DVMAlertForAlopeciaCases.sql @@ -54,6 +54,16 @@ WHERE co.category = 'Alopecia Score' AND reset.observation IN ('0', '1', '2', '3') AND reset.date < co.date ), - '1900-01-01' + {ts '1900-01-01 00:00:00'} ) -); \ No newline at end of file +) + /* Remove old streaks that later returned to 0-3 */ + AND NOT EXISTS ( + SELECT 1 + FROM study.clinical_observations laterReset + WHERE laterReset.Id = co.Id + AND laterReset.category = 'Alopecia Score' + AND laterReset.observation IN ('0', '1', '2', '3') + AND laterReset.date > co.date +) +ORDER BY co.Id ASC \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java index f453f8406..a9b82ed5a 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java @@ -87,7 +87,7 @@ public String getMessageBodyHTML(Container c, User u) { StringBuilder msg = new StringBuilder(); - /* remarksWithoutAssignedVet(c, u, msg);*/ + /* remarksWithoutAssignedVet(c, u, msg);*/ DVMAlopeciaAlert(c,u,msg); //Added by Kolli, March 2026 vetRecordsUnderReview(c, u, msg); animalsWithoutAssignedVet(c, u, msg); @@ -110,9 +110,9 @@ private void DVMAlopeciaAlert(final Container c, User u, final StringBuilder msg if (total > 0) { - msg.append("
ALERT: " + total + " animals found with alopecia score of 4 or 5 with open behavioral case for alopecia in the last 7 days. "); - msg.append("Click here to view the data in a grid view\n"); - msg.append("
"); + msg.append("
ALERT: " + total + " animals found with alopecia score of 4 or 5 with open behavioral case for alopecia in the last 7 days. "); + msg.append("Click here to view the data in a grid view\n"); + msg.append("
"); //Display the report in the email Set columns = new HashSet<>(); @@ -149,7 +149,6 @@ private void DVMAlopeciaAlert(final Container c, User u, final StringBuilder msg }); msg.append("

"); } - else { msg.append("WARNING: No animals found with alopecia score of 4 or 5 with open behavioral case for alopecia in last 7 days!

\n"); @@ -237,4 +236,4 @@ protected void animalsWithoutAssignedVet(final Container c, User u, final String msg.append("
\n"); } } -} +} \ No newline at end of file