| 
					
				 | 
			
			
				@ -3,6 +3,7 @@ package com.yihu.wlyy.job; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				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 +29,8 @@ public class PatientConfirmReceiptJob implements Job { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PrescriptionDao prescriptionDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientDao patientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private SystemDictDao systemDictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Override 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -41,6 +44,8 @@ public class PatientConfirmReceiptJob implements Job { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //1.找出状态是已支付未完成且取药方式不是健管师配送的续方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<Prescription> PrescriptionList = prescriptionDao.findUndelivered(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (Prescription prescription : PrescriptionList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String patient = prescription.getPatient(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String patietnName = prescription.getPatientName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //2.取出延长收货的次数及支付时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    int extendCount = prescription.getExtendCount(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Date payTime = prescription.getPayTime(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -48,10 +53,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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            //发送自动确认提醒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 |