|
@ -5476,7 +5476,7 @@ public class StatisticsService extends BaseService {
|
|
public String setLevelAndDisSql2(String sql,String disease,String level,String area){
|
|
public String setLevelAndDisSql2(String sql,String disease,String level,String area){
|
|
|
|
|
|
if(StringUtils.isNotBlank(disease)){
|
|
if(StringUtils.isNotBlank(disease)){
|
|
sql += " JOIN wlyy_prescription_diagnosis d ON d.prescription_code = t.prescription_code ";
|
|
|
|
|
|
sql += " JOIN wlyy_prescription_diagnosis d ON d.prescription_code = p.code ";
|
|
}
|
|
}
|
|
if("4".equals(level)){
|
|
if("4".equals(level)){
|
|
sql +=" WHERE 1=1 ";
|
|
sql +=" WHERE 1=1 ";
|
|
@ -6100,5 +6100,568 @@ public class StatisticsService extends BaseService {
|
|
}
|
|
}
|
|
return rs;
|
|
return rs;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public List<Map<String,Object>> getPrescriptionAgeTotal(String level,String area,String disease){
|
|
|
|
String sql = "SELECT " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) 0age " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient ";
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" )>= 0 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 6 " +
|
|
|
|
" ) 0age, " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) 7age " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient ";
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 7 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 18 " +
|
|
|
|
" ) 7age, " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) 19age " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient " ;
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 19 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 30 " +
|
|
|
|
" ) 19age, " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) 31age " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient " ;
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 31 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 50 " +
|
|
|
|
" ) 31age, " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) 51age " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient ";
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 51 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 64 " +
|
|
|
|
" ) 51age, " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) 65age " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient " ;
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 65 " +
|
|
|
|
" ) 65age, " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) total " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient " ;
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " ) total";
|
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
|
|
if(rs!=null&&rs.size()>0){
|
|
|
|
Long age0 = (Long)rs.get(0).get("0age");
|
|
|
|
Long age7 = (Long)rs.get(0).get("7age");
|
|
|
|
Long age19 = (Long)rs.get(0).get("19age");
|
|
|
|
Long age31 = (Long)rs.get(0).get("31age");
|
|
|
|
Long age51 = (Long)rs.get(0).get("51age");
|
|
|
|
Long age65 = (Long)rs.get(0).get("65age");
|
|
|
|
Long total = (Long)rs.get(0).get("total");
|
|
|
|
|
|
|
|
rs.get(0).put("0ageRate",getAgeRate(age0,total));
|
|
|
|
rs.get(0).put("7ageRate",getAgeRate(age7,total));
|
|
|
|
rs.get(0).put("19ageRate",getAgeRate(age19,total));
|
|
|
|
rs.get(0).put("31ageRate",getAgeRate(age31,total));
|
|
|
|
rs.get(0).put("51ageRate",getAgeRate(age51,total));
|
|
|
|
rs.get(0).put("65ageRate",getAgeRate(age65,total));
|
|
|
|
}
|
|
|
|
return rs;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getAgeRate(Long age,Long total){
|
|
|
|
if(total!=null&&total!=0){
|
|
|
|
float ageRate0 = age.floatValue()/total.floatValue()*100;
|
|
|
|
DecimalFormat decimalFormat=new DecimalFormat("0.00");//构造方法的字符格式这里如果小数不足2位,会以0补足.
|
|
|
|
String ageR0=decimalFormat.format(ageRate0)+"%";//format 返回的是字符串
|
|
|
|
return ageR0;
|
|
|
|
}
|
|
|
|
return "0";
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getAgeRateLine(Long age,Long total){
|
|
|
|
if(total!=null&&total!=0){
|
|
|
|
float ageRate0 = age.floatValue()/total.floatValue();
|
|
|
|
DecimalFormat decimalFormat=new DecimalFormat("0.00");//构造方法的字符格式这里如果小数不足2位,会以0补足.
|
|
|
|
String ageR0=decimalFormat.format(ageRate0);//format 返回的是字符串
|
|
|
|
return ageR0;
|
|
|
|
}
|
|
|
|
return "0";
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Map<String,Object>> getPrescriptionAgeHistogram(String level,String area,String disease,String startDate,String endDate){
|
|
|
|
|
|
|
|
startDate += " 00:00:00";
|
|
|
|
endDate += " 23:59:59";
|
|
|
|
String sql ="SELECT " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) 0age " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient ";
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" )>= 0 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 6 " +
|
|
|
|
" AND p.create_time >='"+startDate+"' " +
|
|
|
|
" AND p.create_time <='"+endDate+"' " +
|
|
|
|
" ) 0age,( " +
|
|
|
|
" SELECT " +
|
|
|
|
" COUNT(c.patient) " +
|
|
|
|
" FROM " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" DISTINCT p.patient " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient ";
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" )>= 0 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 6 " +
|
|
|
|
" AND p.create_time >='"+startDate+"' " +
|
|
|
|
" AND p.create_time <='"+endDate+"') c " +
|
|
|
|
" ) 0people, " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) 7age " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient ";
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 7 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 18 " +
|
|
|
|
" AND p.create_time >='"+startDate+"' " +
|
|
|
|
" AND p.create_time <='"+endDate+"' " +
|
|
|
|
" ) 7age,( " +
|
|
|
|
" SELECT " +
|
|
|
|
" COUNT(c.patient) " +
|
|
|
|
" FROM " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" DISTINCT p.patient " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient ";
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 7 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 18 " +
|
|
|
|
" AND p.create_time >='"+startDate+"' " +
|
|
|
|
" AND p.create_time <='"+endDate+"') c " +
|
|
|
|
" ) 7people, " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) 19age " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient " ;
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 19 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 30 " +
|
|
|
|
" AND p.create_time >='"+startDate+"' " +
|
|
|
|
" AND p.create_time <='"+endDate+"' " +
|
|
|
|
" ) 19age,( " +
|
|
|
|
" SELECT " +
|
|
|
|
" COUNT(c.patient) " +
|
|
|
|
" FROM " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" DISTINCT p.patient " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient " ;
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 19 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 30 " +
|
|
|
|
" AND p.create_time >='"+startDate+"' " +
|
|
|
|
" AND p.create_time <='"+endDate+"') c " +
|
|
|
|
" ) 19people, " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) 31age " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient ";
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 31 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 50 " +
|
|
|
|
" AND p.create_time >='"+startDate+"' " +
|
|
|
|
" AND p.create_time <='"+endDate+"' " +
|
|
|
|
" ) 31age,( " +
|
|
|
|
" SELECT " +
|
|
|
|
" COUNT(c.patient) " +
|
|
|
|
" FROM " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" DISTINCT p.patient " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient ";
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 31 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 50 " +
|
|
|
|
" AND p.create_time >='"+startDate+"' " +
|
|
|
|
" AND p.create_time <='"+endDate+"') c " +
|
|
|
|
" ) 31people, " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) 51age " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient " ;
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 51 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 64 " +
|
|
|
|
" AND p.create_time >='"+startDate+"' " +
|
|
|
|
" AND p.create_time <='"+endDate+"' " +
|
|
|
|
" ) 51age,( " +
|
|
|
|
" SELECT " +
|
|
|
|
" COUNT(c.patient) " +
|
|
|
|
" FROM " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" DISTINCT p.patient " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient ";
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 51 " +
|
|
|
|
" AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) <= 64 " +
|
|
|
|
" AND p.create_time >='"+startDate+"' " +
|
|
|
|
" AND p.create_time <='"+endDate+"') c " +
|
|
|
|
" ) 51people, " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) 65age " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient ";
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 65 " +
|
|
|
|
" AND p.create_time >='"+startDate+"' " +
|
|
|
|
" AND p.create_time <='"+endDate+"' " +
|
|
|
|
" ) 65age,( " +
|
|
|
|
" SELECT " +
|
|
|
|
" COUNT(c.patient) " +
|
|
|
|
" FROM " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" DISTINCT p.patient " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " +
|
|
|
|
" JOIN wlyy_patient pt ON pt. CODE = p.patient ";
|
|
|
|
sql = setLevelAndDisSql2(sql,disease,level,area);
|
|
|
|
sql += " AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
|
|
|
|
" RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
|
|
|
|
" ) >= 65 " +
|
|
|
|
" AND p.create_time >='"+startDate+"' " +
|
|
|
|
" AND p.create_time <='"+endDate+"') c " +
|
|
|
|
" ) 65people";
|
|
|
|
|
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
|
|
if(rs!=null&&rs.size()>0){
|
|
|
|
|
|
|
|
Long age0 = (Long)rs.get(0).get("0age");
|
|
|
|
Long age7 = (Long)rs.get(0).get("7age");
|
|
|
|
Long age19 = (Long)rs.get(0).get("19age");
|
|
|
|
Long age31 = (Long)rs.get(0).get("31age");
|
|
|
|
Long age51 = (Long)rs.get(0).get("51age");
|
|
|
|
Long age65 = (Long)rs.get(0).get("65age");
|
|
|
|
|
|
|
|
Long people0 = (Long)rs.get(0).get("0people");
|
|
|
|
Long people7 = (Long)rs.get(0).get("7people");
|
|
|
|
Long people19 = (Long)rs.get(0).get("19people");
|
|
|
|
Long people31 = (Long)rs.get(0).get("31people");
|
|
|
|
Long people51 = (Long)rs.get(0).get("51people");
|
|
|
|
Long people65= (Long)rs.get(0).get("65people");
|
|
|
|
|
|
|
|
rs.get(0).put("0ageRate",getAgeRateLine(age0,people0));
|
|
|
|
rs.get(0).put("7ageRate",getAgeRateLine(age7,people7));
|
|
|
|
rs.get(0).put("19ageRate",getAgeRateLine(age19,people19));
|
|
|
|
rs.get(0).put("31ageRate",getAgeRateLine(age31,people31));
|
|
|
|
rs.get(0).put("51ageRate",getAgeRateLine(age51,people51));
|
|
|
|
rs.get(0).put("65ageRate",getAgeRateLine(age65,people65));
|
|
|
|
}
|
|
|
|
|
|
|
|
return rs;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Map<String,Object>> getPrescriptionAgeLowLevel(String level,String lowlevel,String area,String disease) {
|
|
|
|
|
|
|
|
if("4".equals(level)){
|
|
|
|
if("3".equals(lowlevel)){
|
|
|
|
String sql = "SELECT " +
|
|
|
|
" tw.`code`, " +
|
|
|
|
" tw.`name`, " +
|
|
|
|
" ifnull(c.total,0) num " +
|
|
|
|
" FROM " +
|
|
|
|
" dm_town tw LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) total, " +
|
|
|
|
" LEFT(pp.hospital,6) code " +
|
|
|
|
" FROM " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT DISTINCT " +
|
|
|
|
" p.patient, " +
|
|
|
|
" p.admin_team_id, " +
|
|
|
|
" p.hospital " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p " ;
|
|
|
|
sql = setDisSql( sql, disease);
|
|
|
|
sql += " ) pp " +
|
|
|
|
" GROUP BY " +
|
|
|
|
" LEFT(pp.hospital,6) " +
|
|
|
|
" ) c ON c.code = tw.code " +
|
|
|
|
" WHERE " +
|
|
|
|
" tw.city = '350200' " +
|
|
|
|
" ORDER BY num DESC ";
|
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
|
|
|
|
return rs;
|
|
|
|
}else if("2".equals(lowlevel)){
|
|
|
|
String sql = "SELECT " +
|
|
|
|
" tw.`code`, " +
|
|
|
|
" tw.`name`, " +
|
|
|
|
" ifnull(c.total,0) num " +
|
|
|
|
" FROM " +
|
|
|
|
" dm_hospital tw LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) total, " +
|
|
|
|
" pp.hospital code " +
|
|
|
|
" FROM " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT DISTINCT " +
|
|
|
|
" p.patient, " +
|
|
|
|
" p.admin_team_id, " +
|
|
|
|
" p.hospital " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p ";
|
|
|
|
sql = setDisSql(sql,disease);
|
|
|
|
sql += " ) pp " +
|
|
|
|
" GROUP BY " +
|
|
|
|
" pp.hospital " +
|
|
|
|
" ) c ON c.code = tw.code " +
|
|
|
|
" WHERE " +
|
|
|
|
" tw.city = '350200' " +
|
|
|
|
" AND LENGTH(tw.code)=10 " +
|
|
|
|
" ORDER BY num DESC ";
|
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
|
|
|
|
return rs;
|
|
|
|
}else if("1".equals(lowlevel)){
|
|
|
|
String sql ="SELECT " +
|
|
|
|
" tw.id code, " +
|
|
|
|
" tw.`name`, " +
|
|
|
|
" ifnull(c.total,0) num " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_admin_team tw LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) total, " +
|
|
|
|
" pp.admin_team_id code " +
|
|
|
|
" FROM " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT DISTINCT " +
|
|
|
|
" p.patient, " +
|
|
|
|
" p.admin_team_id, " +
|
|
|
|
" p.hospital " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p ";
|
|
|
|
sql = setDisSql(sql,disease);
|
|
|
|
sql += " ) pp " +
|
|
|
|
" GROUP BY " +
|
|
|
|
" pp.admin_team_id " +
|
|
|
|
" ) c ON c.code = tw.id " +
|
|
|
|
" WHERE " +
|
|
|
|
" 1=1 " +
|
|
|
|
" ORDER BY num DESC ";
|
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
|
|
|
|
statisticsAllService.translateTeamLeaderName2(rs);
|
|
|
|
return rs;
|
|
|
|
}
|
|
|
|
}else if("3".equals(level)){
|
|
|
|
if("2".equals(lowlevel)){
|
|
|
|
String sql = "SELECT " +
|
|
|
|
" tw.`code`, " +
|
|
|
|
" tw.`name`, " +
|
|
|
|
" ifnull(c.total,0) num " +
|
|
|
|
" FROM " +
|
|
|
|
" dm_hospital tw LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) total, " +
|
|
|
|
" pp.hospital code " +
|
|
|
|
" FROM " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT DISTINCT " +
|
|
|
|
" p.patient, " +
|
|
|
|
" p.admin_team_id, " +
|
|
|
|
" p.hospital " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p ";
|
|
|
|
sql = setDisSql(sql,disease);
|
|
|
|
sql += " AND LEFT(p.hospital,6) ='"+area+"'" +
|
|
|
|
" ) pp " +
|
|
|
|
" GROUP BY " +
|
|
|
|
" pp.hospital " +
|
|
|
|
" ) c ON c.code = tw.code " +
|
|
|
|
" WHERE " +
|
|
|
|
" tw.city = '350200' " +
|
|
|
|
" AND tw.town ='"+area+"' " +
|
|
|
|
" AND LENGTH(tw.code)=10 " +
|
|
|
|
" ORDER BY num DESC ";
|
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
|
|
|
|
return rs;
|
|
|
|
}else if("1".equals(lowlevel)){
|
|
|
|
String sql ="SELECT " +
|
|
|
|
" tw.id code, " +
|
|
|
|
" tw.`name`, " +
|
|
|
|
" ifnull(c.total,0) num " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_admin_team tw LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) total, " +
|
|
|
|
" pp.admin_team_id code " +
|
|
|
|
" FROM " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT DISTINCT " +
|
|
|
|
" p.patient, " +
|
|
|
|
" p.admin_team_id, " +
|
|
|
|
" p.hospital " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p ";
|
|
|
|
sql = setDisSql(sql,disease);
|
|
|
|
sql += " AND LEFT(p.hospital,6) ='"+area+"'" +
|
|
|
|
") pp " +
|
|
|
|
" GROUP BY " +
|
|
|
|
" pp.admin_team_id " +
|
|
|
|
" ) c ON c.code = tw.id " +
|
|
|
|
" WHERE " +
|
|
|
|
" 1=1 " +
|
|
|
|
" AND LEFT(tw.org_code,6) ='"+area+"' " +
|
|
|
|
" ORDER BY num DESC ";
|
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
|
|
|
|
statisticsAllService.translateTeamLeaderName2(rs);
|
|
|
|
return rs;
|
|
|
|
}
|
|
|
|
}else if("2".equals(level)){
|
|
|
|
if("1".equals(lowlevel)){
|
|
|
|
String sql ="SELECT " +
|
|
|
|
" tw.id code, " +
|
|
|
|
" tw.`name`, " +
|
|
|
|
" ifnull(c.total,0) num " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_admin_team tw LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" count(1) total, " +
|
|
|
|
" pp.admin_team_id code " +
|
|
|
|
" FROM " +
|
|
|
|
" ( " +
|
|
|
|
" SELECT DISTINCT " +
|
|
|
|
" p.patient, " +
|
|
|
|
" p.admin_team_id, " +
|
|
|
|
" p.hospital " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription p ";
|
|
|
|
sql = setDisSql(sql,disease);
|
|
|
|
sql += " AND p.hospital ='"+area+"'" +
|
|
|
|
") pp " +
|
|
|
|
" GROUP BY " +
|
|
|
|
" pp.admin_team_id " +
|
|
|
|
" ) c ON c.code = tw.id " +
|
|
|
|
" WHERE " +
|
|
|
|
" 1=1 " +
|
|
|
|
" AND tw.org_code ='"+area+"' " +
|
|
|
|
" ORDER BY num DESC ";
|
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
|
|
|
|
statisticsAllService.translateTeamLeaderName2(rs);
|
|
|
|
return rs;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|