From fd0ed7fa164713be75d1b5a12a577ac9838550a5 Mon Sep 17 00:00:00 2001 From: kollil Date: Thu, 13 Oct 2022 17:44:29 -0700 Subject: [PATCH 1/4] Changed the notifications. --- .../web/onprc_ehr/model/sources/PMIC_PET.js | 4 +- .../ClinicalRoundsNotification.java | 115 +++++++++++++++++- .../notification/VetReviewNotification.java | 9 +- 3 files changed, 120 insertions(+), 8 deletions(-) diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_PET.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_PET.js index 33402f046..4ad181461 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_PET.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_PET.js @@ -34,8 +34,8 @@ EHR.model.DataModelManager.registerMetadata('PET', { chargeType: { allowBlank: true, hidden: false, - defaultValue: 'PMIC' - + defaultValue: 'PMIC', + editable: false }, examNum: { 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..fb3ad3192 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 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 @@ -88,6 +94,10 @@ public String getMessageBodyHTML(Container c, User u) animalsWithoutRounds(c, u, msg); //animalsWithoutVetReview(c, u, msg); + //Clinical process alerts : kollil byt 10/13 + animalsWithRounds(c, u, msg); //Added: 8-22-2016 R.Blasa + animalsWithoutRounds2(c, u, msg); //Added 8-29-2016 + return msg.toString(); } @@ -188,4 +198,101 @@ public void exec(ResultSet object) throws SQLException msg.append("
\n"); } } -} + + //Clinical process alerts + 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("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"); + } + } + + //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("CONFIRMATION: There are " + count + " active cases that have their 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("
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"); + } + } + + } 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 From 31394bb47742122edaaf0a932d0e8d61f15a9784 Mon Sep 17 00:00:00 2001 From: kollil Date: Mon, 17 Oct 2022 15:55:01 -0700 Subject: [PATCH 2/4] Update the alert code. --- .../ClinicalRoundsNotification.java | 109 ++++++++++-------- 1 file changed, 59 insertions(+), 50 deletions(-) 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 fb3ad3192..7bfbfce88 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java @@ -90,13 +90,13 @@ public String getMessageBodyHTML(Container c, User u) { StringBuilder msg = new StringBuilder(); - duplicateCases(c, u, msg); + //duplicateCases(c, u, msg); animalsWithoutRounds(c, u, msg); - //animalsWithoutVetReview(c, u, msg); + animalsWithoutVetReview(c, u, msg); - //Clinical process alerts : kollil byt 10/13 + //Clinical process alerts : Kollil, 10/13/22 animalsWithRounds(c, u, msg); //Added: 8-22-2016 R.Blasa - animalsWithoutRounds2(c, u, msg); //Added 8-29-2016 + //animalsWithoutRounds2(c, u, msg); //Added 8-29-2016 return msg.toString(); } @@ -122,6 +122,7 @@ protected void animalsWithoutRounds(final Container c, User u, final StringBuild long count = ts.getRowCount(); if (count > 0) { + msg.append("Clinical Rounds Alerts: Active cases that do not have observations.
"); msg.append("WARNING: There are " + count + " active cases that do not have obs entered today.
"); msg.append(""); msg.append(""); @@ -173,6 +174,7 @@ protected void animalsWithoutVetReview(final Container c, User u, final StringBu long count = ts.getRowCount(); if (count > 0) { + msg.append("Clinical Rounds Alerts: Active cases with no Vet review.
"); msg.append("WARNING: There are " + count + " active cases that have not been vet reviewed in the past 7 days.
"); msg.append("
RoomCageIdAssigned VetProblem(s)Days Since Last Rounds
"); msg.append(""); @@ -200,52 +202,7 @@ public void exec(ResultSet object) throws SQLException } //Clinical process alerts - 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("WARNING: There are " + count + " active cases that do not have 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(""); - } - }); - - 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"); - } - } +// //Modified: 8-15-2016 R.Blasa Show Clinical open cases that were entered protected void animalsWithRounds(final Container c, User u, final StringBuilder msg) @@ -267,8 +224,10 @@ protected void animalsWithRounds(final Container c, User u, final StringBuilder 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: There are " + count + " active cases that have their obs entered today.
"); msg.append(""); msg.append(""); @@ -295,4 +254,54 @@ public void exec(ResultSet object) throws SQLException } } + + // 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("
RoomCageIdAssigned VetProblem(s)
"); +// 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"); +// } +// } + } From 82b00476fb1703d37db40362454f319c809c28b3 Mon Sep 17 00:00:00 2001 From: kollil Date: Mon, 17 Oct 2022 18:29:48 -0700 Subject: [PATCH 3/4] Updated #2 --- .../notification/ClinicalRoundsNotification.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 7bfbfce88..e1324b62b 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java @@ -90,9 +90,9 @@ public String getMessageBodyHTML(Container c, User u) { StringBuilder msg = new StringBuilder(); - //duplicateCases(c, u, msg); + duplicateCases(c, u, msg); animalsWithoutRounds(c, u, msg); - animalsWithoutVetReview(c, u, msg); + animalsWithoutVetReview(c, u, msg); //Clinical process alerts : Kollil, 10/13/22 animalsWithRounds(c, u, msg); //Added: 8-22-2016 R.Blasa @@ -123,7 +123,7 @@ protected void animalsWithoutRounds(final Container c, User u, final StringBuild if (count > 0) { msg.append("Clinical Rounds Alerts: Active cases that do not have observations.
"); - msg.append("WARNING: There are " + count + " active cases that do not have obs entered today.
"); + msg.append("WARNING: " + count + " active case(s) found that do not have obs entered today.
"); msg.append(""); msg.append(""); @@ -175,7 +175,7 @@ protected void animalsWithoutVetReview(final Container c, User u, final StringBu if (count > 0) { msg.append("Clinical Rounds Alerts: Active cases with no Vet review.
"); - msg.append("WARNING: There are " + count + " active cases that have not been vet reviewed in the past 7 days.
"); + 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(""); @@ -228,7 +228,7 @@ protected void animalsWithRounds(final Container c, User u, final StringBuilder if (count > 0) { msg.append("Clinical Rounds Process Alerts: Active cases that have observations.
"); - msg.append("CONFIRMATION: There are " + count + " active cases that have their obs entered today.
"); + 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(""); From c1554de88e1eb7639f851e046742562c6633b028 Mon Sep 17 00:00:00 2001 From: kollil Date: Tue, 29 Nov 2022 15:29:26 -0800 Subject: [PATCH 4/4] updated cln rounds alert --- .../onprc_ehr/notification/ClinicalRoundsNotification.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 e1324b62b..214b29754 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java @@ -67,7 +67,7 @@ public String getEmailSubject(Container c) // return "0 0 15 * * ?"; // } - //Kollil 10/13: Changed the daily alert to Tuesdays and Thursdays + //Kollil 10/13: Changed the daily clinical rounds alert to Tuesdays and Thursdays public String getCronString() { return "0 0 15 ? * TUE,THU"; @@ -95,8 +95,9 @@ public String getMessageBodyHTML(Container c, User u) animalsWithoutVetReview(c, u, msg); //Clinical process alerts : Kollil, 10/13/22 - animalsWithRounds(c, u, msg); //Added: 8-22-2016 R.Blasa - //animalsWithoutRounds2(c, u, msg); //Added 8-29-2016 + //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(); }
RoomCageIdAssigned VetProblem(s)