ผู้เขียน หัวข้อ: วิธีดึงคนไข้ที่ มีค่า Lab ที่น้อยกว่ากำหนด  (อ่าน 2578 ครั้ง)

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

ออฟไลน์ gweeped

  • Sr. Member
  • ****
  • กระทู้: 254
  • ขอบคุณทุกคน กับสังคมดีๆ ใน HosXP
  • Respect: +2
    • ดูรายละเอียด
    • TAKBAI HOSPITAL FANPAGE
คือจะดึงคนไข้ที่เป็นเบาหวานตรวจ 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
Nirafeeda Binnima
Systems Admin
Takbai Hospital
MASTER SERVER :
IBM System x3550 M4
CentOS 6.3
MySQL version 5.6.15-56
SLAVE SERVER :
HP Proliant DL160 Gen8
CentOS Linux 5.3
MySQL version 5.6.15-56
ขึ้นระบบโดย BMS TEAM ปี 47
เริ่มงานและเริ่มรู้จัก HosXP 1 กค. 2011

ออฟไลน์ เกื้อกูล ครับ..

  • Hero Member
  • *****
  • กระทู้: 12,611
  • Respect: +169
    • ดูรายละเอียด
    • โรงพยาบาลปากท่อ
Re: วิธีดึงคนไข้ที่ มีค่า Lab ที่น้อยกว่ากำหนด
« ตอบกลับ #1 เมื่อ: กรกฎาคม 04, 2012, 11:03:48 AM »
0
อืมระบบเก็บเป็น vachar(25) ครับ มิใช่ integer

ลองแก้เป็น

and lab_order_result < 7    and lab_order_result  is not null and lab_order_result <>""
« แก้ไขครั้งสุดท้าย: กรกฎาคม 04, 2012, 11:06:22 AM โดย เกื้อกูล ครับ.. »
Implement  HOSxP  Start 2548 ---> NOW!
Station : 130 Client   V.3 Version  3.67.1.XX
Server  : CENTOS  +MySQL maria 10.x.x