SELECT o.REG_DATETIME , o.HN , o.VISIT_ID, p.CID, CONCAT(p.FNAME,'',p.LNAME) AS FULLNAME, p.BIRTHDATE, o.UNIT_REG, icd.ICD10_TM
FROM opd_visits o
INNER JOIN cid_hn c ON o.hn = c.hn
INNER JOIN population p ON c.cid = p.cid
INNER JOIN opd_diagnosis dx ON dx.visit_id = o.visit_id and dx.is_cancel = 0
INNER JOIN icd10new icd ON icd.icd10 = dx.icd10 and icd.ICD10_TM BETWEEN 'X60' AND 'X64'
WHERE o.REG_DATETIME BETWEEN '2017.01.01 00:00' and '2020.12.31 23:59'
AND o.is_cancel = 0 ORDER BY o.REG_DATETIME DESC
ไม่มีความคิดเห็น:
แสดงความคิดเห็น