Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions onprc_ehr/resources/queries/study/DVMAlertForAlopeciaCases.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
)
);
)
/* 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
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -110,9 +110,9 @@ private void DVMAlopeciaAlert(final Container c, User u, final StringBuilder msg

if (total > 0)
{
msg.append("<br><b>ALERT: <b> " + total + " animals found with alopecia score of 4 or 5 with open behavioral case for alopecia in the last 7 days. ");
msg.append("<a href='" + getExecuteQueryUrl(c, "study", "DVMAlertforAlopeciaCases", null) + "'>Click here to view the data in a grid view</a>\n");
msg.append("<hr>");
msg.append("<br><b>ALERT: " + total + " animals found with alopecia score of 4 or 5 with open behavioral case for alopecia in the last 7 days. ");
msg.append("<a href='" + getExecuteQueryUrl(c, "study", "DVMAlertforAlopeciaCases", null) + "'>Click here to view the data in a grid view</a></b>\n");
msg.append("<br>");

//Display the report in the email
Set<FieldKey> columns = new HashSet<>();
Expand Down Expand Up @@ -149,7 +149,6 @@ private void DVMAlopeciaAlert(final Container c, User u, final StringBuilder msg
});
msg.append("</table><br><hr>");
}

else
{
msg.append("<b>WARNING: No animals found with alopecia score of 4 or 5 with open behavioral case for alopecia in last 7 days!</b><br><hr>\n");
Expand Down Expand Up @@ -237,4 +236,4 @@ protected void animalsWithoutAssignedVet(final Container c, User u, final String
msg.append("<hr>\n");
}
}
}
}
Loading