ผู้เขียน หัวข้อ: จากคำสั่งมีแต่รายการจ่ายยานอก จะต้องแก้ให้แสดงข้อมูลจ่ายยาในได้อย่างไรครับ  (อ่าน 1367 ครั้ง)

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

ออฟไลน์ sahavej_pct

  • Jr. Member
  • **
  • กระทู้: 75
  • ศิวกรณ์ เนียมน้อย
  • Respect: 0
    • ดูรายละเอียด
    • www.sahavej.com
จากคำสั่งมีแต่รายการจ่ายยานอก จะต้องแก้ให้แสดงข้อมูลจ่ายยาในได้อย่างไรครับ...ขอบคุณมากครับ งานกำลังเข้าผมมากเลย  :'( :'( :'( :'( :'(
---------------------------------------------------------------------------

select concat(b.name,' ',strength) as drugname,generic_name,g.pharmacology_group_name,unitcost,sum(qty),units,
b.unitprice ,sum(qty*b.unitprice) as total,f.cur_dep,department
from opitemrece a
left outer join drugitems b on a.icode=b.icode
left outer join ovst f  on f.vn = a.vn
left outer join kskdepartment c on f.cur_dep=c.depcode
left outer join pharmacology_group g on g.pharmacology_group_id=b.pharmacology_group1
where a.icode like'1%'
and qty>=1
and f.vstdate between '2016-03-10'  and '2016-03-12'
group by b.name,strength,units,b.unitprice,a.dep_code,department
order by f.cur_dep,b.name
::SAHAVEJ PHICHIT HOSPITAL::
 ขึ้นระบบเมื่อ 1 ตุลาคม 2552
SERVER :   Linux Centos 5.3 X86 64B IT Ram 4 G
BackUp1 :  Linux Centos 5.3 X86 64B IT Ram 4 G
BackUp2 :  Linux Centos 5.3 X86 64B IT Ram 2 G
HOSxP Version : 3.54.7.20
MySQL Version : 5.1.30
Client : Windows Xp & Windows Vista  30 เครื่อง
--

ออฟไลน์ golf_win

  • Hero Member
  • *****
  • กระทู้: 3,481
  • Respect: +112
    • ดูรายละเอียด
OPD

select concat(b.name,' ',strength) as drugname,generic_name,g.pharmacology_group_name,unitcost,sum(qty),units,
b.unitprice ,sum(qty*b.unitprice) as total,f.cur_dep,department
from opitemrece a
left outer join drugitems b on a.icode=b.icode
left outer join ovst f  on f.vn = a.vn
left outer join kskdepartment c on f.cur_dep=c.depcode
left outer join pharmacology_group g on g.pharmacology_group_id=b.pharmacology_group1
where a.icode like'1%'
and qty>=1
and a.rxdate between '2016-03-10'  and '2016-03-12' and a.an is null
group by b.name,strength,units,b.unitprice,a.dep_code,department
order by f.cur_dep,b.name


IPD

select concat(b.name,' ',strength) as drugname,generic_name,g.pharmacology_group_name,unitcost,sum(qty),units,
b.unitprice ,sum(qty*b.unitprice) as total,f.cur_dep,department
from opitemrece a
left outer join drugitems b on a.icode=b.icode
left outer join ovst f  on f.vn = a.vn
left outer join kskdepartment c on f.cur_dep=c.depcode
left outer join pharmacology_group g on g.pharmacology_group_id=b.pharmacology_group1
where a.icode like'1%'
and qty>=1
and a.rxdate between '2016-03-10'  and '2016-03-12' and a.an<>""
group by b.icode
order by f.cur_dep,b.name
« แก้ไขครั้งสุดท้าย: มีนาคม 15, 2016, 09:39:56 AM โดย golf_win »
โรงพยาบาลเจ็ดเสมียน จังหวัดราชบุรี
Start 19-1-51    35 station
HOSxP  3.59.5.18 Activate License
Tel. 032-305096-7 ต่อ 118
Web. http://csmhos.thaiddns.com:8080
         http://csmhos.thaieasydns.com:8080

ออฟไลน์ sahavej_pct

  • Jr. Member
  • **
  • กระทู้: 75
  • ศิวกรณ์ เนียมน้อย
  • Respect: 0
    • ดูรายละเอียด
    • www.sahavej.com
ขอบพระคุณ อ. มากๆๆๆๆๆครับ :)
::SAHAVEJ PHICHIT HOSPITAL::
 ขึ้นระบบเมื่อ 1 ตุลาคม 2552
SERVER :   Linux Centos 5.3 X86 64B IT Ram 4 G
BackUp1 :  Linux Centos 5.3 X86 64B IT Ram 4 G
BackUp2 :  Linux Centos 5.3 X86 64B IT Ram 2 G
HOSxP Version : 3.54.7.20
MySQL Version : 5.1.30
Client : Windows Xp & Windows Vista  30 เครื่อง
--