BMS-HOSxP Community

HOSxP => Report Exchange => ข้อความที่เริ่มโดย: Bluebird ที่ ธันวาคม 13, 2013, 11:30:07 AM

หัวข้อ: script ดึงรายงานอันดับโรค แบบจัดกลุ่ม Diag
เริ่มหัวข้อโดย: 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
หัวข้อ: Re: script ดึงรายงานอันดับโรค แบบจัดกลุ่ม Diag
เริ่มหัวข้อโดย: บิ๊กเบิร์ด ที่ ธันวาคม 13, 2013, 12:08:55 PM
ขอบคุณมากครับ  ;)
หัวข้อ: Re: script ดึงรายงานอันดับโรค แบบจัดกลุ่ม Diag
เริ่มหัวข้อโดย: udomchok ที่ ธันวาคม 13, 2013, 12:43:21 PM
แบบบ้าน ๆ
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'
หัวข้อ: Re: script ดึงรายงานอันดับโรค แบบจัดกลุ่ม Diag
เริ่มหัวข้อโดย: Bluebird ที่ ธันวาคม 13, 2013, 14:40:25 PM
แบบบ้าน ๆ
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'

เป้าหมาย ต้องการ อันดับโรคครับ
หัวข้อ: Re: script ดึงรายงานอันดับโรค แบบจัดกลุ่ม Diag
เริ่มหัวข้อโดย: udomchok ที่ ธันวาคม 13, 2013, 15:48:59 PM
เป้าหมาย ต้องการ อันดับโรคครับ
แปลหน่อย  ??? ??? ??? ???
หัวข้อ: Re: script ดึงรายงานอันดับโรค แบบจัดกลุ่ม Diag
เริ่มหัวข้อโดย: woravet ที่ ธันวาคม 13, 2013, 16:31:48 PM
คุณต้องสร้างกลุ่มโรคที่ต้องการขึ้นมาก่อน
เช่น แบบ RPT_504_CODE/RPT_504_NAME
แล้วค่อยมาคำนวณ
หัวข้อ: Re: script ดึงรายงานอันดับโรค แบบจัดกลุ่ม Diag
เริ่มหัวข้อโดย: Bluebird ที่ ธันวาคม 18, 2013, 15:11:50 PM
จะจัดกลุ่มยังไงเนียะ    ???
เท่าที่รู้ก็ E10-E149 คือ เบาหวาน
I10-I159 คือ ความดันโลหิตสูง
นอกนั้น ไม่รู้ว่า โรคอะไร มี ICD10อะไรบ้าง