BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: @_MY_NAME_IS_AM_@ ที่ เมษายน 06, 2013, 10:03:56 AM

หัวข้อ: ผมคิด code sql ไ่ม่ทราบว่าถูกต้องหรือไม่ครับ
เริ่มหัวข้อโดย: @_MY_NAME_IS_AM_@ ที่ เมษายน 06, 2013, 10:03:56 AM
ผมจะสุ่มหาเวลาทั้งหมด 100 คน ที่มารับบริการ ลบด้วยเวลาที่แพทย์ตรวจ ในเวลาราชการครับ
ผมไปดูฟิลด์เวลาผมก็งงๆ
ตามที่ผมเข้าใจ

service5 = แพทย์เริ่มตรวจ
service7 = เวลาที่การเงินเก็บเงิน (จะมีปัญหาไหมครับ ถ้าเป็นคนที่ใช้สิทธิแล้วไม่ได้ปริ๊นใบเสร็จ)
service12 = แพทย์ตรวจเสร็จ

ผมเข้าใจถูกไหมครับ รบกวนพี่ๆด้วยครับผม

select s.hn, s.vstdate, s.vsttime, s.service7 as Endtime,s.service5 as DoctorExam,s.service12 as DoctorExamFinish,
sec_to_time(time_to_sec(service7)-time_to_sec(vsttime)) as Totaltime,
sec_to_time(time_to_sec(service12)-time_to_sec(service5)) as doctor2finishdoctor,
sec_to_time((time_to_sec(service7)-time_to_sec(vsttime)) - (time_to_sec(service12)-time_to_sec(service5))) as TotaltimeFinished
from service_time s
where s.vstdate between '2013-04-04' and '2013-04-04'
and vsttime between '08:00:00' and '16:00:00'
and service7 is not null
and (time_to_sec(service12)-time_to_sec(service5)) is not null
order by rand()
limit 100
หัวข้อ: Re: ผมคิด code sql ไ่ม่ทราบว่าถูกต้องหรือไม่ครับ
เริ่มหัวข้อโดย: mashimaro ที่ เมษายน 08, 2013, 12:16:49 PM
ผมจะสุ่มหาเวลาทั้งหมด 100 คน ที่มารับบริการ ลบด้วยเวลาที่แพทย์ตรวจ ในเวลาราชการครับ
ผมไปดูฟิลด์เวลาผมก็งงๆ
ตามที่ผมเข้าใจ

service5 = แพทย์เริ่มตรวจ
service7 = เวลาที่การเงินเก็บเงิน (จะมีปัญหาไหมครับ ถ้าเป็นคนที่ใช้สิทธิแล้วไม่ได้ปริ๊นใบเสร็จ)
service12 = แพทย์ตรวจเสร็จ

ผมเข้าใจถูกไหมครับ รบกวนพี่ๆด้วยครับผม

select s.hn, s.vstdate, s.vsttime, s.service7 as Endtime,s.service5 as DoctorExam,s.service12 as DoctorExamFinish,
sec_to_time(time_to_sec(service7)-time_to_sec(vsttime)) as Totaltime,
sec_to_time(time_to_sec(service12)-time_to_sec(service5)) as doctor2finishdoctor,
sec_to_time((time_to_sec(service7)-time_to_sec(vsttime)) - (time_to_sec(service12)-time_to_sec(service5))) as TotaltimeFinished
from service_time s
where s.vstdate between '2013-04-04' and '2013-04-04'
and vsttime between '08:00:00' and '16:00:00'
and service7 is not null
and (time_to_sec(service12)-time_to_sec(service5)) is not null
order by rand()
limit 100


ใช้สิทธิ์แล้วไม่เรียกเก็บเงินจึงไม่พิมพ์ใบเสร็จ อาจจะเข้าเงื่อนไขนี้น่ะครับ คนไข้ไม่มารับยาแล้วไม่พิมพ์ใบเสร็จรับเงินครับ ตรวจสอบได้จาก Print Field ตาราง opitemrece ครับ
หัวข้อ: Re: ผมคิด code sql ไ่ม่ทราบว่าถูกต้องหรือไม่ครับ
เริ่มหัวข้อโดย: @_MY_NAME_IS_AM_@ ที่ เมษายน 10, 2013, 12:10:50 PM
ผมจะสุ่มหาเวลาทั้งหมด 100 คน ที่มารับบริการ ลบด้วยเวลาที่แพทย์ตรวจ ในเวลาราชการครับ
ผมไปดูฟิลด์เวลาผมก็งงๆ
ตามที่ผมเข้าใจ

service5 = แพทย์เริ่มตรวจ
service7 = เวลาที่การเงินเก็บเงิน (จะมีปัญหาไหมครับ ถ้าเป็นคนที่ใช้สิทธิแล้วไม่ได้ปริ๊นใบเสร็จ)
service12 = แพทย์ตรวจเสร็จ

ผมเข้าใจถูกไหมครับ รบกวนพี่ๆด้วยครับผม

select s.hn, s.vstdate, s.vsttime, s.service7 as Endtime,s.service5 as DoctorExam,s.service12 as DoctorExamFinish,
sec_to_time(time_to_sec(service7)-time_to_sec(vsttime)) as Totaltime,
sec_to_time(time_to_sec(service12)-time_to_sec(service5)) as doctor2finishdoctor,
sec_to_time((time_to_sec(service7)-time_to_sec(vsttime)) - (time_to_sec(service12)-time_to_sec(service5))) as TotaltimeFinished
from service_time s
where s.vstdate between '2013-04-04' and '2013-04-04'
and vsttime between '08:00:00' and '16:00:00'
and service7 is not null
and (time_to_sec(service12)-time_to_sec(service5)) is not null
order by rand()
limit 100


ใช้สิทธิ์แล้วไม่เรียกเก็บเงินจึงไม่พิมพ์ใบเสร็จ อาจจะเข้าเงื่อนไขนี้น่ะครับ คนไข้ไม่มารับยาแล้วไม่พิมพ์ใบเสร็จรับเงินครับ ตรวจสอบได้จาก Print Field ตาราง opitemrece ครับ

ฉะนั้น แล้ว ผมจะต้องทำ อย่างไรที่ข้อมูลจะสมบูรณ์ ที่สุดครับ ผมเห็นบางท่านก็ใช้เป็น service6 ตอนสุดท้ายน่ะครับ แล้ว service6 คือจุดบริการอะไรครับ รบกวนด้วยครับ