| 
					
				 | 
			
			
				@ -21,6 +21,7 @@ import org.springframework.mock.web.MockMultipartFile; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.multipart.MultipartFile; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import javax.transaction.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.io.InputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.net.HttpURLConnection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.net.URL; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -54,6 +55,52 @@ public class QrcodeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private EntranceService entranceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private XzzxEntranceService xzzxEntranceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 生成所有医生的二维码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void makeAllSpecialistQrcode() throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String token=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //中山医院互联网医院 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("xm_zsyy_wx".equals(wxId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String response = entranceService.getAccessToken("100033"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            net.sf.json.JSONObject object1 = net.sf.json.JSONObject.fromObject(response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null != object1&&null!=object1.get("respCode") && "00".equals(object1.get("respCode"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                token  = object1.getJSONObject("respEntity").getString("access_token"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                throw new Exception("获取ACCESSTOKEN失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if("xm_xzzx_wx".equals(wxId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            token = xzzxEntranceService.getXzToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            token = wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        System.out.println("token"+token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        System.out.println("wxId"+wxId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Iterable<BaseDoctorDO> doctors = baseDoctorDao.findAll(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (BaseDoctorDO doctorDO :doctors){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null==doctorDO.getQrcode()||"".equals(doctorDO.getQrcode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                // 二维码内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String content = "hlw_doctor_" + doctorDO.getId() +"_"+doctorDO.getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                System.out.println("content"+content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                // 二维码图片文件名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String fileName = doctorDO.getId()+"_"+doctorDO.getMobile()+".png"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                /*String path = QrcodeService.class.getResource("/").getPath().replace("/WEB-INF/classes/", "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        + File.separator + "qrcode";*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                System.out.println("fileName"+fileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                // 通过微信接口生成医生二维码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String uri = makeQrcodeFromWeiXin(content, fileName.replaceAll("\r\n", ""), token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                System.out.println("uri"+uri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctorDO.setQrcode(uri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                baseDoctorDao.save(doctorDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 生成某个医生的二维码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -63,6 +110,7 @@ public class QrcodeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String makeSpecialistQrcode(String doctor) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        System.out.println("doctorID"+doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String token=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //中山医院互联网医院 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("xm_zsyy_wx".equals(wxId)) { 
			 |