|
@ -103,7 +103,7 @@ public class SignAgeGroupDiseaseJob implements Job {
|
|
|
//抽取數據
|
|
|
List<SignFamily> signFamilies= dbExtract.extract(SignFamily.class,sql);
|
|
|
//清洗數據
|
|
|
FilterModel etlModels= signDataFilter.filter(signFamilies,SignDataFilter.level2Age,SignDataFilter.level3Disease,yesterday);
|
|
|
FilterModel etlModels= signDataFilter.filter(signFamilies,SignDataFilter.level2Age,SignDataFilter.level3Disease,sql,yesterday);
|
|
|
//统计数据 一级维度
|
|
|
List<Map<String, List<ETLModel>>> returnDatas= levelRole.elt(etlModels.getEtlModelList());
|
|
|
//统计数据 二级维度
|
|
@ -121,89 +121,6 @@ public class SignAgeGroupDiseaseJob implements Job {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
private String saveContent(List<SignFamily> signFamilys, Long qkCount, Long orgCount, Long townCount, Long cityCount, boolean isAll, StringBuffer errorContent,long errorCount,String sql) {
|
|
|
StringBuffer string=new StringBuffer("统计"+yesterday+" 的签约数据完成 ,数据库查询到签约数目:"+signFamilys.size());
|
|
|
string.append(",sql语句:"+sql);
|
|
|
string.append(",过滤的脏数据数目:"+errorCount);
|
|
|
string.append(",统计到市的数据总数:"+cityCount);
|
|
|
string.append(",统计到区的数据总数:"+townCount);
|
|
|
string.append(",统计到机构的数据总数:"+orgCount);
|
|
|
string.append(",统计到团队的数据总数:"+qkCount);
|
|
|
string.append(",是否统计成功:"+isAll);
|
|
|
if(!isAll){
|
|
|
string.append(",失败原因:"+errorContent);
|
|
|
}
|
|
|
return string.toString();
|
|
|
}
|
|
|
private void save(Map<String, Map> oneAgeMap, String key_2, String key_3, String city, String cityName, String town, String townName, String org, String orgName,String level) {
|
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
wlyyQuotaResult.setCity(city);
|
|
|
wlyyQuotaResult.setCityName(cityName);
|
|
|
wlyyQuotaResult.setTown(town);
|
|
|
wlyyQuotaResult.setTownName(townName);
|
|
|
wlyyQuotaResult.setOrgCode(org);
|
|
|
wlyyQuotaResult.setOrgName(orgName);
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
wlyyQuotaResult.setLevel1Type(level);//等级
|
|
|
wlyyQuotaResult.setLevel2Type(key_2);
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.getLevelAgeName(key_2));
|
|
|
wlyyQuotaResult.setLevel3Type(key_3);
|
|
|
wlyyQuotaResult.setLevel3TypeName(Constant.getLevelDiseaseName(key_3));
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(key_2)) {
|
|
|
Map<String,Long> key3Map=oneAgeMap.get(key_2);
|
|
|
if(key3Map!=null&&key3Map.containsKey(key_3)){
|
|
|
wlyyQuotaResult.setResult(key3Map.get(key_3) + "");
|
|
|
}else{
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
}
|
|
|
} else {
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
}
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 统计方案
|
|
|
* @param rootMap 数据存放的map
|
|
|
* @param rootKey 数据的key 机构 区 市
|
|
|
* @param ageCode 年龄的key
|
|
|
* @param diseaseType 疾病类型 1是高血压 2是糖尿病 3是高血压和糖尿病 4是健康人群
|
|
|
*/
|
|
|
private void compute(Map<String, Map<String, Map>> rootMap, String rootKey, String ageCode, String diseaseType) {
|
|
|
if (rootMap.containsKey(rootKey)) {
|
|
|
//得到市下面的所有的年龄map
|
|
|
Map<String, Map> groupMapTemp = rootMap.get(rootKey);
|
|
|
if(groupMapTemp.containsKey(ageCode)){
|
|
|
//得到这个年龄下的患者map
|
|
|
Map<String,Long> mape= groupMapTemp.get(ageCode);
|
|
|
if(mape.containsKey(diseaseType)){
|
|
|
mape.put(diseaseType,mape.get(diseaseType)+1L); //key是三级维度
|
|
|
}else{
|
|
|
mape.put(diseaseType,1L); //key是三级维度
|
|
|
}
|
|
|
}else{
|
|
|
//新增疾病的统计map
|
|
|
Map<String, Long> groupMapTemp1 = new HashMap<String, Long>();
|
|
|
groupMapTemp1.put(diseaseType, 1L);//key是三级维度
|
|
|
groupMapTemp.put(ageCode,groupMapTemp1);//key是二级维度
|
|
|
}
|
|
|
} else {
|
|
|
//没有就新建统计数据 新增疾病的统计map
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
groupMapTemp.put(diseaseType, 1L); //key是三级维度
|
|
|
//把统计疾病的map放入对应的年龄组map中
|
|
|
Map<String, Map> groupMapTemp2 = new HashMap<String, Map>();
|
|
|
groupMapTemp2.put(ageCode,groupMapTemp); //key是二级维度
|
|
|
//把年龄组map放入市的map里面
|
|
|
rootMap.put(rootKey, groupMapTemp2); //key是一级维度
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/*
|
|
|
得到昨天的日期字符串 yyyy-MM-dd
|
|
|
*/
|
|
@ -243,13 +160,6 @@ public class SignAgeGroupDiseaseJob implements Job {
|
|
|
String dateString = formatter.format(date);
|
|
|
return dateString;
|
|
|
}
|
|
|
private String getOrg(String org){
|
|
|
if(!"00".equals(org.substring(org.length()-2,org.length()))){
|
|
|
return org.substring(0,org.length()-2)+"00";
|
|
|
}else{
|
|
|
return org;
|
|
|
}
|
|
|
}
|
|
|
public static void main(String[] args) {
|
|
|
getDayString(0);
|
|
|
}
|