diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java index 2c719c49d..214b29754 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java @@ -62,21 +62,27 @@ public String getEmailSubject(Container c) } @Override +// public String getCronString() +// { +// return "0 0 15 * * ?"; +// } + + //Kollil 10/13: Changed the daily clinical rounds alert to Tuesdays and Thursdays public String getCronString() { - return "0 0 15 * * ?"; + return "0 0 15 ? * TUE,THU"; } @Override public String getScheduleDescription() { - return "every day at 3PM"; + return "every Tuesday & Thursday at 3PM"; } @Override public String getDescription() { - return "The report is designed alert if there are any animals without rounds observations entered or lacking vet review"; + return "The report is designed to alert if there are any animals without rounds observations entered or lacking vet review. Also, contains the report to alert for Clinical rounds observations entered today, and not entered recently"; } @Override @@ -86,7 +92,12 @@ public String getMessageBodyHTML(Container c, User u) duplicateCases(c, u, msg); animalsWithoutRounds(c, u, msg); - //animalsWithoutVetReview(c, u, msg); + animalsWithoutVetReview(c, u, msg); + + //Clinical process alerts : Kollil, 10/13/22 + //Merging two alerts into one. + animalsWithRounds(c, u, msg); //Added: 8-22-2016 R.Blasa + //animalsWithoutRounds2(c, u, msg); //Added 8-29-2016 return msg.toString(); } @@ -112,7 +123,8 @@ protected void animalsWithoutRounds(final Container c, User u, final StringBuild long count = ts.getRowCount(); if (count > 0) { - msg.append("WARNING: There are " + count + " active cases that do not have obs entered today.
"); + msg.append("Clinical Rounds Alerts: Active cases that do not have observations.
"); + msg.append("WARNING: " + count + " active case(s) found that do not have obs entered today.
"); msg.append(""); msg.append(""); @@ -163,7 +175,8 @@ protected void animalsWithoutVetReview(final Container c, User u, final StringBu long count = ts.getRowCount(); if (count > 0) { - msg.append("WARNING: There are " + count + " active cases that have not been vet reviewed in the past 7 days.
"); + msg.append("Clinical Rounds Alerts: Active cases with no Vet review.
"); + msg.append("WARNING: " + count + " active case(s) found that have not been vet reviewed in the past 7 days.
"); msg.append("
RoomCageIdAssigned VetProblem(s)Days Since Last Rounds
"); msg.append(""); @@ -188,4 +201,108 @@ public void exec(ResultSet object) throws SQLException msg.append("
\n"); } } -} + + //Clinical process alerts +// + + //Modified: 8-15-2016 R.Blasa Show Clinical open cases that were entered + protected void animalsWithRounds(final Container c, User u, final StringBuilder msg) + { + SimpleFilter filter = new SimpleFilter(FieldKey.fromString("daysSinceLastRounds"), 0, CompareType.EQUAL); + filter.addCondition(FieldKey.fromString("isActive"), true, CompareType.EQUAL); + filter.addCondition(FieldKey.fromString("category"), "Clinical", CompareType.EQUAL); + filter.addCondition(FieldKey.fromString("Id/demographics/calculated_status"), "Alive", CompareType.EQUAL); + + TableInfo ti = getStudySchema(c, u).getTable("cases"); + Set keys = new HashSet<>(); + keys.add(FieldKey.fromString("Id")); + keys.add(FieldKey.fromString("Id/curLocation/room")); + keys.add(FieldKey.fromString("Id/curLocation/cage")); + keys.add(FieldKey.fromString("daysSinceLastRounds")); + keys.add(FieldKey.fromString("assignedvet/DisplayName")); + keys.add(FieldKey.fromString("allProblemCategories")); + final Map cols = QueryService.get().getColumns(ti, keys); + + TableSelector ts = new TableSelector(ti, cols.values(), filter, new Sort("Id/curLocation/room_sortValue,Id/curLocation/cage_sortValue")); + long count = ts.getRowCount(); + + if (count > 0) + { + msg.append("Clinical Rounds Process Alerts: Active cases that have observations.
"); + msg.append("CONFIRMATION: " + count + " active case(s) found that have their obs entered today.
"); + msg.append("
RoomCageIdAssigned VetProblem(s)Days Since last Vet Review
"); + msg.append(""); + + ts.forEach(new Selector.ForEachBlock() + { + @Override + public void exec(ResultSet object) throws SQLException + { + Results rs = new ResultsImpl(object, cols); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + + msg.append(""); + } + }); + + msg.append("
RoomCageIdAssigned VetProblem(s)
" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/room")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/cage")), "") + "" + rs.getString(FieldKey.fromString("Id")) + "" + safeAppend(rs.getString(FieldKey.fromString("assignedvet/DisplayName")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("allProblemCategories")), "None") + "
"); + msg.append("
\n"); + } + } + + + // protected void animalsWithoutRounds2(final Container c, User u, final StringBuilder msg) +// { +// SimpleFilter filter = new SimpleFilter(FieldKey.fromString("daysSinceLastRounds"), 0, CompareType.GT); +// filter.addCondition(FieldKey.fromString("isActive"), true, CompareType.EQUAL); +// filter.addCondition(FieldKey.fromString("category"), "Clinical", CompareType.EQUAL); +// filter.addCondition(FieldKey.fromString("Id/demographics/calculated_status"), "Alive", CompareType.EQUAL); +// +// TableInfo ti = getStudySchema(c, u).getTable("cases"); +// Set keys = new HashSet<>(); +// keys.add(FieldKey.fromString("Id")); +// keys.add(FieldKey.fromString("Id/curLocation/room")); +// keys.add(FieldKey.fromString("Id/curLocation/cage")); +// keys.add(FieldKey.fromString("daysSinceLastRounds")); +// keys.add(FieldKey.fromString("assignedvet/DisplayName")); +// keys.add(FieldKey.fromString("allProblemCategories")); +// final Map cols = QueryService.get().getColumns(ti, keys); +// +// TableSelector ts = new TableSelector(ti, cols.values(), filter, new Sort("Id/curLocation/room_sortValue,Id/curLocation/cage_sortValue")); +// long count = ts.getRowCount(); +// +// if (count > 0) +// { +// msg.append("Clinical Rounds Process Alerts: Active cases that do not have observations entered today.
"); +// msg.append("WARNING: There are " + count + " active cases that do not have obs entered today.
"); +// msg.append(""); +// msg.append(""); +// +// ts.forEach(new Selector.ForEachBlock() +// { +// @Override +// public void exec(ResultSet object) throws SQLException +// { +// Results rs = new ResultsImpl(object, cols); +// msg.append(""); +// msg.append(""); +// msg.append(""); +// msg.append(""); +// msg.append(""); +// msg.append(""); +// msg.append(""); +// msg.append(""); +// } +// }); +// +// msg.append("
RoomCageIdAssigned VetProblem(s)Days Since Last Rounds
" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/room")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/cage")), "") + "" + rs.getString(FieldKey.fromString("Id")) + "" + safeAppend(rs.getString(FieldKey.fromString("assignedvet/DisplayName")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("allProblemCategories")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("daysSinceLastRounds")), "") + "
"); +// msg.append("
\n"); +// } +// } + + } 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 3e30b8c7e..e454b213d 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java @@ -63,15 +63,20 @@ public String getEmailSubject(Container c) } @Override +// public String getCronString() +// { +// return "0 0 15 * * ?"; +// } + //Kollil 10/13: Changed the daily alert to once a week, Wednesdays public String getCronString() { - return "0 0 15 * * ?"; + return "0 0 15 ? * WED"; } @Override public String getScheduleDescription() { - return "daily at 3PM"; + return "every Wednesday at 3PM"; } @Override