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) 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/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Daily.sql new file mode 100644 index 000000000..d538ef1e6 --- /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.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, PMIC_getFolderInfo r +Where r.id = e.resourceid + 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 new file mode 100644 index 000000000..5674ea490 --- /dev/null +++ b/extscheduler/resources/queries/extscheduler/PMIC_Scheduler_Weekly.sql @@ -0,0 +1,29 @@ +/* +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, + 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, PMIC_getFolderInfo r +Where r.id = e.resourceid +--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/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_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 + diff --git a/onprc_ehr/resources/etls/HousingTransferAlert_Process.xml b/onprc_ehr/resources/etls/HousingTransferAlert_Process.xml new file mode 100644 index 000000000..fc5361d48 --- /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/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 new file mode 100644 index 000000000..2d304d87a --- /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 + + + Housing Condition + + + Reason For Move + + + + + 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 new file mode 100644 index 000000000..3cc90d077 --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/housing_transfers.sql @@ -0,0 +1,24 @@ +Select + h.Id, + CASE + 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, + 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 >= '03-01-2021' +And h.date >= timestampadd(SQL_TSI_DAY, -1, now()) 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_Angio_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_Angio_AnimalHistory.sql new file mode 100644 index 000000000..9f7d90775 --- /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_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..d7b7c56e8 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_CTImagingData.query.xml @@ -0,0 +1,167 @@ + + + + + + + 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 + + + + + CTAC Type + + study + PMIC_CTACType_values + value + + + + + CT Scan Range(mm) + + + + CTDIVol + 0.0000 + + + + Phantom + + study + PMIC_Phantom_values + value + + + + + DLP + 0.0000 + + + + Total Exam DLP + 0.0000 + + + + CT Scan Range(mm) + + + + 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_CT_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_CT_AnimalHistory.sql new file mode 100644 index 000000000..8c26ad8aa --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_CT_AnimalHistory.sql @@ -0,0 +1,24 @@ +SELECT + Id, + Date, + examNum, + accessionNum, + PMICType, + contrastType, + contrastAmount, + route, + CTACType, + CTScanRange, + phantom, + 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_ChargeTypes.sql b/onprc_ehr/resources/queries/study/PMIC_ChargeTypes.sql new file mode 100644 index 000000000..90edf3d2a --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_ChargeTypes.sql @@ -0,0 +1,3 @@ +SELECT chargetype +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/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_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_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..2b117a817 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_PETImagingData.query.xml @@ -0,0 +1,170 @@ + + + + + + + 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 + + + + + CTAC Type + + study + PMIC_CTACType_values + value + + + + + CTAC Scan Range(mm) + + + + CTDIVol + 0.0000 + + + + Phantom + + study + PMIC_Phantom_values + value + + + + + DLP + 0.0000 + + + + Total Exam DLP + 0.0000 + + + + Wet lab use + + study + PMIC_WetLabUse_values + value + + + + + Ligand and Comments + + + + Image Upload Link + + + + Performed By + + + + + study + qcstate + RowId + + + + + Task Id + + ehr + tasks + taskid + + + + true + + + + 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_PET_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_PET_AnimalHistory.sql new file mode 100644 index 000000000..009f7bf26 --- /dev/null +++ b/onprc_ehr/resources/queries/study/PMIC_PET_AnimalHistory.sql @@ -0,0 +1,25 @@ +SELECT + Id, + Date, + examNum, + accessionNum, + PMICType, + PETRadioisotope, + PETDoseMCI, + PETDoseMBQ, + route, + CTACType, + CTACScanRange, + CTDIvol, + phantom, + DLP, + --totalExamDLP, + wetLabUse, + ligandAndComments, + --imageUploadLink, + taskid, + qcstate, + performedby, + created, + createdBy +from study.PMIC_PETImagingData 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_SPECT_AnimalHistory.sql b/onprc_ehr/resources/queries/study/PMIC_SPECT_AnimalHistory.sql new file mode 100644 index 000000000..843381441 --- /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_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_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/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/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 --> + + + + + + + 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/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 6d96b6159..10604fc10 100644 --- a/onprc_ehr/resources/referenceStudy/datasets/datasets_metadata.xml +++ b/onprc_ehr/resources/referenceStudy/datasets/datasets_metadata.xml @@ -2420,6 +2420,688 @@ 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 + + + varchar + CTACType + + + varchar + CTScan Range + + + varchar + Phantom + + + 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 +
+ + 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 index 4cf1b33f2..09310731a 100644 --- 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 @@ -1,5 +1,144 @@ -ALTER TABLE onprc_ehr.AvailableBloodVolume ALTER COLUMN Id nvarchar(32) NOT NULL; +/****** 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 -ALTER TABLE onprc_ehr.AvailableBloodVolume ADD CONSTRAINT PK_AvailableBloodVolume PRIMARY KEY (Id); + +-- 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 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/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/resources/schemas/onprc_ehr.xml b/onprc_ehr/resources/schemas/onprc_ehr.xml index 1b0d871c3..943b44f09 100644 --- a/onprc_ehr/resources/schemas/onprc_ehr.xml +++ b/onprc_ehr/resources/schemas/onprc_ehr.xml @@ -992,4 +992,74 @@
+ + + + PMIC_Reference_Data + + DETAILED + + + true + + + + Value + + + + Name + + + + + End Date + + + + true + + + + true + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + +
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/resources/views/printableReports.html b/onprc_ehr/resources/views/printableReports.html index f1d335528..be4c32686 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,39 +582,49 @@ 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('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; + 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('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, @@ -628,27 +635,37 @@ 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; + 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); - } + 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 + url += '&rs:Format=PDF'; + window.open(url); + } + }] + },{ + html: '' + },{ + html: '
', + style: 'padding-top: 10px;', + colspan: 4 },{ html: 'Weight Sheets by Breeding Groups:' //Added: 2-28-2017 R.Blasa @@ -694,15 +711,25 @@ menu: [{ text: 'Print', handler: function(menu){ - var btn = menu.up('button'); - var url = btn.getUrlString(); - if (!url) - return; + 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: '' @@ -774,40 +801,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 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..535189367 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Angio.js @@ -0,0 +1,100 @@ + +/** + * 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, + hidden: false, + 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..689ccabf2 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_CT.js @@ -0,0 +1,179 @@ + +/** + * 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, + hidden: false, + columnConfig: { + width: 150 + } + }, + + chargeType: { + allowBlank: true, + hidden: false, + defaultValue: 'PMIC' + + }, + + 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 + } + }, + + CTACType: { + 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 + } + }, + + CTACScanRange: { + header:"CT Scan Range(mm)", + columnConfig: { + width: 150 + } + }, + + phantom: { + 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..2cd5ebcee --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_DEXA.js @@ -0,0 +1,108 @@ + +/** + * 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, + hidden: false, + columnConfig: { + width: 150 + } + }, + + chargeType: { + allowBlank: true, + hidden: false, + defaultValue: 'PMIC' + + }, + + 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..33402f046 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_PET.js @@ -0,0 +1,177 @@ + +/** + * 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, + hidden: false, + columnConfig: { + width: 150 + } + }, + + chargeType: { + allowBlank: true, + hidden: false, + defaultValue: 'PMIC' + + }, + + examNum: { + header:"Exam Num", + columnConfig: { + width: 150 + } + }, + + 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..f5454fee1 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_SPECT.js @@ -0,0 +1,176 @@ + +/** + * 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, + hidden: false, + columnConfig: { + width: 150 + } + }, + + chargeType: { + allowBlank: true, + hidden: false, + defaultValue: 'PMIC' + + }, + + 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..6b09a5c99 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_Services.js @@ -0,0 +1,86 @@ + +/* + * 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) + ] + } + }, + performedBy: { + defaultValue: LABKEY.Security.currentUser.displayName, + hidden: false, + columnConfig: { + width: 150 + } + }, + 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 new file mode 100644 index 000000000..0f4fcb3bd --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_US.js @@ -0,0 +1,93 @@ + +/** + * 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, + hidden: false, + columnConfig: { + width: 150 + } + }, + + chargeType: { + allowBlank: true, + hidden: false, + defaultValue: 'PMIC' + + }, + + 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/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/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 96ebf128e..d3a410bfe 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.906; + return 20.908; } @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)); @@ -563,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 new file mode 100644 index 000000000..b75291427 --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICDataEntryFormType.java @@ -0,0 +1,57 @@ + +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 ClinicalEncountersFormSection(), + 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..a263f146b --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PMICRequestFormType.java @@ -0,0 +1,76 @@ +/* + * 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.json.JSONObject; +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; +import java.util.HashMap; +import java.util.Map; + +//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"); + } + + } + + //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() +// { +// 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/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"); 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); 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..0afd3f547 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -1099,29 +1099,42 @@ 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(); - 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,88 +1149,226 @@ 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("
Today's PMIC events:

\n"); + msg.append("
Resource Id Start Date End Date Name Alias Quantity Comments Color Room Bldg
" + rs.getString("resourceid") + "" + rs.getString("startdate") + "" + rs.getString("enddate") + "" + rs.getString("name") + "" + rs.getString("alias") + "" + rs.getString("quantity") + "" + rs.getString("comments") + "" + rs.getString("color") + "" + rs.getString("room") + "" + rs.getString("bldg") + "
"); + 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); + + 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 + + /** + * 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("
Housing Transfers:

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

Click here to view the transfers in PRIME

\n"); + msg.append("
"); + } + + if (count == 0) { + msg.append("There are no animal transfers today!
"); + } + + //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")); + columns.add(FieldKey.fromString("ActiveDiets")); + + final Map colMap = QueryService.get().getColumns(ti, columns); + TableSelector ts2 = new TableSelector(ti, colMap.values(), null, null); + + //Legend + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append("
LEGEND:
Yellow row indicates animal transferred into an empty room.
Blue cell indicates animal has active Clinical treatments with no Diets.
Orange cell indicates animal has active Clinical treatments including Diets (or) just Diets.
"); + // Table 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 && 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"); + } + 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("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")) + "
"); - } - //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"); - } - else { - 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(""); + 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"); } - }); - msg.append("
Resource Id Start Date End Date Name Alias Quantity Comments Color Room Bldg
" + rs1.getString("resourceid") + "" + rs1.getString("startdate") + "" + rs1.getString("enddate") + "" + rs1.getString("name") + "" + rs1.getString("alias") + "" + rs1.getString("quantity") + "" + rs1.getString("comments") + "" + rs1.getString("color") + "" + rs1.getString("room") + "" + rs1.getString("bldg") + "
" + PageFlowUtil.filter(rs.getString("Id")) + " " + PageFlowUtil.filter(rs.getString("Id")) + " " + PageFlowUtil.filter(rs.getString("Id")) + "
"); + msg.append("" + PageFlowUtil.filter(rs.getString("InDate")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("Building")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("Area")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("Room")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("Cage")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("housingType")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("housingCondition")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("ReasonForMove")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getString("Remark")) + ""); + msg.append("" + PageFlowUtil.filter(rs.getInt("TotalAnimals")) + ""); + msg.append(""); + } + } - } + }); + msg.append(""); } } - //End of PMIC alert + //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 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("

"); 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..8198db54c 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 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 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