BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: SV_Phichit ที่ สิงหาคม 01, 2010, 12:15:11 PM

หัวข้อ: รบกวนด้วยครับแก้ไขอย่างไรครับ
เริ่มหัวข้อโดย: SV_Phichit ที่ สิงหาคม 01, 2010, 12:15:11 PM
รบกวนด้วยครับแก้ไขอย่างไรครับ
จะแทรก ขนาดฟิล์มที่ใช้กับคนไข้นะครับ

select staff,x.xn,x.hn,x.request_date,x.request_time,x.report_date,x.report_time,x.doctor,x.xray_type,
concat(p.pname," ",p.fname,"  ",p.lname) as ptname ,  d.name as doctor_name  ,
d2.name as request_doctor_name ,  t.name as xray_type_name ,x.vn,x.an  ,v.age_y,
 xi.* , rx.xn as real_xn
 from xray_report x
 left outer join patient p on p.hn=x.hn
 left outer join doctor d on d.code=x.doctor
 left outer join doctor d2 on d2.code=x.request_doctor
 left outer join xray_type t on t.xray_type = x.xray_type
 left outer join xray_items xi on xi.xray_items_code=x.xray_items_code
 left outer join vn_stat v on v.vn=x.vn
 left outer join xrayxn rx on rx.hn=x.hn

 and rx.regdate between "2010-07-31" and "2010-07-31"
 where ( x.request_date between "2010-07-31" and "2010-07-31")
 and x.xray_items_code not in (0)
 and (x.confirm="Y")
หัวข้อ: Re: รบกวนด้วยครับแก้ไขอย่างไรครับ
เริ่มหัวข้อโดย: Khuad ที่ สิงหาคม 01, 2010, 23:48:21 PM
select staff,x.xn,x.hn,x.request_date,x.request_time,x.report_date,x.report_time,x.doctor,x.xray_type,
concat(p.pname," ",p.fname,"  ",p.lname) as ptname ,  d.name as doctor_name  ,
d2.name as request_doctor_name ,  t.name as xray_type_name ,x.vn,x.an  ,v.age_y,
xi.* , rx.xn as real_xn

,xf.film_name as "ขนาด Film ที่ใช้",xrf.qty as "จำนวน Film ที่ใช้",xd.damage_name as "สาเหตุ กรณี Film เสีย"

from xray_report x
left outer join patient p on p.hn=x.hn
left outer join doctor d on d.code=x.doctor
left outer join doctor d2 on d2.code=x.request_doctor
left outer join xray_type t on t.xray_type = x.xray_type
left outer join xray_items xi on xi.xray_items_code=x.xray_items_code
left outer join vn_stat v on v.vn=x.vn

left outer join xray_report_film xrf on xrf.xn = x.xn
left outer join xray_film xf on xf.film_id = xrf.film_id
left outer join xray_damage xd on xd.damage_id = xrf.damage_id

left outer join xrayxn rx on rx.hn=x.hn

and rx.regdate between "2008-01-11" and "2008-01-11"
where ( x.request_date between "2008-01-11" and "2008-01-11")
and x.xray_items_code not in (0)
and (x.confirm="Y")

... น่าจะพอใช้ได้นะครับ ...  :D ...