BMS-HOSxP Community

HOSxP => Report Exchange => ข้อความที่เริ่มโดย: gweeped ที่ กรกฎาคม 04, 2012, 10:56:41 AM

หัวข้อ: วิธีดึงคนไข้ที่ มีค่า Lab ที่น้อยกว่ากำหนด
เริ่มหัวข้อโดย: gweeped ที่ กรกฎาคม 04, 2012, 10:56:41 AM
คือจะดึงคนไข้ที่เป็นเบาหวานตรวจ HbA1c ที่มีผลน้อยกว่า 7
แต่เขียนโค๊ดแบบนี้ไป ทำไมผลที่มีค่า มากกว่า 7 ถึงออกมาด้วยคะ

โค๊ด: [Select]
select pt.hn,ov.pdx  , lo.lab_order_result
from  vn_stat ov, ovst ovst, patient pt  ,lab_head lh   , lab_order lo
where  ov.vn=ovst.vn and pt.hn=ov.hn
and ov.vn= lh.vn    and   lh.lab_order_number =   lo.lab_order_number
and ov.vstdate between "2011-10-01" and  "2012-06-30"
and lo.lab_items_code = '48'
and lo.lab_order_result < '7'
 and ( (ov.pdx >= "e100" and ov.pdx <= "e149")
 or (ov.dx0 >= "e100" and ov.dx0 <= "e149")
 or (ov.dx1 >= "e100" and ov.dx1 <= "e149")
 or (ov.dx2 >= "e100" and ov.dx2 <= "e149")
 or (ov.dx3 >= "e100" and ov.dx3 <= "e149")
 or (ov.dx4 >= "e100" and ov.dx4 <= "e149")
 or (ov.dx5 >= "e100" and ov.dx5 <= "e149") )

group by pt.hn
หัวข้อ: Re: วิธีดึงคนไข้ที่ มีค่า Lab ที่น้อยกว่ากำหนด
เริ่มหัวข้อโดย: เกื้อกูล ครับ.. ที่ กรกฎาคม 04, 2012, 11:03:48 AM
อืมระบบเก็บเป็น vachar(25) ครับ มิใช่ integer

ลองแก้เป็น

and lab_order_result < 7    and lab_order_result  is not null and lab_order_result <>""