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
12 changes: 0 additions & 12 deletions snprc_ehr/resources/queries/snprc_ehr/ActiveVets.sql

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,11 @@
<datatype>varchar</datatype>
</column>
</columns>
<indices>
<index type="unique">
<column>caseid</column>
</index>
</indices>
<tableTitle>Cases</tableTitle>
</table>
<table tableName="matings" tableDbType="TABLE">
Expand Down Expand Up @@ -1498,6 +1503,7 @@
<datatype>varchar</datatype>
<nullable>false</nullable>
<columnTitle>Species code (3 char)</columnTitle>
<scale>10</scale>
</column>
<column columnName="project">
<datatype>integer</datatype>
Expand Down
3 changes: 2 additions & 1 deletion snprc_ehr/src/org/labkey/snprc_ehr/SNPRC_EHRSequencer.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

public enum SNPRC_EHRSequencer
{
ANIMALID("org.labkey.snprc_ehr.domain.AnimalId", 100);
ANIMALID("org.labkey.snprc_ehr.domain.AnimalId", 100),
ADMITID("org.labkey.snprc_ehr.domain.AdmitId", 300000);
// "last value assigned" is stored in the table - not the same as CAMP which is the "next value to assign"
// new sequences are added here
// example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.labkey.api.security.UserManager;
import org.labkey.api.util.PageFlowUtil;
import org.labkey.snprc_ehr.SNPRC_EHRSchema;
import org.labkey.snprc_ehr.SNPRC_EHRSequencer;

import java.sql.ResultSet;
import java.sql.SQLException;
Expand Down Expand Up @@ -222,15 +223,7 @@ public Integer getNextDietCode()
*/
public Integer getNextCaseId()
{
DbSchema dbStudySchema = SNPRC_EHRSchema.getInstance().getStudySchema();
SQLFragment sql = new SQLFragment("SELECT MAX(c.caseid) AS MAX_CODE FROM ");
sql.append(getTableInfo("study", "cases"), "c");
SqlSelector sqlSelector = new SqlSelector(dbStudySchema, sql);

Integer caseId = sqlSelector.getObject(Integer.class);

// if table has been truncated - reseed the caseid at 1
return (caseId == null) ? 1 : caseId + 1;
return SNPRC_EHRSequencer.ADMITID.getNext(getContainer(), getUser());
}

public Map<String, Object> getExtraContext()
Expand Down
Loading