HbA1C รหัสตัวนี้ nd.nhso_adp_code in ('32401') ขาดไปในคิวรี่ มีแค่ วันที่ 9เดือน 12 ส่วนวันที่ 22 และ 27 ยังไม่มีน๊ะครับ รบกวนปรับด่วนน๊ะครับ
(SELECT concat(li.lab_items_name,':',lo.lab_order_result,' (',lh.report_date,')')
FROM lab_head lh
INNER JOIN ovst o on o.vn = lh.vn
INNER JOIN lab_order lo ON lo.lab_order_number = lh.lab_order_number
INNER JOIN lab_items li ON li.lab_items_code = lo.lab_items_code
INNER join nondrugitems nd on nd.icode = li.icode
WHERE lh.hn = '000077635'
and lh.report_date between '2022-12-19' and '2022-12-26'
and nd.nhso_adp_code in ('32401')
and lh.confirm_report='Y'
order by lh.report_date desc limit 1)
union
(SELECT concat(li.lab_items_name,':',lo.lab_order_result,' (',lh.report_date,')')
FROM lab_head lh
INNER JOIN ovst o on o.vn = lh.vn
INNER JOIN lab_order lo ON lo.lab_order_number = lh.lab_order_number
INNER JOIN lab_items li ON li.lab_items_code = lo.lab_items_code
INNER join nondrugitems nd on nd.icode = li.icode
WHERE lh.hn = '000077635'
and lh.report_date between '2022-12-19' and '2022-12-26'
and nd.nhso_adp_code in ('32202')
and lh.confirm_report='Y'
order by lh.report_date desc limit 1 )
union
(SELECT concat(li.lab_items_name,':',lo.lab_order_result,' (',lh.report_date,')')
FROM lab_head lh
INNER JOIN ovst o on o.vn = lh.vn
INNER JOIN lab_order lo ON lo.lab_order_number = lh.lab_order_number
INNER JOIN lab_items li ON li.lab_items_code = lo.lab_items_code
INNER join nondrugitems nd on nd.icode = li.icode
WHERE lh.hn = '000077635'
and lh.report_date between '2022-12-19' and '2022-12-26'
and nd.nhso_adp_code in ('32103')
and lh.confirm_report='Y'
order by lh.report_date desc limit 1 )