| 
					
				 | 
			
			
				@ -27,6 +27,7 @@ import com.yihu.jw.hospital.prescription.dao.PrescriptionDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.PrescriptionLogService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.entrance.EntranceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.ykyy.service.YkyyService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.order.dao.BusinessOrderDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -108,6 +109,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseDoctorDao doctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private EntranceService entranceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private XzzxEntranceService xzzxEntranceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1073,21 +1076,45 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (businessOrderDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String idcard = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String ssc = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (patientDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                idcard = patientDO.getIdcard(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("开始1"+idcard); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String openId = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BaseDoctorDO doctorDO = doctorDao.findById(businessOrderDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String fee = doctorDO.getFee(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!StringUtils.isNoneBlank(fee)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                throw new Exception("医生费用为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Double doctorFee = 0.0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNoneBlank(businessOrderDO.getDoctor())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseDoctorDO doctorDO = doctorDao.findById(businessOrderDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String fee = doctorDO.getFee(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (!StringUtils.isNoneBlank(fee)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    throw new Exception("医生费用为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctorFee= Double.parseDouble(fee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                WlyyHospitalSysDictDO wlyyHospitalSysDictDO =hospitalSysDictDao.findById("WX_MONEY"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctorFee = Double.parseDouble(wlyyHospitalSysDictDO.getDictValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyHospitalSysDictDO wlyyHospitalSysDictDO =hospitalSysDictDao.findById("YLZ_YE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (wlyyHospitalSysDictDO!=null&&wlyyHospitalSysDictDO.getDictValue().equalsIgnoreCase("0")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                businessOrderDO.setPayPrice(doctorFee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(cardNo, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Double cardFee = object1.getDouble("ZHYE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BigDecimal b = new BigDecimal(String.valueOf(cardFee)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BigDecimal c = new BigDecimal(String.valueOf(doctorFee)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BigDecimal balance = c.subtract(b); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    businessOrderDO.setPayPrice(balance.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else if(wechatId.equalsIgnoreCase("xm_xzzx_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    JSONObject object = xzzxEntranceService.selectCardInfo(cardNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Double cardFee = object.getDouble("ZHYE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BigDecimal b = new BigDecimal(String.valueOf(cardFee)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BigDecimal c = new BigDecimal(String.valueOf(doctorFee)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BigDecimal balance = c.subtract(b); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    businessOrderDO.setPayPrice(balance.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(cardNo, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Double cardFee = object1.getDouble("ZHYE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Double doctorFee = Double.parseDouble(fee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Double balance = doctorFee-cardFee; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            businessOrderDO.setPayPrice(balance); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            businessOrderDO.setPayType(4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            businessOrderDao.save(businessOrderDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1097,7 +1124,16 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String price = businessOrderDO.getPayPrice().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String notifyUrl = hospitalSysDictDO.getDictCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            response = ylzPayService.recharge("123456",businessOrderDO.getPatientName(),cardType,"01",cardNo,idcard,depositType,price,businessOrderDO.getOrderNo(),openId,patientDO.getName(),notifyUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String operatorId =null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String operatorName = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                operatorId = "123456"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                operatorName =businessOrderDO.getPatientName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(wechatId.equalsIgnoreCase("xm_xzzx_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                operatorId = "hlwyy"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                operatorName = "互联网医院"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            response = ylzPayService.recharge(operatorId,operatorName,cardType,"01",cardNo,idcard,depositType,price,businessOrderDO.getOrderNo(),openId,patientDO.getName(),notifyUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (depositType.equalsIgnoreCase("WX_QR")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject object = JSONObject.parseObject(response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (object!=null){ 
			 |