Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 708 medicalCard.service.for.organization Вид услуги select id,
- case
- when is_complex is true then concat('[+]', coalesce(code, ''), ' ', name)
- else concat(coalesce(code, ''), ' ', name)
- end,
- duration_unit_id,
- case
- when is_complex is true then cul = get_service_cul(id, is_complex)
- else is_actual_cul
- end as is_actual_cul,
- case
- when is_complex is true then get_service_cul(id, is_complex)
- else cul
- end as cul,
- is_multuplicity,
- prototype_id,
- is_fictitious,
- is_stomat,
- is_filling,
- is_need_anatomic_zone,
- is_need_close_date
- from sr_service SUGGESTION where id = :id where org_id = :orgId and (is_fictitious is not true)
- and lower('[+]'||coalesce(code, '')||' '||name) like '%'||lower(:text)||'%'
- and (from_dt is null or from_dt<=to_date(:date, 'DD.MM.YYYY')) and
- (to_dt is null or to_dt>=to_date(:date, 'DD.MM.YYYY'))
- and(:resGroupId::integer is null
- or (exists (select 1 from sr_res_group_service gs join sr_res_group rg on rg.template_res_group_id = gs.group_id
- where srv_type_id = sr_service.id and rg.id = :resGroupId)
- and exists(select 1 from sr_res_group_service gs join sr_res_group rg on rg.template_res_group_id = gs.group_id
- where rg.id = :resGroupId)
- )
- or (exists (select 1 from sr_res_group_service where srv_type_id = sr_service.id and group_id = :resGroupId)
- and exists(select 1 from sr_res_group_service where group_id = :resGroupId)
- )
- or (not exists(select 1 from sr_res_group_service where group_id = :resGroupId)
- and not exists(select 1 from sr_res_group_service gs join sr_res_group rg on rg.template_res_group_id = gs.group_id
- where rg.id = :resGroupId))
- ) app_group_master 2016-12-20 21:51:11.184643 DB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement