from opd_visits as o1
inner join opd_diagnosis od1 ON od1.visit_id = o1.visit_id AND o1.is_cancel = 0 AND od1.is_cancel = 0
LEFT JOIN icd10new i1 ON i1.icd10 = od1.icd10 AND i1.icd10_tm BETWEEN 'A90' AND 'A999'
where o1.REG_DATETIME BETWEEN "2020-05-01 00:00:00 " AND NOW()
AND a.hn=o1.hn and a.visit_id > o1.visit_id order by o1.visit_id desc limit 1) as last_visit
ไม่มีความคิดเห็น:
แสดงความคิดเห็น