วันอังคารที่ 23 ธันวาคม พ.ศ. 2557

รายชื่อคนที่ไม่ได้รับการคัดกรอง ncd 58 (ไม่มีกลุ่มป่วย)

select concat(ctitle.titlename,person.fname,' ',person.lname)as pname,
person.birth as pbirth,
GetAgeYearNum(person.birth,'2014-10-01')as age,
person.idcard as pcid,
person.hnomoi as hno,
person.mumoi as mu
from person inner join ctitle on person.prename = ctitle.titlecode
inner join house on person.pcucodeperson = house.pcucode and person.hcode = house.hcode
inner join village on house.pcucode = village.pcucode and village.villcode = house.villcode
where person.typelive in ('1','3') and GetAgeYearNum(person.birth,'2014-10-01') >= '35'
and SUBSTRING(house.villcode,7,2)<>'00' and person.pid not in (select ncd_person_ncd_screen.pid
FROM ncd_person_ncd_screen where ncd_person_ncd_screen.screen_date between '2014-10-01' and '2015-09-30' )
and CONCAT(person.pid,person.pcucodeperson) not in (select concat(persondeath.pid,persondeath.pcucodeperson)
from persondeath where persondeath.deaddate <= CURRENT_DATE)and concat(person.pid,person.pcucodeperson)
not in (select concat(personchronic.pid,personchronic.pcucodeperson)from personchronic where personchronic.chroniccode like'E1%' or(personchronic.chroniccode like'I1%'))
order by village.villno

Share this

0 Comment to "รายชื่อคนที่ไม่ได้รับการคัดกรอง ncd 58 (ไม่มีกลุ่มป่วย)"

แสดงความคิดเห็น