BMS-HOSxP Community
HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: malee_jung ที่ กรกฎาคม 07, 2008, 22:38:37 PM
-
- เนื่องจากทำระบบส่งน้ำเกลือที่
-
???
-
คำสั่งยอดการใช้น้ำเกลือของแต่ละตึก
select f.name as ward_name,b.name as iv_name,b.units,sum(a.qty)
from drugitems b
left outer join opitemrece a on a.icode=b.icode
left outer join ipt_order_no d on d.order_no=a.order_no
left outer join ward f on d.ward=f.ward
where b.drugcategory ="INTRAVENOUS SOLUTION"
and a.rxdate between'2008-06-05' and '2008-06-05'
and a.an <> "" and a.hn <>""
group by iv_name,ward_name,units
order by f.name , b.name
เนื่องจากลดปริมาณการสต๊อคน้ำเกลือที่ห้องจ่ายยาจึงทำรายงานยอดการใช้น้ำเกลือส่งจากคลังกำหนดให้ iv ที่จะส่ง เป็น drugcategory ="INTRAVENOUS SOLUTION"
1. ฝากพี่ พี่ดูโค๊ดให้หน่อยคะ test แล้วใช้ได้ แต่ทุกครั้งที่ดึงรายงาน โดน Admin ค้อนประจำว่าทำให้ระบบช้า แฮ่แฮ่
2. หน่วยงานที่ไม่ใช่ ward เช่น ผ่าตัด วิสัญญี ไตเทียม Er ก็อยากได้ระบบส่งน้ำเกลือ แต่เขาไม่ใช่ ward ไม่รู้จะผูกกับอะไรดี ช่วยแนะนำหน่อยคะ
3. กำลังคิดว่าจะเพิ่ม icode IV สำหรับแต่ละแผนก เช่น NSS(ER), NSS(anas)... เป็นต้น ไม่รู้ใช่ทางออกที่ถูกหรือเปล่า
4. ใน opitemrece มีช่อง depcode น่าจะใช้ได้เพราะแต่ละแผนกคีย์ IV เอง แต่ทำไมข้อมูล depcode ผู้ป่วยในมันไม่มีข้อมูลนะคะ
-
ห้องผ่าตัดใช้คำสั่งคล้ายๆ แบบนี้ครับ
select o.icode,count(o.qty)
from opitemrece o,operation_invent i, operation_list l
where o.hos_guid = i.opi_guid and i.operation_id = l.operation_id and l.operation_date between '2008-01-01' and '2008-01-31'
group by o.icode
ห้องวิสัญญีก็ใช้คำสั่งคล้ายๆ แบบนี้
select o.icode,count(o.qty)
from opitemrece o,operation_anes_invent i, operation_list l
where o.hos_guid = i.opi_guid and i.operation_id = l.operation_id and l.operation_date between '2008-01-01' and '2008-01-31'
group by o.icode
-
ขอบคุณนะคะอ.
แต่ว่ายังคงใช้งานไม่ได้เพราะ anas and OR คีย์ค่าใช้จ่ายเรื่องยาผ่าน drug profie คะ
operation_invent จึงไม่มีข้อมูล
จะลองศึกษาระบบ anas และ OR ก่อนและจะมาถามอ.อีกรอบนะคะ