|  | @ -6,6 +6,7 @@ import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.iot.common.UploadVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.security.dao.OauthYlzConfigDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.security.dao.patient.BasePatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.security.utils.ByteToInputStream;
 | 
	
		
			
				|  |  | import com.yihu.jw.security.utils.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.security.utils.QrcodeUtil;
 | 
	
		
			
				|  |  | import com.yihu.utils.security.MD5;
 | 
	
	
		
			
				|  | @ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | import sun.misc.BASE64Encoder;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.io.InputStream;
 | 
	
		
			
				|  |  | import java.util.Date;
 | 
	
	
		
			
				|  | @ -88,6 +90,46 @@ public class OauthYlzConfigService {
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getOauthQRCodeImg(){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("ylz_config");
 | 
	
		
			
				|  |  |             logger.info("getOauthQRCode:",oauthYlzConfigDO.toString());
 | 
	
		
			
				|  |  |             TransRequest e = new TransRequest();
 | 
	
		
			
				|  |  |             e.setMethod("ehc.ehealthcard.authurl");
 | 
	
		
			
				|  |  |             e.setApp_id(oauthYlzConfigDO.getAppId());
 | 
	
		
			
				|  |  |             e.setTerm_id(oauthYlzConfigDO.getTermId());
 | 
	
		
			
				|  |  |             e.setVersion(oauthYlzConfigDO.getVersion());
 | 
	
		
			
				|  |  |             e.setTimestamp(DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss"));
 | 
	
		
			
				|  |  |             e.setSign_type(oauthYlzConfigDO.getSignType());
 | 
	
		
			
				|  |  |             e.setEnc_type(oauthYlzConfigDO.getEncType());
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject bizContent = new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |             String no = UUID.randomUUID().toString().substring(0,30);
 | 
	
		
			
				|  |  |             bizContent.put("out_authorize_no", no);
 | 
	
		
			
				|  |  |             bizContent.put("out_authorize_time", DateUtils.getOutTradeTime());
 | 
	
		
			
				|  |  |             e.setBiz_content(JSON.toJSONString(bizContent));
 | 
	
		
			
				|  |  |             EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl(), oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey());
 | 
	
		
			
				|  |  |             TransResponse re = ehcHandler.execute(e);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String rs = com.alibaba.fastjson.JSONObject.toJSONString(re);
 | 
	
		
			
				|  |  |             logger.info("TransResponse:"+rs);
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(rs);
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject biz = json.getJSONObject("biz_content");
 | 
	
		
			
				|  |  |             InputStream qrcode = QrcodeUtil.createQrcode(biz.getString("ehealth_authurl"),300,"jpg");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String QRCodeImg = ByteToInputStream.getBase64FromInputStream(qrcode);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             Map<String,Object> map = new HashedMap();
 | 
	
		
			
				|  |  |             map.put("QRCodeImg",QRCodeImg);
 | 
	
		
			
				|  |  |             map.put("out_authorize_no",no);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             return map;
 | 
	
		
			
				|  |  |         } catch (Exception var5) {
 | 
	
		
			
				|  |  |             var5.printStackTrace();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 验证电子健康卡授权
 | 
	
		
			
				|  |  |      * @param authorizeNo
 |