| 
					
				 | 
			
			
				@ -4,18 +4,21 @@ import com.yihu.wlyy.entity.address.Town; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.organization.Hospital; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.statistics.PopulationBase; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.statistics.WlyyQuotaResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.address.CityDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.address.TownDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.doctor.DoctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.organization.HospitalDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.statistics.PopulationBaseDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.statistics.WlyyQuotaResultDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.service.BaseService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.util.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.json.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.data.redis.core.StringRedisTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.BeanPropertyRowMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.JdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.util.StringUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -46,6 +49,8 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    PopulationBaseDao peopleNumDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private StringRedisTemplate redisTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WlyyQuotaResultDao wlyyQuotaResultDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取时间戳 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -145,7 +150,7 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "     wlyy_quota_result " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "     quato_code = ? " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   and level1_type = ? and del = '1'" ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   and level1_type = ? and del = '1'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level == 4) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 市级别 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -273,7 +278,7 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (peopleNum != null && peopleNum.getNum() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rate", df.format((signAmount * 1.0000) / peopleNum.getNum() * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rateString", signAmount+"/"+peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rateString", signAmount + "/" + peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("sign", signAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("people", peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -302,12 +307,12 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (peopleNum != null && peopleNum.getTaskNum() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rate", df.format((signAmount * 1.0000) / peopleNum.getTaskNum() * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rateString", signAmount +"/"+ peopleNum.getTaskNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rateString", signAmount + "/" + peopleNum.getTaskNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("sign", signAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("people", peopleNum.getTaskNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rate", "0.0000"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rateString","0/0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rateString", "0/0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("sign", signAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("people", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -430,13 +435,13 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        signRate.put("sign", total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        signRate.put("people", num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        signRate.put("rate", df.format((total * 1.0000) / num * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        signRate.put("rateString",total+"/"+num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        signRate.put("rateString", total + "/" + num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("signRate", signRate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject signTaskRate = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        signTaskRate.put("sign", total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        signTaskRate.put("people", taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        signTaskRate.put("rate", df.format((total * 1.0000) / taskNum * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        signTaskRate.put("rateString", total  +"/"+taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        signTaskRate.put("rateString", total + "/" + taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("signTaskRate", signTaskRate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return json; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -503,9 +508,9 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / num * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / taskNum * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRate", df.format(taskNum * 1.0000 / num * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount")+"/"+ num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount")+"/"+ taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString",taskNum+"/"+num ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") + "/" + num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount") + "/" + taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString", taskNum + "/" + num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("num", num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("task", taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -528,9 +533,9 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / num * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / taskNum * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRate", df.format(taskNum * 1.0000 / num * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount")+"/"+ num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount")+"/"+ taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString",taskNum+"/"+num ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") + "/" + num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount") + "/" + taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString", taskNum + "/" + num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("num", num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("task", taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -538,7 +543,7 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if((level==4&&"1".equals(lowLevel))||(level==2)||(level==3&&"1".equals(lowLevel))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ((level == 4 && "1".equals(lowLevel)) || (level == 2) || (level == 3 && "1".equals(lowLevel))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                translateTeamLeaderName(resultList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -609,9 +614,9 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getNum() * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getTaskNum() * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRate", df.format(peopleNum.getTaskNum() * 1.0000 / peopleNum.getNum() * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") +"/"+ peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount")+"/"+  peopleNum.getTaskNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString",peopleNum.getTaskNum()+"/"+ peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") + "/" + peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount") + "/" + peopleNum.getTaskNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString", peopleNum.getTaskNum() + "/" + peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("num", peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("task", peopleNum.getTaskNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -621,9 +626,9 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getInt("num") * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getInt("taskNum") * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRate", df.format(peopleNum.getInt("taskNum") * 1.0000 / peopleNum.getInt("num") * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") +"/"+ peopleNum.getInt("num") ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString",map.get("amount") +"/"+peopleNum.getInt("taskNum") ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString",peopleNum.getInt("taskNum") +"/"+ peopleNum.getInt("num")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") + "/" + peopleNum.getInt("num")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount") + "/" + peopleNum.getInt("taskNum")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString", peopleNum.getInt("taskNum") + "/" + peopleNum.getInt("num")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("num", peopleNum.getInt("num")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("task", peopleNum.getInt("taskNum")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -631,7 +636,7 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if((level==4&&"1".equals(lowLevel))||(level==2)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ((level == 4 && "1".equals(lowLevel)) || (level == 2)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                translateTeamLeaderName(resultList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -703,9 +708,9 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getNum() * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getTaskNum() * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRate", df.format(peopleNum.getTaskNum() * 1.0000 / peopleNum.getNum() * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") +"/"+ peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount")+"/"+  peopleNum.getTaskNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString",peopleNum.getTaskNum()+"/"+ peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") + "/" + peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount") + "/" + peopleNum.getTaskNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString", peopleNum.getTaskNum() + "/" + peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("num", peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("task", peopleNum.getTaskNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -715,9 +720,9 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getInt("num") * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getInt("taskNum") * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRate", df.format(peopleNum.getInt("taskNum") * 1.0000 / peopleNum.getInt("num") * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") +"/"+ peopleNum.getInt("num") ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString",map.get("amount") +"/"+peopleNum.getInt("taskNum") ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString",peopleNum.getInt("taskNum") +"/"+ peopleNum.getInt("num")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") + "/" + peopleNum.getInt("num")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount") + "/" + peopleNum.getInt("taskNum")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString", peopleNum.getInt("taskNum") + "/" + peopleNum.getInt("num")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("num", peopleNum.getInt("num")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("task", peopleNum.getInt("taskNum")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -725,7 +730,7 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if((level==4&&"1".equals(lowLevel))||(level==2)||(level==3&&"1".equals(lowLevel))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ((level == 4 && "1".equals(lowLevel)) || (level == 2) || (level == 3 && "1".equals(lowLevel))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                translateTeamLeaderName(resultList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -745,7 +750,6 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return new JSONArray(resultList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return new JSONArray(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -779,14 +783,14 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   wlyy_quota_result" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  where quota_date = ? and quato_code = ?"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int rows = jdbcTemplate.queryForObject(sql1,Integer.class,date,index); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rows==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Date tdate=sdf.parse(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Calendar day = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                day.setTime(tdate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                day.add(Calendar.DATE, -1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                date = new SimpleDateFormat("yyyy-MM-dd").format(day.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int rows = jdbcTemplate.queryForObject(sql1, Integer.class, date, index); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rows == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Date tdate = sdf.parse(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Calendar day = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            day.setTime(tdate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            day.add(Calendar.DATE, -1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            date = new SimpleDateFormat("yyyy-MM-dd").format(day.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level == 4) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -839,7 +843,7 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("amount", 0L); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("num", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("rate", 0.0000D); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("rateString","0/0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("rateString", "0/0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                DecimalFormat df = new DecimalFormat("0.0000"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] args = map.get("amount").toString().split("/"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -847,11 +851,11 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("amount", Long.valueOf(args[0])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("num", Long.valueOf(args[1])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("rate", df.format((Long.valueOf(args[0]) * 1.0000) / Long.valueOf(args[1]) * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("rateString", args[0] +"/"+ args[1]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("rateString", args[0] + "/" + args[1]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if((level==4&&"1".equals(lowLevel))||(level==2)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ((level == 4 && "1".equals(lowLevel)) || (level == 2)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            translateTeamLeaderName(resultList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1173,7 +1177,7 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                towns = townDao.findByCityCode(area); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if (level == 3) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Town town = townDao.findByCode(area); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(town != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (town != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    towns.add(town); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1255,7 +1259,7 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                towns = townDao.findByCityCode(area); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if (level == 3) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Town town = townDao.findByCode(area); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(town != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (town != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    towns.add(town); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1359,7 +1363,7 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (Map<String, Object> map : resultList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    double rateG = (total > 0 ? ((long) map.get("amount")) * 1.0000 / total * 100 : 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("rate", df.format(rateG)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("rateString",map.get("amount")+"/"+total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("rateString", map.get("amount") + "/" + total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (index.equals("6") && resultList.size() > 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1990,7 +1994,7 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Calendar next = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            next.setTime(days.get(days.size() - 1).getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            next.add(Calendar.DATE, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (df.format(next.getTime()).compareTo(endDate) < 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (next.getTime().before(DateUtil.strToDate(endDate, "yyyy-MM-dd"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                days.add(next); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                days.add(end); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2158,7 +2162,7 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                next.add(Calendar.DATE, 7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (df.format(next.getTime()).compareTo(df.format(end.getTime())) < 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (next.getTime().before(DateUtil.strToDate(endDate, "yyyy-MM-dd"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                days.add(next); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (i == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    firstEnd = df.format(next.getTime()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2349,7 +2353,7 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            next.set(Calendar.DAY_OF_MONTH, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            next.add(Calendar.DAY_OF_MONTH, -1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (df.format(next.getTime()).compareTo(df.format(end.getTime())) < 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (next.getTime().before(DateUtil.strToDate(endDate, "yyyy-MM-dd"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                days.add(next); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                days.add(end); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2515,9 +2519,9 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getNum() * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getTaskNum() * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRate", df.format(peopleNum.getTaskNum() * 1.0000 / peopleNum.getNum() * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") +"/"+ peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount")+"/"+  peopleNum.getTaskNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString",peopleNum.getTaskNum()+"/"+ peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") + "/" + peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount") + "/" + peopleNum.getTaskNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString", peopleNum.getTaskNum() + "/" + peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("num", peopleNum.getNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("task", peopleNum.getTaskNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2527,9 +2531,9 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getInt("num") * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getInt("taskNum") * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRate", df.format(peopleNum.getInt("taskNum") * 1.0000 / peopleNum.getInt("num") * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") +"/"+ peopleNum.getInt("num") ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString",map.get("amount") +"/"+peopleNum.getInt("taskNum") ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString",peopleNum.getInt("taskNum") +"/"+ peopleNum.getInt("num")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") + "/" + peopleNum.getInt("num")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount") + "/" + peopleNum.getInt("taskNum")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString", peopleNum.getInt("taskNum") + "/" + peopleNum.getInt("num")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("num", peopleNum.getInt("num")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("task", peopleNum.getInt("taskNum")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2553,39 +2557,39 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //计算签约人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> signList = getTodayLowLevelTotal2(area, level, "1", sort, lowLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,Object> signMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(signList!=null&&signList.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, Object> signMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (signList != null && signList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //将List转化为Map减小循环层数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for(Map<String, Object> sign :signList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    signMap.put(sign.get("code").toString(),sign); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (Map<String, Object> sign : signList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    signMap.put(sign.get("code").toString(), sign); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(Map<String, Object> map :resultList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Long bindCout = (Long)map.get("amount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Map<String, Object> sMap = (Map<String, Object>)signMap.get(map.get("code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Long signCout = (Long)sMap.get("amount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if((signCout!=null&&signCout!=0)&&(bindCout!=null&&bindCout!=0)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    double rate = (double)bindCout/signCout*100; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String, Object> map : resultList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Long bindCout = (Long) map.get("amount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Map<String, Object> sMap = (Map<String, Object>) signMap.get(map.get("code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Long signCout = (Long) sMap.get("amount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ((signCout != null && signCout != 0) && (bindCout != null && bindCout != 0)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    double rate = (double) bindCout / signCout * 100; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    DecimalFormat decimalFormat = new DecimalFormat("0.00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("bindRate",decimalFormat.format(rate)+"%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("bindDoubleRate",rate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("bindRate","0.00%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("bindDoubleRate",0.00); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("bindRate", decimalFormat.format(rate) + "%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("bindDoubleRate", rate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("bindRate", "0.00%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("bindDoubleRate", 0.00); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if((level==4&&"1".equals(lowLevel))||(level==2)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ((level == 4 && "1".equals(lowLevel)) || (level == 2)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                translateTeamLeaderName(resultList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 排序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resultList.sort(new Comparator<Map<String, Object>>() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                public int compare(Map<String, Object> o1, Map<String, Object> o2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ((double)o1.get("bindDoubleRate")>=(double)o2.get("bindDoubleRate")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ((double) o1.get("bindDoubleRate") >= (double) o2.get("bindDoubleRate")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } else if ((double)o1.get("bindDoubleRate")<(double)o2.get("bindDoubleRate")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } else if ((double) o1.get("bindDoubleRate") < (double) o2.get("bindDoubleRate")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        return 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        return 0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2600,30 +2604,31 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *  查询签约人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查询签约人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param code 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Long getQuoTaResult(int level,String code){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        StringBuffer sql = new StringBuffer("SELECT t.result FROM wlyy_quota_result t WHERE t.quato_code ='1'AND t.quota_date = DATE_SUB(curdate(),INTERVAL 1 DAY) AND t.level1_type ='"+level+"'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(level ==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Long getQuoTaResult(int level, String code) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        StringBuffer sql = new StringBuffer("SELECT t.result FROM wlyy_quota_result t WHERE t.quato_code ='1'AND t.quota_date = DATE_SUB(curdate(),INTERVAL 1 DAY) AND t.level1_type ='" + level + "'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //1: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(" AND t.qkdoctor_code = '"+code+"'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if(level == 2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(" AND t.qkdoctor_code = '" + code + "'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (level == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //2社区机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(" AND t.org_code = '"+code+"'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if(level == 3){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(" AND t.org_code = '" + code + "'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (level == 3) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //3区级 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(" AND t.town = '"+code+"'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if(level == 4){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(" AND t.town = '" + code + "'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (level == 4) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //4市级 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(" AND t.city = '"+code+"'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(" AND t.city = '" + code + "'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(resultList!=null&&resultList.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return Long.parseLong((String)resultList.get(0).get("result")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (resultList != null && resultList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return Long.parseLong((String) resultList.get(0).get("result")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return 0L; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2631,19 +2636,20 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取所有团队长信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public  Map<Integer,Map<String,Object>> getAllTeamLeaders(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<Integer, Map<String, Object>> getAllTeamLeaders() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select t.leader_code,t.id,d.name " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " from wlyy_admin_team t " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " LEFT JOIN wlyy_doctor d " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " on t.leader_code = d.code "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //将结果集转换为 map减小循环层 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<Integer,Map<String,Object>> rsMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(rs!=null&&rs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(Map<String,Object> map : rs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rsMap.put((Integer)map.get("id"),map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<Integer, Map<String, Object>> rsMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rs != null && rs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String, Object> map : rs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rsMap.put((Integer) map.get("id"), map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rsMap; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2651,71 +2657,72 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取团队长队长名字 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param leaders 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param teamCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getTeamLeaderNameByTeamCode(Map<Integer,Map<String,Object>> leaders ,int teamCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(leaders!=null&&leaders.size()>0&&teamCode!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,Object> leader = leaders.get(teamCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(leader!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return (String)leader.get("name"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getTeamLeaderNameByTeamCode(Map<Integer, Map<String, Object>> leaders, int teamCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (leaders != null && leaders.size() > 0 && teamCode != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, Object> leader = leaders.get(teamCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (leader != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return (String) leader.get("name"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> translateTeamLeaderName(List<Map<String,Object>> rs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<Integer,Map<String,Object>> leaders = getAllTeamLeaders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(rs!=null&&rs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(Map<String,Object> r :rs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = (String)r.get("code"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String name = getTeamLeaderNameByTeamCode(leaders,Integer.parseInt(id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(org.apache.commons.lang3.StringUtils.isNotBlank(name)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    r.put("name",name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> translateTeamLeaderName(List<Map<String, Object>> rs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<Integer, Map<String, Object>> leaders = getAllTeamLeaders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rs != null && rs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String, Object> r : rs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = (String) r.get("code"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String name = getTeamLeaderNameByTeamCode(leaders, Integer.parseInt(id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (org.apache.commons.lang3.StringUtils.isNotBlank(name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    r.put("name", name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray translateTeamLeaderName(JSONArray rs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<Integer,Map<String,Object>> leaders = getAllTeamLeaders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(rs!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<rs.length();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray translateTeamLeaderName(JSONArray rs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<Integer, Map<String, Object>> leaders = getAllTeamLeaders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rs != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < rs.length(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject r = rs.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Integer id = (Integer)r.get("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String name = getTeamLeaderNameByTeamCode(leaders,id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(org.apache.commons.lang3.StringUtils.isNotBlank(name)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    r.put("name",name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Integer id = (Integer) r.get("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String name = getTeamLeaderNameByTeamCode(leaders, id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (org.apache.commons.lang3.StringUtils.isNotBlank(name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    r.put("name", name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray translateTeamLeaderNameByCode(JSONArray rs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<Integer,Map<String,Object>> leaders = getAllTeamLeaders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(rs!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<rs.length();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray translateTeamLeaderNameByCode(JSONArray rs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<Integer, Map<String, Object>> leaders = getAllTeamLeaders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rs != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < rs.length(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject r = rs.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = (String)r.get("code"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String name = getTeamLeaderNameByTeamCode(leaders,Integer.parseInt(id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(org.apache.commons.lang3.StringUtils.isNotBlank(name)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    r.put("name",name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = (String) r.get("code"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String name = getTeamLeaderNameByTeamCode(leaders, Integer.parseInt(id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (org.apache.commons.lang3.StringUtils.isNotBlank(name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    r.put("name", name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<AdminTeam> translateAdminTeamLeaderName(List<AdminTeam> rs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<Integer,Map<String,Object>> leaders = getAllTeamLeaders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(rs!=null&&rs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(AdminTeam team :rs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<AdminTeam> translateAdminTeamLeaderName(List<AdminTeam> rs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<Integer, Map<String, Object>> leaders = getAllTeamLeaders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rs != null && rs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (AdminTeam team : rs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Integer id = team.getId().intValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String name = getTeamLeaderNameByTeamCode(leaders,id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(org.apache.commons.lang3.StringUtils.isNotBlank(name)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String name = getTeamLeaderNameByTeamCode(leaders, id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (org.apache.commons.lang3.StringUtils.isNotBlank(name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    team.setName(name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2785,9 +2792,9 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / num * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / taskNum * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRate", df.format(taskNum * 1.0000 / num * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount")+"/"+ num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount")+"/"+ taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString",taskNum+"/"+num ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") + "/" + num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount") + "/" + taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString", taskNum + "/" + num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("num", num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("task", taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2810,16 +2817,16 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / num * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / taskNum * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRate", df.format(taskNum * 1.0000 / num * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount")+"/"+ num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount")+"/"+ taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString",taskNum+"/"+num ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("rateString", map.get("amount") + "/" + num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("taskRateString", map.get("amount") + "/" + taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("targetRateString", taskNum + "/" + num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("num", num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            map.put("task", taskNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if((level==4&&"1".equals(lowLevel))||(level==2)||(level==3&&"1".equals(lowLevel))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ((level == 4 && "1".equals(lowLevel)) || (level == 2) || (level == 3 && "1".equals(lowLevel))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                translateTeamLeaderName(resultList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2843,4 +2850,126 @@ public class StatisticsAllService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getRange(int first, int second, int i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(second==0&&first>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //如果分母为0 分子不为0 返回100% 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "100%"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if(second==0&&first==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //如果分母为0 分子为0 返回0% 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "0%"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        float size = (float) (first * 100) / second; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String filesize = df.format(size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return filesize + "%"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getLevelTwoLowLevelTotalSignAndRenew(String date, String area, int level, String index, int sort, String lowLevel, String lowCode, String year) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String lastDate = year + "-06-30"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> resultList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (date.compareTo(dateFormat.format(new Date())) >= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            查询当天及以后的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resultList = getLevelTwoTodayLowLevelTotal(area, level, index, sort, lowLevel, lowCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//           查询当天以前的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resultList = getLevelTwoTodayBeforeLowLevelTotal(date, area, level, index, sort, lowLevel, lowCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 结果为空时,自建结果集 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (resultList == null || resultList.size() < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resultList = getLowLevelMapKey(level, low_level, area); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (resultList != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            DecimalFormat df = new DecimalFormat("0.0000"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String, Object> map : resultList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("amount", map.get("amount") != null ? Long.valueOf(map.get("amount").toString()) : 0L); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //获取去年签约的人数 默认是上个年度的最后一天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                WlyyQuotaResult redisNum = findOneQuotaResult(lastDate, Integer.valueOf(low_level), "1", map.get("code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (redisNum == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    int signNum = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    int renewNum = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    signNum = Integer.valueOf(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    renewNum = Integer.valueOf(map.get("amount").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("rate", getRange(renewNum,signNum,2)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("signNum", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put("renewNum", renewNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    JSONObject peopleNum = new JSONObject(redisNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (peopleNum != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        int signNum = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        int renewNum = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        signNum = Integer.valueOf(redisNum.getResult()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        renewNum = Integer.valueOf(map.get("amount").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        map.put("rate",getRange(renewNum,signNum,2)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        map.put("signNum", signNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        map.put("renewNum", renewNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ((level == 4 && "1".equals(lowLevel)) || (level == 2) || (level == 3 && "1".equals(lowLevel))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                translateTeamLeaderName(resultList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Collections.sort(resultList, new Comparator<Map<String, Object>>() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                public int compare(Map<String, Object> o1, Map<String, Object> o2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    long map1value = (long) o1.get("amount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    long map2value = (long) o2.get("amount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (map1value - map2value > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        return sort == 1 ? -1 : 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } else if (map1value - map2value < 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        return sort == 1 ? 1 : -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return new JSONArray(resultList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取单个数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param date 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param index 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param area 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyQuotaResult findOneQuotaResult(String date, int level, String index, String area) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select * from wlyy_quota_result w where w.quota_date ='" + date + "' and w.quato_code='" + index + "' and w.level1_type= " + level; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level == 4) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 市级别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and city='" + area + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (level == 3) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 区、城镇级别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and town='" + area + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (level == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 机构级别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and org_code='" + area + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (level == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 机构级别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and qkdoctor_code ='" + area + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyQuotaResult> results = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyQuotaResult.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (results.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return results.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |