diff --git a/nirc_ehr/resources/queries/study/demographicsLastProject.query.xml b/nirc_ehr/resources/queries/study/demographicsLastProject.query.xml new file mode 100644 index 00000000..d01971e9 --- /dev/null +++ b/nirc_ehr/resources/queries/study/demographicsLastProject.query.xml @@ -0,0 +1,13 @@ + + + + + + + Last Project + + +
+
+
+
diff --git a/nirc_ehr/resources/queries/study/demographicsLastProject.sql b/nirc_ehr/resources/queries/study/demographicsLastProject.sql new file mode 100644 index 00000000..e4870630 --- /dev/null +++ b/nirc_ehr/resources/queries/study/demographicsLastProject.sql @@ -0,0 +1,10 @@ + +SELECT + d2.id, + d2.project, + h.enddate as enddate + +FROM study.assignment d2 + JOIN (SELECT id, max(date) as maxDate, max(enddate) as enddate FROM study.assignment h GROUP BY id) h + ON (h.id = d2.id and d2.date = h.maxdate) +WHERE d2.qcstate.publicdata = true \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/demographicsLastProtocol.query.xml b/nirc_ehr/resources/queries/study/demographicsLastProtocol.query.xml new file mode 100644 index 00000000..94265b7c --- /dev/null +++ b/nirc_ehr/resources/queries/study/demographicsLastProtocol.query.xml @@ -0,0 +1,13 @@ + + + + + + + Last Protocol + + +
+
+
+
\ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/demographicsLastProtocol.sql b/nirc_ehr/resources/queries/study/demographicsLastProtocol.sql new file mode 100644 index 00000000..d72da760 --- /dev/null +++ b/nirc_ehr/resources/queries/study/demographicsLastProtocol.sql @@ -0,0 +1,10 @@ + +SELECT + d2.id, + d2.protocol, + h.enddate as enddate + +FROM study.protocolAssignment d2 + JOIN (SELECT id, max(date) as maxDate, max(enddate) as enddate FROM study.protocolAssignment h GROUP BY id) h + ON (h.id = d2.id and d2.date = h.maxdate) +WHERE d2.qcstate.publicdata = true \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/tissueDisposition.query.xml b/nirc_ehr/resources/queries/study/tissueDisposition.query.xml index 18a0c90a..494a4ab1 100644 --- a/nirc_ehr/resources/queries/study/tissueDisposition.query.xml +++ b/nirc_ehr/resources/queries/study/tissueDisposition.query.xml @@ -5,6 +5,7 @@ Tissue + 80 ehr_lookups necropsy_tissue @@ -12,7 +13,8 @@ - Tissue Disposition Codes + Tissue Disposition Code + 180 ehr_lookups necropsy_disposition_codes diff --git a/nirc_ehr/resources/queries/study/tissueDisposition/.qview.xml b/nirc_ehr/resources/queries/study/tissueDisposition/.qview.xml index 6289bd39..428b9371 100644 --- a/nirc_ehr/resources/queries/study/tissueDisposition/.qview.xml +++ b/nirc_ehr/resources/queries/study/tissueDisposition/.qview.xml @@ -7,5 +7,6 @@ + \ No newline at end of file diff --git a/nirc_ehr/resources/views/necropsy.html b/nirc_ehr/resources/views/necropsy.html new file mode 100644 index 00000000..f7390155 --- /dev/null +++ b/nirc_ehr/resources/views/necropsy.html @@ -0,0 +1,94 @@ + + +
+ + +
+
+
+
+ +
+
+
+
+
+ + diff --git a/nirc_ehr/resources/views/necropsy.view.xml b/nirc_ehr/resources/views/necropsy.view.xml new file mode 100644 index 00000000..37cdfd93 --- /dev/null +++ b/nirc_ehr/resources/views/necropsy.view.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/BehaviorDefaults.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/BehaviorDefaults.js index f225153d..efdde47b 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/BehaviorDefaults.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/BehaviorDefaults.js @@ -51,7 +51,7 @@ EHR.model.DataModelManager.registerMetadata('BehaviorDefaults', { store: { type: 'labkey-store', schemaName: 'core', - sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.users', + sql: "SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.PrincipalsWithoutAdmin WHERE active = TRUE AND Type = 'u'", autoLoad: true } } diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalCase.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalCase.js index 9567f57b..7be9323e 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalCase.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalCase.js @@ -134,7 +134,7 @@ EHR.model.DataModelManager.registerMetadata('ClinicalCase', { store: { type: 'labkey-store', schemaName: 'core', - sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.users', + sql: "SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.PrincipalsWithoutAdmin WHERE active = TRUE AND Type = 'u'", autoLoad: true } } diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js index 90e99cbc..2f734dc3 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js @@ -24,7 +24,7 @@ EHR.model.DataModelManager.registerMetadata('Default', { // from the display when a value is selected from the dropdown even though the 'userid' value gets saved as a text (this behavior was only seen // in the form panel but not in the grid panel). // casting it as a varchar when loading the store fixes this issue. - sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.users', + sql: "SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.PrincipalsWithoutAdmin WHERE active = TRUE AND Type = 'u'", autoLoad: true } } diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java b/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java index e80bd590..dff28c58 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java @@ -37,6 +37,7 @@ import org.labkey.api.module.Module; import org.labkey.api.module.ModuleContext; import org.labkey.api.query.DefaultSchema; +import org.labkey.api.query.DetailsURL; import org.labkey.api.query.QuerySchema; import org.labkey.api.resource.Resource; import org.labkey.api.security.roles.RoleManager; @@ -188,6 +189,9 @@ protected void doStartupAfterSpringConfig(ModuleContext moduleContext) NotificationService.get().registerNotification(new NIRCProcedureOverdueNotification()); NotificationService.get().registerNotification(new NIRCPregnancyOutcomeNotification()); + EHRService.get().registerReportLink(EHRService.REPORT_LINK_TYPE.moreReports, "Printable Necropsy Report", this, DetailsURL.fromString("/nirc_ehr-necropsy.view"), "Pathology"); + + // Ensure N: is mounted if it's configured, as it's being mapped in via a symlink/shortcut, so we can't // recognize paths using it based solely on their drive letter and mount just-in-time if (NetworkDrive.getNetworkDrive("N:\\") != null) diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java b/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java index a5951343..ef34eaa1 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java @@ -974,6 +974,20 @@ private void customizeAnimalTable(AbstractTableInfo ds) col.setLabel("Alias"); ds.addColumn(col); } + if (ds.getColumn("lastProtocol") == null) + { + var col = getWrappedCol(us, ds, "lastProtocol", "demographicsLastProtocol", "Id", "Id"); + col.setLabel("Assignment - Final Protocol"); + col.setDescription("This calculates the final protocol assignment for the animal. This is distinct from active protocol assignment because it will return a protocol assignment for dead animals"); + ds.addColumn(col); + } + if (ds.getColumn("lastProject") == null) + { + var col = getWrappedCol(us, ds, "lastProject", "demographicsLastProject", "Id", "Id"); + col.setLabel("Assignment - Final Project"); + col.setDescription("This calculates the final project assignment for the animal. This is distinct from active project assignment because it will return a project assignment for dead animals"); + ds.addColumn(col); + } } private void customizeProtocolTable(AbstractTableInfo ti)