|
@ -1,5 +1,6 @@
|
|
package com.yihu.wlyy.job;
|
|
package com.yihu.wlyy.job;
|
|
|
|
|
|
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
import com.yihu.wlyy.entity.address.Town;
|
|
import com.yihu.wlyy.entity.address.Town;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
@ -8,6 +9,7 @@ import com.yihu.wlyy.entity.job.QuartzJobLog;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.entity.statistics.WlyyQuotaResult;
|
|
import com.yihu.wlyy.entity.statistics.WlyyQuotaResult;
|
|
import com.yihu.wlyy.repository.address.TownDao;
|
|
import com.yihu.wlyy.repository.address.TownDao;
|
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
|
|
import com.yihu.wlyy.repository.job.QuartzJobLogDao;
|
|
import com.yihu.wlyy.repository.job.QuartzJobLogDao;
|
|
@ -59,6 +61,8 @@ public class SignJob implements Job {
|
|
private JdbcTemplate jdbcTemplate;
|
|
private JdbcTemplate jdbcTemplate;
|
|
@Autowired
|
|
@Autowired
|
|
private StringRedisTemplate redisTemplate;
|
|
private StringRedisTemplate redisTemplate;
|
|
|
|
@Autowired
|
|
|
|
private DoctorAdminTeamDao doctorAdminTeamDao;
|
|
|
|
|
|
String yesterday;
|
|
String yesterday;
|
|
String now;
|
|
String now;
|
|
@ -138,17 +142,32 @@ public class SignJob implements Job {
|
|
Map<String, Map<String, Long>> townSexMap = new HashMap<String, Map<String, Long>>();//key是区行政代码
|
|
Map<String, Map<String, Long>> townSexMap = new HashMap<String, Map<String, Long>>();//key是区行政代码
|
|
Map<String, Map<String, Long>> orgSexMap = new HashMap<String, Map<String, Long>>();//key是机构代码
|
|
Map<String, Map<String, Long>> orgSexMap = new HashMap<String, Map<String, Long>>();//key是机构代码
|
|
//统计有签约的
|
|
//统计有签约的
|
|
|
|
Long cityCount = 0L; //统计到市的数目
|
|
|
|
Long townCount = 0L; //统计到所有区的数目
|
|
|
|
Long orgCount = 0L;//统计到所有机构的数目
|
|
|
|
Long qkCount = 0L;//统计到所有全科医生的数目
|
|
|
|
boolean isAll=true;//是否统计失败
|
|
|
|
StringBuffer errorContent=new StringBuffer();
|
|
for (SignFamily signFamily : signFamilys) {
|
|
for (SignFamily signFamily : signFamilys) {
|
|
String idcard = signFamily.getIdcard();//得到签约中患者的身份证号
|
|
String idcard = signFamily.getIdcard();//得到签约中患者的身份证号
|
|
String orgCodeTemp=getOrg(signFamily.getHospital());
|
|
String orgCodeTemp=getOrg(signFamily.getHospital());
|
|
Hospital hospital = hospitalsMap.get(orgCodeTemp);//得到患者签约的机构
|
|
Hospital hospital = hospitalsMap.get(orgCodeTemp);//得到患者签约的机构
|
|
|
|
if(hospital == null) {
|
|
|
|
errorContent.append("签约code:"+signFamily.getCode()+",签约的全科医生(doctor字段)的所属机构(wlyy_doctor表中的hospital字段)为空或者所属的机构数据有问题");
|
|
|
|
isAll=false;
|
|
|
|
continue;
|
|
|
|
}
|
|
String town = hospital.getTown();//得到患者签约的机构的区号
|
|
String town = hospital.getTown();//得到患者签约的机构的区号
|
|
String hospitalCode = hospital.getCode();//得到患者签约的机构号
|
|
String hospitalCode = hospital.getCode();//得到患者签约的机构号
|
|
String sex = IdCardUtil.getSexForIdcard(idcard);//根据身份证得到性别
|
|
String sex = IdCardUtil.getSexForIdcard(idcard);//根据身份证得到性别
|
|
|
|
|
|
|
|
|
|
//统计市 目前只统计厦门市 所以先写死 后期再改造
|
|
//统计市 目前只统计厦门市 所以先写死 后期再改造
|
|
compute_level2_1(citySexMap,Constant.city, sex);
|
|
compute_level2_1(citySexMap,Constant.city, sex);
|
|
|
|
cityCount++;
|
|
//统计区
|
|
//统计区
|
|
compute_level2_1(townSexMap,town, sex);
|
|
compute_level2_1(townSexMap,town, sex);
|
|
|
|
townCount++;
|
|
//统计机构
|
|
//统计机构
|
|
//统计站
|
|
//统计站
|
|
String orgCode=hospital.getCode();
|
|
String orgCode=hospital.getCode();
|
|
@ -160,7 +179,7 @@ public class SignJob implements Job {
|
|
//统计社区
|
|
//统计社区
|
|
compute_level2_1(orgSexMap,hospitalCode, sex);
|
|
compute_level2_1(orgSexMap,hospitalCode, sex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
orgCount++;
|
|
}
|
|
}
|
|
//保存统计数据
|
|
//保存统计数据
|
|
//保存市统计数据
|
|
//保存市统计数据
|
|
@ -173,7 +192,7 @@ public class SignJob implements Job {
|
|
String townName="";
|
|
String townName="";
|
|
String org="";
|
|
String org="";
|
|
String orgName="";
|
|
String orgName="";
|
|
String level="3";
|
|
|
|
|
|
String level="4";
|
|
save_level2_1(entry.getValue(), key, city, cityName, town, townName, org, orgName, level);
|
|
save_level2_1(entry.getValue(), key, city, cityName, town, townName, org, orgName, level);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@ -212,8 +231,8 @@ public class SignJob implements Job {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
QuartzJobLog.setJobEndTime(new Date());
|
|
QuartzJobLog.setJobEndTime(new Date());
|
|
QuartzJobLog.setJobContent("统计" + getYesterday() + " 的签约性别数据完成 ,得到签约数目:"+signFamilys.size());
|
|
|
|
QuartzJobLog.setJobType("1");
|
|
|
|
|
|
QuartzJobLog.setJobContent(saveContent(signFamilys,qkCount,orgCount,townCount,cityCount,isAll,errorContent));
|
|
|
|
QuartzJobLog.setJobType(isAll?"1":"0");
|
|
quartzJobLogDao.save(QuartzJobLog);
|
|
quartzJobLogDao.save(QuartzJobLog);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@ -317,7 +336,12 @@ public class SignJob implements Job {
|
|
|
|
|
|
//找出今天的签约信息
|
|
//找出今天的签约信息
|
|
List<SignFamily> signFamilys = signFamilyDao.findByJiatingSignYesterday(yesterday, now);
|
|
List<SignFamily> signFamilys = signFamilyDao.findByJiatingSignYesterday(yesterday, now);
|
|
|
|
|
|
|
|
Long cityCount = 0L; //统计到市的数目
|
|
|
|
Long townCount = 0L; //统计到所有区的数目
|
|
|
|
Long orgCount = 0L;//统计到所有机构的数目
|
|
|
|
Long qkCount = 0L;//统计到所有全科医生的数目
|
|
|
|
boolean isAll=true;//是否统计失败
|
|
|
|
StringBuffer errorContent=new StringBuffer();
|
|
//统计有签约的
|
|
//统计有签约的
|
|
for (SignFamily signFamily : signFamilys) {
|
|
for (SignFamily signFamily : signFamilys) {
|
|
String patient = signFamily.getPatient();
|
|
String patient = signFamily.getPatient();
|
|
@ -330,58 +354,31 @@ public class SignJob implements Job {
|
|
group="1";
|
|
group="1";
|
|
}
|
|
}
|
|
|
|
|
|
Hospital hospital = hospitalsMap.get(signFamily.getHospital());//得到患者签约的机构
|
|
|
|
if (hospital == null) {
|
|
|
|
|
|
Hospital hospital = hospitalsMap.get(getOrg(signFamily.getHospital()));//得到患者签约的机构
|
|
|
|
if(hospital == null) {
|
|
|
|
errorContent.append("签约code:"+signFamily.getCode()+",签约的全科医生(doctor字段)的所属机构(wlyy_doctor表中的hospital字段)为空或者所属的机构数据有问题");
|
|
|
|
isAll=false;
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
String town = hospital.getTown();
|
|
String town = hospital.getTown();
|
|
//统计市 现在只有厦门市 默认先写死 后面再改
|
|
//统计市 现在只有厦门市 默认先写死 后面再改
|
|
if (cityGroupMap.containsKey(Constant.city)) {
|
|
|
|
Map<String, Long> groupMapTemp = cityGroupMap.get(Constant.city);
|
|
|
|
groupMapTemp.put(group, (groupMapTemp.get(group) == null ? 0l : groupMapTemp.get(group)) + 1);
|
|
|
|
cityGroupMap.put(Constant.city, groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(group, 1L);
|
|
|
|
cityGroupMap.put(Constant.city, groupMapTemp);
|
|
|
|
}
|
|
|
|
|
|
compute_level2_2(cityGroupMap, group,Constant.city);
|
|
|
|
cityCount++;
|
|
//统计区
|
|
//统计区
|
|
if (townGroupMap.containsKey(town)) {
|
|
|
|
Map<String, Long> groupMapTemp = townGroupMap.get(town);
|
|
|
|
groupMapTemp.put(group, (groupMapTemp.get(group) == null ? 0l : groupMapTemp.get(group)) + 1);
|
|
|
|
townGroupMap.put(town, groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(group, 1L);
|
|
|
|
townGroupMap.put(town, groupMapTemp);
|
|
|
|
}
|
|
|
|
|
|
compute_level2_2(townGroupMap, group,town);
|
|
|
|
townCount++;
|
|
//统计站
|
|
//统计站
|
|
String orgCode=hospital.getCode();
|
|
String orgCode=hospital.getCode();
|
|
if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
|
|
if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
|
|
//统计站
|
|
//统计站
|
|
String orgCodeTemp=orgCode.substring(0,orgCode.length()-2)+"00";
|
|
String orgCodeTemp=orgCode.substring(0,orgCode.length()-2)+"00";
|
|
//统计机构
|
|
//统计机构
|
|
if (orgGroupMap.containsKey(orgCodeTemp)) {
|
|
|
|
Map<String, Long> groupMapTemp = orgGroupMap.get(orgCodeTemp);
|
|
|
|
groupMapTemp.put(group, (groupMapTemp.get(group) == null ? 0l : groupMapTemp.get(group)) + 1);
|
|
|
|
orgGroupMap.put(orgCodeTemp, groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(group, 1L);
|
|
|
|
orgGroupMap.put(orgCodeTemp, groupMapTemp);
|
|
|
|
}
|
|
|
|
|
|
compute_level2_2(orgGroupMap, group,orgCodeTemp);
|
|
} else {
|
|
} else {
|
|
//统计机构
|
|
//统计机构
|
|
if (orgGroupMap.containsKey(hospital.getCode())) {
|
|
|
|
Map<String, Long> groupMapTemp = orgGroupMap.get(hospital.getCode());
|
|
|
|
groupMapTemp.put(group, (groupMapTemp.get(group) == null ? 0l : groupMapTemp.get(group)) + 1);
|
|
|
|
orgGroupMap.put(hospital.getCode(), groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(group, 1L);
|
|
|
|
orgGroupMap.put(hospital.getCode(), groupMapTemp);
|
|
|
|
}
|
|
|
|
|
|
compute_level2_2(orgGroupMap, group,hospital.getCode());
|
|
}
|
|
}
|
|
|
|
orgCount++;
|
|
boolean hasGXY = false;//有高血压
|
|
boolean hasGXY = false;//有高血压
|
|
boolean hasTNB = false;//有糖尿病
|
|
boolean hasTNB = false;//有糖尿病
|
|
if ("2".equals(group)) {
|
|
if ("2".equals(group)) {
|
|
@ -422,50 +419,20 @@ public class SignJob implements Job {
|
|
}else if(hasTNB){
|
|
}else if(hasTNB){
|
|
group = 5 + "";//4高血压,5糖尿病
|
|
group = 5 + "";//4高血压,5糖尿病
|
|
}
|
|
}
|
|
if (cityGroupMap.containsKey(Constant.city)) {
|
|
|
|
Map<String, Long> groupMapTemp = cityGroupMap.get(Constant.city);
|
|
|
|
groupMapTemp.put(group, (groupMapTemp.get(group) == null ? 0l : groupMapTemp.get(group)) + 1);
|
|
|
|
cityGroupMap.put(Constant.city, groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(group, 1L);
|
|
|
|
cityGroupMap.put(Constant.city, groupMapTemp);
|
|
|
|
}
|
|
|
|
|
|
//统计市 现在只有厦门市 默认先写死 后面再改
|
|
|
|
compute_level2_2(cityGroupMap, group,Constant.city);
|
|
//统计区
|
|
//统计区
|
|
if (townGroupMap.containsKey(town)) {
|
|
|
|
Map<String, Long> groupMapTemp = townGroupMap.get(town);
|
|
|
|
groupMapTemp.put(group, (groupMapTemp.get(group) == null ? 0l : groupMapTemp.get(group)) + 1);
|
|
|
|
townGroupMap.put(town, groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(group, 1L);
|
|
|
|
townGroupMap.put(town, groupMapTemp);
|
|
|
|
}
|
|
|
|
//统计机构
|
|
|
|
|
|
compute_level2_2(townGroupMap, group,town);
|
|
//统计站
|
|
//统计站
|
|
if (!"00".equals(hospital.getCode().substring(8))) {
|
|
|
|
String orgCodeTemp = hospital.getCode().substring(0, 8) + "00";
|
|
|
|
|
|
orgCode=hospital.getCode();
|
|
|
|
if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
|
|
|
|
//统计站
|
|
|
|
String orgCodeTemp=orgCode.substring(0,orgCode.length()-2)+"00";
|
|
//统计机构
|
|
//统计机构
|
|
if (orgGroupMap.containsKey(orgCodeTemp)) {
|
|
|
|
Map<String, Long> groupMapTemp = orgGroupMap.get(orgCodeTemp);
|
|
|
|
groupMapTemp.put(group, (groupMapTemp.get(group) == null ? 0l : groupMapTemp.get(group)) + 1);
|
|
|
|
orgGroupMap.put(orgCodeTemp, groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(group, 1L);
|
|
|
|
orgGroupMap.put(orgCodeTemp, groupMapTemp);
|
|
|
|
}
|
|
|
|
|
|
compute_level2_2(orgGroupMap, group,orgCodeTemp);
|
|
} else {
|
|
} else {
|
|
//统计机构
|
|
//统计机构
|
|
if (orgGroupMap.containsKey(hospital.getCode())) {
|
|
|
|
Map<String, Long> groupMapTemp = orgGroupMap.get(hospital.getCode());
|
|
|
|
groupMapTemp.put(group, (groupMapTemp.get(group) == null ? 0l : groupMapTemp.get(group)) + 1);
|
|
|
|
orgGroupMap.put(hospital.getCode(), groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(group, 1L);
|
|
|
|
orgGroupMap.put(hospital.getCode(), groupMapTemp);
|
|
|
|
}
|
|
|
|
|
|
compute_level2_2(orgGroupMap, group,hospital.getCode());
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@ -475,391 +442,100 @@ public class SignJob implements Job {
|
|
//保存市的统计数据
|
|
//保存市的统计数据
|
|
for (Map.Entry<String, Map<String, Long>> entry : cityGroupMap.entrySet()) {
|
|
for (Map.Entry<String, Map<String, Long>> entry : cityGroupMap.entrySet()) {
|
|
//保存健康人群
|
|
//保存健康人群
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("4");//市级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_1);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_1_name);
|
|
|
|
if (entry.getValue() != null && entry.getValue().containsKey(Constant.level_group_1)) {
|
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_group_1) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存慢病人群
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("4");//市级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_2);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_2_name);
|
|
|
|
if (entry.getValue() != null && entry.getValue().containsKey(Constant.level_group_2)) {
|
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_group_2) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存65岁以上人群
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("4");//市级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_3);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_3_name);
|
|
|
|
if (entry.getValue() != null && entry.getValue().containsKey(Constant.level_group_3)) {
|
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_group_3) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存高血压
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("4");//市级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_4);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_4_name);
|
|
|
|
if (entry.getValue() != null && entry.getValue().containsKey(Constant.level_group_4)) {
|
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_group_4) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存糖尿病
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("4");//市级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_5);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_5_name);
|
|
|
|
if (entry.getValue() != null && entry.getValue().containsKey(Constant.level_group_5)) {
|
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_group_5) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
|
|
|
|
//保存糖尿病和高血压
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("4");//市级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_100);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_100_name);
|
|
|
|
if (entry.getValue() != null && entry.getValue().containsKey(Constant.level_group_100)) {
|
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_group_100) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
|
|
Map<String, Long> oneMap=entry.getValue();
|
|
|
|
for(Map.Entry<String, Long> entryCh: oneMap.entrySet()){
|
|
|
|
String city=entry.getKey();
|
|
|
|
String cityName=Constant.cityName;
|
|
|
|
String town="";
|
|
|
|
String townName="";
|
|
|
|
String org="";
|
|
|
|
String orgName="";
|
|
|
|
String level="4";
|
|
|
|
String key=entryCh.getKey();
|
|
|
|
save_level2_2(oneMap, city, cityName, town, townName, org, orgName, level, key);
|
|
}
|
|
}
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//保存区级
|
|
//保存区级
|
|
//保存区的统计数据
|
|
//保存区的统计数据
|
|
for (Map.Entry<String, Town> townEntry : townsMap.entrySet()) {
|
|
for (Map.Entry<String, Town> townEntry : townsMap.entrySet()) {
|
|
//判断该区是否有统计数据
|
|
//判断该区是否有统计数据
|
|
Map<String, Long> oneTownGroupMap = townGroupMap.get(townEntry.getKey());//得到当个区的统计数据
|
|
Map<String, Long> oneTownGroupMap = townGroupMap.get(townEntry.getKey());//得到当个区的统计数据
|
|
Town town = townEntry.getValue();//得到区级信息
|
|
|
|
//保存健康人群
|
|
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(Constant.city);
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(town.getCode());
|
|
|
|
wlyyQuotaResult.setTownName(town.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("3");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_1);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_1_name);
|
|
|
|
if (oneTownGroupMap != null && oneTownGroupMap.containsKey(Constant.level_group_1)) {
|
|
|
|
wlyyQuotaResult.setResult(oneTownGroupMap.get(Constant.level_group_1) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存慢病人群
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(Constant.city);
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(town.getCode());
|
|
|
|
wlyyQuotaResult.setTownName(town.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("3");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_2);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_2_name);
|
|
|
|
if (oneTownGroupMap != null && oneTownGroupMap.containsKey(Constant.level_group_2)) {
|
|
|
|
wlyyQuotaResult.setResult(oneTownGroupMap.get(Constant.level_group_2) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存65岁以上人群
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(Constant.city);
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(town.getCode());
|
|
|
|
wlyyQuotaResult.setTownName(town.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("3");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_3);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_3_name);
|
|
|
|
if (oneTownGroupMap != null && oneTownGroupMap.containsKey(Constant.level_group_3)) {
|
|
|
|
wlyyQuotaResult.setResult(oneTownGroupMap.get(Constant.level_group_3) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存高血压
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(Constant.city);
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(town.getCode());
|
|
|
|
wlyyQuotaResult.setTownName(town.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("3");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_4);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_4_name);
|
|
|
|
if (oneTownGroupMap != null && oneTownGroupMap.containsKey(Constant.level_group_4)) {
|
|
|
|
wlyyQuotaResult.setResult(oneTownGroupMap.get(Constant.level_group_4) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存糖尿病
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(Constant.city);
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(town.getCode());
|
|
|
|
wlyyQuotaResult.setTownName(town.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("3");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_5);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_5_name);
|
|
|
|
if (oneTownGroupMap != null && oneTownGroupMap.containsKey(Constant.level_group_5)) {
|
|
|
|
wlyyQuotaResult.setResult(oneTownGroupMap.get(Constant.level_group_5) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存糖尿病
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(Constant.city);
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(town.getCode());
|
|
|
|
wlyyQuotaResult.setTownName(town.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("3");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_100);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_100_name);
|
|
|
|
if (oneTownGroupMap != null && oneTownGroupMap.containsKey(Constant.level_group_100)) {
|
|
|
|
wlyyQuotaResult.setResult(oneTownGroupMap.get(Constant.level_group_100) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
|
|
Town townObj = townEntry.getValue();//得到区级信息
|
|
|
|
for(Map.Entry<String, Long> entryCh: oneTownGroupMap.entrySet()){
|
|
|
|
String city=entryCh.getKey();
|
|
|
|
String cityName=Constant.cityName;
|
|
|
|
String town=townObj.getCode();
|
|
|
|
String townName=townObj.getName();
|
|
|
|
String org="";
|
|
|
|
String orgName="";
|
|
|
|
String level="3";
|
|
|
|
String key=entryCh.getKey();
|
|
|
|
save_level2_2(oneTownGroupMap, city, cityName, town, townName, org, orgName, level, key);
|
|
}
|
|
}
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
}
|
|
}
|
|
//保存机构
|
|
//保存机构
|
|
for (Map.Entry<String, Hospital> hospitalEntry : hospitalsMap.entrySet()) {
|
|
for (Map.Entry<String, Hospital> hospitalEntry : hospitalsMap.entrySet()) {
|
|
//判断该机构是否有统计数据
|
|
//判断该机构是否有统计数据
|
|
Map<String, Long> oneOrgGroupMap = orgGroupMap.get(hospitalEntry.getKey());//得到当个机构的统计数据
|
|
Map<String, Long> oneOrgGroupMap = orgGroupMap.get(hospitalEntry.getKey());//得到当个机构的统计数据
|
|
Hospital hospital = hospitalEntry.getValue();//得到区级信息
|
|
Hospital hospital = hospitalEntry.getValue();//得到区级信息
|
|
//保存健康人群
|
|
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(Constant.city);
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("2");//机构级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_1);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_1_name);
|
|
|
|
if (oneOrgGroupMap != null && oneOrgGroupMap.containsKey(Constant.level_group_1)) {
|
|
|
|
wlyyQuotaResult.setResult(oneOrgGroupMap.get(Constant.level_group_1) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存慢病
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(Constant.city);
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("2");//机构级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_2);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_2_name);
|
|
|
|
if (oneOrgGroupMap != null && oneOrgGroupMap.containsKey(Constant.level_group_2)) {
|
|
|
|
wlyyQuotaResult.setResult(oneOrgGroupMap.get(Constant.level_group_2) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存65岁以上人群
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(Constant.city);
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("2");//机构级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_3);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_3_name);
|
|
|
|
if (oneOrgGroupMap != null && oneOrgGroupMap.containsKey(Constant.level_group_3)) {
|
|
|
|
wlyyQuotaResult.setResult(oneOrgGroupMap.get(Constant.level_group_3) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存高血压
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(Constant.city);
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("2");//机构级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_4);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_4_name);
|
|
|
|
if (oneOrgGroupMap != null && oneOrgGroupMap.containsKey(Constant.level_group_4)) {
|
|
|
|
wlyyQuotaResult.setResult(oneOrgGroupMap.get(Constant.level_group_4) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存糖尿病
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(Constant.city);
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("2");//机构级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_5);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_5_name);
|
|
|
|
if (oneOrgGroupMap != null && oneOrgGroupMap.containsKey(Constant.level_group_5)) {
|
|
|
|
wlyyQuotaResult.setResult(oneOrgGroupMap.get(Constant.level_group_5) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存糖尿病和高血压
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(Constant.city);
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("2");//机构级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_group_100);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_group_100_name);
|
|
|
|
if (oneOrgGroupMap != null && oneOrgGroupMap.containsKey(Constant.level_group_100)) {
|
|
|
|
wlyyQuotaResult.setResult(oneOrgGroupMap.get(Constant.level_group_100) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
|
|
for(Map.Entry<String, Long> entryCh: oneOrgGroupMap.entrySet()){
|
|
|
|
String city=entryCh.getKey();
|
|
|
|
String cityName=Constant.cityName;
|
|
|
|
String town=hospital.getTown();
|
|
|
|
String townName=hospital.getTownName();
|
|
|
|
String org=hospital.getCode();
|
|
|
|
String orgName=hospital.getName();
|
|
|
|
String level="2";
|
|
|
|
String key=entryCh.getKey();
|
|
|
|
save_level2_2(oneOrgGroupMap, city, cityName, town, townName, org, orgName, level, key);
|
|
}
|
|
}
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
QuartzJobLog.setJobEndTime(new Date());
|
|
QuartzJobLog.setJobEndTime(new Date());
|
|
QuartzJobLog.setJobContent("统计" + getYesterday() + " 的签约病人分组数据完成 ,得到签约数目:"+signFamilys.size());
|
|
|
|
QuartzJobLog.setJobType("1");
|
|
|
|
|
|
QuartzJobLog.setJobContent(saveContent(signFamilys,qkCount,orgCount,townCount,cityCount,isAll,errorContent));
|
|
|
|
QuartzJobLog.setJobType(isAll?"1":"0");
|
|
quartzJobLogDao.save(QuartzJobLog);
|
|
quartzJobLogDao.save(QuartzJobLog);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void save_level2_2(Map<String, Long> oneMap, String city, String cityName, String town, String townName, String org, String orgName, String level, String key) {
|
|
|
|
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);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.getLevelGroupName(key));
|
|
|
|
if (oneMap != null && oneMap.containsKey(key)) {
|
|
|
|
wlyyQuotaResult.setResult(oneMap.get(key) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void compute_level2_2(Map<String, Map<String, Long>> cityGroupMap, String group,String key) {
|
|
|
|
if (cityGroupMap.containsKey(key)) {
|
|
|
|
Map<String, Long> groupMapTemp = cityGroupMap.get(key);
|
|
|
|
groupMapTemp.put(group, (groupMapTemp.get(group) == null ? 0l : groupMapTemp.get(group)) + 1);
|
|
|
|
cityGroupMap.put(key, groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(group, 1L);
|
|
|
|
cityGroupMap.put(key, groupMapTemp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 机构维度患者年龄维度计算指标
|
|
* 机构维度患者年龄维度计算指标
|
|
*/
|
|
*/
|
|
@ -892,451 +568,142 @@ public class SignJob implements Job {
|
|
|
|
|
|
Map<String, Map<String, Long>> townAgeMap = new HashMap<String, Map<String, Long>>();//key是区行政代码
|
|
Map<String, Map<String, Long>> townAgeMap = new HashMap<String, Map<String, Long>>();//key是区行政代码
|
|
Map<String, Map<String, Long>> orgAgeMap = new HashMap<String, Map<String, Long>>();//key是机构代码
|
|
Map<String, Map<String, Long>> orgAgeMap = new HashMap<String, Map<String, Long>>();//key是机构代码
|
|
|
|
|
|
|
|
//统计有签约的
|
|
|
|
Long cityCount = 0L; //统计到市的数目
|
|
|
|
Long townCount = 0L; //统计到所有区的数目
|
|
|
|
Long orgCount = 0L;//统计到所有机构的数目
|
|
|
|
Long qkCount = 0L;//统计到所有全科医生的数目
|
|
|
|
boolean isAll=true;//是否统计失败
|
|
|
|
StringBuffer errorContent=new StringBuffer();
|
|
//统计有签约的
|
|
//统计有签约的
|
|
for (SignFamily signFamily : signFamilys) {
|
|
for (SignFamily signFamily : signFamilys) {
|
|
|
|
|
|
String orgCodeTemp=getOrg(signFamily.getHospital());
|
|
|
|
|
|
String orgCodeTemp=getOrg(signFamily.getHospital());
|
|
Hospital hospital = hospitalsMap.get(orgCodeTemp);//得到患者签约的机构
|
|
Hospital hospital = hospitalsMap.get(orgCodeTemp);//得到患者签约的机构
|
|
|
|
if(hospital == null) {
|
|
|
|
errorContent.append("签约code:"+signFamily.getCode()+",签约的全科医生(doctor字段)的所属机构(wlyy_doctor表中的hospital字段)为空或者所属的机构数据有问题");
|
|
|
|
isAll=false;
|
|
|
|
continue;
|
|
|
|
}
|
|
String town = hospital.getTown();
|
|
String town = hospital.getTown();
|
|
int age = IdCardUtil.getAgeForIdcard(signFamily.getIdcard());//根据card解析年龄
|
|
int age = IdCardUtil.getAgeForIdcard(signFamily.getIdcard());//根据card解析年龄
|
|
String ageCode = getAgeCode(age);//得到年龄的code
|
|
String ageCode = getAgeCode(age);//得到年龄的code
|
|
//统计市
|
|
//统计市
|
|
if (cityAgeMap.containsKey(Constant.city)) {
|
|
|
|
Map<String, Long> groupMapTemp = cityAgeMap.get(Constant.city);
|
|
|
|
groupMapTemp.put(ageCode, (groupMapTemp.get(ageCode) == null ? 0l : groupMapTemp.get(ageCode)) + 1);
|
|
|
|
cityAgeMap.put(Constant.city, groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(ageCode, 1L);
|
|
|
|
cityAgeMap.put(Constant.city, groupMapTemp);
|
|
|
|
}
|
|
|
|
//统计区
|
|
|
|
if (townAgeMap.containsKey(town)) {
|
|
|
|
Map<String, Long> groupMapTemp = townAgeMap.get(town);
|
|
|
|
groupMapTemp.put(ageCode, (groupMapTemp.get(ageCode) == null ? 0l : groupMapTemp.get(ageCode)) + 1);
|
|
|
|
townAgeMap.put(town, groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(ageCode, 1L);
|
|
|
|
townAgeMap.put(town, groupMapTemp);
|
|
|
|
}
|
|
|
|
//统计机构
|
|
|
|
|
|
compute_level2_3(cityAgeMap, ageCode,Constant.city);
|
|
|
|
cityCount++;
|
|
|
|
//统计区
|
|
|
|
compute_level2_3(townAgeMap, ageCode,town);
|
|
|
|
townCount++;
|
|
//统计站
|
|
//统计站
|
|
String orgCode=hospital.getCode();
|
|
String orgCode=hospital.getCode();
|
|
if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
|
|
if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
|
|
//统计站
|
|
//统计站
|
|
orgCodeTemp=orgCode.substring(0,orgCode.length()-2)+"00";
|
|
orgCodeTemp=orgCode.substring(0,orgCode.length()-2)+"00";
|
|
//统计机构
|
|
//统计机构
|
|
if (orgAgeMap.containsKey(orgCodeTemp)) {
|
|
|
|
Map<String, Long> groupMapTemp = orgAgeMap.get(orgCodeTemp);
|
|
|
|
groupMapTemp.put(ageCode, (groupMapTemp.get(ageCode) == null ? 0l : groupMapTemp.get(ageCode)) + 1);
|
|
|
|
orgAgeMap.put(orgCodeTemp, groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(ageCode, 1L);
|
|
|
|
orgAgeMap.put(orgCodeTemp, groupMapTemp);
|
|
|
|
}
|
|
|
|
|
|
compute_level2_3(orgAgeMap, ageCode,orgCodeTemp);
|
|
} else {
|
|
} else {
|
|
//统计机构
|
|
//统计机构
|
|
if (orgAgeMap.containsKey(hospital.getCode())) {
|
|
|
|
Map<String, Long> groupMapTemp = orgAgeMap.get(hospital.getCode());
|
|
|
|
groupMapTemp.put(ageCode, (groupMapTemp.get(ageCode) == null ? 0l : groupMapTemp.get(ageCode)) + 1);
|
|
|
|
orgAgeMap.put(hospital.getCode(), groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(ageCode, 1L);
|
|
|
|
orgAgeMap.put(hospital.getCode(), groupMapTemp);
|
|
|
|
}
|
|
|
|
|
|
compute_level2_3(orgAgeMap, ageCode,hospital.getCode());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
orgCount++;
|
|
}
|
|
}
|
|
//保存统计数据
|
|
//保存统计数据
|
|
// 保存市的统计数据
|
|
// 保存市的统计数据
|
|
for (Map.Entry<String, Map<String, Long>> entry : cityAgeMap.entrySet()) {
|
|
for (Map.Entry<String, Map<String, Long>> entry : cityAgeMap.entrySet()) {
|
|
Map<String, Long> oneAgeMap = entry.getValue();
|
|
Map<String, Long> oneAgeMap = entry.getValue();
|
|
//保存0~6
|
|
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("4");//市级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_1);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_1_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_1)) {
|
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_age_1) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存7~18
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("4");//市级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_2);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_2_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_2)) {
|
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_age_2) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存18~30
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("4");//市级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_3);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_3_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_3)) {
|
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_age_3) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存30~50
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("4");//市级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_4);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_4_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_4)) {
|
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_age_4) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存50~65
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("4");//市级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_5);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_5_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_5)) {
|
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_age_5) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存18~30
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("4");//市级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_6);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_6_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_6)) {
|
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_age_6) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
|
|
for(int i=1;i<7;i++){
|
|
|
|
String city=Constant.city;
|
|
|
|
String cityName=Constant.cityName;
|
|
|
|
String town="";
|
|
|
|
String townName="";
|
|
|
|
String org="";
|
|
|
|
String orgName="";
|
|
|
|
String level="4";
|
|
|
|
String key=i+"";
|
|
|
|
save_level2_3(oneAgeMap, city, cityName, town, townName, org, orgName, level, key);
|
|
}
|
|
}
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
}
|
|
}
|
|
//保存区级
|
|
//保存区级
|
|
for (Map.Entry<String, Town> entry : townsMap.entrySet()) {
|
|
for (Map.Entry<String, Town> entry : townsMap.entrySet()) {
|
|
//判断该区是否有统计数据
|
|
//判断该区是否有统计数据
|
|
Map<String, Long> oneAgeMap = townAgeMap.get(entry.getKey());//得到当个区的统计数据
|
|
Map<String, Long> oneAgeMap = townAgeMap.get(entry.getKey());//得到当个区的统计数据
|
|
Town town = entry.getValue();//得到区级信息
|
|
|
|
//保存0~6
|
|
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(town.getCode());
|
|
|
|
wlyyQuotaResult.setTownName(town.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("3");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_1);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_1_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_1)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(Constant.level_age_1) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存7~18
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(town.getCode());
|
|
|
|
wlyyQuotaResult.setTownName(town.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("3");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_2);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_2_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_2)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(Constant.level_age_2) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存18~30
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(town.getCode());
|
|
|
|
wlyyQuotaResult.setTownName(town.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("3");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_3);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_3_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_3)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(Constant.level_age_3) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存30~50
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(town.getCode());
|
|
|
|
wlyyQuotaResult.setTownName(town.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("3");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_4);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_4_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_4)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(Constant.level_age_4) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存50~65
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(town.getCode());
|
|
|
|
wlyyQuotaResult.setTownName(town.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("3");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_5);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_5_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_5)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(Constant.level_age_5) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存18~30
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(entry.getKey());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(town.getCode());
|
|
|
|
wlyyQuotaResult.setTownName(town.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("3");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_6);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_6_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_6)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(Constant.level_age_6) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
|
|
Town townObj = entry.getValue();//得到区级信息
|
|
|
|
for(int i=1;i<7;i++){
|
|
|
|
String city=Constant.city;
|
|
|
|
String cityName=Constant.cityName;
|
|
|
|
String town=townObj.getCode();
|
|
|
|
String townName=townObj.getName();
|
|
|
|
String org="";
|
|
|
|
String orgName="";
|
|
|
|
String level="3";
|
|
|
|
String key=i+"";
|
|
|
|
save_level2_3(oneAgeMap, city, cityName, town, townName, org, orgName, level, key);
|
|
}
|
|
}
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//保存机构
|
|
for (Map.Entry<String, Hospital> hospitalEntry : hospitalsMap.entrySet()) {
|
|
for (Map.Entry<String, Hospital> hospitalEntry : hospitalsMap.entrySet()) {
|
|
//判断该机构是否有统计数据
|
|
//判断该机构是否有统计数据
|
|
Map<String, Long> oneAgeMap = orgAgeMap.get(hospitalEntry.getKey());//得到当个机构的统计数据
|
|
Map<String, Long> oneAgeMap = orgAgeMap.get(hospitalEntry.getKey());//得到当个机构的统计数据
|
|
Hospital hospital = hospitalEntry.getValue();//得到区级信息
|
|
Hospital hospital = hospitalEntry.getValue();//得到区级信息
|
|
//保存0~6
|
|
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(hospital.getCity());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("2");//区级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_1);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_1_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_1)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(Constant.level_age_1) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存7~18
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(hospital.getCity());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("2");//机构级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_2);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_2_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_2)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(Constant.level_age_2) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存18~30
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(hospital.getCity());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("2");//机构级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_3);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_3_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_3)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(Constant.level_age_3) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存30~50
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(hospital.getCity());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("2");//机构级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_4);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_4_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_4)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(Constant.level_age_4) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存50~65
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(hospital.getCity());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("2");//机构级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_5);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_5_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_5)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(Constant.level_age_5) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
//保存18~30
|
|
|
|
wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
|
wlyyQuotaResult.setCity(hospital.getCity());
|
|
|
|
wlyyQuotaResult.setCityName(Constant.cityName);
|
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
|
wlyyQuotaResult.setLevel1Type("2");//机构级
|
|
|
|
wlyyQuotaResult.setLevel2Type(Constant.level_age_6);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_age_6_name);
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(Constant.level_age_6)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(Constant.level_age_6) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
|
|
for(int i=1;i<7;i++){
|
|
|
|
String city=Constant.city;
|
|
|
|
String cityName=Constant.cityName;
|
|
|
|
String town=hospital.getTown();
|
|
|
|
String townName=hospital.getTownName();
|
|
|
|
String org=hospital.getCode();
|
|
|
|
String orgName=hospital.getName();
|
|
|
|
String level="2";
|
|
|
|
String key=i+"";
|
|
|
|
save_level2_3(oneAgeMap, city, cityName, town, townName, org, orgName, level, key);
|
|
}
|
|
}
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
QuartzJobLog.setJobEndTime(new Date());
|
|
QuartzJobLog.setJobEndTime(new Date());
|
|
QuartzJobLog.setJobContent("统计" + getYesterday() + " 的签约患者年龄数据完成 ,得到签约数目:"+signFamilys.size());
|
|
|
|
QuartzJobLog.setJobType("1");
|
|
|
|
|
|
QuartzJobLog.setJobContent(saveContent(signFamilys,qkCount,orgCount,townCount,cityCount,isAll,errorContent));
|
|
|
|
QuartzJobLog.setJobType(isAll?"1":"0");
|
|
quartzJobLogDao.save(QuartzJobLog);
|
|
quartzJobLogDao.save(QuartzJobLog);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void save_level2_3(Map<String, Long> oneAgeMap, String city, String cityName, String town, String townName, String org, String orgName, String level, String key) {
|
|
|
|
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);
|
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.getLevelAgeName(key));
|
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(key)) {
|
|
|
|
wlyyQuotaResult.setResult(oneAgeMap.get(key) + "");
|
|
|
|
} else {
|
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
|
}
|
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void compute_level2_3(Map<String, Map<String, Long>> cityAgeMap, String ageCode,String key) {
|
|
|
|
if (cityAgeMap.containsKey(key)) {
|
|
|
|
Map<String, Long> groupMapTemp = cityAgeMap.get(key);
|
|
|
|
groupMapTemp.put(ageCode, (groupMapTemp.get(ageCode) == null ? 0l : groupMapTemp.get(ageCode)) + 1);
|
|
|
|
cityAgeMap.put(key, groupMapTemp);
|
|
|
|
} else {
|
|
|
|
Map<String, Long> groupMapTemp = new HashMap<String, Long>();
|
|
|
|
groupMapTemp.put(ageCode, 1L);
|
|
|
|
cityAgeMap.put(key, groupMapTemp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 机构维度计算指标
|
|
* 机构维度计算指标
|
|
*/
|
|
*/
|
|
@ -1351,10 +718,10 @@ public class SignJob implements Job {
|
|
QuartzJobLog.setJobName(wlyyJobConfig.getJobName());
|
|
QuartzJobLog.setJobName(wlyyJobConfig.getJobName());
|
|
|
|
|
|
//查找出系统全部的全科医生
|
|
//查找出系统全部的全科医生
|
|
List<Doctor> doctors = doctorDao.findAllQKDoctot();
|
|
|
|
Map<String, Doctor> doctorsMap = new HashMap<String, Doctor>();
|
|
|
|
for (Doctor doctor : doctors) {
|
|
|
|
doctorsMap.put(doctor.getCode(), doctor);
|
|
|
|
|
|
List<AdminTeam> adminTeams=doctorAdminTeamDao.findAllTeam();
|
|
|
|
Map<String, AdminTeam> adminTeamMap = new HashMap<String, AdminTeam>();
|
|
|
|
for (AdminTeam adminTeam : adminTeams) {
|
|
|
|
adminTeamMap.put(adminTeam.getId()+"", adminTeam);
|
|
}
|
|
}
|
|
//查找出系统全部的机构
|
|
//查找出系统全部的机构
|
|
List<Hospital> hospitals = hospitalDao.findHospitalzxFWZ();
|
|
List<Hospital> hospitals = hospitalDao.findHospitalzxFWZ();
|
|
@ -1373,45 +740,57 @@ public class SignJob implements Job {
|
|
|
|
|
|
Map<String, Long> tjTownMap = new HashMap<String, Long>();//区级的统计map key 是区行政区划350200
|
|
Map<String, Long> tjTownMap = new HashMap<String, Long>();//区级的统计map key 是区行政区划350200
|
|
Map<String, Long> tjOrgMap = new HashMap<String, Long>();//机构的统计map key 是机构的code
|
|
Map<String, Long> tjOrgMap = new HashMap<String, Long>();//机构的统计map key 是机构的code
|
|
Map<String, Long> tjQkdoctorMap = new HashMap<String, Long>();//团队级的统计map 目前没有团队 先用全科医生统一 key doctorCode
|
|
|
|
Long cityCount = 0L;
|
|
|
|
|
|
Map<String, Long> tjAdminTeamMap = new HashMap<String, Long>();//团队级的统计map 目前没有团队 先用全科医生统一 key doctorCode
|
|
|
|
Long cityCount = 0L; //统计到市的数目
|
|
|
|
Long townCount = 0L; //统计到所有区的数目
|
|
|
|
Long orgCount = 0L;//统计到所有机构的数目
|
|
|
|
Long qkCount = 0L;//统计到所有全科医生的数目
|
|
|
|
boolean isAll=true;//是否统计失败
|
|
|
|
StringBuffer errorContent=new StringBuffer();
|
|
//统计有签约的
|
|
//统计有签约的
|
|
String orgCodeTemp="";
|
|
|
|
for (SignFamily signFamily : signFamilys) {
|
|
for (SignFamily signFamily : signFamilys) {
|
|
String doctorCode = signFamily.getDoctor();//得到签约中全科医生的code
|
|
|
|
//统计团队
|
|
|
|
compute_level1(tjQkdoctorMap, doctorCode);
|
|
|
|
//判断医生属于哪个机构
|
|
|
|
Doctor doctor = doctorsMap.get(doctorCode);
|
|
|
|
if (doctor == null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
String orgCode = doctor.getHospital();
|
|
|
|
//统计机构
|
|
|
|
//统计站
|
|
|
|
|
|
String orgCode = signFamily.getHospital();
|
|
|
|
String orgCodeTemp="";
|
|
if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
|
|
if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
|
|
//统计站
|
|
|
|
|
|
//站
|
|
orgCodeTemp=orgCode.substring(0,orgCode.length()-2)+"00";
|
|
orgCodeTemp=orgCode.substring(0,orgCode.length()-2)+"00";
|
|
compute_level1(tjOrgMap, orgCodeTemp);
|
|
|
|
} else {
|
|
|
|
//统计社区
|
|
|
|
compute_level1(tjOrgMap, orgCode);
|
|
|
|
|
|
}else{
|
|
|
|
//社区
|
|
orgCodeTemp=orgCode;
|
|
orgCodeTemp=orgCode;
|
|
}
|
|
}
|
|
|
|
|
|
Hospital hospital=hospitalsMap.get(orgCodeTemp);
|
|
Hospital hospital=hospitalsMap.get(orgCodeTemp);
|
|
|
|
if(hospital == null) {
|
|
|
|
errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的hospital数据异常");
|
|
|
|
isAll=false;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
AdminTeam adminTeam=adminTeamMap.get(signFamily.getAdminTeamId()+"");
|
|
|
|
if(adminTeam == null) {
|
|
|
|
errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的Admin_Team_Id数据异常");
|
|
|
|
isAll=false;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
//统计市 ---------------start--------------
|
|
|
|
cityCount++;
|
|
|
|
//统计区 ---------------start--------------
|
|
String townCode = hospital.getTown();
|
|
String townCode = hospital.getTown();
|
|
//统计区
|
|
|
|
compute_level1(tjTownMap, townCode);
|
|
compute_level1(tjTownMap, townCode);
|
|
//统计市
|
|
|
|
cityCount++;
|
|
|
|
|
|
townCount++;
|
|
|
|
//统计机构---------------start--------------
|
|
|
|
compute_level1(tjOrgMap, orgCodeTemp);
|
|
|
|
orgCount++;
|
|
|
|
//统计团队 ---------------start--------------
|
|
|
|
String adminTeamId = signFamily.getAdminTeamId()+"";
|
|
|
|
compute_level1(tjAdminTeamMap, adminTeamId);
|
|
|
|
qkCount++;
|
|
|
|
|
|
}
|
|
}
|
|
//保存统计的结果
|
|
//保存统计的结果
|
|
//保存全科医生的签约统计
|
|
|
|
for (Map.Entry<String, Doctor> entry : doctorsMap.entrySet()) {
|
|
|
|
Doctor doctor = doctorsMap.get(entry.getKey());//得到全科医生
|
|
|
|
orgCodeTemp=getOrg(doctor.getHospital());
|
|
|
|
|
|
for (Map.Entry<String, AdminTeam> entry : adminTeamMap.entrySet()) {
|
|
|
|
AdminTeam adminTeam = adminTeamMap.get(entry.getKey());//得到全科医生
|
|
|
|
String orgCodeTemp=getOrg(adminTeam.getOrgCode());
|
|
Hospital hospital = hospitalsMap.get(orgCodeTemp);//得到全科医生的机构
|
|
Hospital hospital = hospitalsMap.get(orgCodeTemp);//得到全科医生的机构
|
|
|
|
if(hospital == null) continue;
|
|
String city=Constant.city;
|
|
String city=Constant.city;
|
|
String cityName=Constant.cityName;
|
|
String cityName=Constant.cityName;
|
|
String town=hospital.getTown();
|
|
String town=hospital.getTown();
|
|
@ -1422,16 +801,17 @@ public class SignJob implements Job {
|
|
org=hospital.getCode().substring(0,hospital.getCode().length()-2)+"00";
|
|
org=hospital.getCode().substring(0,hospital.getCode().length()-2)+"00";
|
|
}
|
|
}
|
|
String orgName=hospital.getName();
|
|
String orgName=hospital.getName();
|
|
String doctorCode=doctor.getCode();
|
|
|
|
String doctorName=doctor.getName();
|
|
|
|
String doctorJob=doctor.getJob();
|
|
|
|
|
|
String doctorCode=adminTeam.getId()+"";
|
|
|
|
String doctorName=adminTeam.getName();
|
|
|
|
String doctorJob="";
|
|
String level="1";
|
|
String level="1";
|
|
String key=doctor.getCode();
|
|
|
|
save_level1(tjQkdoctorMap, key, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level);
|
|
|
|
|
|
String key=adminTeam.getId()+"";
|
|
|
|
save_level1(tjAdminTeamMap, key, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level);
|
|
}
|
|
}
|
|
//保存机构的签约统计
|
|
//保存机构的签约统计
|
|
for (Map.Entry<String, Hospital> entry : hospitalsMap.entrySet()) {
|
|
for (Map.Entry<String, Hospital> entry : hospitalsMap.entrySet()) {
|
|
Hospital hospital = hospitalsMap.get(entry.getKey());//得到全科医生
|
|
Hospital hospital = hospitalsMap.get(entry.getKey());//得到全科医生
|
|
|
|
if(hospital == null) continue;
|
|
String city=Constant.city;
|
|
String city=Constant.city;
|
|
String cityName=Constant.cityName;
|
|
String cityName=Constant.cityName;
|
|
String town=hospital.getTown();
|
|
String town=hospital.getTown();
|
|
@ -1482,8 +862,8 @@ public class SignJob implements Job {
|
|
}
|
|
}
|
|
|
|
|
|
QuartzJobLog.setJobEndTime(new Date());
|
|
QuartzJobLog.setJobEndTime(new Date());
|
|
QuartzJobLog.setJobContent("统计" + getYesterday() + " 的签约数据完成 ,得到签约数目:"+signFamilys.size());
|
|
|
|
QuartzJobLog.setJobType("1");
|
|
|
|
|
|
QuartzJobLog.setJobContent(saveContent(signFamilys,qkCount,orgCount,townCount,cityCount,isAll,errorContent));
|
|
|
|
QuartzJobLog.setJobType(isAll?"1":"0");
|
|
quartzJobLogDao.save(QuartzJobLog);
|
|
quartzJobLogDao.save(QuartzJobLog);
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@ -1568,13 +948,25 @@ public class SignJob implements Job {
|
|
return dateString;
|
|
return dateString;
|
|
}
|
|
}
|
|
private String getOrg(String org){
|
|
private String getOrg(String org){
|
|
if(!"00".equals(org.substring(org.length()-2,org.length()))){
|
|
|
|
|
|
//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";
|
|
return org.substring(0,org.length()-2)+"00";
|
|
}else{
|
|
}else{
|
|
return org;
|
|
return org;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public static void main(String[] args) {
|
|
|
|
getDayString(0);
|
|
|
|
|
|
|
|
|
|
private String saveContent(List<SignFamily> signFamilys, Long qkCount, Long orgCount, Long townCount, Long cityCount, boolean isAll, StringBuffer errorContent) {
|
|
|
|
StringBuffer string=new StringBuffer("统计"+getYesterday()+" 的待签约数据完成 ,数据库查询到待签约数目:"+signFamilys.size());
|
|
|
|
string.append(",统计到市的数据总数:"+cityCount);
|
|
|
|
string.append(",统计到区的数据总数:"+townCount);
|
|
|
|
string.append(",统计到机构的数据总数:"+orgCount);
|
|
|
|
string.append(",统计到团队的数据总数:"+qkCount);
|
|
|
|
string.append(",是否统计成功:"+isAll);
|
|
|
|
if(!isAll){
|
|
|
|
string.append(",失败原因:"+errorContent);
|
|
|
|
}
|
|
|
|
return string.toString();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|