BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: Manit ที่ กรกฎาคม 13, 2007, 12:06:16 PM

หัวข้อ: ช่วยดูรายงานการใช้ Morphine ให้หน่อยครับ
เริ่มหัวข้อโดย: Manit ที่ กรกฎาคม 13, 2007, 12:06:16 PM
ไม่ทราบว่าผิดพลาดขั้นตอนไหน

ผู้ป่วยมาฉีด Morphine ที่ er เกือบทุกวัน แต่เรียกรายงานมาดูมีขึ้นมาแค่ 3 ครั้ง

แต่ถ้าลองค้นหาจาก รายงานระบบ OPD Custom search มีการใช้ถึง 19 ครั้ง ซึ่งเป็นตัวเลขที่น่าจะถูกต้อง

ตามรูปครับ

ใครมีความรู้ในการเขียนรายงานช่วยแก้ให้หน่อยครับ
หัวข้อ: Re: ช่วยดูรายงานการใช้ Morphine ให้หน่อยครับ
เริ่มหัวข้อโดย: nahos ที่ กรกฎาคม 13, 2007, 14:08:07 PM
ลองเปลี่ยนคำสั่ง sql เป็น

select
concat(pt.pname,pt.fname,"  ",pt.lname) as fullname,ov.vn,
concat(pt.addrpart," ËÁÙè ",pt.moopart," µ.",t3.name," Í.",t2.name," ¨.",t1.name) as fulladdressname,
op.an,icode,qty,year(rxdate)-year(birthday) as age,rxdate,order_no
from ovst ov
left outer join patient pt on pt.hn=ov.hn
left outer join thaiaddress t1 on t1.chwpart=pt.chwpart and
     t1.amppart="00" and t1.tmbpart="00"
left outer join thaiaddress t2 on t2.chwpart=pt.chwpart and
     t2.amppart=pt.amppart and t2.tmbpart="00"
left outer join thaiaddress t3 on t3.chwpart=pt.chwpart and
     t3.amppart=pt.amppart and t3.tmbpart=pt.tmbpart
left outer join opitemrece op on op.hn=ov.hn
where op.rxdate between "2007-06-01" and "2007-07-31"  and op.icode ="1000196"
 group by rxtime
order by rxdate

ดูนะครับ  :D
หัวข้อ: Re: ช่วยดูรายงานการใช้ Morphine ให้หน่อยครับ
เริ่มหัวข้อโดย: Manit ที่ กรกฎาคม 13, 2007, 14:31:34 PM
ลองเปลี่ยนคำสั่ง sql เป็น

select
concat(pt.pname,pt.fname,"  ",pt.lname) as fullname,ov.vn,
concat(pt.addrpart," ËÁÙè ",pt.moopart," µ.",t3.name," Í.",t2.name," ¨.",t1.name) as fulladdressname,
op.an,icode,qty,year(rxdate)-year(birthday) as age,rxdate,order_no
from ovst ov
left outer join patient pt on pt.hn=ov.hn
left outer join thaiaddress t1 on t1.chwpart=pt.chwpart and
     t1.amppart="00" and t1.tmbpart="00"
left outer join thaiaddress t2 on t2.chwpart=pt.chwpart and
     t2.amppart=pt.amppart and t2.tmbpart="00"
left outer join thaiaddress t3 on t3.chwpart=pt.chwpart and
     t3.amppart=pt.amppart and t3.tmbpart=pt.tmbpart
left outer join opitemrece op on op.hn=ov.hn
where op.rxdate between "2007-06-01" and "2007-07-31"  and op.icode ="1000196"
 group by rxtime
order by rxdate

ดูนะครับ  :D

OK ครับ ลองแล้วใช้ได้เลยครับ

ขอบคุณ คุณ nahos มากๆเลยครับ  ;D