select d1.*,v1.*,o1.*,s.*,t.blobtext,t.blobtext2,pe.image1,ic1.name as diag_name0,ic2.name as diag_name1,ic3.name as diag_name2,ic4.name as diag_name3,o.nextdate,o.nexttime,o.app_user,o.app_cause,o1.command_doctor,concat("รับคำสั่ง",doc.name) as commname
from doctor_order_print d1
left outer join vn_stat v1 on v1.vn=d1.vn
left outer join ovst o1 on o1.vn=d1.vn
left outer join doctor doc on doc.code=o1.command_doctor
left outer join opdscreen s on s.vn = d1.vn
left outer join pe_image pe on pe.vn=d1.vn
left outer join oapp o on o.vn=d1.vn
left outer join oapp ap on ap.vn=d1.vn
left outer join tempreport t on t.name=d1.vn and t.reportname="DOCTOR-FORM"
left outer join icd101 ic1 on ic1.code = v1.dx0
left outer join icd101 ic2 on ic2.code = v1.dx1
left outer join icd101 ic3 on ic3.code = v1.dx2
left outer join icd101 ic4 on ic4.code = v1.dx3
where d1.vn="490618121204" and d1.print_server="MANOI-NOTEBOOK"