|
@ -1,5 +1,6 @@
|
|
package com.yihu.wlyy.statistics.etl.storage;
|
|
package com.yihu.wlyy.statistics.etl.storage;
|
|
|
|
|
|
|
|
import com.mysql.jdbc.Blob;
|
|
import com.yihu.wlyy.statistics.dao.DoctorAdminTeamDao;
|
|
import com.yihu.wlyy.statistics.dao.DoctorAdminTeamDao;
|
|
import com.yihu.wlyy.statistics.dao.HospitalDao;
|
|
import com.yihu.wlyy.statistics.dao.HospitalDao;
|
|
import com.yihu.wlyy.statistics.dao.TownDao;
|
|
import com.yihu.wlyy.statistics.dao.TownDao;
|
|
@ -7,21 +8,25 @@ import com.yihu.wlyy.statistics.dao.WlyyQuotaResultDao;
|
|
import com.yihu.wlyy.statistics.etl.model.ETLModel;
|
|
import com.yihu.wlyy.statistics.etl.model.ETLModel;
|
|
import com.yihu.wlyy.statistics.job.business.Constant;
|
|
import com.yihu.wlyy.statistics.job.business.Constant;
|
|
import com.yihu.wlyy.statistics.model.hosptial.Hospital;
|
|
import com.yihu.wlyy.statistics.model.hosptial.Hospital;
|
|
|
|
import com.yihu.wlyy.statistics.model.job.QuartzJobLog;
|
|
import com.yihu.wlyy.statistics.model.job.WlyyQuotaResult;
|
|
import com.yihu.wlyy.statistics.model.job.WlyyQuotaResult;
|
|
import com.yihu.wlyy.statistics.model.system.City;
|
|
import com.yihu.wlyy.statistics.model.system.City;
|
|
import com.yihu.wlyy.statistics.model.system.Town;
|
|
import com.yihu.wlyy.statistics.model.system.Town;
|
|
import com.yihu.wlyy.statistics.model.team.AdminTeam;
|
|
import com.yihu.wlyy.statistics.model.team.AdminTeam;
|
|
import com.yihu.wlyy.statistics.vo.WlyyQuotaVO;
|
|
import com.yihu.wlyy.statistics.vo.WlyyQuotaVO;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
|
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
|
import org.springframework.jdbc.core.PreparedStatementCreator;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.transaction.PlatformTransactionManager;
|
|
|
|
import org.springframework.transaction.TransactionDefinition;
|
|
|
|
import org.springframework.transaction.TransactionStatus;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
|
|
|
|
|
|
|
import javax.transaction.TransactionManager;
|
|
|
|
|
|
import javax.persistence.EntityManager;
|
|
|
|
import javax.persistence.EntityTransaction;
|
|
|
|
import javax.persistence.PersistenceContext;
|
|
|
|
import java.sql.Connection;
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
import java.sql.Timestamp;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -30,7 +35,6 @@ import java.util.*;
|
|
*/
|
|
*/
|
|
|
|
|
|
@Component
|
|
@Component
|
|
@Transactional
|
|
|
|
public class DBStorage {
|
|
public class DBStorage {
|
|
private WlyyQuotaVO wlyyQuota;//指标对象
|
|
private WlyyQuotaVO wlyyQuota;//指标对象
|
|
private Map<String, AdminTeam> adminTeamMap = new HashMap<String, AdminTeam>();
|
|
private Map<String, AdminTeam> adminTeamMap = new HashMap<String, AdminTeam>();
|
|
@ -44,6 +48,10 @@ public class DBStorage {
|
|
private DoctorAdminTeamDao doctorAdminTeamDao;
|
|
private DoctorAdminTeamDao doctorAdminTeamDao;
|
|
@Autowired
|
|
@Autowired
|
|
private WlyyQuotaResultDao wlyyQuotaResultDao;//指标结果Dao
|
|
private WlyyQuotaResultDao wlyyQuotaResultDao;//指标结果Dao
|
|
|
|
@Autowired
|
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -76,15 +84,55 @@ public class DBStorage {
|
|
city.setName(Constant.cityName);
|
|
city.setName(Constant.cityName);
|
|
cityMap.put(Constant.city,city);
|
|
cityMap.put(Constant.city,city);
|
|
//保存团队
|
|
//保存团队
|
|
saveAdminTeamDataLevel1(data.get(0),date,adminTeamMap);
|
|
|
|
|
|
saveAll(saveAdminTeamDataLevel1(data.get(0),date,adminTeamMap));
|
|
//保存机构
|
|
//保存机构
|
|
saveHospitalTeamDataLevel1(data.get(1),date,hospitalsMap);
|
|
|
|
|
|
saveAll(saveHospitalTeamDataLevel1(data.get(1),date,hospitalsMap));
|
|
//保存区
|
|
//保存区
|
|
saveTownTeamDataLevel1(data.get(2),date,townsMap);
|
|
|
|
|
|
saveAll(saveTownTeamDataLevel1(data.get(2),date,townsMap));
|
|
//保存市
|
|
//保存市
|
|
saveCityTeamDataLevel1(data.get(3),date,cityMap);
|
|
|
|
|
|
saveAll(saveCityTeamDataLevel1(data.get(3),date,cityMap));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 保存一级维度的数据
|
|
|
|
* @param data
|
|
|
|
* @param date
|
|
|
|
* @param wlyyQuota
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public List<WlyyQuotaResult> getLevel1(List<Map<String, List<ETLModel>>> data,String date,WlyyQuotaVO wlyyQuota) throws Exception {
|
|
|
|
List<WlyyQuotaResult> returnList=new ArrayList<WlyyQuotaResult>();
|
|
|
|
this.wlyyQuota=wlyyQuota;
|
|
|
|
List<AdminTeam> adminTeams=doctorAdminTeamDao.findAllTeam();
|
|
|
|
for (AdminTeam adminTeam : adminTeams) {
|
|
|
|
adminTeamMap.put(adminTeam.getId()+"", adminTeam);
|
|
|
|
}
|
|
|
|
//查找出系统全部的机构
|
|
|
|
List<Hospital> hospitals = hospitalDao.findHospitalzxFWZ();
|
|
|
|
for (Hospital hospital : hospitals) {
|
|
|
|
hospitalsMap.put(hospital.getCode(), hospital);
|
|
|
|
}
|
|
|
|
//查找出厦门市全部的区
|
|
|
|
List<Town> towns = townDao.findByCityCode(Constant.city);
|
|
|
|
for (Town town : towns) {
|
|
|
|
townsMap.put(town.getCode(), town);
|
|
|
|
}
|
|
|
|
//全部的市
|
|
|
|
Map<String, City> cityMap = new HashMap<String, City>();
|
|
|
|
City city=new City();
|
|
|
|
city.setCode(Constant.city);
|
|
|
|
city.setName(Constant.cityName);
|
|
|
|
cityMap.put(Constant.city,city);
|
|
|
|
//保存团队
|
|
|
|
returnList.addAll(saveAdminTeamDataLevel1(data.get(0),date,adminTeamMap));
|
|
|
|
//保存机构
|
|
|
|
returnList.addAll(saveHospitalTeamDataLevel1(data.get(1),date,hospitalsMap));
|
|
|
|
//保存区
|
|
|
|
returnList.addAll(saveTownTeamDataLevel1(data.get(2),date,townsMap));
|
|
|
|
//保存市
|
|
|
|
returnList.addAll(saveCityTeamDataLevel1(data.get(3),date,cityMap));
|
|
|
|
return returnList;
|
|
|
|
}
|
|
/**
|
|
/**
|
|
* 保存二级维度
|
|
* 保存二级维度
|
|
* @param data
|
|
* @param data
|
|
@ -98,6 +146,48 @@ public class DBStorage {
|
|
this.wlyyQuota=wlyyQuota;
|
|
this.wlyyQuota=wlyyQuota;
|
|
level2Public(data, day, foreachNum, type, start);
|
|
level2Public(data, day, foreachNum, type, start);
|
|
}
|
|
}
|
|
|
|
/**
|
|
|
|
* 得到二级维度
|
|
|
|
* @param data
|
|
|
|
* @param day
|
|
|
|
* @param wlyyQuota
|
|
|
|
* @param foreachNum 如果start是默认的 标识二级维度循环的次数 例如 年龄就传6 性别就传3
|
|
|
|
* @param type 1 性别 2 年龄 3 用户分组 4.签约费用 5 健康分布
|
|
|
|
* @param start 起始位置 默认是1
|
|
|
|
*/
|
|
|
|
public List<WlyyQuotaResult> getLevel2(List<Map<String, Map<String, List<ETLModel>>>> data, String day, WlyyQuotaVO wlyyQuota,Integer foreachNum,Integer type,Integer start)throws Exception {
|
|
|
|
List<WlyyQuotaResult> returnList=new ArrayList<WlyyQuotaResult>();
|
|
|
|
this.wlyyQuota=wlyyQuota;
|
|
|
|
List<AdminTeam> adminTeams=doctorAdminTeamDao.findAllTeam();
|
|
|
|
for (AdminTeam adminTeam : adminTeams) {
|
|
|
|
adminTeamMap.put(adminTeam.getId()+"", adminTeam);
|
|
|
|
}
|
|
|
|
//查找出系统全部的机构
|
|
|
|
List<Hospital> hospitals = hospitalDao.findHospitalzxFWZ();
|
|
|
|
for (Hospital hospital : hospitals) {
|
|
|
|
hospitalsMap.put(hospital.getCode(), hospital);
|
|
|
|
}
|
|
|
|
//查找出厦门市全部的区
|
|
|
|
List<Town> towns = townDao.findByCityCode(Constant.city);
|
|
|
|
for (Town town : towns) {
|
|
|
|
townsMap.put(town.getCode(), town);
|
|
|
|
}
|
|
|
|
//全部的市
|
|
|
|
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);
|
|
|
|
//保存团队
|
|
|
|
returnList.addAll(saveAdminTeamDataLevel2(data.get(0),day,adminTeamMap,foreachNum,type,start));
|
|
|
|
//保存机构
|
|
|
|
returnList.addAll(saveHospitalTeamDataLevel2(data.get(1),day,hospitalsMap,foreachNum,type,start));
|
|
|
|
//保存区
|
|
|
|
returnList.addAll(saveTownTeamDataLevel2(data.get(2),day,townsMap,foreachNum,type,start));
|
|
|
|
//保存市
|
|
|
|
returnList.addAll(saveCityTeamDataLevel2(data.get(3),day,cityMap,foreachNum,type,start));
|
|
|
|
return returnList;
|
|
|
|
}
|
|
/**
|
|
/**
|
|
* 保存二级维度
|
|
* 保存二级维度
|
|
* @param data
|
|
* @param data
|
|
@ -385,16 +475,16 @@ public class DBStorage {
|
|
Map<String, City> cityMap = new HashMap<String, City>();
|
|
Map<String, City> cityMap = new HashMap<String, City>();
|
|
cityMap.put(Constant.city,city);
|
|
cityMap.put(Constant.city,city);
|
|
//保存团队
|
|
//保存团队
|
|
saveAdminTeamDataLevel2(data.get(0),day,adminTeamMap,foreachNum,type,start);
|
|
|
|
|
|
saveAll( saveAdminTeamDataLevel2(data.get(0),day,adminTeamMap,foreachNum,type,start));
|
|
//保存机构
|
|
//保存机构
|
|
saveHospitalTeamDataLevel2(data.get(1),day,hospitalsMap,foreachNum,type,start);
|
|
|
|
|
|
saveAll( saveHospitalTeamDataLevel2(data.get(1),day,hospitalsMap,foreachNum,type,start));
|
|
//保存区
|
|
//保存区
|
|
saveTownTeamDataLevel2(data.get(2),day,townsMap,foreachNum,type,start);
|
|
|
|
|
|
saveAll( saveTownTeamDataLevel2(data.get(2),day,townsMap,foreachNum,type,start));
|
|
//保存市
|
|
//保存市
|
|
saveCityTeamDataLevel2(data.get(3),day,cityMap,foreachNum,type,start);
|
|
|
|
|
|
saveAll( saveCityTeamDataLevel2(data.get(3),day,cityMap,foreachNum,type,start));
|
|
}
|
|
}
|
|
|
|
|
|
private void saveCityTeamDataLevel2(Map<String, Map<String, List<ETLModel>>> etlModelMap, String day, Map<String, City> citysMap ,Integer foreachNum,Integer type,Integer start) throws Exception{
|
|
|
|
|
|
private List<WlyyQuotaResult> saveCityTeamDataLevel2(Map<String, Map<String, List<ETLModel>>> etlModelMap, String day, Map<String, City> citysMap ,Integer foreachNum,Integer type,Integer start) throws Exception{
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
for(Map.Entry<String,City> oneCity:citysMap.entrySet()){
|
|
for(Map.Entry<String,City> oneCity:citysMap.entrySet()){
|
|
Map<String, List<ETLModel>> oneELTMap= etlModelMap.get(oneCity.getKey());
|
|
Map<String, List<ETLModel>> oneELTMap= etlModelMap.get(oneCity.getKey());
|
|
@ -422,10 +512,10 @@ public class DBStorage {
|
|
wlyyQuotaResults.add(save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,level2,level2Name,null,null,day));
|
|
wlyyQuotaResults.add(save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,level2,level2Name,null,null,day));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
saveAll(wlyyQuotaResults);
|
|
|
|
|
|
return wlyyQuotaResults;
|
|
}
|
|
}
|
|
|
|
|
|
private void saveTownTeamDataLevel2(Map<String, Map<String, List<ETLModel>>> etlModelMap, String day, Map<String, Town> townsMap ,Integer foreachNum,Integer type,Integer start)throws Exception {
|
|
|
|
|
|
private List<WlyyQuotaResult> saveTownTeamDataLevel2(Map<String, Map<String, List<ETLModel>>> etlModelMap, String day, Map<String, Town> townsMap ,Integer foreachNum,Integer type,Integer start)throws Exception {
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
for(Map.Entry<String,Town> oneTown:townsMap.entrySet()){
|
|
for(Map.Entry<String,Town> oneTown:townsMap.entrySet()){
|
|
Map<String, List<ETLModel>> oneELTMap= etlModelMap.get(oneTown.getKey());
|
|
Map<String, List<ETLModel>> oneELTMap= etlModelMap.get(oneTown.getKey());
|
|
@ -453,10 +543,10 @@ public class DBStorage {
|
|
wlyyQuotaResults.add(save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,level2,level2Name,null,null,day));
|
|
wlyyQuotaResults.add(save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,level2,level2Name,null,null,day));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
saveAll(wlyyQuotaResults);
|
|
|
|
|
|
return wlyyQuotaResults;
|
|
}
|
|
}
|
|
|
|
|
|
private void saveHospitalTeamDataLevel2(Map<String, Map<String, List<ETLModel>>> etlModelMap, String day, Map<String, Hospital> hospitalsMap,Integer foreachNum,Integer type,Integer start)throws Exception {
|
|
|
|
|
|
private List<WlyyQuotaResult> saveHospitalTeamDataLevel2(Map<String, Map<String, List<ETLModel>>> etlModelMap, String day, Map<String, Hospital> hospitalsMap,Integer foreachNum,Integer type,Integer start)throws Exception {
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
for(Map.Entry<String,Hospital> oneHospital:hospitalsMap.entrySet()){
|
|
for(Map.Entry<String,Hospital> oneHospital:hospitalsMap.entrySet()){
|
|
Map<String, List<ETLModel>> oneELTMap= etlModelMap.get(oneHospital.getKey());
|
|
Map<String, List<ETLModel>> oneELTMap= etlModelMap.get(oneHospital.getKey());
|
|
@ -485,10 +575,10 @@ public class DBStorage {
|
|
wlyyQuotaResults.add(save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,level2,level2Name,null,null,day));
|
|
wlyyQuotaResults.add(save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,level2,level2Name,null,null,day));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
saveAll(wlyyQuotaResults);
|
|
|
|
|
|
return wlyyQuotaResults;
|
|
}
|
|
}
|
|
|
|
|
|
private void saveAdminTeamDataLevel2(Map<String, Map<String, List<ETLModel>>> etlModelMap, String day, Map<String, AdminTeam> adminTeamMap,Integer foreachNum,Integer type,Integer start)throws Exception {
|
|
|
|
|
|
private List<WlyyQuotaResult> saveAdminTeamDataLevel2(Map<String, Map<String, List<ETLModel>>> etlModelMap, String day, Map<String, AdminTeam> adminTeamMap,Integer foreachNum,Integer type,Integer start)throws Exception {
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
for(Map.Entry<String,AdminTeam> adminTeam:adminTeamMap.entrySet()){
|
|
for(Map.Entry<String,AdminTeam> adminTeam:adminTeamMap.entrySet()){
|
|
Map<String, List<ETLModel>> oneELTMap= etlModelMap.get(adminTeam.getKey());
|
|
Map<String, List<ETLModel>> oneELTMap= etlModelMap.get(adminTeam.getKey());
|
|
@ -520,10 +610,10 @@ public class DBStorage {
|
|
wlyyQuotaResults.add(save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,level2,level2Name,null,null,day));
|
|
wlyyQuotaResults.add(save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,level2,level2Name,null,null,day));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
saveAll(wlyyQuotaResults);
|
|
|
|
|
|
return wlyyQuotaResults;
|
|
}
|
|
}
|
|
|
|
|
|
private void saveAdminTeamDataLevel1(Map<String, List<ETLModel>> mapData,String date,Map<String, AdminTeam> adminTeamMap)throws Exception {
|
|
|
|
|
|
private List<WlyyQuotaResult> saveAdminTeamDataLevel1(Map<String, List<ETLModel>> mapData,String date,Map<String, AdminTeam> adminTeamMap)throws Exception {
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
for(Map.Entry<String, AdminTeam> entry:adminTeamMap.entrySet()){
|
|
for(Map.Entry<String, AdminTeam> entry:adminTeamMap.entrySet()){
|
|
List<ETLModel> etlModel= mapData.get(entry.getKey());
|
|
List<ETLModel> etlModel= mapData.get(entry.getKey());
|
|
@ -548,10 +638,10 @@ public class DBStorage {
|
|
String level="1";
|
|
String level="1";
|
|
wlyyQuotaResults.add(save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,null,null,null,null,date));
|
|
wlyyQuotaResults.add(save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,null,null,null,null,date));
|
|
}
|
|
}
|
|
saveAll(wlyyQuotaResults);
|
|
|
|
|
|
return wlyyQuotaResults;
|
|
}
|
|
}
|
|
|
|
|
|
private void saveHospitalTeamDataLevel1(Map<String, List<ETLModel>> mapData, String date, Map<String, Hospital> hospitalsMap )throws Exception {
|
|
|
|
|
|
private List<WlyyQuotaResult> saveHospitalTeamDataLevel1(Map<String, List<ETLModel>> mapData, String date, Map<String, Hospital> hospitalsMap )throws Exception {
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
for(Map.Entry<String, Hospital> entry:hospitalsMap.entrySet()){
|
|
for(Map.Entry<String, Hospital> entry:hospitalsMap.entrySet()){
|
|
List<ETLModel> etlModel= mapData.get(entry.getKey());
|
|
List<ETLModel> etlModel= mapData.get(entry.getKey());
|
|
@ -573,10 +663,10 @@ public class DBStorage {
|
|
String level="2";
|
|
String level="2";
|
|
wlyyQuotaResults.add( save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,null,null,null,null,date));
|
|
wlyyQuotaResults.add( save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,null,null,null,null,date));
|
|
}
|
|
}
|
|
saveAll(wlyyQuotaResults);
|
|
|
|
|
|
return wlyyQuotaResults;
|
|
}
|
|
}
|
|
|
|
|
|
private void saveTownTeamDataLevel1(Map<String, List<ETLModel>> mapData, String date, Map<String, Town> townsMap)throws Exception {
|
|
|
|
|
|
private List<WlyyQuotaResult> saveTownTeamDataLevel1(Map<String, List<ETLModel>> mapData, String date, Map<String, Town> townsMap)throws Exception {
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
for(Map.Entry<String, Town> entry:townsMap.entrySet()){
|
|
for(Map.Entry<String, Town> entry:townsMap.entrySet()){
|
|
List<ETLModel> etlModel= mapData.get(entry.getKey());
|
|
List<ETLModel> etlModel= mapData.get(entry.getKey());
|
|
@ -597,10 +687,10 @@ public class DBStorage {
|
|
String level="3";
|
|
String level="3";
|
|
wlyyQuotaResults.add(save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,null,null,null,null,date));
|
|
wlyyQuotaResults.add(save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,null,null,null,null,date));
|
|
}
|
|
}
|
|
saveAll(wlyyQuotaResults);
|
|
|
|
|
|
return wlyyQuotaResults;
|
|
}
|
|
}
|
|
|
|
|
|
private void saveCityTeamDataLevel1(Map<String, List<ETLModel>> mapData, String date, Map<String, City> cityMap) throws Exception{
|
|
|
|
|
|
private List<WlyyQuotaResult> saveCityTeamDataLevel1(Map<String, List<ETLModel>> mapData, String date, Map<String, City> cityMap) throws Exception{
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
List<WlyyQuotaResult> wlyyQuotaResults=new ArrayList<WlyyQuotaResult>();
|
|
for(Map.Entry<String, City> entry:cityMap.entrySet()){
|
|
for(Map.Entry<String, City> entry:cityMap.entrySet()){
|
|
List<ETLModel> etlModel= mapData.get(entry.getKey());
|
|
List<ETLModel> etlModel= mapData.get(entry.getKey());
|
|
@ -621,7 +711,7 @@ public class DBStorage {
|
|
String level="4";
|
|
String level="4";
|
|
wlyyQuotaResults.add( save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,null,null,null,null,date));
|
|
wlyyQuotaResults.add( save(num, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level,null,null,null,null,date));
|
|
}
|
|
}
|
|
saveAll(wlyyQuotaResults);
|
|
|
|
|
|
return wlyyQuotaResults;
|
|
}
|
|
}
|
|
|
|
|
|
private String getOrg(String org){
|
|
private String getOrg(String org){
|
|
@ -647,7 +737,7 @@ public class DBStorage {
|
|
*/
|
|
*/
|
|
private WlyyQuotaResult save(int num, String city, String cityName, String town, String townName, String org, String orgName, String doctorCode, String doctorName, String doctorJob, String level1, String level2, String level2Name,String level3, String level3Name,String date) {
|
|
private WlyyQuotaResult save(int num, String city, String cityName, String town, String townName, String org, String orgName, String doctorCode, String doctorName, String doctorJob, String level1, String level2, String level2Name,String level3, String level3Name,String date) {
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
wlyyQuotaResult.setId(UUID.randomUUID().toString().replace("-",""));
|
|
|
|
|
|
//wlyyQuotaResult.setId(UUID.randomUUID().toString().replace("-",""));
|
|
wlyyQuotaResult.setDel("1");
|
|
wlyyQuotaResult.setDel("1");
|
|
wlyyQuotaResult.setOrgCode(org);
|
|
wlyyQuotaResult.setOrgCode(org);
|
|
wlyyQuotaResult.setOrgName(orgName);
|
|
wlyyQuotaResult.setOrgName(orgName);
|
|
@ -672,7 +762,8 @@ public class DBStorage {
|
|
return wlyyQuotaResult;
|
|
return wlyyQuotaResult;
|
|
}
|
|
}
|
|
|
|
|
|
private void saveAll(final List<WlyyQuotaResult> wlyyQuotaResults) throws Exception{
|
|
|
|
|
|
@Transactional
|
|
|
|
private void saveAll(List<WlyyQuotaResult> wlyyQuotaResults) throws Exception{
|
|
wlyyQuotaResultDao.save(wlyyQuotaResults);
|
|
wlyyQuotaResultDao.save(wlyyQuotaResults);
|
|
}
|
|
}
|
|
|
|
|
|
@ -715,4 +806,21 @@ public class DBStorage {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Transactional
|
|
|
|
public void saveLog(final QuartzJobLog quartzJobLog){
|
|
|
|
quartzJobLog.setId(UUID.randomUUID().toString().replace("-",""));
|
|
|
|
String sql="INSERT INTO wlyy_job_log (id, job_start_time, Job_end_time, job_id, job_content, job_type, job_name) VALUES (?,?,?,?,?,?,?);";
|
|
|
|
jdbcTemplate.update(connection -> {
|
|
|
|
PreparedStatement statementCreator= connection.prepareCall(sql);
|
|
|
|
statementCreator.setString(1,quartzJobLog.getId());
|
|
|
|
statementCreator.setTimestamp(2,new Timestamp(quartzJobLog.getJobStartTime().getTime()));
|
|
|
|
statementCreator.setTimestamp(3,new Timestamp(quartzJobLog.getJobEndTime().getTime()));
|
|
|
|
statementCreator.setString(4,quartzJobLog.getJobId());
|
|
|
|
statementCreator.setString(5,quartzJobLog.getJobContent());
|
|
|
|
|
|
|
|
statementCreator.setString(6,quartzJobLog.getJobType());
|
|
|
|
statementCreator.setString(7,quartzJobLog.getJobName());
|
|
|
|
return statementCreator;
|
|
|
|
});
|
|
|
|
}
|
|
}
|
|
}
|