diff --git a/onprc_ehr/resources/queries/study/DVMAlertforAlopeciaCases.query.xml b/onprc_ehr/resources/queries/study/DVMAlertforAlopeciaCases.query.xml
new file mode 100644
index 000000000..8a9bd25b6
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/DVMAlertforAlopeciaCases.query.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ DVM alert for new alopecia cases with a score of 4 or 5
+
+
+ false
+
+ study
+ animal
+ id
+
+
+
+ false
+ Alert Observation Date
+
+
+ Alopecia Score
+
+
+ Performed By
+
+
+ Entered Since Last Vet Review?
+
+
+ Assigned Vet
+
+
+ Behavior Case Open Date
+
+
+ Vet Review Due Date
+
+
+
+
+
+
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/DVMAlertforAlopeciaCases.sql b/onprc_ehr/resources/queries/study/DVMAlertforAlopeciaCases.sql
new file mode 100644
index 000000000..85385bdb9
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/DVMAlertforAlopeciaCases.sql
@@ -0,0 +1,52 @@
+/* Added by Kollil 09/22/2025
+ When BSU creates a case AND scores the alopecia at either 4 or 5 (only those scores)
+ THEN the vet assigned to that animal should receive an alert.
+ Show open cases in last 7 days
+Refer to tkt # 12523
+*/
+SELECT
+ co.Id,
+ co.date AS AlertObservationDate,
+ co.observation AS AlopeciaScore,
+ co.performedby,
+ co.enteredSincevetReview,
+ co.Id.assignedVet.AssignedVet AS AssignedVet,
+ c.BehaviorCaseOpenDate,
+ TIMESTAMPADD(SQL_TSI_DAY, 7, c.BehaviorCaseOpenDate) AS VetReviewDueDate
+FROM study.clinical_observations co
+ INNER JOIN study.demographics d
+ ON d.Id = co.Id
+ INNER JOIN (
+ SELECT
+ x.Id,
+ MAX(x.date) AS BehaviorCaseOpenDate
+ FROM study.Cases x
+ WHERE x.category = 'Behavior'
+ AND x.allProblemCategories = 'Behavioral: Alopecia'
+ AND x.enddate IS NULL
+ GROUP BY x.Id
+) c
+ ON c.Id = co.Id
+WHERE co.category = 'Alopecia Score'
+ AND co.observation IN ('4', '5')
+ AND d.calculated_status = 'Alive'
+ AND NOT EXISTS (
+ SELECT 1
+ FROM study.clinical_observations prev
+ WHERE prev.Id = co.Id
+ AND prev.category = 'Alopecia Score'
+ AND prev.observation IN ('4', '5')
+ AND prev.date < co.date
+ AND prev.date >
+ COALESCE(
+ (
+ SELECT MAX(reset.date)
+ FROM study.clinical_observations reset
+ WHERE reset.Id = co.Id
+ AND reset.category = 'Alopecia Score'
+ AND reset.observation IN ('0', '1', '2', '3')
+ AND reset.date < co.date
+ ),
+ '1900-01-01'
+ )
+)
\ 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 9008df054..1b0a722fc 100644
--- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java
@@ -86,12 +86,38 @@ public String getMessageBodyHTML(Container c, User u)
StringBuilder msg = new StringBuilder();
/* remarksWithoutAssignedVet(c, u, msg);*/
+ DVMAlopeciaAlert(c,u,msg); //Added by Kolli, March 2026
vetRecordsUnderReview(c, u, msg);
animalsWithoutAssignedVet(c, u, msg);
return msg.toString();
}
+ /* Added by Kollil 09/22/2025
+ When BSU creates a case AND scores the alopecia at either 4 or 5 (only those scores)
+ THEN the vet assigned to that animal should receive an alert. Show open cases in last 7 days
+ Refer to tkt # 12523
+ */
+ private void DVMAlopeciaAlert(final Container c, User u, final StringBuilder msg)
+ {
+ TableInfo ti = getStudySchema(c, u).getTable("DVMAlertforAlopeciaCases");
+
+ TableSelector ts = new TableSelector(ti, null, null);
+ long total = ts.getRowCount();
+
+ if (total > 0)
+ {
+ msg.append("ALERT: Animals with alopecia score of 4 or 5 with open behavioral case for alopecia in last 7 days:
");
+ msg.append("There are " + total + " entries found. ");
+ msg.append("Click here to view them\n");
+ msg.append("
\n\n");
+ }
+ 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");
+ }
+ }
+
public void vetRecordsUnderReview(Container c, User u, final StringBuilder msg)
{
int duration = 7;