NCD
สถานการณ์โรคไม่ติดต่อ
  • จากฐานข้อมูลโปรแกรม HOSxP
  • Table :

SELECT cm.clinic AS clinic,c.`name` AS ncdname,COUNT(*) AS ptotal
FROM clinicmember cm
LEFT OUTER JOIN clinic c ON c.clinic = cm.clinic
LEFT OUTER JOIN patient p ON p.hn = cm.hn
WHERE p.death <> 'Y' AND cm.clinic IN ('040','041','043')
AND cm.discharge <> 'N' AND p.chwpart = '66' AND p.amppart = '04'
GROUP BY cm.clinic

UNION

SELECT '112' AS clinic,'มะเร็ง' AS ncdname,COUNT(*) AS ptotal
FROM patient_cancer_registeration pc
LEFT OUTER JOIN patient p ON p.hn = pc.hn
WHERE pc.cancer_person_live_status_id <> '2'
AND p.chwpart = '66' AND p.amppart = '04'