คีย์sealants ป.1

"กลุ่มเป้าหมายจริงๆคือ เด็ก  6ปี ถึง 6 ปี 11 เดือน 29 วัน (นับตามเดือนที่อายุถึง)
ขั้นตอน
1.เข้าหน้าบริการ

2.เข้าตรวจฟัน Dental (6)

3.เติมจำนวนซีฟันที่ทำsealant ด้วยนะ เนื่องจากเขานับผลงานจากฟันแท้ซี่ 1 เช่น ซี่ 16 ,26,36,46

4.วินิจฉัย K02.0  + หัตถการ  "2387030"  และใส่ Oralน้อย+ใหญ่ได้ >> แต่หากมีรหัส "Z01.2" โผล่มา ให้ลบออกนะจ๊ะ (ผิดกฎ A1 สนย.)

5.กลุ่มเป้าหมาย ที่ต้องตามเก็บ (นับตั้งแต่ต้นปีงบประมาณ และหักคนที่ให้sealants ไปแล้ว)
scpt หาเด็กทำsealants (ที่เหลือ)
................................................................
DROP TABLE IF EXISTS t6sealant;

CREATE TABLE t6sealant AS

(Select p.pid,ct.titlename,p.fname,p.lname,p.birth,GetAgeymd(p.birth,CURDATE())as age,
p.idcard as idcard,h.hno as hno,Right(h.villcode,2) as village
,'2016-10-01'AS'เดือนที่อายุถึง'
from person p
inner join ctitle ct on p.prename = ct.titlecode
inner join house h on p.pcucodeperson = h.pcucode and p.hcode = h.hcode
where p.typelive in ('1','3')and p.pid not in (select persondeath.pid from persondeath)
and RIGHT(h.villcode,2)<> '00' and GetAgemonth(p.birth,'2016-10-01') BETWEEN '72' AND '73')
UNION
(Select p.pid,ct.titlename,p.fname,p.lname,p.birth,GetAgeymd(p.birth,CURDATE())as age,
p.idcard as idcard,h.hno as hno,Right(h.villcode,2) as village
,'2016-11-01'AS'เดือนที่อายุถึง'
from person p
inner join ctitle ct on p.prename = ct.titlecode
inner join house h on p.pcucodeperson = h.pcucode and p.hcode = h.hcode
where p.typelive in ('1','3')and p.pid not in (select persondeath.pid from persondeath)
and RIGHT(h.villcode,2)<> '00' and (GetAgemonth(p.birth,'2016-11-01') BETWEEN '72' AND '73'))
UNION
(Select p.pid,ct.titlename,p.fname,p.lname,p.birth,GetAgeymd(p.birth,CURDATE())as age,
p.idcard as idcard,h.hno as hno,Right(h.villcode,2) as village
,'2016-12-01'AS'เดือนที่อายุถึง'
from person p
inner join ctitle ct on p.prename = ct.titlecode
inner join house h on p.pcucodeperson = h.pcucode and p.hcode = h.hcode
where p.typelive in ('1','3')and p.pid not in (select persondeath.pid from persondeath)
and RIGHT(h.villcode,2)<> '00' and (GetAgemonth(p.birth,'2016-12-01') BETWEEN '72' AND '73'))
UNION
(Select p.pid,ct.titlename,p.fname,p.lname,p.birth,GetAgeymd(p.birth,CURDATE())as age,
p.idcard as idcard,h.hno as hno,Right(h.villcode,2) as village
,'2017-01-01'AS'เดือนที่อายุถึง'
from person p
inner join ctitle ct on p.prename = ct.titlecode
inner join house h on p.pcucodeperson = h.pcucode and p.hcode = h.hcode
where p.typelive in ('1','3')and p.pid not in (select persondeath.pid from persondeath)
and RIGHT(h.villcode,2)<> '00' and (GetAgemonth(p.birth,'2017-01-01') BETWEEN '72' AND '73'))
UNION
(Select p.pid,ct.titlename,p.fname,p.lname,p.birth,GetAgeymd(p.birth,CURDATE())as age,
p.idcard as idcard,h.hno as hno,Right(h.villcode,2) as village
,'2017-02-01'AS'เดือนที่อายุถึง'
from person p
inner join ctitle ct on p.prename = ct.titlecode
inner join house h on p.pcucodeperson = h.pcucode and p.hcode = h.hcode
where p.typelive in ('1','3')and p.pid not in (select persondeath.pid from persondeath)
and RIGHT(h.villcode,2)<> '00' and (GetAgemonth(p.birth,'2017-02-01') BETWEEN '72' AND '73'))
UNION
(Select p.pid,ct.titlename,p.fname,p.lname,p.birth,GetAgeymd(p.birth,CURDATE())as age,
p.idcard as idcard,h.hno as hno,Right(h.villcode,2) as village
,'2017-03-01'AS'เดือนที่อายุถึง'
from person p
inner join ctitle ct on p.prename = ct.titlecode
inner join house h on p.pcucodeperson = h.pcucode and p.hcode = h.hcode
where p.typelive in ('1','3')and p.pid not in (select persondeath.pid from persondeath)
and RIGHT(h.villcode,2)<> '00' and (GetAgemonth(p.birth,'2017-03-01') BETWEEN '72' AND '73'))
union
(Select p.pid,ct.titlename,p.fname,p.lname,p.birth,GetAgeymd(p.birth,CURDATE())as age,
p.idcard as idcard,h.hno as hno,Right(h.villcode,2) as village
,'2017-04-01'AS'เดือนที่อายุถึง'
from person p
inner join ctitle ct on p.prename = ct.titlecode
inner join house h on p.pcucodeperson = h.pcucode and p.hcode = h.hcode
where p.typelive in ('1','3')and p.pid not in (select persondeath.pid from persondeath)
and RIGHT(h.villcode,2)<> '00' and (GetAgemonth(p.birth,'2017-04-01') BETWEEN '72' AND '73'))
UNION
(Select p.pid,ct.titlename,p.fname,p.lname,p.birth,GetAgeymd(p.birth,CURDATE())as age,
p.idcard as idcard,h.hno as hno,Right(h.villcode,2) as village
,'2017-05-01'AS'เดือนที่อายุถึง'
from person p
inner join ctitle ct on p.prename = ct.titlecode
inner join house h on p.pcucodeperson = h.pcucode and p.hcode = h.hcode
where p.typelive in ('1','3')and p.pid not in (select persondeath.pid from persondeath)
and RIGHT(h.villcode,2)<> '00' and (GetAgemonth(p.birth,'2017-05-01') BETWEEN '72' AND '73'))
UNION
(Select p.pid,ct.titlename,p.fname,p.lname,p.birth,GetAgeymd(p.birth,CURDATE())as age,
p.idcard as idcard,h.hno as hno,Right(h.villcode,2) as village
,'2017-06-01'AS'เดือนที่อายุถึง'
from person p
inner join ctitle ct on p.prename = ct.titlecode
inner join house h on p.pcucodeperson = h.pcucode and p.hcode = h.hcode
where p.typelive in ('1','3')and p.pid not in (select persondeath.pid from persondeath)
and RIGHT(h.villcode,2)<> '00' and (GetAgemonth(p.birth,'2017-06-01') BETWEEN '72' AND '73'));

Select t6.pid,t6.titlename,t6.fname,t6.lname,t6.birth,t6.age,t6.idcard
,t6.hno,t6.village,t6.เดือนที่อายุถึง
from t6sealant t6
where t6.pid NOT in (SELECT v.pid FROM visit v inner JOIN visitdrug vd ON v.visitno=vd.visitno
AND v.visitdate BETWEEN '2016-10-01'AND'2017-09-30' AND vd.drugcode = '2387030'
GROUP BY v.pid);
................................................................
หมายเหตุ: ให้copy มาทั้งชุด จากคำว่า DROP จนถึงสุดท้ายนะจะ (ไม่งั้นรันไม่ออกจ้า)
          และ หากรันครั้งที่ 2 ไม่ผ่านให้ปิดโปรแกรมรันแล้วรันใหม่อีกรอบนะค่ะ

6.เท่าที่ทราบเป้าหมายปี 2560 เพียง 20% ของกลุ่ม : แต่เป็นส่วนหนึ่งของ 6 กลุ่มวัยงานทันตฯ  ดังนั้นก็ต้องคีย์ให้ได้เป้าฯไม่งันกลุ่มอื่นก็จะตกไปด้วยละจ๊า

..............................................SEE U  LATER...........................bye.........

link



ไม่มีความคิดเห็น:

https://www.blogs

 kllgnsgkj[jtlm'oahd bfldkb'pdojgaojp mfigjdo;sjgaij misjgo;sjagijwo;