|  | @ -6,8 +6,11 @@ import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.wx.WxPayLogDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.wx.WxWechatDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.order.BusinessOrderDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.order.BusinessOrderRefundDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.ykyy.service.YkyyService;
 | 
	
		
			
				|  |  | import com.yihu.jw.order.dao.BusinessOrderDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.order.dao.BusinessOrderRefundDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.order.pay.wx.WeChatConfig;
 | 
	
	
		
			
				|  | @ -54,14 +57,38 @@ public class BusinessOrderService {
 | 
	
		
			
				|  |  |     private BasePatientDao patientDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BusinessOrderRefundDao orderRefundDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private YkyyService ykyyService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private DoctorMappingDao doctorMappingDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * @param businessOrderDO
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public BusinessOrderDO saveOrder(BusinessOrderDO businessOrderDO) throws Exception {
 | 
	
		
			
				|  |  |         businessOrderDO.setStatus(0);
 | 
	
		
			
				|  |  |         businessOrderDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |         businessOrderDO.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |         businessOrderDO.setOrderNo(getGuid());
 | 
	
		
			
				|  |  |         businessOrderDO.setStatus(0);
 | 
	
		
			
				|  |  |         businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
 | 
	
		
			
				|  |  |         businessOrderDO = businessOrderDao.save(businessOrderDO);
 | 
	
		
			
				|  |  |         String patient = businessOrderDO.getPatient();
 | 
	
		
			
				|  |  |         BasePatientDO basePatientDO = patientDao.findById(patient);
 | 
	
		
			
				|  |  |         String orderNo = businessOrderDO.getOrderNo();
 | 
	
		
			
				|  |  |         String patientId = basePatientDO.getUserId();
 | 
	
		
			
				|  |  |         String orderAmout = businessOrderDO.getPayPrice().toString();
 | 
	
		
			
				|  |  |         String description = businessOrderDO.getDescription();
 | 
	
		
			
				|  |  |         String state = businessOrderDO.getStatus().toString();
 | 
	
		
			
				|  |  |         String orderType =businessOrderDO.getOrderType().toString();
 | 
	
		
			
				|  |  |         String payType="2";
 | 
	
		
			
				|  |  |         String patientTel = basePatientDO.getMobile();
 | 
	
		
			
				|  |  |         DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(businessOrderDO.getDoctor());
 | 
	
		
			
				|  |  |         String orderCatagrate = businessOrderDO.getOrderCategory();
 | 
	
		
			
				|  |  |         String pcCallBack=businessOrderDO.getPcCallbackUrl();
 | 
	
		
			
				|  |  |         String appCallBack = businessOrderDO.getAppCallbackUrl();
 | 
	
		
			
				|  |  |         ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,doctorMappingDO.getMappingCode(),payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
 | 
	
		
			
				|  |  |         return businessOrderDO;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -76,7 +103,7 @@ public class BusinessOrderService {
 | 
	
		
			
				|  |  |         businessOrderDO.setStatus(0);
 | 
	
		
			
				|  |  |         businessOrderDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |         businessOrderDO.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |         businessOrderDO.setOrderNo(getGuid());
 | 
	
		
			
				|  |  |         businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
 | 
	
		
			
				|  |  |         businessOrderDO = businessOrderDao.save(businessOrderDO);
 | 
	
		
			
				|  |  |         List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
 | 
	
		
			
				|  |  |         String openId = "";
 | 
	
	
		
			
				|  | @ -89,7 +116,23 @@ public class BusinessOrderService {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String url = wxWechatDO.getBaseUrl();
 | 
	
		
			
				|  |  |         String notifyUrl =url+"/ykyy"+BaseHospitalRequestMapping.WxPay.Notify;
 | 
	
		
			
				|  |  |         return unifiedorder(wechatId,businessOrderDO.getDescription(),businessOrderDO.getPayPrice().toString(),WeChatConfig.TRADE_TYPE_JSAPI,openId,businessOrderDO.getOrderNo(),notifyUrl);
 | 
	
		
			
				|  |  |         Map<String,Object> map = unifiedorder(wechatId,businessOrderDO.getDescription(),businessOrderDO.getPayPrice().toString(),WeChatConfig.TRADE_TYPE_JSAPI,openId,businessOrderDO.getOrderNo(),notifyUrl);
 | 
	
		
			
				|  |  |         String patient = businessOrderDO.getPatient();
 | 
	
		
			
				|  |  |         BasePatientDO basePatientDO = patientDao.findById(patient);
 | 
	
		
			
				|  |  |         String orderNo = businessOrderDO.getOrderNo();
 | 
	
		
			
				|  |  |         String patientId = basePatientDO.getUserId();
 | 
	
		
			
				|  |  |         String orderAmout = businessOrderDO.getPayPrice().toString();
 | 
	
		
			
				|  |  |         String description = businessOrderDO.getDescription();
 | 
	
		
			
				|  |  |         String state = businessOrderDO.getStatus().toString();
 | 
	
		
			
				|  |  |         String orderType =businessOrderDO.getOrderType().toString();
 | 
	
		
			
				|  |  |         String payType="2";
 | 
	
		
			
				|  |  |         String patientTel = basePatientDO.getMobile();
 | 
	
		
			
				|  |  |         DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(businessOrderDO.getDoctor());
 | 
	
		
			
				|  |  |         String orderCatagrate = businessOrderDO.getOrderCategory();
 | 
	
		
			
				|  |  |         String pcCallBack=businessOrderDO.getPcCallbackUrl();
 | 
	
		
			
				|  |  |         String appCallBack = businessOrderDO.getAppCallbackUrl();
 | 
	
		
			
				|  |  |         ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,doctorMappingDO.getMappingCode(),payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
 | 
	
		
			
				|  |  |         return map;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
	
		
			
				|  | @ -218,7 +261,7 @@ public class BusinessOrderService {
 | 
	
		
			
				|  |  |         orderRefundDO.setRefundPrice(refundPrice);
 | 
	
		
			
				|  |  |         orderRefundDO.setAppId(wxWechatDO.getAppId());
 | 
	
		
			
				|  |  |         orderRefundDO.setMchId(wxWechatDO.getMchId());
 | 
	
		
			
				|  |  |         orderRefundDO.setOutRefundNo(getGuid());
 | 
	
		
			
				|  |  |         orderRefundDO.setOutRefundNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
 | 
	
		
			
				|  |  |         orderRefundDO.setPatient(patient);
 | 
	
		
			
				|  |  |         orderRefundDO.setPatientName(patientDO.getName());
 | 
	
		
			
				|  |  |         orderRefundDO.setRefundDesc(description);
 | 
	
	
		
			
				|  | @ -339,6 +382,7 @@ public class BusinessOrderService {
 | 
	
		
			
				|  |  |             BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
 | 
	
		
			
				|  |  |             businessOrderDO.setPayTime(DateUtil.strToDate(timeEnd,DateUtil.YYYY_MM_DD_HH_MM_SS));
 | 
	
		
			
				|  |  |             businessOrderDO.setStatus(1);
 | 
	
		
			
				|  |  |             ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),businessOrderDO.getStatus().toString());
 | 
	
		
			
				|  |  |             //操作微信日志表记录
 | 
	
		
			
				|  |  |             List<WxPayLogDO> wxPayLogDOs = wxPayLogDao.findBySeqNo(seqNo);
 | 
	
		
			
				|  |  |             WxPayLogDO wxPayLogDO = wxPayLogDOs.get(0);
 | 
	
	
		
			
				|  | @ -356,4 +400,31 @@ public class BusinessOrderService {
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String sendDataToYkt(String orderNo){
 | 
	
		
			
				|  |  |         BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
 | 
	
		
			
				|  |  |         String patient = businessOrderDO.getPatient();
 | 
	
		
			
				|  |  |         BasePatientDO basePatientDO = patientDao.findById(patient);
 | 
	
		
			
				|  |  |         String patientId = basePatientDO.getUserId();
 | 
	
		
			
				|  |  |         String orderAmout = businessOrderDO.getPayPrice().toString();
 | 
	
		
			
				|  |  |         String description = businessOrderDO.getDescription();
 | 
	
		
			
				|  |  |         String state = businessOrderDO.getStatus().toString();
 | 
	
		
			
				|  |  |         String orderType =businessOrderDO.getOrderType().toString();
 | 
	
		
			
				|  |  |         String payType="2";
 | 
	
		
			
				|  |  |         String patientTel = basePatientDO.getMobile();
 | 
	
		
			
				|  |  |         DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(businessOrderDO.getDoctor());
 | 
	
		
			
				|  |  |         String orderCatagrate = businessOrderDO.getOrderCategory();
 | 
	
		
			
				|  |  |         String pcCallBack=businessOrderDO.getPcCallbackUrl();
 | 
	
		
			
				|  |  |         String appCallBack = businessOrderDO.getAppCallbackUrl();
 | 
	
		
			
				|  |  |         String response = ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,doctorMappingDO.getMappingCode(),payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
 | 
	
		
			
				|  |  |         return response;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String updateStatusToYk(String orderNo){
 | 
	
		
			
				|  |  |         BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
 | 
	
		
			
				|  |  |         String response = ykyyService.updateYktOrderStatus(orderNo,businessOrderDO.getStatus().toString());
 | 
	
		
			
				|  |  |         return response;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |