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

egfr แบ่งช่วง และ แยก เบาหวาน ความดัน และ เบาหวาน+ความดัน

select c.hn,s1.egfr,(case when s1.egfr between ‘1’ and ‘15.99’ then 1 else 0 end)as 1to15,
(case when s1.egfr between ’16’ and ‘30.99’ then 1 else 0 end)as 16to30,
(case when s1.egfr between ’31’ and ‘45.99’ then 1 else 0 end)as 31to45,
(case when s1.egfr between ’46’ and ‘60.99’ then 1 else 0 end)as 46to60,
(case when s1.egfr between ’61’ and ‘75.99’ then 1 else 0 end)as 61to75,
(case when s1.egfr between ’76’ and ‘90.99’ then 1 else 0 end)as 76to90,
(case when s1.egfr between ’91’ and ‘300.99’ then 1 else 0 end)as 91up
from clinicmember c
left join opdscreen s1 on s1.hn=c.hn
where c.clinic=001 and c.other_chronic_text not like ‘โรคความดัน%’ and s1.egfr<>””
group by c.hn
order by s1.egfr

 

select c.hn,s1.egfr,(case when s1.egfr between ‘1’ and ‘15.99’ then 1 else 0 end)as 1to15,
(case when s1.egfr between ’16’ and ‘30.99’ then 1 else 0 end)as 16to30,
(case when s1.egfr between ’31’ and ‘45.99’ then 1 else 0 end)as 31to45,
(case when s1.egfr between ’46’ and ‘60.99’ then 1 else 0 end)as 46to60,
(case when s1.egfr between ’61’ and ‘75.99’ then 1 else 0 end)as 61to75,
(case when s1.egfr between ’76’ and ‘90.99’ then 1 else 0 end)as 76to90,
(case when s1.egfr between ’91’ and ‘300.99’ then 1 else 0 end)as 91up
from clinicmember c
left join opdscreen s1 on s1.hn=c.hn
where c.clinic=002 and c.other_chronic_text not like ‘โรคเบาหวาน%’ and s1.egfr<>””
group by c.hn
order by s1.egfr

 

select c.hn,s1.egfr,c.clinic,c.other_chronic_text,(case when s1.egfr between ‘1’ and ‘15.99’ then 1 else 0 end)as 1to15,
(case when s1.egfr between ’16’ and ‘30.99’ then 1 else 0 end)as 16to30,
(case when s1.egfr between ’31’ and ‘45.99’ then 1 else 0 end)as 31to45,
(case when s1.egfr between ’46’ and ‘60.99’ then 1 else 0 end)as 46to60,
(case when s1.egfr between ’61’ and ‘75.99’ then 1 else 0 end)as 61to75,
(case when s1.egfr between ’76’ and ‘90.99’ then 1 else 0 end)as 76to90,
(case when s1.egfr between ’91’ and ‘300.99’ then 1 else 0 end)as 91up
from clinicmember c
left join opdscreen s1 on s1.hn=c.hn
where c.clinic=001 and c.other_chronic_text like ‘โรคความดัน%’ or c.clinic=002 and c.other_chronic_text like ‘โรคเบาหวาน%’
and s1.egfr<>””
group by c.hn
order by s1.egfr

———————————————————————————————————————————

select o.egfr,o.hn,o.vstdate,o.vn,c.clinic,c.other_chronic_text,
(case when o.egfr between ‘1’ and ‘15.99’ then 1 else 0 end)as 1to15,
(case when o.egfr between ’16’ and ‘30.99’ then 1 else 0 end)as 16to30,
(case when o.egfr between ’31’ and ‘45.99’ then 1 else 0 end)as 31to45,
(case when o.egfr between ’46’ and ‘60.99’ then 1 else 0 end)as 46to60,
(case when o.egfr between ’61’ and ‘75.99’ then 1 else 0 end)as 61to75,
(case when o.egfr between ’76’ and ‘90.99’ then 1 else 0 end)as 76to90,
(case when o.egfr between ’91’ and ‘300.99’ then 1 else 0 end)as 91up
from opdscreen o
right join clinicmember c on c.hn=o.hn and c.clinic=001 and c.other_chronic_text not like ‘âä¤ÇÒÁ´Ñ¹%’
where o.egfr<>””
group by o.hn
order by o.vstdate desc

——————————————————————————————————————————–

 

 

 

ปิดการแสดงความเห็น