|  | @ -149,12 +149,12 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |             WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
 | 
	
		
			
				|  |  |             BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(wlyyPrescriptionDO.getId());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if (businessOrderDO==null){
 | 
	
		
			
				|  |  |             if (businessOrderDO==null) {
 | 
	
		
			
				|  |  |                 businessOrderDO = new BusinessOrderDO();
 | 
	
		
			
				|  |  |                 businessOrderDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                 businessOrderDO.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |                 businessOrderDO.setStatus(0);
 | 
	
		
			
				|  |  |                 businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
 | 
	
		
			
				|  |  |                 businessOrderDO.setOrderNo("HLWYY" + System.currentTimeMillis() + (int) (Math.random() * 900) + 100);
 | 
	
		
			
				|  |  |                 businessOrderDO.setUploadStatus(0);
 | 
	
		
			
				|  |  |                 businessOrderDO.setPayType(1);
 | 
	
		
			
				|  |  |                 businessOrderDO.setRelationCode(code);
 | 
	
	
		
			
				|  | @ -175,49 +175,58 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |                 wlyyPrescriptionDO.setOrderId(getCode());
 | 
	
		
			
				|  |  |                 wlyyPrescriptionDO = prescriptionDao.save(wlyyPrescriptionDO);
 | 
	
		
			
				|  |  |                 JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |                 List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(code,1);
 | 
	
		
			
				|  |  |                 for (WlyyPrescriptionInfoDO prescriptionInfoDO:wlyyPrescriptionInfoDOS){
 | 
	
		
			
				|  |  |                 List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(code, 1);
 | 
	
		
			
				|  |  |                 WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("YKTCONTROL");
 | 
	
		
			
				|  |  |                 for (WlyyPrescriptionInfoDO prescriptionInfoDO : wlyyPrescriptionInfoDOS) {
 | 
	
		
			
				|  |  |                     JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |                     //{"commodityName":"","commodityPrice":"","DrugUnit":"","MedicineDoctor":""}
 | 
	
		
			
				|  |  |                     object.put("commodityName",prescriptionInfoDO.getDrugName());
 | 
	
		
			
				|  |  |                     object.put("commodityPrice",prescriptionInfoDO.getPackRetprice());
 | 
	
		
			
				|  |  |                     object.put("DrugUnit",prescriptionInfoDO.getPackUnitName());
 | 
	
		
			
				|  |  |                     object.put("commodityName", prescriptionInfoDO.getDrugName());
 | 
	
		
			
				|  |  |                     object.put("commodityPrice", prescriptionInfoDO.getPackRetprice());
 | 
	
		
			
				|  |  |                     object.put("DrugUnit", prescriptionInfoDO.getPackUnitName());
 | 
	
		
			
				|  |  |                     DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(businessOrderDO.getDoctor());
 | 
	
		
			
				|  |  |                     String yktDoctor ="";
 | 
	
		
			
				|  |  |                     if (doctorMappingDO!=null&&StringUtils.isNoneBlank(doctorMappingDO.getMappingCode())){
 | 
	
		
			
				|  |  |                         String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
 | 
	
		
			
				|  |  |                         JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
 | 
	
		
			
				|  |  |                         if (jsonObject.getInteger("code")==200){
 | 
	
		
			
				|  |  |                             JSONArray array1 = jsonObject.getJSONArray("data");
 | 
	
		
			
				|  |  |                             if (array1!=null&&array1.size()!=0){
 | 
	
		
			
				|  |  |                                 yktDoctor=array1.getJSONObject(0).getString("DOCTORUSERID");
 | 
	
		
			
				|  |  |                     String yktDoctor = "";
 | 
	
		
			
				|  |  |                     if (doctorMappingDO != null && StringUtils.isNoneBlank(doctorMappingDO.getMappingCode())) {
 | 
	
		
			
				|  |  |                         System.out.println("----------------"+hospitalSysDictDO.getDictValue());
 | 
	
		
			
				|  |  |                         if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         } else {
 | 
	
		
			
				|  |  |                             String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
 | 
	
		
			
				|  |  |                             JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
 | 
	
		
			
				|  |  |                             if (jsonObject.getInteger("code") == 200) {
 | 
	
		
			
				|  |  |                                 JSONArray array1 = jsonObject.getJSONArray("data");
 | 
	
		
			
				|  |  |                                 if (array1 != null && array1.size() != 0) {
 | 
	
		
			
				|  |  |                                     yktDoctor = array1.getJSONObject(0).getString("DOCTORUSERID");
 | 
	
		
			
				|  |  |                                 }
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                     } else {
 | 
	
		
			
				|  |  |                         throw new Exception("医生映射表不存在!");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     object.put("MedicineDoctor",yktDoctor);
 | 
	
		
			
				|  |  |                     object.put("MedicineDoctor", yktDoctor);
 | 
	
		
			
				|  |  |                     array.add(object);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
 | 
	
		
			
				|  |  |                 String userId =null;
 | 
	
		
			
				|  |  |                 if (patientDO!=null){
 | 
	
		
			
				|  |  |                 String userId = null;
 | 
	
		
			
				|  |  |                 if (patientDO != null) {
 | 
	
		
			
				|  |  |                     userId = patientDO.getUserId();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 String response = ykyyService.addOrder4Jkzl("1",wlyyPrescriptionDO.getOrderId(),businessOrderDO.getOrderNo(),userId,array);
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(response)){
 | 
	
		
			
				|  |  |                     JSONObject jsonObject = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |                     if (jsonObject.getString("code").equalsIgnoreCase("10000")){
 | 
	
		
			
				|  |  |                         String orderId = jsonObject.getString("orderId");
 | 
	
		
			
				|  |  |                         String orderNo = jsonObject.getString("orderNo");
 | 
	
		
			
				|  |  |                         businessOrderDO.setYkOrderId(orderId);
 | 
	
		
			
				|  |  |                         businessOrderDO.setYkOrderNo(orderNo);
 | 
	
		
			
				|  |  |                         businessOrderDO.setUploadStatus(1);
 | 
	
		
			
				|  |  |                         businessOrderDao.save(businessOrderDO);
 | 
	
		
			
				|  |  |                 if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     String response = ykyyService.addOrder4Jkzl("1", wlyyPrescriptionDO.getOrderId(), businessOrderDO.getOrderNo(), userId, array);
 | 
	
		
			
				|  |  |                     if (StringUtils.isNoneBlank(response)) {
 | 
	
		
			
				|  |  |                         JSONObject jsonObject = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |                         if (jsonObject.getString("code").equalsIgnoreCase("10000")) {
 | 
	
		
			
				|  |  |                             String orderId = jsonObject.getString("orderId");
 | 
	
		
			
				|  |  |                             String orderNo = jsonObject.getString("orderNo");
 | 
	
		
			
				|  |  |                             businessOrderDO.setYkOrderId(orderId);
 | 
	
		
			
				|  |  |                             businessOrderDO.setYkOrderNo(orderNo);
 | 
	
		
			
				|  |  |                             businessOrderDO.setUploadStatus(1);
 | 
	
		
			
				|  |  |                             businessOrderDao.save(businessOrderDO);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return businessOrderDOS;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -242,6 +251,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |             businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/yk/consult/record?outpatientId="+businessOrderDO.getRelationCode()+"&verifyCode=");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<WlyyHospitalSysDictDO> hospitalSysDictDOS = hospitalSysDictDao.findByDictName("WX_MONEY");
 | 
	
		
			
				|  |  |         WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("YKTCONTROL");
 | 
	
		
			
				|  |  |         String totalFee = null;
 | 
	
		
			
				|  |  |         if (hospitalSysDictDOS!=null&&hospitalSysDictDOS.size()!=0){
 | 
	
		
			
				|  |  |             totalFee= hospitalSysDictDOS.get(0).getDictValue();
 | 
	
	
		
			
				|  | @ -255,7 +265,11 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(basePatientDO.getYktId())){
 | 
	
		
			
				|  |  |             patientId = basePatientDO.getYktId();
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             patientId = ykyyService.registerYkt(basePatientDO.getId());
 | 
	
		
			
				|  |  |             if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 patientId = ykyyService.registerYkt(basePatientDO.getId());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String orderAmout = businessOrderDO.getPayPrice()/100+"";
 | 
	
		
			
				|  |  |         String description = businessOrderDO.getDescription();
 | 
	
	
		
			
				|  | @ -268,25 +282,36 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |         String pcCallBack=businessOrderDO.getPcCallbackUrl();
 | 
	
		
			
				|  |  |         String appCallBack = businessOrderDO.getAppCallbackUrl();
 | 
	
		
			
				|  |  |         String yktDoctor ="";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (doctorMappingDO!=null&&StringUtils.isNoneBlank(doctorMappingDO.getMappingCode())){
 | 
	
		
			
				|  |  |             String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
 | 
	
		
			
				|  |  |             JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
 | 
	
		
			
				|  |  |             if (jsonObject.getInteger("code")==200){
 | 
	
		
			
				|  |  |                 JSONArray array = jsonObject.getJSONArray("data");
 | 
	
		
			
				|  |  |                 if (array!=null&&array.size()!=0){
 | 
	
		
			
				|  |  |                     yktDoctor=array.getJSONObject(0).getString("DOCTORUSERID");
 | 
	
		
			
				|  |  |             if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
 | 
	
		
			
				|  |  |                 System.out.println("Continue");
 | 
	
		
			
				|  |  |                 JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
 | 
	
		
			
				|  |  |                 if (jsonObject.getInteger("code")==200){
 | 
	
		
			
				|  |  |                     JSONArray array = jsonObject.getJSONArray("data");
 | 
	
		
			
				|  |  |                     if (array!=null&&array.size()!=0){
 | 
	
		
			
				|  |  |                         yktDoctor=array.getJSONObject(0).getString("DOCTORUSERID");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             /*throw new Exception("医生映射表不存在!");*/
 | 
	
		
			
				|  |  |             yktDoctor="hlwyymrys001";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String remark = businessOrderDO.getRematk();
 | 
	
		
			
				|  |  |         String response=ykyyService.addYktOrder(orderNo,patientId,orderAmout,remark,state,orderType,yktDoctor,payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         if (object.getInteger("code")==200){
 | 
	
		
			
				|  |  |             businessOrderDO.setUploadStatus(1);
 | 
	
		
			
				|  |  |             businessOrderDao.save(businessOrderDO);
 | 
	
		
			
				|  |  |         if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             String response=ykyyService.addYktOrder(orderNo,patientId,orderAmout,remark,state,orderType,yktDoctor,payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
 | 
	
		
			
				|  |  |             JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |             if (object.getInteger("code")==200){
 | 
	
		
			
				|  |  |                 businessOrderDO.setUploadStatus(1);
 | 
	
		
			
				|  |  |                 businessOrderDao.save(businessOrderDO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return businessOrderDO;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -335,7 +360,13 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |         if (doctorMappingDO!=null){
 | 
	
		
			
				|  |  |             doctorId = doctorMappingDO.getMappingCode();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,doctorId,payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
 | 
	
		
			
				|  |  |         WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("YKTCONTROL");
 | 
	
		
			
				|  |  |         if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,doctorId,payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return map;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -708,6 +739,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |             //更改业务状态,做日志保存等操作
 | 
	
		
			
				|  |  |             BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
 | 
	
		
			
				|  |  |             businessOrderDO.setPayTime(DateUtil.strToDate(timeEnd,DateUtil.YYYY_MM_DD_HH_MM_SS));
 | 
	
		
			
				|  |  |             WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("YKTCONTROL");
 | 
	
		
			
				|  |  |             if (businessOrderDO!=null){
 | 
	
		
			
				|  |  |                 if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |                     ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
 | 
	
	
		
			
				|  | @ -770,20 +802,29 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("5")){
 | 
	
		
			
				|  |  |                     String price = Integer.parseInt(totalFee)/100+"";
 | 
	
		
			
				|  |  |                     if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     if (businessOrderDO.getOrderType()==10){
 | 
	
		
			
				|  |  |                         String re = ykyyService.upRecharge4Jkzl(businessOrderDO.getYkOrderNo(), Integer.parseInt(price), 0);
 | 
	
		
			
				|  |  |                         logger.info("调用结果="+re);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     if (businessOrderDO.getOrderType()==11){
 | 
	
		
			
				|  |  |                         String re = ykyyService.upRecharge4Jkzl(businessOrderDO.getYkOrderNo(), Integer.parseInt(price), 1);
 | 
	
		
			
				|  |  |                         logger.info("调用结果="+re);
 | 
	
		
			
				|  |  |                     } else {
 | 
	
		
			
				|  |  |                         if (businessOrderDO.getOrderType()==10){
 | 
	
		
			
				|  |  |                             String re = ykyyService.upRecharge4Jkzl(businessOrderDO.getYkOrderNo(), Integer.parseInt(price), 0);
 | 
	
		
			
				|  |  |                             logger.info("调用结果="+re);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         if (businessOrderDO.getOrderType()==11){
 | 
	
		
			
				|  |  |                             String re = ykyyService.upRecharge4Jkzl(businessOrderDO.getYkOrderNo(), Integer.parseInt(price), 1);
 | 
	
		
			
				|  |  |                             logger.info("调用结果="+re);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (businessOrderDO!=null&&!businessOrderDO.getOrderCategory().equalsIgnoreCase("5")&&businessOrderDO.getStatus()!=1){
 | 
	
		
			
				|  |  |                 ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"1");
 | 
	
		
			
				|  |  |                 if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"1");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             businessOrderDO.setStatus(1);
 | 
	
		
			
				|  |  |             businessOrderDao.save(businessOrderDO);
 | 
	
	
		
			
				|  | @ -1357,7 +1398,13 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |         businessOrderDO.setPayType(5);
 | 
	
		
			
				|  |  |         businessOrderDao.save(businessOrderDO);
 | 
	
		
			
				|  |  |         String totalFee =(int)(businessOrderDO.getPayPrice()*100)+"";
 | 
	
		
			
				|  |  |         return ykyyService.getPayCDATA4Jkzl(businessOrderDO.getRematk(),businessOrderDO.getOrderNo(),totalFee,serverIp,notifyUrl);
 | 
	
		
			
				|  |  |         WlyyHospitalSysDictDO hospitalSysD2ictDO = hospitalSysDictDao.findById("YKTCONTROL");
 | 
	
		
			
				|  |  |         if (null != hospitalSysD2ictDO && "0".equalsIgnoreCase(hospitalSysD2ictDO.getDictValue())) {
 | 
	
		
			
				|  |  |             return null;
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             return ykyyService.getPayCDATA4Jkzl(businessOrderDO.getRematk(),businessOrderDO.getOrderNo(),totalFee,serverIp,notifyUrl);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 |