BMS-HOSxP Community
HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: sshpt ที่ มิถุนายน 03, 2008, 11:26:10 AM
-
select an.regdate,an.hn,c.cardno,concat(p.pname," ",p.fname," ",p.lname) as ptname,p.addrpart,p.moopart,t.full_name,an.pdx,p.birthday
from an_stat an
left outer join patient p on p.hn=an.hn
left outer join ptcardno c on c.hn=an.hn
left outer join thaiaddress t on t.addressid=an.aid
where an.regdate between '2008-05-07' and '2008-05-07'and an.age_y>'64' and an.pdx in ('I05','I06','I07','I08','I09','I11','I13','I20','I21','I22','I23','I24','I25','I26','I27','I28','I29','I30','I31','I32','I33','I34','I35','I36','I37','I38','I39','I40','I41','I42','I43','I44','I45','I46','I47','I48','I49','I50','I51','I52')
group by hn
order by hn
จาก CODE ด้านบน เงื่อนไข ICD10 ยาวมากครับ
จริง ๆ แล้ว คือ I05-09 และ 11 และ 13 และ 20-52
ถ้าจะเขียนให้สั้นลงกว่านี้ ทำไงครับ ;D ;D
-
ใช้แบบนี้ได้ไหมครับ แต่ข้อมูลที่ได้จะละเอียดขึ้นครับ
select an.regdate,an.hn,c.cardno,concat(p.pname," ",p.fname," ",p.lname) as ptname,p.addrpart,p.moopart,t.full_name,an.pdx,p.birthday
from an_stat an
left outer join patient p on p.hn=an.hn
left outer join ptcardno c on c.hn=an.hn
left outer join thaiaddress t on t.addressid=an.aid
where an.regdate between '2008-04-01' and '2008-04-30'and an.age_y>'64'
and an.pdx between "I05" and "I09"
or pdx between "I11" and "I13"
or pdx between "I20" and "I52"
group by hn
order by hn
-
ขอบคุณครับ ;D
-
ใช้แบบนี้ได้ไหมครับ แต่ข้อมูลที่ได้จะละเอียดขึ้นครับ
select an.regdate,an.hn,c.cardno,concat(p.pname," ",p.fname," ",p.lname) as ptname,p.addrpart,p.moopart,t.full_name,an.pdx,p.birthday
from an_stat an
left outer join patient p on p.hn=an.hn
left outer join ptcardno c on c.hn=an.hn
left outer join thaiaddress t on t.addressid=an.aid
where an.regdate between '2008-04-01' and '2008-04-30'and an.age_y>'64'
and an.pdx between "I05" and "I09"
or pdx between "I11" and "I13"
or pdx between "I20" and "I52"
group by hn
order by hn
จริงๆ ต้องเป็นแบบนี้ครับ
select an.regdate,an.hn,c.cardno,concat(p.pname," ",p.fname," ",p.lname) as ptname,p.addrpart,p.moopart,t.full_name,an.pdx,p.birthday
from an_stat an
left outer join patient p on p.hn=an.hn
left outer join ptcardno c on c.hn=an.hn
left outer join thaiaddress t on t.addressid=an.aid
where an.regdate between '2008-04-01' and '2008-04-30'and an.age_y>'64'
and ( an.pdx between "I05" and "I0999999"
or pdx between "I11" and "I1399999"
or pdx between "I20" and "I5299999" )
group by hn
order by hn