18
« เมื่อ: ตุลาคม 07, 2011, 10:09:33 AM »
รายงาน REPORT-RG501,REPORT-RG502,REPORT-RG505 จำหน่ายผู้ป่วยในแล้วตัวรายงานระบบไม่ออก
ปิดCHART ไม่ได้ (ทดสอบในฐานสำรองOS windowsXP) ยังไม่กล้าทำกับฐานจริง
เพราะตัวรายงานไม่ออกหลายตัวเฉพาะผู้ป่วยใน ตย. Codeบางช่วงครับ
select "Thai" as eclinic ,ip.dchtime,ip.regtime,
"Medicine" as admitdepart,i.*,pcn.cardno as CID_CODE,
concat(pt.pname,pt.fname," ",pt.lname) as PT_NAME,
concat(pt.addrpart," หมู่ ",pt.moopart," ต.",t3.name," อ.",t2.name," จ.",t1.name) as ADDRESS,
sx.name as SEX_NAME,
mr.name as MARRYSTATUS,
oc.name as OCCUPATION,
pt.birthday as DOB, pt.informname as INFORMNAME,
concat("<",pt.informrelation,">") as INFORMRELATION,pt.informaddr as INFORMADDR,
pty.name as PTTYPENAME,
wd.name as WARD_NAME,
sp.name as SPCLTY_NAME ,
ov.*, concat(hc.hosptype," ",hc.name) as hospmain_name,concat(hc2.hosptype," ",hc2.name) as hospsub_name ,
ip.dchstts ,ds.name as dchstts_name ,ip.dchtype , dt.name as dchtype_name,ip.drg ,ip.rw ,ip.wtlos ,ip.ot,
ip.gravidity,ip.parity,ip.living_children ,ip.bw,ip.adjrw,ip.rw,d.name as doctor,opl.enter_date,opl.enter_time,opl.leave_date,opl.leave_time
from an_stat i
left outer join ptcardno pcn on pcn.hn=i.hn and pcn.cardtype="01"
left outer join patient pt on pt.hn=i.hn
left outer join sex sx on sx.code=pt.sex
left outer join ovst ov on ov.vn=i.vn
left outer join hospcode hc on hc.hospcode = ov.hospmain
left outer join hospcode hc2 on hc2.hospcode = ov.hospsub
left outer join marrystatus mr on mr.code=pt.marrystatus
left outer join occupation oc on oc.occupation=pt.occupation
left outer join pttype pty on pty.pttype=i.pttype
left outer join ward wd on wd.ward=i.ward
left outer join spclty sp on sp.spclty=i.spclty
left outer join thaiaddress t1 on t1.codetype="1" and t1.chwpart=pt.chwpart
left outer join thaiaddress t2 on t2.codetype="2" and t2.chwpart=pt.chwpart and t2.amppart=pt.amppart
left outer join thaiaddress t3 on t3.codetype="3" and t3.chwpart=pt.chwpart and t3.amppart=pt.amppart and t3.tmbpart=pt.tmbpart
left outer join ipt ip on ip.an=i.an
left outer join dchstts ds on ds.dchstts=ip.dchstts
left outer join dchtype dt on dt.dchtype=ip.dchtype
left outer join doctor d on d.code = ip.admdoctor
left outer join operation_list opl on opl.an = i.an
left outer join operation_detail opd on opd.operation_id = opl.operation_id
left outer join operation_item opi on opi.operation_item_id = opd.operation_item_id
where ip.an='540003601'