|  | @ -5151,7 +5151,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 sql = "SELECT " +
 | 
	
		
			
				|  |  |                         " t.code, " +
 | 
	
		
			
				|  |  |                         " t.name, " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) num  " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) val  " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " dm_town t " +
 | 
	
		
			
				|  |  |                         " LEFT JOIN ( " +
 | 
	
	
		
			
				|  | @ -5166,12 +5166,12 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         " ) s ON s.code = t.code " +
 | 
	
		
			
				|  |  |                         " WHERE " +
 | 
	
		
			
				|  |  |                         " t.city='350200' " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC";
 | 
	
		
			
				|  |  |             }else if("2".equals(lowlevel)){
 | 
	
		
			
				|  |  |                  sql = "SELECT " +
 | 
	
		
			
				|  |  |                         " t.code, " +
 | 
	
		
			
				|  |  |                         " t.name, " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) num  " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) val  " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " dm_hospital t " +
 | 
	
		
			
				|  |  |                         " LEFT JOIN ( " +
 | 
	
	
		
			
				|  | @ -5187,12 +5187,12 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         " WHERE " +
 | 
	
		
			
				|  |  |                         " t.city='350200' " +
 | 
	
		
			
				|  |  |                         " AND LENGTH(t.code)=10 " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC";
 | 
	
		
			
				|  |  |             }else if("1".equals(lowlevel)){
 | 
	
		
			
				|  |  |                  sql = " SELECT " +
 | 
	
		
			
				|  |  |                         " t.id code, " +
 | 
	
		
			
				|  |  |                         " t.name, " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) num  " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) val  " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " wlyy_admin_team t " +
 | 
	
		
			
				|  |  |                         " LEFT JOIN ( " +
 | 
	
	
		
			
				|  | @ -5205,7 +5205,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 sql +=  "  GROUP BY " +
 | 
	
		
			
				|  |  |                         "  p.admin_team_id " +
 | 
	
		
			
				|  |  |                         " ) s ON s.code = t.id " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC ";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         //区级维度
 | 
	
		
			
				|  |  |         }else if("3".equals(level)){
 | 
	
	
		
			
				|  | @ -5213,7 +5213,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                  sql = "SELECT " +
 | 
	
		
			
				|  |  |                         " t.code, " +
 | 
	
		
			
				|  |  |                         " t.name, " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) num  " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) val  " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " dm_hospital t " +
 | 
	
		
			
				|  |  |                         " LEFT JOIN ( " +
 | 
	
	
		
			
				|  | @ -5230,12 +5230,12 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         " t.city='350200' " +
 | 
	
		
			
				|  |  |                         " AND LENGTH(t.code)=10 " +
 | 
	
		
			
				|  |  |                         " AND t.town ='"+area+"'" +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC";
 | 
	
		
			
				|  |  |             }else if("1".equals(lowlevel)){
 | 
	
		
			
				|  |  |                  sql = " SELECT " +
 | 
	
		
			
				|  |  |                         " t.id code, " +
 | 
	
		
			
				|  |  |                         " t.name, " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) num  " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) val  " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " wlyy_admin_team t " +
 | 
	
		
			
				|  |  |                         " LEFT JOIN ( " +
 | 
	
	
		
			
				|  | @ -5249,7 +5249,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         "  p.admin_team_id " +
 | 
	
		
			
				|  |  |                         " ) s ON s.code = t.id " +
 | 
	
		
			
				|  |  |                         " WHERE LEFT(t.org_code,6) ='"+area+"' " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC ";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         //机构级维度
 | 
	
		
			
				|  |  |         }else if("2".equals(level)){
 | 
	
	
		
			
				|  | @ -5257,7 +5257,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                  sql = " SELECT " +
 | 
	
		
			
				|  |  |                         " t.id code, " +
 | 
	
		
			
				|  |  |                         " t.name, " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) num  " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) val  " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " wlyy_admin_team t " +
 | 
	
		
			
				|  |  |                         " LEFT JOIN ( " +
 | 
	
	
		
			
				|  | @ -5271,7 +5271,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         "  p.admin_team_id " +
 | 
	
		
			
				|  |  |                         " ) s ON s.code = t.id " +
 | 
	
		
			
				|  |  |                         " WHERE t.org_code ='"+area+"'" +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC ";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         rs = jdbcTemplate.queryForList(sql);
 | 
	
	
		
			
				|  | @ -5530,7 +5530,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     String sql = "SELECT  " +
 | 
	
		
			
				|  |  |                             " tw.`code`, " +
 | 
	
		
			
				|  |  |                             " tw.`name`, " +
 | 
	
		
			
				|  |  |                             " ifnull(c.sum/100,0) sum " +
 | 
	
		
			
				|  |  |                             " ifnull(c.sum/100,0) val " +
 | 
	
		
			
				|  |  |                             " FROM dm_town tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                             " SELECT " +
 | 
	
		
			
				|  |  |                             " sum(t.total_amount) sum, " +
 | 
	
	
		
			
				|  | @ -5543,7 +5543,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                             " ) c ON c.code = tw.code  " +
 | 
	
		
			
				|  |  |                             " WHERE " +
 | 
	
		
			
				|  |  |                             " tw.city = '350200' " +
 | 
	
		
			
				|  |  |                             " ORDER BY sum DESC ";
 | 
	
		
			
				|  |  |                             " ORDER BY val DESC ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -5552,7 +5552,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     String sql = "SELECT  " +
 | 
	
		
			
				|  |  |                             " tw.`code`, " +
 | 
	
		
			
				|  |  |                             " tw.`name`, " +
 | 
	
		
			
				|  |  |                             " ifnull(FORMAT(c.avg/100,2),0) avg " +
 | 
	
		
			
				|  |  |                             " ifnull(FORMAT(c.avg/100,2),0) val " +
 | 
	
		
			
				|  |  |                             " FROM dm_town tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                             " SELECT " +
 | 
	
		
			
				|  |  |                             " avg(t.total_amount) avg, " +
 | 
	
	
		
			
				|  | @ -5565,7 +5565,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                             " ) c ON c.code = tw.code  " +
 | 
	
		
			
				|  |  |                             " WHERE " +
 | 
	
		
			
				|  |  |                             " tw.city = '350200' " +
 | 
	
		
			
				|  |  |                             " ORDER BY avg DESC ";
 | 
	
		
			
				|  |  |                             " ORDER BY c.avg DESC ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -5578,7 +5578,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     String sql = "SELECT  " +
 | 
	
		
			
				|  |  |                             " tw.`code`, " +
 | 
	
		
			
				|  |  |                             " tw.`name`, " +
 | 
	
		
			
				|  |  |                             " ifnull(c.sum/100,0) sum " +
 | 
	
		
			
				|  |  |                             " ifnull(c.sum/100,0) val " +
 | 
	
		
			
				|  |  |                             " FROM dm_hospital tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                             " SELECT " +
 | 
	
		
			
				|  |  |                             " sum(t.total_amount) sum, " +
 | 
	
	
		
			
				|  | @ -5592,7 +5592,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                             " WHERE " +
 | 
	
		
			
				|  |  |                             " tw.city = '350200' " +
 | 
	
		
			
				|  |  |                             " AND LENGTH(tw.code)=10 " +
 | 
	
		
			
				|  |  |                             " ORDER BY sum DESC ";
 | 
	
		
			
				|  |  |                             " ORDER BY val DESC ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -5601,7 +5601,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     String sql = " SELECT  " +
 | 
	
		
			
				|  |  |                             " tw.`code`, " +
 | 
	
		
			
				|  |  |                             " tw.`name`, " +
 | 
	
		
			
				|  |  |                             " ifnull(FORMAT(c.avg/100,2),0) avg " +
 | 
	
		
			
				|  |  |                             " ifnull(FORMAT(c.avg/100,2),0) val " +
 | 
	
		
			
				|  |  |                             " FROM dm_hospital tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                             " SELECT " +
 | 
	
		
			
				|  |  |                             " avg(t.total_amount) avg, " +
 | 
	
	
		
			
				|  | @ -5615,7 +5615,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                             " WHERE " +
 | 
	
		
			
				|  |  |                             " tw.city = '350200' " +
 | 
	
		
			
				|  |  |                             " AND LENGTH(tw.code)=10 " +
 | 
	
		
			
				|  |  |                             " ORDER BY avg DESC ";
 | 
	
		
			
				|  |  |                             " ORDER BY c.avg DESC ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -5627,7 +5627,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     String sql = "SELECT  " +
 | 
	
		
			
				|  |  |                             " tw.`id` code, " +
 | 
	
		
			
				|  |  |                             " tw.`name`, " +
 | 
	
		
			
				|  |  |                             " ifnull(c.sum/100,0) sum " +
 | 
	
		
			
				|  |  |                             " ifnull(c.sum/100,0) val " +
 | 
	
		
			
				|  |  |                             " FROM wlyy_admin_team tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                             " SELECT " +
 | 
	
		
			
				|  |  |                             " sum(t.total_amount) sum, " +
 | 
	
	
		
			
				|  | @ -5638,7 +5638,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     sql +=  " AND t.trade_status = 1 " +
 | 
	
		
			
				|  |  |                             " GROUP BY p.admin_team_id " +
 | 
	
		
			
				|  |  |                             " ) c ON c.code = tw.id  " +
 | 
	
		
			
				|  |  |                             " ORDER BY sum DESC ";
 | 
	
		
			
				|  |  |                             " ORDER BY val DESC ";
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |                     statisticsAllService.translateTeamLeaderName2(rs);
 | 
	
		
			
				|  |  |                     return rs;
 | 
	
	
		
			
				|  | @ -5646,7 +5646,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     String sql = "SELECT  " +
 | 
	
		
			
				|  |  |                             " tw.`id` code, " +
 | 
	
		
			
				|  |  |                             " tw.`name`, " +
 | 
	
		
			
				|  |  |                             " ifnull(FORMAT(c.avg/100,2),0) avg " +
 | 
	
		
			
				|  |  |                             " ifnull(FORMAT(c.avg/100,2),0) val " +
 | 
	
		
			
				|  |  |                             " FROM wlyy_admin_team tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                             " SELECT " +
 | 
	
		
			
				|  |  |                             " avg(t.total_amount) avg, " +
 | 
	
	
		
			
				|  | @ -5657,7 +5657,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     sql +=  " AND t.trade_status = 1 " +
 | 
	
		
			
				|  |  |                             " GROUP BY p.hospital " +
 | 
	
		
			
				|  |  |                             " ) c ON c.code = tw.id  " +
 | 
	
		
			
				|  |  |                             " ORDER BY avg DESC ";
 | 
	
		
			
				|  |  |                             " ORDER BY c.avg DESC ";
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |                     statisticsAllService.translateTeamLeaderName2(rs);
 | 
	
		
			
				|  |  |                     return rs;
 | 
	
	
		
			
				|  | @ -5673,7 +5673,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     String sql = "SELECT  " +
 | 
	
		
			
				|  |  |                             " tw.`code`, " +
 | 
	
		
			
				|  |  |                             " tw.`name`, " +
 | 
	
		
			
				|  |  |                             " ifnull(c.sum/100,0) sum " +
 | 
	
		
			
				|  |  |                             " ifnull(c.sum/100,0) val " +
 | 
	
		
			
				|  |  |                             " FROM dm_hospital tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                             " SELECT " +
 | 
	
		
			
				|  |  |                             " sum(t.total_amount) sum, " +
 | 
	
	
		
			
				|  | @ -5686,10 +5686,10 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                             " GROUP BY p.hospital " +
 | 
	
		
			
				|  |  |                             " ) c ON c.code = tw.code  " +
 | 
	
		
			
				|  |  |                             " WHERE " +
 | 
	
		
			
				|  |  |                             " ADN tw.city = '350200' " +
 | 
	
		
			
				|  |  |                             " tw.city = '350200' " +
 | 
	
		
			
				|  |  |                             " AND tw.town = '"+ area+"'" +
 | 
	
		
			
				|  |  |                             " AND LENGTH(tw.code)=10 " +
 | 
	
		
			
				|  |  |                             " ORDER BY sum DESC ";
 | 
	
		
			
				|  |  |                             " ORDER BY val DESC ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -5698,7 +5698,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     String sql = " SELECT  " +
 | 
	
		
			
				|  |  |                             " tw.`code`, " +
 | 
	
		
			
				|  |  |                             " tw.`name`, " +
 | 
	
		
			
				|  |  |                             " ifnull(FORMAT(c.avg/100,2),0) avg " +
 | 
	
		
			
				|  |  |                             " ifnull(FORMAT(c.avg/100,2),0) val " +
 | 
	
		
			
				|  |  |                             " FROM dm_hospital tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                             " SELECT " +
 | 
	
		
			
				|  |  |                             " avg(t.total_amount) avg, " +
 | 
	
	
		
			
				|  | @ -5714,7 +5714,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                             " tw.city = '350200' " +
 | 
	
		
			
				|  |  |                             " AND tw.town = '"+ area+"'" +
 | 
	
		
			
				|  |  |                             " AND LENGTH(tw.code)=10 " +
 | 
	
		
			
				|  |  |                             " ORDER BY avg DESC ";
 | 
	
		
			
				|  |  |                             " ORDER BY c.avg DESC ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -5727,7 +5727,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     String sql = "SELECT  " +
 | 
	
		
			
				|  |  |                             " tw.`id` code, " +
 | 
	
		
			
				|  |  |                             " tw.`name`, " +
 | 
	
		
			
				|  |  |                             " ifnull(c.sum/100,0) sum " +
 | 
	
		
			
				|  |  |                             " ifnull(c.sum/100,0) val " +
 | 
	
		
			
				|  |  |                             " FROM wlyy_admin_team tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                             " SELECT " +
 | 
	
		
			
				|  |  |                             " sum(t.total_amount) sum, " +
 | 
	
	
		
			
				|  | @ -5740,7 +5740,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                             " GROUP BY p.admin_team_id " +
 | 
	
		
			
				|  |  |                             " ) c ON c.code = tw.id  " +
 | 
	
		
			
				|  |  |                             " WHERE  LEFT(tw.org_code,6) ='"+area+"' " +
 | 
	
		
			
				|  |  |                             " ORDER BY sum DESC ";
 | 
	
		
			
				|  |  |                             " ORDER BY val DESC ";
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |                     statisticsAllService.translateTeamLeaderName2(rs);
 | 
	
		
			
				|  |  |                     return rs;
 | 
	
	
		
			
				|  | @ -5748,7 +5748,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     String sql = "SELECT  " +
 | 
	
		
			
				|  |  |                             " tw.`id` code, " +
 | 
	
		
			
				|  |  |                             " tw.`name`, " +
 | 
	
		
			
				|  |  |                             " ifnull(FORMAT(c.avg/100,2),0) avg " +
 | 
	
		
			
				|  |  |                             " ifnull(FORMAT(c.avg/100,2),0) val " +
 | 
	
		
			
				|  |  |                             " FROM wlyy_admin_team tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                             " SELECT " +
 | 
	
		
			
				|  |  |                             " avg(t.total_amount) avg, " +
 | 
	
	
		
			
				|  | @ -5761,7 +5761,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                             " GROUP BY p.admin_team_id " +
 | 
	
		
			
				|  |  |                             " ) c ON c.code = tw.id  " +
 | 
	
		
			
				|  |  |                             " WHERE  LEFT(tw.org_code,6) ='"+area+"' " +
 | 
	
		
			
				|  |  |                             " ORDER BY avg DESC ";
 | 
	
		
			
				|  |  |                             " ORDER BY c.avg DESC ";
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |                     statisticsAllService.translateTeamLeaderName2(rs);
 | 
	
		
			
				|  |  |                     return rs;
 | 
	
	
		
			
				|  | @ -5776,7 +5776,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     String sql = "SELECT  " +
 | 
	
		
			
				|  |  |                             " tw.`id` code, " +
 | 
	
		
			
				|  |  |                             " tw.`name`, " +
 | 
	
		
			
				|  |  |                             " ifnull(c.sum/100,0) sum " +
 | 
	
		
			
				|  |  |                             " ifnull(c.sum/100,0) val " +
 | 
	
		
			
				|  |  |                             " FROM wlyy_admin_team tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                             " SELECT " +
 | 
	
		
			
				|  |  |                             " sum(t.total_amount) sum, " +
 | 
	
	
		
			
				|  | @ -5785,11 +5785,11 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                             " wlyy_prescription_pay t JOIN wlyy_prescription p ON p.code = t.prescription_code " ;
 | 
	
		
			
				|  |  |                     sql = setDisSql(sql,disease);
 | 
	
		
			
				|  |  |                     sql +=  " AND t.trade_status = 1 " +
 | 
	
		
			
				|  |  |                             " AND p.hospital,6 ='"+area+"' " +
 | 
	
		
			
				|  |  |                             " AND p.hospital ='"+area+"' " +
 | 
	
		
			
				|  |  |                             " GROUP BY p.admin_team_id " +
 | 
	
		
			
				|  |  |                             " ) c ON c.code = tw.id  " +
 | 
	
		
			
				|  |  |                             " WHERE  tw.org_code ='"+area+"' " +
 | 
	
		
			
				|  |  |                             " ORDER BY sum DESC ";
 | 
	
		
			
				|  |  |                             " ORDER BY val DESC ";
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |                     statisticsAllService.translateTeamLeaderName2(rs);
 | 
	
		
			
				|  |  |                     return rs;
 | 
	
	
		
			
				|  | @ -5797,7 +5797,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                     String sql = "SELECT  " +
 | 
	
		
			
				|  |  |                             " tw.`id` code, " +
 | 
	
		
			
				|  |  |                             " tw.`name`, " +
 | 
	
		
			
				|  |  |                             " ifnull(FORMAT(c.avg/100,2),0) avg " +
 | 
	
		
			
				|  |  |                             " ifnull(FORMAT(c.avg/100,2),0) val " +
 | 
	
		
			
				|  |  |                             " FROM wlyy_admin_team tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                             " SELECT " +
 | 
	
		
			
				|  |  |                             " avg(t.total_amount) avg, " +
 | 
	
	
		
			
				|  | @ -5810,7 +5810,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                             " GROUP BY p.admin_team_id " +
 | 
	
		
			
				|  |  |                             " ) c ON c.code = tw.id  " +
 | 
	
		
			
				|  |  |                             " WHERE  tw.org_code ='"+area+"' " +
 | 
	
		
			
				|  |  |                             " ORDER BY avg DESC ";
 | 
	
		
			
				|  |  |                             " ORDER BY c.avg DESC ";
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     statisticsAllService.translateTeamLeaderName2(rs);
 | 
	
	
		
			
				|  | @ -5832,50 +5832,38 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |         return sql;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getPrescriptionDispatchingTotal(String level,String area,String disease){
 | 
	
		
			
				|  |  |     public Map<String,Object> getPrescriptionDispatchingTotal(String level,String area,String disease){
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " COUNT(1) total" +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " wlyy_prescription p " ;
 | 
	
		
			
				|  |  |         sql = setLevelAndDisSql2(sql,disease, level, area);
 | 
	
		
			
				|  |  |         sql += " AND p.`status` > 50 " +
 | 
	
		
			
				|  |  |         sql += " AND p.`status` >= " +PrescriptionLog.PrescriptionLogStatus.pay_success.getValue()+
 | 
	
		
			
				|  |  |                 " AND p.dispensary_type = ? ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<Map<String,Object>> rs = new ArrayList();
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         //自取数目
 | 
	
		
			
				|  |  |         List<Map<String,Object>> seltList = jdbcTemplate.queryForList(sql,new Object[]{1});
 | 
	
		
			
				|  |  |         if(seltList!=null&&seltList.size()>0){
 | 
	
		
			
				|  |  |             Map<String,Object> map = new HashedMap();
 | 
	
		
			
				|  |  |             map.put("seltTotal",seltList.get(0).get("total"));
 | 
	
		
			
				|  |  |             rs.add(map);
 | 
	
		
			
				|  |  |             rs.put("seltTotal",seltList.get(0).get("total"));
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             Map<String,Object> map = new HashedMap();
 | 
	
		
			
				|  |  |             map.put("seltTotal",0);
 | 
	
		
			
				|  |  |             rs.add(map);
 | 
	
		
			
				|  |  |             rs.put("seltTotal",0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //快递配送
 | 
	
		
			
				|  |  |         List<Map<String,Object>> deliveryList = jdbcTemplate.queryForList(sql,new Object[]{2});
 | 
	
		
			
				|  |  |         if(deliveryList!=null&&deliveryList.size()>0){
 | 
	
		
			
				|  |  |             Map<String,Object> map = new HashedMap();
 | 
	
		
			
				|  |  |             map.put("deliveryTotal",deliveryList.get(0).get("total"));
 | 
	
		
			
				|  |  |             rs.add(map);
 | 
	
		
			
				|  |  |             rs.put("deliveryTotal",deliveryList.get(0).get("total"));
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             Map<String,Object> map = new HashedMap();
 | 
	
		
			
				|  |  |             map.put("deliveryTotal",0);
 | 
	
		
			
				|  |  |             rs.add(map);
 | 
	
		
			
				|  |  |             rs.put("deliveryTotal",0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //健管师配送
 | 
	
		
			
				|  |  |         List<Map<String,Object>> healthDoctorList = jdbcTemplate.queryForList(sql,new Object[]{2});
 | 
	
		
			
				|  |  |         List<Map<String,Object>> healthDoctorList = jdbcTemplate.queryForList(sql,new Object[]{3});
 | 
	
		
			
				|  |  |         if(healthDoctorList!=null&&healthDoctorList.size()>0){
 | 
	
		
			
				|  |  |             Map<String,Object> map = new HashedMap();
 | 
	
		
			
				|  |  |             map.put("doctorTotal",healthDoctorList.get(0).get("total"));
 | 
	
		
			
				|  |  |             rs.add(map);
 | 
	
		
			
				|  |  |             rs.put("doctorTotal",healthDoctorList.get(0).get("total"));
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             Map<String,Object> map = new HashedMap();
 | 
	
		
			
				|  |  |             map.put("doctorTotal",0);
 | 
	
		
			
				|  |  |             rs.add(map);
 | 
	
		
			
				|  |  |             rs.put("doctorTotal",0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -5971,7 +5959,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 sql = "SELECT " +
 | 
	
		
			
				|  |  |                         " t.code, " +
 | 
	
		
			
				|  |  |                         " t.name, " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) num  " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) val  " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " dm_town t " +
 | 
	
		
			
				|  |  |                         " LEFT JOIN ( " +
 | 
	
	
		
			
				|  | @ -5986,12 +5974,12 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         " ) s ON s.code = t.code " +
 | 
	
		
			
				|  |  |                         " WHERE " +
 | 
	
		
			
				|  |  |                         " t.city='350200' " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC";
 | 
	
		
			
				|  |  |             }else if("2".equals(lowlevel)){
 | 
	
		
			
				|  |  |                 sql = "SELECT " +
 | 
	
		
			
				|  |  |                         " t.code, " +
 | 
	
		
			
				|  |  |                         " t.name, " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) num  " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) val  " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " dm_hospital t " +
 | 
	
		
			
				|  |  |                         " LEFT JOIN ( " +
 | 
	
	
		
			
				|  | @ -6007,12 +5995,12 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         " WHERE " +
 | 
	
		
			
				|  |  |                         " t.city='350200' " +
 | 
	
		
			
				|  |  |                         " AND LENGTH(t.code)=10 " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC";
 | 
	
		
			
				|  |  |             }else if("1".equals(lowlevel)){
 | 
	
		
			
				|  |  |                 sql = " SELECT " +
 | 
	
		
			
				|  |  |                         " t.id code, " +
 | 
	
		
			
				|  |  |                         " t.name, " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) num  " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) val  " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " wlyy_admin_team t " +
 | 
	
		
			
				|  |  |                         " LEFT JOIN ( " +
 | 
	
	
		
			
				|  | @ -6025,7 +6013,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 sql +=  "  GROUP BY " +
 | 
	
		
			
				|  |  |                         "  p.admin_team_id " +
 | 
	
		
			
				|  |  |                         " ) s ON s.code = t.id " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC ";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //区级维度
 | 
	
		
			
				|  |  |         }else if("3".equals(level)){
 | 
	
	
		
			
				|  | @ -6033,7 +6021,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 sql = "SELECT " +
 | 
	
		
			
				|  |  |                         " t.code, " +
 | 
	
		
			
				|  |  |                         " t.name, " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) num  " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) val  " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " dm_hospital t " +
 | 
	
		
			
				|  |  |                         " LEFT JOIN ( " +
 | 
	
	
		
			
				|  | @ -6050,12 +6038,12 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         " t.city='350200' " +
 | 
	
		
			
				|  |  |                         " AND LENGTH(t.code)=10 " +
 | 
	
		
			
				|  |  |                         " AND t.town ='"+area+"'" +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC";
 | 
	
		
			
				|  |  |             }else if("1".equals(lowlevel)){
 | 
	
		
			
				|  |  |                 sql = " SELECT " +
 | 
	
		
			
				|  |  |                         " t.id code, " +
 | 
	
		
			
				|  |  |                         " t.name, " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) num  " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) val  " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " wlyy_admin_team t " +
 | 
	
		
			
				|  |  |                         " LEFT JOIN ( " +
 | 
	
	
		
			
				|  | @ -6069,7 +6057,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         "  p.admin_team_id " +
 | 
	
		
			
				|  |  |                         " ) s ON s.code = t.id " +
 | 
	
		
			
				|  |  |                         " WHERE LEFT(t.org_code,6) ='"+area+"' " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC ";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //机构级维度
 | 
	
		
			
				|  |  |         }else if("2".equals(level)){
 | 
	
	
		
			
				|  | @ -6077,7 +6065,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 sql = " SELECT " +
 | 
	
		
			
				|  |  |                         " t.id code, " +
 | 
	
		
			
				|  |  |                         " t.name, " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) num  " +
 | 
	
		
			
				|  |  |                         " ifnull(s.count,0) val  " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " wlyy_admin_team t " +
 | 
	
		
			
				|  |  |                         " LEFT JOIN ( " +
 | 
	
	
		
			
				|  | @ -6091,7 +6079,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         "  p.admin_team_id " +
 | 
	
		
			
				|  |  |                         " ) s ON s.code = t.id " +
 | 
	
		
			
				|  |  |                         " WHERE t.org_code ='"+area+"'" +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC ";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         rs = jdbcTemplate.queryForList(sql);
 | 
	
	
		
			
				|  | @ -6101,11 +6089,11 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getPrescriptionAgeTotal(String level,String area,String disease){
 | 
	
		
			
				|  |  |     public Map<String,Object> getPrescriptionAgeTotal(String level,String area,String disease){
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
		
			
				|  |  |                 " ( SELECT count(pe.patient) 0age from (" +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
		
			
				|  |  |                 "   count(1) 0age " +
 | 
	
		
			
				|  |  |                 "   DISTINCT p.patient " +
 | 
	
		
			
				|  |  |                 "  FROM " +
 | 
	
		
			
				|  |  |                 "   wlyy_prescription p " +
 | 
	
		
			
				|  |  |                 "  JOIN wlyy_patient pt ON pt. CODE = p.patient ";
 | 
	
	
		
			
				|  | @ -6115,11 +6103,11 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "   )>= 0 " +
 | 
	
		
			
				|  |  |                 "  AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
 | 
	
		
			
				|  |  |                 "   RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
 | 
	
		
			
				|  |  |                 "  ) <= 6 " +
 | 
	
		
			
				|  |  |                 "  ) <= 6 ) pe" +
 | 
	
		
			
				|  |  |                 " ) 0age, " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
		
			
				|  |  |                 " ( SELECT count(pe.patient) 7age from (" +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
		
			
				|  |  |                 "   count(1) 7age " +
 | 
	
		
			
				|  |  |                 "   DISTINCT p.patient " +
 | 
	
		
			
				|  |  |                 "  FROM " +
 | 
	
		
			
				|  |  |                 "   wlyy_prescription p " +
 | 
	
		
			
				|  |  |                 "  JOIN wlyy_patient pt ON pt. CODE = p.patient ";
 | 
	
	
		
			
				|  | @ -6129,11 +6117,11 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "   ) >= 7 " +
 | 
	
		
			
				|  |  |                 "  AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
 | 
	
		
			
				|  |  |                 "   RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
 | 
	
		
			
				|  |  |                 "  ) <= 18 " +
 | 
	
		
			
				|  |  |                 "  ) <= 18 ) pe" +
 | 
	
		
			
				|  |  |                 " ) 7age, " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
		
			
				|  |  |                 " ( SELECT count(pe.patient) 19age from (" +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
		
			
				|  |  |                 "   count(1) 19age " +
 | 
	
		
			
				|  |  |                 "   DISTINCT p.patient " +
 | 
	
		
			
				|  |  |                 "  FROM " +
 | 
	
		
			
				|  |  |                 "   wlyy_prescription p " +
 | 
	
		
			
				|  |  |                 "  JOIN wlyy_patient pt ON pt. CODE = p.patient " ;
 | 
	
	
		
			
				|  | @ -6143,11 +6131,11 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "   ) >= 19 " +
 | 
	
		
			
				|  |  |                 "  AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
 | 
	
		
			
				|  |  |                 "   RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
 | 
	
		
			
				|  |  |                 "  ) <= 30 " +
 | 
	
		
			
				|  |  |                 "  ) <= 30 ) pe" +
 | 
	
		
			
				|  |  |                 " ) 19age, " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
		
			
				|  |  |                 " ( SELECT count(pe.patient) 31age from (" +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
		
			
				|  |  |                 "   count(1) 31age " +
 | 
	
		
			
				|  |  |                 "   DISTINCT p.patient " +
 | 
	
		
			
				|  |  |                 "  FROM " +
 | 
	
		
			
				|  |  |                 "   wlyy_prescription p " +
 | 
	
		
			
				|  |  |                 "  JOIN wlyy_patient pt ON pt. CODE = p.patient " ;
 | 
	
	
		
			
				|  | @ -6157,11 +6145,11 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "   ) >= 31 " +
 | 
	
		
			
				|  |  |                 "  AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
 | 
	
		
			
				|  |  |                 "   RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
 | 
	
		
			
				|  |  |                 "  ) <= 50 " +
 | 
	
		
			
				|  |  |                 "  ) <= 50 ) pe" +
 | 
	
		
			
				|  |  |                 " ) 31age, " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
		
			
				|  |  |                 " ( SELECT count(pe.patient) 51age from (" +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
		
			
				|  |  |                 "   count(1) 51age " +
 | 
	
		
			
				|  |  |                 "   DISTINCT p.patient " +
 | 
	
		
			
				|  |  |                 "  FROM " +
 | 
	
		
			
				|  |  |                 "   wlyy_prescription p " +
 | 
	
		
			
				|  |  |                 "  JOIN wlyy_patient pt ON pt. CODE = p.patient ";
 | 
	
	
		
			
				|  | @ -6171,27 +6159,27 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "   ) >= 51 " +
 | 
	
		
			
				|  |  |                 "  AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
 | 
	
		
			
				|  |  |                 "   RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
 | 
	
		
			
				|  |  |                 "  ) <= 64 " +
 | 
	
		
			
				|  |  |                 "  ) <= 64 ) pe" +
 | 
	
		
			
				|  |  |                 "  ) 51age, " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
		
			
				|  |  |                 " ( SELECT count(pe.patient) 65age from (" +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
		
			
				|  |  |                 "   count(1) 65age " +
 | 
	
		
			
				|  |  |                 "   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 " +
 | 
	
		
			
				|  |  |                 "   ) >= 65 ) pe" +
 | 
	
		
			
				|  |  |                 "  ) 65age, " +
 | 
	
		
			
				|  |  |                 "  ( " +
 | 
	
		
			
				|  |  |                 "  ( SELECT count(pe.patient) total from (" +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
		
			
				|  |  |                 "   count(1) total " +
 | 
	
		
			
				|  |  |                 "   DISTINCT p.patient " +
 | 
	
		
			
				|  |  |                 "  FROM " +
 | 
	
		
			
				|  |  |                 "   wlyy_prescription p " +
 | 
	
		
			
				|  |  |                 "  JOIN wlyy_patient pt ON pt. CODE = p.patient " ;
 | 
	
		
			
				|  |  |         sql = setLevelAndDisSql2(sql,disease,level,area);
 | 
	
		
			
				|  |  |         sql += "  ) total";
 | 
	
		
			
				|  |  |         sql += " ) pe ) total";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(rs!=null&&rs.size()>0){
 | 
	
	
		
			
				|  | @ -6210,7 +6198,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |             rs.get(0).put("51ageRate",getAgeRate(age51,total));
 | 
	
		
			
				|  |  |             rs.get(0).put("65ageRate",getAgeRate(age65,total));
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |         return rs.get(0);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String getAgeRate(Long age,Long total){
 | 
	
	
		
			
				|  | @ -6233,10 +6221,8 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |         return "0";
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getPrescriptionAgeHistogram(String level,String area,String disease,String startDate,String endDate){
 | 
	
		
			
				|  |  |     public Map<String,Object> getPrescriptionAgeHistogram(String level,String area,String disease){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         startDate += " 00:00:00";
 | 
	
		
			
				|  |  |         endDate += " 23:59:59";
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
	
		
			
				|  | @ -6251,8 +6237,6 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "  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)  " +
 | 
	
	
		
			
				|  | @ -6270,8 +6254,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "  AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
 | 
	
		
			
				|  |  |                 "   RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
 | 
	
		
			
				|  |  |                 "  ) <= 6 " +
 | 
	
		
			
				|  |  |                 "  AND p.create_time >='"+startDate+"'  " +
 | 
	
		
			
				|  |  |                 "  AND p.create_time <='"+endDate+"') c " +
 | 
	
		
			
				|  |  |                 " ) c " +
 | 
	
		
			
				|  |  |                 " ) 0people, " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
	
		
			
				|  | @ -6286,8 +6269,6 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "  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)  " +
 | 
	
	
		
			
				|  | @ -6306,8 +6287,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "  AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
 | 
	
		
			
				|  |  |                 "   RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
 | 
	
		
			
				|  |  |                 "  ) <= 18 " +
 | 
	
		
			
				|  |  |                 "  AND p.create_time >='"+startDate+"'  " +
 | 
	
		
			
				|  |  |                 "  AND p.create_time <='"+endDate+"') c " +
 | 
	
		
			
				|  |  |                 " ) c " +
 | 
	
		
			
				|  |  |                 " ) 7people, " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
	
		
			
				|  | @ -6322,8 +6302,6 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "  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)  " +
 | 
	
	
		
			
				|  | @ -6341,8 +6319,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "  AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
 | 
	
		
			
				|  |  |                 "   RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
 | 
	
		
			
				|  |  |                 "  ) <= 30 " +
 | 
	
		
			
				|  |  |                 "  AND p.create_time >='"+startDate+"'  " +
 | 
	
		
			
				|  |  |                 "  AND p.create_time <='"+endDate+"') c " +
 | 
	
		
			
				|  |  |                 "  ) c " +
 | 
	
		
			
				|  |  |                 "  ) 19people, " +
 | 
	
		
			
				|  |  |                 "  ( " +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
	
		
			
				|  | @ -6357,8 +6334,6 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "  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)  " +
 | 
	
	
		
			
				|  | @ -6376,8 +6351,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "  AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
 | 
	
		
			
				|  |  |                 "   RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
 | 
	
		
			
				|  |  |                 "  ) <= 50 " +
 | 
	
		
			
				|  |  |                 "  AND p.create_time >='"+startDate+"'  " +
 | 
	
		
			
				|  |  |                 "  AND p.create_time <='"+endDate+"') c " +
 | 
	
		
			
				|  |  |                 "  ) c " +
 | 
	
		
			
				|  |  |                 "  ) 31people, " +
 | 
	
		
			
				|  |  |                 "  ( " +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
	
		
			
				|  | @ -6392,8 +6366,6 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "  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)  " +
 | 
	
	
		
			
				|  | @ -6411,8 +6383,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 "  AND YEAR (CURDATE()) - YEAR (birthday) - ( " +
 | 
	
		
			
				|  |  |                 "   RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
 | 
	
		
			
				|  |  |                 "  ) <= 64 " +
 | 
	
		
			
				|  |  |                 "  AND p.create_time >='"+startDate+"'  " +
 | 
	
		
			
				|  |  |                 "  AND p.create_time <='"+endDate+"') c " +
 | 
	
		
			
				|  |  |                 "  ) c " +
 | 
	
		
			
				|  |  |                 " ) 51people, " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
	
		
			
				|  | @ -6424,8 +6395,6 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |         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)  " +
 | 
	
	
		
			
				|  | @ -6440,8 +6409,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |         sql +=  " AND  YEAR (CURDATE()) - YEAR (birthday) - ( " +
 | 
	
		
			
				|  |  |                 "    RIGHT (CURDATE(), 5) < RIGHT (birthday, 5) " +
 | 
	
		
			
				|  |  |                 "   ) >= 65 " +
 | 
	
		
			
				|  |  |                 "  AND p.create_time >='"+startDate+"'  " +
 | 
	
		
			
				|  |  |                 "  AND p.create_time <='"+endDate+"') c " +
 | 
	
		
			
				|  |  |                 "  ) c " +
 | 
	
		
			
				|  |  |                 " ) 65people";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
	
		
			
				|  | @ -6470,7 +6438,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |             rs.get(0).put("65ageRate",getAgeRateLine(age65,people65));
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |         return rs.get(0);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getPrescriptionAgeLowLevel(String level,String lowlevel,String area,String disease) {
 | 
	
	
		
			
				|  | @ -6480,7 +6448,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 String sql = "SELECT " +
 | 
	
		
			
				|  |  |                         " tw.`code`, " +
 | 
	
		
			
				|  |  |                         " tw.`name`, " +
 | 
	
		
			
				|  |  |                         "  ifnull(c.total,0) num " +
 | 
	
		
			
				|  |  |                         "  ifnull(c.total,0) val " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " dm_town tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                         " SELECT " +
 | 
	
	
		
			
				|  | @ -6501,14 +6469,14 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         " ) c ON c.code = tw.code " +
 | 
	
		
			
				|  |  |                         " WHERE " +
 | 
	
		
			
				|  |  |                         " tw.city = '350200' " +
 | 
	
		
			
				|  |  |                         "   ORDER BY num DESC ";
 | 
	
		
			
				|  |  |                         "   ORDER BY val 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 " +
 | 
	
		
			
				|  |  |                         "  ifnull(c.total,0) val " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " dm_hospital tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                         " SELECT " +
 | 
	
	
		
			
				|  | @ -6530,14 +6498,14 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         " WHERE " +
 | 
	
		
			
				|  |  |                         " tw.city = '350200' " +
 | 
	
		
			
				|  |  |                         " AND LENGTH(tw.code)=10 " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC ";
 | 
	
		
			
				|  |  |                         " ORDER BY val 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 " +
 | 
	
		
			
				|  |  |                         "  ifnull(c.total,0) val " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " wlyy_admin_team tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                         " SELECT " +
 | 
	
	
		
			
				|  | @ -6558,7 +6526,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         " ) c ON c.code = tw.id " +
 | 
	
		
			
				|  |  |                         " WHERE " +
 | 
	
		
			
				|  |  |                         " 1=1  " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC ";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC ";
 | 
	
		
			
				|  |  |                 List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |                 statisticsAllService.translateTeamLeaderName2(rs);
 | 
	
		
			
				|  |  |                 return rs;
 | 
	
	
		
			
				|  | @ -6568,7 +6536,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 String sql = "SELECT " +
 | 
	
		
			
				|  |  |                         " tw.`code`, " +
 | 
	
		
			
				|  |  |                         " tw.`name`, " +
 | 
	
		
			
				|  |  |                         "  ifnull(c.total,0) num " +
 | 
	
		
			
				|  |  |                         "  ifnull(c.total,0) val " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " dm_hospital tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                         " SELECT " +
 | 
	
	
		
			
				|  | @ -6592,14 +6560,14 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         " tw.city = '350200' " +
 | 
	
		
			
				|  |  |                         " AND tw.town ='"+area+"' " +
 | 
	
		
			
				|  |  |                         " AND LENGTH(tw.code)=10 " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC ";
 | 
	
		
			
				|  |  |                         " ORDER BY val 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 " +
 | 
	
		
			
				|  |  |                         "  ifnull(c.total,0) val " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " wlyy_admin_team tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                         " SELECT " +
 | 
	
	
		
			
				|  | @ -6622,7 +6590,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         " WHERE " +
 | 
	
		
			
				|  |  |                         " 1=1  " +
 | 
	
		
			
				|  |  |                         " AND LEFT(tw.org_code,6) ='"+area+"' " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC ";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC ";
 | 
	
		
			
				|  |  |                 List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |                 statisticsAllService.translateTeamLeaderName2(rs);
 | 
	
		
			
				|  |  |                 return rs;
 | 
	
	
		
			
				|  | @ -6632,7 +6600,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                 String sql ="SELECT " +
 | 
	
		
			
				|  |  |                         " tw.id code, " +
 | 
	
		
			
				|  |  |                         " tw.`name`, " +
 | 
	
		
			
				|  |  |                         "  ifnull(c.total,0) num " +
 | 
	
		
			
				|  |  |                         "  ifnull(c.total,0) val " +
 | 
	
		
			
				|  |  |                         " FROM " +
 | 
	
		
			
				|  |  |                         " wlyy_admin_team tw LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                         " SELECT " +
 | 
	
	
		
			
				|  | @ -6655,7 +6623,7 @@ public class StatisticsService extends BaseService {
 | 
	
		
			
				|  |  |                         " WHERE " +
 | 
	
		
			
				|  |  |                         " 1=1  " +
 | 
	
		
			
				|  |  |                         " AND tw.org_code ='"+area+"' " +
 | 
	
		
			
				|  |  |                         " ORDER BY num DESC ";
 | 
	
		
			
				|  |  |                         " ORDER BY val DESC ";
 | 
	
		
			
				|  |  |                 List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |                 statisticsAllService.translateTeamLeaderName2(rs);
 | 
	
		
			
				|  |  |                 return rs;
 |