BMS-HOSxP Community
HOSxP => Report Exchange => ข้อความที่เริ่มโดย: Zulkiflee ที่ เมษายน 23, 2012, 11:12:22 AM
-
คุณหมออยากได้รายงานเกี่ยวการสั่งยาใน1ใบสั่งยาแล้วมียาในกลุ่ม N-Said ซ้ำกัน ซึ่งยาในกลุ่มนี้จะประกอบด้วย
1.diclofenac tab 2.ibuprofen 200mg 3.ibuprofen 400 mg 4.indomethanacin cap 5.mefenamic acid cap
6.naproxen tab 7.celecoxib cap 8.etoricoxib(arcoxia)tab 9.froctafenine tab 10.aspirin 81 mg
11.aspirin 300 mg 12.diclofenac inj 13.nabumetone tab 14.parecoxib
ถ้ามียาใน 14 ข้อนี้ ในใบสังยาเดียวกันคือซ้ำกัน เช่น มี dicolfenac แล้วก็มี aspirin 300 mg ถือว่าซ้ำกัน ใน 1000 ใบสั่งยาล่าสุด มีกี่ใบที่มียาในกลุ่มนี้มากว่า 1 รายการ
ช่วยหน่อยน่ะครับ พี่ๆน้องๆ hosxp
-
ต้องหา icode ของยาในกลุ่ม n-said มาก่อนแล้วค่อยรัน sql ดังนี้
select o.hn,o.vn,sum(icode in (
'icode 1.diclofenac tab',
'icode 2.ibuprofen 200mg',
'icode 3.ibuprofen 400 mg',
'icode 4.indomethanacin cap',
'icode 5.mefenamic acid cap',
'icode 6.naproxen tab',
'icode 7.celecoxib cap',
'icode 8.etoricoxib(arcoxia)tab',
'icode 9.froctafenine tab',
'icode 10.aspirin 81 mg',
'icode 11.aspirin 300 mg',
'icode 12.diclofenac inj',
'icode 13.nabumetone tab',
'icode 14.parecoxib')) as `n-said`
from opitemrece o
where o.vstdate between '2011-10-01' and '2012-03-31' and o.vn is not null
group by o.hn,o.vn
having `n-said`>1
order by o.hn,o.vn desc
หรือ
กำหนดใน ทะเบียนเวชภัณฑ์ของยาว่าอยู่ใน category 'n-said' ซึ่งย่อมาจาก 'NON-STEROIDAL ANTI-INFLAMMATORIES'
select o.hn,o.vn,sum(icode in (select d.icode from drugitems d where d.drugcategory like '%NON-STEROIDAL ANTI-INFLAMMATORIES%')) as `n-said`
from opitemrece o
where o.vstdate between '2011-10-01' and '2012-03-31' and o.vn is not null
group by o.hn,o.vn
having `n-said`>1
order by o.hn,o.vn desc
[/quot]