![]()
Hi,
How do I only display the selected department(s) activation?e.g. I selected the Emergency department, but in the top table it still displayed as if I selected all the departments? I have attached my code. Thanks in advance.
ALTER PROC [dbo].[GHS_usp_MyChart_Activations_byDep_detail] ( @in_StartDate date ,@in_EndDate date ,@Department varchar (MAX) --,@Act_Type varchar(max) --activation type ) AS SET NOCOUNT ON BEGIN SET NOCOUNT ON; --use local variables to Parameter de-sniffing.
Use relative dates for local date parameter. Need to add a conversion if want to display dates in the RDL declare @lv_StartDate datetime set @lv_StartDate = @in_StartDate declare @lv_EndDate datetime set @lv_EndDate = @in_EndDate set transaction isolation
level read uncommitted --unlock tables --New Activiations in the time range IF object_id('tempdb..#new_acts') IS NOT NULL DROP TABLE #new_acts; select pmsh.PAT_ID , p.PAT_NAME , max(pmat.ACSS_TIMESTAMP) as 'CodeCreateTime' , max(pmsh.myc_stat_hx_tmstp) as
'MYCTime' --MyChart activation time , emp.NAME as Activation_Employee , p.pat_mrn_id into #new_acts from Clarity.dbo.pat_myc_stat_hx pmsh inner join Clarity.dbo.pat_myc_acss_trk pmat on pmsh.PAT_ID = pmat.PAT_ID and pmat.MYC_ACSS_ACTION_C =1 inner join Clarity.dbo.patient
p on pmsh.pat_id = p.pat_id Left Outer Join Clarity.dbo.CLARITY_EMP emp on pmat.MYC_ACSS_USER_ID = emp.USER_ID left outer join clarity.dbo.clarity_dep as cdep on pmsh.Department_id = cdep.department_id where pmsh.myc_stat_hx_tmstp >= @lv_StartDate and pmsh.MYC_STAT_HX_TMSTP<dateadd(day,
#found_nomatch="" #found_nomatch;="" #new_acts="" #step2="" #step2;="" 'ed="" 'ed%'="" 'ed'="" 'ip="" 'ip%'="" 'ip'="" 'no="" 'no'=""
'op="" 'op%'="" 'op'="" 'patient="" 'yes'="" (="" ('0'="" (1000,1003,101,105,106,120,1200,1201,1214,1215,1216,1217,1218,1220,1221,2,201,210,2100,210011013,2101,2102,210771,210781001,210781002,210781003,210781004,2109071101,2502,2508,2509,3,51,52,53,81,90,61)=""
(61,105)="" (@department,','))="" (@department,',')))="" (pe.appt_status_c="2" (select="" )="" ,abs(datediff(hour,s.myctime,="" ,acct_basecls_ha_c="n.ACCT_BASECLS_HA_C" ,acct_class="n.Acct_Class"
,activation_in_clinicoradm="case" ,activation_type="case" ,department_name="n.DEPARTMENT_NAME" ,final_adm_datetime="case" ,final_disch_datetime="case" ,har.disch_dept_id,dep.department_name,="" ,myctype="n.MycType"
,n.*="" ,pat_enc_csn_id="n.PRIM_ENC_CSN_ID" ,pe.pat_enc_csn_id,="" ,peh.department_id,="" --="" ---regina="" --and="" --find="" --found="" --inactivated=""
--not="" --patient="" 1,="" 1-24-2020="" <="" @lv_enddate)="" [clarity].[dbo].[udf_splitparameter]="" a="" a.*,="" a.activation_type="IP" a.order_visit="1"
aa="" aa.*,activation_in_clinicoradm="case" aa.codecreatetime,="" aa.myctime)<="4" aa.order_visit="1" abs(datediff(hour,s.myctime,="" acct_basecls_ha_c="" acct_class,="" acct_class,map.base_class_map_c=""
activated="" activation="" activation'="" activation_in_clinicoradm="Yes" added="" adm_date_time,="" after="" allow="" and="" as="" before="" by=""
cdep.department_id="" clarity.dbo.clarity_dep="" clarity.dbo.hsd_base_class_map="" clarity.dbo.hsp_account="" clarity.dbo.pat_enc="" clarity.dbo.pat_enc_2="" clarity.dbo.pat_enc_hsp="" clarity.dbo.pat_myc_stat_hx=""
clarity.dbo.zc_acct_basecls_ha="" clarity.dbo.zc_acct_billsts_ha="" clinic="" closest="" coalesce(pe.checkin_time,="" coalesce(pe.checkout_time,="" coalesce(peh.hosp_admsn_time,="" codecreatetime,s.myctime=""
date)="" datediff(hour,="" dep="" department="" department_id="n.DISCH_DEPT_ID" desc="" disch="" disch_date_time,har.hsp_account_id,="" distinct="" div="" drop=""
else="" email,="" emp.name="" end="" final_activation_basetype="case" for="" from="" group="" har="" har.acct_basecls_ha_c="zbc.ACCT_BASECLS_HA_C" har.disch_date_time))=""
har.disch_date_time)))="" har.disch_dept_id="dep.DEPARTMENT_ID" if="" in="" in(select="" include="" info="" initiated'="" inner="" into="" is="" join=""
left="" letter="" like="" long="" map="" map.base_class_map_c="1" match="" match'="" mychart="" myctype="case" n="" n.codecreatetime,=""
n.myctime)<="4" n.pat_id="" no="" not="" null="" null)="" object_id('tempdb..#found_nomatch')="" object_id('tempdb..#step2')="" or="" order="" order_visit=""
out="" outer="" outside="" over(partition="" p.pat_mrn_id,="" p.pat_name,="" p1="" p1.myc_stat_hx_c="2" p1.myc_stat_hx_tmstp="" p1.pat_id="" p2=""
p2.myc_stat_hx_c="1)" p2.myc_stat_hx_tmstp="" patients="" pe="" pe.appt_status_c="" pe.appt_status_c,="" pe.checkout_time,dep.department_name,="" pe.effective_date_dt="cast(n.CodeCreateTime"
pe.effective_date_dt)="" pe.effective_date_dt,="" pe.effective_date_dt,pe.checkin_time,="" pe.effective_dept_id="dep.DEPARTMENT_ID" pe.effective_dept_id,="" pe.enc_type_c="" pe.hosp_admsn_time,=""
pe.hosp_dischrg_time,peh.hosp_disch_time,pe.effective_date_dt)="" pe.pat_enc_csn_id="peh.PAT_ENC_CSN_ID" pe2="" pe2.adt_pat_class_c="map.ACCT_CLASS_MAP_C" peh="" peh.adt_pat_class_c,="" peh.hosp_admsn_time)=""
peh.hosp_admsn_time,="" peh.hosp_disch_time,="" pmsh.myc_stat_hx_c="1" pmsh.pat_id="" pmsh.pat_id,="" prim_enc_csn_id="" result="" row_number()="" s="" s.*,=""
s.activation_type="No Match" s.department_id="" s.myctype="" s.pat_id="" s.pat_id,har.acct_basecls_ha_c,zbc.name="" select="" set="" table="" that="" the=""
then="" those="" time="" time_diff,="" to="" update="" user="" visit="" when="" where="" zbc="" zbc.name=""></dateadd(day,>