select v.hn as HN,p.cardno as CID,o.icd10 as ICD10,pt.informname as N1,pt.informaddr as N2,
concat(pt.pname,pt.fname," ",pt.lname) as fullname,s.name as sex ,pt.birthday
from vn_stat v,ovstdiag o,visit_pttype vp,ptcardno p,patient pt
left outer join sex s on s.code=pt.sex
where v.vn=o.vn and v.vn=vp.vn and v.hn = pt.hn and vp.pttype="52"
and o.icd10 in ("Z021","Z027") and p.hn=v.hn
and v.vstdate between "2008-02-11" and "2008-02-11" group by v.hn