From a2e796ae16dce63ed29521c34ba39976fcca1a70 Mon Sep 17 00:00:00 2001 From: Lakshmi Kolli <69940873+kollil@users.noreply.github.com> Date: Wed, 31 Mar 2021 09:26:11 -0700 Subject: [PATCH 01/17] Adding PMIC project files. (#122) * Adding PMIC project files. * Avoid using "IF EXISTS" syntax, unsupported by older SQL Server versions that are still supported and tested on TeamCity * Removed the containerid from the queries * Updated PMIC files and adding housing alert related files. * Added the PMIC section to the Queues * Fixed the file name typo and updated the xml file with PMIC_Reference_Data * Added "Go" statement before the CREATE statements * Added a new alert called PMIC services alert. Updated the ONPRC_EHRModule.java file, added a new sql file and updated ColonyAlertsNotification.java file. * New ETL process added to schedule housing transfer alert process * Added the "GO" statements before and after the stored proc. Co-authored-by: labkey-jeckels --- .../extscheduler/PMIC_Scheduler_Daily.sql | 23 +++ .../extscheduler/PMIC_Scheduler_Weekly.sql | 24 +++ .../etls/HousingTransferAlert_Process.xml | 27 +++ .../queries/onprc_ehr/housing_transfers.sql | 19 ++ .../study/PMIC_AngioImagingData.query.xml | 118 +++++++++++ .../study/PMIC_CTACType_values.query.xml | 15 ++ .../queries/study/PMIC_CTACType_values.sql | 2 + .../PMIC_CTContrastType_values.query.xml | 15 ++ .../study/PMIC_CTContrastType_values.sql | 2 + .../study/PMIC_CTImagingData.query.xml | 154 +++++++++++++++ .../queries/study/PMIC_ChargeTypes.sql | 3 + .../study/PMIC_DEXAImagingData.query.xml | 108 ++++++++++ .../PMIC_DEXA_AnimalPosition_values.query.xml | 15 ++ .../study/PMIC_DEXA_AnimalPosition_values.sql | 2 + .../queries/study/PMIC_DEXA_values.query.xml | 15 ++ .../queries/study/PMIC_DEXA_values.sql | 2 + .../study/PMIC_PETImagingData.query.xml | 168 ++++++++++++++++ .../PMIC_PETRadioisotope_values.query.xml | 15 ++ .../study/PMIC_PETRadioisotope_values.sql | 2 + .../study/PMIC_Phantom_values.query.xml | 15 ++ .../queries/study/PMIC_Phantom_values.sql | 2 + .../queries/study/PMIC_Route_values.query.xml | 15 ++ .../queries/study/PMIC_Route_values.sql | 2 + .../study/PMIC_SPECTImagingData.query.xml | 146 ++++++++++++++ .../PMIC_SPECTRadioisotype_values.query.xml | 15 ++ .../study/PMIC_SPECTRadioisotype_values.sql | 2 + .../study/PMIC_ServicesRequestAlert.sql | 14 ++ .../study/PMIC_USImagingData.query.xml | 108 ++++++++++ .../queries/study/PMIC_US_values.query.xml | 15 ++ .../queries/study/PMIC_US_values.sql | 4 + .../study/PMIC_WetLabUse_values.query.xml | 15 ++ .../queries/study/PMIC_WetLabUse_values.sql | 2 + .../sqlserver/onprc_ehr-20.905-20.906.sql | 144 ++++++++++++++ .../sqlserver/onprc_ehr-20.906-20.907.sql | 19 ++ onprc_ehr/resources/schemas/onprc_ehr.xml | 35 ++++ .../form/field/PMIC_DoseCalcField.js | 43 ++++ .../form/field/PMIC_SPECTDoseCalcField.js | 43 ++++ .../web/onprc_ehr/model/sources/PMIC_Angio.js | 99 ++++++++++ .../web/onprc_ehr/model/sources/PMIC_CT.js | 164 ++++++++++++++++ .../web/onprc_ehr/model/sources/PMIC_DEXA.js | 106 ++++++++++ .../web/onprc_ehr/model/sources/PMIC_PET.js | 175 +++++++++++++++++ .../web/onprc_ehr/model/sources/PMIC_SPECT.js | 174 ++++++++++++++++ .../onprc_ehr/model/sources/PMIC_Services.js | 76 +++++++ .../web/onprc_ehr/model/sources/PMIC_US.js | 91 +++++++++ .../web/onprc_ehr/panel/EnterDataPanel.js | 37 ++++ .../org/labkey/onprc_ehr/ONPRC_EHRModule.java | 18 +- .../dataentry/PMICDataEntryFormType.java | 56 ++++++ .../dataentry/PMICRequestFormType.java | 61 ++++++ .../dataentry/PMIC_AngioFormSection.java | 27 +++ .../dataentry/PMIC_CTFormSection.java | 26 +++ .../dataentry/PMIC_DEXAFormSection.java | 26 +++ .../dataentry/PMIC_PETFormSection.java | 29 +++ .../dataentry/PMIC_SPECTFormSection.java | 27 +++ .../dataentry/PMIC_USFormSection.java | 26 +++ .../ColonyAlertsNotification.java | 185 +++++++++++++++--- .../HousingTransferNotification.java | 59 ++++++ .../PMICSchedulerNotification.java | 59 ++++++ .../PMICServicesRequestNotification.java | 61 ++++++ 58 files changed, 2920 insertions(+), 30 deletions(-) create mode 100644 extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql create mode 100644 extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql create mode 100644 onprc_ehr/resources/etls/HousingTransferAlert_Process.xml create mode 100644 onprc_ehr/resources/queries/onprc_ehr/housing_transfers.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_AngioImagingData.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_CTACType_values.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_CTACType_values.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_CTContrastType_values.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_CTContrastType_values.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_CTImagingData.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_ChargeTypes.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_DEXAImagingData.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_DEXA_AnimalPosition_values.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_DEXA_AnimalPosition_values.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_DEXA_values.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_DEXA_values.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_PETImagingData.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_PETRadioisotope_values.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_PETRadioisotope_values.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_Phantom_values.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_Phantom_values.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_Route_values.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_Route_values.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_SPECTImagingData.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_SPECTRadioisotype_values.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_SPECTRadioisotype_values.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_ServicesRequestAlert.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_USImagingData.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_US_values.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_US_values.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_WetLabUse_values.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_WetLabUse_values.sql create mode 100644 onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.905-20.906.sql create mode 100644 onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.906-20.907.sql create mode 100644 onprc_ehr/resources/web/onprc_ehr/form/field/PMIC_DoseCalcField.js create mode 100644 onprc_ehr/resources/web/onprc_ehr/form/field/PMIC_SPECTDoseCalcField.js create mode 100644 onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js create mode 100644 onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js create mode 100644 onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js create mode 100644 onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_PET.js create mode 100644 onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js create mode 100644 onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Services.js create mode 100644 onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICDataEntryFormType.java create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICRequestFormType.java create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_AngioFormSection.java create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_CTFormSection.java create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_DEXAFormSection.java create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_PETFormSection.java create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_SPECTFormSection.java create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_USFormSection.java create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/notification/HousingTransferNotification.java create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/notification/PMICSchedulerNotification.java create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/notification/PMICServicesRequestNotification.java diff --git a/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql new file mode 100644 index 000000000..999ae1f67 --- /dev/null +++ b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql @@ -0,0 +1,23 @@ +/* +Created by: Kolli on 10/24/2019 +This query filters all the PMIC daily events +*/ +SELECT + r.name as resourceid, + e.startdate, + e.enddate, + e.name, + e.alias, + e.quantity, + e.comments, + r.color, + r.room, + r.bldg, + e.created, + e.createdby, + e.modifiedby, + e.modified +FROM Events e, Resources r +Where r.id = e.resourceid + --And e.container = '783D2EA5-C6AC-1036-A33C-BD25D0574070' + And CAST(e.startDate AS DATE) = curdate() --Show only PMIC events \ No newline at end of file diff --git a/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql new file mode 100644 index 000000000..c2c6c087a --- /dev/null +++ b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql @@ -0,0 +1,24 @@ +/* +Created by: Kolli on 11/14/2019 +Weekly report: This query filters all the PMIC events from today to the next 7 days +*/ +SELECT + r.name as resourceid, + e.startdate, + e.enddate, + e.name, + e.alias, + e.quantity, + e.comments, + r.color, + r.room, + r.bldg, + e.created, + e.createdby, + e.modifiedby, + e.modified +FROM Events e, Resources r +Where r.id = e.resourceid + --And e.container = '783D2EA5-C6AC-1036-A33C-BD25D0574070' -- PMIC container + And CAST(e.startDate AS DATE) BETWEEN curdate() and TIMESTAMPADD('SQL_TSI_DAY', 7, curdate()) +--Where r.id = e.resourceid And e.container = 'E1CFA5B8-FAD2-1034-A87D-5107380A72B9' -- for testing \ No newline at end of file diff --git a/onprc_ehr/resources/etls/HousingTransferAlert_Process.xml b/onprc_ehr/resources/etls/HousingTransferAlert_Process.xml new file mode 100644 index 000000000..96e498987 --- /dev/null +++ b/onprc_ehr/resources/etls/HousingTransferAlert_Process.xml @@ -0,0 +1,27 @@ + + + + + + + + HousingTransfers + + Executes stored procedure to populate the NHP room utilization numbers into a temp table. + + + + + Runs a stored procedure to get the room utilization numbers + + + + + + + + + + + + diff --git a/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.sql b/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.sql new file mode 100644 index 000000000..5da786f54 --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.sql @@ -0,0 +1,19 @@ +Select + h.Id, + CASE + WHEN (Select totalClinicalTreatments from study.demographicsActiveTreatments t where h.id = t.id ) > 0 THEN 'Yes' + ELSE null + END as ActiveClinicalTreatment, + h.date as InDate, + h.room.building as Building, + h.room.area as Area, + h.room as Room, + h.cage as Cage, + h.room.housingType.value as housingType, + h.room.housingCondition.value as housingCondition, + h.reason as ReasonForMove, + h.remark as Remark, + r.totalAnimals as TotalAnimals +From study.housing h, roomUtilization_temp r +Where h.room = r.room +And h.date >= timestampadd(SQL_TSI_DAY, -1, now()) --'03-08-2021' diff --git a/onprc_ehr/resources/queries/study/PMIC_AngioImagingData.query.xml b/onprc_ehr/resources/queries/study/PMIC_AngioImagingData.query.xml new file mode 100644 index 000000000..8ac6f57ad --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_AngioImagingData.query.xml @@ -0,0 +1,118 @@ + + + + + + + Angio Imaging Data + + + true + + + + AnimalId + + + + Exam Date + + + + Charge To + + + + Credit To + + study + PMIC_ChargeTypes + chargetype + + + + + Exam Num + + + + Accession Num + + + + PMIC Type + + + + CTDIVol + 0.000 + + + + DLP + 0.000 + + + + Total Exam DLP + 0.000 + + + + Wet lab use + + study + PMIC_WetLabUse_values + value + + + + + Image Upload Link + + + + Remark + + + + + study + qcstate + RowId + + + + + Task Id + + ehr + tasks + taskid + + + + true + + + Performed By + + + true + + + + + true + + + + + true + + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_CTACType_values.query.xml b/onprc_ehr/resources/queries/study/PMIC_CTACType_values.query.xml new file mode 100644 index 000000000..7328c77c2 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_CTACType_values.query.xml @@ -0,0 +1,15 @@ + + + + + PMIC + + + true + false + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_CTACType_values.sql b/onprc_ehr/resources/queries/study/PMIC_CTACType_values.sql new file mode 100644 index 000000000..63fcca73d --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_CTACType_values.sql @@ -0,0 +1,2 @@ +SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.PMIC_Reference_Data +where name like 'CTACType' and dateDisabled is null \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_CTContrastType_values.query.xml b/onprc_ehr/resources/queries/study/PMIC_CTContrastType_values.query.xml new file mode 100644 index 000000000..7328c77c2 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_CTContrastType_values.query.xml @@ -0,0 +1,15 @@ + + + + + PMIC + + + true + false + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_CTContrastType_values.sql b/onprc_ehr/resources/queries/study/PMIC_CTContrastType_values.sql new file mode 100644 index 000000000..723ddb48c --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_CTContrastType_values.sql @@ -0,0 +1,2 @@ +SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.PMIC_Reference_Data +where name like 'ContrastType' and dateDisabled is null \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_CTImagingData.query.xml b/onprc_ehr/resources/queries/study/PMIC_CTImagingData.query.xml new file mode 100644 index 000000000..144e86baf --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_CTImagingData.query.xml @@ -0,0 +1,154 @@ + + + + + + + CT Imaging Data + + + true + + + + AnimalId + + + + Exam Date + + + + Charge To + + + + Credit To + + study + PMIC_ChargeTypes + chargetype + + + + + Exam Num + + + + Accession Num + + + + PMIC Type + + + + Contrast Type + + study + PMIC_CTContrastType_values + value + + + + + Contrast Amount + 0.0000 + + + + Route + + study + PMIC_Route_values + value + + + + + CT Type + + study + PMIC_CTACType_values + value + + + + + CT Scan Range(mm) + + + + CTDIVol + 0.0000 + + + + DLP + 0.0000 + + + + Total Exam DLP + 0.0000 + + + + Wet lab use + + study + PMIC_WetLabUse_values + value + + + + + Image Upload Link + + + + Remark + + + + + study + qcstate + RowId + + + + + Task Id + + ehr + tasks + taskid + + + + true + + + Performed By + + + true + + + + + true + + + + + true + + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_ChargeTypes.sql b/onprc_ehr/resources/queries/study/PMIC_ChargeTypes.sql new file mode 100644 index 000000000..02ca552fa --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_ChargeTypes.sql @@ -0,0 +1,3 @@ +SELECT chargetype +From Site.{substitutePath moduleProperty('onprc_billing','BillingContainer')}.onprc_billing.chargeUnits +Where servicecenter is null or servicecenter like 'PMIC' \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_DEXAImagingData.query.xml b/onprc_ehr/resources/queries/study/PMIC_DEXAImagingData.query.xml new file mode 100644 index 000000000..2f2b705fe --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_DEXAImagingData.query.xml @@ -0,0 +1,108 @@ + + + + + + + DEXA Imaging Data + + + true + + + + AnimalId + + + + Exam Date + + + + Charge To + + + + Credit To + + study + PMIC_ChargeTypes + chargetype + + + + + Exam Num + + + + Accession Num + + + + PMIC Type + + + + DEXA Procedure + + study + PMIC_DEXA_values + value + + + + + Animal Position + + study + PMIC_DEXA_AnimalPosition_values + value + + + + + Remark + + + + + study + qcstate + RowId + + + + + Task Id + + ehr + tasks + taskid + + + + true + + + Performed By + + + true + + + + + true + + + + + true + + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_DEXA_AnimalPosition_values.query.xml b/onprc_ehr/resources/queries/study/PMIC_DEXA_AnimalPosition_values.query.xml new file mode 100644 index 000000000..7328c77c2 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_DEXA_AnimalPosition_values.query.xml @@ -0,0 +1,15 @@ + + + + + PMIC + + + true + false + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_DEXA_AnimalPosition_values.sql b/onprc_ehr/resources/queries/study/PMIC_DEXA_AnimalPosition_values.sql new file mode 100644 index 000000000..e903b21c8 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_DEXA_AnimalPosition_values.sql @@ -0,0 +1,2 @@ +SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.PMIC_Reference_Data +Where name like 'PMIC_DEXA_AnimalPosition_values' and dateDisabled is null \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_DEXA_values.query.xml b/onprc_ehr/resources/queries/study/PMIC_DEXA_values.query.xml new file mode 100644 index 000000000..7328c77c2 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_DEXA_values.query.xml @@ -0,0 +1,15 @@ + + + + + PMIC + + + true + false + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_DEXA_values.sql b/onprc_ehr/resources/queries/study/PMIC_DEXA_values.sql new file mode 100644 index 000000000..d2b3e6639 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_DEXA_values.sql @@ -0,0 +1,2 @@ +SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.PMIC_Reference_Data +Where name like 'PMIC_DEXA_values' and dateDisabled is null \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_PETImagingData.query.xml b/onprc_ehr/resources/queries/study/PMIC_PETImagingData.query.xml new file mode 100644 index 000000000..ea3cc3172 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_PETImagingData.query.xml @@ -0,0 +1,168 @@ + + + + + + + PET Imaging Data + + + true + + + + AnimalId + + + + Exam Date + + + + Charge To + + + + Credit To + + study + PMIC_ChargeTypes + chargetype + + + + + Exam Num + + + + Accession Num + + + + PMIC Type + + + + PET Radioisotope + + study + PMIC_PETRadioisotope_values + value + + + + + PET Dose(mCi) + 0.0000 + + + + PET Dose(MBq) + 0.0000 + + + + Route + + study + PMIC_Route_values + value + + + + + CT Type + + study + PMIC_CTACType_values + value + + + + + CT Scan Range(mm) + + + + CTDIVol + 0.0000 + + + + DLP + 0.0000 + + + + Total Exam DLP + 0.0000 + + + + Phantom + + study + PMIC_Phantom_values + value + + + + + Wet lab use + + study + PMIC_WetLabUse_values + value + + + + + Ligand and Comments + + + + Image Upload Link + + + + + study + qcstate + RowId + + + + + Task Id + + ehr + tasks + taskid + + + + true + + + Performed By + + + true + + + + + true + + + + + true + + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_PETRadioisotope_values.query.xml b/onprc_ehr/resources/queries/study/PMIC_PETRadioisotope_values.query.xml new file mode 100644 index 000000000..7328c77c2 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_PETRadioisotope_values.query.xml @@ -0,0 +1,15 @@ + + + + + PMIC + + + true + false + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_PETRadioisotope_values.sql b/onprc_ehr/resources/queries/study/PMIC_PETRadioisotope_values.sql new file mode 100644 index 000000000..9c2f2df13 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_PETRadioisotope_values.sql @@ -0,0 +1,2 @@ +SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.PMIC_Reference_Data +where name like 'PETRadioisotope' and dateDisabled is null \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_Phantom_values.query.xml b/onprc_ehr/resources/queries/study/PMIC_Phantom_values.query.xml new file mode 100644 index 000000000..7328c77c2 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_Phantom_values.query.xml @@ -0,0 +1,15 @@ + + + + + PMIC + + + true + false + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_Phantom_values.sql b/onprc_ehr/resources/queries/study/PMIC_Phantom_values.sql new file mode 100644 index 000000000..803a1ce78 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_Phantom_values.sql @@ -0,0 +1,2 @@ +SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.PMIC_Reference_Data +where name like 'Phantom' and dateDisabled is null \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_Route_values.query.xml b/onprc_ehr/resources/queries/study/PMIC_Route_values.query.xml new file mode 100644 index 000000000..7328c77c2 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_Route_values.query.xml @@ -0,0 +1,15 @@ + + + + + PMIC + + + true + false + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_Route_values.sql b/onprc_ehr/resources/queries/study/PMIC_Route_values.sql new file mode 100644 index 000000000..40c76ad17 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_Route_values.sql @@ -0,0 +1,2 @@ +SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.PMIC_Reference_Data +Where name like 'PMIC_Route_values' and dateDisabled is null \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_SPECTImagingData.query.xml b/onprc_ehr/resources/queries/study/PMIC_SPECTImagingData.query.xml new file mode 100644 index 000000000..aba0f6789 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_SPECTImagingData.query.xml @@ -0,0 +1,146 @@ + + + + + + + SPECT Imaging Data + + + true + + + + AnimalId + + + + Exam Date + + + + Charge To + + + + Credit To + + study + PMIC_ChargeTypes + chargetype + + + + + Exam Num + + + + Accession Num + + + + PMIC Type + + + + SPECT Isotope + + study + PMIC_SPECTRadioisotope_values + value + + + + + SPECT Dose(mCi) + 0.0000 + + + + SPECT Dose(MBq) + 0.0000 + + + + Route + + study + PMIC_Route_values + value + + + + + CTDIVol + 0.0000 + + + + DLP + 0.0000 + + + + Total Exam DLP + 0.0000 + + + + Wet lab use + + study + PMIC_WetLabUse_values + value + + + + + Ligand and Comments + + + + Image Upload Link + + + + + study + qcstate + RowId + + + + + Task Id + + ehr + tasks + taskid + + + + true + + + Performed By + + + true + + + + + true + + + + + true + + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_SPECTRadioisotype_values.query.xml b/onprc_ehr/resources/queries/study/PMIC_SPECTRadioisotype_values.query.xml new file mode 100644 index 000000000..7328c77c2 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_SPECTRadioisotype_values.query.xml @@ -0,0 +1,15 @@ + + + + + PMIC + + + true + false + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_SPECTRadioisotype_values.sql b/onprc_ehr/resources/queries/study/PMIC_SPECTRadioisotype_values.sql new file mode 100644 index 000000000..0d2809ad9 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_SPECTRadioisotype_values.sql @@ -0,0 +1,2 @@ +SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.PMIC_Reference_Data +Where name like 'SPECTIsotope' and dateDisabled is null \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_ServicesRequestAlert.sql b/onprc_ehr/resources/queries/study/PMIC_ServicesRequestAlert.sql new file mode 100644 index 000000000..496ff55df --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_ServicesRequestAlert.sql @@ -0,0 +1,14 @@ +SELECT + Id, + date, + project, + type, + procedureid, + remark, + QCState, + requestid, + taskid, + created, + createdby +from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.study.encounters +Where chargeType like 'PMIC' and date >= now() \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_USImagingData.query.xml b/onprc_ehr/resources/queries/study/PMIC_USImagingData.query.xml new file mode 100644 index 000000000..1bdc18801 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_USImagingData.query.xml @@ -0,0 +1,108 @@ + + + + + + + US Imaging Data + + + true + + + + AnimalId + + + + Exam Date + + + + Charge To + + + + Credit To + + study + PMIC_ChargeTypes + chargetype + + + + + Exam Num + + + + Accession Num + + + + PMIC Type + + + + Ultrasound Procedure + + study + PMIC_US_values + value + + + + + Wet lab use + + study + PMIC_WetLabUse_values + value + + + + + Remark + + + + + study + qcstate + RowId + + + + + Task Id + + ehr + tasks + taskid + + + + true + + + Performed By + + + true + + + + + true + + + + + true + + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_US_values.query.xml b/onprc_ehr/resources/queries/study/PMIC_US_values.query.xml new file mode 100644 index 000000000..7328c77c2 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_US_values.query.xml @@ -0,0 +1,15 @@ + + + + + PMIC + + + true + false + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_US_values.sql b/onprc_ehr/resources/queries/study/PMIC_US_values.sql new file mode 100644 index 000000000..8b2c808f8 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_US_values.sql @@ -0,0 +1,4 @@ +SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.PMIC_Reference_Data +where name like 'PMIC_USProcedures' and dateDisabled is null + + diff --git a/onprc_ehr/resources/queries/study/PMIC_WetLabUse_values.query.xml b/onprc_ehr/resources/queries/study/PMIC_WetLabUse_values.query.xml new file mode 100644 index 000000000..7328c77c2 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_WetLabUse_values.query.xml @@ -0,0 +1,15 @@ + + + + + PMIC + + + true + false + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_WetLabUse_values.sql b/onprc_ehr/resources/queries/study/PMIC_WetLabUse_values.sql new file mode 100644 index 000000000..d9a8c2e12 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_WetLabUse_values.sql @@ -0,0 +1,2 @@ +SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.PMIC_Reference_Data +Where name like 'WetLabUse' and dateDisabled is null \ No newline at end of file diff --git a/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.905-20.906.sql b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.905-20.906.sql new file mode 100644 index 000000000..2a9f14582 --- /dev/null +++ b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.905-20.906.sql @@ -0,0 +1,144 @@ +/****** Housing transfers alert project: By Kolli******/ +/* + Created 3 temp tables to get the list of NHP rooms usage. + The stored proc manages the addition and deleting data from the temp tables + at the time of execution via ETL process. + */ +EXEC core.fn_dropifexists 'availableCages_temp','onprc_ehr','TABLE'; +EXEC core.fn_dropifexists 'availableCagesByRoom_temp','onprc_ehr','TABLE'; +EXEC core.fn_dropifexists 'roomUtilization_temp','onprc_ehr','TABLE'; + +GO + +-- Create the temp tables +CREATE TABLE [onprc_ehr].[availableCages_temp]( + [location] [varchar](50) NOT NULL, + [room] [varchar](200) NULL, + [cage] [varchar](200) NULL, + [row] [varchar](200) NULL, + [columnidx] [int] NULL, + [cage_type] [varchar](200) NULL, + [lowerCage] [varchar](200) NULL, + [lower_cage_type] [varchar](200) NULL, + [divider] [int] NULL, + [isAvailable] [int] NULL, + [isMarkedUnavailable] [int] NULL, + ) +; + +CREATE TABLE [onprc_ehr].[availableCagesByRoom_temp]( + [room] [varchar](200) NULL, + [availableCages] [int] NULL, + [markedUnavailable] [int] NULL + ) +; + +CREATE TABLE [onprc_ehr].[roomUtilization_temp]( + [room] [nvarchar](200) NULL, + [availableCages] [int] NULL, + [cagesUsed] [int] NULL, + [markedUnavailable] [int] NULL, + [cagesEmpty] [int] NULL, + [totalAnimals] [int] NULL + ) +; + +GO + + +-- Create the stored proc here +/****** Object: StoredProcedure [onprc_ehr].[NHPRoomsUsage] ******/ + +-- ============================================= +-- Author: Lakshmi Kolli +-- Create date: 3/6/2021 +-- Description: Get the list of NHP rooms usage. The procedure is scheduled using a ETL process +-- to list out the room utilization list at 4pm every day. The list is later used to check against for the +-- empty rooms with the current list of rooms usage. +-- ============================================= +CREATE PROCEDURE [onprc_ehr].[NHPRoomsUsage] + +AS +BEGIN + +----Truncate the temp table first +delete from onprc_ehr.availableCages_temp + +----Get the cages list and insert into the temp table +Insert Into onprc_ehr.availableCages_temp(location,room, cage, row, columnidx, cage_type, lowerCage, lower_cage_type, divider, isAvailable, isMarkedUnavailable) +SELECT + CASE + WHEN c.cage IS NULL THEN c.room + ELSE (c.room + '-' + c.cage) + END as location, + c.room, + c.cage, + (Select cp.row from ehr_lookups.cage_positions cp where c.cage = cp.cage) as row, + (Select cp.columnIdx from ehr_lookups.cage_positions cp where c.cage = cp.cage) as columnidx, + c.cage_type, + lc.cage as lowerCage, + lc.cage_type as lower_cage_type, + lc.divider, + --if the divider on the left-hand cage is separating, then these cages are separate + --and should be counted. if there's no left-hand cage, always include + CASE + WHEN c.cage_type = 'No Cage' THEN 0 + --WHEN lc.divider.countAsSeparate = 0 THEN false + WHEN (Select d.countAsSeparate from ehr_lookups.divider_types d where lc.divider = d.rowid) = 0 THEN 0 + ELSE 1 + END as isAvailable, + + CASE + WHEN (c.status IS NOT NULL AND c.status = 'Unavailable') then 1 + ELSE 0 + END as isMarkedUnavailable + +FROM ehr_lookups.cage c + --find the cage located to the left + LEFT JOIN ehr_lookups.cage lc ON (lc.cage_type != 'No Cage' and c.room = lc.room and (Select cp.row from ehr_lookups.cage_positions cp where c.cage = cp.cage) = (Select cp.row from ehr_lookups.cage_positions cp where lc.cage = cp.cage) and ((Select cp.columnIdx from ehr_lookups.cage_positions cp where c.cage = cp.cage) - 1) = (Select cp.columnIdx from ehr_lookups.cage_positions cp where lc.cage = cp.cage) ) +--WHERE c.room.housingType.value = 'Cage Location' + +----Truncate the temp table first +delete from onprc_ehr.availableCagesByRoom_temp + +--Get the available cages by room +Insert Into onprc_ehr.availableCagesByRoom_temp(room, availableCages, markedUnavailable) +SELECT + c.room, + count(*) as availableCages, + sum(c.isMarkedUnavailable) as markedUnavailable +FROM onprc_ehr.availableCages_temp c +WHERE c.isAvailable = 1 +GROUP BY c.room + +----Truncate the temp table first +delete from onprc_ehr.roomUtilization_temp + +--Get the rooms usage data +Insert Into onprc_ehr.roomUtilization_temp(room, availableCages, CagesUsed, MarkedUnavailable, CagesEmpty, TotalAnimals) +SELECT + r.room, + max(cbr.availableCages) as AvailableCages, + count(DISTINCT h.cage) as CagesUsed, + max(cbr.markedUnavailable) as MarkedUnavailable, + max(cbr.availableCages) - count(DISTINCT h.cage) - max(cbr.markedUnavailable) as CagesEmpty, + count(DISTINCT h.participantid) as TotalAnimals +FROM ehr_lookups.rooms r + LEFT JOIN ( + SELECT c.room, c.cage + FROM ehr_lookups.cage c + WHERE cage is not null + + --allow for rooms w/o cages + UNION ALL + SELECT r.room, null as cage + FROM ehr_lookups.rooms r + ) c on (r.room = c.room) + LEFT JOIN studyDataset.c6d194_housing h ON (r.room=h.room AND (c.cage=h.cage OR (c.cage is null and h.cage is null)) AND (((date <= GETDATE() AND enddate >= GETDATE()) OR (date <= GETDATE() AND enddate is null)))) + LEFT JOIN onprc_ehr.availableCagesByRoom_temp cbr ON (cbr.room = r.room) +WHERE r.datedisabled is null +GROUP BY r.room + +END + +GO \ No newline at end of file diff --git a/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.906-20.907.sql b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.906-20.907.sql new file mode 100644 index 000000000..901e1937b --- /dev/null +++ b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.906-20.907.sql @@ -0,0 +1,19 @@ +EXEC core.fn_dropifexists 'PMIC_Reference_Data','onprc_ehr','TABLE'; + GO + +/****** Object: Table [onprc_ehr].[PMIC_Reference_Data] Script Date: 2/12/2020 ******/ +CREATE TABLE [onprc_ehr].[PMIC_Reference_Data]( + [RowId] INT IDENTITY(1,1)NOT NULL, + [value] [nvarchar](1000) NULL, + [name] [nvarchar](1000) NULL, + [remark] [nvarchar](4000) NULL, + [dateDisabled] [datetime] NULL, + [created] [datetime] NULL, + [createdBy] [int] NULL, + [modified] [datetime] NULL, + [modifiedBy] [int] NULL + + CONSTRAINT pk_PMIC_Reference_Data PRIMARY KEY (RowId) + ) + + GO diff --git a/onprc_ehr/resources/schemas/onprc_ehr.xml b/onprc_ehr/resources/schemas/onprc_ehr.xml index 1b0d871c3..afd52934a 100644 --- a/onprc_ehr/resources/schemas/onprc_ehr.xml +++ b/onprc_ehr/resources/schemas/onprc_ehr.xml @@ -992,4 +992,39 @@ + + + + PMIC_Reference_Data + + DETAILED + + + true + + + + Value + + + + Name + + + + + End Date + + + + true + + + + true + + + + +
diff --git a/onprc_ehr/resources/web/onprc_ehr/form/field/PMIC_DoseCalcField.js b/onprc_ehr/resources/web/onprc_ehr/form/field/PMIC_DoseCalcField.js new file mode 100644 index 000000000..93bfe4021 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/form/field/PMIC_DoseCalcField.js @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2013-2014 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +/** + * A trigger field which only allows numeric characters + */ + +/*Convert the dosage units from mCi to mBq: +1mCi = 37MBq +By Kollil - 9/25/2020 + */ +Ext4.define('EHR.form.field.PMIC_DoseCalcField', { + extend: 'EHR.form.field.TriggerNumberField', + alias: 'widget.ehr-PMIC_DoseCalcField', + + triggerCls: 'x4-form-search-trigger', + + triggerToolTip: 'Click to calculate the dosage in MBq units', + + initComponent: function(){ + this.callParent(arguments); + }, + + onTriggerClick: function(){ + //Get the current record + var record = EHR.DataEntryUtils.getBoundRecord(this); + if (!record){ + return; + } + //if empty, throw error + if (!record.get('PETDoseMCI')) { + Ext4.Msg.alert('Error', 'Must enter the PET Dose (mCi)'); + return; + } + //convert the units from Millicurie [mCi] to Megabecquerel [MBq]: 1 Mci = 37 MBq and display the value in the PETDoseMBQ field + var mBq_units = record.get('PETDoseMCI') * 37; + if (mBq_units) + record.set('PETDoseMBQ', mBq_units); + } + +}); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/form/field/PMIC_SPECTDoseCalcField.js b/onprc_ehr/resources/web/onprc_ehr/form/field/PMIC_SPECTDoseCalcField.js new file mode 100644 index 000000000..df96ee957 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/form/field/PMIC_SPECTDoseCalcField.js @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2013-2014 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +/** + * A trigger field which only allows numeric characters + */ + +/*Convert the dosage units from mCi to mBq: +1mCi = 37MBq +By Kollil - 9/25/2020 + */ +Ext4.define('EHR.form.field.PMIC_SPECTDoseCalcField', { + extend: 'EHR.form.field.TriggerNumberField', + alias: 'widget.ehr-PMIC_SPECTDoseCalcField', + + triggerCls: 'x4-form-search-trigger', + + triggerToolTip: 'Click to calculate the dosage in MBq units', + + initComponent: function(){ + this.callParent(arguments); + }, + + onTriggerClick: function(){ + //Get the current record + var record = EHR.DataEntryUtils.getBoundRecord(this); + if (!record){ + return; + } + //if empty, throw error + if (!record.get('SPECTDoseMCI')) { + Ext4.Msg.alert('Error', 'Must enter the SPECT Dose (mCi)'); + return; + } + //convert the units from Millicurie [mCi] to Megabecquerel [MBq]: 1 Mci = 37 MBq and display the value in the PETDoseMBQ field + var mBq_units = record.get('SPECTDoseMCI') * 37; + if (mBq_units) + record.set('SPECTDoseMBQ', mBq_units); + } + +}); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js new file mode 100644 index 000000000..729f97ff0 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js @@ -0,0 +1,99 @@ + +/** + * User: Kolli + * Date: 7/14/19 + * Time: 10:36 AM + */ +EHR.model.DataModelManager.registerMetadata('Angio', { + allQueries: { + }, + byQuery: { + 'study.PMIC_AngioImagingData': { + PMICType: { + allowBlank: true, + defaultValue: 'Angio', + hidden: false + }, + + Date: { + header:'Exam Date', + columnConfig: { + width: 200 + } + }, + + project: { + allowBlank: true, + columnConfig: { + width: 150 + } + }, + + chargeType: { + allowBlank: true, + defaultValue: 'PMIC', + hidden: false + }, + + examNum: { + header:"Exam Num", + columnConfig: { + width: 150 + } + }, + + accessionNum: { + header:"Accession Num", + columnConfig: { + width: 150 + } + }, + + CTDIvol: { + header:"CTDIVol (mGy)", + columnConfig: { + width: 150 + } + }, + + DLP: { + header:"DLP (mGy*cm)", + columnConfig: { + width: 150 + } + }, + + wetLabUse: { + header:"Wet lab use", + defaultValue: 'No', + columnConfig: { + width: 150 + } + }, + + ImageUploadLink: { + hidden: true, + columnConfig: { + width: 150 + } + }, + + TotalExamDLP: { + hidden: true, + header: 'Total Exam DLP (mGy*cm)', + columnConfig: { + width: 200 + } + }, + + performedBy: { + defaultValue: LABKEY.Security.currentUser.displayName, + columnConfig: { + width: 150 + } + } + + } + + } +}); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js new file mode 100644 index 000000000..c190269f9 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js @@ -0,0 +1,164 @@ + +/** + * User: Kolli + * Date: 7/14/19 + * Time: 10:36 AM + */ +EHR.model.DataModelManager.registerMetadata('CT', { + allQueries: { + + }, + byQuery: { + 'study.PMIC_CTImagingData': { + PMICType: { + allowBlank: true, + defaultValue: 'CT', + hidden: false + }, + + Date: { + header:'Exam Date', + columnConfig: { + width: 200 + } + }, + + project: { + allowBlank: true, + columnConfig: { + width: 150 + } + }, + + chargeType: { + allowBlank: true, + defaultValue: 'PMIC', + hidden: false + }, + + examNum: { + header:"Exam Num", + columnConfig: { + width: 150 + } + }, + + accessionNum: { + header:"Accession Num", + columnConfig: { + width: 150 + } + }, + + CTDIvol: { + header:"CTDIVol (mGy)", + columnConfig: { + width: 150 + } + }, + + DLP: { + header:"DLP (mGy*cm)", + columnConfig: { + width: 150 + } + }, + + CTType: { + columnConfig: { + width: 150 + } + }, + + CTScanRange: { + header:"CT Scan Range(mm)", + columnConfig: { + width: 150 + } + }, + + ContrastType: { + // xtype: 'combo', + // hidden: false, + // lookup: { + // schemaName: 'study', + // queryName: 'PMIC_CTContrastType_values', + // displayColumn: 'value', + // columns: 'value, name' + // }, + // editorConfig: { + // listConfig: { + // innerTpl: '{[("" + values.value + "" )]}', + // getInnerTpl: function(){ + // return this.innerTpl; + // } + // } + // }, + columnConfig: { + width: 150 + } + + }, + + Route: { + // xtype: 'combo', + // lookup: { + // schemaName: 'study', + // queryName: 'PMIC_Route_values', + // displayColumn: 'value', + // columns: 'value, name' + // }, + // editorConfig: { + // listConfig: { + // innerTpl: '{[("" + values.value + "" )]}', + // getInnerTpl: function(){ + // return this.innerTpl; + // } + // } + // }, + columnConfig: { + width: 150 + } + }, + + ContrastAmount: { + header: 'Contrast Amount (ml)', + hidden: false, + columnConfig: { + width: 200 + } + }, + + wetLabUse: { + header:"Wet lab use", + defaultValue: 'No', + columnConfig: { + width: 150 + } + }, + + ImageUploadLink: { + hidden: true, + columnConfig: { + width: 150 + } + }, + + TotalExamDLP: { + hidden: true, + header: 'Total Exam DLP (mGy*cm)', + columnConfig: { + width: 200 + } + }, + + performedBy: { + defaultValue: LABKEY.Security.currentUser.displayName, + columnConfig: { + width: 150 + } + } + + } + } +}); diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js new file mode 100644 index 000000000..cb1ff2f12 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js @@ -0,0 +1,106 @@ + +/** + * User: Kolli + * Date: 7/14/19 + * Time: 10:36 AM + */ +EHR.model.DataModelManager.registerMetadata('DEXA', { + allQueries: { + }, + byQuery: { + 'study.PMIC_DEXAImagingData': { + PMICType: { + allowBlank: true, + defaultValue: 'DEXA', + hidden: false + }, + + Date: { + header:'Exam Date', + columnConfig: { + width: 200 + } + }, + + project: { + allowBlank: true, + columnConfig: { + width: 150 + } + }, + + chargeType: { + allowBlank: true, + defaultValue: 'PMIC', + hidden: false + }, + + examNum: { + header:"Exam Num", + columnConfig: { + width: 150 + } + }, + + accessionNum: { + header:"Accession Num", + columnConfig: { + width: 150 + } + }, + + animalPosition: { + // xtype: 'combo', + // lookup: { + // schemaName: 'study', + // queryName: 'PMIC_DEXA_AnimalPosition_values', + // displayColumn: 'value', + // columns: 'value, name' + // }, + // editorConfig: { + // listConfig: { + // innerTpl: '{[("" + values.value + "" )]}', + // getInnerTpl: function(){ + // return this.innerTpl; + // } + // } + // }, + columnConfig: { + width: 200 + } + }, + + DEXAProcedure: { + // xtype: 'combo', + // header: "DEXA Procedure", + // lookup: { + // schemaName: 'study', + // queryName: 'PMIC_DEXA_values', + // displayColumn: 'value', + // columns: 'value, name' + // }, + // editorConfig: { + // listConfig: { + // innerTpl: '{[("" + values.value + "" )]}', + // getInnerTpl: function () { + // return this.innerTpl; + // } + // } + // }, + columnConfig: { + width: 200 + } + }, + + performedBy: { + defaultValue: LABKEY.Security.currentUser.displayName, + columnConfig: { + width: 150 + } + } + + + } + + } +}); \ No newline at end of file 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 new file mode 100644 index 000000000..aa925c2e3 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_PET.js @@ -0,0 +1,175 @@ + +/** + * User: Kolli + * Date: 7/14/19 + * Time: 10:36 AM + */ +EHR.model.DataModelManager.registerMetadata('PET', { + allQueries: { + }, + + byQuery: { + 'study.PMIC_PETImagingData': { + PMICType: { + allowBlank: true, + defaultValue: 'PET', + hidden: false + }, + + Date: { + header:'Exam Date', + columnConfig: { + width: 200 + } + }, + + project: { + allowBlank: true, + columnConfig: { + width: 150 + } + }, + + chargeType: { + allowBlank: true, + defaultValue: 'PMIC', + hidden: false + }, + + examNum: { + header:"Exam Num", + columnConfig: { + width: 200 + } + }, + + accessionNum: { + header:"Accession Num", + columnConfig: { + width: 200 + } + }, + + PETDoseMCI: { + header:"PET Dose (mCi)", + columnConfig: { + width: 200 + }, + editorConfig: { + decimalPrecision: 4 + } + }, + + PETDoseMBQ: { + /* + The conversion is actually pretty simple [1mCi = 37MBq] + */ + xtype: 'ehr-PMIC_DoseCalcField', + header:"PET Dose (MBq)", + columnConfig: { + width: 200 + }, + editorConfig: { + decimalPrecision: 4 + } + }, + + CTACType: { + columnConfig: { + width: 150 + } + }, + + PETRadioIsotope: { + columnConfig: { + width: 350 + } + }, + + route: { + // xtype: 'combo', + // lookup: { + // schemaName: 'study', + // queryName: 'PMIC_Route_values', + // displayColumn: 'value', + // columns: 'value, name' + // }, + // editorConfig: { + // listConfig: { + // innerTpl: '{[("" + values.value + "" )]}', + // getInnerTpl: function(){ + // return this.innerTpl; + // } + // } + // }, + columnConfig: { + width: 150 + } + }, + + CTACScanRange: { + header:"CT Scan Range(mm)", + columnConfig: { + width: 150 + } + }, + + DLP: { + header:"DLP (mGy*cm)", + columnConfig: { + width: 150 + } + }, + + CTDIVol: { + header:"CTDIVol (mGy)", + columnConfig: { + width: 150 + } + }, + + phantom: { + columnConfig: { + width: 150 + } + }, + + wetLabUse: { + header:"Wet lab use", + defaultValue: 'No', + columnConfig: { + width: 150 + } + }, + + imageUploadLink: { + hidden: true, + columnConfig: { + width: 150 + } + }, + + ligandAndComments: { + header:'Ligand and Comments', + columnConfig: { + width: 200 + } + }, + + totalExamDLP: { + hidden: true, + header: 'Total Exam DLP (mGy*cm)', + columnConfig: { + width: 200 + } + }, + + performedBy: { + defaultValue: LABKEY.Security.currentUser.displayName, + columnConfig: { + width: 150 + } + } + } + } +}); diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js new file mode 100644 index 000000000..9885ae35a --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js @@ -0,0 +1,174 @@ + +/** + * User: Kolli + * Date: 7/14/19 + * Time: 10:36 AM + */ +EHR.model.DataModelManager.registerMetadata('SPECT', { + allQueries: { + }, + + byQuery: { + 'study.PMIC_SPECTImagingData': { + PMICType: { + allowBlank: true, + defaultValue: 'SPECT', + hidden: false + }, + + Date: { + header:'Exam Date', + columnConfig: { + width: 200 + } + }, + + project: { + allowBlank: true, + columnConfig: { + width: 150 + } + }, + + chargeType: { + allowBlank: true, + defaultValue: 'PMIC', + hidden: false + }, + + examNum: { + header:"Exam Num", + columnConfig: { + width: 150 + } + }, + + accessionNum: { + header:"Accession Num", + columnConfig: { + width: 150 + } + }, + + CTDIVol: { + header:"CTDIVol (mGy)", + columnConfig: { + width: 150 + } + }, + + DLP: { + header:"DLP (mGy*cm)", + columnConfig: { + width: 150 + } + }, + + wetLabUse: { + header:"Wet lab use", + defaultValue: 'No', + columnConfig: { + width: 150 + } + }, + + ImageUploadLink: { + hidden: true, + columnConfig: { + width: 150 + } + }, + + TotalExamDLP: { + hidden: true, + header: 'Total Exam DLP (mGy*cm)', + columnConfig: { + width: 200 + } + }, + + SPECTDoseMCI: { + header: 'SPECT Dose (mCi)', + columnConfig: { + width: 200 + }, + editorConfig: { + decimalPrecision: 4 + } + }, + /* + The conversion is actually pretty simple [1mCi = 37MBq] + */ + SPECTDoseMBQ: { + xtype: 'ehr-PMIC_SPECTDoseCalcField', + header: 'SPECT Dose (MBq)', + columnConfig: { + width: 200 + }, + editorConfig: { + decimalPrecision: 4 + } + }, + + Route: { + // xtype: 'combo', + // lookup: { + // schemaName: 'study', + // queryName: 'PMIC_Route_values', + // displayColumn: 'value', + // columns: 'value, name' + // }, + // editorConfig: { + // listConfig: { + // innerTpl: '{[("" + values.value + "" )]}', + // getInnerTpl: function(){ + // return this.innerTpl; + // } + // } + // }, + columnConfig: { + width: 150 + } + }, + + LigandAndComments: { + header:'Ligand and Comments', + columnConfig: { + width: 200 + } + }, + + SPECTIsotope: { + // xtype: 'combo', + // header: 'SPECT Radioisotope', + // lookup: { + // schemaName: 'study', + // queryName: 'PMIC_SPECTRadioisotope_values', + // displayColumn: 'value', + // columns: 'value, name' + // }, + // editorConfig: { + // listConfig: { + // innerTpl: '{[("" + values.value + "" )]}', + // getInnerTpl: function(){ + // return this.innerTpl; + // } + // } + // }, + columnConfig: { + width: 200 + } + + }, + + performedBy: { + defaultValue: LABKEY.Security.currentUser.displayName, + columnConfig: { + width: 150 + } + } + + } + + } +}); diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Services.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Services.js new file mode 100644 index 000000000..02edc5aa0 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Services.js @@ -0,0 +1,76 @@ + +/* + * Copyright (c) 2013-2014 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +EHR.model.DataModelManager.registerMetadata('PMIC_Services', { + allQueries: { + + }, + + byQuery: { + 'study.encounters': { + chargetype: { + defaultValue: 'PMIC', + hidden: true + }, + date: { + xtype: 'xdatetime', + extFormat: 'Y-m-d H:i', + defaultValue: (new Date()).format('Y-m-d 8:0') + }, + type: { + defaultValue: 'Procedure', + hidden: true + }, + procedureid: { + lookup: { + filterArray: [ + LABKEY.Filter.create('category', 'PMIC', LABKEY.Filter.Types.EQUAL), + LABKEY.Filter.create('active', true, LABKEY.Filter.Types.EQUAL) + ] + } + } + }, + + 'study.drug': { + chargetype: { + defaultValue: 'PMIC Services', + hidden: true + }, + date: { + xtype: 'xdatetime', + extFormat: 'Y-m-d H:i', + defaultValue: (new Date()).format('Y-m-d 8:0') + }, + Billable: { + defaultValue: 'Yes', + hidden: false + }, + category: { + defaultValue: 'Research', + hidden: true + }, + remark: { + header: 'Ligand and Comments', + hidden: false + }, + reason: { + defaultValue: 'Research', + hidden: false + }, + lot: { + hidden: true + }, + code: { + editorConfig: { + defaultSubset: 'Research' + }, + header: 'Radioisotopes' + } + } + + } + } +); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js new file mode 100644 index 000000000..f5bb694fe --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js @@ -0,0 +1,91 @@ + +/** + * User: Kolli + * Date: 7/14/19 + * Time: 10:36 AM + */ +EHR.model.DataModelManager.registerMetadata('US', { + allQueries: { + }, + byQuery: { + 'study.PMIC_USImagingData': { + PMICType: { + allowBlank: true, + defaultValue: 'Ultrasound', + hidden: false + }, + + Date: { + header:'Exam Date', + columnConfig: { + width: 200 + } + }, + + project: { + allowBlank: true, + columnConfig: { + width: 150 + } + }, + + chargeType: { + allowBlank: true, + defaultValue: 'PMIC', + hidden: false + }, + + examNum: { + header:"Exam Num", + columnConfig: { + width: 150 + } + }, + + accessionNum: { + header:"Accession Num", + columnConfig: { + width: 150 + } + }, + + wetLabUse: { + header:"Wet lab use", + defaultValue: 'No', + columnConfig: { + width: 150 + } + }, + + ultrasoundProcedure: { + // xtype: 'combo', + // header: "Ultrasound Procedure", + // lookup: { + // schemaName: 'study', + // queryName: 'PMIC_US_values', + // displayColumn: 'value', + // columns: 'value, name' + // }, + // editorConfig: { + // listConfig: { + // innerTpl: '{[("" + values.value + "" )]}', + // getInnerTpl: function () { + // return this.innerTpl; + // } + // } + // }, + columnConfig: { + width: 200 + } + }, + + performedBy: { + defaultValue: LABKEY.Security.currentUser.displayName, + columnConfig: { + width: 150 + } + } + } + + } +}); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/panel/EnterDataPanel.js b/onprc_ehr/resources/web/onprc_ehr/panel/EnterDataPanel.js index 1afd6bb3c..867c6460b 100644 --- a/onprc_ehr/resources/web/onprc_ehr/panel/EnterDataPanel.js +++ b/onprc_ehr/resources/web/onprc_ehr/panel/EnterDataPanel.js @@ -139,6 +139,43 @@ Ext4.define('onprc_ehr.panel.EnterDataPanel', { linkCls: 'labkey-text-link', href: LABKEY.ActionURL.buildURL('ldk', 'runNotification', null, {key: 'org.labkey.onprc_ehr.notification.RequestAdminNotification'}) }] + },{ + header: 'PMIC Service Requests', //Added by Kolli 3/23/2020 + renderer: function(item){ + return { + layout: 'hbox', + bodyStyle: 'padding: 2px;background-color: transparent;', + defaults: { + border: false + }, + items: [{ + html: item.name + ':', + width: 200 + },{ + xtype: 'ldk-linkbutton', + text: 'Unapproved Requests', + linkCls: 'labkey-text-link', + href: LABKEY.ActionURL.buildURL('query', 'executeQuery', null, {schemaName: 'study', 'query.queryName': 'encounters', 'query.viewName': 'Requests', 'query.QCState/Label~eq': 'Request: Pending', 'query.chargetype~eq': item.chargeType}) + },{ + xtype: 'ldk-linkbutton', + text: 'Approved Requests', + linkCls: 'labkey-text-link', + style: 'padding-left: 5px;', + href: LABKEY.ActionURL.buildURL('query', 'executeQuery', null, {schemaName: 'study', 'query.queryName': 'encounters', 'query.viewName': 'Requests', 'query.QCState/Label~eq': 'Request: Pending', 'query.chargetype~eq': item.chargeType}) + },{ + xtype: 'ldk-linkbutton', + text: 'Scheduled Today', + linkCls: 'labkey-text-link', + style: 'padding-left: 5px;', + href: LABKEY.ActionURL.buildURL('query', 'executeQuery', null, {schemaName: 'study', 'query.queryName': 'encounters', 'query.viewName': 'Requests', 'query.QCState/Label~eq': 'Request: Approved', 'query.chargetype~eq': item.chargeType, 'query.date~dateeq': (new Date()).format('Y-m-d')}) + }] + } + }, + items: [{ + name: 'Procedure Request', + chargeType: 'PMIC' + + }] },{ //header: 'Blood Draw Requests', header: 'ASB Service Requests', diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java index b66eac44a..3c8a13650 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java @@ -120,7 +120,7 @@ public String getName() @Override public @Nullable Double getSchemaVersion() { - return 20.905; + return 20.907; } @Override @@ -184,7 +184,13 @@ protected void doStartupAfterSpringConfig(ModuleContext moduleContext) ns.registerNotification(new BSUNotesNotification(this)); //Added Oct 7th, 2020 Kollil -// ns.registerNotification(new PMICSchedulerNotification(this)); + ns.registerNotification(new PMICSchedulerNotification(this)); + + //Added Oct 7th, 2020 Kollil + ns.registerNotification(new PMICServicesRequestNotification(this)); + + //Added Mar 18th, 2021 Kollil + ns.registerNotification(new HousingTransferNotification(this)); //Added 8-7-2018 R.Blasa ns.registerNotification(new BirthHousingMismatchNotification(this)); @@ -461,7 +467,10 @@ public String toString() EHRService.get().registerFormType(new DefaultDataEntryFormFactory(PathDeathFormType.class, this)); //Added: 5/23/2019 Kolli -// EHRService.get().registerFormType(new DefaultDataEntryFormFactory(PMICRequestFormType.class, this)); + EHRService.get().registerFormType(new DefaultDataEntryFormFactory(PMICRequestFormType.class, this)); + + //Added: 7/10/2019 by Kolli + EHRService.get().registerFormType(new DefaultDataEntryFormFactory(PMICDataEntryFormType.class, this)); //Added: 1/13/2021 Kolli // EHRService.get().registerFormType(new DefaultDataEntryFormFactory(ARTCoreRequestFormType.class, this)); @@ -469,9 +478,6 @@ public String toString() //Added: 8/10/2019 Kolli // EHRService.get().registerFormType(new DefaultDataEntryFormFactory(IPCRequestFormType.class, this)); - //Added: 7/10/2019 by Kolli -// EHRService.get().registerFormType(new DefaultDataEntryFormFactory(PMICDataEntryFormType.class, this)); - // Added: 11-21-2017 R.Blasa EHRService.get().registerFormType(new DefaultDataEntryFormFactory(ProcedureRequestBulkEditFormType.class, this)); diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICDataEntryFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICDataEntryFormType.java new file mode 100644 index 000000000..c6713bcb0 --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICDataEntryFormType.java @@ -0,0 +1,56 @@ + +package org.labkey.onprc_ehr.dataentry; + +import org.labkey.api.ehr.dataentry.AnimalDetailsFormSection; +import org.labkey.api.ehr.dataentry.DataEntryFormContext; +import org.labkey.api.ehr.dataentry.FormSection; +import org.labkey.api.ehr.dataentry.TaskForm; +import org.labkey.api.ehr.dataentry.TaskFormSection; +import org.labkey.api.module.Module; +import org.labkey.api.view.template.ClientDependency; + +import java.util.Arrays; + +/** + * User: Kolli + * Date: 7/7/19 + * Time: 10:36 AM + */ +public class PMICDataEntryFormType extends TaskForm +{ + public static final String NAME = "PMIC"; + + public PMICDataEntryFormType(DataEntryFormContext ctx, Module owner) + { + super(ctx, owner, NAME, "PMIC Data Entry", "Imaging", Arrays.asList( + new TaskFormSection(), + new AnimalDetailsFormSection(), + new PMIC_PETFormSection(), + new PMIC_CTFormSection(), + new PMIC_SPECTFormSection(), + new PMIC_AngioFormSection(), + new PMIC_USFormSection(), + new PMIC_DEXAFormSection() + )); + + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/PMIC_Services.js")); + + + for (FormSection s : getFormSections()) + { + s.addConfigSource("PMIC_Services"); + } + + } + +// // Added: 12-5-2019 R.Blasa Allow access only to PMIC Access group. +// @Override +// protected boolean canInsert() +// { +// if (!getCtx().getContainer().hasPermission(getCtx().getUser(), ONPRC_EHRPMICEditPermission.class)) +// return false; +// +// return super.canInsert(); +// } + +} \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICRequestFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICRequestFormType.java new file mode 100644 index 000000000..1ab3e5eff --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICRequestFormType.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2013-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.dataentry; + +import org.labkey.api.ehr.dataentry.AnimalDetailsFormSection; +import org.labkey.api.ehr.dataentry.DataEntryFormContext; +import org.labkey.api.ehr.dataentry.FormSection; +import org.labkey.api.ehr.dataentry.RequestForm; +import org.labkey.api.ehr.dataentry.RequestFormSection; +import org.labkey.api.module.Module; +import org.labkey.api.view.template.ClientDependency; + +import java.util.Arrays; + +//Created: 5/23/2019 Kollil +public class PMICRequestFormType extends RequestForm +{ + public static final String NAME = "PMIC SERVICES REQUEST"; + public static final String DEFAULT_GROUP = "PMIC Services"; + + public PMICRequestFormType(DataEntryFormContext ctx, Module owner) + { + super(ctx, owner, NAME, NAME, "Requests", Arrays.asList( + new RequestFormSection(), + new AnimalDetailsFormSection(), + new ClinicalEncountersFormSection() + )); + + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/PMIC_Services.js")); + + for (FormSection s : getFormSections()) + { + s.addConfigSource("PMIC_Services"); + } + + } + +// // Added: 12-5-2019 R.Blasa Allow access only to PMIC Access group. +// @Override +// protected boolean canInsert() +// { +// if (!getCtx().getContainer().hasPermission(getCtx().getUser(), ONPRC_EHRPMICEditPermission.class)) +// return false; +// +// return super.canInsert(); +// } + +} \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_AngioFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_AngioFormSection.java new file mode 100644 index 000000000..051986c93 --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_AngioFormSection.java @@ -0,0 +1,27 @@ +package org.labkey.onprc_ehr.dataentry; + +import org.labkey.api.ehr.EHRService; +import org.labkey.api.view.template.ClientDependency; +import org.labkey.api.ehr.dataentry.SimpleGridPanel; + + +/** + * User: Kolli + * Date: 7/7/19 + * Time: 10:36 AM + */ +public class PMIC_AngioFormSection extends SimpleGridPanel +{ + public PMIC_AngioFormSection() + { + this(EHRService.FORM_SECTION_LOCATION.Body); + } + + public PMIC_AngioFormSection(EHRService.FORM_SECTION_LOCATION location) + { + super("study", "PMIC_AngioImagingData", "Angio", location); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/PMIC_Angio.js")); + addConfigSource("Angio"); +// _showLocation = true; + } +} \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_CTFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_CTFormSection.java new file mode 100644 index 000000000..69c6f4f46 --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_CTFormSection.java @@ -0,0 +1,26 @@ +package org.labkey.onprc_ehr.dataentry; + +import org.labkey.api.ehr.EHRService; +import org.labkey.api.view.template.ClientDependency; +import org.labkey.api.ehr.dataentry.SimpleGridPanel; + +/** + * User: Kolli + * Date: 7/7/19 + * Time: 10:36 AM + */ +public class PMIC_CTFormSection extends SimpleGridPanel +{ + public PMIC_CTFormSection() + { + this(EHRService.FORM_SECTION_LOCATION.Body); + } + + public PMIC_CTFormSection(EHRService.FORM_SECTION_LOCATION location) + { + super("study", "PMIC_CTImagingData", "CT", location); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/PMIC_CT.js")); + addConfigSource("CT"); +// _showLocation = true; + } +} \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_DEXAFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_DEXAFormSection.java new file mode 100644 index 000000000..edff4d5ae --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_DEXAFormSection.java @@ -0,0 +1,26 @@ +package org.labkey.onprc_ehr.dataentry; + +import org.labkey.api.ehr.EHRService; +import org.labkey.api.view.template.ClientDependency; +import org.labkey.api.ehr.dataentry.SimpleGridPanel; + +/** + * User: Kolli + * Date: 7/7/19 + * Time: 10:36 AM + */ +public class PMIC_DEXAFormSection extends SimpleGridPanel +{ + public PMIC_DEXAFormSection() + { + this(EHRService.FORM_SECTION_LOCATION.Body); + } + + public PMIC_DEXAFormSection(EHRService.FORM_SECTION_LOCATION location) + { + super("study", "PMIC_DEXAImagingData", "DEXA", location); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/PMIC_DEXA.js")); + addConfigSource("DEXA"); +// _showLocation = true; + } +} \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_PETFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_PETFormSection.java new file mode 100644 index 000000000..35f0b7394 --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_PETFormSection.java @@ -0,0 +1,29 @@ +package org.labkey.onprc_ehr.dataentry; + +import org.labkey.api.ehr.EHRService; +import org.labkey.api.view.template.ClientDependency; +import org.labkey.api.ehr.dataentry.SimpleGridPanel; + +/** + * User: Kolli + * Date: 7/7/19 + * Time: 10:36 AM + */ +public class PMIC_PETFormSection extends SimpleGridPanel +{ + public PMIC_PETFormSection() + { + this(EHRService.FORM_SECTION_LOCATION.Body); + } + + + public PMIC_PETFormSection(EHRService.FORM_SECTION_LOCATION location) + { + super("study", "PMIC_PETImagingData", "PET", location); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/PMIC_PET.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/PMIC_DoseCalcField.js")); + addConfigSource("PET"); +// _showLocation = true; + } + +} \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_SPECTFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_SPECTFormSection.java new file mode 100644 index 000000000..054ce8a4e --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_SPECTFormSection.java @@ -0,0 +1,27 @@ +package org.labkey.onprc_ehr.dataentry; + +import org.labkey.api.ehr.EHRService; +import org.labkey.api.view.template.ClientDependency; +import org.labkey.api.ehr.dataentry.SimpleGridPanel; + +/** + * User: Kolli + * Date: 7/7/19 + * Time: 10:36 AM + */ +public class PMIC_SPECTFormSection extends SimpleGridPanel +{ + public PMIC_SPECTFormSection() + { + this(EHRService.FORM_SECTION_LOCATION.Body); + } + + public PMIC_SPECTFormSection(EHRService.FORM_SECTION_LOCATION location) + { + super("study", "PMIC_SPECTImagingData", "SPECT", location); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/PMIC_SPECT.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/PMIC_SPECTDoseCalcField.js")); + addConfigSource("SPECT"); +// _showLocation = true; + } +} \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_USFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_USFormSection.java new file mode 100644 index 000000000..50a5670f0 --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMIC_USFormSection.java @@ -0,0 +1,26 @@ +package org.labkey.onprc_ehr.dataentry; + +import org.labkey.api.ehr.EHRService; +import org.labkey.api.view.template.ClientDependency; +import org.labkey.api.ehr.dataentry.SimpleGridPanel; + +/** + * User: Kolli + * Date: 7/7/19 + * Time: 10:36 AM + */ +public class PMIC_USFormSection extends SimpleGridPanel +{ + public PMIC_USFormSection() + { + this(EHRService.FORM_SECTION_LOCATION.Body); + } + + public PMIC_USFormSection(EHRService.FORM_SECTION_LOCATION location) + { + super("study", "PMIC_USImagingData", "Ultrasound", location); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/PMIC_US.js")); + addConfigSource("US"); +// _showLocation = true; + } +} \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java index 5c4632ef8..947c7ec6d 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -1099,14 +1099,14 @@ protected void pmicSchedulerAlert(final Container c, User u, final StringBuilder return; } //Daily events query - TableInfo ti = QueryService.get().getUserSchema(u, c, "extscheduler").getTable("PMIC_Scheduler_Daily"); - ((ContainerFilterable) ti).setContainerFilter(ContainerFilter.Type.AllFolders.create(c, u)); + TableInfo ti = QueryService.get().getUserSchema(u, c, "extscheduler").getTable("PMIC_Scheduler_Daily", ContainerFilter.Type.AllFolders.create(c, u)); + //((ContainerFilterable) ti).setContainerFilter(ContainerFilter.Type.AllFolders.create(c, u)); TableSelector ts = new TableSelector(ti, null, null); long count = ts.getRowCount(); //Weekly events query - TableInfo ti1 = QueryService.get().getUserSchema(u, c, "extscheduler").getTable("PMIC_Scheduler_Weekly"); - ((ContainerFilterable) ti1).setContainerFilter(ContainerFilter.Type.AllFolders.create(c, u)); + TableInfo ti1 = QueryService.get().getUserSchema(u, c, "extscheduler").getTable("PMIC_Scheduler_Weekly", ContainerFilter.Type.AllFolders.create(c, u)); + //((ContainerFilterable) ti1).setContainerFilter(ContainerFilter.Type.AllFolders.create(c, u)); TableSelector ts1 = new TableSelector(ti1, null, null); long count1 = ts1.getRowCount(); @@ -1152,16 +1152,16 @@ protected void pmicSchedulerAlert(final Container c, User u, final StringBuilder public void exec(ResultSet object) throws SQLException { Results rs = new ResultsImpl(object, colMap); msg.append(""); - msg.append("" + 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("" + PageFlowUtil.filter(rs.getString("resourceid")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("startdate")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("enddate")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("name")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("alias")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("quantity")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("comments")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("color")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("room")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("bldg")) + ""); msg.append(""); } }); @@ -1199,16 +1199,16 @@ public void exec(ResultSet object) throws SQLException { public void exec(ResultSet object) throws SQLException { Results rs1 = new ResultsImpl(object, colMap1); msg.append(""); - msg.append("" + 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("" + PageFlowUtil.filter(rs1.getString("resourceid")) + ""); + msg.append("" + PageFlowUtil.filter(rs1.getString("startdate")) + ""); + msg.append("" + PageFlowUtil.filter(rs1.getString("enddate")) + ""); + msg.append("" + PageFlowUtil.filter(rs1.getString("name")) + ""); + msg.append("" + PageFlowUtil.filter(rs1.getString("alias")) + ""); + msg.append("" + PageFlowUtil.filter(rs1.getString("quantity")) + ""); + msg.append("" + PageFlowUtil.filter(rs1.getString("comments")) + ""); + msg.append("" + PageFlowUtil.filter(rs1.getString("color")) + ""); + msg.append("" + PageFlowUtil.filter(rs1.getString("room")) + ""); + msg.append("" + PageFlowUtil.filter(rs1.getString("bldg")) + ""); msg.append(""); } }); @@ -1219,6 +1219,143 @@ public void exec(ResultSet object) throws SQLException { } //End of PMIC alert + /** + * Kollil, 03/24/2021 : PMIC services request alert + */ + protected void pmicServicesRequestAlert(final Container c, User u, final StringBuilder msg) + { + SimpleFilter filter = new SimpleFilter(FieldKey.fromString("date"), new Date(), CompareType.DATE_GTE); + TableSelector ts = new TableSelector(getStudySchema(c, u).getTable("PMIC_ServicesRequestAlert"), filter, null); + long count = ts.getRowCount(); + if (count > 0) + { + msg.append("" + count + " PMIC procedures found.
\n"); + msg.append("

Click here to view them
\n\n"); + msg.append("



"); + } + else + { + msg.append("WARNING: There are no scheduled PMIC procedures!

"); + } + } + //End of PMIC services alert + + /** + * Kollil, 03/18/2021 : Housing transfer notifications Daily + */ + protected void housingTransferAlert(final Container c, User u, final StringBuilder msg) + { + if (QueryService.get().getUserSchema(u, c, "onprc_ehr") == null) { + msg.append("Warning: The onprc_ehr schema has not been enabled in this folder, so the alert cannot run!


"); + return; + } + + //Daily transfers query + TableInfo ti = QueryService.get().getUserSchema(u, c, "onprc_ehr").getTable("housing_transfers", ContainerFilter.Type.AllFolders.create(c, u)); + //((ContainerFilterable) ti).setContainerFilter(ContainerFilter.Type.AllFolders.create(c, u)); + TableSelector ts = new TableSelector(ti, null, null); + long count = ts.getRowCount(); + + if (count > 0) {//transfers count + msg.append("" + count + " animal transfers were found in last 24 hours:"); + msg.append("

Click here to view them

\n"); + msg.append("
"); + } + + if (count == 0) { + msg.append("There were no animal transfers!"); + } + + //Display the daily report in the email + if (count > 0) { + Set columns = new HashSet<>(); + columns.add(FieldKey.fromString("Id")); + columns.add(FieldKey.fromString("Indate")); + columns.add(FieldKey.fromString("Building")); + columns.add(FieldKey.fromString("Area")); + columns.add(FieldKey.fromString("Room")); + columns.add(FieldKey.fromString("Cage")); + columns.add(FieldKey.fromString("housingType")); + columns.add(FieldKey.fromString("housingCondition")); + columns.add(FieldKey.fromString("ReasonForMove")); + columns.add(FieldKey.fromString("Remark")); + columns.add(FieldKey.fromString("TotalAnimals")); + columns.add(FieldKey.fromString("ActiveClinicalTreatment")); + + final Map colMap = QueryService.get().getColumns(ti, columns); + TableSelector ts2 = new TableSelector(ti, colMap.values(), null, null); + count = ts2.getRowCount(); + + msg.append("
Housing Transfers:

"); + //Legend + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append("
Yellow indicates animal transferred into an empty room
Blue indicates animal has active clinical treatments
"); + //Header + msg.append("

"); + msg.append(""); + msg.append(""); + + ts2.forEach(new Selector.ForEachBlock() { + @Override + public void exec(ResultSet object) throws SQLException { + Results rs = new ResultsImpl(object, colMap); + String url = getParticipantURL(c, rs.getString("Id")); + int animal_count = rs.getInt("TotalAnimals"); + + if ( animal_count == 0) { //high light the row in yellow if the room was empty before the move + msg.append(""); + if (rs.getString("ActiveClinicalTreatment") != null) { //High light with blue color if there are any active treatments + msg.append("\n"); + } + else { + msg.append("\n"); + } + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + } + else { + //msg.append("\n"); + if (rs.getString("ActiveClinicalTreatment") != null) { //High light with blue color if there are any active treatments + msg.append("\n"); + } + else { + msg.append("\n"); + } + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + } + + } + }); + msg.append("
Id In Date Building Area Room Cage Housing Type Housing Condition Reason For Move Remark Num animals before the transfer
" + PageFlowUtil.filter(rs.getString("Id")) + " " + PageFlowUtil.filter(rs.getString("Id")) + "" + PageFlowUtil.filter(rs.getString("InDate")) + "" + PageFlowUtil.filter(rs.getString("Building")) + "" + PageFlowUtil.filter(rs.getString("Area")) + "" + PageFlowUtil.filter(rs.getString("Room")) + "" + PageFlowUtil.filter(rs.getString("Cage")) + "" + PageFlowUtil.filter(rs.getString("housingType")) + "" + PageFlowUtil.filter(rs.getString("housingCondition")) + "" + PageFlowUtil.filter(rs.getString("ReasonForMove")) + "" + PageFlowUtil.filter(rs.getString("Remark")) + "" + PageFlowUtil.filter(rs.getInt("TotalAnimals")) + "
" + rs.getString("Id") + " " + PageFlowUtil.filter(rs.getString("Id")) + " " + PageFlowUtil.filter(rs.getString("Id")) + "" + PageFlowUtil.filter(rs.getString("InDate")) + "" + PageFlowUtil.filter(rs.getString("Building")) + "" + PageFlowUtil.filter(rs.getString("Area")) + "" + PageFlowUtil.filter(rs.getString("Room")) + "" + PageFlowUtil.filter(rs.getString("Cage")) + "" + PageFlowUtil.filter(rs.getString("housingType")) + "" + PageFlowUtil.filter(rs.getString("housingCondition")) + "" + PageFlowUtil.filter(rs.getString("ReasonForMove")) + "" + PageFlowUtil.filter(rs.getString("Remark")) + "" + PageFlowUtil.filter(rs.getInt("TotalAnimals")) + "
"); + + + } + } + //End of housing transfer alert + /** * we find protocols over the animal limit */ diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/HousingTransferNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/HousingTransferNotification.java new file mode 100644 index 000000000..94d0fadcd --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/HousingTransferNotification.java @@ -0,0 +1,59 @@ +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 on 03/18/2021 + */ + +public class HousingTransferNotification extends ColonyAlertsNotification +{ + public HousingTransferNotification(Module owner) + { + super(owner); + } + + @Override + public String getName() + { + return "Housing Transfers Notification"; + } + + @Override + public String getEmailSubject(Container c) + { + return "Housing Transfer Alerts: " + getDateTimeFormat(c).format(new Date()); + } + + @Override + public String getCronString() + { + return "0 0 16 * * ?"; + } + + @Override + public String getScheduleDescription() + { + return "every day at 4:00PM"; + } + + @Override + public String getDescription() + { + return "The report is designed to send housing transfer alerts daily!"; + } + + @Override + public String getMessageBodyHTML(Container c, User u) + { + StringBuilder msg = new StringBuilder(); + + housingTransferAlert(c, u, msg); + + return msg.toString(); + } +} \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/PMICSchedulerNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/PMICSchedulerNotification.java new file mode 100644 index 000000000..28bedca9a --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/PMICSchedulerNotification.java @@ -0,0 +1,59 @@ +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 on 10/24/2019. + */ + +public class PMICSchedulerNotification extends ColonyAlertsNotification +{ + public PMICSchedulerNotification(Module owner) + { + super(owner); + } + + @Override + public String getName() + { + return "PMIC Scheduler Notification"; + } + + @Override + public String getEmailSubject(Container c) + { + return "PMIC Scheduler 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 send PMIC scheduler alerts daily!"; + } + + @Override + public String getMessageBodyHTML(Container c, User u) + { + StringBuilder msg = new StringBuilder(); + + pmicSchedulerAlert(c, u, msg); + + return msg.toString(); + } +} \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/PMICServicesRequestNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/PMICServicesRequestNotification.java new file mode 100644 index 000000000..2379003cb --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/PMICServicesRequestNotification.java @@ -0,0 +1,61 @@ +package org.labkey.onprc_ehr.notification; + +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 java.util.Date; + +/** + * Created by Kollil on 03/18/2021 + */ + +public class PMICServicesRequestNotification extends ColonyAlertsNotification +{ + public PMICServicesRequestNotification(Module owner) + { + super(owner); + } + + @Override + public String getName() + { + return "PMIC Services Request Notification"; + } + + @Override + public String getEmailSubject(Container c) + { + return "PMIC Services Request Alerts: " + getDateTimeFormat(c).format(new Date()); + } + + @Override + public String getCronString() + { + return "0 15 7 ? * THU"; + } + + @Override + public String getScheduleDescription() + { + return "every Thursday at 7:15Am"; + } + + @Override + public String getDescription() + { + return "This runs every Thursday and sends alerts related to PMIC service requests!"; + } + + @Override + public String getMessageBodyHTML(Container c, User u) + { + StringBuilder msg = new StringBuilder(); + //msg.append("This email is designed to summarize pending or scheduled requests. It was run on: " + getDateFormat(c).format(now) + " at " + AbstractEHRNotification._timeFormat.format(now) + ".

"); + + pmicServicesRequestAlert(c, u, msg); + + return msg.toString(); + } +} \ No newline at end of file From aa54527abe39210b2906c1a3ecbf80d6ba139c60 Mon Sep 17 00:00:00 2001 From: josheckels Date: Wed, 31 Mar 2021 17:28:08 -0700 Subject: [PATCH 02/17] Disallow null Id values in onprc_ehr.AvailableBloodVolume, give it a PK (#114) --- extscheduler/module.properties | 3 +-- .../schemas/dbscripts/sqlserver/onprc_ehr-20.907-20.908.sql | 5 +++++ onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.907-20.908.sql diff --git a/extscheduler/module.properties b/extscheduler/module.properties index 446b2b018..cfa1b282e 100644 --- a/extscheduler/module.properties +++ b/extscheduler/module.properties @@ -1,6 +1,5 @@ Name: extscheduler ModuleClass: org.labkey.extscheduler.ExtSchedulerModule -ModuleDependencies: LDK SupportedDatabases: mssql RequiredServerVersion: 15.2 -ManageVersion: false \ No newline at end of file +ManageVersion: false diff --git a/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.907-20.908.sql b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.907-20.908.sql new file mode 100644 index 000000000..4cf1b33f2 --- /dev/null +++ b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.907-20.908.sql @@ -0,0 +1,5 @@ +ALTER TABLE onprc_ehr.AvailableBloodVolume ALTER COLUMN Id nvarchar(32) NOT NULL; +GO + +ALTER TABLE onprc_ehr.AvailableBloodVolume ADD CONSTRAINT PK_AvailableBloodVolume PRIMARY KEY (Id); +GO diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java index 3c8a13650..1d5ebfe8b 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java @@ -120,7 +120,7 @@ public String getName() @Override public @Nullable Double getSchemaVersion() { - return 20.907; + return 20.908; } @Override From b988ff10db7f1ab97fff81cda7ee04fe6b164cf0 Mon Sep 17 00:00:00 2001 From: Lakshmi Kolli <69940873+kollil@users.noreply.github.com> Date: Mon, 5 Apr 2021 10:23:19 -0700 Subject: [PATCH 03/17] ETL job time changed (#138) The change is tested on prime20test and ready to be put in uat & production. --- onprc_ehr/resources/etls/HousingTransferAlert_Process.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onprc_ehr/resources/etls/HousingTransferAlert_Process.xml b/onprc_ehr/resources/etls/HousingTransferAlert_Process.xml index 96e498987..fc5361d48 100644 --- a/onprc_ehr/resources/etls/HousingTransferAlert_Process.xml +++ b/onprc_ehr/resources/etls/HousingTransferAlert_Process.xml @@ -19,8 +19,8 @@ - - + + From beff13cd5c1188b473a74db3b1ba296c9c133df4 Mon Sep 17 00:00:00 2001 From: Lakshmi Kolli <69940873+kollil@users.noreply.github.com> Date: Wed, 7 Apr 2021 09:48:14 -0700 Subject: [PATCH 04/17] Added changes to PMIC project (#135) * - Added code to hide the "ChargeType" and "CreditTo" fields from all PMIC data entry panels. - Added a new db field "Instance" to extscheduler.Resources to solve the container issue. * Instance field is added to xml. * Added a new query and updated the PMIC daily & weekly sql to get the folder name * Changed the file name to be relevant * Updated the sql name in both files * Changed a field name in all 3 queries to stay in-sync with the notification field names. * resourceid field is case sensitive * Added sql to display the PMIC data on animal history Imaging tab * Added the query filter to the PMIC daily & weekly alert urls to include "All folders" --- .../extscheduler/PMIC_Scheduler_Daily.sql | 4 ++-- .../extscheduler/PMIC_Scheduler_Weekly.sql | 5 ++-- .../extscheduler/PMIC_getFolderInfo.sql | 12 ++++++++++ .../sqlserver/extscheduler-21.001-21.002.sql | 1 + .../resources/schemas/extscheduler.xml | 1 + .../extscheduler/ExtSchedulerModule.java | 2 +- .../queries/study/PET_CT_AnimalHistory.sql | 21 +++++++++++++++++ .../study/PMIC_Angio_AnimalHistory.sql | 18 +++++++++++++++ .../queries/study/PMIC_DEXA_AnimalHistory.sql | 15 ++++++++++++ .../queries/study/PMIC_PET_AnimalHistory.sql | 23 +++++++++++++++++++ .../study/PMIC_SPECT_AnimalHistory.sql | 22 ++++++++++++++++++ .../queries/study/PMIC_US_AnimalHistory.sql | 15 ++++++++++++ .../web/onprc_ehr/model/sources/PMIC_Angio.js | 3 ++- .../web/onprc_ehr/model/sources/PMIC_CT.js | 3 ++- .../web/onprc_ehr/model/sources/PMIC_DEXA.js | 3 ++- .../web/onprc_ehr/model/sources/PMIC_PET.js | 3 ++- .../web/onprc_ehr/model/sources/PMIC_SPECT.js | 3 ++- .../web/onprc_ehr/model/sources/PMIC_US.js | 3 ++- .../ColonyAlertsNotification.java | 4 ++-- 19 files changed, 147 insertions(+), 14 deletions(-) create mode 100644 extscheduler/resources/queries/extscheduler/PMIC_getFolderInfo.sql create mode 100644 extscheduler/resources/schemas/dbscripts/sqlserver/extscheduler-21.001-21.002.sql create mode 100644 onprc_ehr/resources/queries/study/PET_CT_AnimalHistory.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_Angio_AnimalHistory.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_DEXA_AnimalHistory.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_PET_AnimalHistory.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_SPECT_AnimalHistory.sql create mode 100644 onprc_ehr/resources/queries/study/PMIC_US_AnimalHistory.sql diff --git a/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql index 999ae1f67..0ae451d2f 100644 --- a/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql +++ b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql @@ -3,7 +3,7 @@ Created by: Kolli on 10/24/2019 This query filters all the PMIC daily events */ SELECT - r.name as resourceid, + r.resourceid, e.startdate, e.enddate, e.name, @@ -17,7 +17,7 @@ SELECT e.createdby, e.modifiedby, e.modified -FROM Events e, Resources r +FROM Events e, PMIC_getFolderInfo r Where r.id = e.resourceid --And e.container = '783D2EA5-C6AC-1036-A33C-BD25D0574070' And CAST(e.startDate AS DATE) = curdate() --Show only PMIC events \ No newline at end of file diff --git a/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql index c2c6c087a..117b1bb9c 100644 --- a/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql +++ b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql @@ -3,7 +3,7 @@ Created by: Kolli on 11/14/2019 Weekly report: This query filters all the PMIC events from today to the next 7 days */ SELECT - r.name as resourceid, + r.resourceid, e.startdate, e.enddate, e.name, @@ -17,8 +17,7 @@ SELECT e.createdby, e.modifiedby, e.modified -FROM Events e, Resources r +FROM Events e, PMIC_getFolderInfo r Where r.id = e.resourceid --And e.container = '783D2EA5-C6AC-1036-A33C-BD25D0574070' -- PMIC container And CAST(e.startDate AS DATE) BETWEEN curdate() and TIMESTAMPADD('SQL_TSI_DAY', 7, curdate()) ---Where r.id = e.resourceid And e.container = 'E1CFA5B8-FAD2-1034-A87D-5107380A72B9' -- for testing \ No newline at end of file diff --git a/extscheduler/resources/queries/extscheduler/PMIC_getFolderInfo.sql b/extscheduler/resources/queries/extscheduler/PMIC_getFolderInfo.sql new file mode 100644 index 000000000..99f71d8d8 --- /dev/null +++ b/extscheduler/resources/queries/extscheduler/PMIC_getFolderInfo.sql @@ -0,0 +1,12 @@ +SELECT +r.Id, +r.name as resourceid, +r.color, +r.room, +r.bldg, +r.Container, +c.name as FolderName +FROM Resources r, core.Containers c +Where c.EntityId = r.container +And c.name like 'PMIC Scheduler' + diff --git a/extscheduler/resources/schemas/dbscripts/sqlserver/extscheduler-21.001-21.002.sql b/extscheduler/resources/schemas/dbscripts/sqlserver/extscheduler-21.001-21.002.sql new file mode 100644 index 000000000..ffc8359a2 --- /dev/null +++ b/extscheduler/resources/schemas/dbscripts/sqlserver/extscheduler-21.001-21.002.sql @@ -0,0 +1 @@ +ALTER TABLE extscheduler.Resources ADD Instance varchar(50); \ No newline at end of file diff --git a/extscheduler/resources/schemas/extscheduler.xml b/extscheduler/resources/schemas/extscheduler.xml index 60ed7c87d..e1234afe5 100644 --- a/extscheduler/resources/schemas/extscheduler.xml +++ b/extscheduler/resources/schemas/extscheduler.xml @@ -10,6 +10,7 @@ + true diff --git a/extscheduler/src/org/labkey/extscheduler/ExtSchedulerModule.java b/extscheduler/src/org/labkey/extscheduler/ExtSchedulerModule.java index c87f2b790..e35ac332f 100644 --- a/extscheduler/src/org/labkey/extscheduler/ExtSchedulerModule.java +++ b/extscheduler/src/org/labkey/extscheduler/ExtSchedulerModule.java @@ -27,7 +27,7 @@ public String getName() @Override public @Nullable Double getSchemaVersion() { - return 20.937; + return 21.002; } @Override diff --git a/onprc_ehr/resources/queries/study/PET_CT_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PET_CT_AnimalHistory.sql new file mode 100644 index 000000000..f3f0d1cb0 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PET_CT_AnimalHistory.sql @@ -0,0 +1,21 @@ +SELECT + Id, + Date, + examNum, + accessionNum, + PMICType, + contrastType, + contrastAmount, + route, + CTDIvol, + DLP, + totalExamDLP, + wetLabUse, + remark, + imageUploadLink, + taskid, + qcstate, + performedby, + created, + createdBy +from study.PMIC_CTImagingData \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_Angio_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_Angio_AnimalHistory.sql new file mode 100644 index 000000000..fbe7e05ca --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_Angio_AnimalHistory.sql @@ -0,0 +1,18 @@ +SELECT + Id, + Date, + examNum, + accessionNum, + PMICType, + CTDIvol, + DLP, + totalExamDLP, + wetLabUse, + remark, + imageUploadLink, + taskid, + qcstate, + performedby, + created, + createdBy +from study.PMIC_AngioImagingData \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_DEXA_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_DEXA_AnimalHistory.sql new file mode 100644 index 000000000..78caaf2bb --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_DEXA_AnimalHistory.sql @@ -0,0 +1,15 @@ +SELECT + Id, + Date, + examNum, + accessionNum, + PMICType, + DEXAProcedure, + animalPosition, + remark, + taskid, + qcstate, + performedby, + created, + createdBy +from study.PMIC_DEXAImagingData \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_PET_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_PET_AnimalHistory.sql new file mode 100644 index 000000000..71a646e3d --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_PET_AnimalHistory.sql @@ -0,0 +1,23 @@ +SELECT + Id, + Date, + examNum, + accessionNum, + PMICType, + PETRadioisotope, + PETDoseMCI, + PETDoseMBQ, + route, + CTDIvol, + DLP, + totalExamDLP, + phantom, + wetLabUse, + ligandAndComments, + imageUploadLink, + taskid, + qcstate, + performedby, + created, + createdBy +from study.PMIC_PETImagingData diff --git a/onprc_ehr/resources/queries/study/PMIC_SPECT_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_SPECT_AnimalHistory.sql new file mode 100644 index 000000000..e8d038fae --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_SPECT_AnimalHistory.sql @@ -0,0 +1,22 @@ +SELECT + Id, + Date, + examNum, + accessionNum, + PMICType, + SPECTIsotope, + SPECTDoseMCI, + SPECTDoseMBQ, + route, + CTDIvol, + DLP, + totalExamDLP, + wetLabUse, + ligandAndComments, + imageUploadLink, + taskid, + qcstate, + performedby, + created, + createdBy +from study.PMIC_SPECTImagingData \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_US_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_US_AnimalHistory.sql new file mode 100644 index 000000000..4a9f7e09e --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_US_AnimalHistory.sql @@ -0,0 +1,15 @@ +SELECT + Id, + Date, + examNum, + accessionNum, + PMICType, + ultrasoundProcedure, + wetLabUse, + remark, + taskid, + qcstate, + performedby, + created, + createdBy +from study.PMIC_USImagingData \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js index 729f97ff0..0a0a4dce6 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js @@ -24,6 +24,7 @@ EHR.model.DataModelManager.registerMetadata('Angio', { project: { allowBlank: true, + hidden: true, columnConfig: { width: 150 } @@ -32,7 +33,7 @@ EHR.model.DataModelManager.registerMetadata('Angio', { chargeType: { allowBlank: true, defaultValue: 'PMIC', - hidden: false + hidden: true }, examNum: { diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js index c190269f9..1e41eebef 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js @@ -25,6 +25,7 @@ EHR.model.DataModelManager.registerMetadata('CT', { project: { allowBlank: true, + hidden: true, columnConfig: { width: 150 } @@ -33,7 +34,7 @@ EHR.model.DataModelManager.registerMetadata('CT', { chargeType: { allowBlank: true, defaultValue: 'PMIC', - hidden: false + hidden: true }, examNum: { diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js index cb1ff2f12..88a3bd1cc 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js @@ -24,6 +24,7 @@ EHR.model.DataModelManager.registerMetadata('DEXA', { project: { allowBlank: true, + hidden: true, columnConfig: { width: 150 } @@ -32,7 +33,7 @@ EHR.model.DataModelManager.registerMetadata('DEXA', { chargeType: { allowBlank: true, defaultValue: 'PMIC', - hidden: false + hidden: true }, examNum: { 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 aa925c2e3..d5eb5e413 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 @@ -25,6 +25,7 @@ EHR.model.DataModelManager.registerMetadata('PET', { project: { allowBlank: true, + hidden: true, columnConfig: { width: 150 } @@ -33,7 +34,7 @@ EHR.model.DataModelManager.registerMetadata('PET', { chargeType: { allowBlank: true, defaultValue: 'PMIC', - hidden: false + hidden: true }, examNum: { diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js index 9885ae35a..52d958ea7 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js @@ -25,6 +25,7 @@ EHR.model.DataModelManager.registerMetadata('SPECT', { project: { allowBlank: true, + hidden: true, columnConfig: { width: 150 } @@ -33,7 +34,7 @@ EHR.model.DataModelManager.registerMetadata('SPECT', { chargeType: { allowBlank: true, defaultValue: 'PMIC', - hidden: false + hidden: true }, examNum: { diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js index f5bb694fe..c6e3db70d 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js @@ -24,6 +24,7 @@ EHR.model.DataModelManager.registerMetadata('US', { project: { allowBlank: true, + hidden: true, columnConfig: { width: 150 } @@ -32,7 +33,7 @@ EHR.model.DataModelManager.registerMetadata('US', { chargeType: { allowBlank: true, defaultValue: 'PMIC', - hidden: false + hidden: true }, examNum: { diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java index 947c7ec6d..28bb432ea 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -1112,12 +1112,12 @@ protected void pmicSchedulerAlert(final Container c, User u, final StringBuilder if (count > 0) {//Daily events count msg.append("There are " + count + " PMIC events scheduled for today:"); - msg.append("

Click here to view them

\n"); + msg.append("

Click here to view them

\n"); msg.append("
"); } if (count1 > 0) {//Weekly events count msg.append("There are " + count1 + " PMIC events scheduled this week:"); - msg.append("

Click here to view them

\n"); + msg.append("

Click here to view them

\n"); msg.append("
"); } //Display the daily report in the email From c2ed3281f88770325f685924f68f65f30cf41f8d Mon Sep 17 00:00:00 2001 From: Lakshmi Kolli <69940873+kollil@users.noreply.github.com> Date: Mon, 12 Apr 2021 14:51:16 -0700 Subject: [PATCH 05/17] A new notes alert added to Behavior alerts (#139) The alert is tested in test and uat environment and ready to be merged to master branch. --- .../notification/BehaviorNotification.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java index 105ce5dd1..51ee3f43e 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java @@ -146,8 +146,11 @@ private void NHPTraining_BehaviorAlert(final Container c, User u, final StringBu } /* - Kollil, 11/18/20: 1. New alert for DCM notes (category = notes pertaining to DAR) added the previous day. - 2. New alert for Flags added the previous day. + Kollil, Created: 11/18/20, Modified: 04/07/2021 + 1. New alert for DCM notes (category = notes pertaining to DAR) added the previous day. + 2. New alert for DCM notes (category = notes pertaining to DAR) removed the previous day. + 3. New alert for Flags added the previous day. + 4. New alert for Flags removed the previous day. */ protected void dcmNotesAlert(final Container c, User u, final StringBuilder msg) { @@ -174,6 +177,22 @@ protected void dcmNotesAlert(final Container c, User u, final StringBuilder msg) msg.append("WARNING: No DCM notes added yesterday where \"Category = Notes pertaining to DAR\"!

"); } + //Added by Kollil on 04/07/2021 + //New alert for DCM notes (category = notes pertaining to DAR) removed the previous day. + SimpleFilter filter4 = new SimpleFilter(FieldKey.fromString("enddate"), cal.getTime(), CompareType.DATE_EQUAL); + filter4.addCondition(FieldKey.fromString("category"), "Notes Pertaining to DAR", CompareType.EQUAL); + TableSelector ts4 = new TableSelector(getStudySchema(c, u).getTable("notes"), filter4, null); + long count4 = ts4.getRowCount(); + + if (count4 > 0) { + msg.append("" + count4 + " DCM notes entries removed yesterday where \"Category = Notes pertaining to DAR\".
\n"); + msg.append("

Click here to view them
\n\n"); + msg.append("



\n\n"); + } + else { + msg.append("WARNING: No DCM notes removed yesterday where \"Category = Notes pertaining to DAR\"!

"); + } + //Added by Kollil on 11/04/2020 //New alert for Flags added the previous day. SimpleFilter filter2 = new SimpleFilter(FieldKey.fromString("created"), cal.getTime(), CompareType.DATE_EQUAL); From 165a8ba656a41d90b809e36784149b929080aaad Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Tue, 13 Apr 2021 09:31:10 -0700 Subject: [PATCH 06/17] Restored the option button menu that allows users to print a report to a pdf file. (#141) --- .../resources/views/printableReports.html | 628 ++++++++---------- 1 file changed, 290 insertions(+), 338 deletions(-) diff --git a/onprc_ehr/resources/views/printableReports.html b/onprc_ehr/resources/views/printableReports.html index f1d335528..04d279167 100644 --- a/onprc_ehr/resources/views/printableReports.html +++ b/onprc_ehr/resources/views/printableReports.html @@ -169,25 +169,35 @@ if (!url) return; - window.open(url); - } - - }] - },{ - xtype: 'button', - style: 'margin-left: 5px;', - text: 'Online Version', - border: true, - handler: function(btn){ - var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); - url += btn.up('#sheetPanel').getAnimalHistoryHash('cases'); - window.open(url); - } - },{ - html: '
', - style: 'padding-top: 10px;', - colspan: 4 - },{ + window.open(url); + } + },{ + text: 'Print To PDF', + handler: function(menu){ + var btn = menu.up('button'); + var url = btn.getUrlString(); + if (!url) + return; + + url += '&rs:Format=PDF'; + window.open(url); + } + }] + },{ + xtype: 'button', + style: 'margin-left: 5px;', + text: 'Online Version', + border: true, + handler: function(btn){ + var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); + url += btn.up('#sheetPanel').getAnimalHistoryHash('cases'); + window.open(url); + } + },{ + html: '
', + style: 'padding-top: 10px;', + colspan: 4 + },{ html: 'Open Clinical Cases:' },{ @@ -228,48 +238,58 @@ if (!url) return; - window.open(url); - } - - }] - },{ - xtype: 'button', - style: 'margin-left: 5px;', - text: 'Online Version', - border: true, - handler: function(btn){ - var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); - url += btn.up('#sheetPanel').getAnimalHistoryHash('cases'); - window.open(url); - } - },{ - html: '
', - style: 'padding-top: 10px;', - colspan: 4 - },{ - html: 'Clinical Medications:' - },{ - style: 'padding-left: 10px;', - items: [{ - xtype: 'datefield', - fieldLabel: 'Date', - itemId: 'medicationDateField', - value: new Date(), - allowBlank: false - },{ - xtype: 'ehr-timeofdayfield', - itemId: 'medicationTimeOfDayField' - }] - },{ - xtype: 'button', - style: 'margin-left: 5px;', - text: 'Print Version', - border: true, - getUrlString: function(){ - var panel = this.up('#sheetPanel'); - var params = panel.getParams(true, true); - if (!params) - return; + window.open(url); + } + },{ + text: 'Print To PDF', + handler: function(menu){ + var btn = menu.up('button'); + var url = btn.getUrlString(); + if (!url) + return; + + url += '&rs:Format=PDF'; + window.open(url); + } + }] + },{ + xtype: 'button', + style: 'margin-left: 5px;', + text: 'Online Version', + border: true, + handler: function(btn){ + var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); + url += btn.up('#sheetPanel').getAnimalHistoryHash('cases'); + window.open(url); + } + },{ + html: '
', + style: 'padding-top: 10px;', + colspan: 4 + },{ + html: 'Clinical Medications:' + },{ + style: 'padding-left: 10px;', + items: [{ + xtype: 'datefield', + fieldLabel: 'Date', + itemId: 'medicationDateField', + value: new Date(), + allowBlank: false + },{ + xtype: 'ehr-timeofdayfield', + itemId: 'medicationTimeOfDayField' + }] + },{ + xtype: 'button', + style: 'margin-left: 5px;', + text: 'Print Version', + border: true, + getUrlString: function(){ + var panel = this.up('#sheetPanel'); + var params = panel.getParams(true, true); + if (!params) + return; if (params.Rooms) params.Rooms = params.Rooms.join(';'); @@ -309,73 +329,30 @@ if (!url) return; - window.open(url); - } - }] - },{ - xtype: 'button', - style: 'margin-left: 5px;', - text: 'Online Version', - border: true, - handler: function(btn){ - var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); - url += btn.up('#sheetPanel').getAnimalHistoryHash('clinMedicationSchedule'); - window.open(url); - } - },{ - html: '
', - style: 'padding-top: 10px;', - colspan: 4 - },{ - - html: 'Sustained Release Medications:' - - },{ - - style: 'padding-left: 60px;', - + window.open(url); + } + },{ + text: 'Print To PDF', + handler: function(menu){ + var btn = menu.up('button'); + var url = btn.getUrlString(); + if (!url) + return; + url += '&rs:Format=PDF'; + window.open(url); + } + }] },{ xtype: 'button', style: 'margin-left: 5px;', - text: 'Print Version', - + text: 'Online Version', border: true, - getUrlString: function(){ - var panel = this.up('#sheetPanel'); - var params = panel.getParams(true, true); - if (!params) - return; - - if (params.Rooms) - params.Rooms = params.Rooms.join(';'); - - - Ext4.apply(params, { - 'rs:ClearSession': true, - 'rs:Command': 'render' - }); - - var url = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSServerURL'); - var ssrsFolder = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSReportFolder'); - ssrsFolder = '/' + ssrsFolder + '/' + 'Clinical/ActiveTreatments_72hr'; - - url += ssrsFolder + '&' + LABKEY.ActionURL.queryString(params); - return url; - }, - menu: [{ - text: 'Print', - handler: function(menu){ - var btn = menu.up('button'); - var url = btn.getUrlString(); - if (!url) - return; - - window.open(url); - } - - }] - + handler: function(btn){ + var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); + url += btn.up('#sheetPanel').getAnimalHistoryHash('clinMedicationSchedule'); + window.open(url); + } },{ style: 'margin-left: 5px;', @@ -447,39 +424,49 @@ if (!url) return; - window.open(url); - } - - }] - },{ - xtype: 'button', - style: 'margin-left: 5px;', - text: 'Online Version', - border: true, - handler: function(btn){ - var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); - url += btn.up('#sheetPanel').getAnimalHistoryHash('diet'); - window.open(url); - } - },{ - html: '
', - style: 'padding-top: 10px;', - colspan: 4 - },{ - html: 'Open Surgical Cases:' - },{ - style: 'padding-left: 10px;', - html: '' - },{ - xtype: 'button', - style: 'margin-left: 5px;', - text: 'Print Version', - border: true, - getUrlString: function(){ - var panel = this.up('#sheetPanel'); - var params = panel.getParams(true, true); - if (!params) - return; + window.open(url); + } + },{ + text: 'Print To PDF', + handler: function(menu){ + var btn = menu.up('button'); + var url = btn.getUrlString(); + if (!url) + return; + + url += '&rs:Format=PDF'; + window.open(url); + } + }] + },{ + xtype: 'button', + style: 'margin-left: 5px;', + text: 'Online Version', + border: true, + handler: function(btn){ + var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); + url += btn.up('#sheetPanel').getAnimalHistoryHash('diet'); + window.open(url); + } + },{ + html: '
', + style: 'padding-top: 10px;', + colspan: 4 + },{ + html: 'Open Surgical Cases:' + },{ + style: 'padding-left: 10px;', + html: '' + },{ + xtype: 'button', + style: 'margin-left: 5px;', + text: 'Print Version', + border: true, + getUrlString: function(){ + var panel = this.up('#sheetPanel'); + var params = panel.getParams(true, true); + if (!params) + return; if (params.Rooms) params.Rooms = params.Rooms.join(';'); @@ -504,48 +491,58 @@ if (!url) return; - window.open(url); - } + window.open(url); + } + },{ + text: 'Print To PDF', + handler: function(menu){ + var btn = menu.up('button'); + var url = btn.getUrlString(); + if (!url) + return; - }] - },{ - xtype: 'button', - style: 'margin-left: 5px;', - text: 'Online Version', - border: true, - handler: function(btn){ - var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); - url += btn.up('#sheetPanel').getAnimalHistoryHash('surgicalCases'); - window.open(url); - } - },{ - html: '
', - style: 'padding-top: 10px;', - colspan: 4 - },{ - html: 'Surgical Medications:' - },{ - style: 'padding-left: 10px;', - items: [{ - xtype: 'datefield', - fieldLabel: 'Date', - itemId: 'surgicalMedicationDateField', - value: new Date(), - allowBlank: false - },{ - xtype: 'ehr-timeofdayfield', - itemId: 'surgicalMedicationTimeOfDayField' - }] - },{ - xtype: 'button', - style: 'margin-left: 5px;', - text: 'Print Version', - border: true, - getUrlString: function(){ - var panel = this.up('#sheetPanel'); - var params = panel.getParams(true, true); - if (!params) - return; + url += '&rs:Format=PDF'; + window.open(url); + } + }] + },{ + xtype: 'button', + style: 'margin-left: 5px;', + text: 'Online Version', + border: true, + handler: function(btn){ + var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); + url += btn.up('#sheetPanel').getAnimalHistoryHash('surgicalCases'); + window.open(url); + } + },{ + html: '
', + style: 'padding-top: 10px;', + colspan: 4 + },{ + html: 'Surgical Medications:' + },{ + style: 'padding-left: 10px;', + items: [{ + xtype: 'datefield', + fieldLabel: 'Date', + itemId: 'surgicalMedicationDateField', + value: new Date(), + allowBlank: false + },{ + xtype: 'ehr-timeofdayfield', + itemId: 'surgicalMedicationTimeOfDayField' + }] + },{ + xtype: 'button', + style: 'margin-left: 5px;', + text: 'Print Version', + border: true, + getUrlString: function(){ + var panel = this.up('#sheetPanel'); + var params = panel.getParams(true, true); + if (!params) + return; if (params.Rooms) params.Rooms = params.Rooms.join(';'); @@ -585,73 +582,36 @@ if (!url) return; - window.open(url); - } - - }] - },{ - xtype: 'button', - style: 'margin-left: 5px;', - text: 'Online Version', - border: true, - handler: function(btn){ - var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); - url += btn.up('#sheetPanel').getAnimalHistoryHash('surgMedicationSchedule'); - window.open(url); - } - },{ - html: '
', - style: 'padding-top: 10px;', - colspan: 4 - },{ - html: 'Weight Sheets:' - },{ - style: 'padding-left: 5px;', - html: '' - },{ - xtype: 'button', - style: 'margin-left: 5px;', - text: 'Print Version', - border: true, - getUrlString: function(){ - var panel = this.up('#sheetPanel'); - var params = panel.getParams(); - if (!params) - return; - - Ext4.apply(params, { - 'rs:ClearSession': true, - 'rs:Command': 'render' - }); - - var url = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSServerURL'); - var ssrsFolder = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSReportFolder'); - ssrsFolder = '/' + ssrsFolder + '/' + 'Clinical/WeightSheetsNew'; - - url += ssrsFolder + '&' + LABKEY.ActionURL.queryString(params); - return url; - }, - menu: [{ - text: 'Print', - handler: function(menu){ - var btn = menu.up('button'); - var url = btn.getUrlString(); - if (!url) - return; - - window.open(url); - } - - }] - },{ - html: '' - },{ - html: '
', - style: 'padding-top: 10px;', - colspan: 4 + window.open(url); + } + },{ + text: 'Print To PDF', + handler: function(menu){ + var btn = menu.up('button'); + var url = btn.getUrlString(); + if (!url) + return; + url += '&rs:Format=PDF'; + window.open(url); + } + }] },{ - html: 'Weight Sheets by Breeding Groups:' //Added: 2-28-2017 R.Blasa + xtype: 'button', + style: 'margin-left: 5px;', + text: 'Online Version', + border: true, + handler: function(btn){ + var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); + url += btn.up('#sheetPanel').getAnimalHistoryHash('surgMedicationSchedule'); + window.open(url); + } + },{ + html: '
', + style: 'padding-top: 10px;', + colspan: 4 + },{ + html: 'Weight Sheets:' },{ style: 'padding-left: 5px;', html: '' @@ -662,23 +622,10 @@ border: true, getUrlString: function(){ var panel = this.up('#sheetPanel'); - var field = panel.down('#animalGroup'); - - var value = field.getValue() || []; - value = Ext4.isArray(value) ? value: [value]; - - var params = { - SessionId: LABKEY.Utils.getSessionID(), - HostName: location.hostname - - }; - if (!value) + var params = panel.getParams(); + if (!params) return; - if (!Ext4.isEmpty(value)) - params.Groups = value; - - Ext4.apply(params, { 'rs:ClearSession': true, 'rs:Command': 'render' @@ -686,7 +633,7 @@ var url = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSServerURL'); var ssrsFolder = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSReportFolder'); - ssrsFolder = '/' + ssrsFolder + '/' + 'Clinical/WeightSheetsGroup'; + ssrsFolder = '/' + ssrsFolder + '/' + 'Clinical/WeightSheetsNew'; url += ssrsFolder + '&' + LABKEY.ActionURL.queryString(params); return url; @@ -699,11 +646,20 @@ if (!url) return; - window.open(url); - } - - }] + window.open(url); + } + },{ + text: 'Print To PDF', + handler: function(menu){ + var btn = menu.up('button'); + var url = btn.getUrlString(); + if (!url) + return; + url += '&rs:Format=PDF'; + window.open(url); + } + }] },{ html: '' },{ @@ -712,7 +668,7 @@ colspan: 4 },{ - html: 'Weight Sheets by Monkey ID:' //Added: 7-27-2017 R.Blasa + html: 'Weight Sheets by Breeding Groups:' //Added: 2-28-2017 R.Blasa },{ style: 'padding-left: 5px;', html: '' @@ -721,37 +677,23 @@ style: 'margin-left: 5px;', text: 'Print Version', border: true, - getUrlString: function(){ - var panel = this.up('#sheetPanel'); - var field = panel.down('#animalField'); - - var val = field.getValue() || []; - - - if (val){ - val = Ext4.String.trim(val); - val = val.replace(/[\s,;]+/g, ';'); - val = val.replace(/(^;|;$)/g, ''); - - val = val ? val.split(';') : []; - } + getUrlString: function(){ + var panel = this.up('#sheetPanel'); + var field = panel.down('#animalGroup'); - if (!val){ - Ext4.Msg.alert('Error', 'Must enter at least one animal Id'); - return; - } - value = Ext4.isArray(val) ? val: [val]; + var value = field.getValue() || []; + value = Ext4.isArray(value) ? value: [value]; var params = { SessionId: LABKEY.Utils.getSessionID(), HostName: location.hostname }; - if (!val) + if (!value) return; if (!Ext4.isEmpty(value)) - params.AnimalID = val; + params.Groups = value; Ext4.apply(params, { @@ -761,7 +703,7 @@ var url = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSServerURL'); var ssrsFolder = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSReportFolder'); - ssrsFolder = '/' + ssrsFolder + '/' + 'Clinical/WeightSheetsID'; + ssrsFolder = '/' + ssrsFolder + '/' + 'Clinical/WeightSheetsGroup'; url += ssrsFolder + '&' + LABKEY.ActionURL.queryString(params); return url; @@ -774,40 +716,50 @@ if (!url) return; - window.open(url); - } + window.open(url); + } + },{ + text: 'Print To PDF', + handler: function(menu){ + var btn = menu.up('button'); + var url = btn.getUrlString(); + if (!url) + return; - }] - },{ - html: '' - },{ - html: '
', - style: 'padding-top: 10px;', - colspan: 4 - },{ - html: 'Room Utilization / Layout:', - width: 200 - },{ - style: 'margin-left: 5px;', - xtype: 'checkbox', - fieldLabel: 'Invert C/D Rows?', - labelWidth: 140, - itemId: 'doInvertRows', - checked: false - },{ - xtype: 'button', - style: 'margin-left: 5px;', - text: 'Print Version', - itemId: 'roomBtn', - border: true, - getUrlParams: function(){ - var panel = this.up('#sheetPanel'); - var area = panel.down('#areaField').getValue(); - var rooms = panel.down('#roomField').getValue(); - if (Ext4.isEmpty(area) && Ext4.isEmpty(rooms)){ - Ext4.Msg.alert('Error', 'Must provide a room or area'); - return; - } + url += '&rs:Format=PDF'; + window.open(url); + } + }] + },{ + html: '' + },{ + html: '
', + style: 'padding-top: 10px;', + colspan: 4 + },{ + html: 'Room Utilization / Layout:', + width: 200 + },{ + style: 'margin-left: 5px;', + xtype: 'checkbox', + fieldLabel: 'Invert C/D Rows?', + labelWidth: 140, + itemId: 'doInvertRows', + checked: false + },{ + xtype: 'button', + style: 'margin-left: 5px;', + text: 'Print Version', + itemId: 'roomBtn', + border: true, + getUrlParams: function(){ + var panel = this.up('#sheetPanel'); + var area = panel.down('#areaField').getValue(); + var rooms = panel.down('#roomField').getValue(); + if (Ext4.isEmpty(area) && Ext4.isEmpty(rooms)){ + Ext4.Msg.alert('Error', 'Must provide a room or area'); + return; + } var params = { doRowInversion: panel.down('#doInvertRows').getValue() ? 1 : 0 From 9e21a5e32ad08027fd4a5918bd77b51ac40ae04a Mon Sep 17 00:00:00 2001 From: Lakshmi Kolli <69940873+kollil@users.noreply.github.com> Date: Thu, 15 Apr 2021 16:34:42 -0700 Subject: [PATCH 07/17] Color coding the cells in query.xml (#140) * Color coding the cells in query.xml * Changed the date filter in the query. * Renamed a PMIC file. * Updated the housing color coding for diets --- .../onprc_ehr/housing_transfers.query.xml | 68 +++++++++++++++++++ .../queries/onprc_ehr/housing_transfers.sql | 9 ++- ...lHistory.sql => PMIC_CT_AnimalHistory.sql} | 0 .../ColonyAlertsNotification.java | 37 ++++++---- 4 files changed, 99 insertions(+), 15 deletions(-) create mode 100644 onprc_ehr/resources/queries/onprc_ehr/housing_transfers.query.xml rename onprc_ehr/resources/queries/study/{PET_CT_AnimalHistory.sql => PMIC_CT_AnimalHistory.sql} (100%) diff --git a/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.query.xml b/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.query.xml new file mode 100644 index 000000000..c90fabf37 --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.query.xml @@ -0,0 +1,68 @@ + + + + + Housing Transfer Alert + + + + Active Treatments? + + + + + + + 00FFFF + + + + + Active Diets? + + + + + + + FFA500 + + + + + In Date + + + + + + + Housing Type + column> + + Housing Condition + column> + + Reason For Move + column> + + + + Num animals before the transfer + + + + + + + + FFFF00 + + + + + +
+
+
+
diff --git a/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.sql b/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.sql index 5da786f54..3cc90d077 100644 --- a/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.sql +++ b/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.sql @@ -1,9 +1,13 @@ Select h.Id, CASE - WHEN (Select totalClinicalTreatments from study.demographicsActiveTreatments t where h.id = t.id ) > 0 THEN 'Yes' + WHEN (Select totalClinicalTreatments from study.demographicsActiveTreatments t where h.id = t.id) > 0 THEN 'Yes' ELSE null END as ActiveClinicalTreatment, + CASE + WHEN (Select totalClinicalTreatments FROM study.demographicsActiveTreatments t WHERE h.id = t.id and activeTreatments LIKE '%diet%') > 0 THEN 'Yes' + ELSE null + END as ActiveDiets, h.date as InDate, h.room.building as Building, h.room.area as Area, @@ -16,4 +20,5 @@ Select r.totalAnimals as TotalAnimals From study.housing h, roomUtilization_temp r Where h.room = r.room -And h.date >= timestampadd(SQL_TSI_DAY, -1, now()) --'03-08-2021' +-- And h.date >= '03-01-2021' +And h.date >= timestampadd(SQL_TSI_DAY, -1, now()) diff --git a/onprc_ehr/resources/queries/study/PET_CT_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_CT_AnimalHistory.sql similarity index 100% rename from onprc_ehr/resources/queries/study/PET_CT_AnimalHistory.sql rename to onprc_ehr/resources/queries/study/PMIC_CT_AnimalHistory.sql diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java index 28bb432ea..832cd6336 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -1257,6 +1257,7 @@ protected void housingTransferAlert(final Container c, User u, final StringBuild long count = ts.getRowCount(); if (count > 0) {//transfers count + msg.append("
Housing Transfers:

"); msg.append("" + count + " animal transfers were found in last 24 hours:"); msg.append("

Click here to view them

\n"); msg.append("
"); @@ -1281,20 +1282,23 @@ protected void housingTransferAlert(final Container c, User u, final StringBuild columns.add(FieldKey.fromString("Remark")); columns.add(FieldKey.fromString("TotalAnimals")); columns.add(FieldKey.fromString("ActiveClinicalTreatment")); + columns.add(FieldKey.fromString("ActiveDiets")); final Map colMap = QueryService.get().getColumns(ti, columns); TableSelector ts2 = new TableSelector(ti, colMap.values(), null, null); - count = ts2.getRowCount(); - msg.append("
Housing Transfers:

"); //Legend msg.append(""); + msg.append(""); + msg.append(""); msg.append(""); - msg.append(""); + msg.append(""); msg.append(""); - msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); msg.append("
LEGEND:
Yellow indicates animal transferred into an empty room
Yellow row indicates animal transferred into an empty room.
Blue indicates animal has active clinical treatments
Blue cell indicates animal has active Clinical treatments.
Orange cell indicates animal has active Clinical treatments including Diets (or) just Diets.
"); - //Header + // Table header msg.append("

"); msg.append(""); msg.append(""); @@ -1308,8 +1312,13 @@ public void exec(ResultSet object) throws SQLException { if ( animal_count == 0) { //high light the row in yellow if the room was empty before the move msg.append(""); - if (rs.getString("ActiveClinicalTreatment") != null) { //High light with blue color if there are any active treatments - msg.append("\n"); + if (rs.getString("ActiveClinicalTreatment") != null && rs.getString("ActiveDiets") == null) + { //High light with blue color if there are any active treatments + msg.append("\n"); + } + else if (rs.getString("ActiveClinicalTreatment") != null && rs.getString("ActiveDiets") != null) + { //High light with orange color if there are any diets within treatments + msg.append("\n"); } else { msg.append("\n"); @@ -1326,10 +1335,14 @@ public void exec(ResultSet object) throws SQLException { msg.append(""); msg.append(""); } - else { - //msg.append("\n"); - if (rs.getString("ActiveClinicalTreatment") != null) { //High light with blue color if there are any active treatments - msg.append("\n"); + else { //animal moving into non-empty room + if (rs.getString("ActiveClinicalTreatment") != null && rs.getString("ActiveDiets") == null) + { //High light with blue color if there are any active treatments + msg.append("\n"); + } + else if (rs.getString("ActiveClinicalTreatment") != null && rs.getString("ActiveDiets") != null) + { //High light with orange color if there are any diets within treatments + msg.append("\n"); } else { msg.append("\n"); @@ -1350,8 +1363,6 @@ public void exec(ResultSet object) throws SQLException { } }); msg.append("
Id In Date Building Area Room Cage Housing Type Housing Condition Reason For Move Remark Num animals before the transfer
" + PageFlowUtil.filter(rs.getString("Id")) + " " + PageFlowUtil.filter(rs.getString("Id")) + " " + PageFlowUtil.filter(rs.getString("Id")) + " " + PageFlowUtil.filter(rs.getString("Id")) + "" + PageFlowUtil.filter(rs.getInt("TotalAnimals")) + "
" + rs.getString("Id") + " " + PageFlowUtil.filter(rs.getString("Id")) + " " + PageFlowUtil.filter(rs.getString("Id")) + " " + PageFlowUtil.filter(rs.getString("Id")) + " " + PageFlowUtil.filter(rs.getString("Id")) + "
"); - - } } //End of housing transfer alert From 4b735a536332250ae19b7053da19d12cf8a799e0 Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Mon, 19 Apr 2021 09:55:32 -0700 Subject: [PATCH 08/17] Add PMIC and IPC datasets to study archive to fix query validation (#142) --- .../datasets/datasets_manifest.xml | 40 ++ .../datasets/datasets_metadata.xml | 670 ++++++++++++++++++ 2 files changed, 710 insertions(+) diff --git a/onprc_ehr/resources/referenceStudy/datasets/datasets_manifest.xml b/onprc_ehr/resources/referenceStudy/datasets/datasets_manifest.xml index 68528b111..67348c484 100644 --- a/onprc_ehr/resources/referenceStudy/datasets/datasets_manifest.xml +++ b/onprc_ehr/resources/referenceStudy/datasets/datasets_manifest.xml @@ -149,5 +149,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/onprc_ehr/resources/referenceStudy/datasets/datasets_metadata.xml b/onprc_ehr/resources/referenceStudy/datasets/datasets_metadata.xml index 7b7a311c2..fca83b8e5 100644 --- a/onprc_ehr/resources/referenceStudy/datasets/datasets_metadata.xml +++ b/onprc_ehr/resources/referenceStudy/datasets/datasets_metadata.xml @@ -2417,6 +2417,676 @@ Organ Weights + + + Contains up to one row of PMIC_PETImagingData data for each Animal/Date combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + integer + urn:ehr.labkey.org/#Project + + + varchar + Credit To + + + varchar + Exam Num + + + varchar + Accession Num + + + varchar + PMIC Type + + + varchar + PET Radioisotope + + + double + PET Dose(mCi) + 0.0000 + + + double + PET Dose(MBq) + 0.0000 + + + varchar + Route + + + double + CTDIVol + 0.0000 + + + double + DLP + 0.0000 + + + double + Total Exam DLP + 0.0000 + + + varchar + Phantom + + + varchar + Wet lab use + + + varchar + Ligand and Comments + + + varchar + Image Upload Link + + + varchar + CTACType + + + varchar + CTACScanRange + + + PMIC_PETImagingData +
+ + Contains up to one row of PMIC_CTImagingData data for each Animal/Date combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + integer + urn:ehr.labkey.org/#Project + + + varchar + Credit To + + + varchar + Exam Num + + + varchar + Accession Num + + + varchar + PMIC Type + + + varchar + Contrast Type + + + double + Contrast Amount + 0.0000 + + + varchar + Route + + + double + CTDIVol + 0.0000 + + + double + DLP + 0.0000 + + + double + Total Exam DLP + 0.0000 + + + varchar + Wet lab use + + + varchar + Image Upload Link + + + PMIC_CTImagingData +
+ + Contains up to one row of PMIC_SPECTImagingData data for each Animal/Date combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + integer + urn:ehr.labkey.org/#Project + + + varchar + Credit To + + + varchar + Exam Num + + + varchar + Accession Num + + + varchar + PMIC Type + + + varchar + SPECT Isotope + + + double + SPECT Dose(mCi) + 0.0000 + + + double + SPECT Dose(MBq) + 0.0000 + + + varchar + Route + + + double + CTDIVol + 0.0000 + + + double + DLP + 0.0000 + + + double + Total Exam DLP + 0.0000 + + + varchar + Wet lab use + + + varchar + Ligand and Comments + + + varchar + Image Upload Link + + + PMIC_SPECTImagingData +
+ + Contains up to one row of PMIC_AngioImagingData data for each Animal/Date combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + integer + urn:ehr.labkey.org/#Project + + + varchar + Credit To + + + varchar + Exam Num + + + varchar + Accession Num + + + varchar + PMIC Type + + + double + CTDIVol + 0.000 + + + double + DLP + 0.000 + + + double + Total Exam DLP + 0.000 + + + varchar + Wet lab use + + + varchar + Image Upload Link + + + PMIC_AngioImagingData +
+ + Contains up to one row of PMIC_USImagingData data for each Animal/Date combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + integer + urn:ehr.labkey.org/#Project + + + varchar + Credit To + + + varchar + Exam Num + + + varchar + Accession Num + + + varchar + PMIC Type + + + varchar + Ultrasound Procedure + + + varchar + Wet lab use + + + PMIC_USImagingData +
+ + Contains up to one row of PMIC_DEXAImagingData data for each Animal/Date combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + integer + urn:ehr.labkey.org/#Project + + + varchar + Credit To + + + varchar + Exam Num + + + varchar + Accession Num + + + varchar + PMIC Type + + + varchar + DEXA Procedure + + + varchar + Animal Position + + + PMIC_DEXAImagingData +
+ + Contains up to one row of IPC_Sectioning data for each Animal/Date/objectId combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + varchar + Tissue Type + + + varchar + Paraffin Sectioning + + + varchar + SectionThickness + + + varchar + Frozen Sectioning + + + varchar + Special Instructions + + + IPC_Sectioning +
+ + Contains up to one row of IPC_Staining data for each Animal/Date/objectId combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + varchar + Tissue Type + + + varchar + + + + varchar + Special Stain + + + varchar + IHC + + + varchar + IHC Primary Antibody + + + varchar + Irrevelant Antibody + + + varchar + RNA Scope + + + varchar + Other + + + IPC_Staining +
+ + Contains up to one row of IPC_SlidePrinting data for each Animal/Date combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + varchar + Tissue Type + + + varchar + Project Notes + + + varchar + Additional text on slide + + + IPC_SlidePrinting +
+ + Contains up to one row of IPC_Other data for each Animal/Date/objectId combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + varchar + Service And Products + + + IPC_Other +
+ + Contains up to one row of IPC_ServiceRequestDetails data for each Animal/Date/objectId combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + integer + urn:ehr.labkey.org/#Project + + + varchar + Requested By + + + varchar + Email + + + varchar + Department + + + varchar + Pathologist + + + varchar + Investigator + + + varchar + Alias + + + varchar + Sample Dropoff/Pickup Location + + + IPC_ServiceRequestDetails +
+ + Contains up to one row of IPC_CassettePrinting data for each Animal/Date/objectId combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + varchar + Tissue Type + + + varchar + PI Label Text + + + IPC_CassettePrinting +
+ + Contains up to one row of IPC_ProcessingEmbedding data for each Animal/Date/objectId combination. + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + ptid + + + + timestamp + http://cpas.labkey.com/Study#VisitDate + http://cpas.labkey.com/Study#VisitDate + + + varchar + Tissue Type + + + varchar + Embedding + + + varchar + Fixation Method + + + varchar + Fixation Duration + + + varchar + Current Fixative + + + varchar + Processing Type + + + varchar + Embedding Instructions + + + IPC_ProcessingEmbedding +
+ + From ae151a659f0fdf2bb5907e73fe09c9d4ff01b753 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Wed, 21 Apr 2021 16:50:45 -0700 Subject: [PATCH 09/17] Added the Procedure category into Procedure selection drop down listings and have this feature applied to both Surgery input screens. (#146) --- .../web/onprc_ehr/model/sources/Surgery.js | 119 ++++++++++++++++++ .../dataentry/SingleSurgeryFormType.java | 6 +- .../onprc_ehr/dataentry/SurgeryFormType.java | 8 +- 3 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 onprc_ehr/resources/web/onprc_ehr/model/sources/Surgery.js diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/Surgery.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/Surgery.js new file mode 100644 index 000000000..f7575470e --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/Surgery.js @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2013-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ + +// Created: 4-20-2021 R. Blasa +EHR.model.DataModelManager.registerMetadata('onprc_Surgery', { + allQueries: { + performedby: { + allowBlank: true + } + }, + byQuery: { + 'onprc_billing.miscCharges': { + chargeId: { + lookup: { + filterArray: [ + LABKEY.Filter.create('active', true, LABKEY.Filter.Types.EQUAL), + LABKEY.Filter.create('category', 'Lease Fee', LABKEY.Filter.Types.NEQ), + LABKEY.Filter.create('category', 'Animal Per Diem', LABKEY.Filter.Types.NEQ), + LABKEY.Filter.create('category', 'Small Animal Per Diem', LABKEY.Filter.Types.NEQ), + LABKEY.Filter.create('category', 'Timed Mated Breeders', LABKEY.Filter.Types.NEQ) + ] + } + }, + chargetype: { + //NOTE: this will be inherited from the encounters record, so we dont want a default + //defaultValue: 'DCM: Surgery Services', + allowBlank: false + } + }, + 'study.treatment_order': { + category: { + defaultValue: 'Surgical' + } + }, + 'study.drug': { + enddate: { + hidden: false + }, + category: { + defaultValue: 'Surgical' + }, + reason: { + defaultValue: 'Procedure' + }, + chargetype: { + //NOTE: this will be inherited from the encounters record, so we dont want a default + //defaultValue: 'DCM: Surgery Services', + allowBlank: false + } + }, + 'study.encounters': { + type: { + defaultValue: 'Surgery', + hidden: true + }, + title: { + hidden: true + }, + caseno: { + hidden: true + }, + procedureid: { + lookup: { + filterArray: [ + LABKEY.Filter.create('category', 'Surgery;Procedure', LABKEY.Filter.Types.EQUALS_ONE_OF), + LABKEY.Filter.create('active', true, LABKEY.Filter.Types.EQUAL) + ] + } + }, + performedby: { + hidden: true + }, + remark: { + hidden: true + }, + chargetype: { + allowBlank: false + }, + assistingstaff: { + hidden: false, + allowBlank: true //will be handled in trigger script + }, + enddate: { + editorConfig: { + getDefaultDate: function(){ + var rec = EHR.DataEntryUtils.getBoundRecord(this); + if (rec){ + if (rec.get('date')){ + return rec.get('date'); + } + } + } + } + } + }, + 'ehr.snomed_tags': { + code: { + editorConfig: { + xtype: 'ehr-snomedcombo', + defaultSubset: 'Diagnostic Codes' + } + }, + set_number: { + hidden: true + }, + sort: { + hidden: true + } + }, + 'ehr.encounter_summaries': { + category: { + defaultValue: 'Narrative' + } + } + } +}); \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SingleSurgeryFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SingleSurgeryFormType.java index e98836ab0..495767b0b 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SingleSurgeryFormType.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SingleSurgeryFormType.java @@ -64,7 +64,7 @@ public SingleSurgeryFormType(DataEntryFormContext ctx, Module owner) addSection(new EncounterChildFormSection("onprc_billing", "miscCharges", "Misc. Charges", false, "EHR.data.MiscChargesClientStore", Arrays.asList(ClientDependency.supplierFromPath("ehr/data/MiscChargesClientStore.js")), null)); } - addClientDependency(ClientDependency.supplierFromPath("ehr/model/sources/Surgery.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/Surgery.js")); addClientDependency(ClientDependency.supplierFromPath("ehr/window/OpenSurgeryCasesWindow.js")); addClientDependency(ClientDependency.supplierFromPath("ehr/panel/SurgeryDataEntryPanel.js")); setDisplayReviewRequired(true); @@ -73,7 +73,9 @@ public SingleSurgeryFormType(DataEntryFormContext ctx, Module owner) for (FormSection s : this.getFormSections()) { s.addConfigSource("Encounter"); - s.addConfigSource("Surgery"); + + // Modified: 4-20-2021 R. Blasa + s.addConfigSource("onprc_Surgery"); //Added: 9-6-2017 R.Blasa s.addConfigSource("Surgery_Blood"); diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgeryFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgeryFormType.java index d53b31f0d..d3ac76565 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgeryFormType.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgeryFormType.java @@ -64,7 +64,9 @@ public SurgeryFormType(DataEntryFormContext ctx, Module owner) { addSection(new EncounterChildFormSection("onprc_billing", "miscCharges", "Misc. Charges", false, "EHR.data.MiscChargesClientStore", Arrays.asList(ClientDependency.supplierFromPath("ehr/data/MiscChargesClientStore.js")), null)); } - addClientDependency(ClientDependency.supplierFromPath("ehr/model/sources/Surgery.js")); +// Modified: 4-20-2021 R.Blasa + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/Surgery.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/window/OpenSurgeryCasesWindow.js")); addClientDependency(ClientDependency.supplierFromPath("ehr/panel/SurgeryDataEntryPanel.js")); setDisplayReviewRequired(true); @@ -73,7 +75,9 @@ public SurgeryFormType(DataEntryFormContext ctx, Module owner) for (FormSection s : this.getFormSections()) { s.addConfigSource("Encounter"); - s.addConfigSource("Surgery"); + +// Modified: 4-20-2021 R. Blasa + s.addConfigSource("onprc_Surgery"); //Added: 9-6-2017 R.Blasa s.addConfigSource("Surgery_Blood"); From 2345c6fea0698e9472c62233fca29ad482298451 Mon Sep 17 00:00:00 2001 From: Lakshmi Kolli <69940873+kollil@users.noreply.github.com> Date: Thu, 29 Apr 2021 16:55:59 -0700 Subject: [PATCH 10/17] 20.11 fb sla and pmic (#149) * Added the webpart for PMIC wiki * Added groups info to SLA purchase data and changed the billing container in PMIC * URL path updated * Added webpart for SLA landing page and updated PMIC service request form. * SLA allowable data dates validation. * Enhanced the PMIC alerts and housing alerts code. * NHP allowable data dates validation is added. * Fix malformed XML * Fixed the xml * Update onprc_ehr/resources/queries/study/PMIC_ChargeTypes.sql Co-authored-by: Josh Eckels * Changed the aliases table reference code * Added new query that retrieves breeding groups data from eIACUC tables. Co-authored-by: labkey-jeckels --- .../resources/queries/ehr/protocol_counts.js | 22 +- .../onprc_ehr/housing_transfers.query.xml | 6 +- .../queries/study/PMIC_ChargeTypes.sql | 4 +- onprc_ehr/resources/views/PMIC_Wiki.html | 47 +++ onprc_ehr/resources/views/PMIC_Wiki.view.xml | 5 + .../resources/views/PMIC_Wiki.webpart.xml | 6 + .../dataentry/PMICRequestFormType.java | 15 + .../ColonyAlertsNotification.java | 175 +++++---- sla/resources/queries/sla/PlandProtocols.sql | 107 +++-- .../queries/sla/ProtocolProjectsUsage.sql | 371 ++++++++++++------ sla/resources/queries/sla/allowableAnimals.js | 31 ++ .../sla/allowableAnimals_BreedingGroups.sql | 14 + sla/resources/views/SLA_LandingPage.html | 29 ++ sla/resources/views/SLA_LandingPage.view.xml | 5 + .../views/SLA_LandingPage.webpart.xml | 6 + 15 files changed, 606 insertions(+), 237 deletions(-) create mode 100644 onprc_ehr/resources/views/PMIC_Wiki.html create mode 100644 onprc_ehr/resources/views/PMIC_Wiki.view.xml create mode 100644 onprc_ehr/resources/views/PMIC_Wiki.webpart.xml create mode 100644 sla/resources/queries/sla/allowableAnimals_BreedingGroups.sql create mode 100644 sla/resources/views/SLA_LandingPage.html create mode 100644 sla/resources/views/SLA_LandingPage.view.xml create mode 100644 sla/resources/views/SLA_LandingPage.webpart.xml diff --git a/onprc_ehr/resources/queries/ehr/protocol_counts.js b/onprc_ehr/resources/queries/ehr/protocol_counts.js index 13bd324a8..6b199fc88 100644 --- a/onprc_ehr/resources/queries/ehr/protocol_counts.js +++ b/onprc_ehr/resources/queries/ehr/protocol_counts.js @@ -10,4 +10,24 @@ function onUpsert(helper, scriptErrors, row, oldRow){ if (row && row.project){ EHR.Server.Utils.addError(scriptErrors, 'project', 'You should probably leave this field blank. Animal counts are usually associated with the IACUC itself. The project field was left in place to support IRIS data, but should not be used unless there is a good reason to do so.', 'INFO'); } -} \ No newline at end of file +} +//Validate dates. Kollil, 1/19/2021 +EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_UPSERT, 'ehr', 'protocol_counts', function(helper, scriptErrors, row, oldRow) +{ + var start = row.start; + var end = row.enddate; + //console.log ("In 11"); + + // Check if startdate and enddate are not empty + if ((start == null && end == null) || (start == null && end != null) || (start != null && end == null)) { + EHR.Server.Utils.addError(scriptErrors, 'start', 'Must enter Start and End dates', 'ERROR'); + } + + //enddate: verify enddate not prior to startdate + if (start != null && end != null) { + if (start.getTime() > end.getTime()) { + EHR.Server.Utils.addError(scriptErrors, 'enddate', 'End date must be after Start date', 'ERROR'); + } + } + +}); \ No newline at end of file diff --git a/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.query.xml b/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.query.xml index c90fabf37..2d304d87a 100644 --- a/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.query.xml +++ b/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.query.xml @@ -38,13 +38,13 @@ Housing Type - column> + Housing Condition - column> + Reason For Move - column> + diff --git a/onprc_ehr/resources/queries/study/PMIC_ChargeTypes.sql b/onprc_ehr/resources/queries/study/PMIC_ChargeTypes.sql index 02ca552fa..90edf3d2a 100644 --- a/onprc_ehr/resources/queries/study/PMIC_ChargeTypes.sql +++ b/onprc_ehr/resources/queries/study/PMIC_ChargeTypes.sql @@ -1,3 +1,3 @@ SELECT chargetype -From Site.{substitutePath moduleProperty('onprc_billing','BillingContainer')}.onprc_billing.chargeUnits -Where servicecenter is null or servicecenter like 'PMIC' \ No newline at end of file +From Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer_Public')}.onprc_billing.chargeUnits +Where servicecenter is null or servicecenter like 'PMIC' diff --git a/onprc_ehr/resources/views/PMIC_Wiki.html b/onprc_ehr/resources/views/PMIC_Wiki.html new file mode 100644 index 000000000..db50c8c4e --- /dev/null +++ b/onprc_ehr/resources/views/PMIC_Wiki.html @@ -0,0 +1,47 @@ +

This page contains the links related to the PMIC data entry services.

+

 

+ +

This screen contains the PMIC services request data entry form

+ +

This screen contains the data entry panels for PET Scan, CT Scan, SPECT, Angio, Ultrasound and DEXA procedures.

+ +

New tabs are created for each PMIC procedure under "Imaging" tab on the Animal history form. 

+
    +
  1. PMIC - PET:  Click on this tab to view the animal's PET Imaging data.
  2. +
  3. PMIC - CT:  Click on this tab to view the animal's CT Imaging data.
  4. +
  5. PMIC - SPECT:  Click on this tab to view the animal's SPECT Imaging data.
  6. +
  7. PMIC - Angio:  Click on this tab to view the animal's Angio Imaging data.
  8. +
  9. PMIC - Ultrasound:  Click on this tab to view the animal's Ultrasound Imaging data.
  10. +
  11. PMIC - DEXA:  Click on this tab to view the animal's DEXA Imaging data.
  12. +
+ +

This is the maintenance screen for the PMIC reference data such as PET radioisotopes, SPECT radioisotopes, Ultrasound procedures, DEXA values & Animal position values and etc. The PMIC admin can add/edit any of these items.

+

A new item is added by clicking the "IMPORT BULK DATA" on the top panel and entering valid "Value" and "Name" fields with a blank "End Date" field .

+

An item can be disabled by clicking the "EDIT" button and set a valid "End Date". The item will be deleted from the appropriate drop down list(s). 

+ +
    +
  1. Click here to view, Today's scheduled events
  2. +
  3. Click here to view, Weekly scheduled events 
  4. +
+

 

+

 

\ No newline at end of file diff --git a/onprc_ehr/resources/views/PMIC_Wiki.view.xml b/onprc_ehr/resources/views/PMIC_Wiki.view.xml new file mode 100644 index 000000000..c35f7ebb7 --- /dev/null +++ b/onprc_ehr/resources/views/PMIC_Wiki.view.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/onprc_ehr/resources/views/PMIC_Wiki.webpart.xml b/onprc_ehr/resources/views/PMIC_Wiki.webpart.xml new file mode 100644 index 000000000..c732962af --- /dev/null +++ b/onprc_ehr/resources/views/PMIC_Wiki.webpart.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICRequestFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICRequestFormType.java index 1ab3e5eff..a263f146b 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICRequestFormType.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICRequestFormType.java @@ -15,6 +15,7 @@ */ package org.labkey.onprc_ehr.dataentry; +import org.json.JSONObject; import org.labkey.api.ehr.dataentry.AnimalDetailsFormSection; import org.labkey.api.ehr.dataentry.DataEntryFormContext; import org.labkey.api.ehr.dataentry.FormSection; @@ -24,6 +25,8 @@ import org.labkey.api.view.template.ClientDependency; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; //Created: 5/23/2019 Kollil public class PMICRequestFormType extends RequestForm @@ -48,6 +51,18 @@ public PMICRequestFormType(DataEntryFormContext ctx, Module owner) } + //This function has a property that allows to schedule PMIC service requests in future with no num days restriction - By Kollil, 4/20/21 + @Override + public JSONObject toJSON() + { + JSONObject ret = super.toJSON(); + Map map = new HashMap<>(); + map.put("allowRequestsInDistantFuture", true); + ret.put("extraContext", map); + return ret; + } + + // // Added: 12-5-2019 R.Blasa Allow access only to PMIC Access group. // @Override // protected boolean canInsert() diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java index 832cd6336..1e9f12afa 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -1110,18 +1110,31 @@ protected void pmicSchedulerAlert(final Container c, User u, final StringBuilder TableSelector ts1 = new TableSelector(ti1, null, null); long count1 = ts1.getRowCount(); - if (count > 0) {//Daily events count - msg.append("There are " + count + " PMIC events scheduled for today:"); - msg.append("

Click here to view them

\n"); + //Daily events count + if (count > 0) { + msg.append("" + count + " PMIC event(s) scheduled for today:"); + msg.append("

Click here to view the events in PRIME

\n"); + msg.append("
"); + } + else { + msg.append(" There are no PMIC events scheduled today! "); + msg.append("
"); + } + + //Weekly events count + if (count1 > 0) { + msg.append("" + count1 + " PMIC event(s) scheduled this week:"); + msg.append("

Click here to view the events in PRIME

\n"); msg.append("
"); } - if (count1 > 0) {//Weekly events count - msg.append("There are " + count1 + " PMIC events scheduled this week:"); - msg.append("

Click here to view them

\n"); + else { + msg.append(" There are no PMIC events scheduled this week! "); msg.append("
"); } + //Display the daily report in the email - if (count > 0) { + if (count > 0) + { Set columns = new HashSet<>(); columns.add(FieldKey.fromString("resourceid")); columns.add(FieldKey.fromString("startdate")); @@ -1136,86 +1149,76 @@ protected void pmicSchedulerAlert(final Container c, User u, final StringBuilder final Map colMap = QueryService.get().getColumns(ti, columns); TableSelector ts2 = new TableSelector(ti, colMap.values(), null, null); - count = ts2.getRowCount(); - if (count == 0) { - msg.append("There are no scheduled PMIC events"); - } - else { - msg.append("
Daily PMIC events:

\n"); - msg.append("
"); - msg.append(""); - msg.append(""); - - ts2.forEach(new Selector.ForEachBlock() { - @Override - public void exec(ResultSet object) throws SQLException { - Results rs = new ResultsImpl(object, colMap); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - } - }); - msg.append("
Resource Id Start Date End Date Name Alias Quantity Comments Color Room Bldg
" + PageFlowUtil.filter(rs.getString("resourceid")) + "" + PageFlowUtil.filter(rs.getString("startdate")) + "" + PageFlowUtil.filter(rs.getString("enddate")) + "" + PageFlowUtil.filter(rs.getString("name")) + "" + PageFlowUtil.filter(rs.getString("alias")) + "" + PageFlowUtil.filter(rs.getString("quantity")) + "" + PageFlowUtil.filter(rs.getString("comments")) + "" + PageFlowUtil.filter(rs.getString("color")) + "" + PageFlowUtil.filter(rs.getString("room")) + "" + PageFlowUtil.filter(rs.getString("bldg")) + "
"); - } - //Display the weekly report in the email - if (count1 > 0) { - Set columns1 = new HashSet<>(); - columns1.add(FieldKey.fromString("resourceid")); - columns1.add(FieldKey.fromString("startdate")); - columns1.add(FieldKey.fromString("enddate")); - columns1.add(FieldKey.fromString("name")); - columns1.add(FieldKey.fromString("alias")); - columns1.add(FieldKey.fromString("quantity")); - columns1.add(FieldKey.fromString("comments")); - columns1.add(FieldKey.fromString("color")); - columns1.add(FieldKey.fromString("room")); - columns1.add(FieldKey.fromString("bldg")); - - final Map colMap1 = QueryService.get().getColumns(ti1, columns1); - TableSelector ts3 = new TableSelector(ti1, colMap1.values(), null, null); - count1 = ts3.getRowCount(); - - if (count1 == 0) { - msg.append("There are no scheduled PMIC events"); + msg.append("
Daily PMIC events:

\n"); + msg.append(""); + msg.append(""); + msg.append(""); + + ts2.forEach(new Selector.ForEachBlock() { + @Override + public void exec(ResultSet object) throws SQLException { + Results rs = new ResultsImpl(object, colMap); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); } - else { - msg.append("

Weekly PMIC events:

\n"); - msg.append("
Resource Id Start Date End Date Name Alias Quantity Comments Color Room Bldg
" + PageFlowUtil.filter(rs.getString("resourceid")) + "" + PageFlowUtil.filter(rs.getString("startdate")) + "" + PageFlowUtil.filter(rs.getString("enddate")) + "" + PageFlowUtil.filter(rs.getString("name")) + "" + PageFlowUtil.filter(rs.getString("alias")) + "" + PageFlowUtil.filter(rs.getString("quantity")) + "" + PageFlowUtil.filter(rs.getString("comments")) + "" + PageFlowUtil.filter(rs.getString("color")) + "" + PageFlowUtil.filter(rs.getString("room")) + "" + PageFlowUtil.filter(rs.getString("bldg")) + "
"); - msg.append(""); - msg.append(""); - - ts3.forEach(new Selector.ForEachBlock() { - @Override - public void exec(ResultSet object) throws SQLException { - Results rs1 = new ResultsImpl(object, colMap1); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - } - }); - msg.append("
Resource Id Start Date End Date Name Alias Quantity Comments Color Room Bldg
" + PageFlowUtil.filter(rs1.getString("resourceid")) + "" + PageFlowUtil.filter(rs1.getString("startdate")) + "" + PageFlowUtil.filter(rs1.getString("enddate")) + "" + PageFlowUtil.filter(rs1.getString("name")) + "" + PageFlowUtil.filter(rs1.getString("alias")) + "" + PageFlowUtil.filter(rs1.getString("quantity")) + "" + PageFlowUtil.filter(rs1.getString("comments")) + "" + PageFlowUtil.filter(rs1.getString("color")) + "" + PageFlowUtil.filter(rs1.getString("room")) + "" + PageFlowUtil.filter(rs1.getString("bldg")) + "
"); + }); + msg.append(""); + } + + //Display the weekly report in the email + if (count1 > 0) { + Set columns1 = new HashSet<>(); + columns1.add(FieldKey.fromString("resourceid")); + columns1.add(FieldKey.fromString("startdate")); + columns1.add(FieldKey.fromString("enddate")); + columns1.add(FieldKey.fromString("name")); + columns1.add(FieldKey.fromString("alias")); + columns1.add(FieldKey.fromString("quantity")); + columns1.add(FieldKey.fromString("comments")); + columns1.add(FieldKey.fromString("color")); + columns1.add(FieldKey.fromString("room")); + columns1.add(FieldKey.fromString("bldg")); + + final Map colMap1 = QueryService.get().getColumns(ti1, columns1); + TableSelector ts3 = new TableSelector(ti1, colMap1.values(), null, null); + + msg.append("
Weekly PMIC events:

\n"); + msg.append(""); + msg.append(""); + msg.append(""); + + ts3.forEach(new Selector.ForEachBlock() { + @Override + public void exec(ResultSet object) throws SQLException { + Results rs1 = new ResultsImpl(object, colMap1); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); } - } + }); + msg.append("
Resource Id Start Date End Date Name Alias Quantity Comments Color Room Bldg
" + PageFlowUtil.filter(rs1.getString("resourceid")) + "" + PageFlowUtil.filter(rs1.getString("startdate")) + "" + PageFlowUtil.filter(rs1.getString("enddate")) + "" + PageFlowUtil.filter(rs1.getString("name")) + "" + PageFlowUtil.filter(rs1.getString("alias")) + "" + PageFlowUtil.filter(rs1.getString("quantity")) + "" + PageFlowUtil.filter(rs1.getString("comments")) + "" + PageFlowUtil.filter(rs1.getString("color")) + "" + PageFlowUtil.filter(rs1.getString("room")) + "" + PageFlowUtil.filter(rs1.getString("bldg")) + "
"); } + } //End of PMIC alert @@ -1259,12 +1262,12 @@ protected void housingTransferAlert(final Container c, User u, final StringBuild if (count > 0) {//transfers count msg.append("
Housing Transfers:

"); msg.append("" + count + " animal transfers were found in last 24 hours:"); - msg.append("

Click here to view them

\n"); + msg.append("

Click here to view the transfers in PRIME

\n"); msg.append("
"); } if (count == 0) { - msg.append("There were no animal transfers!"); + msg.append("There are no animal transfers today!
"); } //Display the daily report in the email @@ -1294,7 +1297,7 @@ protected void housingTransferAlert(final Container c, User u, final StringBuild msg.append(""); msg.append(" Yellow row indicates animal transferred into an empty room. "); msg.append(""); - msg.append(" Blue cell indicates animal has active Clinical treatments. "); + msg.append(" Blue cell indicates animal has active Clinical treatments with no Diets. "); msg.append(""); msg.append(" Orange cell indicates animal has active Clinical treatments including Diets (or) just Diets. "); msg.append(""); diff --git a/sla/resources/queries/sla/PlandProtocols.sql b/sla/resources/queries/sla/PlandProtocols.sql index 26d5091ff..508ba6041 100644 --- a/sla/resources/queries/sla/PlandProtocols.sql +++ b/sla/resources/queries/sla/PlandProtocols.sql @@ -1,42 +1,87 @@ - SELECT a.project as ProjectID, -aa.species, -a.account as Alias, -y.grantNumber as OGAGrantNumber, -a.protocol as ParentIACUC, -a.title as Title, -a.name as IACUCCode, -a.startdate as StartDate, -a.enddate as EndDate, -i.FirstName, -i.LastName, -i.Division, -p.external_id, -i.LastName + ': ' + a.name + '('+ p.external_id +')' + ' - ' + a.title + ' (Species: ' + aa.species + ')' as PIIacuc + aa.species, + a.account as Alias, + y.grantNumber as OGAGrantNumber, + a.protocol as ParentIACUC, + a.title as Title, + a.name as IACUCCode, + a.startdate as StartDate, + a.enddate as EndDate, + i.FirstName, + i.LastName, + i.Division, + p.external_id, + i.LastName + ': ' + a.name + '('+ p.external_id +')' + ' Group Id & Name - ' + aa. Group_Id + ', '+ aa.Group_Name + ' - ' + a.title + ' (Species: ' + aa.species + ')' as PIIacuc FROM Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project a LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.protocol p ON p.protocol = a.protocol -LEFT JOIN onprc_ehr.investigators i ON i.rowId = a.investigatorId -LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa ON a.protocol = aa.protocol -LEFT JOIN Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer_Public')}.onprc_billing_public.aliases y ON y.alias = a.account + LEFT JOIN onprc_ehr.investigators i ON i.rowId = a.investigatorId + LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals_BreedingGroups aa ON a.protocol = aa.protocol + --LEFT JOIN "/onprc/admin/finance/public".onprc_billing_public.aliases y ON y.alias = a.account + LEFT JOIN Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer_Public')}.onprc_billing_public.aliases y ON y.alias = a.account WHERE - -- filter based on the current date compared with the start and end dates - ( +-- filter based on the current date compared with the start and end dates + ( (aa.StartDate IS NOT NULL AND aa.EndDate IS NULL AND now() > aa.StartDate) OR (aa.StartDate IS NULL AND aa.EndDate IS NOT NULL AND now() < aa.EndDate) OR (now() between aa.StartDate AND aa.EndDate) - ) + ) AND - --Check for the project enddate. Added by LK on 1/16/2019 - (now() between a.StartDate AND a.EndDate) - -- and filtered based on dataAccess for the given user +--Check for the project enddate. Added by LK on 1/16/2019 + (now() between a.StartDate AND a.EndDate) +-- and filtered based on dataAccess for the given user AND - ( + ( (SELECT max(rowid) as expr FROM onprc_billing.dataAccess da - -- current logged in user is the dataAccess user - WHERE isMemberOf(da.userid) - -- has access to all data - AND (da.allData = true - -- has access to the specified investigatorId and the specified project (if applicable) - OR (da.investigatorId = i.rowId AND (da.project IS NULL OR da.project = a.project))) +-- current logged in user is the dataAccess user + WHERE isMemberOf(da.userid) +-- has access to all data + AND (da.allData = true +-- has access to the specified investigatorId and the specified project (if applicable) + OR (da.investigatorId = i.rowId AND (da.project IS NULL OR da.project = a.project))) ) IS NOT NULL - ) + ) + + + +-- +-- SELECT a.project as ProjectID, +-- aa.species, +-- a.account as Alias, +-- y.grantNumber as OGAGrantNumber, +-- a.protocol as ParentIACUC, +-- a.title as Title, +-- a.name as IACUCCode, +-- a.startdate as StartDate, +-- a.enddate as EndDate, +-- i.FirstName, +-- i.LastName, +-- i.Division, +-- p.external_id, +-- i.LastName + ': ' + a.name + '('+ p.external_id +')' + ' - ' + a.title + ' (Species: ' + aa.species + ')' as PIIacuc +-- FROM Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project a +-- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.protocol p ON p.protocol = a.protocol +-- LEFT JOIN onprc_ehr.investigators i ON i.rowId = a.investigatorId +-- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa ON a.protocol = aa.protocol +-- LEFT JOIN Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer_Public')}.onprc_billing_public.aliases y ON y.alias = a.account +-- WHERE +-- -- filter based on the current date compared with the start and end dates +-- ( +-- (aa.StartDate IS NOT NULL AND aa.EndDate IS NULL AND now() > aa.StartDate) OR +-- (aa.StartDate IS NULL AND aa.EndDate IS NOT NULL AND now() < aa.EndDate) OR +-- (now() between aa.StartDate AND aa.EndDate) +-- ) +-- AND +-- --Check for the project enddate. Added by LK on 1/16/2019 +-- (now() between a.StartDate AND a.EndDate) +-- -- and filtered based on dataAccess for the given user +-- AND +-- ( +-- (SELECT max(rowid) as expr FROM onprc_billing.dataAccess da +-- -- current logged in user is the dataAccess user +-- WHERE isMemberOf(da.userid) +-- -- has access to all data +-- AND (da.allData = true +-- -- has access to the specified investigatorId and the specified project (if applicable) +-- OR (da.investigatorId = i.rowId AND (da.project IS NULL OR da.project = a.project))) +-- ) IS NOT NULL +-- ) diff --git a/sla/resources/queries/sla/ProtocolProjectsUsage.sql b/sla/resources/queries/sla/ProtocolProjectsUsage.sql index f7f7aab1f..88c336188 100644 --- a/sla/resources/queries/sla/ProtocolProjectsUsage.sql +++ b/sla/resources/queries/sla/ProtocolProjectsUsage.sql @@ -1,143 +1,286 @@ - - +--SLA usage numbers including Breeding groups data SELECT -a.project as ProjectID, -a.name AS Project, -p.external_id as eIACUCNum, -a.title as Title, -i.LastName || ', ' || i.FirstName AS PIName, -x.account as Alias, -y.projectNumber as OGAProjectNumber, -y.grantNumber as OGAGrantNumber, -f.lastname || ', ' || f.firstName as FiscalAuthorityName, -aa.Species, -aa.Gender, -aa.Strain, -aa.Allowed AS NumAllowed, -calc.NumUsed, -aa.StartDate, -aa.EndDate + a.project as ProjectID, + a.name AS Project, + p.external_id as eIACUCNum, + a.title as Title, + i.LastName || ', ' || i.FirstName AS PIName, + x.account as Alias, + y.projectNumber as OGAProjectNumber, + y.grantNumber as OGAGrantNumber, + f.lastname || ', ' || f.firstName as FiscalAuthorityName, + aa.Species, + aa.Gender, + aa.Strain, + aa.Allowed AS NumAllowed, + calc.NumUsed, + aa.StartDate, + aa.EndDate, + CASE + WHEN aa.BreedingAllowed = '1' THEN 'Yes' + ELSE 'No' + END AS BreedingAllowed, + aa.Group_Id, + aa.Group_Name FROM Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project a LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.protocol p ON p.protocol = a.protocol -LEFT JOIN onprc_ehr.investigators i ON i.rowId = a.investigatorId -LEFT JOIN onprc_billing.fiscalAuthorities f ON f.rowid = i.financialanalyst -LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa ON a.protocol = aa.protocol -LEFT JOIN (select * from onprc_billing.projectAccountHistory z where (z.StartDate IS NOT NULL AND z.EndDate IS NOT NULL AND now() between z.StartDate AND z.EndDate)) x ON a.project = x.project -LEFT JOIN Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer_Public')}.onprc_billing_public.aliases y ON y.alias = x.account -LEFT JOIN ( --- SELECT i.protocol,species,gender,sum(animalsreceived) AS NumUsed --- FROM sla.purchasedetails pd, sla.purchase p --- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i ON p.project = i.project --- WHERE p.objectid = pd.purchaseid AND animalsreceived IS NOT NULL --- GROUP BY i.protocol,species,gender - ---Changed by LK on 5/30 to get the accurate numused. + LEFT JOIN onprc_ehr.investigators i ON i.rowId = a.investigatorId + LEFT JOIN onprc_billing.fiscalAuthorities f ON f.rowid = i.financialanalyst + LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals_BreedingGroups aa ON a.protocol = aa.protocol + LEFT JOIN (select * from onprc_billing.projectAccountHistory z where (z.StartDate IS NOT NULL AND z.EndDate IS NOT NULL AND now() between z.StartDate AND z.EndDate)) x ON a.project = x.project + LEFT JOIN Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer_Public')}.onprc_billing_public.aliases y ON y.alias = x.account + LEFT JOIN ( + --Changed by LK on 5/30 to get the accurate numused. --Ignore the gender when counting the usage if the approval data gender is: "Male or Female". Count both Male and Female usage. - (SELECT i.protocol,pd.species,sum(animalsreceived) AS NumUsed - FROM sla.purchasedetails pd, sla.purchase p, Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i, - Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa1 - Where p.project = i.project AND p.objectid = pd.purchaseid - AND aa1.protocol = i.protocol AND aa1.species = pd.species AND aa1.gender = 'Male or Female' - AND animalsreceived IS NOT NULL - AND (p.orderdate between aa1.StartDate AND aa1.EndDate) AND aa1.enddate > now() - GROUP BY i.protocol, pd.species) + (SELECT i.protocol,pd.species,sum(animalsreceived) AS NumUsed + FROM sla.purchasedetails pd, sla.purchase p, Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i, + Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals_BreedingGroups aa1 + Where p.project = i.project AND p.objectid = pd.purchaseid + AND aa1.protocol = i.protocol AND aa1.species = pd.species AND aa1.gender = 'Male or Female' + AND animalsreceived IS NOT NULL + AND (p.orderdate between aa1.StartDate AND aa1.EndDate) AND aa1.enddate > now() + GROUP BY i.protocol, pd.species) -) AS calc ON a.protocol = calc.protocol - AND (aa.species = calc.species OR (aa.species IS NULL AND calc.species IS NULL)) - --AND (aa.gender = calc.gender OR (aa.gender IS NULL AND calc.gender IS NULL)) - --AND (aa.strain = calc.strain OR (aa.strain IS NULL AND calc.strain IS NULL)) + ) AS calc ON a.protocol = calc.protocol + AND (aa.species = calc.species OR (aa.species IS NULL AND calc.species IS NULL)) + --AND (aa.gender = calc.gender OR (aa.gender IS NULL AND calc.gender IS NULL)) + --AND (aa.strain = calc.strain OR (aa.strain IS NULL AND calc.strain IS NULL)) WHERE - -- filter based on the current date compared with the start and end dates - ( +-- filter based on the current date compared with the start and end dates + ( (aa.StartDate IS NOT NULL AND aa.EndDate IS NULL AND now() > aa.StartDate) OR (aa.StartDate IS NULL AND aa.EndDate IS NOT NULL AND now() < aa.EndDate) OR (aa.StartDate IS NOT NULL AND aa.EndDate IS NOT NULL AND now() between aa.StartDate AND aa.EndDate) - AND (aa.gender = 'Male or Female') - ) + AND (aa.gender = 'Male or Female') + ) AND - --Check for the project enddate. Added by LK on 1/16/2019 - (now() between a.StartDate AND a.EndDate) - -- and filtered based on dataAccess for the given user +--Check for the project enddate. Added by LK on 1/16/2019 + (now() between a.StartDate AND a.EndDate) +-- and filtered based on dataAccess for the given user AND - ( + ( (SELECT max(rowid) as expr FROM onprc_billing.dataAccess da - -- current logged in user is the dataAccess user - WHERE isMemberOf(da.userid) - -- has access to all data - AND (da.allData = true - -- has access to the specified investigatorId and the specified project (if applicable) - OR (da.investigatorId = i.rowId AND (da.project IS NULL OR da.project = a.project))) +-- current logged in user is the dataAccess user + WHERE isMemberOf(da.userid) +-- has access to all data + AND (da.allData = true +-- has access to the specified investigatorId and the specified project (if applicable) + OR (da.investigatorId = i.rowId AND (da.project IS NULL OR da.project = a.project))) ) IS NOT NULL - ) + ) UNION ALL SELECT -a.project as ProjectID, -a.name AS Project, -p.external_id as eIACUCNum, -a.title as Title, -i.LastName || ', ' || i.FirstName AS PIName, -x.account as Alias, -y.projectNumber as OGAProjectNumber, -y.grantNumber as OGAGrantNumber, -f.lastname || ', ' || f.firstName as FiscalAuthorityName, -aa.Species, -aa.Gender, -aa.Strain, -aa.Allowed AS NumAllowed, -calc.NumUsed, -aa.StartDate, -aa.EndDate + a.project as ProjectID, + a.name AS Project, + p.external_id as eIACUCNum, + a.title as Title, + i.LastName || ', ' || i.FirstName AS PIName, + x.account as Alias, + y.projectNumber as OGAProjectNumber, + y.grantNumber as OGAGrantNumber, + f.lastname || ', ' || f.firstName as FiscalAuthorityName, + aa.Species, + aa.Gender, + aa.Strain, + aa.Allowed AS NumAllowed, + calc.NumUsed, + aa.StartDate, + aa.EndDate, + CASE + WHEN aa.BreedingAllowed = '1' THEN 'Yes' + ELSE 'No' + END AS BreedingAllowed, + aa.Group_Id, + aa.Group_Name + FROM Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project a LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.protocol p ON p.protocol = a.protocol -LEFT JOIN onprc_ehr.investigators i ON i.rowId = a.investigatorId -LEFT JOIN onprc_billing.fiscalAuthorities f ON f.rowid = i.financialanalyst -LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa ON a.protocol = aa.protocol -LEFT JOIN (select * from onprc_billing.projectAccountHistory z where (z.StartDate IS NOT NULL AND z.EndDate IS NOT NULL AND now() between z.StartDate AND z.EndDate)) x ON a.project = x.project -LEFT JOIN Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer_Public')}.onprc_billing_public.aliases y ON y.alias = x.account -LEFT JOIN ( --- SELECT i.protocol,species,gender,sum(animalsreceived) AS NumUsed --- FROM sla.purchasedetails pd, sla.purchase p --- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i ON p.project = i.project --- WHERE p.objectid = pd.purchaseid AND animalsreceived IS NOT NULL --- GROUP BY i.protocol,species,gender - ---Changed by LK on 5/30 to get the accurate numused. + LEFT JOIN onprc_ehr.investigators i ON i.rowId = a.investigatorId + LEFT JOIN onprc_billing.fiscalAuthorities f ON f.rowid = i.financialanalyst + LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals_BreedingGroups aa ON a.protocol = aa.protocol + LEFT JOIN (select * from onprc_billing.projectAccountHistory z where (z.StartDate IS NOT NULL AND z.EndDate IS NOT NULL AND now() between z.StartDate AND z.EndDate)) x ON a.project = x.project + LEFT JOIN Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer_Public')}.onprc_billing_public.aliases y ON y.alias = x.account + LEFT JOIN ( + --Changed by LK on 5/30 to get the accurate numused. -- Count only the usage for the "Male" or "Female" gender - (SELECT i.protocol,pd.species,pd.gender,sum(animalsreceived) AS NumUsed - FROM sla.purchasedetails pd, sla.purchase p, Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i, - Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa1 - Where p.project = i.project AND p.objectid = pd.purchaseid - AND aa1.protocol = i.protocol AND aa1.species = pd.species AND aa1.gender = pd.gender AND aa1.gender <> 'Male or Female' - AND animalsreceived IS NOT NULL - AND (p.orderdate between aa1.StartDate AND aa1.EndDate) AND aa1.enddate > now() - GROUP BY i.protocol, pd.species, pd.gender) + (SELECT i.protocol,pd.species,pd.gender,sum(animalsreceived) AS NumUsed + FROM sla.purchasedetails pd, sla.purchase p, Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i, + Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals_BreedingGroups aa1 + Where p.project = i.project AND p.objectid = pd.purchaseid + AND aa1.protocol = i.protocol AND aa1.species = pd.species AND aa1.gender = pd.gender AND aa1.gender <> 'Male or Female' + AND animalsreceived IS NOT NULL + AND (p.orderdate between aa1.StartDate AND aa1.EndDate) AND aa1.enddate > now() + GROUP BY i.protocol, pd.species, pd.gender) -) AS calc ON a.protocol = calc.protocol - AND (aa.species = calc.species OR (aa.species IS NULL AND calc.species IS NULL)) - AND (aa.gender = calc.gender OR (aa.gender IS NULL AND calc.gender IS NULL)) - --AND (aa.strain = calc.strain OR (aa.strain IS NULL AND calc.strain IS NULL)) + ) AS calc ON a.protocol = calc.protocol + AND (aa.species = calc.species OR (aa.species IS NULL AND calc.species IS NULL)) + AND (aa.gender = calc.gender OR (aa.gender IS NULL AND calc.gender IS NULL)) + --AND (aa.strain = calc.strain OR (aa.strain IS NULL AND calc.strain IS NULL)) WHERE - -- filter based on the current date compared with the start and end dates - ( +-- filter based on the current date compared with the start and end dates + ( (aa.StartDate IS NOT NULL AND aa.EndDate IS NULL AND now() > aa.StartDate) OR (aa.StartDate IS NULL AND aa.EndDate IS NOT NULL AND now() < aa.EndDate) OR (aa.StartDate IS NOT NULL AND aa.EndDate IS NOT NULL AND now() between aa.StartDate AND aa.EndDate) - AND (aa.gender <> 'Male or Female') - ) + AND (aa.gender <> 'Male or Female') + ) AND - --Check for the project enddate. Added by LK on 1/16/2019 - (now() between a.StartDate AND a.EndDate) - -- and filtered based on dataAccess for the given user +--Check for the project enddate. Added by LK on 1/16/2019 + (now() between a.StartDate AND a.EndDate) +-- and filtered based on dataAccess for the given user AND - ( + ( (SELECT max(rowid) as expr FROM onprc_billing.dataAccess da - -- current logged in user is the dataAccess user - WHERE isMemberOf(da.userid) - -- has access to all data - AND (da.allData = true - -- has access to the specified investigatorId and the specified project (if applicable) - OR (da.investigatorId = i.rowId AND (da.project IS NULL OR da.project = a.project))) +-- current logged in user is the dataAccess user + WHERE isMemberOf(da.userid) +-- has access to all data + AND (da.allData = true +-- has access to the specified investigatorId and the specified project (if applicable) + OR (da.investigatorId = i.rowId AND (da.project IS NULL OR da.project = a.project))) ) IS NOT NULL - ) \ No newline at end of file + ) + +/* +-- SELECT +-- a.project as ProjectID, +-- a.name AS Project, +-- p.external_id as eIACUCNum, +-- a.title as Title, +-- i.LastName || ', ' || i.FirstName AS PIName, +-- x.account as Alias, +-- y.projectNumber as OGAProjectNumber, +-- y.grantNumber as OGAGrantNumber, +-- f.lastname || ', ' || f.firstName as FiscalAuthorityName, +-- aa.Species, +-- aa.Gender, +-- aa.Strain, +-- aa.Allowed AS NumAllowed, +-- calc.NumUsed, +-- aa.StartDate, +-- aa.EndDate +-- FROM Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project a +-- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.protocol p ON p.protocol = a.protocol +-- LEFT JOIN onprc_ehr.investigators i ON i.rowId = a.investigatorId +-- LEFT JOIN onprc_billing.fiscalAuthorities f ON f.rowid = i.financialanalyst +-- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa ON a.protocol = aa.protocol +-- LEFT JOIN (select * from onprc_billing.projectAccountHistory z where (z.StartDate IS NOT NULL AND z.EndDate IS NOT NULL AND now() between z.StartDate AND z.EndDate)) x ON a.project = x.project +-- LEFT JOIN Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer_Public')}.onprc_billing_public.aliases y ON y.alias = x.account +-- LEFT JOIN ( +-- -- SELECT i.protocol,species,gender,sum(animalsreceived) AS NumUsed +-- -- FROM sla.purchasedetails pd, sla.purchase p +-- -- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i ON p.project = i.project +-- -- WHERE p.objectid = pd.purchaseid AND animalsreceived IS NOT NULL +-- -- GROUP BY i.protocol,species,gender +-- +-- --Changed by LK on 5/30 to get the accurate numused. +-- --Ignore the gender when counting the usage if the approval data gender is: "Male or Female". Count both Male and Female usage. +-- (SELECT i.protocol,pd.species,sum(animalsreceived) AS NumUsed +-- FROM sla.purchasedetails pd, sla.purchase p, Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i, +-- Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa1 +-- Where p.project = i.project AND p.objectid = pd.purchaseid +-- AND aa1.protocol = i.protocol AND aa1.species = pd.species AND aa1.gender = 'Male or Female' +-- AND animalsreceived IS NOT NULL +-- AND (p.orderdate between aa1.StartDate AND aa1.EndDate) AND aa1.enddate > now() +-- GROUP BY i.protocol, pd.species) +-- +-- ) AS calc ON a.protocol = calc.protocol +-- AND (aa.species = calc.species OR (aa.species IS NULL AND calc.species IS NULL)) +-- --AND (aa.gender = calc.gender OR (aa.gender IS NULL AND calc.gender IS NULL)) +-- --AND (aa.strain = calc.strain OR (aa.strain IS NULL AND calc.strain IS NULL)) +-- WHERE +-- -- filter based on the current date compared with the start and end dates +-- ( +-- (aa.StartDate IS NOT NULL AND aa.EndDate IS NULL AND now() > aa.StartDate) OR +-- (aa.StartDate IS NULL AND aa.EndDate IS NOT NULL AND now() < aa.EndDate) OR +-- (aa.StartDate IS NOT NULL AND aa.EndDate IS NOT NULL AND now() between aa.StartDate AND aa.EndDate) +-- AND (aa.gender = 'Male or Female') +-- ) +-- AND +-- --Check for the project enddate. Added by LK on 1/16/2019 +-- (now() between a.StartDate AND a.EndDate) +-- -- and filtered based on dataAccess for the given user +-- AND +-- ( +-- (SELECT max(rowid) as expr FROM onprc_billing.dataAccess da +-- -- current logged in user is the dataAccess user +-- WHERE isMemberOf(da.userid) +-- -- has access to all data +-- AND (da.allData = true +-- -- has access to the specified investigatorId and the specified project (if applicable) +-- OR (da.investigatorId = i.rowId AND (da.project IS NULL OR da.project = a.project))) +-- ) IS NOT NULL +-- ) +-- +-- UNION ALL +-- +-- SELECT +-- a.project as ProjectID, +-- a.name AS Project, +-- p.external_id as eIACUCNum, +-- a.title as Title, +-- i.LastName || ', ' || i.FirstName AS PIName, +-- x.account as Alias, +-- y.projectNumber as OGAProjectNumber, +-- y.grantNumber as OGAGrantNumber, +-- f.lastname || ', ' || f.firstName as FiscalAuthorityName, +-- aa.Species, +-- aa.Gender, +-- aa.Strain, +-- aa.Allowed AS NumAllowed, +-- calc.NumUsed, +-- aa.StartDate, +-- aa.EndDate +-- FROM Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project a +-- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.protocol p ON p.protocol = a.protocol +-- LEFT JOIN onprc_ehr.investigators i ON i.rowId = a.investigatorId +-- LEFT JOIN onprc_billing.fiscalAuthorities f ON f.rowid = i.financialanalyst +-- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa ON a.protocol = aa.protocol +-- LEFT JOIN (select * from onprc_billing.projectAccountHistory z where (z.StartDate IS NOT NULL AND z.EndDate IS NOT NULL AND now() between z.StartDate AND z.EndDate)) x ON a.project = x.project +-- LEFT JOIN Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer_Public')}.onprc_billing_public.aliases y ON y.alias = x.account +-- LEFT JOIN ( +-- -- SELECT i.protocol,species,gender,sum(animalsreceived) AS NumUsed +-- -- FROM sla.purchasedetails pd, sla.purchase p +-- -- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i ON p.project = i.project +-- -- WHERE p.objectid = pd.purchaseid AND animalsreceived IS NOT NULL +-- -- GROUP BY i.protocol,species,gender +-- +-- --Changed by LK on 5/30 to get the accurate numused. +-- -- Count only the usage for the "Male" or "Female" gender +-- (SELECT i.protocol,pd.species,pd.gender,sum(animalsreceived) AS NumUsed +-- FROM sla.purchasedetails pd, sla.purchase p, Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i, +-- Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa1 +-- Where p.project = i.project AND p.objectid = pd.purchaseid +-- AND aa1.protocol = i.protocol AND aa1.species = pd.species AND aa1.gender = pd.gender AND aa1.gender <> 'Male or Female' +-- AND animalsreceived IS NOT NULL +-- AND (p.orderdate between aa1.StartDate AND aa1.EndDate) AND aa1.enddate > now() +-- GROUP BY i.protocol, pd.species, pd.gender) +-- +-- ) AS calc ON a.protocol = calc.protocol +-- AND (aa.species = calc.species OR (aa.species IS NULL AND calc.species IS NULL)) +-- AND (aa.gender = calc.gender OR (aa.gender IS NULL AND calc.gender IS NULL)) +-- --AND (aa.strain = calc.strain OR (aa.strain IS NULL AND calc.strain IS NULL)) +-- WHERE +-- -- filter based on the current date compared with the start and end dates +-- ( +-- (aa.StartDate IS NOT NULL AND aa.EndDate IS NULL AND now() > aa.StartDate) OR +-- (aa.StartDate IS NULL AND aa.EndDate IS NOT NULL AND now() < aa.EndDate) OR +-- (aa.StartDate IS NOT NULL AND aa.EndDate IS NOT NULL AND now() between aa.StartDate AND aa.EndDate) +-- AND (aa.gender <> 'Male or Female') +-- ) +-- AND +-- --Check for the project enddate. Added by LK on 1/16/2019 +-- (now() between a.StartDate AND a.EndDate) +-- -- and filtered based on dataAccess for the given user +-- AND +-- ( +-- (SELECT max(rowid) as expr FROM onprc_billing.dataAccess da +-- -- current logged in user is the dataAccess user +-- WHERE isMemberOf(da.userid) +-- -- has access to all data +-- AND (da.allData = true +-- -- has access to the specified investigatorId and the specified project (if applicable) +-- OR (da.investigatorId = i.rowId AND (da.project IS NULL OR da.project = a.project))) +-- ) IS NOT NULL +-- ) \ No newline at end of file diff --git a/sla/resources/queries/sla/allowableAnimals.js b/sla/resources/queries/sla/allowableAnimals.js index 8df5c7872..bc0ed9c35 100644 --- a/sla/resources/queries/sla/allowableAnimals.js +++ b/sla/resources/queries/sla/allowableAnimals.js @@ -1,7 +1,38 @@ +// var console = require("console"); +// var LABKEY = require("labkey"); +// +// +// function beforeInsert(row, errors){ +// row.objectid = row.objectid || LABKEY.Utils.generateUUID().toUpperCase(); +// } + var console = require("console"); var LABKEY = require("labkey"); +require("ehr/triggers").initScript(this); +var triggerHelper = new org.labkey.onprc_ehr.query.ONPRC_EHRTriggerHelper(LABKEY.Security.currentUser.id, LABKEY.Security.currentContainer.id); function beforeInsert(row, errors){ row.objectid = row.objectid || LABKEY.Utils.generateUUID().toUpperCase(); } + +//Validate dates. Kollil, 1/19/2021 +EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_UPSERT, 'sla', 'allowableAnimals', function(helper, scriptErrors, row, oldRow) +{ + var start = row.startdate; + var end = row.enddate; + //console.log ("In 1"); + + // Check if startdate and enddate are not empty + if ((start == null && end == null) || (start == null && end != null) || (start != null && end == null)) { + EHR.Server.Utils.addError(scriptErrors, 'startdate', 'Must enter Start and End dates', 'ERROR'); + } + + //enddate: verify enddate not prior to startdate + if (start != null && end != null) { + if (start.getTime() > end.getTime()) { + EHR.Server.Utils.addError(scriptErrors, 'enddate', 'End date must be after the Start date', 'ERROR'); + } + } + +}); diff --git a/sla/resources/queries/sla/allowableAnimals_BreedingGroups.sql b/sla/resources/queries/sla/allowableAnimals_BreedingGroups.sql new file mode 100644 index 000000000..bc203f417 --- /dev/null +++ b/sla/resources/queries/sla/allowableAnimals_BreedingGroups.sql @@ -0,0 +1,14 @@ +SELECT a.protocol, + a.species, + a.gender, + a.strain, + a.age, + a.allowed, + a.startdate, + a.enddate, + b.group_id, + b.group_name, + b.breeding_colony as BreedingAllowed +FROM Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals a, + Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.eIACUC_PRIME_VIEW_ANIMAL_GROUPS b +Where a.protocol.displayname = b.parent_protocol \ No newline at end of file diff --git a/sla/resources/views/SLA_LandingPage.html b/sla/resources/views/SLA_LandingPage.html new file mode 100644 index 000000000..466b19567 --- /dev/null +++ b/sla/resources/views/SLA_LandingPage.html @@ -0,0 +1,29 @@ +

SLA Purchase

+

SLA purchase module is for PIs and staff to initiate purchase orders for rodents. It is administered by SLAU staff to ensure quality control and compliance with applicable federal regulations and guidelines. Only authorized personnel are allowed to place rodent orders. If you need access to the module, please contact sla_services@ohsu.edu.

+

Click here to go to SLA Purchase Module

+
+

SLA Census

+

SLA census module is used by SLAU staff to maintain rodent demographic and location data and billing. Please click on the links below for specific operations.

+
+

Entering Animals

+
+

SLA Census - Entry Screen

+

SLA Census - Edit Previous Record Menu  - Choose "All Tasks" navigational tab and click the mouse on the task id to edit a record.

+

SLA Census - Bulk Editing Grid  - Allows editing more than one Census records.

+

SLA - Entry Grid for Rabbits / Guinea Pigs  - Web link to enter new Rabbits and Guinea Pig records.

+
+

Entering Charges

+
+

Misc Charges - Grid - This format is best for export to Excel.

+

Misc Charges - Entry Form

+

Return to "My Task/All Task" Page 

+
+

Reports

+
+

SLA Census - Grid

+

SLA Census - Printed Report - Center Project & Date Range required.

+

SLA Census - Summary Printed Report - Center Project & Date Range required.

+

Monthly Census - Mouse Sheets

+

Monthly Census - Rat Sheets

+

Monthly Census - Rabbit or GP Sheets

+
\ No newline at end of file diff --git a/sla/resources/views/SLA_LandingPage.view.xml b/sla/resources/views/SLA_LandingPage.view.xml new file mode 100644 index 000000000..297678ea8 --- /dev/null +++ b/sla/resources/views/SLA_LandingPage.view.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/sla/resources/views/SLA_LandingPage.webpart.xml b/sla/resources/views/SLA_LandingPage.webpart.xml new file mode 100644 index 000000000..a21b09d25 --- /dev/null +++ b/sla/resources/views/SLA_LandingPage.webpart.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From bef6ed622c6472f5c604d275e9c2381481fc9730 Mon Sep 17 00:00:00 2001 From: Lakshmi Kolli <69940873+kollil@users.noreply.github.com> Date: Tue, 4 May 2021 16:59:45 -0700 Subject: [PATCH 11/17] Fixed the SLA the usage math in the usage query (#151) --- sla/resources/queries/sla/ProtocolProjectsUsage.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sla/resources/queries/sla/ProtocolProjectsUsage.sql b/sla/resources/queries/sla/ProtocolProjectsUsage.sql index 88c336188..8198db54c 100644 --- a/sla/resources/queries/sla/ProtocolProjectsUsage.sql +++ b/sla/resources/queries/sla/ProtocolProjectsUsage.sql @@ -34,7 +34,7 @@ LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.pr --Ignore the gender when counting the usage if the approval data gender is: "Male or Female". Count both Male and Female usage. (SELECT i.protocol,pd.species,sum(animalsreceived) AS NumUsed FROM sla.purchasedetails pd, sla.purchase p, Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i, - Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals_BreedingGroups aa1 + Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa1 Where p.project = i.project AND p.objectid = pd.purchaseid AND aa1.protocol = i.protocol AND aa1.species = pd.species AND aa1.gender = 'Male or Female' AND animalsreceived IS NOT NULL @@ -107,7 +107,7 @@ LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.pr -- Count only the usage for the "Male" or "Female" gender (SELECT i.protocol,pd.species,pd.gender,sum(animalsreceived) AS NumUsed FROM sla.purchasedetails pd, sla.purchase p, Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i, - Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals_BreedingGroups aa1 + Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa1 Where p.project = i.project AND p.objectid = pd.purchaseid AND aa1.protocol = i.protocol AND aa1.species = pd.species AND aa1.gender = pd.gender AND aa1.gender <> 'Male or Female' AND animalsreceived IS NOT NULL From 9207bbe9aaf9e19e128b8889336c63eab28253a3 Mon Sep 17 00:00:00 2001 From: Lakshmi Kolli <69940873+kollil@users.noreply.github.com> Date: Thu, 6 May 2021 19:46:02 -0700 Subject: [PATCH 12/17] Updated the weekly query to start from next day (#154) --- .../queries/extscheduler/PMIC_Scheduler_Daily.sql | 4 ++-- .../queries/extscheduler/PMIC_Scheduler_Weekly.sql | 10 ++++++++-- .../notification/ColonyAlertsNotification.java | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql index 0ae451d2f..d538ef1e6 100644 --- a/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql +++ b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql @@ -19,5 +19,5 @@ SELECT e.modified FROM Events e, PMIC_getFolderInfo r Where r.id = e.resourceid - --And e.container = '783D2EA5-C6AC-1036-A33C-BD25D0574070' - And CAST(e.startDate AS DATE) = curdate() --Show only PMIC events \ No newline at end of file + And CAST(e.startDate AS DATE) = curdate() --Show only PMIC events + Order by e.startDate \ No newline at end of file diff --git a/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql index 117b1bb9c..5674ea490 100644 --- a/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql +++ b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql @@ -1,6 +1,8 @@ /* Created by: Kolli on 11/14/2019 Weekly report: This query filters all the PMIC events from today to the next 7 days +Change by Kolli, 5/5/21: This query filters all the PMIC events from next day to the next 7 days. +The Daily events will cover the current day events, no need to duplicate same day events again in the weekly report. */ SELECT r.resourceid, @@ -19,5 +21,9 @@ SELECT e.modified FROM Events e, PMIC_getFolderInfo r Where r.id = e.resourceid - --And e.container = '783D2EA5-C6AC-1036-A33C-BD25D0574070' -- PMIC container - And CAST(e.startDate AS DATE) BETWEEN curdate() and TIMESTAMPADD('SQL_TSI_DAY', 7, curdate()) +--And CAST(e.startDate AS DATE) BETWEEN curdate() and TIMESTAMPADD('SQL_TSI_DAY', 7, curdate()) +And CAST(e.startDate AS DATE) BETWEEN TIMESTAMPADD('SQL_TSI_DAY', 1, curdate()) and TIMESTAMPADD('SQL_TSI_DAY', 7, curdate()) +Order by e.startdate + + + diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java index 1e9f12afa..0afd3f547 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -1150,7 +1150,7 @@ protected void pmicSchedulerAlert(final Container c, User u, final StringBuilder final Map colMap = QueryService.get().getColumns(ti, columns); TableSelector ts2 = new TableSelector(ti, colMap.values(), null, null); - msg.append("
Daily PMIC events:

\n"); + msg.append("
Today's PMIC events:

\n"); msg.append(""); msg.append(""); msg.append(""); From b0260e8ebcd8e99cf235d6047332ad90d990d5f8 Mon Sep 17 00:00:00 2001 From: Lakshmi Kolli <69940873+kollil@users.noreply.github.com> Date: Mon, 17 May 2021 16:55:18 -0700 Subject: [PATCH 13/17] PMIC service req form flow changes. (#157) * PMIC service req form flow changes. * Take #2: PMIC service req form flow changes. * Put back the chargeto and creditto fields to the PMIC data entry panels * PMIC CT scan changes. * PMIC PET & CT changes and changed weights days from 45 to 75 in routine preventive care alerts. * Updated CT scan history sql to include new fields. * Updated the routine preventive care alert query * PMIC animal history sql changes * PMIC PET scan examnum width changed * PMIC PET scan history sql updated --- .../study/PMIC_Angio_AnimalHistory.sql | 4 +- .../study/PMIC_CTImagingData.query.xml | 17 +- .../queries/study/PMIC_CT_AnimalHistory.sql | 7 +- .../study/PMIC_PETImagingData.query.xml | 34 ++-- .../queries/study/PMIC_PET_AnimalHistory.sql | 8 +- .../study/PMIC_SPECT_AnimalHistory.sql | 4 +- .../queries/study/PMIC_encounters.query.xml | 164 ++++++++++++++++++ .../queries/study/PMIC_encounters.sql | 17 ++ .../web/onprc_ehr/model/sources/PMIC_Angio.js | 4 +- .../web/onprc_ehr/model/sources/PMIC_CT.js | 22 ++- .../web/onprc_ehr/model/sources/PMIC_DEXA.js | 7 +- .../web/onprc_ehr/model/sources/PMIC_PET.js | 9 +- .../web/onprc_ehr/model/sources/PMIC_SPECT.js | 7 +- .../onprc_ehr/model/sources/PMIC_Services.js | 88 +++++----- .../web/onprc_ehr/model/sources/PMIC_US.js | 7 +- .../org/labkey/onprc_ehr/ONPRC_EHRModule.java | 4 +- .../dataentry/PMICDataEntryFormType.java | 1 + .../RoutineClinicalTestsNotification.java | 9 +- 18 files changed, 323 insertions(+), 90 deletions(-) create mode 100644 onprc_ehr/resources/queries/study/PMIC_encounters.query.xml create mode 100644 onprc_ehr/resources/queries/study/PMIC_encounters.sql diff --git a/onprc_ehr/resources/queries/study/PMIC_Angio_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_Angio_AnimalHistory.sql index fbe7e05ca..9f7d90775 100644 --- a/onprc_ehr/resources/queries/study/PMIC_Angio_AnimalHistory.sql +++ b/onprc_ehr/resources/queries/study/PMIC_Angio_AnimalHistory.sql @@ -6,10 +6,10 @@ SELECT PMICType, CTDIvol, DLP, - totalExamDLP, + --totalExamDLP, wetLabUse, remark, - imageUploadLink, + --imageUploadLink, taskid, qcstate, performedby, diff --git a/onprc_ehr/resources/queries/study/PMIC_CTImagingData.query.xml b/onprc_ehr/resources/queries/study/PMIC_CTImagingData.query.xml index 144e86baf..d7b7c56e8 100644 --- a/onprc_ehr/resources/queries/study/PMIC_CTImagingData.query.xml +++ b/onprc_ehr/resources/queries/study/PMIC_CTImagingData.query.xml @@ -66,8 +66,8 @@ - - CT Type + + CTAC Type study PMIC_CTACType_values @@ -84,6 +84,15 @@ 0.0000 + + Phantom + + study + PMIC_Phantom_values + value + + + DLP 0.0000 @@ -94,6 +103,10 @@ 0.0000 + + CT Scan Range(mm) + + Wet lab use diff --git a/onprc_ehr/resources/queries/study/PMIC_CT_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_CT_AnimalHistory.sql index f3f0d1cb0..8c26ad8aa 100644 --- a/onprc_ehr/resources/queries/study/PMIC_CT_AnimalHistory.sql +++ b/onprc_ehr/resources/queries/study/PMIC_CT_AnimalHistory.sql @@ -7,12 +7,15 @@ SELECT contrastType, contrastAmount, route, + CTACType, + CTScanRange, + phantom, CTDIvol, DLP, - totalExamDLP, + --totalExamDLP, wetLabUse, remark, - imageUploadLink, + --imageUploadLink, taskid, qcstate, performedby, diff --git a/onprc_ehr/resources/queries/study/PMIC_PETImagingData.query.xml b/onprc_ehr/resources/queries/study/PMIC_PETImagingData.query.xml index ea3cc3172..2b117a817 100644 --- a/onprc_ehr/resources/queries/study/PMIC_PETImagingData.query.xml +++ b/onprc_ehr/resources/queries/study/PMIC_PETImagingData.query.xml @@ -71,8 +71,8 @@ - - CT Type + + CTAC Type study PMIC_CTACType_values @@ -80,8 +80,8 @@ - - CT Scan Range(mm) + + CTAC Scan Range(mm) @@ -89,6 +89,15 @@ 0.0000 + + Phantom + + study + PMIC_Phantom_values + value + + + DLP 0.0000 @@ -99,15 +108,6 @@ 0.0000 - - Phantom - - study - PMIC_Phantom_values - value - - - Wet lab use @@ -125,6 +125,10 @@ Image Upload Link + + Performed By + + study @@ -144,9 +148,7 @@ true - - Performed By - + true diff --git a/onprc_ehr/resources/queries/study/PMIC_PET_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_PET_AnimalHistory.sql index 71a646e3d..009f7bf26 100644 --- a/onprc_ehr/resources/queries/study/PMIC_PET_AnimalHistory.sql +++ b/onprc_ehr/resources/queries/study/PMIC_PET_AnimalHistory.sql @@ -8,13 +8,15 @@ SELECT PETDoseMCI, PETDoseMBQ, route, + CTACType, + CTACScanRange, CTDIvol, - DLP, - totalExamDLP, phantom, + DLP, + --totalExamDLP, wetLabUse, ligandAndComments, - imageUploadLink, + --imageUploadLink, taskid, qcstate, performedby, diff --git a/onprc_ehr/resources/queries/study/PMIC_SPECT_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_SPECT_AnimalHistory.sql index e8d038fae..843381441 100644 --- a/onprc_ehr/resources/queries/study/PMIC_SPECT_AnimalHistory.sql +++ b/onprc_ehr/resources/queries/study/PMIC_SPECT_AnimalHistory.sql @@ -10,10 +10,10 @@ SELECT route, CTDIvol, DLP, - totalExamDLP, + --totalExamDLP, wetLabUse, ligandAndComments, - imageUploadLink, + --imageUploadLink, taskid, qcstate, performedby, diff --git a/onprc_ehr/resources/queries/study/PMIC_encounters.query.xml b/onprc_ehr/resources/queries/study/PMIC_encounters.query.xml new file mode 100644 index 000000000..900ae3024 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_encounters.query.xml @@ -0,0 +1,164 @@ +!--PMIC schema. Added by Kolli, 02/27/2020 --> + + + +
Resource Id Start Date End Date Name Alias Quantity Comments Color Room Bldg
+ + + PET Imaging Data + + + true + + + + AnimalId + + + + Date + + + + Active Assignments + + + + Project + + + + Investigator + + + + Charge Type + + + + PMIC Type + + + + PET Radioisotope + + study + PMIC_PETRadioisotope_values + value + + + + + PET Dose(mCi) + 0.0000 + + + + PET Dose(MBq) + 0.0000 + + + + Route + + study + PMIC_Route_values + value + + + + + CT Type + + study + PMIC_CTACType_values + value + + + + + CT Scan Range(mm) + + + + CTDIVol + 0.0000 + + + + DLP + 0.0000 + + + + Total Exam DLP + 0.0000 + + + + Phantom + + study + PMIC_Phantom_values + value + + + + + Wet lab use + + study + PMIC_WetLabUse_values + value + + + + + Ligand and Comments + + + + Image Upload Link + + + + + study + qcstate + RowId + + + + + Task Id + + ehr + tasks + taskid + + + + true + + + Performed By + + + true + + + + + true + + + + + true + + + +
+ + + \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/PMIC_encounters.sql b/onprc_ehr/resources/queries/study/PMIC_encounters.sql new file mode 100644 index 000000000..c68d890db --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_encounters.sql @@ -0,0 +1,17 @@ +SELECT + requestid, + Id, + date, + id.activeAssignments.projects as ActiveAssignments, + project, + project.investigatorid, + chargeType, + procedureid, + remark, + QCState, + taskid, + requestid.createdby, + taskid, + isAssignedToProtocolAtTime +from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.study.encounters +Where chargeType like 'PMIC' \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js index 0a0a4dce6..535189367 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js @@ -24,7 +24,7 @@ EHR.model.DataModelManager.registerMetadata('Angio', { project: { allowBlank: true, - hidden: true, + hidden: false, columnConfig: { width: 150 } @@ -33,7 +33,7 @@ EHR.model.DataModelManager.registerMetadata('Angio', { chargeType: { allowBlank: true, defaultValue: 'PMIC', - hidden: true + hidden: false }, examNum: { diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js index 1e41eebef..689ccabf2 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js @@ -25,7 +25,7 @@ EHR.model.DataModelManager.registerMetadata('CT', { project: { allowBlank: true, - hidden: true, + hidden: false, columnConfig: { width: 150 } @@ -33,8 +33,9 @@ EHR.model.DataModelManager.registerMetadata('CT', { chargeType: { allowBlank: true, - defaultValue: 'PMIC', - hidden: true + hidden: false, + defaultValue: 'PMIC' + }, examNum: { @@ -65,7 +66,7 @@ EHR.model.DataModelManager.registerMetadata('CT', { } }, - CTType: { + CTACType: { columnConfig: { width: 150 } @@ -145,6 +146,19 @@ EHR.model.DataModelManager.registerMetadata('CT', { } }, + CTACScanRange: { + header:"CT Scan Range(mm)", + columnConfig: { + width: 150 + } + }, + + phantom: { + columnConfig: { + width: 150 + } + }, + TotalExamDLP: { hidden: true, header: 'Total Exam DLP (mGy*cm)', diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js index 88a3bd1cc..2cd5ebcee 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js @@ -24,7 +24,7 @@ EHR.model.DataModelManager.registerMetadata('DEXA', { project: { allowBlank: true, - hidden: true, + hidden: false, columnConfig: { width: 150 } @@ -32,8 +32,9 @@ EHR.model.DataModelManager.registerMetadata('DEXA', { chargeType: { allowBlank: true, - defaultValue: 'PMIC', - hidden: true + hidden: false, + defaultValue: 'PMIC' + }, examNum: { 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 d5eb5e413..33402f046 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 @@ -25,7 +25,7 @@ EHR.model.DataModelManager.registerMetadata('PET', { project: { allowBlank: true, - hidden: true, + hidden: false, columnConfig: { width: 150 } @@ -33,14 +33,15 @@ EHR.model.DataModelManager.registerMetadata('PET', { chargeType: { allowBlank: true, - defaultValue: 'PMIC', - hidden: true + hidden: false, + defaultValue: 'PMIC' + }, examNum: { header:"Exam Num", columnConfig: { - width: 200 + width: 150 } }, diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js index 52d958ea7..f5454fee1 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js @@ -25,7 +25,7 @@ EHR.model.DataModelManager.registerMetadata('SPECT', { project: { allowBlank: true, - hidden: true, + hidden: false, columnConfig: { width: 150 } @@ -33,8 +33,9 @@ EHR.model.DataModelManager.registerMetadata('SPECT', { chargeType: { allowBlank: true, - defaultValue: 'PMIC', - hidden: true + hidden: false, + defaultValue: 'PMIC' + }, examNum: { diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Services.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Services.js index 02edc5aa0..6b09a5c99 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Services.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Services.js @@ -5,9 +5,7 @@ * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 */ EHR.model.DataModelManager.registerMetadata('PMIC_Services', { - allQueries: { - - }, + allQueries: {}, byQuery: { 'study.encounters': { @@ -31,46 +29,58 @@ EHR.model.DataModelManager.registerMetadata('PMIC_Services', { LABKEY.Filter.create('active', true, LABKEY.Filter.Types.EQUAL) ] } - } - }, - - 'study.drug': { - chargetype: { - defaultValue: 'PMIC Services', - hidden: true - }, - date: { - xtype: 'xdatetime', - extFormat: 'Y-m-d H:i', - defaultValue: (new Date()).format('Y-m-d 8:0') }, - Billable: { - defaultValue: 'Yes', - hidden: false - }, - category: { - defaultValue: 'Research', - hidden: true - }, - remark: { - header: 'Ligand and Comments', - hidden: false - }, - reason: { - defaultValue: 'Research', - hidden: false - }, - lot: { - hidden: true + performedBy: { + defaultValue: LABKEY.Security.currentUser.displayName, + hidden: false, + columnConfig: { + width: 150 + } }, - code: { - editorConfig: { - defaultSubset: 'Research' - }, - header: 'Radioisotopes' + billingproject: { + hidden:true } } - } } + + // 'study.drug': { + // chargetype: { + // defaultValue: 'PMIC Services', + // hidden: true + // }, + // date: { + // xtype: 'xdatetime', + // extFormat: 'Y-m-d H:i', + // defaultValue: (new Date()).format('Y-m-d 8:0') + // }, + // Billable: { + // defaultValue: 'Yes', + // hidden: false + // }, + // category: { + // defaultValue: 'Research', + // hidden: true + // }, + // remark: { + // header: 'Ligand and Comments', + // hidden: false + // }, + // reason: { + // defaultValue: 'Research', + // hidden: false + // }, + // lot: { + // hidden: true + // }, + // code: { + // editorConfig: { + // defaultSubset: 'Research' + // }, + // header: 'Radioisotopes' + // } + // } + // + // } + ); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js index c6e3db70d..0f4fcb3bd 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js @@ -24,7 +24,7 @@ EHR.model.DataModelManager.registerMetadata('US', { project: { allowBlank: true, - hidden: true, + hidden: false, columnConfig: { width: 150 } @@ -32,8 +32,9 @@ EHR.model.DataModelManager.registerMetadata('US', { chargeType: { allowBlank: true, - defaultValue: 'PMIC', - hidden: true + hidden: false, + defaultValue: 'PMIC' + }, examNum: { diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java index 1d5ebfe8b..d3a410bfe 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java @@ -569,7 +569,9 @@ public String toString() //Added: 8-22-2020 R.Blasa EHRService.get().registerMoreActionsButton(new CreateTaskFromRecordButtons(this, "Create Task From Selected", "Procedures", AuxProcedureFormType.NAME), "study", "encounters"); - + //Added: 5/10/21 By Kollil + EHRService.get().registerMoreActionsButton(new CreateTaskFromRecordButtons(this, "Create PMIC Task From Selected", "PMIC Procedures", PMICDataEntryFormType.NAME), "study", "encounters"); + //EHRService.get().registerMoreActionsButton(new CreateTaskFromRecordButtons(this, "Create Task From Selected", "PMIC Procedures", PMICDataEntryFormType.NAME), "study", "PMIC_encounters"); EHRService.get().registerMoreActionsButton(new ChangeQCStateButton(this), "study", "blood"); EHRService.get().registerMoreActionsButton(new ChangeQCStateButton(this, "ONPRC_EHR.window.ChangeLabworkStatusWindow", Collections.singletonList(ClientDependency.supplierFromPath("onprc_ehr/window/ChangeLabworkStatusWindow.js"))), "study", "clinpathRuns"); diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICDataEntryFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICDataEntryFormType.java index c6713bcb0..b75291427 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICDataEntryFormType.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICDataEntryFormType.java @@ -25,6 +25,7 @@ public PMICDataEntryFormType(DataEntryFormContext ctx, Module owner) super(ctx, owner, NAME, "PMIC Data Entry", "Imaging", Arrays.asList( new TaskFormSection(), new AnimalDetailsFormSection(), + new ClinicalEncountersFormSection(), new PMIC_PETFormSection(), new PMIC_CTFormSection(), new PMIC_SPECTFormSection(), 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 db046437b..e3ccb637a 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,8 @@ protected void getAnimalsNotWeightedInPast60Days(StringBuilder msg, Container c, msg.append("Weights:

\n"); SimpleFilter filter = new SimpleFilter(FieldKey.fromString("calculated_status"), "Alive"); - filter.addCondition(FieldKey.fromString("Id/MostRecentWeight/DaysSinceWeight"), 45, CompareType.GT); + //Changed by Kollil, 5/17/21 on Drew's request from 45 to 75 days + filter.addCondition(FieldKey.fromString("Id/MostRecentWeight/DaysSinceWeight"), 75, CompareType.GT); filter.addCondition(FieldKey.fromString("Id/curLocation/Room/housingType/value"), "Cage Location", CompareType.EQUAL); TableInfo ti = getStudySchema(c, u).getTable("demographics"); @@ -272,8 +273,8 @@ protected void getAnimalsNotWeightedInPast60Days(StringBuilder msg, Container c, if (count > 0) { - msg.append("WARNING: There are " + count + " animals in cage locations and have not been weighed in the past 45 days: "); - String url = getExecuteQueryUrl(c, "study", "Demographics", "By Location") + "&query.Id/MostRecentWeight/DaysSinceWeight~gt=45&query.calculated_status~eq=Alive&query.Id/curLocation/Room/housingType/value~eq=Cage Location"; + msg.append("WARNING: There are " + count + " animals in cage locations and have not been weighed in the past 75 days: "); + String url = getExecuteQueryUrl(c, "study", "Demographics", "By Location") + "&query.Id/MostRecentWeight/DaysSinceWeight~gt=75&query.calculated_status~eq=Alive&query.Id/curLocation/Room/housingType/value~eq=Cage Location"; msg.append("Click here to view them.

\n"); msg.append("Summary by area:
\n"); @@ -282,7 +283,7 @@ protected void getAnimalsNotWeightedInPast60Days(StringBuilder msg, Container c, for (String area : areaMap.keySet()) { String newUrl = url + "&query.Id/curLocation/area~eq=" + area; - msg.append("" + area + ":" + areaMap.get(area) + "\n"); + msg.append("" + area + ": " + areaMap.get(area) + "\n"); } msg.append(""); msg.append("

"); From 4125073fb9d7c0f810effaf9354e30ec27e06b63 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Thu, 20 May 2021 06:33:45 -0700 Subject: [PATCH 14/17] Update of Rate Sheet XML for Year 62 forward (#158) * Update of Rate Sheet XML for Year 62 forward * Cleaned up code issue in label * Update onprc_billingpublic/resources/queries/onprc_billing_public/NIHRateConfig.query.xml Co-authored-by: Josh Eckels * Update onprc_billingpublic/resources/queries/onprc_billing_public/NIHRates_ReducedFA.query.xml Co-authored-by: Josh Eckels * Update onprc_billingpublic/resources/queries/onprc_billing_public/NIHIndustryRates.query.xml Co-authored-by: Josh Eckels Co-authored-by: Josh Eckels --- .../NIHIndustryRates.query.xml | 19 +++++++++--------- .../NIHRateConfig.query.xml | 20 +++++++++---------- .../NIHRateSheet.query.xml | 16 +++++++-------- .../NIHRates_ReducedFA.query.xml | 20 +++++++++---------- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/onprc_billingpublic/resources/queries/onprc_billing_public/NIHIndustryRates.query.xml b/onprc_billingpublic/resources/queries/onprc_billing_public/NIHIndustryRates.query.xml index aad927725..7c3d4ebb7 100644 --- a/onprc_billingpublic/resources/queries/onprc_billing_public/NIHIndustryRates.query.xml +++ b/onprc_billingpublic/resources/queries/onprc_billing_public/NIHIndustryRates.query.xml @@ -13,38 +13,39 @@ $#,##0.00
+ - YR62: 5/1/21 to 4/30/22 + YR63: 5/1/22 to 4/30/23 $#,##0.00 - YR63: 5/1/22 to 4/30/23 + YR64: 5/1/23 to 4/30/24 $#,##0.00 - YR64: 5/1/23 to 4/30/24 + YR65: 5/1/24 to 4/30/25 $#,##0.00 - YR65: 5/1/24 to 4/30/25 + YR66: 5/1/25 to 4/30/26 $#,##0.00 - YR66: 5/1/25 to 4/30/26 + YR67: 5/1/26 to 4/30/27 $#,##0.00 - YR67: 5/1/26 to 4/30/27 + YR68: 5/1/27 to 4/30/28 $#,##0.00 - YR68: 5/1/27 to 4/30/28 + YR69: 5/1/28 to 4/30/29 $#,##0.00 - YR69: 5/1/28 to 4/30/29 + YR70: 5/1/29 to 4/30/30 $#,##0.00 @@ -59,4 +60,4 @@ - \ No newline at end of file + diff --git a/onprc_billingpublic/resources/queries/onprc_billing_public/NIHRateConfig.query.xml b/onprc_billingpublic/resources/queries/onprc_billing_public/NIHRateConfig.query.xml index 943a1fd76..87e8f9605 100644 --- a/onprc_billingpublic/resources/queries/onprc_billing_public/NIHRateConfig.query.xml +++ b/onprc_billingpublic/resources/queries/onprc_billing_public/NIHRateConfig.query.xml @@ -13,43 +13,43 @@ $#,##0.00 + - YR62: 5/1/21 to 4/30/22 + YR63: 5/1/22 to 4/30/23 $#,##0.00 - YR63: 5/1/22 to 4/30/23 + YR64: 5/1/23 to 4/30/24 $#,##0.00 - YR64: 5/1/23 to 4/30/24 + YR65: 5/1/24 to 4/30/25 $#,##0.00 - YR65: 5/1/24 to 4/30/25 + YR66: 5/1/25 to 4/30/26 $#,##0.00 - YR66: 5/1/25 to 4/30/26 + YR67: 5/1/26 to 4/30/27 $#,##0.00 - YR67: 5/1/26 to 4/30/27 + YR68: 5/1/27 to 4/30/28 $#,##0.00 - YR68: 5/1/27 to 4/30/28 + YR69: 5/1/28 to 4/30/29 $#,##0.00 - YR69: 5/1/28 to 4/30/29 + YR70: 5/1/29 to 4/30/30 $#,##0.00 - Posted Date MM/dd/yyyy @@ -59,4 +59,4 @@ - \ No newline at end of file + diff --git a/onprc_billingpublic/resources/queries/onprc_billing_public/NIHRateSheet.query.xml b/onprc_billingpublic/resources/queries/onprc_billing_public/NIHRateSheet.query.xml index c65f15585..2e65d0366 100644 --- a/onprc_billingpublic/resources/queries/onprc_billing_public/NIHRateSheet.query.xml +++ b/onprc_billingpublic/resources/queries/onprc_billing_public/NIHRateSheet.query.xml @@ -19,37 +19,37 @@ - YR62: 5/1/21 to 4/30/22 + YR63: 5/1/22 to 4/30/23 $#,##0.00 - YR63: 5/1/22 to 4/30/23 + YR64: 5/1/23 to 4/30/24 $#,##0.00 - YR64: 5/1/23 to 4/30/24 + YR65: 5/1/24 to 4/30/25 $#,##0.00 - YR65: 5/1/24 to 4/30/25 + YR66: 5/1/25 to 4/30/26 $#,##0.00 - YR66: 5/1/25 to 4/30/26 + YR67: 5/1/26 to 4/30/27 $#,##0.00 - YR67: 5/1/26 to 4/30/27 + YR68: 5/1/27 to 4/30/28 $#,##0.00 - YR68: 5/1/27 to 4/30/28 + YR69: 5/1/28 to 4/30/29 $#,##0.00 - YR69: 5/1/28 to 4/30/29 + YR70: 5/1/29 to 4/30/30 $#,##0.00 diff --git a/onprc_billingpublic/resources/queries/onprc_billing_public/NIHRates_ReducedFA.query.xml b/onprc_billingpublic/resources/queries/onprc_billing_public/NIHRates_ReducedFA.query.xml index 9afb7bc29..417ee0127 100644 --- a/onprc_billingpublic/resources/queries/onprc_billing_public/NIHRates_ReducedFA.query.xml +++ b/onprc_billingpublic/resources/queries/onprc_billing_public/NIHRates_ReducedFA.query.xml @@ -13,43 +13,43 @@ $#,##0.00 + - YR62: 5/1/21 to 4/30/22 + YR63: 5/1/22 to 4/30/23 $#,##0.00 - YR63: 5/1/22 to 4/30/23 + YR64: 5/1/23 to 4/30/24 $#,##0.00 - YR64: 5/1/23 to 4/30/24 + YR65: 5/1/24 to 4/30/25 $#,##0.00 - YR65: 5/1/24 to 4/30/25 + YR66: 5/1/25 to 4/30/26 $#,##0.00 - YR66: 5/1/25 to 4/30/26 + YR67: 5/1/26 to 4/30/27 $#,##0.00 - YR67: 5/1/26 to 4/30/27 + YR68: 5/1/27 to 4/30/28 $#,##0.00 - YR68: 5/1/27 to 4/30/28 + YR69: 5/1/28 to 4/30/29 $#,##0.00 - YR69: 5/1/28 to 4/30/29 + YR70: 5/1/29 to 4/30/30 $#,##0.00 - Posted Date MM/dd/yyyy @@ -59,4 +59,4 @@ - \ No newline at end of file + From b4bd2bb45e1fa9ba789edfded9089f16b85585ff Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Wed, 26 May 2021 13:45:28 -0700 Subject: [PATCH 15/17] Modified program to allow reporting to conform into Jarrett's requirements (#166) --- .../queries/EHR_ComplianceDB/ComplianceRecentTests.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ONPRC_EHR_ComplianceDB/resources/queries/EHR_ComplianceDB/ComplianceRecentTests.sql b/ONPRC_EHR_ComplianceDB/resources/queries/EHR_ComplianceDB/ComplianceRecentTests.sql index 4495fdfb3..6453a3232 100644 --- a/ONPRC_EHR_ComplianceDB/resources/queries/EHR_ComplianceDB/ComplianceRecentTests.sql +++ b/ONPRC_EHR_ComplianceDB/resources/queries/EHR_ComplianceDB/ComplianceRecentTests.sql @@ -26,7 +26,7 @@ SELECT WHEN (e.isActive = false) THEN NULL --dont bother to include if the employee is not active WHEN (rn.requirementname IS NULL) THEN NULL WHEN (ee.RequirementName IS NOT NULL) THEN NULL -----Added 12-17-2020 - WHEN (T1.MostRecentDate IS NULL) THEN NULL + WHEN (T1.MostRecentDate IS NULL) THEN 0 ---Modified: 5-18-2021 restore original WHEN(rn.ExpirePeriod = 0 OR rn.ExpirePeriod IS NULL) THEN NULL ELSE (rn.expirePeriod - (age_in_months(T1.MostRecentDate, curdate()))) END AS double) From f309cb5e588187f13b7b5b4853fa0916db71baae Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Fri, 4 Jun 2021 13:36:06 -0700 Subject: [PATCH 16/17] =?UTF-8?q?Restored=20the=20Weights=20by=20Monkey=20?= =?UTF-8?q?Id=20from=20the=20Printable=20reports=20that=20was=E2=80=A6=20(?= =?UTF-8?q?#171)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Restored the Weights by Monkey Id from the Printable reports that was inadvertently removed from the web page. * Add new columns to dataset to make tests happy Co-authored-by: labkey-jeckels --- .../datasets/datasets_metadata.xml | 12 +++ .../resources/views/printableReports.html | 85 +++++++++++++++++++ 2 files changed, 97 insertions(+) diff --git a/onprc_ehr/resources/referenceStudy/datasets/datasets_metadata.xml b/onprc_ehr/resources/referenceStudy/datasets/datasets_metadata.xml index fca83b8e5..c2dc93f12 100644 --- a/onprc_ehr/resources/referenceStudy/datasets/datasets_metadata.xml +++ b/onprc_ehr/resources/referenceStudy/datasets/datasets_metadata.xml @@ -2584,6 +2584,18 @@ varchar Image Upload Link + + varchar + CTACType + + + varchar + CTScan Range + + + varchar + Phantom + PMIC_CTImagingData diff --git a/onprc_ehr/resources/views/printableReports.html b/onprc_ehr/resources/views/printableReports.html index 04d279167..be4c32686 100644 --- a/onprc_ehr/resources/views/printableReports.html +++ b/onprc_ehr/resources/views/printableReports.html @@ -708,6 +708,91 @@ url += ssrsFolder + '&' + LABKEY.ActionURL.queryString(params); return url; }, + menu: [{ + text: 'Print', + handler: function(menu){ + var btn = menu.up('button'); + var url = btn.getUrlString(); + if (!url) + return; + + window.open(url); + } + },{ + text: 'Print To PDF', + handler: function(menu){ + var btn = menu.up('button'); + var url = btn.getUrlString(); + if (!url) + return; + + url += '&rs:Format=PDF'; + window.open(url); + } + }] + + },{ + html: '' + },{ + html: '
', + style: 'padding-top: 10px;', + colspan: 4 + + },{ + html: 'Weight Sheets by Monkey ID:' //Added: 7-27-2017 R.Blasa + },{ + style: 'padding-left: 5px;', + html: '' + },{ + xtype: 'button', + style: 'margin-left: 5px;', + text: 'Print Version', + border: true, + getUrlString: function(){ + var panel = this.up('#sheetPanel'); + var field = panel.down('#animalField'); + + var val = field.getValue() || []; + + + if (val){ + val = Ext4.String.trim(val); + val = val.replace(/[\s,;]+/g, ';'); + val = val.replace(/(^;|;$)/g, ''); + + val = val ? val.split(';') : []; + } + + if (!val){ + Ext4.Msg.alert('Error', 'Must enter at least one animal Id'); + return; + } + value = Ext4.isArray(val) ? val: [val]; + + var params = { + SessionId: LABKEY.Utils.getSessionID(), + HostName: location.hostname + + }; + if (!val) + return; + + if (!Ext4.isEmpty(value)) + params.AnimalID = val; + + + Ext4.apply(params, { + 'rs:ClearSession': true, + 'rs:Command': 'render' + }); + + var url = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSServerURL'); + var ssrsFolder = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSReportFolder'); + ssrsFolder = '/' + ssrsFolder + '/' + 'Clinical/WeightSheetsID'; + + url += ssrsFolder + '&' + LABKEY.ActionURL.queryString(params); + return url; + }, menu: [{ text: 'Print', handler: function(menu){ From 2c49ab8add0790c5ed1d142e06e8f4ed2ccdf6aa Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Fri, 4 Jun 2021 18:34:48 -0700 Subject: [PATCH 17/17] Add missing tables to make SchemaXMLTestCase happy again (#176) Co-authored-by: labkey-jeckels --- onprc_ehr/resources/schemas/onprc_ehr.xml | 35 +++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/onprc_ehr/resources/schemas/onprc_ehr.xml b/onprc_ehr/resources/schemas/onprc_ehr.xml index afd52934a..943b44f09 100644 --- a/onprc_ehr/resources/schemas/onprc_ehr.xml +++ b/onprc_ehr/resources/schemas/onprc_ehr.xml @@ -1027,4 +1027,39 @@ + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + +