ผู้เขียน หัวข้อ: จำนวนผู้ป่วยหอบหืด  (อ่าน 3907 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ yukiplee

  • Newbie
  • *
  • กระทู้: 49
  • Respect: 0
    • ดูรายละเอียด
จำนวนผู้ป่วยหอบหืด
« เมื่อ: มกราคม 30, 2013, 14:10:30 PM »
0
หาจำนวนผู้ป่วยหอบหืด Re admid ภายใน 28 วัน กี่คนราย พอจะมีวิธีหาอย่างไรบ้างคับ  อยากได้ sql คับ
 

ออฟไลน์ k_toedkiets

  • Hero Member
  • *****
  • กระทู้: 853
  • Respect: +2
    • ดูรายละเอียด
Re: จำนวนผู้ป่วยหอบหืด
« ตอบกลับ #1 เมื่อ: มกราคม 30, 2013, 14:21:39 PM »
0
หาจำนวนผู้ป่วยหอบหืด Re admid ภายใน 28 วัน กี่คนราย พอจะมีวิธีหาอย่างไรบ้างคับ  อยากได้ sql คับ
ตามนี้ครับ
select a1.an,a1.hn,a1.pdx as pdx1,
s1.name as clinic1,a2.pdx as pdx2,s2.name as clinic2,a1.regdate,a2.regdate,a1.dchdate,a2.dchdate,a2.lastvisit,a1.age_y,count(a1.pdx) as ptco
from an_stat a1
left outer join an_stat a2 on a1.hn=a2.hn
left outer join patient p on p.hn=a1.hn
left outer join spclty s1 on s1.spclty=a1.spclty
left outer join spclty s2 on s2.spclty=a2.spclty
where a2.regdate between a1.regdate and (a1.dchdate+28) and a1.pdx = a2.pdx
and a1.vn<>a2.vn
and a1.dchdate between '2010-02-01' and '2012-09-30'
group by a1.pdx
order by ptco desc
limit 20
Khaibangrachan Hospital
HOSXP : 3.58.2.12
Activation HOSxP 2015
----------------

ออฟไลน์ jameborn

  • Full Member
  • ***
  • กระทู้: 113
  • เด็กป๋าเวช
  • Respect: 0
    • ดูรายละเอียด
Re: จำนวนผู้ป่วยหอบหืด
« ตอบกลับ #2 เมื่อ: มกราคม 30, 2013, 15:35:26 PM »
0
select count(distinct a.an) 'Total'
,count(distinct if(a.lastvisit<=28,a.an,null)) 'ReAdmit'
,count(distinct a1.an) 'Asthma'
,count(distinct if(a.lastvisit<=28 and a1.an is not null,a.an,null)) 'Re_Asthma'
,count(distinct a2.an) 'COPD'
,count(distinct if(a.lastvisit<=28 and a2.an is not null,a.an,null)) 'Re_COPD'
from an_stat a
left join (select an from iptdiag where icd10='J459') a1 on a1.an=a.an
left join (select an from iptdiag where icd10='J449') a2 on a2.an=a.an
where a.dchdate between '2011-10-1' and '2012-9-30'
แบบนี้ไหวมั๊ย
server :Acer Altos G320
 pentium D 3.00 GHz 2.99 GHz ram 512 MB
HDD:160 GB OS : server 2003 r2 My SQL 5.1.20-bata
replication: intel cpu 2160 ram 896 HDD 160 gb os: server 2003 r2
client:intel intel cpu 2160 ram 896 HDD 160 gb os: server 2003 r2
::HOSxP::v.3.52.8.30  HOSxP pcu ::v.3.52.8.25
***ไม่เสียสละ ชัยชนะไม่เกิด***

ออฟไลน์ James011

  • Hero Member
  • *****
  • กระทู้: 1,743
  • Respect: +16
    • ดูรายละเอียด
Re: จำนวนผู้ป่วยหอบหืด
« ตอบกลับ #3 เมื่อ: มกราคม 30, 2013, 15:48:41 PM »
0
แบบนี้ไม่รู้ได้ป่าวครับ