Theme Colors
Wide Boxed

SQL รายชื่อ admit

DateTime : 1469-01-15 14:46:51
Post By : tharatip
IP Address :

select ipt.*,concat(,' - ', as sname,iptadm.bedno,iptadm.bedtype, as roomname,
iptadm.roomno,iptdiag.icd10,concat(iptdiag.icd10,' - ', as icdname,
concat(patient.pname,patient.fname,' ',patient.lname) as pname,aa.income as income,
ptt.pcode as rtcode, as rtname, as admdoctor_name , as finance_status_name,aa.admdate,aa.age_y,aa.age_m,aa.age_d,aa.paid_money ,
aa.rcpt_money,fs.finance_status  , as dchtype_name, as dchstts_name,
aa.paid_money-aa.rcpt_money as wait_paid_money,aa.rcpt_money as ipt_rcpt_money, as incharge_doctor_name ,
if(ipt.dw_hhc_list_id>0,'Y','N') as hhc_send_status
 from ipt  left outer join spclty on spclty.spclty=ipt.spclty
 left outer join iptadm on
 left outer join patient on
 left outer join doctor dt on dt.code = ipt.admdoctor
 left outer join roomno on roomno.roomno=iptadm.roomno
 left outer join iptdiag on and iptdiag.diagtype='1'
 left outer join icd101 i1 on i1.code=substring(iptdiag.icd10,1,3)
 left outer join an_stat aa on
 left outer join ward w on w.ward = ipt.ward
 left outer join dchtype dc1 on dc1.dchtype = ipt.dchtype
 left outer join dchstts dc2 on dc2.dchstts = ipt.dchstts
 left outer join ipt_finance_status fs on =
 left outer join finance_status ft on ft.finance_status = fs.finance_status
 left outer join doctor di on di.code = ipt.incharge_doctor
 left outer join pttype ptt on ptt.pttype=ipt.pttype
 where  ipt.ward = '01'   and ipt.dchstts is null order by ipt.regdate,ipt.regtime


หากต้องการตอบกระทู้ Webboard กรุณาเข้าใช้ระบบก่อนนะค่ะ..