BMS-HOSxP Community

HOSxP => Report Exchange => ข้อความที่เริ่มโดย: prapansak ที่ กรกฎาคม 05, 2012, 08:40:01 AM

หัวข้อ: ช่วยดู Code หัตถการผู้ป่วยในให้หน่อยครับ
เริ่มหัวข้อโดย: prapansak ที่ กรกฎาคม 05, 2012, 08:40:01 AM
select v.hn,v.age_y,o.vstdate,i.name,concat(p.pname,p.fname," ",p.lname) as ptname,t.full_name,v.moopart,p.cid,v.pttype
from opitemrece o
left outer join vn_stat v  on v.hn=o.hn
left outer join ipt_oper_code i on i.icode=o.icode
left outer join patient p on p.hn=v.hn
left outer join thaiaddress t on t.addressid=v.aid
where o.vstdate between '2012-01-01' and '2012-01-31'
and o.icode = "'+3001340+'"  group by v.hn order by t.full_name,v.vstdate
---------------------------------------------------------------------------------------------
ต้องการหาชื่อ ที่อยู่ ของผู้ที่มารับหัตถการผู้ป่วยในใช้ Code นี้ถูกไหมครับ
อาจารย์ทุกท่าน ช่วยดูให้ที
ขอบคุณครับ
หัวข้อ: Re: ช่วยดู Code หัตถการผู้ป่วยในให้หน่อยครับ
เริ่มหัวข้อโดย: เกื้อกูล ครับ.. ที่ กรกฎาคม 05, 2012, 08:54:34 AM
select v.hn,v.age_y,o.vstdate,i.name,concat(p.pname,p.fname," ",p.lname) as ptname,t.full_name,v.moopart,p.cid,v.pttype
from opitemrece o
left outer join vn_stat v  on v.hn=o.hn
left outer join ipt_oper_code i on i.icode=o.icode
left outer join patient p on p.hn=v.hn
left outer join thaiaddress t on t.addressid=v.aid
where o.vstdate between '2012-01-01' and '2012-01-31'
and o.icode = "'+3001340+'"  group by v.hn order by t.full_name,v.vstdate
---------------------------------------------------------------------------------------------
ต้องการหาชื่อ ที่อยู่ ของผู้ที่มารับหัตถการผู้ป่วยในใช้ Code นี้ถูกไหมครับ
อาจารย์ทุกท่าน ช่วยดูให้ที
ขอบคุณครับ

น่าจะใช้ hn ใน ipt,an_stat แทน  vn_stat ครับ..เพราะเป็น ipd และเก็บข้อมูลตาม an เป็นหลัก
หัวข้อ: Re: ช่วยดู Code หัตถการผู้ป่วยในให้หน่อยครับ
เริ่มหัวข้อโดย: prapansak ที่ กรกฎาคม 05, 2012, 09:12:38 AM
ขอบคุณครับ
หัวข้อ: Re: ช่วยดู Code หัตถการผู้ป่วยในให้หน่อยครับ
เริ่มหัวข้อโดย: prapansak ที่ กรกฎาคม 05, 2012, 09:14:38 AM
ทดสอบใช้ an_stat แล้ว มีปัญหาตรงที่ ฟิล aid ของคนไข้บางรายไม่มี แต่ถ้าใน vn_stat จะมีครบ
ต้องแก้ยังไงดีครับ
ขอบคุณครับ
หัวข้อ: Re: ช่วยดู Code หัตถการผู้ป่วยในให้หน่อยครับ
เริ่มหัวข้อโดย: เกื้อกูล ครับ.. ที่ กรกฎาคม 05, 2012, 09:31:07 AM
ทดสอบใช้ an_stat แล้ว มีปัญหาตรงที่ ฟิล aid ของคนไข้บางรายไม่มี แต่ถ้าใน vn_stat จะมีครบ
ต้องแก้ยังไงดีครับ
ขอบคุณครับ

ลองใช้ 

select v.hn,v.age_y,o.vstdate,i.name,concat(p.pname,p.fname," ",p.lname) as ptname,t.full_name,v.moopart,p.cid,v.pttype
from opitemrece o
left outer join an_stat v  on v.an=o.an
left outer join ipt_oper_code i on i.icode=o.icode
left outer join patient p on p.hn=v.hn
left outer join thaiaddress t on t.addressid=concat(p.chwpart,p.amppart,p.tmbpart)
where o.vstdate between '2011-01-01' and '2012-01-31'
and o.icode like = "XXXXX"  group by v.hn order by t.full_name,v.dchdate
หัวข้อ: Re: ช่วยดู Code หัตถการผู้ป่วยในให้หน่อยครับ
เริ่มหัวข้อโดย: prapansak ที่ กรกฎาคม 05, 2012, 11:35:08 AM
ขอบคุณครับ