BMS-HOSxP Community

HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: Bluebird ที่ มกราคม 26, 2011, 14:44:46 PM

หัวข้อ: ระยะเวลาให้บริการ OPD ในเวลาราชการ ไม่รวม ผู้ป่วยที่สั่ง LAB
เริ่มหัวข้อโดย: Bluebird ที่ มกราคม 26, 2011, 14:44:46 PM
select a.vstdate,a.vn,a.hn,concat(pname,fname,"    ",lname) as ptname,
a.vsttime as begintime,
a.service4 as screen,
sec_to_time(time_to_sec(a.service4)-time_to_sec(a.vsttime)) as watingtimescreen,
a.service11 as screentime,
sec_to_time(time_to_sec(a.service11)-time_to_sec(a.service4)) as timescreen,
a.service5 as doctortime,
sec_to_time(time_to_sec(a.service5)-time_to_sec(a.service11)) as waitingdoctortime,
a.service12 as doctorendtime,
sec_to_time(time_to_sec(a.service12)-time_to_sec(a.service5)) as doctorwatingtime,
a.service6 as jadya,
sec_to_time(time_to_sec(a.service6)-time_to_sec(a.service12)) as jadyawatingtime,
sec_to_time(time_to_sec(a.service6)-time_to_sec(a.vsttime)) as watingtime
from service_time a
left outer join patient b on a.hn=b.hn
left outer join ovst o on o.vn=a.vn
where a.vstdate between'2010-07-01'and'2010-07-01'
and o.visit_type="I"


จากคำสั่งข้างต้นฝากช่วยแก้ โดยเพิ่มเงื่อนไข ไม่รวมผู้ป่วยที่สั่ง LAB
หัวข้อ: Re: ระยะเวลาให้บริการ OPD ในเวลาราชการ ไม่รวม ผู้ป่วยที่สั่ง LAB
เริ่มหัวข้อโดย: golf_win ที่ มกราคม 26, 2011, 15:54:19 PM
กำหนดเงื่อนไข vn not in (select vn from lab_head where order_date between'2010-07-01'and'2010-07-01')
หัวข้อ: Re: ระยะเวลาให้บริการ OPD ในเวลาราชการ ไม่รวม ผู้ป่วยที่สั่ง LAB
เริ่มหัวข้อโดย: เกื้อกูล ครับ.. ที่ มกราคม 26, 2011, 20:41:05 PM
ไม่ค่อยเห็นด้วยทั้งหมดครับ...สั่ง lab เช่น HCT  stat ก็ไม่กินเวลามากครับ..หรือ Pregtest strip ก็แป๋บเดียว..ไม่น่าตัดทุก vn ที่สั่ง lab
หัวข้อ: Re: ระยะเวลาให้บริการ OPD ในเวลาราชการ ไม่รวม ผู้ป่วยที่สั่ง LAB
เริ่มหัวข้อโดย: เกื้อกูล ครับ.. ที่ มกราคม 27, 2011, 08:38:27 AM
ตามกระทู้