select pcucodeperson as hospcode,pid,DATE_FORMAT(datefirstdiag, '%Y%m%d')as date_diag,chroniccode as chronic
			,hospfirstdiag as hosp_dx,cup as hosp_rx,DATE_FORMAT(datedischart, '%Y%m%d') as date_disch,
			typedischart as typedisch,DATE_FORMAT(dateupdate, '%Y%m%d%h%m%s') as d_update
from personchronic 
where chroniccode not like 'M%'