| 
					
				 | 
			
			
				@ -11,6 +11,7 @@ import com.yihu.wlyy.statistics.model.system.City; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.statistics.model.system.Town; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.statistics.model.team.AdminTeam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.statistics.util.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.logging.log4j.message.StringFormattedMessage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.json.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -53,19 +54,19 @@ public class RedisStorage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void saveByLevel1(List<Map<String, List<ETLModel>>> data,List<Map<String, List<ETLModel>>> deleteData, String wlyyQuotaId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<AdminTeam> adminTeams=doctorAdminTeamDao.findAllTeam(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, AdminTeam> adminTeamMap = new HashMap<String, AdminTeam>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        adminTeamMap = new HashMap<String, AdminTeam>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (AdminTeam adminTeam : adminTeams) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            adminTeamMap.put(adminTeam.getId()+"", adminTeam); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //查找出系统全部的机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Hospital> hospitals = hospitalDao.findHospitalzxFWZ(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Hospital> hospitalsMap = new HashMap<String, Hospital>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        hospitalsMap = new HashMap<String, Hospital>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Hospital hospital : hospitals) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            hospitalsMap.put(hospital.getCode(), hospital); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //查找出厦门市全部的区 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Town> towns = townDao.findByCityCode(Constant.city); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Town> townsMap = new HashMap<String, Town>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        townsMap = new HashMap<String, Town>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Town town : towns) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            townsMap.put(town.getCode(), town); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -90,14 +91,14 @@ public class RedisStorage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存全科团队 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveLevel1Team(wlyyQuotaId,adminTeamMap, adminTeam); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存市 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveLevel1City(wlyyQuotaId, cityMap, cityTeam,deleteData.get(3)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存区 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveLevel1Town(wlyyQuotaId, townsMap, townTeam,deleteData.get(2)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveLevel1Org(wlyyQuotaId, hospitalsMap, orgTeam,deleteData.get(1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存全科团队 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveLevel1Team(wlyyQuotaId,adminTeamMap, adminTeam,deleteData.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //保存市 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            saveLevel1City(wlyyQuotaId, cityMap, cityTeam,deleteData.get(3)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //保存区 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            saveLevel1Town(wlyyQuotaId, townsMap, townTeam,deleteData.get(2)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //保存机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            saveLevel1Org(wlyyQuotaId, hospitalsMap, orgTeam,deleteData.get(1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //保存全科团队 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            saveLevel1Team(wlyyQuotaId,adminTeamMap, adminTeam,deleteData.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -584,19 +585,19 @@ public class RedisStorage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private void saveByLevel2Public(List<Map<String, Map<String, List<ETLModel>>>> data,List<Map<String, Map<String, List<ETLModel>>>> deleteData, String wlyyQuotaId, Integer foreachNum, Integer type, Integer start) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<AdminTeam> adminTeams=doctorAdminTeamDao.findAllTeam(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, AdminTeam> adminTeamMap = new HashMap<String, AdminTeam>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        adminTeamMap = new HashMap<String, AdminTeam>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (AdminTeam adminTeam : adminTeams) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            adminTeamMap.put(adminTeam.getId()+"", adminTeam); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //查找出系统全部的机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Hospital> hospitals = hospitalDao.findHospitalzxFWZ(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Hospital> hospitalsMap = new HashMap<String, Hospital>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        hospitalsMap = new HashMap<String, Hospital>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Hospital hospital : hospitals) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            hospitalsMap.put(hospital.getCode(), hospital); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //查找出厦门市全部的区 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Town> towns = townDao.findByCityCode(Constant.city); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Town> townsMap = new HashMap<String, Town>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         townsMap = new HashMap<String, Town>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Town town : towns) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            townsMap.put(town.getCode(), town); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -613,14 +614,14 @@ public class RedisStorage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Map<String, List<ETLModel>>> cityTeam=data.get(3);//市的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(deleteData!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存市 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveLevel2City(wlyyQuotaId, cityMap, cityTeam,deleteData.get(3),foreachNum,type,start); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存区 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveLevel2Town(wlyyQuotaId, townsMap, townTeam,deleteData.get(2),foreachNum,type,start); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveLevel2Org(wlyyQuotaId, hospitalsMap, orgTeam,deleteData.get(1),foreachNum,type,start); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存全科团队 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveLevel2Team(wlyyQuotaId, adminTeamMap, adminTeam,deleteData.get(0),foreachNum,type,start); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //保存市 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            saveLevel2City(wlyyQuotaId, cityMap, cityTeam,deleteData.get(3),foreachNum,type,start); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //保存区 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            saveLevel2Town(wlyyQuotaId, townsMap, townTeam,deleteData.get(2),foreachNum,type,start); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //保存机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            saveLevel2Org(wlyyQuotaId, hospitalsMap, orgTeam,deleteData.get(1),foreachNum,type,start); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //保存全科团队 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            saveLevel2Team(wlyyQuotaId, adminTeamMap, adminTeam,deleteData.get(0),foreachNum,type,start); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存市 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveLevel2City(wlyyQuotaId, cityMap, cityTeam,foreachNum,type,start); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -922,14 +923,12 @@ public class RedisStorage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            keys.add(key.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redisTemplate.opsForValue().set(key.toString(), entry.getValue().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        townjr.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //保存机构下面全部的团队 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map.Entry<String,JSONArray> entry:orgjr.entrySet()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            key=new StringBuffer("quota:"+wlyyQuotaId+":2:"+entry.getKey()+":1:"+timeKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            keys.add(key.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redisTemplate.opsForValue().set(key.toString(), entry.getValue().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        orgjr.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private void saveLevel1Team(String wlyyQuotaId, Map<String, AdminTeam> adminTeamMap, Map<String, List<ETLModel>> adminTeam, Map<String, List<ETLModel>> deleteAdminTeam) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map.Entry<String,AdminTeam> entry:adminTeamMap.entrySet()){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -990,7 +989,6 @@ public class RedisStorage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            keys.add(key.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redisTemplate.opsForValue().set(key.toString(), entry.getValue().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        townjr.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private void addJO(Map<String, JSONArray> townjr,String key, JSONObject jo) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1111,7 +1109,7 @@ public class RedisStorage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jo.put("name", entry.getValue().getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jo.put("code", entry.getValue().getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jr.put(jo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":"+entry.getKey()+":3:"+timeKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":3:"+entry.getKey()+":"+timeKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            keys.add(key.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redisTemplate.opsForValue().set(key.toString(), jo.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1121,6 +1119,7 @@ public class RedisStorage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        redisTemplate.opsForValue().set(key.toString(), jr.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private void saveLevel1City(String wlyyQuotaId, Map<String, City> cityMap, Map<String, List<ETLModel>> cityTeam, Map<String, List<ETLModel>> deleteCityTeam) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray jr=new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map.Entry<String,City> entry:cityMap.entrySet()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jo=new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer num=0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1138,8 +1137,11 @@ public class RedisStorage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jo.put("num", num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jo.put("name", entry.getValue().getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jo.put("code", entry.getValue().getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redisTemplate.opsForValue().set(new StringBuffer("quota:"+wlyyQuotaId+":4:"+entry.getKey()).toString(), jo.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jr.put(jo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":4:"+Constant.city+":"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        keys.add(key.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        redisTemplate.opsForValue().set(key.toString(), jr.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private void saveLevel1City(String wlyyQuotaId, Map<String, City> cityMap, Map<String, List<ETLModel>> cityTeam) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map.Entry<String,City> entry:cityMap.entrySet()){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1153,10 +1155,11 @@ public class RedisStorage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jo.put("num", num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jo.put("name", entry.getValue().getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jo.put("code", entry.getValue().getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":4:"+entry.getKey()+":"+timeKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":4:"+Constant.city+":"+timeKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            keys.add(key.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redisTemplate.opsForValue().set(key.toString(), jo.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String getLevel2Name(String i, Integer type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        switch (type){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1178,7 +1181,7 @@ public class RedisStorage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            case  5:{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //疾病 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return Constant.getLevelExpenseName(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return Constant.getlevelHealthFbName(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            default:{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return ""; 
			 |