BMS-HOSxP Community
HOSxP => Report Exchange => ข้อความที่เริ่มโดย: Bluebird ที่ ธันวาคม 13, 2013, 11:30:07 AM
-
script ดึงรายงานอันดับโรค แบบจัดกลุ่ม Diag
เช่น ความดันโลหิตสูง จะใช้ I10-I159
ซึ่งก่อนนี้จะใช้
select i.code,i.name,(count(icd10))AS CODE1 from ovstdiag o
left outer join icd101 i on i.code=o.icd10
where o.vstdate between '2013-10-01' and '2013-10-31'
and i.code is not null
group by o.icd10
order by code1 desc
-
ขอบคุณมากครับ ;)
-
แบบบ้าน ๆ
select * from (
select "DM" as code, sum(if(o.icd10 between "E10" and "E149",1,0)) AS cases
from ovstdiag o
where o.vstdate between '2013-10-01' and '2013-10-31'
union
select "HT" as code, sum(if(o.icd10 between "I10" and "I159",1,0)) AS Cases
from ovstdiag o
where o.vstdate between '2013-10-01' and '2013-10-31'
union
select "CVD" as code, sum(if(o.icd10 between "I20" and "I259",1,0)) AS Cases
from ovstdiag o
where o.vstdate between '2013-10-01' and '2013-10-31'
) as t
order by t.cases desc
อยากได้(กลุ่ม)โรคอะไรไปเพิ่มเอานะครับ
union
select "CVD" as code, sum(if(o.icd10 between "I20" and "I259",1,0)) AS Cases
from ovstdiag o
where o.vstdate between '2013-10-01' and '2013-10-31'
-
แบบบ้าน ๆ
select * from (
select "DM" as code, sum(if(o.icd10 between "E10" and "E149",1,0)) AS cases
from ovstdiag o
where o.vstdate between '2013-10-01' and '2013-10-31'
union
select "HT" as code, sum(if(o.icd10 between "I10" and "I159",1,0)) AS Cases
from ovstdiag o
where o.vstdate between '2013-10-01' and '2013-10-31'
union
select "CVD" as code, sum(if(o.icd10 between "I20" and "I259",1,0)) AS Cases
from ovstdiag o
where o.vstdate between '2013-10-01' and '2013-10-31'
) as t
order by t.cases desc
อยากได้(กลุ่ม)โรคอะไรไปเพิ่มเอานะครับ
union
select "CVD" as code, sum(if(o.icd10 between "I20" and "I259",1,0)) AS Cases
from ovstdiag o
where o.vstdate between '2013-10-01' and '2013-10-31'
เป้าหมาย ต้องการ อันดับโรคครับ
-
เป้าหมาย ต้องการ อันดับโรคครับ
แปลหน่อย ??? ??? ??? ???
-
คุณต้องสร้างกลุ่มโรคที่ต้องการขึ้นมาก่อน
เช่น แบบ RPT_504_CODE/RPT_504_NAME
แล้วค่อยมาคำนวณ
-
จะจัดกลุ่มยังไงเนียะ ???
เท่าที่รู้ก็ E10-E149 คือ เบาหวาน
I10-I159 คือ ความดันโลหิตสูง
นอกนั้น ไม่รู้ว่า โรคอะไร มี ICD10อะไรบ้าง