Skip to Content
0
Sep 10, 2020 at 07:11 PM

Pull most recent admission date

52 Views

I have attached my code from the select expert. Report pulls the correct info based off the

{ITEM_AUDIT_VALS_HX.INSTANT} field but I also need to put in the code to pull the most recent hospital visit which would be this field {PAT_ENC_HSP.HOSP_ADMSN_TIME}

Not sure how to write the code so the parameters look at the {?Report Run Options} parameter first then also pull the most recent {PAT_ENC_HSP.HOSP_ADMSN_TIME}

Report Code:

{CLARITY_ROM.ROM_CONT_DATE_REAL} = {CLARITY_ROM.END_CONT_DATE_REAL} and
{CLARITY_BED.BED_CONT_DATE_REAL} = {CLARITY_BED.END_CONT_DATE_REAL} and
((not isnull({ZC_PAT_SERVICE.NAME}) and {ZC_PAT_SERVICE.NAME} = {?Service}) or {?Service} = "All") and
((not isnull({CLARITY_DEP.DEPT_ABBREVIATION}) and {CLARITY_DEP.DEPT_ABBREVIATION} = {?Unit}) or {?Unit} = "All") and
((not isnull({ZC_PAT_CLASS.NAME}) and {ZC_PAT_CLASS.NAME} = {?Patient Class}) or {?Patient Class} = "All") and
(
({?Report Run Options} = "Last Full Month" and {ITEM_AUDIT_VALS_HX.INSTANT} = lastfullmonth)
or
({?Report Run Options} = "Last Full Week" and {ITEM_AUDIT_VALS_HX.INSTANT} = lastfullweek)
or
({?Report Run Options} = "Custom Date Range" and {ITEM_AUDIT_VALS_HX.INSTANT} in {?Start Date} to {?End Date})
)