diff --git a/ONPRC_EHR_ComplianceDB/resources/schemas/dbscripts/sqlserver/onprc_ehr_compliancedb-25.000-25.001.sql b/ONPRC_EHR_ComplianceDB/resources/schemas/dbscripts/sqlserver/onprc_ehr_compliancedb-25.000-25.001.sql
new file mode 100644
index 000000000..c64d1ffad
--- /dev/null
+++ b/ONPRC_EHR_ComplianceDB/resources/schemas/dbscripts/sqlserver/onprc_ehr_compliancedb-25.000-25.001.sql
@@ -0,0 +1,579 @@
+ALTER TABLE onprc_ehr_compliancedb.ComplianceProcedureReport ALTER COLUMN expired_period varchar(50) NULL;
+GO
+
+ALTER TABLE onprc_ehr_compliancedb.ComplianceProcedureReport ALTER COLUMN new_expired_period varchar(50) NULL;
+GO
+
+ALTER TABLE onprc_ehr_compliancedb.ComplianceRecentReport ALTER COLUMN expired_period varchar(50) NULL;
+GO
+
+ALTER TABLE onprc_ehr_compliancedb.ComplianceRecentReport ALTER COLUMN new_expired_period varchar(50) NULL;
+GO
+
+
+
+EXEC core.fn_dropifexists 'p_ComplianceProcedureOverDueSoon_Process', 'onprc_ehr_compliancedb', 'PROCEDURE';
+GO
+
+-- Author: R. Blasa
+-- Created: 9-20-2024
+
+/*
+**
+** Created by
+** Blasa 9-20-2024 Created a storedprocedure to create a static set of data from
+** the ComplianceProcedureRecentTest.sql query
+**
+** 1-22-2026 Fix the issues with more than one subquery results
+**
+**
+**
+*/
+
+CREATE Procedure onprc_ehr_compliancedb.p_ComplianceProcedureOverDueSoon_Process
+
+
+AS
+
+
+ ----- Reset Reporting table
+ Delete onprc_ehr_compliancedb.ComplianceProcedureReport
+
+ If @@Error <> 0
+ GoTo Err_Proc
+
+
+
+BEGIN
+
+ Insert into onprc_ehr_compliancedb.ComplianceProcedureReport
+ (
+ requirementname,
+ employeeid,
+ unit,
+ category,
+ trackingflag,
+ email,
+ lastname,
+ firstname,
+ host,
+ supervisor,
+ trainee_type,
+ requirement_name_type,
+ times_completed,
+ expired_period,
+ new_expired_Period,
+ mostrecentcompleted_date,
+ comment,
+ snooze_date,
+ months_until_renewal
+
+ )
+
+
+
+
+
+ select b.requirementname,
+ a.employeeid,
+ string_agg(a.unit,char(10)) as unit,
+ string_agg(a.category,char(10)) as category,
+ string_agg(b.trackingflag,char(10)) as trackingflag,
+ (select h.email from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as email,
+ (select h.lastname from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as lastname,
+ (select h.firstname from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as firstname,
+ (select h.majorudds from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as host,
+ (select h.supervisor from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as supervisor,
+ (select h.type from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as trainee_type, ----- type trainee, or trainer
+ (select string_agg(h.type,char(10)) from ehr_compliancedb.Requirements h where h.requirementname = b.requirementname) as requirement_type,
+
+ (select count(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= b.requirementname and zz.employeeid= a.employeeid ) as times_Completed,
+
+ (select string_agg(k.expireperiod,char(10)) from ehr_compliancedb.Requirements k where k.requirementname = b.requirementname) as ExpiredPeriod,
+
+ ( select (datediff(month,max(pq.date), tt.reviewdate) ) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = b.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (COALESCE(tt.expireperiod,0)) > (datediff(month,max(pq.date), tt.reviewdate)) and (tt.reviewdate is not null) ) as NewExpirePeriod,
+
+ (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= b.requirementname and zz.employeeid= a.employeeid ) as mostrecentcompleted_date,
+
+ (Select distinct string_agg(yy.comment, char(10)) from ehr_compliancedb.completiondates yy where yy.date in (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= b.requirementname and zz.employeeid= a.employeeid )
+ And yy.requirementname= b.requirementname and yy.employeeid= a.employeeid ) as comment,
+
+ (Select distinct string_agg(yy.snooze_date, char(10)) from ehr_compliancedb.completiondates yy where yy.date in (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= b.requirementname and zz.employeeid= a.employeeid )
+ And yy.requirementname= b.requirementname and yy.employeeid= a.employeeid ) as snooze_date,
+
+ CAST(
+ CASE
+
+ WHEN (select max(st.date) from ehr_compliancedb.completiondates st where st.requirementname = b.requirementname and st.employeeid = a.employeeid ) IS NULL then 0
+ WHEN ( select (COALESCE(tt.expireperiod,0)) from ehr_compliancedb.requirements tt where tt.requirementname = b.requirementname group by tt.expireperiod ) = 0 then Null
+
+
+ WHEN ( select count(*) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = b.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) ) > 0 THEN
+
+ ( select (datediff(month,max(pq.date), tt.reviewdate) - ( datediff(month,max(pq.date), getdate()) ) )from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = b.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) )
+
+
+ ELSE ( select (COALESCE(tt.expireperiod,0)) - ( datediff(month,max(pq.date), getdate()) ) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = b.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod )
+
+ END AS Float) AS MonthsUntilRenewal
+
+
+
+ from ehr_Compliancedb.employeeperunit a ,ehr_compliancedb.requirementspercategory b
+ where ( a.unit = b.unit or a.category = b.category )
+ And b.requirementname not in (select distinct t.requirementname from ehr_compliancedb.employeerequirementexemptions t Where a.employeeid = t.employeeid
+ And b.requirementname = t.requirementname)
+ And a.employeeid in (select p.employeeid from ehr_compliancedb.employees p where a.employeeid = p.employeeid And p.enddate is null)
+ And b.requirementname in (select q.requirementname from ehr_compliancedb.Requirements q where q.requirementname = b.requirementname And q.dateDisabled is null )
+
+
+ group by b.requirementname,a.employeeid
+
+ union
+
+ select a.requirementname,
+ a.employeeid,
+ null as unit,
+ null as category,
+ 'None' as trackingflag,
+ (select h.email from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as email,
+ (select h.lastname from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as lastname,
+ (select h.firstname from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as firstname,
+ (select h.majorudds from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as host,
+ (select h.supervisor from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as supervisor,
+ (select h.type from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as trainee_type, ----- type trainee, or trainer
+ (select string_agg(h.type,char(10))from ehr_compliancedb.Requirements h where h.requirementname = a.requirementname) as requirement_type, ----- type trainee, or trainer
+
+
+ (select count(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid ) as timesCompleted,
+
+ (select string_agg(k.expireperiod,char(10)) from ehr_compliancedb.Requirements k where k.requirementname = a.requirementname) as ExpiredPeriod,
+
+ ( select (datediff(month,max(pq.date), tt.reviewdate) )from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (COALESCE(tt.expireperiod,0)) > (datediff(month,max(pq.date), tt.reviewdate)) and (tt.reviewdate is not null) ) as NewExpirePeriod,
+
+ (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid ) as MostRecentDate,
+
+ (Select distinct string_agg(yy.comment, char(10)) from ehr_compliancedb.completiondates yy where yy.date in (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid )
+ And yy.requirementname= a.requirementname and yy.employeeid= a.employeeid ) as comment,
+
+ (Select distinct string_agg(yy.snooze_date, char(10)) from ehr_compliancedb.completiondates yy where yy.date in (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid )
+ And yy.requirementname= a.requirementname and yy.employeeid= a.employeeid ) as snooze_date,
+
+ CAST(
+ CASE
+ WHEN (select max(st.date) from ehr_compliancedb.completiondates st where st.requirementname = a.requirementname and st.employeeid = a.employeeid ) IS NULL then 0
+ WHEN ( select (COALESCE(tt.expireperiod,0)) from ehr_compliancedb.requirements tt where tt.requirementname = a.requirementname group by tt.expireperiod ) = 0 then Null
+
+
+ WHEN ( select count(*) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) ) > 0 THEN
+
+ ( select (datediff(month,max(pq.date), tt.reviewdate) - ( datediff(month,max(pq.date), getdate())) ) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) )
+
+
+ ELSE ( select (COALESCE(tt.expireperiod,0)) - ( datediff(month,max(pq.date), getdate())) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod )
+
+ END AS FLOAT) AS MonthsUntilRenewal
+
+
+ from ehr_compliancedb.completiondates a
+ where a.requirementname not in (select distinct h.requirementname from ehr_compliancedb.employeeperunit k, ehr_compliancedb.requirementspercategory h Where (k.unit = h.unit
+ or k.category = h.category) And a.employeeid = k.employeeid )
+ And a.requirementname not in (select distinct t.requirementname from ehr_compliancedb.employeerequirementexemptions t Where a.employeeid = t.employeeid
+ And a.requirementname = t.requirementname)
+ And a.employeeid in (select p.employeeid from ehr_compliancedb.employees p where a.employeeid = p.employeeid And p.enddate is null)
+ And a.requirementname in (select q.requirementname from ehr_compliancedb.Requirements q where q.requirementname = a.requirementname And q.dateDisabled is null )
+
+ group by a.requirementname,a.employeeid
+
+ union
+
+ -- Additional requirements for employees that have not completed training, but is required
+ select j.requirementname,
+ j.employeeid,
+ null as unit,
+ null as category,
+ string_agg(j.trackingflag,char(10)) as trackingflag,
+ (select h.email from ehr_compliancedb.employees h where h.employeeid = j.employeeid) as email,
+ (select h.lastname from ehr_compliancedb.employees h where h.employeeid = j.employeeid) as lastname,
+ (select h.firstname from ehr_compliancedb.employees h where h.employeeid = j.employeeid) as firstname,
+ (select h.majorudds from ehr_compliancedb.employees h where h.employeeid = j.employeeid) as host,
+ (select h.supervisor from ehr_compliancedb.employees h where h.employeeid = j.employeeid) as supervisor,
+ (select h.type from ehr_compliancedb.employees h where h.employeeid = j.employeeid) as trainee_type, ----- type trainee, or trainer
+ (select string_agg(h.type,char(10)) from ehr_compliancedb.Requirements h where h.requirementname = j.requirementname) as requirement_type, ----- type trainee, or trainer
+ 0 as timesCompleted,
+ (select string_agg(k.expireperiod,char(10)) from ehr_compliancedb.Requirements k where k.requirementname = j.requirementname) as ExpiredPeriod,
+ ( select (datediff(month,max(pq.date), tt.reviewdate) )from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = j.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = j.employeeid group by tt.expireperiod, tt.reviewdate
+ having (COALESCE(tt.expireperiod,0)) > (datediff(month,max(pq.date), tt.reviewdate)) and (tt.reviewdate is not null) ) as NewExpirePeriod,
+ null as MostRecentDate,
+ '' as comment,
+ null as snooze_date,
+ CAST(
+ CASE
+
+ WHEN (select max(st.date) from ehr_compliancedb.completiondates st where st.requirementname = j.requirementname and st.employeeid = j.employeeid ) IS NULL then 0
+ WHEN ( select (COALESCE(tt.expireperiod,0)) from ehr_compliancedb.requirements tt where tt.requirementname = j.requirementname group by tt.expireperiod ) = 0 then Null
+
+
+ WHEN ( select count(*) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = j.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = j.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) ) > 0 THEN
+
+ ( select (datediff(month,max(pq.date), tt.reviewdate) - ( datediff(month,max(pq.date), getdate())) ) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = j.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = j.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) )
+
+
+ ELSE ( select (COALESCE(tt.expireperiod,0)) - ( datediff(month,max(pq.date), getdate())) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = j.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = j.employeeid group by tt.expireperiod )
+
+ END AS FLOAT) AS MonthsUntilRenewal
+
+
+
+ from onprc_ehr_compliancedb.RequirementsPerEmployee j
+ Where j.employeeid in (select p.employeeid from ehr_compliancedb.employees p where j.employeeid = p.employeeid And p.enddate is null)
+ And j.requirementname in (select q.requirementname from ehr_compliancedb.Requirements q where q.requirementname = j.requirementname And q.dateDisabled is null )
+ And j.requirementname not in (select distinct h.requirementname from ehr_compliancedb.employeeperunit k, ehr_compliancedb.requirementspercategory h Where (k.unit = h.unit
+ or k.category = h.category) And j.employeeid = k.employeeid )
+ And j.requirementname not in (select distinct t.requirementname from ehr_compliancedb.employeerequirementexemptions t Where j.employeeid = t.employeeid And j.requirementname = t.requirementname)
+ And j.requirementname not in (select distinct k.requirementname from ehr_compliancedb.completiondates k Where k.employeeid = j.employeeid)
+
+ group by j.requirementname,j.employeeid
+
+ order by employeeid,requirementname, mostrecentcompleted_date desc
+
+
+ If @@Error <> 0
+ GoTo Err_Proc
+
+
+
+
+ RETURN 0
+
+
+Err_Proc:
+
+ RETURN 1
+
+
+END
+
+GO
+
+
+
+
+EXEC core.fn_dropifexists 'p_ComplianceRecentOverDueSoon_Process', 'onprc_ehr_compliancedb', 'PROCEDURE';
+GO
+
+-- Author: R. Blasa
+-- Created: 9-20-2024
+
+/*
+**
+** Created by
+** Blasa 9-20-2024 Created a storedprocedure to create a static set of data from
+** the ComplianceRecentTest.sql query
+**
+** 1-22-2026 Fix the issues with more than one subquery results
+**
+**
+*/
+
+CREATE Procedure onprc_ehr_compliancedb.p_ComplianceRecentOverDueSoon_Process
+
+
+ AS
+
+
+
+----- Reset Reporting table
+Delete onprc_ehr_compliancedb.ComplianceRecentReport
+
+ If @@Error <> 0
+ GoTo Err_Proc
+
+
+
+BEGIN
+
+Insert into onprc_ehr_compliancedb.ComplianceRecentReport
+(
+ requirementname,
+ employeeid,
+ unit,
+ category,
+ trackingflag,
+ email,
+ lastname,
+ firstname,
+ host,
+ supervisor,
+ trainee_type,
+ requirement_name_type,
+ times_completed,
+ expired_period,
+ new_expired_Period,
+ mostrecentcompleted_date,
+ comment,
+ snooze_date,
+ months_until_renewal
+
+)
+
+
+
+
+select b.requirementname,
+ a.employeeid,
+ string_agg(a.unit,char(10)) as unit,
+ string_agg(a.category,char(10)) as category,
+ string_agg(b.trackingflag,char(10)) as trackingflag,
+ (select h.email from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as email,
+ (select h.lastname from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as lastname,
+ (select h.firstname from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as firstname,
+ (select h.majorudds from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as host,
+ (select h.supervisor from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as supervisor,
+ (select h.type from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as trainee_type, ----- type trainee, or trainer
+ (select string_agg(h.type,char(10)) from ehr_compliancedb.Requirements h where h.requirementname = b.requirementname) as requirement_type, ----- type trainee, or trainer
+
+
+ (select count(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= b.requirementname and zz.employeeid= a.employeeid ) as times_Completed,
+
+ (select string_agg(k.expireperiod,char(10)) from ehr_compliancedb.Requirements k where k.requirementname = b.requirementname) as ExpiredPeriod,
+
+ ( select (datediff(month,max(pq.date), tt.reviewdate) ) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = b.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (COALESCE(tt.expireperiod,0)) > (datediff(month,max(pq.date), tt.reviewdate)) and (tt.reviewdate is not null) ) as NewExpirePeriod,
+
+ (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= b.requirementname and zz.employeeid= a.employeeid ) as mostrecentcompleted_date,
+
+ (Select distinct string_agg(yy.comment, char(10)) from ehr_compliancedb.completiondates yy where yy.date in (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= b.requirementname and zz.employeeid= a.employeeid )
+ And yy.requirementname= b.requirementname and yy.employeeid= a.employeeid ) as comment,
+
+ (Select distinct string_agg(yy.snooze_date, char(10)) from ehr_compliancedb.completiondates yy where yy.date in (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= b.requirementname and zz.employeeid= a.employeeid )
+ And yy.requirementname= b.requirementname and yy.employeeid= a.employeeid ) as snooze_date,
+
+ CAST(
+ CASE
+
+ WHEN (select max(st.date) from ehr_compliancedb.completiondates st where st.requirementname = b.requirementname and st.employeeid = a.employeeid ) IS NULL then 0
+ WHEN ( select (COALESCE(tt.expireperiod,0)) from ehr_compliancedb.requirements tt where tt.requirementname = b.requirementname group by tt.expireperiod ) = 0 then Null
+
+
+ WHEN ( select count(*) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = b.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) ) > 0 THEN
+
+ ( select (datediff(month,max(pq.date), tt.reviewdate) - ( datediff(month,max(pq.date), getdate())) ) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = b.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) )
+
+
+
+
+ ELSE ( select (COALESCE(tt.expireperiod,0)) - ( datediff(month,max(pq.date), getdate())) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = b.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod )
+
+ END AS FLOAT) AS MonthsUntilRenewal
+
+
+
+from ehr_Compliancedb.employeeperunit a ,ehr_compliancedb.requirementspercategory b
+where ( a.unit = b.unit or a.category = b.category )
+ And b.requirementname not in (select distinct t.requirementname from ehr_compliancedb.employeerequirementexemptions t Where a.employeeid = t.employeeid
+ And b.requirementname = t.requirementname)
+ And a.employeeid in (select p.employeeid from ehr_compliancedb.employees p where a.employeeid = p.employeeid And p.enddate is null)
+ And b.requirementname in (select q.requirementname from ehr_compliancedb.Requirements q where q.requirementname = b.requirementname And q.dateDisabled is null )
+
+
+group by b.requirementname,a.employeeid
+
+
+union
+
+select a.requirementname,
+ a.employeeid,
+ null as unit,
+ null as category,
+ 'None' as trackingflag,
+ (select h.email from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as email,
+ (select h.lastname from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as lastname,
+ (select h.firstname from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as firstname,
+ (select h.majorudds from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as host,
+ (select h.supervisor from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as supervisor,
+ (select h.type from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as trainee_type, ----- type trainee, or trainer
+ (select string_agg(h.type,char(10)) from ehr_compliancedb.Requirements h where h.requirementname = a.requirementname) as requirement_type, ----- type trainee, or trainer
+
+
+ (select count(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid ) as timesCompleted,
+
+ (select string_agg(k.expireperiod,char(10)) from ehr_compliancedb.Requirements k where k.requirementname = a.requirementname) as ExpiredPeriod,
+
+ ( select (datediff(month,max(pq.date), tt.reviewdate) )from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (COALESCE(tt.expireperiod,0)) > (datediff(month,max(pq.date), tt.reviewdate)) and (tt.reviewdate is not null) ) as NewExpirePeriod,
+
+ (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid ) as MostRecentDate,
+
+ (Select distinct string_agg(yy.comment, char(10)) from ehr_compliancedb.completiondates yy where yy.date in (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid )
+ And yy.requirementname= a.requirementname and yy.employeeid= a.employeeid ) as comment,
+
+ (Select distinct string_agg(yy.snooze_date, char(10)) from ehr_compliancedb.completiondates yy where yy.date in (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid )
+ And yy.requirementname= a.requirementname and yy.employeeid= a.employeeid ) as snooze_date,
+
+ CAST(
+ CASE
+ WHEN (select max(st.date) from ehr_compliancedb.completiondates st where st.requirementname = a.requirementname and st.employeeid = a.employeeid ) IS NULL then 0
+ WHEN ( select (COALESCE(tt.expireperiod,0)) from ehr_compliancedb.requirements tt where tt.requirementname = a.requirementname group by tt.expireperiod ) = 0 then Null
+
+
+ WHEN ( select count(*) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) ) > 0 THEN
+
+ ( select (datediff(month,max(pq.date), tt.reviewdate) - ( datediff(month,max(pq.date), getdate())) ) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) )
+
+
+ ELSE ( select (COALESCE(tt.expireperiod,0)) - ( datediff(month,max(pq.date), getdate())) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod )
+
+ END AS FLOAT) AS MonthsUntilRenewal
+
+
+from ehr_compliancedb.completiondates a
+where a.requirementname not in (select distinct h.requirementname from ehr_compliancedb.employeeperunit k, ehr_compliancedb.requirementspercategory h Where (k.unit = h.unit
+ or k.category = h.category) And a.employeeid = k.employeeid )
+ And a.requirementname not in (select distinct t.requirementname from ehr_compliancedb.employeerequirementexemptions t Where a.employeeid = t.employeeid
+ And a.requirementname = t.requirementname)
+ And a.employeeid in (select p.employeeid from ehr_compliancedb.employees p where a.employeeid = p.employeeid And p.enddate is null)
+ And a.requirementname in (select q.requirementname from ehr_compliancedb.Requirements q where q.requirementname = a.requirementname And q.dateDisabled is null )
+
+group by a.requirementname,a.employeeid
+
+UNION
+
+--- Training that was completed by as an employee training exemptions, and at least completed one, or more times
+
+select a.requirementname,
+ a.employeeid,
+ null as unit,
+ null as category,
+ 'No' as trackingflag,
+ (select h.email from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as email,
+ (select h.lastname from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as lastname,
+ (select h.firstname from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as firstname,
+ (select h.majorudds from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as host,
+ (select h.supervisor from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as supervisor,
+ (select h.type from ehr_compliancedb.employees h where h.employeeid = a.employeeid) as trainee_type, ----- type trainee, or trainer
+ (select string_agg(h.type,char(10)) from ehr_compliancedb.Requirements h where h.requirementname = a.requirementname) as requirement_type, ----- type trainee, or trainer
+
+
+ (select count(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid ) as timesCompleted,
+
+ (select string_agg(k.expireperiod,char(10)) from ehr_compliancedb.Requirements k where k.requirementname = a.requirementname) as ExpiredPeriod,
+
+ ( select (datediff(month,max(pq.date), tt.reviewdate) )from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (COALESCE(tt.expireperiod,0)) > (datediff(month,max(pq.date), tt.reviewdate)) and (tt.reviewdate is not null) ) as NewExpirePeriod,
+
+ (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid ) as MostRecentDate,
+
+ (Select distinct string_agg(yy.comment, char(10)) from ehr_compliancedb.completiondates yy where yy.date in (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid )
+ And yy.requirementname= a.requirementname and yy.employeeid= a.employeeid ) as comment,
+
+ (Select distinct string_agg(yy.snooze_date, char(10)) from ehr_compliancedb.completiondates yy where yy.date in (select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid )
+ And yy.requirementname= a.requirementname and yy.employeeid= a.employeeid ) as snooze_date,
+
+ CAST(
+ CASE
+ WHEN (select max(st.date) from ehr_compliancedb.completiondates st where st.requirementname = a.requirementname and st.employeeid = a.employeeid ) IS NULL then 0
+ WHEN ( select (COALESCE(tt.expireperiod,0)) from ehr_compliancedb.requirements tt where tt.requirementname = a.requirementname group by tt.expireperiod ) = 0 then Null
+
+
+ WHEN ( select count(*) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) ) > 0 THEN
+
+ ( select ( datediff(month,max(pq.date), tt.reviewdate) - (datediff(month,max(pq.date), getdate())) )from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) )
+
+
+ ELSE ( select (COALESCE(tt.expireperiod,0)) - ( datediff(month,max(pq.date), getdate())) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod )
+
+ END AS DECIMAL) AS MonthsUntilRenewal
+
+
+from ehr_compliancedb.employeerequirementexemptions a
+Where a.employeeid in (select p.employeeid from ehr_compliancedb.employees p where a.employeeid = p.employeeid And p.enddate is null)
+ And a.requirementname in (select q.requirementname from ehr_compliancedb.Requirements q where q.requirementname = a.requirementname And q.dateDisabled is null )
+
+group by a.requirementname,a.employeeid
+
+UNION
+
+--- Additional requirements for employees that have not completed training, but is required
+
+select j.requirementname,
+ j.employeeid,
+ null as unit,
+ null as category,
+ string_agg(j.trackingflag,char(10)) as trackingflag,
+ (select h.email from ehr_compliancedb.employees h where h.employeeid = j.employeeid) as email,
+ (select h.lastname from ehr_compliancedb.employees h where h.employeeid = j.employeeid) as lastname,
+ (select h.firstname from ehr_compliancedb.employees h where h.employeeid = j.employeeid) as firstname,
+ (select h.majorudds from ehr_compliancedb.employees h where h.employeeid = j.employeeid) as host,
+ (select h.supervisor from ehr_compliancedb.employees h where h.employeeid = j.employeeid) as supervisor,
+ (select h.type from ehr_compliancedb.employees h where h.employeeid = j.employeeid) as trainee_type, ----- type trainee, or trainer
+ (select string_agg(h.type,char(10)) from ehr_compliancedb.Requirements h where h.requirementname = j.requirementname) as requirement_type, ----- type trainee, or trainer
+ 0 as timesCompleted,
+ (select string_agg(k.expireperiod,char(10)) from ehr_compliancedb.Requirements k where k.requirementname = j.requirementname) as ExpiredPeriod,
+ ( select (datediff(month,max(pq.date), tt.reviewdate) )from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = j.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = j.employeeid group by tt.expireperiod, tt.reviewdate
+ having (COALESCE(tt.expireperiod,0)) > (datediff(month,max(pq.date), tt.reviewdate)) and (tt.reviewdate is not null) ) as NewExpirePeriod,
+ null as MostRecentDate,
+ '' as comment,
+ null as snooze_date,
+ CAST(
+ CASE
+
+ WHEN (select max(st.date) from ehr_compliancedb.completiondates st where st.requirementname = j.requirementname and st.employeeid = j.employeeid ) IS NULL then 0
+ WHEN ( select (COALESCE(tt.expireperiod,0)) from ehr_compliancedb.requirements tt where tt.requirementname = j.requirementname group by tt.expireperiod ) = 0 then Null
+
+ WHEN ( select count(*) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = j.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = j.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) ) > 0 THEN
+
+ ( select (datediff(month,max(pq.date), tt.reviewdate) - ( datediff(month,max(pq.date), getdate())) ) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = j.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = j.employeeid group by tt.expireperiod, tt.reviewdate
+ having (tt.reviewdate) > (max(pq.date)) )
+
+
+ ELSE ( select (COALESCE(tt.expireperiod,0)) - ( datediff(month,max(pq.date), getdate())) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = j.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = j.employeeid group by tt.expireperiod )
+
+ END AS FLOAT) AS MonthsUntilRenewal
+
+
+from onprc_ehr_compliancedb.RequirementsPerEmployee j
+Where j.employeeid in (select p.employeeid from ehr_compliancedb.employees p where j.employeeid = p.employeeid And p.enddate is null)
+ And j.requirementname in (select q.requirementname from ehr_compliancedb.Requirements q where q.requirementname = j.requirementname And q.dateDisabled is null )
+ And j.requirementname not in (select distinct h.requirementname from ehr_compliancedb.employeeperunit k, ehr_compliancedb.requirementspercategory h Where (k.unit = h.unit
+ or k.category = h.category) And j.employeeid = k.employeeid )
+ And j.requirementname not in (select distinct t.requirementname from ehr_compliancedb.employeerequirementexemptions t Where j.employeeid = t.employeeid And j.requirementname = t.requirementname)
+ And j.requirementname not in (select distinct k.requirementname from ehr_compliancedb.completiondates k Where k.employeeid = j.employeeid)
+
+group by j.requirementname,j.employeeid
+
+order by employeeid,requirementname, mostrecentcompleted_date desc
+
+
+ If @@Error <> 0
+ GoTo Err_Proc
+
+
+
+
+ RETURN 0
+
+
+Err_Proc:
+
+ RETURN 1
+
+
+END
+
+GO
\ No newline at end of file
diff --git a/ONPRC_EHR_ComplianceDB/src/org/labkey/ONPRCEHR_ComplianceDB/ONPRC_EHR_ComplianceDBModule.java b/ONPRC_EHR_ComplianceDB/src/org/labkey/ONPRCEHR_ComplianceDB/ONPRC_EHR_ComplianceDBModule.java
index 4ee6b9e89..e03bd4352 100644
--- a/ONPRC_EHR_ComplianceDB/src/org/labkey/ONPRCEHR_ComplianceDB/ONPRC_EHR_ComplianceDBModule.java
+++ b/ONPRC_EHR_ComplianceDB/src/org/labkey/ONPRCEHR_ComplianceDB/ONPRC_EHR_ComplianceDBModule.java
@@ -55,7 +55,7 @@ public String getName()
@Override
public Double getSchemaVersion()
{
- return 24.012;
+ return 25.001;
} //Modified: 9-8-025
@Override
diff --git a/onprc_ehr/resources/queries/study/demographicsOffspringBSU.query.xml b/onprc_ehr/resources/queries/study/demographicsOffspringBSU.query.xml
index 7404ad7f6..cb64f6f1d 100644
--- a/onprc_ehr/resources/queries/study/demographicsOffspringBSU.query.xml
+++ b/onprc_ehr/resources/queries/study/demographicsOffspringBSU.query.xml
@@ -43,6 +43,14 @@
Foster Dam
+
+ Surrogate Dam
+
+ study
+ animal
+ id
+
+
Sire
diff --git a/onprc_ehr/resources/queries/study/demographicsOffspringBSU.sql b/onprc_ehr/resources/queries/study/demographicsOffspringBSU.sql
index 26a72138b..47fe27b8d 100644
--- a/onprc_ehr/resources/queries/study/demographicsOffspringBSU.sql
+++ b/onprc_ehr/resources/queries/study/demographicsOffspringBSU.sql
@@ -17,6 +17,7 @@ d2.status,
d2.geneticdam,
d2.observeddam,
d2.fosterMom,
+d2.surrogateMom,
d2.sire,
d2.sireType,
d.qcstate
@@ -25,7 +26,7 @@ FROM study.Demographics d
INNER JOIN study.demographicsParentsBSU d2
- ON ((d2.sire = d.id OR d2.geneticdam = d.id OR d2.fostermom = d.id OR d2.observeddam = d.id) AND d.id != d2.id)
+ ON ((d2.sire = d.id OR d2.geneticdam = d.id OR d2.fosterMom = d.id OR d2.observeddam = d.id) AND d.id != d2.id)
diff --git a/onprc_ehr/resources/queries/study/demographicsOffspringBSU/.qview.xml b/onprc_ehr/resources/queries/study/demographicsOffspringBSU/.qview.xml
index 4a4679a82..fd9958bee 100644
--- a/onprc_ehr/resources/queries/study/demographicsOffspringBSU/.qview.xml
+++ b/onprc_ehr/resources/queries/study/demographicsOffspringBSU/.qview.xml
@@ -15,6 +15,7 @@
+
diff --git a/onprc_ehr/resources/queries/study/demographicsParents/.qview.xml b/onprc_ehr/resources/queries/study/demographicsParents/.qview.xml
index 2ab5905b4..01e76b9af 100644
--- a/onprc_ehr/resources/queries/study/demographicsParents/.qview.xml
+++ b/onprc_ehr/resources/queries/study/demographicsParents/.qview.xml
@@ -6,6 +6,7 @@
+
diff --git a/onprc_ehr/resources/queries/study/demographicsParentsBSU.query.xml b/onprc_ehr/resources/queries/study/demographicsParentsBSU.query.xml
index 5790dc400..e947589e1 100644
--- a/onprc_ehr/resources/queries/study/demographicsParentsBSU.query.xml
+++ b/onprc_ehr/resources/queries/study/demographicsParentsBSU.query.xml
@@ -48,6 +48,14 @@
id
+
+ Surrogate Dam
+
+ study
+ animal
+ id
+
+
Number of Parents Known
diff --git a/onprc_ehr/resources/queries/study/demographicsParentsBSU.sql b/onprc_ehr/resources/queries/study/demographicsParentsBSU.sql
index 76f64855f..66657396f 100644
--- a/onprc_ehr/resources/queries/study/demographicsParentsBSU.sql
+++ b/onprc_ehr/resources/queries/study/demographicsParentsBSU.sql
@@ -39,12 +39,23 @@ SELECT
ELSE null
END as sireType,
- p3.parent as fosterMom,
- p3.method as fosterType,
- (CASE WHEN p3.parent IS NOT NULL THEN 1 ELSE 0 END +
- CASE WHEN coalesce(p2.parent, b.dam) IS NOT NULL THEN 1 ELSE 0 END +
- CASE WHEN coalesce(p1.parent, b.sire) IS NOT NULL THEN 1 ELSE 0 END) as numParents
+ coalesce(p3.parent, '') as fosterMom,
+ CASE
+ WHEN p3.parent IS NOT NULL THEN p3.method
+ ELSE null
+ END as fosterType,
+
+ coalesce(p4.parent, '') as surrogateMom,
+ CASE
+ WHEN p4.parent IS NOT NULL THEN p4.method
+ ELSE null
+ END as surrogateType,
+
+ (CASE WHEN p4.parent IS NOT NULL THEN 1 ELSE 0 END +
+ CASE WHEN p3.parent IS NOT NULL THEN 1 ELSE 0 END +
+ CASE WHEN coalesce(p2.parent, b.dam) IS NOT NULL THEN 1 ELSE 0 END +
+ CASE WHEN coalesce(p1.parent, b.sire) IS NOT NULL THEN 1 ELSE 0 END) as numParents
FROM study.demographics d
@@ -68,5 +79,12 @@ LEFT JOIN (
WHERE p3.relationship = 'Foster Dam' AND p3.enddate IS NULL
GROUP BY p3.Id
) p3 ON (d.Id = p3.id)
+
+LEFT JOIN (
+ select p4.id, min(p4.method) as method, max(p4.parent) as parent
+ FROM study.parentage p4
+ WHERE p4.relationship = 'Surrogate Dam' AND p4.enddate IS NULL
+ GROUP BY p4.Id
+) p4 ON (d.Id = p4.id)
LEFT JOIN study.birth b ON (b.id = d.id)
diff --git a/onprc_ehr/resources/queries/study/parentageSummary.query.xml b/onprc_ehr/resources/queries/study/parentageSummary.query.xml
index 1efefbcd2..8ebcede84 100644
--- a/onprc_ehr/resources/queries/study/parentageSummary.query.xml
+++ b/onprc_ehr/resources/queries/study/parentageSummary.query.xml
@@ -4,6 +4,12 @@
Parentage Summary
+
+ Id
+
+
+ Date
+
Parent
@@ -18,6 +24,12 @@
Method
+
+ Comments
+
+
+ Data Source
+
diff --git a/onprc_ehr/resources/queries/study/parentageSummary.sql b/onprc_ehr/resources/queries/study/parentageSummary.sql
index d410bee51..a457c8a91 100644
--- a/onprc_ehr/resources/queries/study/parentageSummary.sql
+++ b/onprc_ehr/resources/queries/study/parentageSummary.sql
@@ -18,10 +18,14 @@ SELECT
p.date,
p.parent,
p.relationship,
- p.method
+ p.method,
+ p.remark,
+ 'Parentage' as source
FROM study.parentage p
WHERE p.qcstate.publicdata = true and p.enddate is null
+And p.date in (select max(t.date) from study.parentage t where p.Id = t.Id And p.parent = t.parent
+And p.relationship =t.relationship And p.method = t.method And t.enddate is null and p.enddate is null and t.qcstate.publicdata = true)
UNION
@@ -30,20 +34,23 @@ SELECT
b.date,
b.dam,
'Dam' as relationship,
- 'Observed' as method
+ 'Observed' as method,
+ null as remark,
+ 'Birth' as source
FROM study.birth b
WHERE b.dam is not null and b.qcstate.publicdata = true
-And 'dam' not in (select k.relationship from study.parentage k where k.Id = b.Id and k.enddate is null)
+
UNION
SELECT
a.Id,
- a.date,
+ a.date,
a.sire,
'Sire' as relationship,
- 'Observed' as method
+ 'Observed' as method,
+ null as remark,
+ 'Birth' as source
FROM study.birth a
WHERE a.sire is not null and a.qcstate.publicdata = true
- And 'sire' not in (select k.relationship from study.parentage k where k.Id = a.Id and k.enddate is null)
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/parentageSummary/.qview.xml b/onprc_ehr/resources/queries/study/parentageSummary/.qview.xml
new file mode 100644
index 000000000..e5dbb867c
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/parentageSummary/.qview.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/parentageSummary/Parentage With Dates.qview.xml b/onprc_ehr/resources/queries/study/parentageSummary/Parentage With Dates.qview.xml
new file mode 100644
index 000000000..3393258cd
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/parentageSummary/Parentage With Dates.qview.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-25.003-25.004.sql b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-25.003-25.004.sql
new file mode 100644
index 000000000..ac8027b7d
--- /dev/null
+++ b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-25.003-25.004.sql
@@ -0,0 +1,141 @@
+
+CREATE TABLE onprc_ehr.RequirementName_Convert(
+ searchid integer IDENTITY(100,1) NOT NULL,
+ PreviousDesignation varchar(255) NULL,
+ afterName varchar(255) NULL,
+ FileName varchar(1000) NULL
+ ) ON [PRIMARY]
+ GO
+
+
+/*
+**
+** Created by Date Comment
+**
+**
+** Blasa 1/6/2026 Convert Compliance Requirement Names to its new predefined names.
+*/
+
+
+CREATE Procedure onprc_ehr.sp_Compliance_requirementname_Update_Process
+
+
+
+
+AS
+
+DECLARE
+
+ @SearchKey Int,
+ @TempsearchKey Int,
+ @Code varchar(500)
+Begin
+
+
+
+ ---Initial Values
+ set @TempSearchkey = 0
+ set @Searchkey = 0
+
+
+
+select top 1 @Searchkey= searchid from onprc_ehr.requirementname_Convert
+order by searchid
+
+
+While @TempSearchKey < @SearchKey
+BEGIN
+
+select top 1 @Code=PreviousDesignation from onprc_ehr.requirementname_Convert
+ Where searchid = @Searchkey
+
+ If @@Error <> 0
+ GoTo Err_Proc
+
+ ------Process Requirement Names
+
+Update ss
+set ss.RequirementName = '' + trim(jj.aftername) + ' ' + trim(jj.filename) + ''
+
+ from ehr_Compliancedb.Requirements ss, onprc_ehr.requirementname_Convert jj where ss.RequirementName like '' + trim(@code) + '%'
+ And jj.PreviousDesignation like '' + trim(@code) + '%'
+
+ If @@Error <> 0
+ GoTo Err_Proc
+
+------Process Completion Dates
+
+Update ss
+set ss.RequirementName = '' + trim(jj.aftername) + ' ' + trim(jj.filename) + ''
+
+ from ehr_Compliancedb.CompletionDates ss, onprc_ehr.requirementname_Convert jj where ss.RequirementName like '' + trim(@code) + '%'
+ And jj.PreviousDesignation like '' + trim(@code) + '%'
+
+ If @@Error <> 0
+ GoTo Err_Proc
+
+------Process Requirements per Employees
+
+Update ss
+set ss.RequirementName = '' + trim(jj.aftername) + ' ' + trim(jj.filename) + ''
+
+ from ehr_Compliancedb.RequirementsPerEmployee ss, onprc_ehr.requirementname_Convert jj where ss.RequirementName like '' + trim(@code) + '%'
+ And jj.PreviousDesignation like '' + trim(@code) + '%'
+
+ If @@Error <> 0
+ GoTo Err_Proc
+
+-----Process Requirements per Categories
+
+Update ss
+set ss.RequirementName = '' + trim(jj.aftername) + ' ' + trim(jj.filename) + ''
+
+ from ehr_Compliancedb.RequirementsPerCategory ss, onprc_ehr.requirementname_Convert jj where ss.RequirementName like '' + trim(@code) + '%'
+ And jj.PreviousDesignation like '' + trim(@code) + '%'
+
+ If @@Error <> 0
+ GoTo Err_Proc
+
+-----Process Employee Requirements Exemptions
+
+Update ss
+set ss.RequirementName = '' + trim(jj.aftername) + ' ' + trim(jj.filename) + ''
+
+ from ehr_Compliancedb.EmployeeRequirementExemptions ss, onprc_ehr.requirementname_Convert jj where ss.RequirementName like '' + trim(@code) + '%'
+ And jj.PreviousDesignation like '' + trim(@code) + '%'
+
+ If @@Error <> 0
+ GoTo Err_Proc
+
+
+----- Process the next data record
+
+Set @TempSearchkey = @SearchKey
+
+
+select top 1 @Searchkey= searchid from onprc_ehr.requirementname_Convert
+Where searchid > @TempSearchkey
+order by searchid
+
+ If @@Error <> 0
+ GoTo Err_Proc
+
+
+END ---(While)
+
+
+
+RETURN 0
+
+
+ Err_Proc:
+
+
+ RETURN 1
+
+
+END
+
+GO
+
+
diff --git a/onprc_ehr/resources/schemas/onprc_ehr.xml b/onprc_ehr/resources/schemas/onprc_ehr.xml
index 875814163..298c65edc 100644
--- a/onprc_ehr/resources/schemas/onprc_ehr.xml
+++ b/onprc_ehr/resources/schemas/onprc_ehr.xml
@@ -1471,4 +1471,13 @@
+
+
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java
index ff4a4e16c..d18c157d4 100644
--- a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java
@@ -124,7 +124,7 @@ public String getName()
@Override
public @Nullable Double getSchemaVersion()
{
- return 25.003;
+ return 25.004;
}
@Override
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/BloodDrawFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/BloodDrawFormType.java
index c73c835b1..edbe49d39 100644
--- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/BloodDrawFormType.java
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/BloodDrawFormType.java
@@ -25,6 +25,10 @@
import org.labkey.api.ehr.dataentry.WeightFormSection;
import org.labkey.api.module.Module;
import org.labkey.api.view.template.ClientDependency;
+import org.labkey.security.xml.GroupEnumType;
+import org.labkey.api.security.GroupManager;
+import org.labkey.api.security.Group;
+import org.labkey.api.security.permissions.AdminPermission;
import java.util.Arrays;
import java.util.List;
@@ -69,4 +73,15 @@ public Supplier getAddScheduledTreatmentWindowDependency()
{
return ClientDependency.supplierFromPath("ehr/window/AddScheduledTreatmentWindow.js");
}
+ //Added: 1-15-2026 R.Blasa
+ @Override
+ public boolean isVisible()
+ {
+ Group g = GroupManager.getGroup(getCtx().getContainer(), "Form Clinical Rounds SF", GroupEnumType.SITE);
+ if (g != null && getCtx().getUser().isInGroup(g.getUserId()) && !getCtx().getContainer().hasPermission(getCtx().getUser(), AdminPermission.class))
+ {
+ return false;
+ }
+ return super.isVisible();
+ }
}
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/ClinicalRoundsFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/ClinicalRoundsFormType.java
index b0040122c..ab5d20c96 100644
--- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/ClinicalRoundsFormType.java
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/ClinicalRoundsFormType.java
@@ -77,12 +77,4 @@ public ClinicalRoundsFormType(DataEntryFormContext ctx, Module owner)
}
- @Override
- protected boolean canInsert()
- {
- if (!getCtx().getContainer().hasPermission(getCtx().getUser(), EHRClinicalEntryPermission.class))
- return false;
-
- return super.canInsert();
- }
}