ผู้เขียน หัวข้อ: ขอรายงานหน่อยครับท่าน  (อ่าน 3773 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ โรงพยาบาลอัมพวา

  • Hero Member
  • *****
  • กระทู้: 654
  • Respect: 0
    • ดูรายละเอียด
ขอรายงานหน่อยครับท่าน
« เมื่อ: กันยายน 29, 2011, 14:30:34 PM »
0
ขอรายงานผู้ป่วยไม่มาตามนัด  เอาแบบมีที่อยู่ด้วย อ่ะครับ ตามที่มีอยู่ ในโปรแกรมแล้วอ่ะครับ เพิ่ม ที่อยู่
เอาเป็น คิวรี่ก็ได้นะครับ




select pt.hn,concat(pt.pname,pt.fname,'  ',pt.lname) as ptname,  c.name as clinic_name, o.doctor, d.name as doctor_name,
concat(pt.addrpart," ? ",pt.moopart," ?.",t3.name," ?.",t2.name," ?.",t1.name) as fulladdressname,
 o.hn,o.vstdate,o.nextdate,o.nexttime,o.note,o.vn,k.department,  count(v.hn) as visit_count
  from oapp o
  left outer join patient pt on pt.hn=o.hn
  left outer join clinic c on c.clinic=o.clinic
  left outer join doctor d on d.code=o.doctor
  left outer join kskdepartment k on k.depcode = o.depcode
  left outer join ovst v on v.vstdate=o.nextdate
  left outer join thaiaddress t1 on t1.chwpart=pt.chwpart and
     t1.amppart="00" and t1.tmbpart="00"
left outer join thaiaddress t2 on t2.chwpart=pt.chwpart and
     t2.amppart=pt.amppart and t2.tmbpart="00"
left outer join thaiaddress t3 on t3.chwpart=pt.chwpart and
     t3.amppart=pt.amppart and t3.tmbpart=pt.tmbpart
  and v.hn=o.hn  where o.nextdate between '2011-08-01'  and '2011-08-31'
  and o.hn not in (select hn from ovst
  where vstdate between  '2011-08-01' and '2011-08-31' )
  group by  o.oapp_id,pt.pname,pt.fname,pt.lname,c.name,o.doctor,d.name ,  o.hn,o.vstdate,o.nextdate,o.nexttime,o.note,o.vn,k.department
ผม ลองเขียนรัยได้แตที่อยู่ไม่ขึ้น
Admn โรงพยาบาลอัมพวา
ขึ้นระบบ 5 พ.ค. 50
อยากเก่งกับเค้ามั่งครับ
Tel.0868331387

ออฟไลน์ ไม่เสียสละ ชัยชนะไม่เกิด

  • Hero Member
  • *****
  • กระทู้: 1,267
  • Project Maneger
  • Respect: +2
    • ดูรายละเอียด
Re: ขอรายงานหน่อยครับท่าน
« ตอบกลับ #1 เมื่อ: กันยายน 29, 2011, 15:05:07 PM »
0
ทำไมมันรันนานมากเลยครับ
ทำไม่ได้ หรือไม่ได้ทำ
 Project Maneger
Bangkok Medical Software Co., Ltd.
2, 2nd Floor, Soi Suksawat 33,
Suksawat Road, Radburana 10140
Thailand

ออฟไลน์ เกื้อกูล ครับ..

  • Hero Member
  • *****
  • กระทู้: 12,611
  • Respect: +169
    • ดูรายละเอียด
    • โรงพยาบาลปากท่อ
Re: ขอรายงานหน่อยครับท่าน
« ตอบกลับ #2 เมื่อ: กันยายน 29, 2011, 15:11:22 PM »
0
ขอรายงานผู้ป่วยไม่มาตามนัด

ผมว่า แปลก ๆ นะ  ไม่มาตามนัด กับ ขาดนัด

เช่น นัด25 ก.ย. 54 แต่มาตรวจ 28 ต.ค 54 ก็ถือว่าไม่มาตามนัด  แต่จะใช้ o.hn not in xxxx-xx-xx and xxxx-xx-yy ไม่น่าจะได้ครับ...เพราะอาจมาตรวจก่อนหรือหลังวันนัดไม่เกิน 1-7 วัน และไม่ถือว่าขาดยา...

น่าจะต้องกำหนดเพิ่มเติมว่าเป็นรายงานขาดนัดเลยทีเดียว

ถ้าไม่มาตามนัด อาจต้องเป็น o.nextdate <> vstdate and vstdate > o.nextdate ประมาณนี้ครับ..หรือถ้ามาก่อนนัดสัก 3 วัน (เผื่อติดธุระ ) จะกลายเป็น vstdate < nextdate
ซึ่ีงต้องมี บวก/ลบ ของวันที่อนุโลมได้ว่าไม่ขาดยาและไม่ขาดนัด  คงต้องเพิมนิยาม  ไม่มาตามนัดเกิน 7 วัน จะได้ว่า( vstdate > nextdate และ>=7  day
Implement  HOSxP  Start 2548 ---> NOW!
Station : 130 Client   V.3 Version  3.67.1.XX
Server  : CENTOS  +MySQL maria 10.x.x

ออฟไลน์ niyomstd

  • Hero Member
  • *****
  • กระทู้: 1,270
  • Respect: +15
    • ดูรายละเอียด
    • โรงพยาบาลแม่เมาะ
Re: ขอรายงานหน่อยครับท่าน
« ตอบกลับ #3 เมื่อ: กันยายน 29, 2011, 15:16:15 PM »
0
ตาม อ.เกื้อ เลยครับ
ลองนำ sql นี้ไปทดสอบดูครับ

  select concat(p.pname,p.fname,'  ',p.lname) as ptname,p.informaddr,
c.name as clinic_name, o.doctor, d.name as doctor_name,
 o.hn,o.vstdate,o.nextdate,o.nexttime,o.note,o.vn,k.department
 from oapp o  left outer join patient p on p.hn=o.hn
 left outer join clinic c on c.clinic=o.clinic
 left outer join doctor d on d.code=o.doctor
 left outer join kskdepartment k on k.depcode = o.depcode
 left outer join ovst v on v.vstdate=o.nextdate and v.hn=o.hn
 where o.nextdate between '2011-09-29' and '2011-09-29'
  and o.hn not in (select hn from ovst where vstdate between  '2011-09-29' and '2011-09-29' )
  group by  o.oapp_id,p.pname,p.fname,p.lname,c.name,o.doctor,d.name ,
   o.hn,o.vstdate,o.nextdate,o.nexttime,o.note,o.vn,k.department
นิยม  สีทองแดง
โรงพยาบาลแม่เมาะ  ลำปาง(รพช.30 เตียง)
เริ่มใช้ HOSxP 2 เมษายน 2551
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Master :  CentOS

ออฟไลน์ woravet

  • Sr. Member
  • ****
  • กระทู้: 409
  • Respect: +12
    • ดูรายละเอียด
Re: ขอรายงานหน่อยครับท่าน
« ตอบกลับ #4 เมื่อ: กันยายน 29, 2011, 15:36:12 PM »
0
select a.hn,p.pname,p.fname,p.lname
,a.nextdate
,c.name as clinic,k.department,a.doctor, d.name as doctorname
,concat(p.addrpart,' ม.',p.moopart,' ',t.full_name) address
from oapp a
left join patient p on a.hn=p.hn
left join clinic c on c.clinic=a.clinic
left join doctor d on d.code=a.doctor
left join kskdepartment k on k.depcode = a.depcode
left join thaiaddress t on t.addressid=concat(p.chwpart,p.amppart,p.tmbpart)
where a.nextdate between '2011-9-1' and '2011-9-30'
and (a.patient_visit<>'Y' or a.patient_visit is null)
group by a.hn,a.nextdate
รพ.บึงสามัคคี จ.กำแพงเพชร
*********************
อ.สุชัยและคณะ ขึ้นระบบ 29 ตค.49(Linux+Fedara 5)
*********************
ปัจจุบัน
HOSxP version 3.53.4.27
Server:Windows XP SP2,MySQL 5
Client ประมาณ 15 เครื่อง