BMS-HOSxP Community
HOSxP => Report Exchange => ข้อความที่เริ่มโดย: fast2525 ที่ กุมภาพันธ์ 04, 2009, 11:27:37 AM
-
รบกวนผู้รู้อยากได้รายงานสถิติการให้บริการผู้ป่วยนอกผู้ป่วยใน ตามรูปตัวอย่างนะค่ะค้องเขียนอย่างงัยคะ
-
http://hosxp.net/index.php?option=com_smf&Itemid=28&topic=8853.msg50568#new
-
อยากได้รายงาน สถิติการให้บริการผู้ป่วยใน สิทธิผู้ป่วยเป็นสิทธิผู้พิการที่ขึ้นต้นด้วย ท74 นะคะ ต้องเพิ่มโค้ดตรงไหนค่ะ
set @t1 = unix_timestamp('2008-10-01');
set @t2 = unix_timestamp('2009-09-30');
select "IPD" as type, year(regdate)+543 year, case month(regdate)
when '1' then 'ม.ค.'
when '2' then 'ก.พ.'
when '3' then 'มี.ค.'
when '4' then 'เม.ย.'
when '5' then 'พ.ค.'
when '6' then 'มิ.ย.'
when '7' then 'ก.ค.'
when '8' then 'ส.ค.'
when '9' then 'ก.ย.'
when '10' then 'ต.ค.'
when '11' then 'พ.ย.'
when '12' then 'ธ.ค.'
end as month, count(distinct hn) as count_hn , count(an) as count
from an_stat
where unix_timestamp(regdate) between @t1 and @t2
group by year(regdate), month(regdate)
-
ลองแนบตัว report ขึ้นมาด้วยครับ ;D ;D
-
อันนี้เป็นเลือกคนไข้ทั้งหมดที่มานอนเตียงค่ะ แต่ต้องการแค่คนไข้ที่ใช้สิทธิ ท74 แล้วมานอนเตียงเท่านั้นต้องแก้หรือเพิ่มโค้ดตรงไหนบ้างคะ
-
ลองเขียนอีกแบบ ใช้ variable ช่วยทดสอบด้วยครับ
(เขียนเสร็จยังไม่ได้ test เลย ;D ;D)
-
ทดสอบแล้วคะใช้ไม่ได้ค่ะ error
-
ทดสอบแล้วคะใช้ไม่ได้ค่ะ error
error อย่างไรครับ ลอง post ภาพที่ error ดูหน่อยครับ ผมลองดูก็ไม่ error นะครับ
ส่วนการเพิ่ม code ก็เพิ่มตามนี้ครับ
set @t1 = unix_timestamp('2008-10-01');
set @t2 = unix_timestamp('2009-09-30');
select "IPD" as type, year(regdate)+543 year, case month(regdate)
when '1' then 'ม.ค.'
when '2' then 'ก.พ.'
when '3' then 'มี.ค.'
when '4' then 'เม.ย.'
when '5' then 'พ.ค.'
when '6' then 'มิ.ย.'
when '7' then 'ก.ค.'
when '8' then 'ส.ค.'
when '9' then 'ก.ย.'
when '10' then 'ต.ค.'
when '11' then 'พ.ย.'
when '12' then 'ธ.ค.'
end as month, count(distinct hn) as count_hn , count(an) as count
from an_stat
where unix_timestamp(regdate) between @t1 and @t2
and pttypeno like "ท74%"
group by year(regdate), month(regdate)
-
ขอบคุณพี่ pop_hosxp ที่ช่วยทดสอบครับ ;D ;D
จากการทดสอบผมว่าตัวรายงานก็ค่อนข้าง OK นะครับ ยังไงรบกวน post ภาพ error ที่เกิดขึ้นกับการดึงรายงานด้วยครับ ขอบคุณครับ ::) ::)
-
น่าจะแก้ไข เป็น pcode= "AD" แทน pttypeno=".74%" นะครับ เพราะความหมายของผลการดำเนินงานจริงไม่น่าจะอยู่ที่เลขบัตร เนื่องจากบัตรทองมีหลายเวอร์ชัน แต่ pcode จะชัดเจนกว่าครับ
-
ขอบคุณมากคะทำได้แล้วคะ..อิอิ..
-
น่าจะแก้ไข เป็น pcode= "AD" แทน pttypeno=".74%" นะครับ เพราะความหมายของผลการดำเนินงานจริงไม่น่าจะอยู่ที่เลขบัตร เนื่องจากบัตรทองมีหลายเวอร์ชัน แต่ pcode จะชัดเจนกว่าครับ
จะลองแก้ตามพี่เกื้อแนะนำ แล้วจะนำมาแปะไว้ที่ rep นี้ครับ