BMS-HOSxP Community
HOSxP => Report Exchange => ข้อความที่เริ่มโดย: jeab101 ที่ ตุลาคม 29, 2009, 21:39:38 PM
-
ผมต้องการหารายชื่อคนไข้ที่ "ได้รับคำแนะนำให้เลิกสูบบุหรี่"
ซึ่งผมได้เพิ่ม item ดังกล่าวไว้ที่ รายการค่ารักษาพยาบาล รหัส icode='3900200'
ซึ่งผมได้ตามค้นหาปรากฏว่ามีข้อมูลบันทึกไว้ที่ตาราง "opitemrece_summary"
...ปัญหาคือ ในตารางดังกล่าวไม่มีฟิลด์ ที่ระบุตัวคนไข้เลยครับ เช่น HN ,ชื่อ-สกุล
ท่านเทพทั้งหลายโปรดช่วยแนะนำด้วยครับ ต้องเขียนคำสั่งว่ายังไงครับ
เพื่อให้ได้ HN ,ชื่อ-สกุล,วันที่มารับบริการ, ตามรหัส icode ดังกล่าว
ขอบคุณมากครับ
-
opitemrece น่าจะมีนะครับ hn
-
select o.hn,concat(p.pname,p.fname,' ',p.lname) as name,o.vstdate,o.icode from opitemrece o
left outer join patient p on p.hn =o.hn
where o.icode ="3900200" and o.vstdate between "2009-01-01" and "2009-01-31"
order by o.vstdate
-
select o.hn,concat(p.pname,p.fname,' ',p.lname) as name,o.vstdate,o.icode from opitemrece o
left outer join patient p on p.hn =o.hn
where o.icode ="3900200" and o.vstdate between "2009-01-01" and "2009-01-31"
order by o.vstdate
...ขอบคุณมากครับ...ได้เต็มๆเลย
-
select o.hn,concat(p.pname,p.fname,' ',p.lname) as name,o.vstdate,o.icode from opitemrece o
left outer join patient p on p.hn =o.hn
where o.icode ="3900200" and o.vstdate between "2009-01-01" and "2009-01-31"
order by o.vstdate
...ขอบคุณมากครับ...ได้เต็มๆเลย
ดีใจด้วยครับ
:)