|  | @ -46,6 +46,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.security.PublicKey;
 | 
	
		
			
				|  |  | import java.text.DecimalFormat;
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -105,6 +106,8 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
 | 
	
		
			
				|  |  |     public BusinessOrderDao businessOrderDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     public PrescriptionLogDao prescriptionLogDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     public PrescriptionService prescriptionService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -1821,6 +1824,7 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
 | 
	
		
			
				|  |  |             System.out.println("response=="+response.getContent());
 | 
	
		
			
				|  |  |             List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(ylzMedicalRelationDO.getRelationCode());
 | 
	
		
			
				|  |  |             /*String */
 | 
	
		
			
				|  |  |             String realOrder = "";
 | 
	
		
			
				|  |  |             for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS){
 | 
	
		
			
				|  |  |                 if (prescriptionDO.getStatus()==20){
 | 
	
		
			
				|  |  |                     WlyyPrescriptionLogDO prescriptionLogDO = new WlyyPrescriptionLogDO();
 | 
	
	
		
			
				|  | @ -1837,14 +1841,57 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
 | 
	
		
			
				|  |  |                     prescriptionDO.setPayTime(new Date());
 | 
	
		
			
				|  |  |                     prescriptionDao.save(prescriptionDO);
 | 
	
		
			
				|  |  |                     logger.info("变更处方结算状态成功");
 | 
	
		
			
				|  |  |                     realOrder = prescriptionDO.getRealOrder();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 try {
 | 
	
		
			
				|  |  |                     sfToHis(outpatientId, realOrder);
 | 
	
		
			
				|  |  |                 }catch (Exception e){
 | 
	
		
			
				|  |  |                     e.printStackTrace();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             return "结算成功!";
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             return "结算失败";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 顺丰下订单后同步his
 | 
	
		
			
				|  |  |      * @param outpatientId
 | 
	
		
			
				|  |  |      * @param realorder
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String sfToHis(String outpatientId,String realorder) throws Exception {
 | 
	
		
			
				|  |  |         WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
 | 
	
		
			
				|  |  |         String registerNo = outpatientDO.getRegisterNo();
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionExpressageDO> prescriptionExpressageDOS = prescriptionExpressageDao.findByOutpatientId(outpatientId);
 | 
	
		
			
				|  |  |         WlyyPrescriptionExpressageDO expressageDO = new WlyyPrescriptionExpressageDO();
 | 
	
		
			
				|  |  |         if (prescriptionExpressageDOS!=null&&prescriptionExpressageDOS.size()!=0){
 | 
	
		
			
				|  |  |             expressageDO = prescriptionExpressageDOS.get(0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (expressageDO!=null){
 | 
	
		
			
				|  |  |             if (expressageDO.getOneselfPickupFlg()==0){
 | 
	
		
			
				|  |  |                 Object result=prescriptionService.getSFExpressInfoNew(registerNo,realorder,"");
 | 
	
		
			
				|  |  |                 String re = result.toString();
 | 
	
		
			
				|  |  |                 if (re!=null){
 | 
	
		
			
				|  |  |                     JSONObject object = JSONObject.parseObject(re);
 | 
	
		
			
				|  |  |                     String sfOrder = object.getString("mainMailNo");
 | 
	
		
			
				|  |  |                     String address = expressageDO.getProvinceName()+expressageDO.getCityName()+expressageDO.getTownName()+expressageDO.getStreetName()+expressageDO.getAddress();
 | 
	
		
			
				|  |  |                     String phone = expressageDO.getMobile();
 | 
	
		
			
				|  |  |                     String remark = expressageDO.getRemark();
 | 
	
		
			
				|  |  |                     String cardNo = outpatientDO.getCardNo();
 | 
	
		
			
				|  |  |                     return  hcyyEntranceService.updateSftoHis(registerNo,cardNo,sfOrder,address,phone,remark);
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     return null;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 return null;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |