SELECT lh.vn,lh.hn,p.pname,p.fname,p.lname,v.sex,
v.age_y,p.addrpart,p.moopart,t.full_name,v.pdx,
i.`name`,lh.order_date,lo.lab_order_result,o.egfr,
pe.`name`,if(o.egfr>=90,'1',if(o.egfr between 60 and 89.999,'2',if(o.egfr between 45 and 59.999,'3a',if(o.egfr between 30 and 44.999,'3b',if(o.egfr between 15 and 29.999,'4',if(o.egfr<15,'5','')))))) AS state,
GROUP_CONCAT(distinct(l.name) SEPARATOR ',') as clinic
FROM lab_order AS lo
LEFT OUTER JOIN lab_head AS lh ON lo.lab_order_number = lh.lab_order_number
LEFT OUTER JOIN vn_stat AS v ON v.vn = lh.vn
LEFT OUTER JOIN opdscreen AS o ON v.vn = o.vn
LEFT OUTER JOIN patient AS p ON p.hn = lh.hn
LEFT OUTER JOIN icd101 AS i ON i.`code` = v.pdx
LEFT OUTER JOIN thaiaddress AS t ON t.addressid = concat(p.chwpart,p.amppart,p.tmbpart)
LEFT OUTER JOIN pttype AS pe ON pe.pttype = v.pttype
LEFT OUTER JOIN clinicmember c on c.hn=v.hn
LEFT OUTER JOIN clinic l on l.clinic=c.clinic
where v.vn is not null and lo.lab_items_code in ('155') and (lh.report_date between '2015-12-01' and '2015-12-10')
group by v.vn