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..8be9dda70 100644
--- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java
@@ -61,22 +61,24 @@ public String getEmailSubject(Container c)
return "Clinical Alerts: " + getDateTimeFormat(c).format(new Date());
}
- @Override
+ //Kollil 10/13: Changed the daily clinical rounds alert to Tuesdays and Thursdays. Refer to ticket # 8636
public String getCronString()
{
- return "0 0 15 * * ?";
+// 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 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
@@ -85,8 +87,15 @@ public String getMessageBodyHTML(Container c, User u)
StringBuilder msg = new StringBuilder();
duplicateCases(c, u, msg);
- animalsWithoutRounds(c, u, msg);
- //animalsWithoutVetReview(c, u, msg);
+ //animalsWithoutRounds(c, u, msg);
+ animalsWithoutVetReview(c, u, msg);
+
+ /*Clinical process alerts : Kollil, 10/13/22
+ Merging two alerts into one. Refer to ticket #8636
+ */
+
+ animalsWithRounds(c, u, msg); //Added: 8-22-2016 R.Blasa
+ //animalsWithoutRounds2(c, u, msg); //Added 8-29-2016
return msg.toString();
}
@@ -112,7 +121,9 @@ 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("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("Room | Cage | Id | Assigned Vet | Problem(s) | Days Since Last Rounds |
");
@@ -138,6 +149,57 @@ public void exec(ResultSet object) throws SQLException
}
}
+ //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("");
+ msg.append("Room | Cage | Id | Assigned Vet | Problem(s) |
");
+
+ ts.forEach(new Selector.ForEachBlock()
+ {
+ @Override
+ public void exec(ResultSet object) throws SQLException
+ {
+ Results rs = new ResultsImpl(object, cols);
+ msg.append("");
+ msg.append("" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/room")), "None") + " | ");
+ msg.append("" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/cage")), "") + " | ");
+ msg.append("" + rs.getString(FieldKey.fromString("Id")) + " | ");
+ msg.append("" + safeAppend(rs.getString(FieldKey.fromString("assignedvet/DisplayName")), "None") + " | ");
+ msg.append("" + safeAppend(rs.getString(FieldKey.fromString("allProblemCategories")), "None") + " | ");
+
+ msg.append("
");
+ }
+ });
+
+ msg.append("
");
+ msg.append("
\n");
+ }
+ }
+
private String safeAppend(String val, String emptyText)
{
return val == null ? emptyText : val;
@@ -163,7 +225,9 @@ 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("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("");
msg.append("Room | Cage | Id | Assigned Vet | Problem(s) | Days Since last Vet Review |
");
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..8cdbd9917 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,17 @@ public String getEmailSubject(Container c)
}
@Override
+ //Kollil 10/13: Changed the daily alert to once a week, Wednesdays
public String getCronString()
{
- return "0 0 15 * * ?";
+ //return "0 0 15 * * ?";
+ return "0 0 15 ? * WED";
}
@Override
public String getScheduleDescription()
{
- return "daily at 3PM";
+ return "every Wednesday at 3PM";
}
@Override