From dcf8dbb24528ae9f115f8d6b8da73b94a78128e6 Mon Sep 17 00:00:00 2001 From: kollil Date: Tue, 11 Mar 2025 01:08:45 -0700 Subject: [PATCH 1/2] New section in Behavior alert/notification for when an animal receives an alopecia score of 4 or 5, but does not have an open behavioral case for alopecia --- .../notification/BehaviorNotification.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java index 7a951fab6..0af1b700e 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java @@ -105,6 +105,7 @@ public String getMessageBodyHTML(Container c, User u) surgeryCasesRecentlyClosed(c, u, msg); pairIdConflicts(c, u , msg); NHPTraining_BehaviorAlert(c, u , msg); + AlopeciaAlert(c, u, msg); dcmNotesAlert(c, u , msg); notesEndingToday(c, u, msg, Arrays.asList("BSU Notes"), null); @@ -113,6 +114,32 @@ public String getMessageBodyHTML(Container c, User u) return msg.toString(); } + // Added by Kollil 03/07/2025, Tkt # 12145 + private void AlopeciaAlert(final Container c, User u, final StringBuilder msg) + { + if (QueryService.get().getUserSchema(u, c, "study") == null) { + msg.append("Warning: The onprc_ehr schema has not been enabled in this folder, so the alert cannot run!


"); + return; + } + TableInfo ti = QueryService.get().getUserSchema(u, c, "study").getTable("BehaviorAlertforAlopecia",ContainerFilter.Type.AllFolders.create(c, u)); +// ((ContainerFilterable) ti).setContainerFilter(ContainerFilter.Type.AllFolders.create(u); + TableSelector ts = new TableSelector(ti, null, null); + + long total = ts.getRowCount(); + msg.append("List of animals receive an alopecia score of 4 or 5, but does not have an open behavioral case for alopecia:

"); + if (total > 0) + { + msg.append("There are " + total + " entries found. "); + msg.append("

Click here to view them

\n"); + msg.append("
\n\n"); + } + else + { + msg.append("WARNING: There are no animals who receive an alopecia score of 4 or 5, but does not have an open behavioral case for alopecia !

\n"); + } + + } + // Added by Kollil 11/04/2020 private void NHPTraining_BehaviorAlert(final Container c, User u, final StringBuilder msg) { From 3893351ccd5fcf093f31bc62237e14d1be843e06 Mon Sep 17 00:00:00 2001 From: kollil Date: Tue, 11 Mar 2025 01:09:58 -0700 Subject: [PATCH 2/2] Added comment --- .../labkey/onprc_ehr/notification/BehaviorNotification.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java index 0af1b700e..35d950f86 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java @@ -105,7 +105,7 @@ public String getMessageBodyHTML(Container c, User u) surgeryCasesRecentlyClosed(c, u, msg); pairIdConflicts(c, u , msg); NHPTraining_BehaviorAlert(c, u , msg); - AlopeciaAlert(c, u, msg); + AlopeciaAlert(c, u, msg); //Added by Kollil, 3/7/2025 dcmNotesAlert(c, u , msg); notesEndingToday(c, u, msg, Arrays.asList("BSU Notes"), null); @@ -137,7 +137,6 @@ private void AlopeciaAlert(final Container c, User u, final StringBuilder msg) { msg.append("WARNING: There are no animals who receive an alopecia score of 4 or 5, but does not have an open behavioral case for alopecia !

\n"); } - } // Added by Kollil 11/04/2020