Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions nirc_ehr/resources/queries/study/demographicsLastProject.query.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<query xmlns="http://labkey.org/data/xml/query">
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="demographicsLastProject" tableDbType="NOT_IN_DB">
<columns>
<column columnName="project">
<columnTitle>Last Project</columnTitle>
</column>
</columns>
</table>
</tables>
</metadata>
</query>
10 changes: 10 additions & 0 deletions nirc_ehr/resources/queries/study/demographicsLastProject.sql
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<query xmlns="http://labkey.org/data/xml/query">
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="demographicsLastProtocol" tableDbType="NOT_IN_DB">
<columns>
<column columnName="protocol">
<columnTitle>Last Protocol</columnTitle>
</column>
</columns>
</table>
</tables>
</metadata>
</query>
10 changes: 10 additions & 0 deletions nirc_ehr/resources/queries/study/demographicsLastProtocol.sql
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion nirc_ehr/resources/queries/study/tissueDisposition.query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
<columns>
<column columnName="necropsyTissue">
<columnTitle>Tissue</columnTitle>
<displayWidth>80</displayWidth>
<fk>
<fkDbSchema>ehr_lookups</fkDbSchema>
<fkTable>necropsy_tissue</fkTable>
<fkColumnName>value</fkColumnName>
</fk>
</column>
<column columnName="necropsyDispositionCode">
<columnTitle>Tissue Disposition Codes</columnTitle>
<columnTitle>Tissue Disposition Code</columnTitle>
<displayWidth>180</displayWidth>
<fk>
<fkDbSchema>ehr_lookups</fkDbSchema>
<fkTable>necropsy_disposition_codes</fkTable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
<column name="date"/>
<column name="necropsyTissue"/>
<column name="necropsyDispositionCode"/>
<column name="remark"/>
</columns>
</customView>
94 changes: 94 additions & 0 deletions nirc_ehr/resources/views/necropsy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

<style>
.page-break {
page-break-before: always; /* Older CSS spec */
break-before: page; /* Newer spec */
}

@media print {
.hide-on-print {
display: none !important;
}
}

/* Top border on panel header when printing */
.panel-heading {
border-top: 1px solid black;
}
</style>
<div class="hide-on-print">
<label for="animalId" style="margin-right: 10px;">Animal Id</label><input id="animalId" type="text" />
<button id="animalIdSubmit" name="animalIdSubmit">Submit</button>
<br>
<div id="animalIdError"></div>
</div>
<br>

<div id="animalDeath"></div>
<div id="animalNecropsy"></div>
<div class="page-break"></div>
<div id="grossPathology"></div>
<div id="tissueDisposition"></div>

<script type="text/javascript" nonce="<%=scriptNonce%>">
document.getElementById('animalIdSubmit')['onclick'] = function(){ submitNecropsyForm(); return false; }

const submitNecropsyForm = function() {
const animalId = document.getElementById('animalId').value;

if (!animalId) {
document.getElementById('animalIdError').innerHTML = 'Please enter an Animal Id';
}

const animalIdError = document.getElementById('animalIdError');
const animalDeath = document.getElementById('animalDeath');
const animalNecropsy = document.getElementById('animalNecropsy');
const grossPathology = document.getElementById('grossPathology');
const tissueDisposition = document.getElementById('tissueDisposition');

animalIdError.innerHTML = '';
animalDeath.innerHTML = '';
animalNecropsy.innerHTML = '';
grossPathology.innerHTML = '';
tissueDisposition.innerHTML = '';

const filterArray = [LABKEY.Filter.create('Id', animalId, LABKEY.Filter.Types.EQUAL)]

Ext4.create('LDK.panel.DetailsPanel', {
store: {
schemaName: 'study',
queryName: 'deaths',
filterArray: filterArray,
columns: 'Id,Id/demographics/species,date,reason,remark,performedby,Id/lastProtocol/protocol,Id/lastProject/project',
},
title: 'Death',
renderTo: 'animalDeath',
showBackBtn: false
});

Ext4.create('LDK.panel.DetailsPanel', {
store: {
schemaName: 'study',
queryName: 'necropsy',
filterArray: filterArray,
},
title: 'Necropsy',
renderTo: 'animalNecropsy',
showBackBtn: false
});

LDK.Utils.getReadOnlyQWP({
title: 'Gross Pathology',
schemaName: 'study',
queryName: 'grossPathology',
filterArray: filterArray,
}).render('grossPathology');

LDK.Utils.getReadOnlyQWP({
title: 'Tissue Disposition',
schemaName: 'study',
queryName: 'tissueDisposition',
filterArray: filterArray,
}).render('tissueDisposition');
}
</script>
3 changes: 3 additions & 0 deletions nirc_ehr/resources/views/necropsy.view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<view xmlns="http://labkey.org/data/xml/view" template="print" title="Necropsy Report">
<requiresLogin/>
</view>
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
4 changes: 4 additions & 0 deletions nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down