SELECT
DATE_FORMAT(date(a.LREQ_DT),'%Y%m%d') as date_serv,DATE_FORMAT(time(a.LREQ_DT),'%h:%i:%s') as time_serv
,b.LAB_GROUP as labgroup,b.LAB_NAME as lab_name
,replace(replace(SUBSTR(a.LAB_RESULT, LOCATE('=', a.LAB_RESULT)+1),char(13),''),char(10),'') as lab_result
, '' as unit, b.normal_val as standard_result
FROM lab_requests a
INNER JOIN lab_lists b ON a.LAB_ID = b.LAB_ID AND b.IS_CANCEL =0
WHERE a.VISIT_ID in('0002250317','0002250318','0002262813','0002255663')
AND a.is_cancel = 0
AND b.is_secret = 0
####ดึงคู่กับ Mbase####
SELECT
DATE_FORMAT(date(a.LREQ_DT),'%Y%m%d') as date_serv,DATE_FORMAT(time(a.LREQ_DT),'%h:%i:%s') as time_serv
, s.pid, b.LAB_NAME as lab_name
,replace(replace(SUBSTR(a.LAB_RESULT, LOCATE('=', a.LAB_RESULT)+1),char(13),''),char(10),'') as lab_result
, b.normal_val as standard_result
FROM lab_requests a
INNER JOIN lab_lists b ON a.LAB_ID = b.LAB_ID AND b.IS_CANCEL =0
INNER JOIN service s ON s.seq = a.visit_id AND s.date_serv >='2016-05-01'
WHERE -- a.LREQ_DT >= '2015.01.01 00:00'
s.pid in ('026432')
AND a.is_cancel = 0
AND b.is_secret = 0
ไม่มีความคิดเห็น:
แสดงความคิดเห็น