/*This provides a dropdown list for CURRENT patient status selection.*/
/*
<PARAMETERS>
<PATIENT_STATUS
STATEMENT="select grp_desc
, pg.sys_code
from pat_group pg
join pat_group_type pgt on pg.pat_grp_type_no = pgt.pat_grp_type_no
where pgt.sys_code = 'STA'
and pg.grp_enabled = 'T'
union
select cast((select grp_desc
from pat_group
where sys_code = 'SC'
and grp_enabled = 'T') ||
' or ' ||
(select grp_desc
from pat_group
where sys_code = 'ST'
and grp_enabled = 'T') as varChar(40)) grp_desc
, 'SCT' sys_code
from rdb$database
union
select cast('<Any except fictitious or deceased>' as varChar(40)) grp_desc
, '---' sys_code
from rdb$database
union
select cast('<Any except fictitious>' as varChar(40)) grp_desc
, '===' sys_code
from rdb$database
union
select cast('Deceased' as varChar(40)) grp_desc
, 'XXX' sys_code
from rdb$database"
DEFAULT="<Any except fictitious>"
>
</PATIENT_STATUS>
</PARAMETERS>
*/
...
where ((p.current_status = :Patient_status)
or ('---' = :Patient_status
and (p.current_status not in ('SF', 'SNP')))
or ('===' = :Patient_status
and (p.current_status not in ('SF', 'SNP')
or p.current_status is null))
or ('XXX' = :Patient_status
and p.current_status is null)
or ('SCT' = :Patient_status
and (p.current_status = 'SC'
or p.current_status = 'ST')))
...
/*Get the display description for patient current status.*/
select pg.grp_desc current_status_desc
...
from patient p
join pat_group pg on p.current_status = pg.sys_code
...