Advertisement
| Hall of Fame |
|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: |
create view cd.casemanagement as
DECLARE @FYearStart datetime
-- the fiscal year starts on YYYY-07-01:
SET @FYearStart = convert (datetime, CAST(datepart(year, getdate()-365) as varchar(4)) + '-07-01', 120)
declare @FYearEnd datetime
-- the fiscal year ends on YYYY-06-30:
set @FYearEnd = convert (datetime , Cast(datepart(year,getdate())as varchar(4)) + '-06-30', 120)
select cl.uniqueid_c 'clientUniqueID',
cl.clientcode_c 'ClientCode', cl.lastname_vc 'ClientLastName',
cl.firstname_vc 'ClientFirstName',cl.admdate_d,cl.termdate_d 'Termdate',
cl.birthdate_d 'ClientBirthdate'
, (select datediff(YY, cl.birthdate_d, getDate()) -
(case when (datepart(Y, cl.birthdate_d) > datepart(Y, getDate())) or
(datepart(Y, cl.birthdate_d) = datepart(Y, getDate()) And
datepart(Y, cl.birthdate_d) > datepart(Y, getDate()))
then 1
else 0
end)) as 'Age'
, sm.uniqueid_c 'linkid',sm.Staffcode_c 'StaffCode',
sm.lastname_vc 'StaffLastName', sm.firstname_vc 'StaffFirstName'
,(
SELECT TOP 1 aw.activitydate_d
from ar.activwork aw
where activity_c = '171'and attendance_c ='01'
AND aw.clientid_c = cl.uniqueid_c
order by aw.activitydate_d desc) As LastCMDate
,(
SELECT TOP 1 aw2.activitydate_d
from ar.activwork aw2
where aw2.activity_c = '171'and aw2.attendance_c in ('98','99')
AND aw2.clientid_c = cl.uniqueid_c
order by aw2.activitydate_d desc) As NextCMDate ,
(
select count (aw3.clientid_c)
from ar.activwork aw3
where aw3.attendance_c = '04'and aw3.activity_c = '171' and aw3.activitydate_d Between (@FYearStart) and (@FYearEnd)
and aw3.clientid_c = cl.uniqueid_c) as DNA_CM_Appointments ,
( select count (aw4.clientid_c)
from ar.activwork aw4
where aw4.attendance_c = '03'and aw4.activity_c = '171' and aw4.activitydate_d Between (@FYearStart) and (@FYearEnd)
and aw4.clientid_c = cl.uniqueid_c) as Staff_CM_Canceled_Appointments ,
( select count (aw5.clientid_c)
from ar.activwork aw5
where aw5.attendance_c = '02'and aw5.activity_c = '171' and aw5.activitydate_d Between (@FYearStart) and (@FYearEnd)
and aw5.clientid_c = cl.uniqueid_c) as Client_CM_Canceled_Appointments
,(
SELECT Top 1 CASE WHEN ps.pscode_c = '0005' THEN 'YES' ELSE 'NO' END AS Medicaid_ins
from cd.Client_Paysource ps
where ps.pscode_c = '0005' and ps.enddate_d is null
AND ps.clientid_c = cl.uniqueid_c
) As 'Medicaid_ins' ,
(
SELECT Top 1 CASE WHEN e.eligibility in( 'SPMI','SMI','LU','MASED','SED') THEN 'YES' ELSE 'NO' END AS Medicaid_ins
from cd.Client_elig_0n_activitydate e
where e.eligibility in( 'SPMI','SMI','LU','MASED','SED')and e.activity_c = '171'and e.attendance_c ='01'
AND e.clientid_c = cl.uniqueid_c
) As 'Eligible_on_171'
,(select eligibility from cd.Client_Current_Eligibility e where e.uniqueid_c = cl.uniqueid_c) as CurrentElig
,(select top 1 aw10.activitydate_d
from ar.activwork aw10
where aw10.clientid_c = cl.uniqueid_c and aw10.attendance_c = '01'
order by aw10.activitydate_d desc) as Last_activitydate,
(select top 1 aw12.activity_c
from ar.activwork aw12
where aw12.clientid_c = cl.uniqueid_c and aw12.attendance_c = '01'
order by aw12.activitydate_d desc) as Last_activity,
(select top 1 ( sm2.firstname_vc + ' '+ sm2.lastname_vc) As Staff
from ar.activwork aw13
inner join ar.staffmaster sm2 on sm2.uniqueid_c = aw13.staffmasterid_c
where aw13.clientid_c = cl.uniqueid_c and aw13.attendance_c = '01'
order by aw13.activitydate_d desc) as Staffid_LastActv
from ar.client cl
inner join cd.episode ep on ep.clientid_c = cl.uniqueid_c
inner join cd.enrollments en on en.episodeid_c = ep.uniqueid_c
inner join ar.staffmaster sm on sm.uniqueid_c = ep.primstaffid_c
where --en.program_c = 'ESS' and
en.enddate_d is null
and cl.termdate_d is null and
cl.clientcode_c --= '018833'
not like ('DS%')
and cl.admstat_c not like ('A')and
ep.enddate_d is null and
en.program_c not in ('199','499','104','499C','601','602','808','801')
|