BMS-HOSxP Community

HOSxP => Report Exchange => ข้อความที่เริ่มโดย: Zulkiflee ที่ มกราคม 03, 2014, 16:16:30 PM

หัวข้อ: ขอรายงานผู้ป่วย AMI I21 และI122
เริ่มหัวข้อโดย: Zulkiflee ที่ มกราคม 03, 2014, 16:16:30 PM
โดยมีโจทย์ดังนี้
1.ผลรวมจำนวนวันนอนรวมของผุ้ป่วย AMI ที่จำหน่ายออกจาก รพ ทั้งหมดใน1เดือน
2.ผลรวมจำนวนผู้ป่วย AMI ที่จำหน่ายออกจาก รพ ทั้งหมด(ในเดือนเดียวกัน)

ICD10 ของ AMI คือ I21  I22
หัวข้อ: Re: ขอรายงานผู้ป่วย AMI I21 และI122
เริ่มหัวข้อโดย: udomchok ที่ มกราคม 03, 2014, 17:18:20 PM
โดยมีโจทย์ดังนี้
1.ผลรวมจำนวนวันนอนรวมของผุ้ป่วย AMI ที่จำหน่ายออกจาก รพ ทั้งหมดใน1เดือน
2.ผลรวมจำนวนผู้ป่วย AMI ที่จำหน่ายออกจาก รพ ทั้งหมด(ในเดือนเดียวกัน)

ICD10 ของ AMI คือ I21  I22
ข้อ 1
select sum(admdate) as sum_admit_date
from an_stat a
join iptdiag idx on idx.an=a.an
where (idx.icd10 between "I21" and "I22") and (a.regdate between "2013-01-01" and "2013-06-30")

ข้อ 2
select count(distinct a.an) as cases
from an_stat a
join iptdiag idx on idx.an=a.an
where (idx.icd10 between "I21" and "I22") and (a.regdate between "2013-01-01" and "2013-06-30")



ข้อ 1 หารด้วยข้อ 2
select (select sum(admdate) as sum_admit_date
from an_stat a
join iptdiag idx on idx.an=a.an
where (idx.icd10 between "I21" and "I22") and (a.regdate between "2013-01-01" and "2013-06-30"))/(select count(distinct a.an) as cases
from an_stat a
join iptdiag idx on idx.an=a.an
where (idx.icd10 between "I21" and "I22") and (a.regdate between "2013-01-01" and "2013-06-30")) as result