พฤษภาคม 2024
จ. อ. พ. พฤ. ศ. ส. อา.
« มี.ค.    
 12345
6789101112
13141516171819
20212223242526
2728293031  
พฤษภาคม 2024
จ. อ. พ. พฤ. ศ. ส. อา.
« มี.ค.    
 12345
6789101112
13141516171819
20212223242526
2728293031  

ผู้ป่วย copd พร้อม diag

select vn.pdx,vn.dx0,vn.dx1,vn.dx2,vn.dx3,vn.dx4,vn.dx5,c.* ,concat(p.pname,p.fname,’ ‘,p.lname) as patient_name ,n.name as clinic_name , p.cid,y.name as pttype_name ,
cs.name as clinic_subtype_name ,s.name as sex_name ,
d.name as doctor_name ,cm.clinic_member_status_name ,
((if(isnull(date_format(p.deathday,’%Y’)), date_format(now(),’%Y’), date_format(p.deathday,’%Y’)) – date_format(p.birthday,’%Y’)) –
(if(isnull(date_format(p.deathday,’00-%m-%d’)), date_format(now(),’00-%m-%d’), date_format(p.deathday,’00-%m-%d’))
< date_format(p.birthday,’00-%m-%d’))) as patient_age_y, u.name as staff_name,ov1.vstdate as last_cormobidity_screen_date ,
concat(hh.hosptype,’ ‘,hh.name) as dw_reg_hospital_name, concat(ph.hosptype,’ ‘,ph.name) as send_pcu_hospital_name
from clinicmember c
left join vn_stat vn on vn.hn=c.hn
left outer join patient p on p.hn = c.hn

left outer join clinic n on n.clinic = c.clinic
left outer join pttype y on y.pttype = p.pttype
left outer join clinic_subtype cs on cs.clinic_subtype_id = c.clinic_subtype_id
left outer join sex s on s.code = p.sex
left outer join doctor d on d.code = c.doctor
left outer join clinic_member_status cm on cm.clinic_member_status_id = c.clinic_member_status_id
left outer join opduser u on u.loginname = c.modify_staff
left outer join ovst ov1 on ov1.vn = c.last_cormobidity_screen_vn
left outer join hospcode hh on hh.hospcode = c.register_hospcode
left outer join hospcode ph on ph.hospcode = c.send_to_pcu_hcode
where c.clinic = ‘011’ and (c.discharge is null or c.discharge=’N’)
group by c.hn
order by c.pt_number,c.regdate

ใส่ความเห็น