From d0ea4fc1d3de1e5a0a0e1c7564b61f9c9ec4b82a Mon Sep 17 00:00:00 2001 From: LWeiBCM <63030427+LWeiBCM@users.noreply.github.com> Date: Wed, 14 Feb 2024 20:03:16 -0600 Subject: [PATCH] Table Consult's schema changed. --- Fobt.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Fobt.sql b/Fobt.sql index b188f94..0dcbf99 100644 --- a/Fobt.sql +++ b/Fobt.sql @@ -3055,8 +3055,8 @@ if (OBJECT_ID('tempdb.dbo.#FOBT_Sta3n528_5_Exc_NonDx_9_VisitTIUConsult_joinByCon select v.* ,c.requestDateTime as ReferralRequestDateTime,c.OrderStatusSID as ConsultOrderStatusSID, - c.ToRequestserviceSID as ConsultToRequestserviceSID,c.ToRequestserviceName as ConsultToRequestserviceName, - c.placeofconsultation, + c.ToRequestserviceSID as ConsultToRequestserviceSID,rs.ServiceName as ConsultToRequestserviceName, + --c.placeofconsultation, c.requestType, -- weather the request is a consult or procedure c.[InpatOutpat], -- the ordering person to indicate if the service is to be rendered on an outpatient or Inpatients basis. c.[RemoteService], @@ -3066,6 +3066,8 @@ if (OBJECT_ID('tempdb.dbo.#FOBT_Sta3n528_5_Exc_NonDx_9_VisitTIUConsult_joinByCon left join [CDWWork].[Con].[Consult] as C --altered (ORD_...Src) on C.ConsultSID=V.ConsultSID --and CohortName='Cohort20180712' and C.Sta3n=V.Sta3n + left join cdwwork.dim.RequestService as rs + on c.ToRequestServiceSID=rs.RequestServiceSID and c.Sta3n=rs.sta3n --more filter --and C.[requestDateTime] between dateAdd(yy,-1,(select sp_start from #FOBT_Sta3n528_0_1_inputP)) --altered (ORD_...Dflt) --altered (temp table) -- and DateAdd(dd,(select fu_period from #FOBT_Sta3n528_0_1_inputP) --altered (ORD_...Dflt) --altered (temp table)