BMS-HOSxP Community
HOSxP => Report Exchange => ข้อความที่เริ่มโดย: gu_prajag ที่ ตุลาคม 31, 2013, 17:00:39 PM
-
หน้าตารายงานตามรูปที่แนบมาครับ
หรือไม่ก็ มีคำสั่ง Sql ที่คล้ายกันก็ได้ครับ ที่เหลือผมจะไปหาเพิ่มเติมมาใส่เอง
ปัญหาคือ หาบางตัวไม่เจอหรือไม่ทราบเก็บที่ตารางใด..
รบกวนพี่ด้วยครับ
-
:)
-
select concat(p.fname,' ',p.lname) as full_namea,age_y,ip.g,a.hn,i.an,p.cid,a.regdate,a.pdx,i.icd10
from iptdiag i
left outer join an_stat a on a.an=i.an
left outer join ipt_labour ip on ip.an=i.an
left outer join patient p on p.hn=i.hn
where a.pdx='o800' and i.icd10='o800'
order by a.an desc limit 100
หรือ
select concat(p.fname,' ',p.lname) as full_namea,age_y,ip.g,a.hn,i.an,p.cid,a.regdate,a.pdx,i.icd10
from an_stat a
left outer join iptdiag i on i.an=a.an
left outer join ipt_labour ip on ip.an=i.an
left outer join patient p on p.hn=i.hn
where a.pdx='o800' and i.icd10='o800'
order by a.an desc limit 100
ได้ผลเหมือนกัน...คงได้ประมาณครึ่งนึงแล้ว แต่ไม่รู้ว่าถูกหรือเปล่า
คือสนใจเฉพาะรายที่มาคลอด เช่น ผู้ป่วยมาปวดท้องจะคลอด แต่ไม่คลอด ครั้งนั้น..เคสนี้ไม่นับ
ที่เหลือก็งมต่อไป
-
select concat(p.fname,' ',p.lname) as full_namea,age_y,ip.g,a.hn,a.an,p.cid,a.regdate,a.pdx,ic.name
from an_stat a
left outer join ipt_labour ip on ip.an=a.an
left outer join icd101 ic on ic.code=a.pdx
left outer join patient p on p.hn=a.hn
where a.pdx like 'o80%'
order by a.an desc limit 100
อันนี้น่าจะโอเค กว่า..ที่เหลือก็งมต่อไป
-
select concat(pt.pname,pt.fname,' ',pt.lname) ptname
,timestampdiff(year,pt.birthday,now()) age,anc.ga,s.hn,s.an,pt.cid
,s.service_date,if(s.an is null,v.pdx,a.pdx) pdx,icdname(if(s.an is null,v.pdx,a.pdx)) disease
,o.health_med_operation_item_name
from health_med_service s
left join patient pt on pt.hn=s.hn
left join person p on p.cid=pt.cid
left join person_anc anc on p.person_id=anc.person_id
left join vn_stat v on s.vn=v.vn
left join an_stat a on s.an=a.an
left join health_med_service_operation so on so.health_med_service_id=s.health_med_service_id
left join health_med_operation_item o on o.health_med_operation_item_id=so.health_med_operation_item_id
where s.service_date between '2013-6-1' and '2013-6-30'
and o.health_med_operation_item_name regexp 'หลังคลอด'
order by s.hn,s.service_date
แบบนี้หล่ะ....พอดีไม่มีข้อมูลทดสอบ
-
ขอบคุณมากครับ
มันคืออะไรครับ ตรงประโยค
icdname(if(s.an is null,v.pdx,a.pdx)) disease
พอดีมันฟ้อง error ตรงนี้พอดี
SQL Error: Function hos.icdname does not exist
-
select concat(pt.pname,pt.fname,' ',pt.lname) ptname
,timestampdiff(year,pt.birthday,now()) age,anc.ga,s.hn,s.an,pt.cid
,s.service_date,if(s.an is null,v.pdx,a.pdx) pdx
,o.health_med_operation_item_name
from health_med_service s
left join patient pt on pt.hn=s.hn
left join person p on p.cid=pt.cid
left join person_anc anc on p.person_id=anc.person_id
left join vn_stat v on s.vn=v.vn
left join an_stat a on s.an=a.an
left join health_med_service_operation so on so.health_med_service_id=s.health_med_service_id
left join health_med_operation_item o on o.health_med_operation_item_id=so.health_med_operation_item_id
where s.service_date between '2013-6-1' and '2013-6-30'
and o.health_med_operation_item_name regexp 'ËÅѤÅÍ´'
order by s.hn,s.service_date
ลองตัดเอาออก แบบนี้ครับ
-
icdname() เป็น Stored Function แสดงชื่อโรคที่ผมสร้างขึ้น
เพราะถ้า join ตรงกับ icd101 แล้วมีรหัสที่ขึ้นต้นด้วย M,V-Y ชื่อโรคไม่ตรงตามต้องการ
แผนแพทย์ไทยส่วนใหญ่ diag น่าจะขึ้นด้วย M
*****
เอารายการนี้ออกก่อนก้อได้
-
ค่า AN ไม่ออกครับ
-
ตอน Admit อาจไม่ได้ใช้บริการ
อาจมาหลังจาก D/C ไปแล้ว
-
ตอน Admit อาจไม่ได้ใช้บริการ
อาจมาหลังจาก D/C ไปแล้ว
ใช่แล้วครับ...สุดท้ายเลยทำรายงานตอนมาคลอด แยกอีกหนึ่งอันแล้วให้มาไล่ใส่ AN เอง