diff --git a/GeneticsCore/resources/schemas/dbscripts/postgresql/geneticscore-17.10-17.11.sql b/GeneticsCore/resources/schemas/dbscripts/postgresql/geneticscore-17.10-17.11.sql
new file mode 100644
index 000000000..f3a6a3455
--- /dev/null
+++ b/GeneticsCore/resources/schemas/dbscripts/postgresql/geneticscore-17.10-17.11.sql
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2011 LabKey Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+CREATE TABLE geneticscore.taqman_probes (
+ rowid serial,
+ probe varchar(100),
+ target varchar(1000),
+
+ container ENTITYID,
+ created TIMESTAMP,
+ createdby USERID,
+ modified TIMESTAMP,
+ modifiedby USERID,
+
+ CONSTRAINT PK_taqman_probes PRIMARY KEY (rowid)
+);
+
+CREATE TABLE geneticscore.test_significance (
+ rowid serial,
+ probe varchar(100),
+ genotype varchar(100),
+ label varchar(1000),
+ comment varchar(4000),
+
+ container ENTITYID,
+ created TIMESTAMP,
+ createdby USERID,
+ modified TIMESTAMP,
+ modifiedby USERID,
+
+ CONSTRAINT PK_test_significance PRIMARY KEY (rowid)
+);
\ No newline at end of file
diff --git a/GeneticsCore/resources/schemas/dbscripts/sqlserver/geneticscore-17.10-17.11.sql b/GeneticsCore/resources/schemas/dbscripts/sqlserver/geneticscore-17.10-17.11.sql
new file mode 100644
index 000000000..1dd7283be
--- /dev/null
+++ b/GeneticsCore/resources/schemas/dbscripts/sqlserver/geneticscore-17.10-17.11.sql
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2011 LabKey Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+CREATE TABLE geneticscore.taqman_probes (
+ rowid int identity(1,1),
+ probe varchar(100),
+ target varchar(1000),
+
+ container ENTITYID,
+ created DATETIME,
+ createdby USERID,
+ modified DATETIME,
+ modifiedby USERID,
+
+ CONSTRAINT PK_taqman_probes PRIMARY KEY (rowid)
+);
+
+CREATE TABLE geneticscore.test_significance (
+ rowid int identity(1,1),
+ probe varchar(100),
+ genotype varchar(100),
+ label varchar(1000),
+ comment varchar(4000),
+
+ container ENTITYID,
+ created DATETIME,
+ createdby USERID,
+ modified DATETIME,
+ modifiedby USERID,
+
+ CONSTRAINT PK_test_significance PRIMARY KEY (rowid)
+);
\ No newline at end of file
diff --git a/GeneticsCore/resources/schemas/geneticscore.xml b/GeneticsCore/resources/schemas/geneticscore.xml
index a5a4c1309..1de9bde1c 100644
--- a/GeneticsCore/resources/schemas/geneticscore.xml
+++ b/GeneticsCore/resources/schemas/geneticscore.xml
@@ -58,6 +58,74 @@
Click here to view these animals
"); + msg.append("Click here to view them"); + msg.append("
"); msg.append("There are " + total + " active behavior cases (this does not include cases closed for review). "); - String url = getExecuteQueryUrl(c, "study", "cases", "Open Behavior Cases") + "&query.isActive~eq=true"; + String url = getExecuteQueryUrl(c, "study", "mostRecentObservationsBehavior", "Open Behavior Case") + "&query.isActive~eq=true"; msg.append("Click here to view them"); msg.append("
| Id | Status | Gender | Species | Geographic Origin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Id | Status | Birth Date | Remarks | Gender | Species | Geographic Origin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " + rs.getString("Id") + " | "); msg.append("" + (rs.getString(FieldKey.fromString("Id/demographics/calculated_status")) == null ? "Unknown" : rs.getString(FieldKey.fromString("Id/demographics/calculated_status"))) + " | "); + + //Added: 2-20-2020 R.Blasa + msg.append("" + (rs.getString("date") == null ? "Unknown" : rs.getDate("date")) + " | "); + msg.append("" + (rs.getString("remark") == null ? " " : rs.getString("remark")) + " | "); + msg.append("" + (rs.getString(FieldKey.fromString("Id/demographics/gender/meaning")) == null ? "MISSING" : rs.getString(FieldKey.fromString("Id/demographics/gender/meaning"))) + " | "); msg.append("" + (rs.getString(FieldKey.fromString("Id/demographics/species")) == null ? "MISSING" : rs.getString(FieldKey.fromString("Id/demographics/species"))) + " | "); msg.append("" + (rs.getString(FieldKey.fromString("Id/demographics/geographic_origin")) == null ? "MISSING" : rs.getString(FieldKey.fromString("Id/demographics/geographic_origin"))) + " | "); @@ -960,6 +988,198 @@ protected void protocolsExpiringSoon(final Container c, User u, final StringBuil } } + /** + * Kollil : Find the pregnant NHPs whose gestation time is past 30 days + */ + protected void checkPregnantGestation(final Container c, User u, final StringBuilder msg) + { + SimpleFilter filter = new SimpleFilter(FieldKey.fromString("thirty_days_pastGestation_date"), new Date(), CompareType.DATE_LTE); + TableSelector ts = new TableSelector(getStudySchema(c, u).getTable("pregnancyGestationOverdue"), filter, null); + long count = ts.getRowCount(); + if (count > 0) + { + msg.append("WARNING: There are " + count + " pregnant animals 30 days past the gestation period.
| Resource Id | Start Date | End Date | Name | Alias | Quantity | Comments | Color | Room | Bldg |
| " + rs.getString("resourceid") + " | "); + msg.append("" + rs.getString("startdate") + " | "); + msg.append("" + rs.getString("enddate") + " | "); + msg.append("" + rs.getString("name") + " | "); + msg.append("" + rs.getString("alias") + " | "); + msg.append("" + rs.getString("quantity") + " | "); + msg.append("" + rs.getString("comments") + " | "); + msg.append("" + rs.getString("color") + " | "); + msg.append("" + rs.getString("room") + " | "); + msg.append("" + rs.getString("bldg") + " | "); + msg.append("
| Resource Id | Start Date | End Date | Name | Alias | Quantity | Comments | Color | Room | Bldg |
| " + rs1.getString("resourceid") + " | "); + msg.append("" + rs1.getString("startdate") + " | "); + msg.append("" + rs1.getString("enddate") + " | "); + msg.append("" + rs1.getString("name") + " | "); + msg.append("" + rs1.getString("alias") + " | "); + msg.append("" + rs1.getString("quantity") + " | "); + msg.append("" + rs1.getString("comments") + " | "); + msg.append("" + rs1.getString("color") + " | "); + msg.append("" + rs1.getString("room") + " | "); + msg.append("" + rs1.getString("bldg") + " | "); + msg.append("
Click here to view them
\n\n");
+ msg.append("
Click here to view them
\n\n");
+ msg.append("
| Monkey ID | Date | Project Name | Dam |
| " + PageFlowUtil.filter(Ids) + " | " + PageFlowUtil.filter(getDateTimeFormat(c).format(datess)) + " | " + PageFlowUtil.filter(projectname) + " | " + PageFlowUtil.filter(dams) + " |
| Monkey ID | Start Date | Removal Date | Category | Meaning | |||||||||||||||||||
| Monkey ID | Room | Cage | Current Weight (kg) | Start Date | Removal Date | Assigned Vet | |||||||||||||||||
| " + Ids + " | " + DateUtil.formatDateTime(c, datess) + " | " + DateUtil.formatDateTime(c, enddates) + " | " + categorys + " | " + valuess + " | " + PageFlowUtil.filter(Ids) + " | " + + "" + PageFlowUtil.filter(rooms) + " | " + PageFlowUtil.filter(cages) + " | " + + "" + PageFlowUtil.filter(" ") + PageFlowUtil.filter(weights) + " | " + + PageFlowUtil.filter(DateUtil.formatDateTime(c, datess)) + " | " + PageFlowUtil.filter(DateUtil.formatDateTime(c, enddates)) + " | " + " " + PageFlowUtil.filter(vetname) + " | \n"); + } }); diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/PregnantNHPsGestationAlert.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/PregnantNHPsGestationAlert.java new file mode 100644 index 000000000..19d4e14b6 --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/PregnantNHPsGestationAlert.java @@ -0,0 +1,62 @@ +package org.labkey.onprc_ehr.notification; + +import org.labkey.api.data.Container; +import org.labkey.api.module.Module; +import org.labkey.api.security.User; + +import java.util.Date; + +/** + * Created by kollil + */ +public class PregnantNHPsGestationAlert extends ColonyAlertsNotification +{ + public PregnantNHPsGestationAlert(Module owner) + { + super(owner); + } + + @Override + public String getName() + { + return "Pregnant NHPs Gestation Notification"; + } + + @Override + public String getEmailSubject(Container c) + { + return "Pregnant Animal Alerts: " + getDateTimeFormat(c).format(new Date()); + } + + @Override + public String getCronString() + { + return "0 0 5 * * ?"; + } + + @Override + public String getScheduleDescription() + { + return "every day at 5:00AM"; + } + + @Override + public String getDescription() + { + return "The report is designed to provide a daily summary of pregnant NHPs past 30 days of gestation for the colony!"; + } + + @Override + public String getMessageBodyHTML(Container c, User u) + { + StringBuilder msg = new StringBuilder(); + + checkPregnantGestation(c, u, msg); + + return msg.toString(); + } +} + + + + diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ProjectAlertsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ProjectAlertsNotification.java new file mode 100644 index 000000000..cf8b22a54 --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ProjectAlertsNotification.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2015-2017 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.labkey.onprc_ehr.notification; + +import org.jetbrains.annotations.Nullable; +import org.labkey.api.data.Container; +import org.labkey.api.ehr.notification.AbstractEHRNotification; +import org.labkey.api.module.Module; +import org.labkey.api.security.User; +import org.labkey.api.util.DateUtil; + +import java.util.Date; + +//Added 3-6-2019 R.Blasa + +public class ProjectAlertsNotification extends AbstractEHRNotification +{ + public ProjectAlertsNotification(Module owner) + { + super(owner); + } + + @Override + public String getName() + { + return "Center Project Notification"; + } + + @Override + public String getEmailSubject(Container c) + { + return "Project Alerts Notification: " + DateUtil.formatDateTime(c); + } + + @Override + public String getCronString() + { + return null; + } + + @Override + public String getScheduleDescription() + { + return "Sent immediately when a Center Project record is created"; + } + + @Override + public String getDescription() + { + return "The report sends an alert whenever a new Center Project record is created."; + } + + @Override + @Nullable + public String getMessageBodyHTML(Container c, User u) + { + //this is used as a placeholder so we can use it to track the list of subscribed users + return null ; + } +} diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/RoutineClinicalTestsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/RoutineClinicalTestsNotification.java index cf9741337..db046437b 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/RoutineClinicalTestsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/RoutineClinicalTestsNotification.java @@ -260,7 +260,7 @@ protected void getAnimalsNotWeightedInPast60Days(StringBuilder msg, Container c, msg.append("Weights:
| Id | Status | Treatment Status | Room | Cage | Treatment Date | Treatment Start Date | Treatment End Date | Days Elapsed | Category | Treatment | Volume | Volume Units | Drug Conc | Conc Units | Amount | Amount And Volume | Dosage | Dosage Units | Frequency | Route | Reason | Remark | Ordered By |
| " + PageFlowUtil.filter(rs.getString("id")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("calculated_status")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("TreatmentStatus")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("room")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("cage")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("date")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("startDate")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("endDate")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("dayselapsed")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("category")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("medication")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("volume")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("vol_units")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("concentration")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("conc_units")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("amountWithUnits")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("amountAndVolume")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("dosage")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("dosage_units")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("frequency")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("route")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("reason")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("remark"))+ " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("performedby")) + " | "); + msg.append("
\n");
+ msg.append("
All treatments scheduled prior to " + _timeFormat.format(maxDate) + " have been marked complete as of " + getDateTimeFormat(c).format(curDate) + ".
\n"); } else { - msg.append("There are " + totals.get(incomplete) + " treatments that have not been marked complete:
\n");
+ msg.append("
There are " + totals.get(incomplete) + " treatments that have not been marked complete:
\n"); msg.append("
| Id | Status | Treatment Status | Room | Cage | Treatment Date | Treatment Start Date | Treatment End Date | Days Elapsed | Category | Treatment | Volume | Volume Units | Drug Conc | Conc Units | Amount | Amount And Volume | Dosage | Dosage Units | Frequency | Route | Reason | Remark | Ordered By |
| " + PageFlowUtil.filter(rs.getString("id")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("calculated_status")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("TreatmentStatus")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("room")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("cage")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("date")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("startDate")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("endDate")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("dayselapsed")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("category")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("medication")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("volume")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("vol_units")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("concentration")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("conc_units")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("amountWithUnits")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("amountAndVolume")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("dosage")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("dosage_units")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("frequency")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("route")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("reason")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("remark")) + " | "); + msg.append("" + PageFlowUtil.filter(rs.getString("performedby")) + " | "); + msg.append("
\n"); diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/TreatmentAlertsPostOpsNotificationThird.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/TreatmentAlertsPostOpsNotificationThird.java new file mode 100644 index 000000000..3df709f6e --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/TreatmentAlertsPostOpsNotificationThird.java @@ -0,0 +1,288 @@ +/* + * Copyright (c) 2015-2016 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.labkey.onprc_ehr.notification; + +import org.apache.commons.lang3.time.DateUtils; +import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.CompareType; +import org.labkey.api.data.Container; +import org.labkey.api.data.Results; +import org.labkey.api.data.ResultsImpl; +import org.labkey.api.data.Selector; +import org.labkey.api.data.SimpleFilter; +import org.labkey.api.data.Sort; +import org.labkey.api.data.TableInfo; +import org.labkey.api.data.TableSelector; +import org.labkey.api.ehr.notification.AbstractEHRNotification; +import org.labkey.api.module.Module; +import org.labkey.api.query.FieldKey; +import org.labkey.api.query.QueryService; +import org.labkey.api.security.User; +import org.labkey.api.util.PageFlowUtil; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + +//Added 6-4-2019 Blasa Post Op Meds 5Pm Schedule Only +public class TreatmentAlertsPostOpsNotificationThird extends AbstractEHRNotification +{ + public TreatmentAlertsPostOpsNotificationThird(Module owner) + { + super(owner); + } + + public String getName() + { + return "Treatment PostOpsMed Third Alert"; + } + + public String getDescription() + { + return "This runs every evening at 5:00PM if there are treatments scheduled that have not yet been marked complete"; + } + + public String getEmailSubject(Container c) + { + return "Daily Treatment PostOpsMed Alerts: " + getDateTimeFormat(c).format(new Date()); + } + + @Override //Modified 7/29/2015 Blasa + public String getCronString() { return "0 0 17 * * ?";} + + public String getScheduleDescription() + { + return "Evenings at 5:00 PM"; + } + + @Override + public String getMessageBodyHTML(Container c, User u) + { + StringBuilder msg = new StringBuilder(); + + //Find today's date + Date now = new Date(); + msg.append("This email contains any treatments not marked as completed. It was run on: " + getDateFormat(c).format(now) + " at " + _timeFormat.format(now) + ".
");
+
+
+ processPostOpsTreatments(c, u, msg, new Date());
+
+ return msg.toString();
+ }
+
+
+
+ // Added 7-21-2015 Blasa Address Notifications for only Post Ops Meds
+ private void processPostOpsTreatments(Container c, User u, final StringBuilder msg, final Date maxDate)
+ {
+ Date curDate = new Date();
+ Date roundedMax = new Date();
+ roundedMax.setTime(maxDate.getTime());
+ roundedMax = DateUtils.truncate(roundedMax, Calendar.DATE);
+
+ TableInfo ti = QueryService.get().getUserSchema(u, c, "study").getTable("treatmentSchedulePostOps");
+
+ SimpleFilter filter = new SimpleFilter(FieldKey.fromString("date"), roundedMax, CompareType.DATE_EQUAL);
+ filter.addCondition(FieldKey.fromString("date"), maxDate, CompareType.LTE);
+ filter.addCondition(FieldKey.fromString("Id/DataSet/Demographics/calculated_status"), "Alive");
+
+
+ Set ");
+ msg.append("There are " + (totals.get(completed) + totals.get(incomplete)) + " scheduled treatments on or before " + _timeFormat.format(maxDate) + ". Click here to view them. Of these, " + totals.get(completed) + " have been marked completed. \n");
+ }
+ else
+ {
+ msg.append("There are " + totals.get(incomplete) + " treatments that have not been marked complete: \n");
+ msg.append(" \n");
+ }
+ msg.append("
\n");
+ }
+ else
+ {
+ final String completed = "completed";
+ final String incomplete = "incomplete";
+ final Map
Post Op Meds:
\n");
+ msg.append("");
+ msg.append("
");
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ if (totals.get(incomplete) == 0)
+ {
+ msg.append("All treatments scheduled prior to " + _timeFormat.format(maxDate) + " have been marked complete as of " + getDateTimeFormat(c).format(curDate) + ". ");
+
+ ts1.forEach(new Selector.ForEachBlockId Status Treatment Status Room Cage Treatment Date Treatment Start Date Treatment End Date Days Elapsed Category Treatment Volume Volume Units Drug Conc Conc Units Amount Amount And Volume Dosage Dosage Units Frequency Route Reason Remark Ordered By ");
+ }
+ else {
+ //If not "completed", highlight the record with yellow color
+ msg.append(" ");
+ }
+
+ msg.append(" ");
+ }
+ });
+
+ msg.append("" + PageFlowUtil.filter(rs.getString("id")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("calculated_status")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("TreatmentStatus")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("room")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("cage"))+ " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("date")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("startDate")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("endDate")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("dayselapsed")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("category"))+ " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("medication")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("volume")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("vol_units")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("concentration")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("conc_units")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("amountWithUnits")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("amountAndVolume")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("dosage")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("dosage_units")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("frequency")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("route")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("reason")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("remark")) + " ");
+ msg.append("" + PageFlowUtil.filter(rs.getString("performedby")) + " ");
+ msg.append("");
+
+ for (String area : totalByArea.keySet())
+ {
+ msg.append("
\n");
+ }
+
+ msg.append("" + area + ": " + totalByArea.get(area) + "
\n");
+ }
+ }
+}
\ No newline at end of file
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/UnoccupiedRoomsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/UnoccupiedRoomsNotification.java
index 3e41bf290..7648d9e57 100644
--- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/UnoccupiedRoomsNotification.java
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/UnoccupiedRoomsNotification.java
@@ -15,6 +15,7 @@
*/
package org.labkey.onprc_ehr.notification;
+import org.apache.commons.lang3.StringUtils;
import org.labkey.api.data.AbstractTableInfo;
import org.labkey.api.data.CompareType;
import org.labkey.api.data.Container;
@@ -23,15 +24,28 @@
import org.labkey.api.data.Sort;
import org.labkey.api.data.TableInfo;
import org.labkey.api.data.TableSelector;
+import org.labkey.api.ehr.EHRService;
import org.labkey.api.ldk.LDKService;
import org.labkey.api.module.Module;
import org.labkey.api.query.FieldKey;
+import org.labkey.api.query.QueryService;
+import org.labkey.api.query.UserSchema;
import org.labkey.api.security.User;
+import org.labkey.api.settings.AppProps;
import org.labkey.api.util.PageFlowUtil;
+import org.labkey.api.data.ColumnInfo;
+import org.labkey.api.data.Results;
+import org.labkey.api.data.ResultsImpl;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashSet;
import java.util.Date;
+import java.util.Map;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
/**
* User: bimber
@@ -82,31 +96,38 @@ public String getMessageBodyHTML(Container c, User u)
unoccupiedNHPRooms(c, u, msg);
-
+ unoccupiedSLARooms(c, u, msg);
return msg.toString();
}
+
private void unoccupiedNHPRooms(Container c, User u, final StringBuilder msg)
{
TableInfo ti = getEHRLookupsSchema(c, u).getTable("rooms", null , true, true);
assert ti instanceof AbstractTableInfo;
- LDKService.get().applyNaturalSort((AbstractTableInfo)ti, "room");
+ LDKService.get().applyNaturalSort((AbstractTableInfo) ti, "room");
+
+ //NHP Locations
SimpleFilter filter = new SimpleFilter(FieldKey.fromString("utilization/TotalAnimals"), 0);
+
+ //NHP Location filters
filter.addCondition(FieldKey.fromString("housingType/value"), "Rodent Location", CompareType.NEQ_OR_NULL);
filter.addCondition(FieldKey.fromString("housingType/value"), "Off Campus", CompareType.NEQ_OR_NULL);
filter.addCondition(FieldKey.fromString("datedisabled"), null, CompareType.ISBLANK);
filter.addCondition(FieldKey.fromString("building"), null, CompareType.NONBLANK);
Sort sort = new Sort("building,room");
+ //NHP unoccupied locations
TableSelector ts = new TableSelector(ti, PageFlowUtil.set("room", "building", "room_sortValue"), filter, sort);
if (ts.getRowCount() == 0)
{
- msg.append("There are no empty rooms");
+ msg.append("There are no empty NHP rooms");
}
else
{
+ msg.append("Unoccupied NHP Locations:
\n");
msg.append("");
msg.append("
");
}
}
+
+ private void unoccupiedSLARooms(Container c, User u, final StringBuilder msg)
+ {
+ /*****************************
+ //SLA Unoccupied Locations//
+ ******************************/
+ TableInfo ti = QueryService.get().getUserSchema(u, c, "study").getTable("SLAOccupiedLocations");
+
+
+ //SLA Locations
+
+ SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Cage_Count"),null, CompareType.ISBLANK);
+
+ //SLA Location filters
+ filter.addCondition(FieldKey.fromString("building"), null, CompareType.NONBLANK);
+
+
+ //SLA unoccupied locations
+ Set ");
@@ -122,4 +143,62 @@ public void exec(ResultSet rs) throws SQLException
msg.append("Building Room
Unoccupied SLA Locations:
\n");
+ msg.append("");
+ msg.append("
");
+
+
+ }
+ }
}
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 d95ff8907..3e30b8c7e 100644
--- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java
@@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+/*promoting to uat for verification*/
package org.labkey.onprc_ehr.notification;
import org.labkey.api.data.ColumnInfo;
@@ -43,7 +45,7 @@
*/
public class VetReviewNotification extends ColonyAlertsNotification
{
- public VetReviewNotification(Module owner)
+ public VetReviewNotification (Module owner)
{
super(owner);
}
@@ -83,7 +85,7 @@ public String getMessageBodyHTML(Container c, User u)
{
StringBuilder msg = new StringBuilder();
- remarksWithoutAssignedVet(c, u, msg);
+ /* remarksWithoutAssignedVet(c, u, msg);*/
vetRecordsUnderReview(c, u, msg);
animalsWithoutAssignedVet(c, u, msg);
@@ -97,22 +99,25 @@ public void vetRecordsUnderReview(Container c, User u, final StringBuilder msg)
doRemarkQuery(c, u, msg, filter, "ALERT: The following animals that have remarks entered at least " + duration + " days ago, but have not yet been reviewed.");
}
- public void remarksWithoutAssignedVet(Container c, User u, final StringBuilder msg)
- {
+ /*public void remarksWithoutAssignedVet(Container c, User u, final StringBuilder msg);
+ {
SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Id/assignedVet/assignedVet"), null, CompareType.ISBLANK);
filter.addCondition(FieldKey.fromString("totalRemarksEnteredSinceReview"), 0, CompareType.GT);
doRemarkQuery(c, u, msg, filter, "ALERT: The following animals that have remarks entered, but the animal is not currently assigned to a vet.");
- }
+ }*/
public void doRemarkQuery(Container c, User u, final StringBuilder msg, SimpleFilter filter, String header)
{
- TableInfo ti = QueryService.get().getUserSchema(u, c, "study").getTable("demographics");
+ //TableInfo ti = QueryService.get().getUserSchema(u, c, "study").getTable("demographics_AssignedVetNotification");
+// TableInfo ti = QueryService.get().getUserSchema(u, c, "study").getTable("demographics_VetAssignment_Notification");
+ //Changed by Kollil on 6/19/2019. Created a new query to get the vet assignment info
+ TableInfo ti = QueryService.get().getUserSchema(u, c, "study").getTable("demographics_Vet_Assignment_Alert");
final Map ");
+
+ ts.forEach(new Selector.ForEachBlockBuilding Room "));
+ }
+ });
+
+ msg.append("" + (rs.getString("building") == null ? PageFlowUtil.filter("") : PageFlowUtil.filter(rs.getString("building"))) + " " + PageFlowUtil.filter(rs.getString("room") + " " +
"" + rs.getString(FieldKey.fromString("Id")) + " " +
- "" + (rs.getString(FieldKey.fromString("Id/assignedVet/assignedVet")) == null ? "NONE" : rs.getString(FieldKey.fromString("Id/assignedVet/assignedVet"))) + " " +
+ "" + (rs.getString(FieldKey.fromString("assignedVet")) == null ? "NONE" : rs.getString(FieldKey.fromString("assignedVet"))) + " " +
"" + getDateFormat(c).format(rs.getDate(FieldKey.fromString("earliestRemarkSinceReview"))) + " " +
"" + (rs.getDate(FieldKey.fromString("lastVetReview")) == null ? "Never" : getDateFormat(c).format(rs.getDate(FieldKey.fromString("lastVetReview")))) + " " +
"" + rs.getString(FieldKey.fromString("calculated_status")) + " " +
@@ -152,7 +157,10 @@ protected void animalsWithoutAssignedVet(final Container c, User u, final String
{
SimpleFilter filter = new SimpleFilter(FieldKey.fromString("calculated_status"), "Alive");
filter.addCondition(FieldKey.fromString("Id/assignedVet/assignedVet"), null, CompareType.ISBLANK);
- TableSelector ts = new TableSelector(getStudySchema(c, u).getTable("demographics"), filter, null);
+ //TableSelector ts = new TableSelector(getStudySchema(c, u).getTable("demographics_AssignedVetNotification"), filter, null);
+// TableSelector ts = new TableSelector(getStudySchema(c, u).getTable("demographics_VetAssignment_Notification"), filter, null);
+ //Changed by Kollil on 6/19/2019. Created a new query to get the vet assignment info
+ TableSelector ts = new TableSelector(getStudySchema(c, u).getTable("demographics_Vet_Assignment_Alert"), filter, null);
long count = ts.getRowCount();
if (count > 0)
{
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 3e17cead0..2e2d936e4 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2018 LabKey Corporation
+ * Copyright (c) 2013-2015 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,8 @@
*/
package org.labkey.onprc_ehr.query;
-import org.apache.commons.beanutils.ConversionException;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateUtils;
import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.labkey.api.collections.CaseInsensitiveHashMap;
@@ -25,7 +25,6 @@
import org.labkey.api.data.CompareType;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerManager;
-import org.labkey.api.data.ConvertHelper;
import org.labkey.api.data.DbSchema;
import org.labkey.api.data.DbScope;
import org.labkey.api.data.Results;
@@ -39,7 +38,6 @@
import org.labkey.api.data.TableInfo;
import org.labkey.api.data.TableSelector;
import org.labkey.api.ehr.EHRDemographicsService;
-import org.labkey.api.ehr.EHRQCState;
import org.labkey.api.ehr.EHRService;
import org.labkey.api.ehr.demographics.AnimalRecord;
import org.labkey.api.exp.api.StorageProvisioner;
@@ -58,30 +56,30 @@
import org.labkey.api.security.UserPrincipal;
import org.labkey.api.settings.AppProps;
import org.labkey.api.study.DatasetTable;
-import org.labkey.api.study.StudyService;
import org.labkey.api.util.GUID;
import org.labkey.api.util.MailHelper;
import org.labkey.api.util.PageFlowUtil;
import org.labkey.api.util.Pair;
-//import org.labkey.ehr.demographics.EHRDemographicsServiceImpl;
-//import org.labkey.ehr.security.EHRSecurityManager;
import org.labkey.onprc_ehr.ONPRC_EHRManager;
import org.labkey.onprc_ehr.ONPRC_EHRModule;
import org.labkey.onprc_ehr.ONPRC_EHRSchema;
import org.labkey.onprc_ehr.notification.CullListNotification;
import org.labkey.onprc_ehr.notification.MensesTMBNotification;
+import org.labkey.onprc_ehr.notification.ProjectAlertsNotification;
import org.labkey.onprc_ehr.notification.ProtocolAlertsNotification;
import javax.mail.Address;
import javax.mail.Message;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -90,6 +88,9 @@
import java.util.Set;
import java.util.TreeMap;
+//import org.labkey.ehr.demographics.EHRDemographicsServiceImpl;
+//import org.labkey.ehr.security.EHRSecurityManager;
+
/**
* User: bimber
* Date: 11/26/13
@@ -123,6 +124,9 @@ public class ONPRC_EHRTriggerHelper
private static final String NONRESTRICTED = "Nonrestricted";
private static final String EXPERIMENTAL_EUTHANASIA = "EUTHANASIA, EXPERIMENTAL";
+ private static final String NON_EXPERIMENTAL_EUTHANASIA = "EUTHANASIA, NONEXPERIMENTAL";
+ private static final String SPONTANEOUS_DEATH = "Spontaneous Death";
+ private SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd kk:mm");
public ONPRC_EHRTriggerHelper(int userId, String containerId)
@@ -180,6 +184,84 @@ public Map
| Center Project | Project ID | Iacuc Protocol | Investigator | Center Project Start Date |
| " + (rs.getString("external_id") == null ? "" : rs.getString("external_id")) + " | " + Investname + " | " + rs.getString("approve") + " | ||
| " + (rs.getString("external_id") == null ? "" : rs.getString("external_id")) + " | " + Investname + " | " + rs.getString("approve") + " | ||
| " + PageFlowUtil.filter(rs.getString("name")) + " | " + PageFlowUtil.filter(rs.getString("project")) + " | " + PageFlowUtil.filter(rs.getString(protocolColumn.getAlias())) + " | " + PageFlowUtil.filter(Investname) + " | " + PageFlowUtil.filter(rs.getString("startdate")) + " |
' - + 'No requestor record found for your user account. Please contact an administrator to get ' - + 'this issue resolved.
'); + + 'No requestor record found for your user account. Please contact an administrator to get ' + + 'this issue resolved.'); this.disable(); } } @@ -228,8 +252,8 @@ Ext4.define('SLA.panel.PurchaseOrderRequest', { toggleSubmitButton : function() { var protocolValid = this.getProtocolForm().isValid(), - formValid = this.getPurchaseForm().isValid(), - speciesGridValid = this.getPurchaseSpeciesGrid().isValid(); + formValid = this.getPurchaseForm().isValid(), + speciesGridValid = this.getPurchaseSpeciesGrid().isValid(); this.getSubmitButton().setDisabled(this.adminContainer == null || !protocolValid || !formValid || !speciesGridValid); }, @@ -434,15 +458,17 @@ Ext4.define('SLA.panel.PurchaseOrderRequest', { } //added by Kolli - if (speciesRowData.location == 'NSI 0123D' || speciesRowData.location == 'NSI 0125D' ) + //Added the new room to the list: NSI 134 by Kolli on 4/19 + if (speciesRowData.room == 'NSI 0123D' || speciesRowData.room == 'NSI 0125D' || speciesRowData.room == 'NSI 0134') { isHazardsRequired = true; } }, this); - if (isHazardsRequired && (purchaseData.listHazard == null || purchaseData.listHazard == '')) + //if (isHazardsRequired && (purchaseData.listHazard == null || purchaseData.listHazard == '')) + if (isHazardsRequired && (purchaseData.hazardslist == null || purchaseData.hazardslist == '')) { - this.showErrorMsg('You have selected Location(s): NSI 0123D or NSI 0125D. Please list the biological or chemical agents! '); + this.showErrorMsg('You have selected Location(s): NSI 0123D or NSI 0125D or NSI 134. Please list the biological or chemical agents! '); return; } @@ -529,13 +555,13 @@ Ext4.define('SLA.panel.PurchaseOrderRequest', { Ext4.Msg.confirm('Confirmation Message', warnMsg, function (btn) { if (btn == 'yes') - //successCallback.call(scope); + //successCallback.call(scope); this.insertPurchaseOrder(purchaseData); else this.getSubmitButton().enable(); }, this); - // this.insertPurchaseOrder(purchaseData); + // this.insertPurchaseOrder(purchaseData); }, this); } }, @@ -672,15 +698,15 @@ Ext4.define('SLA.panel.PurchaseOrderRequest', { if (value.PercentUsed > 105) { errorMsg += errorSep + 'With the current order, you have exceeded 100% plus 5% more animal usage of the approved quantity. ' + baseMsg - + ' You are not authorized to purchase any more animals at this point. If you wish to purchase more animals, please contact the IACUC committee for approval!'; + + ' You are not authorized to purchase any more animals at this point. If you wish to purchase more animals, please contact the IACUC committee for approval!'; errorSep = '