|
@ -30,9 +30,9 @@ import java.util.*;
|
|
|
@Component
|
|
|
@Scope("prototype")
|
|
|
public class RedisStorage {
|
|
|
public static String timeKey="";
|
|
|
public static String timeKey = "";
|
|
|
|
|
|
public static List<String> keys=new ArrayList<String>();//全部的key
|
|
|
public static List<String> keys = new ArrayList<String>();//全部的key
|
|
|
|
|
|
private Map<String, AdminTeam> adminTeamMap = new HashMap<String, AdminTeam>();
|
|
|
private Map<String, Hospital> hospitalsMap = new HashMap<String, Hospital>();
|
|
@ -45,18 +45,20 @@ public class RedisStorage {
|
|
|
private TownDao townDao;
|
|
|
@Autowired
|
|
|
private DoctorAdminTeamDao doctorAdminTeamDao;
|
|
|
|
|
|
/**
|
|
|
* 保存一级维度的数据
|
|
|
*
|
|
|
* @param data
|
|
|
* @param wlyyQuotaId
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void saveByLevel1(List<Map<String, List<ETLModel>>> data,List<Map<String, List<ETLModel>>> deleteData, String wlyyQuotaId) throws Exception {
|
|
|
public void saveByLevel1(List<Map<String, List<ETLModel>>> data, List<Map<String, List<ETLModel>>> deleteData, String wlyyQuotaId) throws Exception {
|
|
|
|
|
|
List<AdminTeam> adminTeams=doctorAdminTeamDao.findAllTeam();
|
|
|
List<AdminTeam> adminTeams = doctorAdminTeamDao.findAllTeam();
|
|
|
adminTeamMap = new HashMap<String, AdminTeam>();
|
|
|
for (AdminTeam adminTeam : adminTeams) {
|
|
|
adminTeamMap.put(adminTeam.getId()+"", adminTeam);
|
|
|
adminTeamMap.put(adminTeam.getId() + "", adminTeam);
|
|
|
}
|
|
|
//查找出系统全部的机构
|
|
|
List<Hospital> hospitals = hospitalDao.findHospitalzxFWZ();
|
|
@ -72,16 +74,16 @@ public class RedisStorage {
|
|
|
}
|
|
|
//全部的市
|
|
|
Map<String, City> cityMap = new HashMap<String, City>();
|
|
|
City city=new City();
|
|
|
City city = new City();
|
|
|
city.setCode(Constant.city);
|
|
|
city.setName(Constant.cityName);
|
|
|
cityMap.put(Constant.city,city);
|
|
|
|
|
|
Map<String, List<ETLModel>> adminTeam=data.get(0);//团队的数据
|
|
|
Map<String, List<ETLModel>> orgTeam=data.get(1);//机构的数据
|
|
|
Map<String, List<ETLModel>> townTeam=data.get(2);//区的数据
|
|
|
Map<String, List<ETLModel>> cityTeam=data.get(3);//市的数据
|
|
|
if(deleteData==null){
|
|
|
cityMap.put(Constant.city, city);
|
|
|
|
|
|
Map<String, List<ETLModel>> adminTeam = data.get(0);//团队的数据
|
|
|
Map<String, List<ETLModel>> orgTeam = data.get(1);//机构的数据
|
|
|
Map<String, List<ETLModel>> townTeam = data.get(2);//区的数据
|
|
|
Map<String, List<ETLModel>> cityTeam = data.get(3);//市的数据
|
|
|
if (deleteData == null) {
|
|
|
//保存市
|
|
|
saveLevel1City(wlyyQuotaId, cityMap, cityTeam);
|
|
|
//保存区
|
|
@ -89,8 +91,8 @@ public class RedisStorage {
|
|
|
//保存机构
|
|
|
saveLevel1Org(wlyyQuotaId, hospitalsMap, orgTeam);
|
|
|
//保存全科团队
|
|
|
saveLevel1Team(wlyyQuotaId,adminTeamMap, adminTeam);
|
|
|
}else{
|
|
|
saveLevel1Team(wlyyQuotaId, adminTeamMap, adminTeam);
|
|
|
} else {
|
|
|
// //保存市
|
|
|
// saveLevel1City(wlyyQuotaId, cityMap, cityTeam,deleteData.get(3));
|
|
|
// //保存区
|
|
@ -103,50 +105,54 @@ public class RedisStorage {
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 保存二级维度的数据
|
|
|
*
|
|
|
* @param data
|
|
|
* @param wlyyQuotaId
|
|
|
* @param foreachNum 标识二级维度循环的次数 例如 年龄就传6 性别就传3
|
|
|
* @param type 1 性别 2 年龄 3 用户分组 4.签约费用 5 健康分布
|
|
|
* @param foreachNum 标识二级维度循环的次数 例如 年龄就传6 性别就传3
|
|
|
* @param type 1 性别 2 年龄 3 用户分组 4.签约费用 5 健康分布
|
|
|
*/
|
|
|
public void saveByLevel2(List<Map<String, Map<String, List<ETLModel>>>> data,List<Map<String, Map<String, List<ETLModel>>>> deleteData, String wlyyQuotaId,Integer foreachNum,Integer type) throws Exception {
|
|
|
Integer start=1;
|
|
|
saveByLevel2Public(data,deleteData, wlyyQuotaId, foreachNum, type, start);
|
|
|
public void saveByLevel2(List<Map<String, Map<String, List<ETLModel>>>> data, List<Map<String, Map<String, List<ETLModel>>>> deleteData, String wlyyQuotaId, Integer foreachNum, Integer type) throws Exception {
|
|
|
Integer start = 1;
|
|
|
saveByLevel2Public(data, deleteData, wlyyQuotaId, foreachNum, type, start);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存二级维度的数据
|
|
|
*
|
|
|
* @param data
|
|
|
* @param wlyyQuotaId
|
|
|
* @param foreachNum 标识二级维度循环的次数 例如 年龄就传6 性别就传3
|
|
|
* @param type 1 性别 2 年龄 3 用户分组 4.签约费用 5 健康分布 6繳費未交費 7年齡疾病
|
|
|
* @param start 循环开始
|
|
|
* @param foreachNum 标识二级维度循环的次数 例如 年龄就传6 性别就传3
|
|
|
* @param type 1 性别 2 年龄 3 用户分组 4.签约费用 5 健康分布 6繳費未交費 7年齡疾病 8 咨询分组 9续签原因
|
|
|
* @param start 循环开始
|
|
|
*/
|
|
|
public void saveByLevel2(List<Map<String, Map<String, List<ETLModel>>>> data,List<Map<String, Map<String, List<ETLModel>>>> deleteData, String wlyyQuotaId,Integer foreachNum,Integer type,Integer start) throws Exception {
|
|
|
saveByLevel2Public(data,deleteData, wlyyQuotaId, foreachNum, type, start);
|
|
|
public void saveByLevel2(List<Map<String, Map<String, List<ETLModel>>>> data, List<Map<String, Map<String, List<ETLModel>>>> deleteData, String wlyyQuotaId, Integer foreachNum, Integer type, Integer start) throws Exception {
|
|
|
saveByLevel2Public(data, deleteData, wlyyQuotaId, foreachNum, type, start);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存三级维度的数据
|
|
|
*
|
|
|
* @param data
|
|
|
* @param wlyyQuotaId
|
|
|
* @param foreachNum2 标识二级维度循环的次数 例如 年龄就传6 性别就传3
|
|
|
* @param foreachNum3 标识二级维度循环的次数 例如 年龄就传6 性别就传3
|
|
|
* @param type2 1 性别 2 年龄 3 用户分组 4.签约费用 5 健康分布
|
|
|
* @param type3 1 疾病
|
|
|
* @param start2 循环开始
|
|
|
* @param start3 循环开始
|
|
|
* @param type2 1 性别 2 年龄 3 用户分组 4.签约费用 5 健康分布
|
|
|
* @param type3 1 疾病
|
|
|
* @param start2 循环开始
|
|
|
* @param start3 循环开始
|
|
|
*/
|
|
|
public void saveByLevel3(List<Map<String, Map<String, Map<String, List<ETLModel>>>>> data,List<Map<String, Map<String, Map<String, List<ETLModel>>>>> deleteData, String wlyyQuotaId,Integer foreachNum2,Integer foreachNum3,Integer type2,Integer type3,Integer start2,Integer start3) throws Exception {
|
|
|
if(start2==null){
|
|
|
start2=1;
|
|
|
public void saveByLevel3(List<Map<String, Map<String, Map<String, List<ETLModel>>>>> data, List<Map<String, Map<String, Map<String, List<ETLModel>>>>> deleteData, String wlyyQuotaId, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) throws Exception {
|
|
|
if (start2 == null) {
|
|
|
start2 = 1;
|
|
|
}
|
|
|
if(start3==null){
|
|
|
start2=1;
|
|
|
if (start3 == null) {
|
|
|
start2 = 1;
|
|
|
}
|
|
|
List<AdminTeam> adminTeams=doctorAdminTeamDao.findAllTeam();
|
|
|
List<AdminTeam> adminTeams = doctorAdminTeamDao.findAllTeam();
|
|
|
for (AdminTeam adminTeam : adminTeams) {
|
|
|
adminTeamMap.put(adminTeam.getId()+"", adminTeam);
|
|
|
adminTeamMap.put(adminTeam.getId() + "", adminTeam);
|
|
|
}
|
|
|
//查找出系统全部的机构
|
|
|
List<Hospital> hospitals = hospitalDao.findHospitalzxFWZ();
|
|
@ -159,435 +165,441 @@ public class RedisStorage {
|
|
|
townsMap.put(town.getCode(), town);
|
|
|
}
|
|
|
//全部的市
|
|
|
City city=new City();
|
|
|
City city = new City();
|
|
|
city.setCode(Constant.city);
|
|
|
city.setName(Constant.cityName);
|
|
|
Map<String, City> cityMap = new HashMap<String, City>();
|
|
|
cityMap.put(Constant.city,city);
|
|
|
if(deleteData!=null){
|
|
|
cityMap.put(Constant.city, city);
|
|
|
if (deleteData != null) {
|
|
|
//保存团队
|
|
|
saveAdminTeamDataLevel3(data.get(0),deleteData.get(0),wlyyQuotaId,adminTeamMap,foreachNum2,foreachNum3,type2,type3,start2,start3);
|
|
|
saveAdminTeamDataLevel3(data.get(0), deleteData.get(0), wlyyQuotaId, adminTeamMap, foreachNum2, foreachNum3, type2, type3, start2, start3);
|
|
|
//保存机构
|
|
|
saveHospitalTeamDataLevel3(data.get(1),deleteData.get(1),wlyyQuotaId,hospitalsMap,foreachNum2,foreachNum3,type2,type3,start2,start3);
|
|
|
saveHospitalTeamDataLevel3(data.get(1), deleteData.get(1), wlyyQuotaId, hospitalsMap, foreachNum2, foreachNum3, type2, type3, start2, start3);
|
|
|
//保存区
|
|
|
saveTownTeamDataLevel3(data.get(2),deleteData.get(2),wlyyQuotaId,townsMap,foreachNum2,foreachNum3,type2,type3,start2,start3);
|
|
|
saveTownTeamDataLevel3(data.get(2), deleteData.get(2), wlyyQuotaId, townsMap, foreachNum2, foreachNum3, type2, type3, start2, start3);
|
|
|
//保存市
|
|
|
saveCityTeamDataLevel3(data.get(3),deleteData.get(3),wlyyQuotaId,cityMap,foreachNum2,foreachNum3,type2,type3,start2,start3);
|
|
|
}else{
|
|
|
saveCityTeamDataLevel3(data.get(3), deleteData.get(3), wlyyQuotaId, cityMap, foreachNum2, foreachNum3, type2, type3, start2, start3);
|
|
|
} else {
|
|
|
//保存团队
|
|
|
saveAdminTeamDataLevel3(data.get(0),wlyyQuotaId,adminTeamMap,foreachNum2,foreachNum3,type2,type3,start2,start3);
|
|
|
saveAdminTeamDataLevel3(data.get(0), wlyyQuotaId, adminTeamMap, foreachNum2, foreachNum3, type2, type3, start2, start3);
|
|
|
//保存机构
|
|
|
saveHospitalTeamDataLevel3(data.get(1),wlyyQuotaId,hospitalsMap,foreachNum2,foreachNum3,type2,type3,start2,start3);
|
|
|
saveHospitalTeamDataLevel3(data.get(1), wlyyQuotaId, hospitalsMap, foreachNum2, foreachNum3, type2, type3, start2, start3);
|
|
|
//保存区
|
|
|
saveTownTeamDataLevel3(data.get(2),wlyyQuotaId,townsMap,foreachNum2,foreachNum3,type2,type3,start2,start3);
|
|
|
saveTownTeamDataLevel3(data.get(2), wlyyQuotaId, townsMap, foreachNum2, foreachNum3, type2, type3, start2, start3);
|
|
|
//保存市
|
|
|
saveCityTeamDataLevel3(data.get(3),wlyyQuotaId,cityMap,foreachNum2,foreachNum3,type2,type3,start2,start3);
|
|
|
saveCityTeamDataLevel3(data.get(3), wlyyQuotaId, cityMap, foreachNum2, foreachNum3, type2, type3, start2, start3);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void saveAdminTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap,Map<String, Map<String, Map<String, List<ETLModel>>>> deleteEtlModelMap, String wlyyQuotaId,Map<String, AdminTeam> adminTeamMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
private void saveAdminTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap, Map<String, Map<String, Map<String, List<ETLModel>>>> deleteEtlModelMap, String wlyyQuotaId, Map<String, AdminTeam> adminTeamMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
//遍历团队的Map
|
|
|
for(Map.Entry<String,AdminTeam> oneAdminTeam:adminTeamMap.entrySet()){
|
|
|
for (Map.Entry<String, AdminTeam> oneAdminTeam : adminTeamMap.entrySet()) {
|
|
|
//得到每个团队的2级维度
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap= etlModelMap.get(oneAdminTeam.getKey());
|
|
|
Map<String, Map<String, List<ETLModel>>> deleteTwoETLMap= deleteEtlModelMap.get(oneAdminTeam.getKey());
|
|
|
for(int i=start2;i<=foreachNum2;i++){
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap = etlModelMap.get(oneAdminTeam.getKey());
|
|
|
Map<String, Map<String, List<ETLModel>>> deleteTwoETLMap = deleteEtlModelMap.get(oneAdminTeam.getKey());
|
|
|
for (int i = start2; i <= foreachNum2; i++) {
|
|
|
//得到每个团队的三级维度
|
|
|
Map<String, List<ETLModel>> threeETLMap=null;
|
|
|
if(twoETLMap!=null){
|
|
|
threeETLMap=twoETLMap.get(i+"");
|
|
|
Map<String, List<ETLModel>> threeETLMap = null;
|
|
|
if (twoETLMap != null) {
|
|
|
threeETLMap = twoETLMap.get(i + "");
|
|
|
}
|
|
|
Map<String, List<ETLModel>> deleteThreeETLMap=null;
|
|
|
if(deleteTwoETLMap!=null){
|
|
|
deleteThreeETLMap=deleteTwoETLMap.get(i+"");
|
|
|
Map<String, List<ETLModel>> deleteThreeETLMap = null;
|
|
|
if (deleteTwoETLMap != null) {
|
|
|
deleteThreeETLMap = deleteTwoETLMap.get(i + "");
|
|
|
}
|
|
|
for(int j=start3;j<=foreachNum3;j++){
|
|
|
String level1="1";
|
|
|
String level2=i+"";
|
|
|
String level3=j+"";
|
|
|
int num=0;
|
|
|
if(threeETLMap!=null){
|
|
|
List<ETLModel> etlModelList= threeETLMap.get(j+"");
|
|
|
if(etlModelList!=null&&etlModelList.size()>0){
|
|
|
num=etlModelList.size();
|
|
|
for (int j = start3; j <= foreachNum3; j++) {
|
|
|
String level1 = "1";
|
|
|
String level2 = i + "";
|
|
|
String level3 = j + "";
|
|
|
int num = 0;
|
|
|
if (threeETLMap != null) {
|
|
|
List<ETLModel> etlModelList = threeETLMap.get(j + "");
|
|
|
if (etlModelList != null && etlModelList.size() > 0) {
|
|
|
num = etlModelList.size();
|
|
|
}
|
|
|
}
|
|
|
if(deleteThreeETLMap!=null){
|
|
|
List<ETLModel> etlModelList= deleteThreeETLMap.get(j+"");
|
|
|
if(etlModelList!=null&&etlModelList.size()>0){
|
|
|
num=num-etlModelList.size();
|
|
|
if (deleteThreeETLMap != null) {
|
|
|
List<ETLModel> etlModelList = deleteThreeETLMap.get(j + "");
|
|
|
if (etlModelList != null && etlModelList.size() > 0) {
|
|
|
num = num - etlModelList.size();
|
|
|
}
|
|
|
}
|
|
|
AdminTeam adminTeamObj = adminTeamMap.get(oneAdminTeam.getKey());//团队
|
|
|
if(adminTeamObj==null)continue;
|
|
|
JSONObject jo=new JSONObject();
|
|
|
if (adminTeamObj == null) continue;
|
|
|
JSONObject jo = new JSONObject();
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", adminTeamObj.getName());
|
|
|
jo.put("code", adminTeamObj.getId());
|
|
|
jo.put("name", getLevel3Name(level3,type3));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+level2+":"+level3+":"+adminTeamObj.getId()).toString(), jo.toString());
|
|
|
jo.put("name", getLevel3Name(level3, type3));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + level2 + ":" + level3 + ":" + adminTeamObj.getId()).toString(), jo.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
private void saveAdminTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap, String wlyyQuotaId,Map<String, AdminTeam> adminTeamMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
|
|
|
private void saveAdminTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap, String wlyyQuotaId, Map<String, AdminTeam> adminTeamMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
|
|
|
//遍历团队的Map
|
|
|
for(Map.Entry<String,AdminTeam> oneAdminTeam:adminTeamMap.entrySet()){
|
|
|
JSONArray level2Jr=new JSONArray();
|
|
|
for (Map.Entry<String, AdminTeam> oneAdminTeam : adminTeamMap.entrySet()) {
|
|
|
JSONArray level2Jr = new JSONArray();
|
|
|
AdminTeam adminTeamObj = adminTeamMap.get(oneAdminTeam.getKey());//团队
|
|
|
String level1="1";
|
|
|
String level1 = "1";
|
|
|
//得到每个团队的2级维度
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap= etlModelMap.get(oneAdminTeam.getKey());
|
|
|
for(int i=start2;i<=foreachNum2;i++){
|
|
|
JSONArray jrlevel2=new JSONArray();
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap = etlModelMap.get(oneAdminTeam.getKey());
|
|
|
for (int i = start2; i <= foreachNum2; i++) {
|
|
|
JSONArray jrlevel2 = new JSONArray();
|
|
|
//得到每个团队的三级维度
|
|
|
Map<String, List<ETLModel>> threeETLMap=null;
|
|
|
if(twoETLMap!=null){
|
|
|
threeETLMap=twoETLMap.get(i+"");
|
|
|
Map<String, List<ETLModel>> threeETLMap = null;
|
|
|
if (twoETLMap != null) {
|
|
|
threeETLMap = twoETLMap.get(i + "");
|
|
|
}
|
|
|
for(int j=start3;j<=foreachNum3;j++){
|
|
|
String level2=i+"";
|
|
|
String level3=j+"";
|
|
|
int num=0;
|
|
|
if(threeETLMap!=null){
|
|
|
List<ETLModel> etlModelList= threeETLMap.get(j+"");
|
|
|
if(etlModelList!=null&&etlModelList.size()>0){
|
|
|
num=etlModelList.size();
|
|
|
for (int j = start3; j <= foreachNum3; j++) {
|
|
|
String level2 = i + "";
|
|
|
String level3 = j + "";
|
|
|
int num = 0;
|
|
|
if (threeETLMap != null) {
|
|
|
List<ETLModel> etlModelList = threeETLMap.get(j + "");
|
|
|
if (etlModelList != null && etlModelList.size() > 0) {
|
|
|
num = etlModelList.size();
|
|
|
}
|
|
|
}
|
|
|
if(adminTeamObj==null)continue;
|
|
|
JSONObject jo=new JSONObject();
|
|
|
if (adminTeamObj == null) continue;
|
|
|
JSONObject jo = new JSONObject();
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", getLevel3Name(level3,type3));
|
|
|
jo.put("name", getLevel3Name(level3, type3));
|
|
|
jo.put("code", level3);
|
|
|
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+adminTeamObj.getId()+":"+level2+":"+":"+level3+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + adminTeamObj.getId() + ":" + level2 + ":" + ":" + level3 + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jo.toString());
|
|
|
|
|
|
level2Jr.put(jo);
|
|
|
jrlevel2.put(jo);
|
|
|
}
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+adminTeamObj.getId()+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + adminTeamObj.getId() + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jrlevel2.toString());
|
|
|
}
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+adminTeamObj.getId()+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + adminTeamObj.getId() + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), level2Jr.toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private String getLevel3Name(String j, Integer type) {
|
|
|
switch (type){
|
|
|
case 1:{
|
|
|
switch (type) {
|
|
|
case 1: {
|
|
|
//疾病类型
|
|
|
return Constant.getLevelDiseaseName(j);
|
|
|
}
|
|
|
default:{
|
|
|
default: {
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void saveHospitalTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap,Map<String, Map<String, Map<String, List<ETLModel>>>> deleteEtlModelMap,String wlyyQuotaId, Map<String, Hospital> hospitalMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
private void saveHospitalTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap, Map<String, Map<String, Map<String, List<ETLModel>>>> deleteEtlModelMap, String wlyyQuotaId, Map<String, Hospital> hospitalMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
//遍历团队的Map
|
|
|
for(Map.Entry<String,Hospital> oneHospital:hospitalMap.entrySet()){
|
|
|
for (Map.Entry<String, Hospital> oneHospital : hospitalMap.entrySet()) {
|
|
|
//得到每个团队的2级维度
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap= etlModelMap.get(oneHospital.getKey());
|
|
|
Map<String, Map<String, List<ETLModel>>> deleteTwoETLMap= deleteEtlModelMap.get(oneHospital.getKey());
|
|
|
for(int i=start2;i<=foreachNum2;i++){
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap = etlModelMap.get(oneHospital.getKey());
|
|
|
Map<String, Map<String, List<ETLModel>>> deleteTwoETLMap = deleteEtlModelMap.get(oneHospital.getKey());
|
|
|
for (int i = start2; i <= foreachNum2; i++) {
|
|
|
//得到每个团队的三级维度
|
|
|
Map<String, List<ETLModel>> threeETLMap= new HashMap<String, List<ETLModel>>();
|
|
|
if(twoETLMap!=null){
|
|
|
threeETLMap=twoETLMap.get(i+"");
|
|
|
Map<String, List<ETLModel>> threeETLMap = new HashMap<String, List<ETLModel>>();
|
|
|
if (twoETLMap != null) {
|
|
|
threeETLMap = twoETLMap.get(i + "");
|
|
|
}
|
|
|
Map<String, List<ETLModel>> deleteThreeETLMap= new HashMap<String, List<ETLModel>>();
|
|
|
if(deleteTwoETLMap!=null){
|
|
|
deleteThreeETLMap=deleteTwoETLMap.get(i+"");
|
|
|
Map<String, List<ETLModel>> deleteThreeETLMap = new HashMap<String, List<ETLModel>>();
|
|
|
if (deleteTwoETLMap != null) {
|
|
|
deleteThreeETLMap = deleteTwoETLMap.get(i + "");
|
|
|
}
|
|
|
for(int j=start3;j<=foreachNum3;j++){
|
|
|
String level1="2";
|
|
|
String level2=i+"";
|
|
|
String level3=j+"";
|
|
|
int num=0;
|
|
|
if(threeETLMap!=null&&threeETLMap.size()>0){
|
|
|
List<ETLModel> etlModelList= threeETLMap.get(j+"");
|
|
|
if(etlModelList!=null&&etlModelList.size()>0){
|
|
|
num=etlModelList.size();
|
|
|
for (int j = start3; j <= foreachNum3; j++) {
|
|
|
String level1 = "2";
|
|
|
String level2 = i + "";
|
|
|
String level3 = j + "";
|
|
|
int num = 0;
|
|
|
if (threeETLMap != null && threeETLMap.size() > 0) {
|
|
|
List<ETLModel> etlModelList = threeETLMap.get(j + "");
|
|
|
if (etlModelList != null && etlModelList.size() > 0) {
|
|
|
num = etlModelList.size();
|
|
|
}
|
|
|
}
|
|
|
if(deleteThreeETLMap!=null&&deleteThreeETLMap.size()>0){
|
|
|
List<ETLModel> etlModelList= deleteThreeETLMap.get(j+"");
|
|
|
if(etlModelList!=null&&etlModelList.size()>0){
|
|
|
num=num-etlModelList.size();
|
|
|
if (deleteThreeETLMap != null && deleteThreeETLMap.size() > 0) {
|
|
|
List<ETLModel> etlModelList = deleteThreeETLMap.get(j + "");
|
|
|
if (etlModelList != null && etlModelList.size() > 0) {
|
|
|
num = num - etlModelList.size();
|
|
|
}
|
|
|
}
|
|
|
Hospital hospital = hospitalsMap.get(oneHospital.getKey());
|
|
|
if(hospital==null)continue;
|
|
|
JSONObject jo=new JSONObject();
|
|
|
if (hospital == null) continue;
|
|
|
JSONObject jo = new JSONObject();
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", hospital.getName());
|
|
|
jo.put("code", hospital.getCode());
|
|
|
jo.put("name", getLevel3Name(level3,type3));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+level2+":"+level3+":"+hospital.getCode()).toString(), jo.toString());
|
|
|
jo.put("name", getLevel3Name(level3, type3));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + level2 + ":" + level3 + ":" + hospital.getCode()).toString(), jo.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
private void saveHospitalTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap,String wlyyQuotaId, Map<String, Hospital> hospitalMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
|
|
|
Map<String,Map<String,JSONArray>> cityJr=new HashMap<String,Map<String,JSONArray>>();
|
|
|
private void saveHospitalTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap, String wlyyQuotaId, Map<String, Hospital> hospitalMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
|
|
|
Map<String, Map<String, JSONArray>> cityJr = new HashMap<String, Map<String, JSONArray>>();
|
|
|
//遍历团队的Map
|
|
|
for(Map.Entry<String,Hospital> oneHospital:hospitalMap.entrySet()){
|
|
|
for (Map.Entry<String, Hospital> oneHospital : hospitalMap.entrySet()) {
|
|
|
Hospital hospital = hospitalsMap.get(oneHospital.getKey());
|
|
|
if(hospital==null)continue;
|
|
|
JSONArray jr=new JSONArray();
|
|
|
String level1="2";
|
|
|
if (hospital == null) continue;
|
|
|
JSONArray jr = new JSONArray();
|
|
|
String level1 = "2";
|
|
|
//得到每个团队的2级维度
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap= etlModelMap.get(oneHospital.getKey());
|
|
|
for(int i=start2;i<=foreachNum2;i++){
|
|
|
JSONArray jrlevel2=new JSONArray();
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap = etlModelMap.get(oneHospital.getKey());
|
|
|
for (int i = start2; i <= foreachNum2; i++) {
|
|
|
JSONArray jrlevel2 = new JSONArray();
|
|
|
//得到每个团队的三级维度
|
|
|
Map<String, List<ETLModel>> threeETLMap= new HashMap<String, List<ETLModel>>();
|
|
|
if(twoETLMap!=null){
|
|
|
threeETLMap=twoETLMap.get(i+"");
|
|
|
Map<String, List<ETLModel>> threeETLMap = new HashMap<String, List<ETLModel>>();
|
|
|
if (twoETLMap != null) {
|
|
|
threeETLMap = twoETLMap.get(i + "");
|
|
|
}
|
|
|
for(int j=start3;j<=foreachNum3;j++){
|
|
|
String level2=i+"";
|
|
|
String level3=j+"";
|
|
|
int num=0;
|
|
|
if(threeETLMap!=null&&threeETLMap.size()>0){
|
|
|
List<ETLModel> etlModelList= threeETLMap.get(j+"");
|
|
|
if(etlModelList!=null&&etlModelList.size()>0){
|
|
|
num=etlModelList.size();
|
|
|
for (int j = start3; j <= foreachNum3; j++) {
|
|
|
String level2 = i + "";
|
|
|
String level3 = j + "";
|
|
|
int num = 0;
|
|
|
if (threeETLMap != null && threeETLMap.size() > 0) {
|
|
|
List<ETLModel> etlModelList = threeETLMap.get(j + "");
|
|
|
if (etlModelList != null && etlModelList.size() > 0) {
|
|
|
num = etlModelList.size();
|
|
|
}
|
|
|
}
|
|
|
if(hospital==null)continue;
|
|
|
JSONObject jo=new JSONObject();
|
|
|
if (hospital == null) continue;
|
|
|
JSONObject jo = new JSONObject();
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", getLevel3Name(level3,type3));
|
|
|
jo.put("name", getLevel3Name(level3, type3));
|
|
|
jo.put("code", level3);
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+":"+hospital.getCode()+":"+level2+":"+level3+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + ":" + hospital.getCode() + ":" + level2 + ":" + level3 + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jo.toString());
|
|
|
jr.put(jo);
|
|
|
jrlevel2.put(jo);
|
|
|
}
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+hospital.getCode()+":"+i+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + hospital.getCode() + ":" + i + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jrlevel2.toString());
|
|
|
}
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+hospital.getCode()+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + hospital.getCode() + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jr.toString());
|
|
|
}
|
|
|
}
|
|
|
private void saveTownTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap,Map<String, Map<String, Map<String, List<ETLModel>>>> deleteEtlModelMap,String wlyyQuotaId, Map<String, Town> townsMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
|
|
|
|
private void saveTownTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap, Map<String, Map<String, Map<String, List<ETLModel>>>> deleteEtlModelMap, String wlyyQuotaId, Map<String, Town> townsMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
List<WlyyQuotaResult> wlyyQuotaResults = new ArrayList<WlyyQuotaResult>();
|
|
|
//遍历团队的Map
|
|
|
for(Map.Entry<String,Town> oneTownTeam:townsMap.entrySet()){
|
|
|
for (Map.Entry<String, Town> oneTownTeam : townsMap.entrySet()) {
|
|
|
//得到每个团队的2级维度
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap= etlModelMap.get(oneTownTeam.getKey());
|
|
|
Map<String, Map<String, List<ETLModel>>> deleteTwoETLMap= deleteEtlModelMap.get(oneTownTeam.getKey());
|
|
|
for(int i=start2;i<=foreachNum2;i++){
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap = etlModelMap.get(oneTownTeam.getKey());
|
|
|
Map<String, Map<String, List<ETLModel>>> deleteTwoETLMap = deleteEtlModelMap.get(oneTownTeam.getKey());
|
|
|
for (int i = start2; i <= foreachNum2; i++) {
|
|
|
//得到每个团队的三级维度
|
|
|
Map<String, List<ETLModel>> threeETLMap= new HashMap<String, List<ETLModel>>();
|
|
|
if(twoETLMap!=null){
|
|
|
threeETLMap=twoETLMap.get(i+"");
|
|
|
Map<String, List<ETLModel>> threeETLMap = new HashMap<String, List<ETLModel>>();
|
|
|
if (twoETLMap != null) {
|
|
|
threeETLMap = twoETLMap.get(i + "");
|
|
|
}
|
|
|
Map<String, List<ETLModel>> deleteThreeETLMap= new HashMap<String, List<ETLModel>>();
|
|
|
if(deleteTwoETLMap!=null){
|
|
|
deleteThreeETLMap=deleteTwoETLMap.get(i+"");
|
|
|
Map<String, List<ETLModel>> deleteThreeETLMap = new HashMap<String, List<ETLModel>>();
|
|
|
if (deleteTwoETLMap != null) {
|
|
|
deleteThreeETLMap = deleteTwoETLMap.get(i + "");
|
|
|
}
|
|
|
for(int j=start3;j<=foreachNum3;j++){
|
|
|
String level1="3";
|
|
|
String level2=i+"";
|
|
|
String level3=j+"";
|
|
|
int num=0;
|
|
|
if(threeETLMap!=null&&threeETLMap.size()>0){
|
|
|
List<ETLModel> etlModelList= threeETLMap.get(j+"");
|
|
|
if(etlModelList!=null&&etlModelList.size()>0){
|
|
|
num=etlModelList.size();
|
|
|
for (int j = start3; j <= foreachNum3; j++) {
|
|
|
String level1 = "3";
|
|
|
String level2 = i + "";
|
|
|
String level3 = j + "";
|
|
|
int num = 0;
|
|
|
if (threeETLMap != null && threeETLMap.size() > 0) {
|
|
|
List<ETLModel> etlModelList = threeETLMap.get(j + "");
|
|
|
if (etlModelList != null && etlModelList.size() > 0) {
|
|
|
num = etlModelList.size();
|
|
|
}
|
|
|
}
|
|
|
if(deleteThreeETLMap!=null&&deleteThreeETLMap.size()>0){
|
|
|
List<ETLModel> etlModelList= deleteThreeETLMap.get(j+"");
|
|
|
if(etlModelList!=null&&etlModelList.size()>0){
|
|
|
num=num-etlModelList.size();
|
|
|
if (deleteThreeETLMap != null && deleteThreeETLMap.size() > 0) {
|
|
|
List<ETLModel> etlModelList = deleteThreeETLMap.get(j + "");
|
|
|
if (etlModelList != null && etlModelList.size() > 0) {
|
|
|
num = num - etlModelList.size();
|
|
|
}
|
|
|
}
|
|
|
Town town=townsMap.get(oneTownTeam.getKey());
|
|
|
if(town==null)continue;
|
|
|
JSONObject jo=new JSONObject();
|
|
|
Town town = townsMap.get(oneTownTeam.getKey());
|
|
|
if (town == null) continue;
|
|
|
JSONObject jo = new JSONObject();
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", town.getName());
|
|
|
jo.put("code", town.getCode());
|
|
|
jo.put("name", getLevel3Name(level3,type3));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+level2+":"+level3+":"+town.getCode()).toString(), jo.toString());
|
|
|
jo.put("name", getLevel3Name(level3, type3));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + level2 + ":" + level3 + ":" + town.getCode()).toString(), jo.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
private void saveCityTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap,Map<String, Map<String, Map<String, List<ETLModel>>>> deleteEtlModelMap,String wlyyQuotaId, Map<String, City> cityMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
|
|
|
|
private void saveCityTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap, Map<String, Map<String, Map<String, List<ETLModel>>>> deleteEtlModelMap, String wlyyQuotaId, Map<String, City> cityMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
List<WlyyQuotaResult> wlyyQuotaResults = new ArrayList<WlyyQuotaResult>();
|
|
|
//遍历团队的Map
|
|
|
for(Map.Entry<String,City> oneCityTeam:cityMap.entrySet()){
|
|
|
for (Map.Entry<String, City> oneCityTeam : cityMap.entrySet()) {
|
|
|
//得到每个团队的2级维度
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap= etlModelMap.get(oneCityTeam.getKey());
|
|
|
Map<String, Map<String, List<ETLModel>>> deleteTwoETLMap= deleteEtlModelMap.get(oneCityTeam.getKey());
|
|
|
for(int i=start2;i<=foreachNum2;i++){
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap = etlModelMap.get(oneCityTeam.getKey());
|
|
|
Map<String, Map<String, List<ETLModel>>> deleteTwoETLMap = deleteEtlModelMap.get(oneCityTeam.getKey());
|
|
|
for (int i = start2; i <= foreachNum2; i++) {
|
|
|
//得到每个团队的三级维度
|
|
|
Map<String, List<ETLModel>> threeETLMap= new HashMap<String, List<ETLModel>>();
|
|
|
if(twoETLMap!=null){
|
|
|
threeETLMap=twoETLMap.get(i+"");
|
|
|
Map<String, List<ETLModel>> threeETLMap = new HashMap<String, List<ETLModel>>();
|
|
|
if (twoETLMap != null) {
|
|
|
threeETLMap = twoETLMap.get(i + "");
|
|
|
}
|
|
|
Map<String, List<ETLModel>> deletetThreeETLMap= new HashMap<String, List<ETLModel>>();
|
|
|
if(deleteTwoETLMap!=null){
|
|
|
deletetThreeETLMap=deleteTwoETLMap.get(i+"");
|
|
|
Map<String, List<ETLModel>> deletetThreeETLMap = new HashMap<String, List<ETLModel>>();
|
|
|
if (deleteTwoETLMap != null) {
|
|
|
deletetThreeETLMap = deleteTwoETLMap.get(i + "");
|
|
|
}
|
|
|
for(int j=start3;j<=foreachNum3;j++){
|
|
|
|
|
|
String level1="4";
|
|
|
String level2=i+"";
|
|
|
String level3=j+"";
|
|
|
int num=0;
|
|
|
if(threeETLMap!=null&&threeETLMap.size()>0){
|
|
|
List<ETLModel> etlModelList= threeETLMap.get(j+"");
|
|
|
if(etlModelList!=null&&etlModelList.size()>0){
|
|
|
num=etlModelList.size();
|
|
|
for (int j = start3; j <= foreachNum3; j++) {
|
|
|
|
|
|
String level1 = "4";
|
|
|
String level2 = i + "";
|
|
|
String level3 = j + "";
|
|
|
int num = 0;
|
|
|
if (threeETLMap != null && threeETLMap.size() > 0) {
|
|
|
List<ETLModel> etlModelList = threeETLMap.get(j + "");
|
|
|
if (etlModelList != null && etlModelList.size() > 0) {
|
|
|
num = etlModelList.size();
|
|
|
}
|
|
|
}
|
|
|
if(deletetThreeETLMap!=null&&deletetThreeETLMap.size()>0){
|
|
|
List<ETLModel> etlModelList= deletetThreeETLMap.get(j+"");
|
|
|
if(etlModelList!=null&&etlModelList.size()>0){
|
|
|
num=num-etlModelList.size();
|
|
|
if (deletetThreeETLMap != null && deletetThreeETLMap.size() > 0) {
|
|
|
List<ETLModel> etlModelList = deletetThreeETLMap.get(j + "");
|
|
|
if (etlModelList != null && etlModelList.size() > 0) {
|
|
|
num = num - etlModelList.size();
|
|
|
}
|
|
|
}
|
|
|
City cityObj=oneCityTeam.getValue();
|
|
|
JSONObject jo=new JSONObject();
|
|
|
City cityObj = oneCityTeam.getValue();
|
|
|
JSONObject jo = new JSONObject();
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", cityObj.getName());
|
|
|
jo.put("code", cityObj.getCode());
|
|
|
jo.put("name", getLevel3Name(level3,type3));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+level2+":"+level3+":"+cityObj.getCode()).toString(), jo.toString());
|
|
|
jo.put("name", getLevel3Name(level3, type3));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + level2 + ":" + level3 + ":" + cityObj.getCode()).toString(), jo.toString());
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
private void saveTownTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap,String wlyyQuotaId, Map<String, Town> townsMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
|
|
|
private void saveTownTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap, String wlyyQuotaId, Map<String, Town> townsMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
|
|
|
//遍历团队的Map
|
|
|
for(Map.Entry<String,Town> oneTownTeam:townsMap.entrySet()){
|
|
|
Town town=townsMap.get(oneTownTeam.getKey());
|
|
|
JSONArray jr=new JSONArray();
|
|
|
String level1="3";
|
|
|
for (Map.Entry<String, Town> oneTownTeam : townsMap.entrySet()) {
|
|
|
Town town = townsMap.get(oneTownTeam.getKey());
|
|
|
JSONArray jr = new JSONArray();
|
|
|
String level1 = "3";
|
|
|
//得到每个团队的2级维度
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap= etlModelMap.get(oneTownTeam.getKey());
|
|
|
for(int i=start2;i<=foreachNum2;i++){
|
|
|
JSONArray jrlevel2=new JSONArray();
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap = etlModelMap.get(oneTownTeam.getKey());
|
|
|
for (int i = start2; i <= foreachNum2; i++) {
|
|
|
JSONArray jrlevel2 = new JSONArray();
|
|
|
//得到每个团队的三级维度
|
|
|
Map<String, List<ETLModel>> threeETLMap= new HashMap<String, List<ETLModel>>();
|
|
|
if(twoETLMap!=null){
|
|
|
threeETLMap=twoETLMap.get(i+"");
|
|
|
Map<String, List<ETLModel>> threeETLMap = new HashMap<String, List<ETLModel>>();
|
|
|
if (twoETLMap != null) {
|
|
|
threeETLMap = twoETLMap.get(i + "");
|
|
|
}
|
|
|
for(int j=start3;j<=foreachNum3;j++){
|
|
|
String level2=i+"";
|
|
|
String level3=j+"";
|
|
|
int num=0;
|
|
|
if(threeETLMap!=null&&threeETLMap.size()>0){
|
|
|
List<ETLModel> etlModelList= threeETLMap.get(j+"");
|
|
|
if(etlModelList!=null&&etlModelList.size()>0){
|
|
|
num=etlModelList.size();
|
|
|
for (int j = start3; j <= foreachNum3; j++) {
|
|
|
String level2 = i + "";
|
|
|
String level3 = j + "";
|
|
|
int num = 0;
|
|
|
if (threeETLMap != null && threeETLMap.size() > 0) {
|
|
|
List<ETLModel> etlModelList = threeETLMap.get(j + "");
|
|
|
if (etlModelList != null && etlModelList.size() > 0) {
|
|
|
num = etlModelList.size();
|
|
|
}
|
|
|
}
|
|
|
if(town==null)continue;
|
|
|
JSONObject jo=new JSONObject();
|
|
|
if (town == null) continue;
|
|
|
JSONObject jo = new JSONObject();
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
//jo.put("name", town.getName());
|
|
|
//jo.put("code", town.getCode());
|
|
|
jo.put("level2code", level2);
|
|
|
jo.put("level2name", getLevel2Name(level2,type2));
|
|
|
jo.put("name", getLevel3Name(level3,type3));
|
|
|
jo.put("code",level3 );
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+town.getCode()+":"+level2+":"+level3+":"+timeKey);
|
|
|
jo.put("level2name", getLevel2Name(level2, type2));
|
|
|
jo.put("name", getLevel3Name(level3, type3));
|
|
|
jo.put("code", level3);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + town.getCode() + ":" + level2 + ":" + level3 + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jo.toString());
|
|
|
jr.put(jo);
|
|
|
jrlevel2.put(jo);
|
|
|
}
|
|
|
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+town.getCode()+":"+i+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + town.getCode() + ":" + i + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jrlevel2.toString());
|
|
|
}
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+town.getCode()+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + town.getCode() + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jr.toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void saveCityTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap,String wlyyQuotaId, Map<String, City> cityMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
private void saveCityTeamDataLevel3(Map<String, Map<String, Map<String, List<ETLModel>>>> etlModelMap, String wlyyQuotaId, Map<String, City> cityMap, Integer foreachNum2, Integer foreachNum3, Integer type2, Integer type3, Integer start2, Integer start3) {
|
|
|
//遍历团队的Map
|
|
|
for(Map.Entry<String,City> oneCityTeam:cityMap.entrySet()){
|
|
|
City cityObj=oneCityTeam.getValue();
|
|
|
JSONArray jr=new JSONArray();
|
|
|
String level1="4";
|
|
|
for (Map.Entry<String, City> oneCityTeam : cityMap.entrySet()) {
|
|
|
City cityObj = oneCityTeam.getValue();
|
|
|
JSONArray jr = new JSONArray();
|
|
|
String level1 = "4";
|
|
|
//得到每个团队的2级维度
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap= etlModelMap.get(oneCityTeam.getKey());
|
|
|
for(int i=start2;i<=foreachNum2;i++){
|
|
|
Map<String, Map<String, List<ETLModel>>> twoETLMap = etlModelMap.get(oneCityTeam.getKey());
|
|
|
for (int i = start2; i <= foreachNum2; i++) {
|
|
|
//得到每个团队的三级维度
|
|
|
JSONArray jrLevel2=new JSONArray();
|
|
|
Map<String, List<ETLModel>> threeETLMap= new HashMap<String, List<ETLModel>>();
|
|
|
if(twoETLMap!=null){
|
|
|
threeETLMap=twoETLMap.get(i+"");
|
|
|
JSONArray jrLevel2 = new JSONArray();
|
|
|
Map<String, List<ETLModel>> threeETLMap = new HashMap<String, List<ETLModel>>();
|
|
|
if (twoETLMap != null) {
|
|
|
threeETLMap = twoETLMap.get(i + "");
|
|
|
}
|
|
|
for(int j=start3;j<=foreachNum3;j++){
|
|
|
String level2=i+"";
|
|
|
String level3=j+"";
|
|
|
int num=0;
|
|
|
if(threeETLMap!=null&&threeETLMap.size()>0){
|
|
|
List<ETLModel> etlModelList= threeETLMap.get(j+"");
|
|
|
if(etlModelList!=null&&etlModelList.size()>0){
|
|
|
num=etlModelList.size();
|
|
|
for (int j = start3; j <= foreachNum3; j++) {
|
|
|
String level2 = i + "";
|
|
|
String level3 = j + "";
|
|
|
int num = 0;
|
|
|
if (threeETLMap != null && threeETLMap.size() > 0) {
|
|
|
List<ETLModel> etlModelList = threeETLMap.get(j + "");
|
|
|
if (etlModelList != null && etlModelList.size() > 0) {
|
|
|
num = etlModelList.size();
|
|
|
}
|
|
|
}
|
|
|
JSONObject jo=new JSONObject();
|
|
|
JSONObject jo = new JSONObject();
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name",getLevel3Name(level3,type3));
|
|
|
jo.put("code",level3);
|
|
|
jo.put("name", getLevel3Name(level3, type3));
|
|
|
jo.put("code", level3);
|
|
|
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+cityObj.getCode()+":"+level2+":"+level3+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + cityObj.getCode() + ":" + level2 + ":" + level3 + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jo.toString());
|
|
|
|
|
|
jrLevel2.put(jo);
|
|
|
jr.put(jo);
|
|
|
}
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+cityObj.getCode()+":"+i+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + cityObj.getCode() + ":" + i + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jrLevel2.toString());
|
|
|
}
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":"+level1+":"+cityObj.getCode()+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":" + level1 + ":" + cityObj.getCode() + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jr.toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
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();
|
|
|
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();
|
|
|
adminTeamMap = new HashMap<String, AdminTeam>();
|
|
|
for (AdminTeam adminTeam : adminTeams) {
|
|
|
adminTeamMap.put(adminTeam.getId()+"", adminTeam);
|
|
|
adminTeamMap.put(adminTeam.getId() + "", adminTeam);
|
|
|
}
|
|
|
//查找出系统全部的机构
|
|
|
List<Hospital> hospitals = hospitalDao.findHospitalzxFWZ();
|
|
@ -597,23 +609,23 @@ public class RedisStorage {
|
|
|
}
|
|
|
//查找出厦门市全部的区
|
|
|
List<Town> towns = townDao.findByCityCode(Constant.city);
|
|
|
townsMap = new HashMap<String, Town>();
|
|
|
townsMap = new HashMap<String, Town>();
|
|
|
for (Town town : towns) {
|
|
|
townsMap.put(town.getCode(), town);
|
|
|
}
|
|
|
//全部的市
|
|
|
Map<String, City> cityMap = new HashMap<String, City>();
|
|
|
City city=new City();
|
|
|
City city = new City();
|
|
|
city.setCode(Constant.city);
|
|
|
city.setName(Constant.cityName);
|
|
|
cityMap.put(Constant.city,city);
|
|
|
cityMap.put(Constant.city, city);
|
|
|
|
|
|
Map<String, Map<String, List<ETLModel>>> adminTeam=data.get(0);//团队的数据
|
|
|
Map<String, Map<String, List<ETLModel>>> orgTeam=data.get(1);//机构的数据
|
|
|
Map<String, Map<String, List<ETLModel>>> townTeam=data.get(2);//区的数据
|
|
|
Map<String, Map<String, List<ETLModel>>> cityTeam=data.get(3);//市的数据
|
|
|
Map<String, Map<String, List<ETLModel>>> adminTeam = data.get(0);//团队的数据
|
|
|
Map<String, Map<String, List<ETLModel>>> orgTeam = data.get(1);//机构的数据
|
|
|
Map<String, Map<String, List<ETLModel>>> townTeam = data.get(2);//区的数据
|
|
|
Map<String, Map<String, List<ETLModel>>> cityTeam = data.get(3);//市的数据
|
|
|
|
|
|
if(deleteData!=null){
|
|
|
if (deleteData != null) {
|
|
|
// //保存市
|
|
|
// saveLevel2City(wlyyQuotaId, cityMap, cityTeam,deleteData.get(3),foreachNum,type,start);
|
|
|
// //保存区
|
|
@ -622,347 +634,356 @@ public class RedisStorage {
|
|
|
// saveLevel2Org(wlyyQuotaId, hospitalsMap, orgTeam,deleteData.get(1),foreachNum,type,start);
|
|
|
// //保存全科团队
|
|
|
// saveLevel2Team(wlyyQuotaId, adminTeamMap, adminTeam,deleteData.get(0),foreachNum,type,start);
|
|
|
}else{
|
|
|
} else {
|
|
|
//保存市
|
|
|
saveLevel2City(wlyyQuotaId, cityMap, cityTeam,foreachNum,type,start);
|
|
|
saveLevel2City(wlyyQuotaId, cityMap, cityTeam, foreachNum, type, start);
|
|
|
//保存区
|
|
|
saveLevel2Town(wlyyQuotaId, townsMap, townTeam,foreachNum,type,start);
|
|
|
saveLevel2Town(wlyyQuotaId, townsMap, townTeam, foreachNum, type, start);
|
|
|
//保存机构
|
|
|
saveLevel2Org(wlyyQuotaId, hospitalsMap, orgTeam,foreachNum,type,start);
|
|
|
saveLevel2Org(wlyyQuotaId, hospitalsMap, orgTeam, foreachNum, type, start);
|
|
|
//保存全科团队
|
|
|
saveLevel2Team(wlyyQuotaId, adminTeamMap, adminTeam,foreachNum,type,start);
|
|
|
saveLevel2Team(wlyyQuotaId, adminTeamMap, adminTeam, foreachNum, type, start);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void saveLevel2Team(String wlyyQuotaId, Map<String, AdminTeam> adminTeamMap, Map<String, Map<String, List<ETLModel>>> eltModel, Map<String, Map<String, List<ETLModel>>> deleteEltModel, Integer foreachNum, Integer type,Integer start) {
|
|
|
for(Map.Entry<String,AdminTeam> adminTeam:adminTeamMap.entrySet()){
|
|
|
Map<String, List<ETLModel>> oneELTMap= eltModel.get(adminTeam.getKey());
|
|
|
Map<String, List<ETLModel>> deleteOneELTMap= deleteEltModel.get(adminTeam.getKey());
|
|
|
for(int i=start;i<=foreachNum;i++){
|
|
|
AdminTeam adminTeamObj=adminTeam.getValue();
|
|
|
if(adminTeamObj==null)continue;
|
|
|
JSONObject jo=new JSONObject();
|
|
|
int num=0;
|
|
|
if(oneELTMap!=null){
|
|
|
List<ETLModel> etlModel= oneELTMap.get(i+"");
|
|
|
if(etlModel!=null&&etlModel.size()>0){
|
|
|
num=etlModel.size();
|
|
|
private void saveLevel2Team(String wlyyQuotaId, Map<String, AdminTeam> adminTeamMap, Map<String, Map<String, List<ETLModel>>> eltModel, Map<String, Map<String, List<ETLModel>>> deleteEltModel, Integer foreachNum, Integer type, Integer start) {
|
|
|
for (Map.Entry<String, AdminTeam> adminTeam : adminTeamMap.entrySet()) {
|
|
|
Map<String, List<ETLModel>> oneELTMap = eltModel.get(adminTeam.getKey());
|
|
|
Map<String, List<ETLModel>> deleteOneELTMap = deleteEltModel.get(adminTeam.getKey());
|
|
|
for (int i = start; i <= foreachNum; i++) {
|
|
|
AdminTeam adminTeamObj = adminTeam.getValue();
|
|
|
if (adminTeamObj == null) continue;
|
|
|
JSONObject jo = new JSONObject();
|
|
|
int num = 0;
|
|
|
if (oneELTMap != null) {
|
|
|
List<ETLModel> etlModel = oneELTMap.get(i + "");
|
|
|
if (etlModel != null && etlModel.size() > 0) {
|
|
|
num = etlModel.size();
|
|
|
}
|
|
|
}
|
|
|
if(deleteOneELTMap!=null){
|
|
|
List<ETLModel> etlModel1= deleteOneELTMap.get(i+"");
|
|
|
if(etlModel1!=null&&etlModel1.size()>0){
|
|
|
num=num-etlModel1.size();
|
|
|
if (deleteOneELTMap != null) {
|
|
|
List<ETLModel> etlModel1 = deleteOneELTMap.get(i + "");
|
|
|
if (etlModel1 != null && etlModel1.size() > 0) {
|
|
|
num = num - etlModel1.size();
|
|
|
}
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", adminTeamObj.getName());
|
|
|
jo.put("code", adminTeamObj.getId());
|
|
|
String key=i+"";
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:"+wlyyQuotaId+":1:"+key+":"+adminTeam.getKey()).toString(), jo.toString());
|
|
|
String key = i + "";
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:" + wlyyQuotaId + ":1:" + key + ":" + adminTeam.getKey()).toString(), jo.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
private void saveLevel2Team(String wlyyQuotaId, Map<String, AdminTeam> adminTeamMap, Map<String, Map<String, List<ETLModel>>> eltModel, Integer foreachNum, Integer type,Integer start) {
|
|
|
for(Map.Entry<String,AdminTeam> adminTeam:adminTeamMap.entrySet()){
|
|
|
Map<String, List<ETLModel>> oneELTMap= eltModel.get(adminTeam.getKey());
|
|
|
JSONArray level2=new JSONArray();
|
|
|
for(int i=start;i<=foreachNum;i++){
|
|
|
AdminTeam adminTeamObj=adminTeam.getValue();
|
|
|
if(adminTeamObj==null)continue;
|
|
|
JSONObject jo=new JSONObject();
|
|
|
int num=0;
|
|
|
if(oneELTMap!=null){
|
|
|
List<ETLModel> etlModel= oneELTMap.get(i+"");
|
|
|
if(etlModel!=null&&etlModel.size()>0){
|
|
|
num=etlModel.size();
|
|
|
|
|
|
private void saveLevel2Team(String wlyyQuotaId, Map<String, AdminTeam> adminTeamMap, Map<String, Map<String, List<ETLModel>>> eltModel, Integer foreachNum, Integer type, Integer start) {
|
|
|
for (Map.Entry<String, AdminTeam> adminTeam : adminTeamMap.entrySet()) {
|
|
|
Map<String, List<ETLModel>> oneELTMap = eltModel.get(adminTeam.getKey());
|
|
|
JSONArray level2 = new JSONArray();
|
|
|
for (int i = start; i <= foreachNum; i++) {
|
|
|
AdminTeam adminTeamObj = adminTeam.getValue();
|
|
|
if (adminTeamObj == null) continue;
|
|
|
JSONObject jo = new JSONObject();
|
|
|
int num = 0;
|
|
|
if (oneELTMap != null) {
|
|
|
List<ETLModel> etlModel = oneELTMap.get(i + "");
|
|
|
if (etlModel != null && etlModel.size() > 0) {
|
|
|
num = etlModel.size();
|
|
|
}
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
String key=i+"";
|
|
|
jo.put("name", getLevel2Name(key,type));
|
|
|
jo.put("code",key);
|
|
|
String key = i + "";
|
|
|
jo.put("name", getLevel2Name(key, type));
|
|
|
jo.put("code", key);
|
|
|
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":1:"+adminTeam.getKey().toString()+":"+key+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":1:" + adminTeam.getKey().toString() + ":" + key + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jo.toString());
|
|
|
|
|
|
level2.put(jo);
|
|
|
|
|
|
}
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":1:"+adminTeam.getKey().toString()+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":1:" + adminTeam.getKey().toString() + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), level2.toString());
|
|
|
}
|
|
|
}
|
|
|
private void saveLevel2Org(String wlyyQuotaId, Map<String, Hospital> hospitalsMap, Map<String, Map<String, List<ETLModel>>> eltModel, Map<String, Map<String, List<ETLModel>>> deleteEltModel, Integer foreachNum, Integer type,Integer start) {
|
|
|
for(Map.Entry<String,Hospital> hospital:hospitalsMap.entrySet()){
|
|
|
Map<String, List<ETLModel>> oneELTMap= eltModel.get(hospital.getKey());
|
|
|
Map<String, List<ETLModel>> deleteOneELTMap= deleteEltModel.get(hospital.getKey());
|
|
|
for(int i=start;i<=foreachNum;i++){
|
|
|
Hospital hospitalObj=hospital.getValue();
|
|
|
if(hospitalObj==null)continue;
|
|
|
JSONObject jo=new JSONObject();
|
|
|
int num=0;
|
|
|
if(oneELTMap!=null){
|
|
|
List<ETLModel> etlModel= oneELTMap.get(i+"");
|
|
|
if(etlModel!=null&&etlModel.size()>0){
|
|
|
num=etlModel.size();
|
|
|
|
|
|
private void saveLevel2Org(String wlyyQuotaId, Map<String, Hospital> hospitalsMap, Map<String, Map<String, List<ETLModel>>> eltModel, Map<String, Map<String, List<ETLModel>>> deleteEltModel, Integer foreachNum, Integer type, Integer start) {
|
|
|
for (Map.Entry<String, Hospital> hospital : hospitalsMap.entrySet()) {
|
|
|
Map<String, List<ETLModel>> oneELTMap = eltModel.get(hospital.getKey());
|
|
|
Map<String, List<ETLModel>> deleteOneELTMap = deleteEltModel.get(hospital.getKey());
|
|
|
for (int i = start; i <= foreachNum; i++) {
|
|
|
Hospital hospitalObj = hospital.getValue();
|
|
|
if (hospitalObj == null) continue;
|
|
|
JSONObject jo = new JSONObject();
|
|
|
int num = 0;
|
|
|
if (oneELTMap != null) {
|
|
|
List<ETLModel> etlModel = oneELTMap.get(i + "");
|
|
|
if (etlModel != null && etlModel.size() > 0) {
|
|
|
num = etlModel.size();
|
|
|
}
|
|
|
}
|
|
|
if(deleteOneELTMap!=null){
|
|
|
List<ETLModel> etlModel1= deleteOneELTMap.get(i+"");
|
|
|
if(etlModel1!=null&&etlModel1.size()>0){
|
|
|
num=num-etlModel1.size();
|
|
|
if (deleteOneELTMap != null) {
|
|
|
List<ETLModel> etlModel1 = deleteOneELTMap.get(i + "");
|
|
|
if (etlModel1 != null && etlModel1.size() > 0) {
|
|
|
num = num - etlModel1.size();
|
|
|
}
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", hospitalObj.getName());
|
|
|
jo.put("code", hospitalObj.getCode());
|
|
|
String key=i+"";
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:"+wlyyQuotaId+":2:"+key+":"+hospital.getKey()).toString(), jo.toString());
|
|
|
String key = i + "";
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:" + wlyyQuotaId + ":2:" + key + ":" + hospital.getKey()).toString(), jo.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
private void saveLevel2Town(String wlyyQuotaId, Map<String, Town> townsMap, Map<String, Map<String, List<ETLModel>>> eltModel, Integer foreachNum, Integer type,Integer start) {
|
|
|
for(Map.Entry<String,Town> town:townsMap.entrySet()){
|
|
|
Map<String, List<ETLModel>> oneELTMap= eltModel.get(town.getKey());
|
|
|
JSONArray level2=new JSONArray();
|
|
|
for(int i=start;i<=foreachNum;i++){
|
|
|
JSONObject jo=new JSONObject();
|
|
|
int num=0;
|
|
|
if(oneELTMap!=null){
|
|
|
List<ETLModel> etlModel= oneELTMap.get(i+"");
|
|
|
if(etlModel!=null&&etlModel.size()>0){
|
|
|
num=etlModel.size();
|
|
|
|
|
|
private void saveLevel2Town(String wlyyQuotaId, Map<String, Town> townsMap, Map<String, Map<String, List<ETLModel>>> eltModel, Integer foreachNum, Integer type, Integer start) {
|
|
|
for (Map.Entry<String, Town> town : townsMap.entrySet()) {
|
|
|
Map<String, List<ETLModel>> oneELTMap = eltModel.get(town.getKey());
|
|
|
JSONArray level2 = new JSONArray();
|
|
|
for (int i = start; i <= foreachNum; i++) {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
int num = 0;
|
|
|
if (oneELTMap != null) {
|
|
|
List<ETLModel> etlModel = oneELTMap.get(i + "");
|
|
|
if (etlModel != null && etlModel.size() > 0) {
|
|
|
num = etlModel.size();
|
|
|
}
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
String key=i+"";
|
|
|
jo.put("name", getLevel2Name(key,type));
|
|
|
jo.put("code",key);
|
|
|
String key = i + "";
|
|
|
jo.put("name", getLevel2Name(key, type));
|
|
|
jo.put("code", key);
|
|
|
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":3:"+town.getKey()+":"+key+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":3:" + town.getKey() + ":" + key + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jo.toString());
|
|
|
level2.put(jo);
|
|
|
|
|
|
}
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":3:"+town.getKey()+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":3:" + town.getKey() + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), level2.toString());
|
|
|
}
|
|
|
}
|
|
|
private void saveLevel2Org(String wlyyQuotaId, Map<String, Hospital> hospitalsMap, Map<String, Map<String, List<ETLModel>>> eltModel,Integer foreachNum, Integer type,Integer start) {
|
|
|
Map<String,Map<String,JSONArray>> townjr=new HashMap<String,Map<String,JSONArray>>();
|
|
|
for(Map.Entry<String,Hospital> hospital:hospitalsMap.entrySet()){
|
|
|
Map<String, List<ETLModel>> oneELTMap= eltModel.get(hospital.getKey());
|
|
|
JSONArray level2=new JSONArray();
|
|
|
for(int i=start;i<=foreachNum;i++){
|
|
|
Hospital hospitalObj=hospital.getValue();
|
|
|
if(hospitalObj==null)continue;
|
|
|
JSONObject jo=new JSONObject();
|
|
|
int num=0;
|
|
|
if(oneELTMap!=null){
|
|
|
List<ETLModel> etlModel= oneELTMap.get(i+"");
|
|
|
if(etlModel!=null&&etlModel.size()>0){
|
|
|
num=etlModel.size();
|
|
|
|
|
|
private void saveLevel2Org(String wlyyQuotaId, Map<String, Hospital> hospitalsMap, Map<String, Map<String, List<ETLModel>>> eltModel, Integer foreachNum, Integer type, Integer start) {
|
|
|
Map<String, Map<String, JSONArray>> townjr = new HashMap<String, Map<String, JSONArray>>();
|
|
|
for (Map.Entry<String, Hospital> hospital : hospitalsMap.entrySet()) {
|
|
|
Map<String, List<ETLModel>> oneELTMap = eltModel.get(hospital.getKey());
|
|
|
JSONArray level2 = new JSONArray();
|
|
|
for (int i = start; i <= foreachNum; i++) {
|
|
|
Hospital hospitalObj = hospital.getValue();
|
|
|
if (hospitalObj == null) continue;
|
|
|
JSONObject jo = new JSONObject();
|
|
|
int num = 0;
|
|
|
if (oneELTMap != null) {
|
|
|
List<ETLModel> etlModel = oneELTMap.get(i + "");
|
|
|
if (etlModel != null && etlModel.size() > 0) {
|
|
|
num = etlModel.size();
|
|
|
}
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
String key=i+"";
|
|
|
jo.put("name", getLevel2Name(key,type));
|
|
|
jo.put("code",key);
|
|
|
String key = i + "";
|
|
|
jo.put("name", getLevel2Name(key, type));
|
|
|
jo.put("code", key);
|
|
|
|
|
|
addJOLeval2(townjr,hospitalObj.getTown(),key,jo);
|
|
|
addJOLeval2(townjr, hospitalObj.getTown(), key, jo);
|
|
|
level2.put(jo);
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":2:"+hospital.getKey().toString()+":"+key+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":2:" + hospital.getKey().toString() + ":" + key + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jo.toString());
|
|
|
|
|
|
}
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":2:"+hospital.getKey().toString()+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":2:" + hospital.getKey().toString() + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), level2.toString());
|
|
|
}
|
|
|
}
|
|
|
private void saveLevel2Town(String wlyyQuotaId, Map<String, Town> townsMap, Map<String, Map<String, List<ETLModel>>> eltModel, Map<String, Map<String, List<ETLModel>>> deleteEltModel, Integer foreachNum, Integer type,Integer start) {
|
|
|
for(Map.Entry<String,Town> town:townsMap.entrySet()){
|
|
|
Map<String, List<ETLModel>> oneELTMap= eltModel.get(town.getKey());
|
|
|
Map<String, List<ETLModel>> deleteOneELTMap= deleteEltModel.get(town.getKey());
|
|
|
for(int i=1;i<=foreachNum;i++){
|
|
|
JSONObject jo=new JSONObject();
|
|
|
int num=0;
|
|
|
if(oneELTMap!=null){
|
|
|
List<ETLModel> etlModel= oneELTMap.get(i+"");
|
|
|
if(etlModel!=null&&etlModel.size()>0){
|
|
|
num=etlModel.size();
|
|
|
|
|
|
private void saveLevel2Town(String wlyyQuotaId, Map<String, Town> townsMap, Map<String, Map<String, List<ETLModel>>> eltModel, Map<String, Map<String, List<ETLModel>>> deleteEltModel, Integer foreachNum, Integer type, Integer start) {
|
|
|
for (Map.Entry<String, Town> town : townsMap.entrySet()) {
|
|
|
Map<String, List<ETLModel>> oneELTMap = eltModel.get(town.getKey());
|
|
|
Map<String, List<ETLModel>> deleteOneELTMap = deleteEltModel.get(town.getKey());
|
|
|
for (int i = 1; i <= foreachNum; i++) {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
int num = 0;
|
|
|
if (oneELTMap != null) {
|
|
|
List<ETLModel> etlModel = oneELTMap.get(i + "");
|
|
|
if (etlModel != null && etlModel.size() > 0) {
|
|
|
num = etlModel.size();
|
|
|
}
|
|
|
}
|
|
|
if(deleteOneELTMap!=null){
|
|
|
List<ETLModel> etlModel1= deleteOneELTMap.get(i+"");
|
|
|
if(etlModel1!=null&&etlModel1.size()>0){
|
|
|
num=num-etlModel1.size();
|
|
|
if (deleteOneELTMap != null) {
|
|
|
List<ETLModel> etlModel1 = deleteOneELTMap.get(i + "");
|
|
|
if (etlModel1 != null && etlModel1.size() > 0) {
|
|
|
num = num - etlModel1.size();
|
|
|
}
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", town.getValue().getName());
|
|
|
jo.put("code", town.getValue().getCode());
|
|
|
String key=i+"";
|
|
|
jo.put("name", getLevel2Name(key,type));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:"+wlyyQuotaId+":3:"+key+":"+town.getKey()).toString(), jo.toString());
|
|
|
String key = i + "";
|
|
|
jo.put("name", getLevel2Name(key, type));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:" + wlyyQuotaId + ":3:" + key + ":" + town.getKey()).toString(), jo.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void saveLevel2City(String wlyyQuotaId, Map<String, City> cityMap, Map<String, Map<String, List<ETLModel>>> eltModel, Map<String, Map<String, List<ETLModel>>> deleteEltModel, Integer foreachNum, Integer type,Integer start) {
|
|
|
for(Map.Entry<String,City> city:cityMap.entrySet()){
|
|
|
Map<String, List<ETLModel>> oneELTMap= eltModel.get(city.getKey());
|
|
|
Map<String, List<ETLModel>> deleteOneELTMap= deleteEltModel.get(city.getKey());
|
|
|
for(int i=start;i<=foreachNum;i++){
|
|
|
JSONObject jo=new JSONObject();
|
|
|
int num=0;
|
|
|
if(oneELTMap!=null){
|
|
|
List<ETLModel> etlModel= oneELTMap.get(i+"");
|
|
|
if(etlModel!=null&&etlModel.size()>0){
|
|
|
num=etlModel.size();
|
|
|
private void saveLevel2City(String wlyyQuotaId, Map<String, City> cityMap, Map<String, Map<String, List<ETLModel>>> eltModel, Map<String, Map<String, List<ETLModel>>> deleteEltModel, Integer foreachNum, Integer type, Integer start) {
|
|
|
for (Map.Entry<String, City> city : cityMap.entrySet()) {
|
|
|
Map<String, List<ETLModel>> oneELTMap = eltModel.get(city.getKey());
|
|
|
Map<String, List<ETLModel>> deleteOneELTMap = deleteEltModel.get(city.getKey());
|
|
|
for (int i = start; i <= foreachNum; i++) {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
int num = 0;
|
|
|
if (oneELTMap != null) {
|
|
|
List<ETLModel> etlModel = oneELTMap.get(i + "");
|
|
|
if (etlModel != null && etlModel.size() > 0) {
|
|
|
num = etlModel.size();
|
|
|
}
|
|
|
}
|
|
|
if(deleteOneELTMap!=null){
|
|
|
List<ETLModel> etlModel1= deleteOneELTMap.get(i+"");
|
|
|
if(etlModel1!=null&&etlModel1.size()>0){
|
|
|
num=num-etlModel1.size();
|
|
|
if (deleteOneELTMap != null) {
|
|
|
List<ETLModel> etlModel1 = deleteOneELTMap.get(i + "");
|
|
|
if (etlModel1 != null && etlModel1.size() > 0) {
|
|
|
num = num - etlModel1.size();
|
|
|
}
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", city.getValue().getName());
|
|
|
jo.put("code", city.getValue().getCode());
|
|
|
String key=i+"";
|
|
|
jo.put("name", getLevel2Name(key,type));
|
|
|
jo.put("name", getLevel2Name(key,type));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:"+wlyyQuotaId+":4:"+key+":"+city.getKey()).toString(), jo.toString());
|
|
|
String key = i + "";
|
|
|
jo.put("name", getLevel2Name(key, type));
|
|
|
jo.put("name", getLevel2Name(key, type));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:" + wlyyQuotaId + ":4:" + key + ":" + city.getKey()).toString(), jo.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
private void saveLevel2City(String wlyyQuotaId, Map<String, City> cityMap, Map<String, Map<String, List<ETLModel>>> eltModel, Integer foreachNum, Integer type,Integer start) {
|
|
|
for(Map.Entry<String,City> city:cityMap.entrySet()){
|
|
|
Map<String, List<ETLModel>> oneELTMap= eltModel.get(city.getKey());
|
|
|
JSONArray level2=new JSONArray();
|
|
|
for(int i=start;i<=foreachNum;i++){
|
|
|
JSONObject jo=new JSONObject();
|
|
|
int num=0;
|
|
|
if(oneELTMap!=null){
|
|
|
List<ETLModel> etlModel= oneELTMap.get(i+"");
|
|
|
if(etlModel!=null&&etlModel.size()>0){
|
|
|
num=etlModel.size();
|
|
|
|
|
|
private void saveLevel2City(String wlyyQuotaId, Map<String, City> cityMap, Map<String, Map<String, List<ETLModel>>> eltModel, Integer foreachNum, Integer type, Integer start) {
|
|
|
for (Map.Entry<String, City> city : cityMap.entrySet()) {
|
|
|
Map<String, List<ETLModel>> oneELTMap = eltModel.get(city.getKey());
|
|
|
JSONArray level2 = new JSONArray();
|
|
|
for (int i = start; i <= foreachNum; i++) {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
int num = 0;
|
|
|
if (oneELTMap != null) {
|
|
|
List<ETLModel> etlModel = oneELTMap.get(i + "");
|
|
|
if (etlModel != null && etlModel.size() > 0) {
|
|
|
num = etlModel.size();
|
|
|
}
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
String key=i+"";
|
|
|
String key = i + "";
|
|
|
jo.put("code", key);
|
|
|
jo.put("name", getLevel2Name(key,type));
|
|
|
jo.put("name", getLevel2Name(key, type));
|
|
|
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":4:"+city.getKey()+":"+key+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":4:" + city.getKey() + ":" + key + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), jo.toString());
|
|
|
level2.put(jo);
|
|
|
}
|
|
|
StringBuffer sb=new StringBuffer("quota:"+wlyyQuotaId+":4:"+city.getKey()+":"+timeKey);
|
|
|
StringBuffer sb = new StringBuffer("quota:" + wlyyQuotaId + ":4:" + city.getKey() + ":" + timeKey);
|
|
|
keys.add(sb.toString());
|
|
|
redisTemplate.opsForValue().set(sb.toString(), level2.toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void saveLevel1Team(String wlyyQuotaId, Map<String, AdminTeam> adminTeamMap, Map<String, List<ETLModel>> adminTeam) {
|
|
|
JSONArray cityjr=new JSONArray();
|
|
|
Map<String,JSONArray> townjr=new HashMap<String,JSONArray>();//key是town
|
|
|
Map<String,JSONArray> orgjr=new HashMap<String,JSONArray>();//key是机构
|
|
|
for(Map.Entry<String,AdminTeam> entry:adminTeamMap.entrySet()){
|
|
|
JSONObject jo=new JSONObject();
|
|
|
Integer num=0;
|
|
|
AdminTeam adminTeamObj=entry.getValue();
|
|
|
if(adminTeamObj==null)continue;
|
|
|
List<ETLModel> etlList=adminTeam.get(entry.getKey());
|
|
|
if(etlList!=null&&etlList.size()>0){
|
|
|
num=etlList.size();
|
|
|
JSONArray cityjr = new JSONArray();
|
|
|
Map<String, JSONArray> townjr = new HashMap<String, JSONArray>();//key是town
|
|
|
Map<String, JSONArray> orgjr = new HashMap<String, JSONArray>();//key是机构
|
|
|
for (Map.Entry<String, AdminTeam> entry : adminTeamMap.entrySet()) {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
Integer num = 0;
|
|
|
AdminTeam adminTeamObj = entry.getValue();
|
|
|
if (adminTeamObj == null) continue;
|
|
|
List<ETLModel> etlList = adminTeam.get(entry.getKey());
|
|
|
if (etlList != null && etlList.size() > 0) {
|
|
|
num = etlList.size();
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", adminTeamObj.getName());
|
|
|
jo.put("code", adminTeamObj.getId()+"");
|
|
|
jo.put("code", adminTeamObj.getId() + "");
|
|
|
|
|
|
String orgKey=adminTeamObj.getOrgCode();
|
|
|
Hospital hospital=hospitalsMap.get(orgKey);
|
|
|
if(hospital==null)continue;
|
|
|
String townKey=hospital.getTown();
|
|
|
String orgKey = adminTeamObj.getOrgCode();
|
|
|
Hospital hospital = hospitalsMap.get(orgKey);
|
|
|
if (hospital == null) continue;
|
|
|
String townKey = hospital.getTown();
|
|
|
|
|
|
cityjr.put(jo);
|
|
|
addJO(townjr,townKey,jo);
|
|
|
addJO(orgjr,orgKey,jo);
|
|
|
addJO(townjr, townKey, jo);
|
|
|
addJO(orgjr, orgKey, jo);
|
|
|
|
|
|
StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":1:"+entry.getKey()+":"+timeKey);
|
|
|
StringBuffer key = new StringBuffer("quota:" + wlyyQuotaId + ":1:" + entry.getKey() + ":" + timeKey);
|
|
|
keys.add(key.toString());
|
|
|
redisTemplate.opsForValue().set(key.toString(), jo.toString());
|
|
|
}
|
|
|
//保存市下面全部的团队
|
|
|
StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":4:"+Constant.city+":1:"+timeKey);
|
|
|
StringBuffer key = new StringBuffer("quota:" + wlyyQuotaId + ":4:" + Constant.city + ":1:" + timeKey);
|
|
|
keys.add(key.toString());
|
|
|
redisTemplate.opsForValue().set(key.toString(), cityjr.toString());
|
|
|
|
|
|
//保存区下面全部的团队
|
|
|
for(Map.Entry<String,JSONArray> entry:townjr.entrySet()){
|
|
|
key=new StringBuffer("quota:"+wlyyQuotaId+":3:"+entry.getKey()+":1:"+timeKey);
|
|
|
for (Map.Entry<String, JSONArray> entry : townjr.entrySet()) {
|
|
|
key = new StringBuffer("quota:" + wlyyQuotaId + ":3:" + entry.getKey() + ":1:" + timeKey);
|
|
|
keys.add(key.toString());
|
|
|
redisTemplate.opsForValue().set(key.toString(), entry.getValue().toString());
|
|
|
}
|
|
|
//保存机构下面全部的团队
|
|
|
for(Map.Entry<String,JSONArray> entry:orgjr.entrySet()){
|
|
|
key=new StringBuffer("quota:"+wlyyQuotaId+":2:"+entry.getKey()+":1:"+timeKey);
|
|
|
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());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
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()){
|
|
|
JSONObject jo=new JSONObject();
|
|
|
Integer num=0;
|
|
|
AdminTeam adminTeamObj=entry.getValue();
|
|
|
if(adminTeamObj==null)continue;
|
|
|
List<ETLModel> etlList=adminTeam.get(entry.getKey());
|
|
|
if(etlList!=null&&etlList.size()>0){
|
|
|
num=etlList.size();
|
|
|
for (Map.Entry<String, AdminTeam> entry : adminTeamMap.entrySet()) {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
Integer num = 0;
|
|
|
AdminTeam adminTeamObj = entry.getValue();
|
|
|
if (adminTeamObj == null) continue;
|
|
|
List<ETLModel> etlList = adminTeam.get(entry.getKey());
|
|
|
if (etlList != null && etlList.size() > 0) {
|
|
|
num = etlList.size();
|
|
|
}
|
|
|
if(deleteAdminTeam!=null&&deleteAdminTeam.size()>0){
|
|
|
List<ETLModel> deleteEtlList=deleteAdminTeam.get(entry.getKey());
|
|
|
if(deleteEtlList!=null&&deleteEtlList.size()>0){
|
|
|
num=num-deleteEtlList.size();
|
|
|
if (deleteAdminTeam != null && deleteAdminTeam.size() > 0) {
|
|
|
List<ETLModel> deleteEtlList = deleteAdminTeam.get(entry.getKey());
|
|
|
if (deleteEtlList != null && deleteEtlList.size() > 0) {
|
|
|
num = num - deleteEtlList.size();
|
|
|
}
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", adminTeamObj.getName());
|
|
|
jo.put("code", adminTeamObj.getId());
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:"+wlyyQuotaId+":1:"+entry.getKey()).toString()+":0", jo.toString());
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:" + wlyyQuotaId + ":1:" + entry.getKey()).toString() + ":0", jo.toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void saveLevel1Org(String wlyyQuotaId, Map<String, Hospital> hospitalsMap, Map<String, List<ETLModel>> orgTeam) {
|
|
|
JSONArray cityjr=new JSONArray();
|
|
|
Map<String,JSONArray> townjr=new HashMap<String,JSONArray>();
|
|
|
for(Map.Entry<String,Hospital> entry:hospitalsMap.entrySet()){
|
|
|
Hospital hospital=entry.getValue();
|
|
|
if(hospital==null)continue;
|
|
|
JSONObject jo=new JSONObject();
|
|
|
Integer num=0;
|
|
|
List<ETLModel> etlList=orgTeam.get(entry.getKey());
|
|
|
if(etlList!=null&&etlList.size()>0){
|
|
|
num=etlList.size();
|
|
|
JSONArray cityjr = new JSONArray();
|
|
|
Map<String, JSONArray> townjr = new HashMap<String, JSONArray>();
|
|
|
for (Map.Entry<String, Hospital> entry : hospitalsMap.entrySet()) {
|
|
|
Hospital hospital = entry.getValue();
|
|
|
if (hospital == null) continue;
|
|
|
JSONObject jo = new JSONObject();
|
|
|
Integer num = 0;
|
|
|
List<ETLModel> etlList = orgTeam.get(entry.getKey());
|
|
|
if (etlList != null && etlList.size() > 0) {
|
|
|
num = etlList.size();
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
@ -970,166 +991,169 @@ public class RedisStorage {
|
|
|
jo.put("code", hospital.getCode());
|
|
|
|
|
|
cityjr.put(jo);
|
|
|
String townKey=hospital.getTown();
|
|
|
String townKey = hospital.getTown();
|
|
|
addJO(townjr, townKey, jo);
|
|
|
|
|
|
StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":2:"+entry.getKey()+":"+timeKey);
|
|
|
StringBuffer key = new StringBuffer("quota:" + wlyyQuotaId + ":2:" + entry.getKey() + ":" + timeKey);
|
|
|
keys.add(key.toString());
|
|
|
redisTemplate.opsForValue().set(key.toString(), jo.toString());
|
|
|
}
|
|
|
//保存市下面全部的机构
|
|
|
StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":4:"+Constant.city+":2:"+timeKey);
|
|
|
StringBuffer key = new StringBuffer("quota:" + wlyyQuotaId + ":4:" + Constant.city + ":2:" + timeKey);
|
|
|
keys.add(key.toString());
|
|
|
redisTemplate.opsForValue().set(key.toString(), cityjr.toString());
|
|
|
|
|
|
//保存区下面全部的机构
|
|
|
for(Map.Entry<String,JSONArray> entry:townjr.entrySet()){
|
|
|
key=new StringBuffer("quota:"+wlyyQuotaId+":3:"+entry.getKey()+":2:"+timeKey);
|
|
|
for (Map.Entry<String, JSONArray> entry : townjr.entrySet()) {
|
|
|
key = new StringBuffer("quota:" + wlyyQuotaId + ":3:" + entry.getKey() + ":2:" + timeKey);
|
|
|
keys.add(key.toString());
|
|
|
redisTemplate.opsForValue().set(key.toString(), entry.getValue().toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void addJO(Map<String, JSONArray> townjr,String key, JSONObject jo) {
|
|
|
if(townjr.containsKey(key)){
|
|
|
private void addJO(Map<String, JSONArray> townjr, String key, JSONObject jo) {
|
|
|
if (townjr.containsKey(key)) {
|
|
|
townjr.get(key).put(jo);
|
|
|
}else{
|
|
|
JSONArray townjrList=new JSONArray();
|
|
|
} else {
|
|
|
JSONArray townjrList = new JSONArray();
|
|
|
townjrList.put(jo);
|
|
|
townjr.put(key,townjrList);
|
|
|
townjr.put(key, townjrList);
|
|
|
}
|
|
|
}
|
|
|
private void addJOLeval2(Map<String,Map<String, JSONArray>> townjr,String key1,String key2, JSONObject jo) {
|
|
|
if(townjr.containsKey(key1)){
|
|
|
Map<String, JSONArray> level2=townjr.get(key1);
|
|
|
if(level2.containsKey(key2)){
|
|
|
JSONArray jr=level2.get(key2);
|
|
|
|
|
|
private void addJOLeval2(Map<String, Map<String, JSONArray>> townjr, String key1, String key2, JSONObject jo) {
|
|
|
if (townjr.containsKey(key1)) {
|
|
|
Map<String, JSONArray> level2 = townjr.get(key1);
|
|
|
if (level2.containsKey(key2)) {
|
|
|
JSONArray jr = level2.get(key2);
|
|
|
jr.put(jo);
|
|
|
}else{
|
|
|
JSONArray jr=new JSONArray();
|
|
|
} else {
|
|
|
JSONArray jr = new JSONArray();
|
|
|
jr.put(jo);
|
|
|
level2.put(key2,jr);
|
|
|
level2.put(key2, jr);
|
|
|
}
|
|
|
}else{
|
|
|
Map<String, JSONArray> level2=new HashMap<>();
|
|
|
JSONArray jr=new JSONArray();
|
|
|
} else {
|
|
|
Map<String, JSONArray> level2 = new HashMap<>();
|
|
|
JSONArray jr = new JSONArray();
|
|
|
jr.put(jo);
|
|
|
level2.put(key2,jr);
|
|
|
townjr.put(key1,level2);
|
|
|
level2.put(key2, jr);
|
|
|
townjr.put(key1, level2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void addJOLeval3(Map<String,Map<String, Map<String, JSONArray>>> townjr,String key1,String key2,String key3, JSONObject jo) {
|
|
|
if(townjr.containsKey(key1)){
|
|
|
Map<String, Map<String, JSONArray>> level1= townjr.get(key1);
|
|
|
if(level1.containsKey(key2)){
|
|
|
Map<String, JSONArray> level2=level1.get(key2);
|
|
|
if(level2.containsKey(key3)){
|
|
|
JSONArray jr=level2.get(key3);
|
|
|
private void addJOLeval3(Map<String, Map<String, Map<String, JSONArray>>> townjr, String key1, String key2, String key3, JSONObject jo) {
|
|
|
if (townjr.containsKey(key1)) {
|
|
|
Map<String, Map<String, JSONArray>> level1 = townjr.get(key1);
|
|
|
if (level1.containsKey(key2)) {
|
|
|
Map<String, JSONArray> level2 = level1.get(key2);
|
|
|
if (level2.containsKey(key3)) {
|
|
|
JSONArray jr = level2.get(key3);
|
|
|
jr.put(jo);
|
|
|
}else{
|
|
|
JSONArray jr=new JSONArray();
|
|
|
} else {
|
|
|
JSONArray jr = new JSONArray();
|
|
|
jr.put(jo);
|
|
|
level2.put(key3,jr);
|
|
|
level2.put(key3, jr);
|
|
|
}
|
|
|
}else{
|
|
|
Map<String, JSONArray> level2=new HashMap<>();
|
|
|
JSONArray jr=new JSONArray();
|
|
|
} else {
|
|
|
Map<String, JSONArray> level2 = new HashMap<>();
|
|
|
JSONArray jr = new JSONArray();
|
|
|
jr.put(jo);
|
|
|
level2.put(key3,jr);
|
|
|
level1.put(key2,level2);
|
|
|
level2.put(key3, jr);
|
|
|
level1.put(key2, level2);
|
|
|
}
|
|
|
}else{
|
|
|
Map<String, Map<String, JSONArray>> level1=new HashMap<>();
|
|
|
Map<String, JSONArray> level2=new HashMap<>();
|
|
|
JSONArray level3=new JSONArray();
|
|
|
} else {
|
|
|
Map<String, Map<String, JSONArray>> level1 = new HashMap<>();
|
|
|
Map<String, JSONArray> level2 = new HashMap<>();
|
|
|
JSONArray level3 = new JSONArray();
|
|
|
level3.put(jo);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void saveLevel1Org(String wlyyQuotaId, Map<String, Hospital> hospitalsMap, Map<String, List<ETLModel>> orgTeam, Map<String, List<ETLModel>> deleteOrgTeam) {
|
|
|
for(Map.Entry<String,Hospital> entry:hospitalsMap.entrySet()){
|
|
|
Hospital hospital=entry.getValue();
|
|
|
if(hospital==null)continue;
|
|
|
JSONObject jo=new JSONObject();
|
|
|
Integer num=0;
|
|
|
List<ETLModel> etlList=orgTeam.get(entry.getKey());
|
|
|
if(etlList!=null&&etlList.size()>0){
|
|
|
num=etlList.size();
|
|
|
for (Map.Entry<String, Hospital> entry : hospitalsMap.entrySet()) {
|
|
|
Hospital hospital = entry.getValue();
|
|
|
if (hospital == null) continue;
|
|
|
JSONObject jo = new JSONObject();
|
|
|
Integer num = 0;
|
|
|
List<ETLModel> etlList = orgTeam.get(entry.getKey());
|
|
|
if (etlList != null && etlList.size() > 0) {
|
|
|
num = etlList.size();
|
|
|
}
|
|
|
if(deleteOrgTeam!=null&&deleteOrgTeam.size()>0){
|
|
|
List<ETLModel> deleteEtlList=deleteOrgTeam.get(entry.getKey());
|
|
|
if(deleteEtlList!=null&&deleteEtlList.size()>0){
|
|
|
num=num-deleteEtlList.size();
|
|
|
if (deleteOrgTeam != null && deleteOrgTeam.size() > 0) {
|
|
|
List<ETLModel> deleteEtlList = deleteOrgTeam.get(entry.getKey());
|
|
|
if (deleteEtlList != null && deleteEtlList.size() > 0) {
|
|
|
num = num - deleteEtlList.size();
|
|
|
}
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", hospital.getName());
|
|
|
jo.put("code", hospital.getCode());
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:"+wlyyQuotaId+":2:"+entry.getKey()).toString()+":0", jo.toString());
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:" + wlyyQuotaId + ":2:" + entry.getKey()).toString() + ":0", jo.toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void saveLevel1Town(String wlyyQuotaId, Map<String, Town> townsMap, Map<String, List<ETLModel>> townTeam, Map<String, List<ETLModel>> deleteTownTeam) {
|
|
|
|
|
|
for(Map.Entry<String,Town> entry:townsMap.entrySet()){
|
|
|
JSONObject jo=new JSONObject();
|
|
|
Integer num=0;
|
|
|
List<ETLModel> etlList=townTeam.get(entry.getKey());
|
|
|
if(etlList!=null&&etlList.size()>0){
|
|
|
num=etlList.size();
|
|
|
for (Map.Entry<String, Town> entry : townsMap.entrySet()) {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
Integer num = 0;
|
|
|
List<ETLModel> etlList = townTeam.get(entry.getKey());
|
|
|
if (etlList != null && etlList.size() > 0) {
|
|
|
num = etlList.size();
|
|
|
}
|
|
|
if(deleteTownTeam!=null&&deleteTownTeam.size()>0){
|
|
|
List<ETLModel> deleteEtlList=deleteTownTeam.get(entry.getKey());
|
|
|
if(deleteEtlList!=null&&deleteEtlList.size()>0){
|
|
|
num=num-deleteEtlList.size();
|
|
|
if (deleteTownTeam != null && deleteTownTeam.size() > 0) {
|
|
|
List<ETLModel> deleteEtlList = deleteTownTeam.get(entry.getKey());
|
|
|
if (deleteEtlList != null && deleteEtlList.size() > 0) {
|
|
|
num = num - deleteEtlList.size();
|
|
|
}
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", entry.getValue().getName());
|
|
|
jo.put("code", entry.getValue().getCode());
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:"+wlyyQuotaId+":3:"+entry.getKey()).toString(), jo.toString());
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:" + wlyyQuotaId + ":3:" + entry.getKey()).toString(), jo.toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void saveLevel1Town(String wlyyQuotaId, Map<String, Town> townsMap, Map<String, List<ETLModel>> townTeam) {
|
|
|
JSONArray jr=new JSONArray();
|
|
|
for(Map.Entry<String,Town> entry:townsMap.entrySet()){
|
|
|
JSONObject jo=new JSONObject();
|
|
|
Integer num=0;
|
|
|
List<ETLModel> etlList=townTeam.get(entry.getKey());
|
|
|
if(etlList!=null&&etlList.size()>0){
|
|
|
num=etlList.size();
|
|
|
JSONArray jr = new JSONArray();
|
|
|
for (Map.Entry<String, Town> entry : townsMap.entrySet()) {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
Integer num = 0;
|
|
|
List<ETLModel> etlList = townTeam.get(entry.getKey());
|
|
|
if (etlList != null && etlList.size() > 0) {
|
|
|
num = etlList.size();
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", entry.getValue().getName());
|
|
|
jo.put("code", entry.getValue().getCode());
|
|
|
jr.put(jo);
|
|
|
StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":3:"+entry.getKey()+":"+timeKey);
|
|
|
StringBuffer key = new StringBuffer("quota:" + wlyyQuotaId + ":3:" + entry.getKey() + ":" + timeKey);
|
|
|
keys.add(key.toString());
|
|
|
redisTemplate.opsForValue().set(key.toString(), jo.toString());
|
|
|
}
|
|
|
//保存市下面全部的区
|
|
|
StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":4:"+Constant.city+":3:"+timeKey);
|
|
|
StringBuffer key = new StringBuffer("quota:" + wlyyQuotaId + ":4:" + Constant.city + ":3:" + timeKey);
|
|
|
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, Map<String, List<ETLModel>> deleteCityTeam) {
|
|
|
JSONArray jr=new JSONArray();
|
|
|
for(Map.Entry<String,City> entry:cityMap.entrySet()){
|
|
|
JSONObject jo=new JSONObject();
|
|
|
Integer num=0;
|
|
|
List<ETLModel> etlList=cityTeam.get(entry.getKey());
|
|
|
if(etlList!=null&&etlList.size()>0){
|
|
|
num=etlList.size();
|
|
|
JSONArray jr = new JSONArray();
|
|
|
for (Map.Entry<String, City> entry : cityMap.entrySet()) {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
Integer num = 0;
|
|
|
List<ETLModel> etlList = cityTeam.get(entry.getKey());
|
|
|
if (etlList != null && etlList.size() > 0) {
|
|
|
num = etlList.size();
|
|
|
}
|
|
|
if(deleteCityTeam!=null&&deleteCityTeam.size()>0){
|
|
|
List<ETLModel> deleteEtlList=deleteCityTeam.get(entry.getKey());
|
|
|
if(deleteEtlList!=null&&deleteEtlList.size()>0){
|
|
|
num=num-deleteEtlList.size();
|
|
|
if (deleteCityTeam != null && deleteCityTeam.size() > 0) {
|
|
|
List<ETLModel> deleteEtlList = deleteCityTeam.get(entry.getKey());
|
|
|
if (deleteEtlList != null && deleteEtlList.size() > 0) {
|
|
|
num = num - deleteEtlList.size();
|
|
|
}
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
@ -1138,72 +1162,79 @@ public class RedisStorage {
|
|
|
jo.put("code", entry.getValue().getCode());
|
|
|
jr.put(jo);
|
|
|
}
|
|
|
StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":4:"+Constant.city+":");
|
|
|
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()){
|
|
|
JSONObject jo=new JSONObject();
|
|
|
Integer num=0;
|
|
|
List<ETLModel> etlList=cityTeam.get(entry.getKey());
|
|
|
if(etlList!=null&&etlList.size()>0){
|
|
|
num=etlList.size();
|
|
|
for (Map.Entry<String, City> entry : cityMap.entrySet()) {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
Integer num = 0;
|
|
|
List<ETLModel> etlList = cityTeam.get(entry.getKey());
|
|
|
if (etlList != null && etlList.size() > 0) {
|
|
|
num = etlList.size();
|
|
|
}
|
|
|
jo.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
jo.put("num", num);
|
|
|
jo.put("name", entry.getValue().getName());
|
|
|
jo.put("code", entry.getValue().getCode());
|
|
|
StringBuffer key=new StringBuffer("quota:"+wlyyQuotaId+":4:"+Constant.city+":"+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){
|
|
|
case 1:{
|
|
|
switch (type) {
|
|
|
case 1: {
|
|
|
//性别
|
|
|
return Constant.getLevelSexName(i);
|
|
|
}
|
|
|
case 2:{
|
|
|
case 2: {
|
|
|
//年龄
|
|
|
return Constant.getLevelAgeName(i);
|
|
|
}
|
|
|
case 3:{
|
|
|
case 3: {
|
|
|
//用户分组
|
|
|
return Constant.getLevelGroupName(i);
|
|
|
}
|
|
|
case 4:{
|
|
|
case 4: {
|
|
|
//疾病
|
|
|
return Constant.getLevelDiseaseName(i);
|
|
|
}
|
|
|
case 5:{
|
|
|
case 5: {
|
|
|
//疾病
|
|
|
return Constant.getlevelHealthFbName(i);
|
|
|
}
|
|
|
case 6:{
|
|
|
case 6: {
|
|
|
//繳費未交費
|
|
|
return Constant.getLevelExpenseName(i);
|
|
|
}
|
|
|
case 7:{
|
|
|
case 7: {
|
|
|
//疾病年齡
|
|
|
return Constant.getLevelAgeDiseaseName(i);
|
|
|
}
|
|
|
case 8:{
|
|
|
case 8: {
|
|
|
//疾病年齡
|
|
|
return Constant.getLevelReplyTimeName(i);
|
|
|
}
|
|
|
default:{
|
|
|
case 9: {
|
|
|
//疾病年齡
|
|
|
return Constant.getReason(i);
|
|
|
}
|
|
|
default: {
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
private String getOrg(String org){
|
|
|
|
|
|
private String getOrg(String org) {
|
|
|
//if(!"00".equals(org.substring(org.length()-2,org.length()))){
|
|
|
if(org.length() == 10 && !org.endsWith("00")){
|
|
|
return org.substring(0,org.length()-2)+"00";
|
|
|
}else{
|
|
|
if (org.length() == 10 && !org.endsWith("00")) {
|
|
|
return org.substring(0, org.length() - 2) + "00";
|
|
|
} else {
|
|
|
return org;
|
|
|
}
|
|
|
}
|