BMS-HOSxP Community
HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: ploykot ที่ กุมภาพันธ์ 18, 2013, 14:57:45 PM
-
ขอรายงานยอดการใช้เวชภัณฑ์ยาแบบแยก opd กับ ipd ครับ
-
;D ;D ;D ถ้าอยากได้แค่ ตัวเลข ใช้นีัก็ได้ครับ
-
ขอแบบเป็นรายการครับ
-
ขอแบบเป็นรายการครับ
หมายถึง อันดับการใช้ยา หรอครับ
-
แบบนี้หรือครับ..
-
หรือ แบบนี้...ครับ.. มีในรายงานหลัก.SYSTEM-RX-DRUG-USE-SUMMARY
-
หรือ แบบนี้...ครับ.. มีในรายงานหลัก.SYSTEM-RX-DRUG-USE-SUMMARY
แบบนี้ครับ แต่ต้องการแยก opd กับ ipd ครับ แบบนี้มันรวมกันครับ
-
select o.icode,concat(d.name,' ',d.strength) drug,d.units
,sum(o.qty) 'Total'
,sum(o.sum_price) 'Sum_Price'
,sum(if(o.vn is not null,o.qty,0)) 'OPD'
,sum(if(o.vn is not null,o.sum_price,0)) 'OPD_Price'
,sum(if(o.an is not null,o.qty,0)) 'IPD'
,sum(if(o.an is not null,o.sum_price,0)) 'IPD_Price'
from opitemrece o
left join drugitems d on d.icode=o.icode
where o.rxdate between '2013-1-1' and '2013-1-31'
and d.name is not null
group by o.icode
order by d.name