|
@ -1,8 +1,10 @@
|
|
package com.yihu.wlyy.job;
|
|
package com.yihu.wlyy.job;
|
|
|
|
|
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.prescription.Prescription;
|
|
import com.yihu.wlyy.entity.patient.prescription.Prescription;
|
|
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
|
|
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
|
|
import com.yihu.wlyy.repository.dict.SystemDictDao;
|
|
import com.yihu.wlyy.repository.dict.SystemDictDao;
|
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import org.quartz.Job;
|
|
import org.quartz.Job;
|
|
@ -28,6 +30,8 @@ public class PatientConfirmReceiptJob implements Job {
|
|
@Autowired
|
|
@Autowired
|
|
private PrescriptionDao prescriptionDao;
|
|
private PrescriptionDao prescriptionDao;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
private PatientDao patientDao;
|
|
|
|
@Autowired
|
|
private SystemDictDao systemDictDao;
|
|
private SystemDictDao systemDictDao;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@ -41,6 +45,8 @@ public class PatientConfirmReceiptJob implements Job {
|
|
//1.找出状态是已支付未完成且取药方式不是健管师配送的续方
|
|
//1.找出状态是已支付未完成且取药方式不是健管师配送的续方
|
|
List<Prescription> PrescriptionList = prescriptionDao.findUndelivered();
|
|
List<Prescription> PrescriptionList = prescriptionDao.findUndelivered();
|
|
for (Prescription prescription : PrescriptionList) {
|
|
for (Prescription prescription : PrescriptionList) {
|
|
|
|
String patient = prescription.getPatient();
|
|
|
|
Patient user = patientDao.findByCode(patient);
|
|
//2.取出延长收货的次数及支付时间
|
|
//2.取出延长收货的次数及支付时间
|
|
int extendCount = prescription.getExtendCount();
|
|
int extendCount = prescription.getExtendCount();
|
|
Date payTime = prescription.getPayTime();
|
|
Date payTime = prescription.getPayTime();
|
|
@ -48,10 +54,16 @@ public class PatientConfirmReceiptJob implements Job {
|
|
//3.根据延长收货次数确定确认收货时间
|
|
//3.根据延长收货次数确定确认收货时间
|
|
Date today = new Date();
|
|
Date today = new Date();
|
|
Date confirm = DateUtil.getPreDays(payTime, ((extendCount + 1) * 7));
|
|
Date confirm = DateUtil.getPreDays(payTime, ((extendCount + 1) * 7));
|
|
|
|
//4.计算现在到预计自动确认收货时间差值
|
|
|
|
long days = DateUtil.getDays(today,payTime);
|
|
|
|
if(days == 3){
|
|
|
|
//支付后第三天发送自动确认预提醒
|
|
|
|
}
|
|
int result = today.compareTo(confirm);
|
|
int result = today.compareTo(confirm);
|
|
if (result >= 0) {
|
|
if (result >= 0) {
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
|
|
list.add(prescription);
|
|
list.add(prescription);
|
|
|
|
//发送自动确认提醒
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|