|
@ -903,15 +903,16 @@ public class StatisticsService {
|
|
|
|
|
|
String sql = "select * from (SELECT d.code dept,d.`name` deptName,IFNULL(t1.xtNum,0) xtNum,IFNULL(t1.xyNum,0) xyNum " +
|
|
|
",IFNULL(t2.xtUseNum,0) xtUseNum,IFNULL(t2.xyUseNum,0) xyUseNum " +
|
|
|
",IFNULL(t3.xtBindNum,0) xtBindNum,IFNULL(t3.xyBindNum,0) xyBindNum from dict_hospital_dept d " +
|
|
|
"LEFT JOIN (SELECT d.dept,d.dept_name,COUNT(if(dm.category_code=1,1,null)) xtNum,COUNT(if(dm.category_code=2,1,null)) xyNum " +
|
|
|
",IFNULL(t3.xtBindNum,0) xtBindNum,IFNULL(t3.xyBindNum,0) xyBindNum from (SELECT code,name from dict_hospital_dept " +
|
|
|
" UNION all SELECT '' code,'' name) d " +
|
|
|
"LEFT JOIN (SELECT IFNULL(d.dept,'') dept,IFNULL(d.dept_name,'') dept_name,COUNT(if(dm.category_code=1,1,null)) xtNum,COUNT(if(dm.category_code=2,1,null)) xyNum " +
|
|
|
" from wlyy_devices d,dm_device dm " +
|
|
|
"WHERE d.category_code=dm.id " + filter +
|
|
|
"GROUP BY d.dept) t1 on d.code=t1.dept " +
|
|
|
"LEFT JOIN (SELECT dept,dept_name,COUNT(if(type=1,1,null)) xtUseNum,COUNT(if(type=2,1,null)) xyUseNum from " +
|
|
|
"LEFT JOIN (SELECT IFNULL(dept,'') dept,IFNULL(dept_name,'') dept_name,COUNT(if(type=1,1,null)) xtUseNum,COUNT(if(type=2,1,null)) xyUseNum from " +
|
|
|
"wlyy_patient_health_index where del=1 " + filterUse +
|
|
|
"GROUP BY dept) t2 on d.code=t2.dept " +
|
|
|
"LEFT JOIN (SELECT dept,dept_name,COUNT(if(category_code=1,1,null)) xtBindNum,COUNT(if(category_code=2,1,null)) xyBindNum " +
|
|
|
"LEFT JOIN (SELECT IFNULL(dept,'') dept,IFNULL(dept_name,'') dept_name,COUNT(if(category_code=1,1,null)) xtBindNum,COUNT(if(category_code=2,1,null)) xyBindNum " +
|
|
|
"from wlyy_patient_device where 1=1 " + filterBind+
|
|
|
"GROUP BY dept) t3 on d.code=t3.dept ) t " +
|
|
|
"WHERE (xtNum+xyNum+xtUseNum+xyUseNum+xtBindNum+xyBindNum)>0 ORDER BY "+sort+" desc";
|