|  | @ -3,12 +3,14 @@ package com.yihu.jw.service.channel;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.prescription.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.job.QuartzJobLog;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.order.BusinessOrderDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.dao.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.service.ImService;
 | 
	
		
			
				|  |  | import com.yihu.jw.order.BusinessOrderService;
 | 
	
		
			
				|  |  | import com.yihu.jw.order.dao.BusinessOrderDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.repository.job.QuartzJobLogDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
 | 
	
	
		
			
				|  | @ -61,6 +63,8 @@ public class PrescriptionStatusUpdateService {
 | 
	
		
			
				|  |  |     private BusinessOrderService businessOrderService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PrescriptionLogService prescriptionLogService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private QuartzJobLogDao quartzJobLogDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void autoPush() throws Exception {
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -279,6 +283,7 @@ public class PrescriptionStatusUpdateService {
 | 
	
		
			
				|  |  |         Calendar calendar = Calendar.getInstance();
 | 
	
		
			
				|  |  |         calendar.setTime(new Date());
 | 
	
		
			
				|  |  |         int i = calendar.get(Calendar.HOUR_OF_DAY);
 | 
	
		
			
				|  |  |         QuartzJobLog quartzJobLog = new QuartzJobLog();
 | 
	
		
			
				|  |  |         //复诊记录状态状态安全锁,每天0~2点才允许触发,避免误调用
 | 
	
		
			
				|  |  |         //将所有的已接诊的处方记录
 | 
	
		
			
				|  |  |         if(i==0||i==1){
 | 
	
	
		
			
				|  | @ -288,7 +293,7 @@ public class PrescriptionStatusUpdateService {
 | 
	
		
			
				|  |  |                 for(WlyyOutpatientDO outpatientDO:outpatientDOs){
 | 
	
		
			
				|  |  |                     //结束门诊
 | 
	
		
			
				|  |  |                     outpatientDO.setStatus("3");
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                     logger.info(outpatientDO.getId()+"的处方记录设置为结束");
 | 
	
		
			
				|  |  |                     String consultCode = imService.getConsultCodeByOutpatientId(outpatientDO.getId());
 | 
	
		
			
				|  |  |                     if(StringUtils.isNoneBlank(consultCode)){
 | 
	
		
			
				|  |  |                         try {
 | 
	
	
		
			
				|  | @ -299,27 +304,32 @@ public class PrescriptionStatusUpdateService {
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                        
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     //保存操作日志
 | 
	
		
			
				|  |  |                     quartzJobLog.setId(UUID.randomUUID().toString());
 | 
	
		
			
				|  |  |                     quartzJobLog.setJobName("setOutPatientOver");
 | 
	
		
			
				|  |  |                     quartzJobLog.setJobId("setOutPatientOver");
 | 
	
		
			
				|  |  |                     quartzJobLog.setJobContent(outpatientDO.getId()+"问诊执行自动结束"+outpatientDO.getStatus());
 | 
	
		
			
				|  |  |                     quartzJobLog.setJobStartTime(new Date());
 | 
	
		
			
				|  |  |                     quartzJobLogDao.save(quartzJobLog);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 outpatientDao.save(outpatientDOs);
 | 
	
		
			
				|  |  |                 //退费
 | 
	
		
			
				|  |  |                 for (WlyyOutpatientDO outpatientDO:outpatientDOs){
 | 
	
		
			
				|  |  |                     try {
 | 
	
		
			
				|  |  |                     BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
 | 
	
		
			
				|  |  |                     if (businessOrderDO!=null){
 | 
	
		
			
				|  |  |                         try {
 | 
	
		
			
				|  |  |                             if (businessOrderDO.getPayType()==1){
 | 
	
		
			
				|  |  |                                 businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
 | 
	
		
			
				|  |  |                             }else if (businessOrderDO.getPayType()==3){
 | 
	
		
			
				|  |  | /*
 | 
	
		
			
				|  |  |                                 businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
 | 
	
		
			
				|  |  | */
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                         } catch (Exception e) {
 | 
	
		
			
				|  |  |                             e.printStackTrace();
 | 
	
		
			
				|  |  |                         if (businessOrderDO.getPayType()==1){
 | 
	
		
			
				|  |  |                             businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
 | 
	
		
			
				|  |  |                         }else if (businessOrderDO.getPayType()==3){
 | 
	
		
			
				|  |  |     /*
 | 
	
		
			
				|  |  |                             businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
 | 
	
		
			
				|  |  |     */
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     } } catch (Exception e) {
 | 
	
		
			
				|  |  |                         e.printStackTrace();
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 logger.info("setOutPatientOver count :"+outpatientDOs.size());
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 logger.info("setOutPatientOver count :"+0);
 |