|
@ -1,13 +1,16 @@
|
|
|
package com.yihu.wlyy.job;
|
|
|
|
|
|
import com.yihu.wlyy.entity.*;
|
|
|
import com.yihu.wlyy.entity.address.Hospital;
|
|
|
import com.yihu.wlyy.entity.address.Town;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
|
|
|
import com.yihu.wlyy.entity.job.QuartzJobLog;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.PatientDisease;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.statistics.WlyyQuotaResult;
|
|
|
import com.yihu.wlyy.repository.*;
|
|
|
import com.yihu.wlyy.repository.address.TownDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
|
|
@ -17,6 +20,7 @@ import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.repository.statistics.WlyyQuotaResultDao;
|
|
|
import com.yihu.wlyy.service.app.disease.PatientDiseaseService;
|
|
|
import com.yihu.wlyy.service.common.account.PatientService;
|
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
|
import com.yihu.wlyy.web.quota.WlyyJobConfigVO;
|
|
|
import com.yihu.wlyy.web.quota.WlyyQuotaVO;
|
|
@ -59,12 +63,8 @@ public class SignJob implements Job {
|
|
|
@Autowired
|
|
|
private DoctorPatientGroupInfoDao doctorPatientGroupInfoDao;
|
|
|
@Autowired
|
|
|
private PatientDao patientDao;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
|
private PatientDiseaseService patientDiseaseService;
|
|
|
@Autowired
|
|
|
private StringRedisTemplate redisTemplate;
|
|
|
|
|
|
String yesterday;
|
|
@ -121,10 +121,10 @@ public class SignJob implements Job {
|
|
|
|
|
|
try {
|
|
|
//新建任务日志对象
|
|
|
QuartzJobLog quartzJobLog = new QuartzJobLog();
|
|
|
quartzJobLog.setJobStartTime(new Date());
|
|
|
quartzJobLog.setJobId(wlyyJobConfig.getId());
|
|
|
quartzJobLog.setJobName(wlyyJobConfig.getJobName());
|
|
|
QuartzJobLog QuartzJobLog = new QuartzJobLog();
|
|
|
QuartzJobLog.setJobStartTime(new Date());
|
|
|
QuartzJobLog.setJobId(wlyyJobConfig.getId());
|
|
|
QuartzJobLog.setJobName(wlyyJobConfig.getJobName());
|
|
|
//查找出系统全部的机构
|
|
|
List<Hospital> hospitals = hospitalDao.findHospitalzxFWZ();
|
|
|
Map<String, Hospital> hospitalsMap = new HashMap<String, Hospital>();
|
|
@ -152,259 +152,126 @@ public class SignJob implements Job {
|
|
|
String hospitalCode = hospital.getCode();//得到患者签约的机构号
|
|
|
String sex = IdCardUtil.getSexForIdcard(idcard);//根据身份证得到性别
|
|
|
//统计市 目前只统计厦门市 所以先写死 后期再改造
|
|
|
if (citySexMap.containsKey(Constant.city)) {
|
|
|
Map<String, Long> sexMap = citySexMap.get(Constant.city);
|
|
|
sexMap.put(sex, (sexMap.get(sex) == null ? 0l : sexMap.get(sex)) + 1);
|
|
|
citySexMap.put(Constant.city, sexMap);
|
|
|
} else {
|
|
|
Map<String, Long> sexMap = new HashMap<String, Long>();
|
|
|
sexMap.put(sex, 1L);
|
|
|
citySexMap.put(Constant.city, sexMap);
|
|
|
}
|
|
|
compute_level2_1(citySexMap,Constant.city, sex);
|
|
|
//统计区
|
|
|
if (townSexMap.containsKey(town)) {
|
|
|
Map<String, Long> sexMap = townSexMap.get(town);
|
|
|
sexMap.put(sex, (sexMap.get(sex) == null ? 0l : sexMap.get(sex)) + 1);
|
|
|
townSexMap.put(town, sexMap);
|
|
|
} else {
|
|
|
Map<String, Long> sexMap = new HashMap<String, Long>();
|
|
|
sexMap.put(sex, 1L);
|
|
|
townSexMap.put(town, sexMap);
|
|
|
}
|
|
|
compute_level2_1(townSexMap,town, sex);
|
|
|
//统计机构
|
|
|
|
|
|
//统计站
|
|
|
if (!"00".equals(hospitalCode.substring(8))) {
|
|
|
String orgCodeTemp = hospitalCode.substring(0, 8) + "00";
|
|
|
if (orgSexMap.containsKey(orgCodeTemp)) {
|
|
|
Map<String, Long> sexMap = orgSexMap.get(orgCodeTemp);
|
|
|
sexMap.put(sex, (sexMap.get(sex) == null ? 0l : sexMap.get(sex)) + 1);
|
|
|
orgSexMap.put(orgCodeTemp, sexMap);
|
|
|
} else {
|
|
|
Map<String, Long> sexMap = new HashMap<String, Long>();
|
|
|
sexMap.put(sex, 1L);
|
|
|
orgSexMap.put(orgCodeTemp, sexMap);
|
|
|
}
|
|
|
compute_level2_1(orgSexMap,orgCodeTemp, sex);
|
|
|
} else {
|
|
|
//统计社区
|
|
|
if (orgSexMap.containsKey(hospitalCode)) {
|
|
|
Map<String, Long> sexMap = orgSexMap.get(hospitalCode);
|
|
|
sexMap.put(sex, (sexMap.get(sex) == null ? 0l : sexMap.get(sex)) + 1);
|
|
|
orgSexMap.put(hospitalCode, sexMap);
|
|
|
} else {
|
|
|
Map<String, Long> sexMap = new HashMap<String, Long>();
|
|
|
sexMap.put(sex, 1L);
|
|
|
orgSexMap.put(hospitalCode, sexMap);
|
|
|
}
|
|
|
compute_level2_1(orgSexMap,hospitalCode, sex);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
//保存统计数据
|
|
|
//保存市统计数据
|
|
|
for (Map.Entry<String, Map<String, Long>> entry : citySexMap.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_sex_1);
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_sex_1_name);
|
|
|
if (entry.getValue() != null && entry.getValue().containsKey(Constant.level_sex_1)) {
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_sex_1) + "");
|
|
|
} else {
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
for(int i=1;i<4;i++){
|
|
|
String key=i+"";
|
|
|
String city=Constant.city;
|
|
|
String cityName=Constant.cityName;
|
|
|
String town="";
|
|
|
String townName="";
|
|
|
String org="";
|
|
|
String orgName="";
|
|
|
String level="3";
|
|
|
save_level2_1(entry.getValue(), key, city, cityName, town, townName, org, orgName, level);
|
|
|
}
|
|
|
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_sex_2);
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_sex_2_name);
|
|
|
if (entry.getValue() != null && entry.getValue().containsKey(Constant.level_sex_2)) {
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_sex_2) + "");
|
|
|
} 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_sex_3);
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_sex_3_name);
|
|
|
if (entry.getValue() != null && entry.getValue().containsKey(Constant.level_sex_3)) {
|
|
|
wlyyQuotaResult.setResult(entry.getValue().get(Constant.level_sex_3) + "");
|
|
|
} else {
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
}
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
}
|
|
|
//保存区的统计数据
|
|
|
for (Map.Entry<String, Town> townEntry : townsMap.entrySet()) {
|
|
|
//判断该区是否有统计数据
|
|
|
Map<String, Long> oneTownSexMap = townSexMap.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_sex_1);
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_sex_1_name);
|
|
|
if (oneTownSexMap != null && oneTownSexMap.containsKey(Constant.level_sex_1)) {
|
|
|
wlyyQuotaResult.setResult(oneTownSexMap.get(Constant.level_sex_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_sex_2);
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_sex_2_name);
|
|
|
if (oneTownSexMap != null && oneTownSexMap.containsKey(Constant.level_sex_2)) {
|
|
|
wlyyQuotaResult.setResult(oneTownSexMap.get(Constant.level_sex_2) + "");
|
|
|
} 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_sex_3);
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_sex_3_name);
|
|
|
if (oneTownSexMap != null && oneTownSexMap.containsKey(Constant.level_sex_3)) {
|
|
|
wlyyQuotaResult.setResult(oneTownSexMap.get(Constant.level_sex_3) + "");
|
|
|
} else {
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
Town townObj = townEntry.getValue();//得到区级信息
|
|
|
for(int i=1;i<4;i++){
|
|
|
String key=i+"";
|
|
|
String city=Constant.city;
|
|
|
String cityName=Constant.cityName;
|
|
|
String town=townObj.getCode();
|
|
|
String townName=townObj.getName();
|
|
|
String org="";
|
|
|
String orgName="";
|
|
|
String level="3";
|
|
|
save_level2_1(oneTownSexMap, key, city, cityName, town, townName, org, orgName, level);
|
|
|
}
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
}
|
|
|
//统计机构
|
|
|
for (Map.Entry<String, Hospital> hospitalEntry : hospitalsMap.entrySet()) {
|
|
|
//判断该机构是否有统计数据
|
|
|
Map<String, Long> oneorgSexMap = orgSexMap.get(hospitalEntry.getKey());//得到当个机构的统计数据
|
|
|
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_sex_1);
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_sex_1_name);
|
|
|
if (oneorgSexMap != null && oneorgSexMap.containsKey(Constant.level_sex_1)) {
|
|
|
wlyyQuotaResult.setResult(oneorgSexMap.get(Constant.level_sex_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_sex_2);
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_sex_2_name);
|
|
|
if (oneorgSexMap != null && oneorgSexMap.containsKey(Constant.level_sex_2)) {
|
|
|
wlyyQuotaResult.setResult(oneorgSexMap.get(Constant.level_sex_2) + "");
|
|
|
} 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_sex_3);
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.level_sex_3_name);
|
|
|
if (oneorgSexMap != null && oneorgSexMap.containsKey(Constant.level_sex_3)) {
|
|
|
wlyyQuotaResult.setResult(oneorgSexMap.get(Constant.level_sex_3) + "");
|
|
|
} else {
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
}
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
for(int i=1;i<4;i++){
|
|
|
String key=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";
|
|
|
save_level2_1(oneorgSexMap, key, city, cityName, town, townName, org, orgName, level);
|
|
|
}
|
|
|
}
|
|
|
quartzJobLog.setJobEndTime(new Date());
|
|
|
quartzJobLog.setJobContent("统计" + getYesterday() + " 的签约性别数据完成 ");
|
|
|
quartzJobLog.setJobType("1");
|
|
|
quartzJobLogDao.save(quartzJobLog);
|
|
|
QuartzJobLog.setJobEndTime(new Date());
|
|
|
QuartzJobLog.setJobContent("统计" + getYesterday() + " 的签约性别数据完成 ");
|
|
|
QuartzJobLog.setJobType("1");
|
|
|
quartzJobLogDao.save(QuartzJobLog);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 机构维度下患者性别维度计算指标 公用保存方法
|
|
|
* @param oneorgSexMap
|
|
|
* @param key
|
|
|
* @param city
|
|
|
* @param cityName
|
|
|
* @param town
|
|
|
* @param townName
|
|
|
* @param org
|
|
|
* @param orgName
|
|
|
* @param level
|
|
|
*/
|
|
|
private void save_level2_1(Map<String, Long> oneorgSexMap, String key, 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);
|
|
|
wlyyQuotaResult.setLevel2TypeName(Constant.getLevelSexName(key));
|
|
|
if (oneorgSexMap != null && oneorgSexMap.containsKey(key)) {
|
|
|
wlyyQuotaResult.setResult(oneorgSexMap.get(key) + "");
|
|
|
} else {
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
}
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
}
|
|
|
|
|
|
private void compute_level2_1(Map<String, Map<String, Long>> citySexMap,String key, String sex) {
|
|
|
if (citySexMap.containsKey(key)) {
|
|
|
Map<String, Long> sexMap = citySexMap.get(key);
|
|
|
sexMap.put(sex, (sexMap.get(sex) == null ? 0l : sexMap.get(sex)) + 1);
|
|
|
citySexMap.put(key, sexMap);
|
|
|
} else {
|
|
|
Map<String, Long> sexMap = new HashMap<String, Long>();
|
|
|
sexMap.put(sex, 1L);
|
|
|
citySexMap.put(key, sexMap);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 机构维度患者分组维度计算指标
|
|
|
*/
|
|
@ -419,10 +286,10 @@ public class SignJob implements Job {
|
|
|
Map<String, Map<String, Long>> townGroupMap = new HashMap<String, Map<String, Long>>();//key是区行政代码
|
|
|
Map<String, Map<String, Long>> orgGroupMap = new HashMap<String, Map<String, Long>>();//key是机构代码
|
|
|
//新建任务日志对象
|
|
|
QuartzJobLog quartzJobLog = new QuartzJobLog();
|
|
|
quartzJobLog.setJobStartTime(new Date());
|
|
|
quartzJobLog.setJobId(wlyyJobConfig.getId());
|
|
|
quartzJobLog.setJobName(wlyyJobConfig.getJobName());
|
|
|
QuartzJobLog QuartzJobLog = new QuartzJobLog();
|
|
|
QuartzJobLog.setJobStartTime(new Date());
|
|
|
QuartzJobLog.setJobId(wlyyJobConfig.getId());
|
|
|
QuartzJobLog.setJobName(wlyyJobConfig.getJobName());
|
|
|
//查找出系统全部的机构
|
|
|
List<Hospital> hospitals = hospitalDao.findHospital2();
|
|
|
Map<String, Hospital> hospitalsMap = new HashMap<String, Hospital>();
|
|
@ -437,12 +304,6 @@ public class SignJob implements Job {
|
|
|
one.put("100", 0L);
|
|
|
orgGroupMap.put(hospital.getCode(), one);
|
|
|
}
|
|
|
//查找出系统全部的患者
|
|
|
List<Patient> patients = patientDao.findAllSignPatient();
|
|
|
Map<String, Patient> patientsMap = new HashMap<String, Patient>();
|
|
|
for (Patient patient : patients) {
|
|
|
patientsMap.put(patient.getCode(), patient);
|
|
|
}
|
|
|
//查找出厦门市全部的区
|
|
|
List<Town> towns = townDao.findByCityCode(Constant.city);
|
|
|
Map<String, Town> townsMap = new HashMap<String, Town>();
|
|
@ -457,19 +318,22 @@ public class SignJob implements Job {
|
|
|
one.put("100", 0L);
|
|
|
townGroupMap.put(town.getCode(), one);
|
|
|
}
|
|
|
//得到所有的签约病人的分组信息
|
|
|
List<DoctorPatientGroupInfo> doctorPatientGroupInfos = doctorPatientGroupInfoDao.findAllPatient();
|
|
|
Map<String, String> groupMap = new HashMap<String, String>();
|
|
|
for (DoctorPatientGroupInfo doctorPatientGroupInfo : doctorPatientGroupInfos) {
|
|
|
groupMap.put(doctorPatientGroupInfo.getPatient(), doctorPatientGroupInfo.getGroup());
|
|
|
}
|
|
|
|
|
|
//找出今天的签约信息
|
|
|
List<SignFamily> signFamilys = signFamilyDao.findByJiatingSignYesterday(yesterday, now);
|
|
|
|
|
|
//统计有签约的
|
|
|
for (SignFamily signFamily : signFamilys) {
|
|
|
String patient = signFamily.getPatient();
|
|
|
String group = groupMap.get(patient);//得到该签约病人的所在分组 1 普通 2 慢病 3是 65岁以上人群 4是 高血压 5是糖尿病 100是高血压和糖尿病
|
|
|
//设置查看病人所在分组
|
|
|
List<DoctorPatientGroupInfo> dctorPatientGroupInfo = doctorPatientGroupInfoDao.findByMorenPatient(patient);
|
|
|
String group ="";//得到该签约病人的所在分组 1 普通 2 慢病 3是 65岁以上人群 4是 高血压 5是糖尿病 100是高血压和糖尿病
|
|
|
if (dctorPatientGroupInfo != null && dctorPatientGroupInfo.size() > 0) {
|
|
|
group=dctorPatientGroupInfo.get(0).getGroup();
|
|
|
} else {
|
|
|
group="1";
|
|
|
}
|
|
|
|
|
|
Hospital hospital = hospitalsMap.get(signFamily.getHospital());//得到患者签约的机构
|
|
|
if (hospital == null) {
|
|
|
continue;
|
|
@ -533,6 +397,9 @@ public class SignJob implements Job {
|
|
|
JSONArray redisValues = new JSONArray(jsonString);
|
|
|
for (Object obj : redisValues) {
|
|
|
JSONObject redisValue = new JSONObject(obj);
|
|
|
if(!redisValue.has("signType")){
|
|
|
continue;
|
|
|
}
|
|
|
//排除掉三师签约
|
|
|
if ("1".equals(redisValue.get("signType").toString())) {
|
|
|
continue;
|
|
@ -984,10 +851,10 @@ public class SignJob implements Job {
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
}
|
|
|
|
|
|
quartzJobLog.setJobEndTime(new Date());
|
|
|
quartzJobLog.setJobContent("统计" + getYesterday() + " 的签约病人分组数据完成 ");
|
|
|
quartzJobLog.setJobType("1");
|
|
|
quartzJobLogDao.save(quartzJobLog);
|
|
|
QuartzJobLog.setJobEndTime(new Date());
|
|
|
QuartzJobLog.setJobContent("统计" + getYesterday() + " 的签约病人分组数据完成 ");
|
|
|
QuartzJobLog.setJobType("1");
|
|
|
quartzJobLogDao.save(QuartzJobLog);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@ -1001,10 +868,10 @@ public class SignJob implements Job {
|
|
|
try {
|
|
|
jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='" + yesterday + "' and quato_code='" + 8 + "'");
|
|
|
//新建任务日志对象
|
|
|
QuartzJobLog quartzJobLog = new QuartzJobLog();
|
|
|
quartzJobLog.setJobStartTime(new Date());
|
|
|
quartzJobLog.setJobId(wlyyJobConfig.getId());
|
|
|
quartzJobLog.setJobName(wlyyJobConfig.getJobName());
|
|
|
QuartzJobLog QuartzJobLog = new QuartzJobLog();
|
|
|
QuartzJobLog.setJobStartTime(new Date());
|
|
|
QuartzJobLog.setJobId(wlyyJobConfig.getId());
|
|
|
QuartzJobLog.setJobName(wlyyJobConfig.getJobName());
|
|
|
//查找出系统全部的机构
|
|
|
List<Hospital> hospitals = hospitalDao.findHospital2();
|
|
|
Map<String, Hospital> hospitalsMap = new HashMap<String, Hospital>();
|
|
@ -1457,10 +1324,10 @@ public class SignJob implements Job {
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
}
|
|
|
|
|
|
quartzJobLog.setJobEndTime(new Date());
|
|
|
quartzJobLog.setJobContent("统计" + getYesterday() + " 的签约患者年龄数据完成 ");
|
|
|
quartzJobLog.setJobType("1");
|
|
|
quartzJobLogDao.save(quartzJobLog);
|
|
|
QuartzJobLog.setJobEndTime(new Date());
|
|
|
QuartzJobLog.setJobContent("统计" + getYesterday() + " 的签约患者年龄数据完成 ");
|
|
|
QuartzJobLog.setJobType("1");
|
|
|
quartzJobLogDao.save(QuartzJobLog);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@ -1474,10 +1341,10 @@ public class SignJob implements Job {
|
|
|
|
|
|
jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='" + yesterday + "' and quato_code='" + 1 + "'");
|
|
|
//新建任务日志对象
|
|
|
QuartzJobLog quartzJobLog = new QuartzJobLog();
|
|
|
quartzJobLog.setJobStartTime(new Date());
|
|
|
quartzJobLog.setJobId(wlyyJobConfig.getId());
|
|
|
quartzJobLog.setJobName(wlyyJobConfig.getJobName());
|
|
|
QuartzJobLog QuartzJobLog = new QuartzJobLog();
|
|
|
QuartzJobLog.setJobStartTime(new Date());
|
|
|
QuartzJobLog.setJobId(wlyyJobConfig.getId());
|
|
|
QuartzJobLog.setJobName(wlyyJobConfig.getJobName());
|
|
|
|
|
|
//查找出系统全部的全科医生
|
|
|
List<Doctor> doctors = doctorDao.findAllQKDoctot();
|
|
@ -1508,11 +1375,7 @@ public class SignJob implements Job {
|
|
|
for (SignFamily signFamily : signFamilys) {
|
|
|
String doctorCode = signFamily.getDoctor();//得到签约中全科医生的code
|
|
|
//统计团队
|
|
|
if (tjQkdoctorMap.containsKey(doctorCode)) {
|
|
|
tjQkdoctorMap.put(doctorCode, tjQkdoctorMap.get(doctorCode) + 1);
|
|
|
} else {
|
|
|
tjQkdoctorMap.put(doctorCode, 1L);
|
|
|
}
|
|
|
compute_level1(tjQkdoctorMap, doctorCode);
|
|
|
//判断医生属于哪个机构
|
|
|
Doctor doctor = doctorsMap.get(doctorCode);
|
|
|
if (doctor == null) {
|
|
@ -1523,28 +1386,16 @@ public class SignJob implements Job {
|
|
|
//统计站
|
|
|
if (!"00".equals(orgCode.substring(8))) {
|
|
|
String orgCodeTemp = orgCode.substring(0, 8) + "00";
|
|
|
if (tjOrgMap.containsKey(orgCodeTemp)) {
|
|
|
tjOrgMap.put(orgCodeTemp, tjOrgMap.get(orgCodeTemp) + 1);
|
|
|
} else {
|
|
|
tjOrgMap.put(orgCodeTemp, 1L);
|
|
|
}
|
|
|
compute_level1(tjOrgMap, orgCodeTemp);
|
|
|
} else {
|
|
|
//统计社区
|
|
|
if (tjOrgMap.containsKey(orgCode)) {
|
|
|
tjOrgMap.put(orgCode, tjOrgMap.get(orgCode) + 1);
|
|
|
} else {
|
|
|
tjOrgMap.put(orgCode, 1L);
|
|
|
}
|
|
|
compute_level1(tjOrgMap, orgCode);
|
|
|
}
|
|
|
|
|
|
|
|
|
String townCode = doctor.getTown();
|
|
|
//统计区
|
|
|
if (tjTownMap.containsKey(townCode)) {
|
|
|
tjTownMap.put(townCode, tjTownMap.get(townCode) + 1);
|
|
|
} else {
|
|
|
tjTownMap.put(townCode, 1L);
|
|
|
}
|
|
|
compute_level1(tjTownMap, townCode);
|
|
|
//统计市
|
|
|
cityCount++;
|
|
|
}
|
|
@ -1552,75 +1403,50 @@ public class SignJob implements Job {
|
|
|
//保存全科医生的签约统计
|
|
|
for (Map.Entry<String, Doctor> entry : doctorsMap.entrySet()) {
|
|
|
Doctor doctor = doctorsMap.get(entry.getKey());//得到全科医生
|
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
wlyyQuotaResult.setOrgCode(doctor.getHospital());
|
|
|
wlyyQuotaResult.setOrgName(doctor.getHosptialName());
|
|
|
wlyyQuotaResult.setCity(doctor.getCity());
|
|
|
wlyyQuotaResult.setCityName(doctor.getCityName());
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
wlyyQuotaResult.setQkdoctorJobName(doctor.getJobName());
|
|
|
wlyyQuotaResult.setQkdoctorName(doctor.getName());
|
|
|
wlyyQuotaResult.setQkdoctorCode(doctor.getCode());
|
|
|
wlyyQuotaResult.setTown(doctor.getTown());
|
|
|
wlyyQuotaResult.setTownName(doctor.getTownName());
|
|
|
wlyyQuotaResult.setLevel1Type("1");
|
|
|
//判断全科医生是否有签约量
|
|
|
if (tjQkdoctorMap.containsKey(doctor.getCode())) {
|
|
|
wlyyQuotaResult.setResult(tjQkdoctorMap.get(doctor.getCode()) + "");
|
|
|
} else {
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
}
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
String city=Constant.city;
|
|
|
String cityName=Constant.cityName;
|
|
|
String town=doctor.getTown();
|
|
|
String townName=doctor.getTownName();
|
|
|
String org=doctor.getHospital();
|
|
|
String orgName=doctor.getHosptialName();
|
|
|
String doctorCode=doctor.getCode();
|
|
|
String doctorName=doctor.getName();
|
|
|
String doctorJob=doctor.getJob();
|
|
|
String level="1";
|
|
|
String key=doctor.getCode();
|
|
|
save_level1(tjQkdoctorMap, key, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level);
|
|
|
}
|
|
|
//保存机构的签约统计
|
|
|
for (Map.Entry<String, Hospital> entry : hospitalsMap.entrySet()) {
|
|
|
Hospital hospital = hospitalsMap.get(entry.getKey());//得到全科医生
|
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
wlyyQuotaResult.setOrgCode(hospital.getCode());
|
|
|
wlyyQuotaResult.setOrgName(hospital.getName());
|
|
|
wlyyQuotaResult.setCity(hospital.getCity());
|
|
|
wlyyQuotaResult.setCityName(hospital.getCityName());
|
|
|
wlyyQuotaResult.setTown(hospital.getTown());
|
|
|
wlyyQuotaResult.setTownName(hospital.getTownName());
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
wlyyQuotaResult.setLevel1Type("2");
|
|
|
//判断全科医生是否有签约量
|
|
|
if (tjOrgMap.containsKey(hospital.getCode())) {
|
|
|
wlyyQuotaResult.setResult(tjOrgMap.get(hospital.getCode()) + "");
|
|
|
} else {
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
}
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
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 doctorCode="";
|
|
|
String doctorName="";
|
|
|
String doctorJob="";
|
|
|
String level="2";
|
|
|
String key=hospital.getCode();
|
|
|
save_level1(tjOrgMap, key, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level);
|
|
|
}
|
|
|
//保存区级的签约统计
|
|
|
for (Map.Entry<String, Town> entry : townsMap.entrySet()) {
|
|
|
Town town = townsMap.get(entry.getKey());//得到全科医生
|
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
wlyyQuotaResult.setCity(town.getCity());
|
|
|
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");
|
|
|
//判断全科医生是否有签约量
|
|
|
if (tjTownMap.containsKey(town.getCode())) {
|
|
|
wlyyQuotaResult.setResult(tjTownMap.get(town.getCode()) + "");
|
|
|
} else {
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
}
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
Town townObj = townsMap.get(entry.getKey());//得到全科医生
|
|
|
String city=Constant.city;
|
|
|
String cityName=Constant.cityName;
|
|
|
String town=townObj.getCode();
|
|
|
String townName=townObj.getName();
|
|
|
String org="";
|
|
|
String orgName="";
|
|
|
String doctorCode="";
|
|
|
String doctorName="";
|
|
|
String doctorJob="";
|
|
|
String level="3";
|
|
|
String key=townObj.getCode();
|
|
|
save_level1(tjTownMap, key, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level);
|
|
|
}
|
|
|
//保存市级的统计
|
|
|
{
|
|
@ -1642,10 +1468,51 @@ public class SignJob implements Job {
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
}
|
|
|
|
|
|
quartzJobLog.setJobEndTime(new Date());
|
|
|
quartzJobLog.setJobContent("统计" + getYesterday() + " 的签约数据完成 ");
|
|
|
quartzJobLog.setJobType("1");
|
|
|
quartzJobLogDao.save(quartzJobLog);
|
|
|
QuartzJobLog.setJobEndTime(new Date());
|
|
|
QuartzJobLog.setJobContent("统计" + getYesterday() + " 的签约数据完成 ");
|
|
|
QuartzJobLog.setJobType("1");
|
|
|
quartzJobLogDao.save(QuartzJobLog);
|
|
|
}
|
|
|
/**
|
|
|
* 统计签约的公用保存方案
|
|
|
*
|
|
|
*/
|
|
|
private void save_level1(Map<String, Long> countMap, String key, String city, String cityName, String town, String townName, String org, String orgName, String doctorCode, String doctorName, String doctorJob, String level) {
|
|
|
WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
|
|
|
wlyyQuotaResult.setDel("1");
|
|
|
wlyyQuotaResult.setOrgCode(org);
|
|
|
wlyyQuotaResult.setOrgName(orgName);
|
|
|
wlyyQuotaResult.setCity(city);
|
|
|
wlyyQuotaResult.setCityName(cityName);
|
|
|
wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
|
|
|
wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
|
|
|
wlyyQuotaResult.setQuotaDate(getYesterday());
|
|
|
wlyyQuotaResult.setCreateTime(new Date());
|
|
|
wlyyQuotaResult.setQkdoctorJobName(doctorJob);
|
|
|
wlyyQuotaResult.setQkdoctorName(doctorName);
|
|
|
wlyyQuotaResult.setQkdoctorCode(doctorCode);
|
|
|
wlyyQuotaResult.setTown(town);
|
|
|
wlyyQuotaResult.setTownName(townName);
|
|
|
wlyyQuotaResult.setLevel1Type(level);
|
|
|
//判断全科医生是否有解约量
|
|
|
if (countMap.containsKey(key)) {
|
|
|
wlyyQuotaResult.setResult(countMap.get(key) + "");
|
|
|
} else {
|
|
|
wlyyQuotaResult.setResult("0");
|
|
|
}
|
|
|
wlyyQuotaResultDao.save(wlyyQuotaResult);
|
|
|
}
|
|
|
/**
|
|
|
* 统计签约的公用统计方案
|
|
|
* @param tjQkdoctorMap
|
|
|
* @param doctorCode
|
|
|
*/
|
|
|
private void compute_level1(Map<String, Long> tjQkdoctorMap, String doctorCode) {
|
|
|
if (tjQkdoctorMap.containsKey(doctorCode)) {
|
|
|
tjQkdoctorMap.put(doctorCode, tjQkdoctorMap.get(doctorCode) + 1);
|
|
|
} else {
|
|
|
tjQkdoctorMap.put(doctorCode, 1L);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*
|