Explorar el Código

Merge branch 'dev' of wujunjie/patient-co-management into dev

huangwenjie hace 7 años
padre
commit
6a0677528b

+ 12 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PatientConfirmReceiptJob.java

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