case when ifnull(G.STATE2,'0')='0' and ifnull(H.SUBMIT_TYPE,'1')='1' then exists(select 1 from t2 where H_ID=G.H_ID) else '1' end as iscan