|
@ -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;
|
|
@ -7,6 +8,7 @@ import com.yihu.wlyy.entity.job.QuartzJobLog;
|
|
import com.yihu.wlyy.entity.patient.PatientHealthGuidance;
|
|
import com.yihu.wlyy.entity.patient.PatientHealthGuidance;
|
|
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.job.QuartzJobLogDao;
|
|
import com.yihu.wlyy.repository.job.QuartzJobLogDao;
|
|
import com.yihu.wlyy.repository.organization.HospitalDao;
|
|
import com.yihu.wlyy.repository.organization.HospitalDao;
|
|
@ -49,6 +51,8 @@ public class FollowUpJob implements Job {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private JdbcTemplate jdbcTemplate_wlyy;
|
|
private JdbcTemplate jdbcTemplate_wlyy;
|
|
|
|
@Autowired
|
|
|
|
private DoctorAdminTeamDao doctorAdminTeamDao;
|
|
|
|
|
|
private org.apache.tomcat.jdbc.pool.DataSource fvdataSource=new org.apache.tomcat.jdbc.pool.DataSource();//随访数据源
|
|
private org.apache.tomcat.jdbc.pool.DataSource fvdataSource=new org.apache.tomcat.jdbc.pool.DataSource();//随访数据源
|
|
|
|
|
|
@ -91,10 +95,10 @@ public class FollowUpJob implements Job {
|
|
quartzJobLog.setJobName(wlyyJobConfig.getJobName());
|
|
quartzJobLog.setJobName(wlyyJobConfig.getJobName());
|
|
|
|
|
|
//查找出系统全部的医生
|
|
//查找出系统全部的医生
|
|
List<Doctor> doctors = doctorDao.findAllCertifiedDoctors();
|
|
|
|
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.findHospital2();
|
|
List<Hospital> hospitals = hospitalDao.findHospital2();
|
|
@ -113,7 +117,7 @@ public class FollowUpJob 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
|
|
|
|
|
|
Map<String, Long> tjAdminTeamMap = new HashMap<String, Long>();//团队级的统计map 目前没有团队 先用全科医生统一 key doctorCode
|
|
Long cityCount = 0L; //统计到市的数目
|
|
Long cityCount = 0L; //统计到市的数目
|
|
Long townCount = 0L; //统计到所有区的数目
|
|
Long townCount = 0L; //统计到所有区的数目
|
|
Long orgCount = 0L;//统计到所有机构的数目
|
|
Long orgCount = 0L;//统计到所有机构的数目
|
|
@ -127,17 +131,30 @@ public class FollowUpJob implements Job {
|
|
cityCount++;
|
|
cityCount++;
|
|
//统计团队------------------start ------------------
|
|
//统计团队------------------start ------------------
|
|
String doctorCode = (String) plan.get("doctor_uid");//得到随访中的全部医生的code
|
|
String doctorCode = (String) plan.get("doctor_uid");//得到随访中的全部医生的code
|
|
compute(tjQkdoctorMap, doctorCode);
|
|
|
|
|
|
|
|
|
|
String teamId= doctorAdminTeamDao.findIdByLeaderCode(doctorCode)+"";
|
|
|
|
if(teamId==null){
|
|
|
|
errorContent.append("随访id:"+plan.get("id")+",随访的医生所属的团队不存在");
|
|
|
|
isAll=false;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
AdminTeam adminTeam=adminTeamMap.get(teamId);
|
|
|
|
if(adminTeam==null){
|
|
|
|
errorContent.append("随访id:"+plan.get("id")+",随访的医生所属的团队不存在");
|
|
|
|
isAll=false;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
compute(tjAdminTeamMap, teamId);
|
|
qkCount++;
|
|
qkCount++;
|
|
//统计机构------------------start ------------------
|
|
//统计机构------------------start ------------------
|
|
//判断医生属于哪个机构
|
|
//判断医生属于哪个机构
|
|
Doctor doctor = doctorsMap.get(doctorCode);
|
|
|
|
if(doctor==null){
|
|
|
|
errorContent.append("随访id:"+plan.get("id")+",随访的医生为空或者不存在");
|
|
|
|
|
|
String orgCode = adminTeam.getOrgCode();
|
|
|
|
Hospital hospital=hospitalsMap.get(orgCode);
|
|
|
|
if(hospital==null){
|
|
|
|
errorContent.append("随访id:"+plan.get("id")+",随访的医生所属的团队的机构不存在");
|
|
isAll=false;
|
|
isAll=false;
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
String orgCode = doctor.getHospital();
|
|
|
|
//统计机构
|
|
//统计机构
|
|
if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
|
|
if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
|
|
//统计站
|
|
//统计站
|
|
@ -150,7 +167,6 @@ public class FollowUpJob implements Job {
|
|
}
|
|
}
|
|
orgCount++;
|
|
orgCount++;
|
|
//统计区------------------start ------------------
|
|
//统计区------------------start ------------------
|
|
Hospital hospital=hospitalsMap.get(orgCodeTemp);
|
|
|
|
if(hospital == null) {
|
|
if(hospital == null) {
|
|
errorContent.append("随访id:"+plan.get("id")+",随访的医生所属的机构为空或者不存在");
|
|
errorContent.append("随访id:"+plan.get("id")+",随访的医生所属的机构为空或者不存在");
|
|
isAll=false;
|
|
isAll=false;
|
|
@ -163,9 +179,9 @@ public class FollowUpJob implements Job {
|
|
}
|
|
}
|
|
//保存统计的结果
|
|
//保存统计的结果
|
|
//保存全科医生的随访统计
|
|
//保存全科医生的随访统计
|
|
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());//得到健康管理师
|
|
|
|
orgCodeTemp=getOrg(adminTeam.getOrgCode());
|
|
Hospital hospital = hospitalsMap.get(orgCodeTemp);//得到全科医生的机构
|
|
Hospital hospital = hospitalsMap.get(orgCodeTemp);//得到全科医生的机构
|
|
if(hospital == null) continue;
|
|
if(hospital == null) continue;
|
|
String city=Constant.city;
|
|
String city=Constant.city;
|
|
@ -178,12 +194,12 @@ public class FollowUpJob 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(tjQkdoctorMap, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level, key);
|
|
|
|
|
|
String key=adminTeam.getId()+"";
|
|
|
|
save(tjAdminTeamMap, city, cityName, town, townName, org, orgName, doctorCode, doctorName, doctorJob, level, key);
|
|
}
|
|
}
|
|
//保存机构的随访统计
|
|
//保存机构的随访统计
|
|
for (Map.Entry<String, Hospital> entry : hospitalsMap.entrySet()) {
|
|
for (Map.Entry<String, Hospital> entry : hospitalsMap.entrySet()) {
|