|
@ -0,0 +1,97 @@
|
|
|
|
package com.yihu.wlyy.job;
|
|
|
|
|
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
|
import com.yihu.wlyy.entity.patient.SignFamilyMapping;
|
|
|
|
import com.yihu.wlyy.entity.patient.SignFamilyRenewLog;
|
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyMappingDao;
|
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyRenewLogDao;
|
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.quartz.Job;
|
|
|
|
import org.quartz.JobExecutionContext;
|
|
|
|
import org.quartz.JobExecutionException;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 处理家庭签约到期数据未迁移到续签表数据
|
|
|
|
* Created by Reece on 2018/1/9/029.
|
|
|
|
*/
|
|
|
|
@Component
|
|
|
|
public class SignToRenewJob implements Job {
|
|
|
|
@Autowired
|
|
|
|
private SignFamilyRenewLogDao RenewLogDao;
|
|
|
|
@Autowired
|
|
|
|
private SignFamilyDao signFamilyDao;
|
|
|
|
@Autowired
|
|
|
|
private SignFamilyMappingDao mappingDao;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
|
|
|
System.out.println("SignToRenewJob start");
|
|
|
|
try {
|
|
|
|
//1.查询wlyy_sign_family有续签却未同步到wlyy_sign_family_renew_log数据(过滤掉已到期)
|
|
|
|
List<SignFamily> totalSign = signFamilyDao.findRenew();
|
|
|
|
for (SignFamily sign:totalSign) {
|
|
|
|
String idcard = sign.getIdcard();
|
|
|
|
if (idcard == null){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
//2.根据身份证号查询最近的已到期签约数据
|
|
|
|
SignFamily latelySign = signFamilyDao.findLatelyRenew(idcard);
|
|
|
|
if (latelySign != null){
|
|
|
|
SignFamilyRenewLog renewLog = new SignFamilyRenewLog();
|
|
|
|
renewLog.setSignCode(sign.getCode());
|
|
|
|
// renewLog.setRenewSignCode();
|
|
|
|
renewLog.setIdcard(sign.getIdcard()) ;
|
|
|
|
renewLog.setHospital(sign.getHospital());
|
|
|
|
renewLog.setAdminTeamId(sign.getAdminTeamId());
|
|
|
|
renewLog.setDoctor(sign.getDoctor());
|
|
|
|
renewLog.setOldSignCode(latelySign.getSignDoctorCode());
|
|
|
|
renewLog.setOldHospital(latelySign.getHospital());
|
|
|
|
renewLog.setOldAdminTeamId(latelySign.getAdminTeamId());
|
|
|
|
renewLog.setOldDoctor(latelySign.getDoctor());
|
|
|
|
SignFamilyMapping signMapping = mappingDao.findByCode(sign.getCode());
|
|
|
|
if (signMapping != null){
|
|
|
|
String proId = signMapping.getProId();
|
|
|
|
if (StringUtils.isNotEmpty(proId)){
|
|
|
|
renewLog.setNeedUpload("0");
|
|
|
|
}else {
|
|
|
|
renewLog.setNeedUpload("1");
|
|
|
|
}
|
|
|
|
renewLog.setSignYear(signMapping.getSignYear());
|
|
|
|
renewLog.setRenewProId(signMapping.getRenewProId());
|
|
|
|
renewLog.setProId(signMapping.getProId());
|
|
|
|
}
|
|
|
|
SignFamilyMapping renewMapping = mappingDao.findByCode(latelySign.getCode());
|
|
|
|
if (renewMapping != null){
|
|
|
|
renewLog.setOldProId(renewMapping.getProId());
|
|
|
|
}
|
|
|
|
// renewLog.setUploadLog() ;
|
|
|
|
renewLog.setCreateTime(new Date());
|
|
|
|
renewLog.setUpdateTime(new Date());
|
|
|
|
renewLog.setStatus(sign.getStatus());
|
|
|
|
renewLog.setApplyDate(sign.getApplyDate());
|
|
|
|
renewLog.setRenewChangeReason(sign.getRenewChangeReason());
|
|
|
|
renewLog.setExpensesStatus(sign.getExpensesStatus());
|
|
|
|
renewLog.setPatient(sign.getPatient());
|
|
|
|
|
|
|
|
RenewLogDao.save(renewLog);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
System.out.println("SignToRenewJob end");
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
System.out.println("SignToRenewJob failed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|