Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@

CREATE TABLE onprc_ehr.Rpt_TempJmacDate(
searchid integer IDENTITY(100,1) NOT NULL,
animalid varchar(200) NULL,
JBGRemovalDate varchar(255) NULL,
JBGActualRemovalDate varchar(255) NULL

) ON [PRIMARY]
GO

CREATE TABLE onprc_ehr.JmacRemovalDate(
searchid integer IDENTITY(100,1) NOT NULL,
Id varchar(100) NULL,
JBGRemovalDate smalldatetime NULL,
JBGActualRemovalDate smalldatetime NULL,
DaysDiff float NULL,
reason varchar(100) NULL
) ON [PRIMARY]
GO



/*
**
** Created by Date Comment
**
** blasa 4/10/2026 Process to update jmac Removal date
**
**
**
**/

CREATE Procedure onprc_ehr.s_JmacRemovalDateProcess


AS


declare


@TempSearchKey Int,
@Searchkey Int,
@AnimalID Int,
@OrgRemovalDate smalldatetime,
@ActualRemovalDate smalldatetime


Begin


----- Reset the last two months only

Delete onprc_ehr.Rpt_TempJmacDate

If @@Error <> 0
GoTo Err_Proc



Set @Tempsearchkey = 0
Set @Searchkey = 0

--- Set initial processing

Insert into onprc_ehr.Rpt_TempJmacDate
select Id, JBGRemovalDate, JBGActualRemovalDate
from onprc_ehr.JmacRemovalDate

Order by searchid

Select top 1 @SearchKey = searchID from onprc_ehr.Rpt_TempJmacDate
Order by searchid


While @Tempsearchkey < @SearchKey
Begin



select @animalid = animalid, @OrgRemovalDate = JBGRemovalDate, @ActualRemovalDate = JBGActualRemovalDate
from onprc_ehr.Rpt_TempJmacDate Where searchid = @Searchkey

-------Begin updating records


Update JB
Set JB.enddate = @ActualRemovalDate
From StudyDataset.c6d346_animal_group_members JB
Where JB.Participantid = @Animalid
And cast(JB.enddate as Date) = cast(@OrgRemovalDate as Date)


If @@Error <> 0
GoTo Err_Proc


Set @TempSearchkey = @Searchkey

Select Top 1 @SearchKey = searchid From onprc_ehr.Rpt_TempJmacDate
Where @Searchkey > @Tempsearchkey
Order by searchid




End ------(While @tempsearchkey < @Searchkey)


Return 0

Err_Proc: Return 1




END




21 changes: 21 additions & 0 deletions onprc_ehr/resources/schemas/onprc_ehr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1480,4 +1480,25 @@
</columns>
</table>

<table tableName="Rpt_TempJmacDate" tableDbType="TABLE">
<columns>
<column columnName="searchid"/>
<column columnName="animalic"/>
<column columnName="JBGRemovalDate"/>
<column columnName="JBGActualRemovalDate"/>
</columns>
</table>

<table tableName="JmacRemovalDate" tableDbType="TABLE">
<columns>
<column columnName="searchid"/>
<column columnName="Id"/>
<column columnName="JBGRemovalDate"/>
<column columnName="JBGActualRemovalDate"/>
<column columnName="DaysDiff"/>
<column columnName="reason"/>
</columns>
</table>


</tables>
2 changes: 1 addition & 1 deletion onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public String getName()
@Override
public @Nullable Double getSchemaVersion()
{
return 25.004;
return 25.005;
}

@Override
Expand Down
Loading