BMS-HOSxP Community

HOSxP => Report Exchange => ข้อความที่เริ่มโดย: gweeped ที่ มิถุนายน 01, 2012, 08:24:44 AM

หัวข้อ: แจกครั้งแรก รายงานชื่อผู้ป่วยอุบัติเหตุจราจร
เริ่มหัวข้อโดย: gweeped ที่ มิถุนายน 01, 2012, 08:24:44 AM
พอดีวันนี้ Er มาขอ สถิติ ที่ สสจ. อยากได้เอาไปทำ แบบประเมิณตนเองด้านการขับขี่ปลอดภัย
เลยดึงข้อมูลดิบให้ บอกเอาไปแยกเอง หุหุ

(http://upic.me/i/yj/sdvsdvdsv.png) (http://upic.me/show/36219449)
หัวข้อ: Re: แจกครั้งแรก รายงานชื่อผู้ป่วยอุบัติเหตุจราจร
เริ่มหัวข้อโดย: Multithreading ที่ มิถุนายน 01, 2012, 08:59:19 AM
มี sql ดิบมั้ยครับ
หัวข้อ: Re: แจกครั้งแรก รายงานชื่อผู้ป่วยอุบัติเหตุจราจร
เริ่มหัวข้อโดย: gweeped ที่ มิถุนายน 01, 2012, 09:13:48 AM
มี sql ดิบมั้ยครับ

select pt.hn,concat(pt.pname,pt.fname,'  ',pt.lname) as ptname ,ov.vstdate, pt.cid  , pt.occupation , ovst.vsttime , er.er_dch_type , ov.age_y , er.er_emergency_type , er.vn
from vn_stat ov ,patient pt ,ovst ovst ,er_regist er , er_nursing_detail dl
where  ov.vn=ovst.vn and pt.hn=ov.hn and er.vn=ov.vn and  dl.vn=ov.vn
and ov.vstdate between "2011-01-01" and  "2011-12-31"
and ov.hn=pt.hn
and er.er_pt_type = "2"
 and ( (ov.pdx >= "v00" and ov.pdx <= "v99")
 or (ov.dx0 >= "v00" and ov.dx0 <= "v99")
 or (ov.dx1 >= "v00" and ov.dx1 <= "v99")
 or (ov.dx2 >= "v00" and ov.dx2 <= "v99")
 or (ov.dx3 >= "v00" and ov.dx3 <= "v99")
 or (ov.dx4 >= "v00" and ov.dx4 <= "v99")
 or (ov.dx5 >= "v00" and ov.dx5 <= "v99") )
and ( er.er_emergency_type = "1"
or er.er_emergency_type = "2"
or er.er_dch_type = "4")

group by pt.hn
order by  er.vstdate