From d421f8ecbc06c55fac5e2b5f50c663b7bffb78c6 Mon Sep 17 00:00:00 2001 From: ohsudev Date: Tue, 7 Oct 2025 11:56:02 -0700 Subject: [PATCH 01/21] Created a new Clinpath Chemistry email notification to alert lab values that contains "Panic value" entries --- .../onprc_ehr/ChemistryPanicNotification.sql | 14 ++++++++++++++ .../onprc_ehr/ChemistryPaniucNotification.xml | 14 ++++++++++++++ .../resources/scripts/onprc_ehr/onprc_triggers.js | 8 ++++++++ 3 files changed, 36 insertions(+) create mode 100644 onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql create mode 100644 onprc_ehr/resources/queries/onprc_ehr/ChemistryPaniucNotification.xml diff --git a/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql new file mode 100644 index 000000000..d119f304f --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql @@ -0,0 +1,14 @@ +select a.Id, + a.date, + a.servicerequested, + b.testid, + b.qualResult, + a.vet, + a.created + +from study.ClinpathRuns a, study.chemistryResults b +Where a.objectid = b.runid + And a.type = 'biochemistry' + And b.qualresult like '%panic%' + And a.qcstate = 18 + And b.qcstate = 18 \ No newline at end of file diff --git a/onprc_ehr/resources/queries/onprc_ehr/ChemistryPaniucNotification.xml b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPaniucNotification.xml new file mode 100644 index 000000000..45e370226 --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPaniucNotification.xml @@ -0,0 +1,14 @@ + + + + + + + user ID + true + + +
+
+
+
diff --git a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js index a9bf2573a..6ea1e7526 100644 --- a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js +++ b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js @@ -1355,6 +1355,14 @@ exports.init = function(EHR){ } }); + // Added: 10-6-2025 + EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_UPSERT, 'study', 'chemistryResults', function (helper, scriptErrors, row, oldRow) { + if (row.Id && row.qualresults) { + //update birth records + triggerHelper.sendClinpatPanicEmail(row.Id, row.qualresults, row.vet); + } + }); + //Added: 10-4-2022 R.Blasa EHR.Server.TriggerManager.registerHandler(EHR.Server.TriggerManager.Events.COMPLETE, function(event, errors, helper){ // Send notifications when requests approved From 3cf6ef17bc92752a64b93464173ac6866da82d75 Mon Sep 17 00:00:00 2001 From: ohsudev Date: Mon, 13 Oct 2025 10:37:39 -0700 Subject: [PATCH 02/21] Modified program to allow immediate notifcation when Panic entries were made onto the Chemistry lab results. --- ...ion.xml => ChemistryPanicNotification.xml} | 0 .../query/ONPRC_EHRTriggerHelper.java | 39 +++++++++++++++++++ 2 files changed, 39 insertions(+) rename onprc_ehr/resources/queries/onprc_ehr/{ChemistryPaniucNotification.xml => ChemistryPanicNotification.xml} (100%) diff --git a/onprc_ehr/resources/queries/onprc_ehr/ChemistryPaniucNotification.xml b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.xml similarity index 100% rename from onprc_ehr/resources/queries/onprc_ehr/ChemistryPaniucNotification.xml rename to onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.xml diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index b7d72a105..69855a9c9 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -54,6 +54,9 @@ import org.labkey.api.query.QueryService; import org.labkey.api.query.QueryUpdateServiceException; import org.labkey.api.query.UserSchema; +import org.labkey.api.security.Group; +import org.labkey.api.security.MemberType; +import org.labkey.api.security.SecurityManager; import org.labkey.api.security.User; import org.labkey.api.security.UserManager; import org.labkey.api.security.UserPrincipal; @@ -2633,6 +2636,42 @@ public void exec(ResultSet object) throws SQLException } } + public void sendRequestStateEmail(String id, String qualresult, String panic) + { + + final TableInfo requestTable = getTableInfo("onpc_ehr", "ChemistryNotification"); + SimpleFilter filter = new SimpleFilter(FieldKey.fromString("qualresult"), '%' + panic + '%', CompareType.IN); + TableSelector ts = new TableSelector(requestTable, filter, null); + + ts.forEach(rs -> { + String testresults = rs.getString("qualResult"); + Integer vetname = rs.getInt("vetname"); + Integer servicename = rs.getInt("servicerequested"); + Integer paneltest = rs.getInt("paneltestname"); + boolean sendemail = rs.getObject("sendemail") == null ? false : rs.getBoolean("sendemail"); + String title = rs.getString("title"); + String formtype = rs.getString("formtype"); + + if (sendemail) + { + +// Set recipients = vetname; +// if (recipients.isEmpty()) +// { +// _log.warn("No recipients, unable to send EHR trigger script email"); +// return; +// } + + StringBuilder html = new StringBuilder(); + +// html.append("One or more records from the request titled " + title + " have been marked " + label.toLowerCase() + ". "); + +// sendMessage(subject, html.toString(), vetname); + } + + }); + } + //Added 9-30-2025 From 32ecb6a56643bf39e32045ff6d2e11699e965e6b Mon Sep 17 00:00:00 2001 From: ohsudev Date: Thu, 16 Oct 2025 22:52:33 -0700 Subject: [PATCH 03/21] Modified Clinpath notification to include one set of recipeints. --- .../onprc_ehr/ChemistryPanicNotification.sql | 3 +- .../scripts/onprc_ehr/onprc_triggers.js | 4 +- .../query/ONPRC_EHRTriggerHelper.java | 64 +++++++++++++------ 3 files changed, 48 insertions(+), 23 deletions(-) diff --git a/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql index d119f304f..d063bdcf1 100644 --- a/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql +++ b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql @@ -4,7 +4,8 @@ select a.Id, b.testid, b.qualResult, a.vet, - a.created + a.created, + b.objectid from study.ClinpathRuns a, study.chemistryResults b Where a.objectid = b.runid diff --git a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js index d4bc4a577..bfd492307 100644 --- a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js +++ b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js @@ -1351,9 +1351,9 @@ exports.init = function(EHR){ // Added: 10-6-2025 EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_UPSERT, 'study', 'chemistryResults', function (helper, scriptErrors, row, oldRow) { - if (row.Id && row.qualresults) { + if (row.Id && row.qualresults == 'panic%') { //update birth records - triggerHelper.sendClinpatPanicEmail(row.Id, row.qualresults, row.vet); + triggerHelper.sendClinpatPanicEmail(row.Id, row.objectid); } }); diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 69855a9c9..36eaffe2b 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2636,43 +2636,67 @@ public void exec(ResultSet object) throws SQLException } } - public void sendRequestStateEmail(String id, String qualresult, String panic) + public void sendClinpatPanicEmail(String id, String objectid, Integer vetname) { final TableInfo requestTable = getTableInfo("onpc_ehr", "ChemistryNotification"); - SimpleFilter filter = new SimpleFilter(FieldKey.fromString("qualresult"), '%' + panic + '%', CompareType.IN); + SimpleFilter filter = new SimpleFilter(FieldKey.fromString("objectid"), objectid, CompareType.IN); TableSelector ts = new TableSelector(requestTable, filter, null); ts.forEach(rs -> { String testresults = rs.getString("qualResult"); - Integer vetname = rs.getInt("vetname"); Integer servicename = rs.getInt("servicerequested"); - Integer paneltest = rs.getInt("paneltestname"); - boolean sendemail = rs.getObject("sendemail") == null ? false : rs.getBoolean("sendemail"); - String title = rs.getString("title"); - String formtype = rs.getString("formtype"); + String paneltest = rs.getString("testid"); + Date clndate = rs.getDate("date"); + String subject = "Clinpath Chemistry Panic Values"; + StringBuilder html = new StringBuilder(); - if (sendemail) - { -// Set recipients = vetname; -// if (recipients.isEmpty()) -// { -// _log.warn("No recipients, unable to send EHR trigger script email"); -// return; -// } + Set recipients = getRecipients(vetname); + if (recipients.isEmpty()) + { + _log.warn("No recipients, unable to send EHR trigger script email"); + return; + } + - StringBuilder html = new StringBuilder(); + html.append("Chemistry Results with Panic values"); -// html.append("One or more records from the request titled " + title + " have been marked " + label.toLowerCase() + ". "); -// sendMessage(subject, html.toString(), vetname); - } + sendMessage(subject, html.toString(), recipients); - }); + }); +// }); } + private Set getRecipients(Integer... userIds) + { + Set recipients = new HashSet<>(); + for (Integer userId : userIds) + { + if (userId > 0) + { + UserPrincipal up = SecurityManager.getPrincipal(userId); + if (up != null) + { + if (up instanceof User) + { + recipients.add(up); + } + else + { + for (UserPrincipal u : SecurityManager.getAllGroupMembers((Group)up, MemberType.ACTIVE_USERS)) + { + if (u.isActive()) + recipients.add(u); + } + } + } + } + } + return recipients; + } //Added 9-30-2025 public String retrieveGeographic_Origin(String Id) From d26da5f1d7f7b1d00a656d8c7da6dfecd91eab33 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Wed, 29 Oct 2025 19:17:19 -0700 Subject: [PATCH 04/21] Created clinpath notification for Chemistry results that shows "Panic values". --- .../query/ONPRC_EHRTriggerHelper.java | 92 +++++++++++++++---- 1 file changed, 72 insertions(+), 20 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 36eaffe2b..1fc20e45e 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2638,37 +2638,89 @@ public void exec(ResultSet object) throws SQLException public void sendClinpatPanicEmail(String id, String objectid, Integer vetname) { + String subject = "Chemistry Results with Panic values"; - final TableInfo requestTable = getTableInfo("onpc_ehr", "ChemistryNotification"); - SimpleFilter filter = new SimpleFilter(FieldKey.fromString("objectid"), objectid, CompareType.IN); - TableSelector ts = new TableSelector(requestTable, filter, null); + Set recipients = getRecipients(vetname); + if (recipients.isEmpty()) + { + _log.warn("No recipients, unable to send EHR trigger script email"); + return; + } - ts.forEach(rs -> { - String testresults = rs.getString("qualResult"); - Integer servicename = rs.getInt("servicerequested"); - String paneltest = rs.getString("testid"); - Date clndate = rs.getDate("date"); - String subject = "Clinpath Chemistry Panic Values"; - StringBuilder html = new StringBuilder(); + final TableInfo ti = getTableInfo("onpc_ehr", "ChemistryNotification"); + SimpleFilter filter = new SimpleFilter(FieldKey.fromString("objectid"), objectid, CompareType.IN); - Set recipients = getRecipients(vetname); - if (recipients.isEmpty()) - { - _log.warn("No recipients, unable to send EHR trigger script email"); - return; - } + List names= new ArrayList<>(); + FieldKey clinpathFieldKey = FieldKey.fromString("objectid"); + names.add(clinpathFieldKey); + names.add(FieldKey.fromString("qualResult")); + names.add(FieldKey.fromString("servicerequested")); + names.add(FieldKey.fromString("testid")); + names.add(FieldKey.fromString("date")); + names.add(FieldKey.fromString("Id")); - html.append("Chemistry Results with Panic values"); + final Map colKeys = QueryService.get().getColumns(ti, names); + final ColumnInfo clinpathColumn = colKeys.get(clinpathFieldKey); + TableSelector ts = new TableSelector(ti, colKeys.values(), filter, null); + + final StringBuilder html = new StringBuilder(); + if (ts.getRowCount() == 0) + { + html.append("There are Chemistry Panlc Values to display"); - sendMessage(subject, html.toString(), recipients); + return; + } + else + { + //Create header information on the report + + html.append(""); + html.append("\n"); + ts.forEach(new Selector.ForEachBlock() + { + + @Override + public void exec(ResultSet rs) throws SQLException + { + + TableInfo ti2 = getTableInfo("onprc_ehr", "Labwork_Requestor_Vets"); + SimpleFilter filter2 = new SimpleFilter(FieldKey.fromString("userid"), rs.getString("vetname")); + filter2.addCondition(FieldKey.fromString("DisableDate"), true, CompareType.ISBLANK); + + TableSelector ts2 = new TableSelector(ti2, PageFlowUtil.set("LastName", "FirstName") , filter2, null); + List ret2 = ts2.getArrayList(String.class); + if (!ret2.isEmpty()) + { + for (String Vetname : ret2) + { + html.append("\n"); + break; + + } + } + } + + } + + ); + + } + + html.append("
Animal IDDateService Requested Panel Test Name Qual Results Vet/PI Name
" + PageFlowUtil.filter(rs.getString("Id")) + + "" + PageFlowUtil.filter(rs.getString("date")) + + "" + PageFlowUtil.filter(rs.getString("servicerequested")) + + " " + PageFlowUtil.filter(rs.getString("testid")) + + " " + PageFlowUtil.filter(rs.getString("qualResult")) + + "" + PageFlowUtil.filter(rs.getString("Vetname")) + "
\n"); + + sendMessage(subject, html.toString(), recipients); - }); -// }); } + private Set getRecipients(Integer... userIds) { Set recipients = new HashSet<>(); From f24507a4f4ed3cae39e4daa4875542d15ff47858 Mon Sep 17 00:00:00 2001 From: ohsudev Date: Fri, 31 Oct 2025 15:20:42 -0700 Subject: [PATCH 05/21] Created clinpath notification for Chemistry results that shows "Panic values". --- .../org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 1fc20e45e..36e4e8485 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2640,7 +2640,11 @@ public void sendClinpatPanicEmail(String id, String objectid, Integer vetname) { String subject = "Chemistry Results with Panic values"; - Set recipients = getRecipients(vetname); + + Integer testname = 1007; //Raymond Vamdy 1014 + + Set recipients = getRecipients(testname); +// Set recipients = getRecipients(vetname); if (recipients.isEmpty()) { _log.warn("No recipients, unable to send EHR trigger script email"); From 4149404c1ea12b1360073609d1c377d39bcaf84b Mon Sep 17 00:00:00 2001 From: ohsudev Date: Mon, 3 Nov 2025 11:58:43 -0800 Subject: [PATCH 06/21] Created clinpath notification for Chemistry results that shows "Panic values". --- onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js index a4978be06..aad235283 100644 --- a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js +++ b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js @@ -1377,10 +1377,10 @@ exports.init = function(EHR){ }); // Added: 10-6-2025 - EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_UPSERT, 'study', 'chemistryResults', function (helper, scriptErrors, row, oldRow) { + EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_UPSERT, 'study', 'chemistryResults', function (helper, scriptErrors, row, oldRow) { if (row.Id && row.qualresults == 'panic%') { //update birth records - triggerHelper.sendClinpatPanicEmail(row.Id, row.objectid); + triggerHelper.sendClinpatPanicEmail(row.Id, row.objectid,row.vet); } }); From 321eb1c4a6161f15b1d5a9d5bcacda425151cc09 Mon Sep 17 00:00:00 2001 From: ohsudev Date: Wed, 5 Nov 2025 16:18:25 -0800 Subject: [PATCH 07/21] Modified program implement Chemistry email notifications. --- .../src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 36e4e8485..66144e5c2 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2653,7 +2653,7 @@ public void sendClinpatPanicEmail(String id, String objectid, Integer vetname) final TableInfo ti = getTableInfo("onpc_ehr", "ChemistryNotification"); - SimpleFilter filter = new SimpleFilter(FieldKey.fromString("objectid"), objectid, CompareType.IN); + SimpleFilter filter = new SimpleFilter(FieldKey.fromString("vet"), vetname, CompareType.EQUAL); List names= new ArrayList<>(); FieldKey clinpathFieldKey = FieldKey.fromString("objectid"); From f61b730dc92a8eb42812280d204e7dfdaa7a712c Mon Sep 17 00:00:00 2001 From: ohsudev Date: Wed, 5 Nov 2025 17:54:16 -0800 Subject: [PATCH 08/21] Modified program implement Chemistry email notifications. --- onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js | 3 +-- .../src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js index aad235283..3f6637b99 100644 --- a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js +++ b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js @@ -1378,8 +1378,7 @@ exports.init = function(EHR){ // Added: 10-6-2025 EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_UPSERT, 'study', 'chemistryResults', function (helper, scriptErrors, row, oldRow) { - if (row.Id && row.qualresults == 'panic%') { - //update birth records + if (row.Id && row.qualresults == '%panic%') { triggerHelper.sendClinpatPanicEmail(row.Id, row.objectid,row.vet); } }); diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 66144e5c2..9707f3fd8 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2640,7 +2640,6 @@ public void sendClinpatPanicEmail(String id, String objectid, Integer vetname) { String subject = "Chemistry Results with Panic values"; - Integer testname = 1007; //Raymond Vamdy 1014 Set recipients = getRecipients(testname); @@ -2673,7 +2672,7 @@ public void sendClinpatPanicEmail(String id, String objectid, Integer vetname) if (ts.getRowCount() == 0) { - html.append("There are Chemistry Panlc Values to display"); + html.append("There are no Chemistry Panlc Values to display"); return; } From b3b435ff234b8476b45155e7ca58693d536c3cdf Mon Sep 17 00:00:00 2001 From: ohsudev Date: Wed, 5 Nov 2025 22:39:31 -0800 Subject: [PATCH 09/21] Modified program implement Chemistry email notifications. --- .../queries/onprc_ehr/ChemistryPanicNotification.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql index d063bdcf1..0cab616f4 100644 --- a/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql +++ b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql @@ -5,7 +5,9 @@ select a.Id, b.qualResult, a.vet, a.created, - b.objectid + a.objectid, + a.taskid, + from study.ClinpathRuns a, study.chemistryResults b Where a.objectid = b.runid From ba750752db6e5497eb821d5b68216a5553dc00ad Mon Sep 17 00:00:00 2001 From: ohsudev Date: Thu, 13 Nov 2025 12:51:24 -0800 Subject: [PATCH 10/21] Modified Chemistry Results to flag Panic values. --- onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js index 3f6637b99..32fde3359 100644 --- a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js +++ b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js @@ -1378,7 +1378,7 @@ exports.init = function(EHR){ // Added: 10-6-2025 EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_UPSERT, 'study', 'chemistryResults', function (helper, scriptErrors, row, oldRow) { - if (row.Id && row.qualresults == '%panic%') { + if (row.Id && ['panic','Panic'].indexOf(row.qualresults ) != -1) { triggerHelper.sendClinpatPanicEmail(row.Id, row.objectid,row.vet); } }); From 69f676648e4052d5e15d4f6117084a04143189c7 Mon Sep 17 00:00:00 2001 From: ohsudev Date: Tue, 18 Nov 2025 14:59:29 -0800 Subject: [PATCH 11/21] Created a email notification for Chemistry entries that shows a "qualresutl" values that contain string called"panic"/ --- onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js | 6 ++++-- .../org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js index 32fde3359..2b1b38040 100644 --- a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js +++ b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js @@ -1378,8 +1378,10 @@ exports.init = function(EHR){ // Added: 10-6-2025 EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_UPSERT, 'study', 'chemistryResults', function (helper, scriptErrors, row, oldRow) { - if (row.Id && ['panic','Panic'].indexOf(row.qualresults ) != -1) { - triggerHelper.sendClinpatPanicEmail(row.Id, row.objectid,row.vet); + // ['panic','Panic'].indexOf(row.qualresult) !== -1 + if (row.Id && row.qualresult.toLowerCase().indexOf('panic') !== -1) { + console.log("panic values: " + row.qualresult) + triggerHelper.sendClinpathPanicEmail(row.Id, row.objectid,row.vet); } }); diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 9707f3fd8..e13a36bf8 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -66,6 +66,7 @@ import org.labkey.api.util.MailHelper; import org.labkey.api.util.PageFlowUtil; import org.labkey.api.util.Pair; +import org.labkey.api.util.logging.LogHelper; import org.labkey.onprc_ehr.ONPRC_EHRManager; import org.labkey.onprc_ehr.ONPRC_EHRModule; import org.labkey.onprc_ehr.ONPRC_EHRSchema; @@ -102,7 +103,7 @@ */ public class ONPRC_EHRTriggerHelper { - private static final Logger _log = LogManager.getLogger(ONPRC_EHRTriggerHelper.class); + private static final Logger _log = LogHelper.getLogger(ONPRC_EHRTriggerHelper.class, "Fill in description"); private static final String NONRESTRICTED = "Nonrestricted"; private static final String EXPERIMENTAL_EUTHANASIA = "EUTHANASIA, EXPERIMENTAL"; private static final String NON_EXPERIMENTAL_EUTHANASIA = "EUTHANASIA, NONEXPERIMENTAL"; @@ -2636,7 +2637,7 @@ public void exec(ResultSet object) throws SQLException } } - public void sendClinpatPanicEmail(String id, String objectid, Integer vetname) + public void sendClinpathPanicEmail(String id, String objectid, Integer vetname) { String subject = "Chemistry Results with Panic values"; From e11a13e490d713193c74f213192040b9a8a005fc Mon Sep 17 00:00:00 2001 From: ohsudev Date: Wed, 19 Nov 2025 14:45:57 -0800 Subject: [PATCH 12/21] Created a email notification for Chemistry entries that shows a "qualresutl" values that contain string called"panic"/ --- .../queries/onprc_ehr/ChemistryPanicNotification.sql | 2 +- onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql index 0cab616f4..bae6066e7 100644 --- a/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql +++ b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql @@ -2,7 +2,7 @@ select a.Id, a.date, a.servicerequested, b.testid, - b.qualResult, + b.qualresult, a.vet, a.created, a.objectid, diff --git a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js index 2b1b38040..e17860c6e 100644 --- a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js +++ b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js @@ -1380,8 +1380,8 @@ exports.init = function(EHR){ EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_UPSERT, 'study', 'chemistryResults', function (helper, scriptErrors, row, oldRow) { // ['panic','Panic'].indexOf(row.qualresult) !== -1 if (row.Id && row.qualresult.toLowerCase().indexOf('panic') !== -1) { - console.log("panic values: " + row.qualresult) - triggerHelper.sendClinpathPanicEmail(row.Id, row.objectid,row.vet); + console.log("panic values: " + row.qualresult); + triggerHelper.sendClinpathPanicEmail(row.Id, row.objectid); } }); From 0118d4900c2d421b0cc18200c79a1f424cdb6d53 Mon Sep 17 00:00:00 2001 From: ohsudev Date: Wed, 19 Nov 2025 14:51:02 -0800 Subject: [PATCH 13/21] Created a email notification for Chemistry entries that shows a "qualresutl" values that contain string called"panic"/ --- .../onprc_ehr/query/ONPRC_EHRTriggerHelper.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index e13a36bf8..41866a1c7 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2637,9 +2637,10 @@ public void exec(ResultSet object) throws SQLException } } - public void sendClinpathPanicEmail(String id, String objectid, Integer vetname) + public void sendClinpathPanicEmail(String id, String objectid) { - String subject = "Chemistry Results with Panic values"; + String subject = "Chemistry Result" + + "s with Panic values"; Integer testname = 1007; //Raymond Vamdy 1014 @@ -2652,8 +2653,10 @@ public void sendClinpathPanicEmail(String id, String objectid, Integer vetname) } - final TableInfo ti = getTableInfo("onpc_ehr", "ChemistryNotification"); - SimpleFilter filter = new SimpleFilter(FieldKey.fromString("vet"), vetname, CompareType.EQUAL); + final TableInfo ti = getTableInfo("onprc_ehr", "ChemistryPanicNotification"); + SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Id"), id, CompareType.EQUAL); + filter.addCondition(FieldKey.fromString("objectid"), "objectid"); + List names= new ArrayList<>(); FieldKey clinpathFieldKey = FieldKey.fromString("objectid"); @@ -2663,6 +2666,7 @@ public void sendClinpathPanicEmail(String id, String objectid, Integer vetname) names.add(FieldKey.fromString("testid")); names.add(FieldKey.fromString("date")); names.add(FieldKey.fromString("Id")); + names.add(FieldKey.fromString("vet")); final Map colKeys = QueryService.get().getColumns(ti, names); @@ -2691,7 +2695,7 @@ public void exec(ResultSet rs) throws SQLException { TableInfo ti2 = getTableInfo("onprc_ehr", "Labwork_Requestor_Vets"); - SimpleFilter filter2 = new SimpleFilter(FieldKey.fromString("userid"), rs.getString("vetname")); + SimpleFilter filter2 = new SimpleFilter(FieldKey.fromString("userid"), rs.getString("vet")); filter2.addCondition(FieldKey.fromString("DisableDate"), true, CompareType.ISBLANK); TableSelector ts2 = new TableSelector(ti2, PageFlowUtil.set("LastName", "FirstName") , filter2, null); @@ -2705,7 +2709,7 @@ public void exec(ResultSet rs) throws SQLException "" + PageFlowUtil.filter(rs.getString("servicerequested")) + " " + PageFlowUtil.filter(rs.getString("testid")) + " " + PageFlowUtil.filter(rs.getString("qualResult")) + - "" + PageFlowUtil.filter(rs.getString("Vetname")) + "\n"); + "" + PageFlowUtil.filter(rs.getString("LastName")) + "\n"); break; } From 1e8ffabd5e609ef51f85cfc989f5530987b82683 Mon Sep 17 00:00:00 2001 From: ohsudev Date: Wed, 19 Nov 2025 15:05:37 -0800 Subject: [PATCH 14/21] Created a email notification for Chemistry entries that shows a "qualresutl" values that contain string called"panic"/ --- onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js index e17860c6e..54131fc1e 100644 --- a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js +++ b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js @@ -1378,8 +1378,8 @@ exports.init = function(EHR){ // Added: 10-6-2025 EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_UPSERT, 'study', 'chemistryResults', function (helper, scriptErrors, row, oldRow) { - // ['panic','Panic'].indexOf(row.qualresult) !== -1 - if (row.Id && row.qualresult.toLowerCase().indexOf('panic') !== -1) { + + if (row.Id && row.qualresult && row.qualresult.indexOf('panic') !== -1) { console.log("panic values: " + row.qualresult); triggerHelper.sendClinpathPanicEmail(row.Id, row.objectid); } From f398bc4c9ce8b2af0e11a9570268cd9fd28884c0 Mon Sep 17 00:00:00 2001 From: ohsudev Date: Thu, 20 Nov 2025 00:14:00 -0800 Subject: [PATCH 15/21] Created a email notification for Chemistry entries that shows a "qualresutl" values that contain string called"panic"/ --- .../org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 41866a1c7..741a592e0 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2604,7 +2604,6 @@ public void updateArrivalrecords(String id, Date date) throws Exception keys.add(FieldKey.fromString("lsid")); final Map colMap = QueryService.get().getColumns(ti, keys); - final List> toUpdate = new ArrayList<>(); final List> oldKeys = new ArrayList<>(); TableSelector ts = new TableSelector(ti, colMap.values(), new SimpleFilter(FieldKey.fromString("Id"), id, CompareType.IN), null); @@ -2651,11 +2650,11 @@ public void sendClinpathPanicEmail(String id, String objectid) _log.warn("No recipients, unable to send EHR trigger script email"); return; } - + _log.info("Success Panic value 1"); final TableInfo ti = getTableInfo("onprc_ehr", "ChemistryPanicNotification"); SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Id"), id, CompareType.EQUAL); - filter.addCondition(FieldKey.fromString("objectid"), "objectid"); + filter.addCondition(FieldKey.fromString("objectid"), objectid, CompareType.EQUAL); List names= new ArrayList<>(); @@ -2684,6 +2683,7 @@ public void sendClinpathPanicEmail(String id, String objectid) else { //Create header information on the report + _log.info("Success Panic value 2"); html.append(""); html.append("\n"); From 59294f3114fd1ccfb5d6e554d5b37a10ab91e47d Mon Sep 17 00:00:00 2001 From: ohsudev Date: Thu, 20 Nov 2025 01:11:33 -0800 Subject: [PATCH 16/21] Created a email notification for Chemistry entries that shows a "qualresutl" values that contain string called"panic"/ --- .../onprc_ehr/query/ONPRC_EHRTriggerHelper.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 741a592e0..3006d8629 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2638,8 +2638,7 @@ public void exec(ResultSet object) throws SQLException public void sendClinpathPanicEmail(String id, String objectid) { - String subject = "Chemistry Result" + - "s with Panic values"; + String subject = "Chemistry Results with Panic values"; Integer testname = 1007; //Raymond Vamdy 1014 @@ -2654,7 +2653,7 @@ public void sendClinpathPanicEmail(String id, String objectid) final TableInfo ti = getTableInfo("onprc_ehr", "ChemistryPanicNotification"); SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Id"), id, CompareType.EQUAL); - filter.addCondition(FieldKey.fromString("objectid"), objectid, CompareType.EQUAL); +// filter.addCondition(FieldKey.fromString("objectid"), objectid, CompareType.EQUAL); List names= new ArrayList<>(); @@ -2667,6 +2666,7 @@ public void sendClinpathPanicEmail(String id, String objectid) names.add(FieldKey.fromString("Id")); names.add(FieldKey.fromString("vet")); + _log.info("Success Panic value 2"); final Map colKeys = QueryService.get().getColumns(ti, names); final ColumnInfo clinpathColumn = colKeys.get(clinpathFieldKey); @@ -2683,7 +2683,7 @@ public void sendClinpathPanicEmail(String id, String objectid) else { //Create header information on the report - _log.info("Success Panic value 2"); + _log.info("Success Panic value 3"); html.append("
Animal IDDateService Requested Panel Test Name Qual Results Vet/PI Name
"); html.append("\n"); @@ -2698,7 +2698,7 @@ public void exec(ResultSet rs) throws SQLException SimpleFilter filter2 = new SimpleFilter(FieldKey.fromString("userid"), rs.getString("vet")); filter2.addCondition(FieldKey.fromString("DisableDate"), true, CompareType.ISBLANK); - TableSelector ts2 = new TableSelector(ti2, PageFlowUtil.set("LastName", "FirstName") , filter2, null); + TableSelector ts2 = new TableSelector(ti2, PageFlowUtil.set("LastName") , filter2, null); List ret2 = ts2.getArrayList(String.class); if (!ret2.isEmpty()) { @@ -2709,7 +2709,7 @@ public void exec(ResultSet rs) throws SQLException "\n"); + "\n"); break; } From 1c6f7cf1e1606ed068d407abd705ae9f0cd98d6d Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Thu, 20 Nov 2025 14:14:33 -0800 Subject: [PATCH 17/21] Created a email notification for Chemistry entries that shows a "qualresutl" values that contain string called"panic"/ --- .../query/ONPRC_EHRTriggerHelper.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 3006d8629..37d521d5e 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2642,14 +2642,6 @@ public void sendClinpathPanicEmail(String id, String objectid) Integer testname = 1007; //Raymond Vamdy 1014 - Set recipients = getRecipients(testname); -// Set recipients = getRecipients(vetname); - if (recipients.isEmpty()) - { - _log.warn("No recipients, unable to send EHR trigger script email"); - return; - } - _log.info("Success Panic value 1"); final TableInfo ti = getTableInfo("onprc_ehr", "ChemistryPanicNotification"); SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Id"), id, CompareType.EQUAL); @@ -2698,6 +2690,8 @@ public void exec(ResultSet rs) throws SQLException SimpleFilter filter2 = new SimpleFilter(FieldKey.fromString("userid"), rs.getString("vet")); filter2.addCondition(FieldKey.fromString("DisableDate"), true, CompareType.ISBLANK); + Integer testname = Integer.valueOf(rs.getString("vet")); + TableSelector ts2 = new TableSelector(ti2, PageFlowUtil.set("LastName") , filter2, null); List ret2 = ts2.getArrayList(String.class); if (!ret2.isEmpty()) @@ -2721,6 +2715,14 @@ public void exec(ResultSet rs) throws SQLException ); } + Set recipients = getRecipients(testname); +// Set recipients = getRecipients(vetname); + if (recipients.isEmpty()) + { + _log.warn("No recipients, unable to send EHR trigger script email"); + return; + } + _log.info("Success Panic value 1"); html.append("
Animal IDDateService Requested Panel Test Name Qual Results Vet/PI Name
" + PageFlowUtil.filter(rs.getString("servicerequested")) + " " + PageFlowUtil.filter(rs.getString("testid")) + " " + PageFlowUtil.filter(rs.getString("qualResult")) + - "" + PageFlowUtil.filter(rs.getString("LastName")) + "
" + PageFlowUtil.filter(Vetname) + "
\n"); From 9c836877a501da8c48692bebc4520a0dc6f2bc0e Mon Sep 17 00:00:00 2001 From: ohsudev Date: Thu, 4 Dec 2025 19:11:21 -0800 Subject: [PATCH 18/21] Created Clinpath email notification --- .../scripts/onprc_ehr/onprc_triggers.js | 2 +- .../query/ONPRC_EHRTriggerHelper.java | 125 +++++++++++------- 2 files changed, 76 insertions(+), 51 deletions(-) diff --git a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js index 54131fc1e..d72da9f36 100644 --- a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js +++ b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js @@ -1381,7 +1381,7 @@ exports.init = function(EHR){ if (row.Id && row.qualresult && row.qualresult.indexOf('panic') !== -1) { console.log("panic values: " + row.qualresult); - triggerHelper.sendClinpathPanicEmail(row.Id, row.objectid); + triggerHelper.sendClinpathPanicEmail(row.Id, row.runid); } }); diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 37d521d5e..63a1e49d0 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2636,12 +2636,10 @@ public void exec(ResultSet object) throws SQLException } } - public void sendClinpathPanicEmail(String id, String objectid) + public void sendClinpathPanicEmail(String id, String runid) { String subject = "Chemistry Results with Panic values"; - Integer testname = 1007; //Raymond Vamdy 1014 - final TableInfo ti = getTableInfo("onprc_ehr", "ChemistryPanicNotification"); SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Id"), id, CompareType.EQUAL); @@ -2658,7 +2656,6 @@ public void sendClinpathPanicEmail(String id, String objectid) names.add(FieldKey.fromString("Id")); names.add(FieldKey.fromString("vet")); - _log.info("Success Panic value 2"); final Map colKeys = QueryService.get().getColumns(ti, names); final ColumnInfo clinpathColumn = colKeys.get(clinpathFieldKey); @@ -2666,6 +2663,7 @@ public void sendClinpathPanicEmail(String id, String objectid) final StringBuilder html = new StringBuilder(); + if (ts.getRowCount() == 0) { html.append("There are no Chemistry Panlc Values to display"); @@ -2674,8 +2672,6 @@ public void sendClinpathPanicEmail(String id, String objectid) } else { - //Create header information on the report - _log.info("Success Panic value 3"); html.append(""); html.append("\n"); @@ -2690,24 +2686,24 @@ public void exec(ResultSet rs) throws SQLException SimpleFilter filter2 = new SimpleFilter(FieldKey.fromString("userid"), rs.getString("vet")); filter2.addCondition(FieldKey.fromString("DisableDate"), true, CompareType.ISBLANK); - Integer testname = Integer.valueOf(rs.getString("vet")); - TableSelector ts2 = new TableSelector(ti2, PageFlowUtil.set("LastName") , filter2, null); + TableSelector ts2 = new TableSelector(ti2, PageFlowUtil.set("LastName"), filter2, null); List ret2 = ts2.getArrayList(String.class); if (!ret2.isEmpty()) { for (String Vetname : ret2) { - html.append("\n"); + html.append("\n"); break; } } + } } @@ -2715,49 +2711,78 @@ public void exec(ResultSet rs) throws SQLException ); } - Set recipients = getRecipients(testname); -// Set recipients = getRecipients(vetname); - if (recipients.isEmpty()) - { - _log.warn("No recipients, unable to send EHR trigger script email"); - return; - } - _log.info("Success Panic value 1"); +//testname = Integer.valueOf(rs.getString("vet")); - html.append("
Animal IDDateService Requested Panel Test Name Qual Results Vet/PI Name
" + PageFlowUtil.filter(rs.getString("Id")) + - "" + PageFlowUtil.filter(rs.getString("date")) + - "" + PageFlowUtil.filter(rs.getString("servicerequested")) + - " " + PageFlowUtil.filter(rs.getString("testid")) + - " " + PageFlowUtil.filter(rs.getString("qualResult")) + - "" + PageFlowUtil.filter(Vetname) + "
" + PageFlowUtil.filter(rs.getString("Id")) + + "" + PageFlowUtil.filter(rs.getString("date")) + + "" + PageFlowUtil.filter(rs.getString("servicerequested")) + + " " + PageFlowUtil.filter(rs.getString("testid")) + + " " + PageFlowUtil.filter(rs.getString("qualResult")) + + "" + PageFlowUtil.filter(Vetname) + "
\n"); - - sendMessage(subject, html.toString(), recipients); + final TableInfo tt = getTableInfo("study", "clinpathRuns"); + SimpleFilter filtert = new SimpleFilter(FieldKey.fromString("objectid"), runid, CompareType.EQUAL); + filter.addCondition(FieldKey.fromString("id"), id, CompareType.EQUAL); - } + List vetnames= new ArrayList<>(); + FieldKey vetFieldKey = FieldKey.fromString("objectid"); + vetnames.add(vetFieldKey); + vetnames.add(FieldKey.fromString("vet")); + final Map colKeyss = QueryService.get().getColumns(tt, vetnames); + final ColumnInfo vetColumn = colKeyss.get(vetFieldKey); + TableSelector tst = new TableSelector(ti, colKeys.values(), filtert, null); - private Set getRecipients(Integer... userIds) - { - Set recipients = new HashSet<>(); - for (Integer userId : userIds) + if (tst.getRowCount() == 0) { - if (userId > 0) - { - UserPrincipal up = SecurityManager.getPrincipal(userId); - if (up != null) - { - if (up instanceof User) - { - recipients.add(up); - } - else - { - for (UserPrincipal u : SecurityManager.getAllGroupMembers((Group)up, MemberType.ACTIVE_USERS)) - { - if (u.isActive()) - recipients.add(u); - } - } - } - } + html.append("There are no Chemistry Panlc Values to display"); + + return; } + else + { - return recipients; +// tst.forEach(new Selector.ForEachBlock() + } + + { +// +// final recipients = getRecipients(testname); +// if (recipients.isEmpty()) +// { +// _log.warn("No recipients, unable to send EHR trigger script email"); +// return; +// } +// html.append("\n"); +// sendMessage(subject, html.toString(), recipients); +// +// html.append("\n"); +// +// sendMessage(subject, html.toString(), recipients); + + } + +// +// private Set getRecipients(Integer... userIds) +// { +// Set recipients = new HashSet<>(); +// for (Integer userId : userIds) +// { +// if (userId > 0) +// { +// UserPrincipal up = SecurityManager.getPrincipal(userId); +// if (up != null) +// { +// if (up instanceof User) +// { +// recipients.add(up); +// } +// else +// { +// for (UserPrincipal u : SecurityManager.getAllGroupMembers((Group)up, MemberType.ACTIVE_USERS)) +// { +// if (u.isActive()) +// recipients.add(u); +// } +// } +// } +// } +// } +// +// return recipients; } //Added 9-30-2025 From 9121e0e87152ee31323321a58636c8c621961be3 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Tue, 9 Dec 2025 22:28:19 -0800 Subject: [PATCH 19/21] Modified Clinpath panic value notifications. --- .../query/ONPRC_EHRTriggerHelper.java | 113 ++++++++---------- 1 file changed, 52 insertions(+), 61 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 63a1e49d0..5991f573b 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2717,72 +2717,63 @@ public void exec(ResultSet rs) throws SQLException SimpleFilter filtert = new SimpleFilter(FieldKey.fromString("objectid"), runid, CompareType.EQUAL); filter.addCondition(FieldKey.fromString("id"), id, CompareType.EQUAL); - List vetnames= new ArrayList<>(); - FieldKey vetFieldKey = FieldKey.fromString("objectid"); - vetnames.add(vetFieldKey); - vetnames.add(FieldKey.fromString("vet")); + TableSelector tst = new TableSelector(ti, PageFlowUtil.set("vet"), filter, null); + tst.forEach(new Selector.ForEachBlock<>() + { + @Override + public void exec(ResultSet rs) throws SQLException + { + Integer vetId = rs.getInt("vet"); + Set recipients = getRecipients(vetId); + if (recipients.isEmpty()) + { + _log.warn("No recipients, unable to send EHR trigger script email"); + return; + } + else + { + html.append("\n"); - final Map colKeyss = QueryService.get().getColumns(tt, vetnames); - final ColumnInfo vetColumn = colKeyss.get(vetFieldKey); - TableSelector tst = new TableSelector(ti, colKeys.values(), filtert, null); + sendMessage(subject, html.toString(), recipients); - if (tst.getRowCount() == 0) - { - html.append("There are no Chemistry Panlc Values to display"); + } - return; - } - else + } + + + }); + + + } + + + private Set getRecipients(Integer... userIds) + { + Set recipients = new HashSet<>(); + for (Integer userId : userIds) { + if (userId > 0) + { + UserPrincipal up = SecurityManager.getPrincipal(userId); + if (up != null) + { + if (up instanceof User) + { + recipients.add(up); + } + else + { + for (UserPrincipal u : SecurityManager.getAllGroupMembers((Group)up, MemberType.ACTIVE_USERS)) + { + if (u.isActive()) + recipients.add(u); + } + } + } + } + } -// tst.forEach(new Selector.ForEachBlock() - } - - { -// -// final recipients = getRecipients(testname); -// if (recipients.isEmpty()) -// { -// _log.warn("No recipients, unable to send EHR trigger script email"); -// return; -// } -// html.append("\n"); -// sendMessage(subject, html.toString(), recipients); -// -// html.append("\n"); -// -// sendMessage(subject, html.toString(), recipients); - - } - -// -// private Set getRecipients(Integer... userIds) -// { -// Set recipients = new HashSet<>(); -// for (Integer userId : userIds) -// { -// if (userId > 0) -// { -// UserPrincipal up = SecurityManager.getPrincipal(userId); -// if (up != null) -// { -// if (up instanceof User) -// { -// recipients.add(up); -// } -// else -// { -// for (UserPrincipal u : SecurityManager.getAllGroupMembers((Group)up, MemberType.ACTIVE_USERS)) -// { -// if (u.isActive()) -// recipients.add(u); -// } -// } -// } -// } -// } -// -// return recipients; + return recipients; } //Added 9-30-2025 From 2dd94076c1e614ca7ce25135179bef6d17fc2b18 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Tue, 9 Dec 2025 22:29:56 -0800 Subject: [PATCH 20/21] Modified Clinpath panic value notifications. --- .../src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 5991f573b..270d1bace 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2711,7 +2711,7 @@ public void exec(ResultSet rs) throws SQLException ); } -//testname = Integer.valueOf(rs.getString("vet")); + final TableInfo tt = getTableInfo("study", "clinpathRuns"); SimpleFilter filtert = new SimpleFilter(FieldKey.fromString("objectid"), runid, CompareType.EQUAL); From db4fdb3dbb93477c0e83fd8eee02ffd0d1aeab8f Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Mon, 22 Dec 2025 21:43:51 -0800 Subject: [PATCH 21/21] Modified Clinpath panic value notification to include task ids. --- .../queries/onprc_ehr/ChemistryPanicNotification.sql | 2 +- .../org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql index bae6066e7..588fd71ae 100644 --- a/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql +++ b/onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql @@ -6,7 +6,7 @@ select a.Id, a.vet, a.created, a.objectid, - a.taskid, + (select j.rowid from ehr.tasks j where j.taskid = a.taskid) as taskid from study.ClinpathRuns a, study.chemistryResults b diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java index 270d1bace..babf66144 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java @@ -2643,7 +2643,7 @@ public void sendClinpathPanicEmail(String id, String runid) final TableInfo ti = getTableInfo("onprc_ehr", "ChemistryPanicNotification"); SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Id"), id, CompareType.EQUAL); -// filter.addCondition(FieldKey.fromString("objectid"), objectid, CompareType.EQUAL); + filter.addCondition(FieldKey.fromString("objectid"), runid, CompareType.EQUAL); List names= new ArrayList<>(); @@ -2655,6 +2655,7 @@ public void sendClinpathPanicEmail(String id, String runid) names.add(FieldKey.fromString("date")); names.add(FieldKey.fromString("Id")); names.add(FieldKey.fromString("vet")); + names.add(FieldKey.fromString("taskid")); final Map colKeys = QueryService.get().getColumns(ti, names); @@ -2674,7 +2675,7 @@ public void sendClinpathPanicEmail(String id, String runid) { html.append(""); - html.append("\n"); + html.append("\n"); ts.forEach(new Selector.ForEachBlock() { @@ -2698,6 +2699,7 @@ public void exec(ResultSet rs) throws SQLException "\n"); break;
Animal IDDateService Requested Panel Test Name Qual Results Vet/PI Name
Animal IDDateService Requested Panel Test Name Qual ResultsTask ID Vet/PI Name
" + PageFlowUtil.filter(rs.getString("servicerequested")) + " " + PageFlowUtil.filter(rs.getString("testid")) + " " + PageFlowUtil.filter(rs.getString("qualResult")) + + " " + PageFlowUtil.filter(rs.getString("taskid")) + "" + PageFlowUtil.filter(Vetname) + "