|  | @ -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;
 | 
	
	
		
			
				|  | @ -34,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | import org.springframework.util.StringUtils;
 | 
	
		
			
				|  |  | import org.springframework.web.context.support.SpringBeanAutowiringSupport;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import javax.annotation.Resource;
 | 
	
		
			
				|  |  | import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -121,10 +126,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>();
 | 
	
	
		
			
				|  | @ -396,10 +401,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();
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -419,10 +424,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 +442,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 +456,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;
 | 
	
	
		
			
				|  | @ -984,10 +986,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 +1003,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 +1459,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 +1476,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();
 | 
	
	
		
			
				|  | @ -1642,10 +1644,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);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /*
 |