---定义成视图，方便现场调整
select xx1||xx2,count(*) from (
select mrn000,
(select REPLACE(b.BGJYJG,'型','') from jy_yw0000_dzbl a,jy_jyjg00_dzbl b,yj_yw0000 c where a.jyywid=b.jyywid and a.yjdjh0=c.yjdjh0
 and c.zlxmid in (66471,17781) and trim(BGXMMC) like '%血型' and bgxmid=5770 and c.yjdjh0 in 
(select max(yjdjh0) from  yj_yw0000 where zyghid=h.zyid00 and mzzybz='1' and  zlxmid in (66471,17781))) xx1,
(select decode(b.BGJYJG,'阴性','-','陽性','+','') from jy_yw0000_dzbl a,jy_jyjg00_dzbl b,yj_yw0000 c where a.jyywid=b.jyywid and a.yjdjh0=c.yjdjh0
 and c.zlxmid in (66471,17781) and trim(BGXMMC) like '%血型' and bgxmid=5776 and c.yjdjh0 in 
(select max(yjdjh0) from  yj_yw0000 where zyghid=h.zyid00 and mzzybz='1' and  zlxmid in (66471,17781))) xx2
 from zy_brxxb0 h where brzt00='20' and ryrq00 >= to_char(sysdate-365 ,'yyyymmdd') and cyrq00 is null
) group by xx1||xx2