Skip to content

Commit 3117a7b

Browse files
authored
26.3 fb master problem updates (#1798)
Created a new program that will update historical Master Problem Wound records to a different name.
1 parent 85910c3 commit 3117a7b

3 files changed

Lines changed: 163 additions & 1 deletion

File tree

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
2+
CREATE TABLE onprc_ehr.Rpt_TempProblemList(
3+
searchid integer IDENTITY(100,1) NOT NULL,
4+
animalid varchar(200) NULL,
5+
date smalldatetime NULL,
6+
objectid varchar(4000) NULL,
7+
caseid varchar(4000) NULL
8+
9+
) ON [PRIMARY]
10+
GO
11+
12+
CREATE TABLE onprc_ehr.Rpt_TempProblemListMaster(
13+
searchid integer IDENTITY(100,1) NOT NULL,
14+
animalid varchar(200) NULL,
15+
date smalldatetime NULL,
16+
objectid varchar(4000) NULL,
17+
caseid varchar(4000) NULL
18+
19+
) ON [PRIMARY]
20+
GO
21+
22+
23+
24+
25+
/*
26+
**
27+
** Created by Date Comment
28+
**
29+
** blasa 7-7-2026 Process to update historical problem list records
30+
**
31+
**
32+
**
33+
**/
34+
35+
CREATE Procedure onprc_ehr.s_MasterProblemHistoricalProcess
36+
37+
38+
AS
39+
40+
41+
declare
42+
43+
44+
@TempSearchKey Int,
45+
@Searchkey Int,
46+
@AnimalID varchar(100),
47+
@date smalldatetime,
48+
@objectid varchar(4000),
49+
@caseid varchar(4000)
50+
51+
52+
Begin
53+
54+
55+
----- Reset the last two months only
56+
57+
Delete onprc_ehr.Rpt_TempProblemList
58+
59+
If @@Error <> 0
60+
GoTo Err_Proc
61+
62+
63+
64+
Set @Tempsearchkey = 0
65+
Set @Searchkey = 0
66+
Set @Animalid = ''
67+
Set @date = null
68+
Set @objectid = null
69+
Set @caseid = null
70+
71+
--- Set initial processing
72+
73+
Insert into onprc_ehr.Rpt_TempProblemList
74+
select participantid,
75+
date,
76+
objectid,
77+
caseid
78+
from studydataset.c6d200_problem
79+
Where category = 'Wound'
80+
And subcategory = 'Digit Amputation'
81+
And qcstate = 18
82+
83+
Order by participantid
84+
85+
Select top 1 @SearchKey = searchID from onprc_ehr.Rpt_TempProblemList
86+
Order by searchid
87+
88+
89+
While @Tempsearchkey < @SearchKey
90+
Begin
91+
92+
Set @Animalid = ''
93+
Set @date = null
94+
Set @objectid = null
95+
96+
select @animalid = animalid, @Date = date, @Objectid = objectid
97+
from Rpt_TempProblemList Where searchid = @Searchkey
98+
99+
-------Begin updating records
100+
101+
102+
Update pb
103+
Set pb.subcategory = 'Digit Removal/Caudectomy'
104+
From studydataset.c6d200_problem pb
105+
Where pb.Participantid = @Animalid
106+
And pb.objectid = @objectid
107+
108+
109+
If @@Error <> 0
110+
GoTo Err_Proc
111+
112+
113+
Set @TempSearchkey = @Searchkey
114+
115+
Select Top 1 @SearchKey = searchid From onprc_ehr.Rpt_TempProblemList
116+
Where searchid > @Tempsearchkey
117+
Order by searchid
118+
119+
120+
121+
122+
End ------(While @tempsearchkey < @Searchkey)
123+
124+
---- Create an audit record of these entries
125+
126+
insert into onprc_ehr.Rpt_TempProblemListMaster
127+
Select animalid, date, objectid, caseid
128+
from onprc_ehr.Rpt_TempProblemList
129+
130+
131+
Return 0
132+
133+
Err_Proc: Return 1
134+
135+
136+
137+
END
138+
139+
140+
141+

onprc_ehr/resources/schemas/onprc_ehr.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,5 +1537,26 @@
15371537
</columns>
15381538
</table>
15391539

1540+
<table tableName="Rpt_TempProblemList" tableDbType="TABLE">
1541+
<columns>
1542+
<column columnName="searchid"/>
1543+
<column columnName="animalid"/>
1544+
<column columnName="date"/>
1545+
<column columnName="objectid"/>
1546+
<column columnName="caseid"/>
1547+
</columns>
1548+
</table>
1549+
1550+
<table tableName="Rpt_TempProblemListMaster" tableDbType="TABLE">
1551+
<columns>
1552+
<column columnName="searchid"/>
1553+
<column columnName="animalid"/>
1554+
<column columnName="date"/>
1555+
<column columnName="objectid"/>
1556+
<column columnName="caseid"/>
1557+
</columns>
1558+
</table>
1559+
1560+
15401561

15411562
</tables>

onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public String getName()
124124
@Override
125125
public @Nullable Double getSchemaVersion()
126126
{
127-
return 26.001;
127+
return 26.002;
128128
}
129129

130130
@Override

0 commit comments

Comments
 (0)