|  | @ -560,6 +560,39 @@ public class ImService {
 | 
	
		
			
				|  |  | 		return failed;
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	/**
 | 
	
		
			
				|  |  | 	 * 获取微信服务器图片
 | 
	
		
			
				|  |  | 	 * @param wechat_appid 微信公众号appid
 | 
	
		
			
				|  |  | 	 * @return
 | 
	
		
			
				|  |  | 	 */
 | 
	
		
			
				|  |  | 	public String fetchWxImages(String wechat_appid) {
 | 
	
		
			
				|  |  | 		String photos = "";
 | 
	
		
			
				|  |  | 		try {
 | 
	
		
			
				|  |  | 			String images = request.getParameter("mediaIds");
 | 
	
		
			
				|  |  | 			if (org.apache.commons.lang3.StringUtils.isEmpty(images)) {
 | 
	
		
			
				|  |  | 				return photos;
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			String[] mediaIds = images.split(",");
 | 
	
		
			
				|  |  | 			for (String mediaId : mediaIds) {
 | 
	
		
			
				|  |  | 				if (org.apache.commons.lang3.StringUtils.isEmpty(mediaId)) {
 | 
	
		
			
				|  |  | 					continue;
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 				String temp = saveImageToDisk(mediaId,wechat_appid);
 | 
	
		
			
				|  |  | 				if (org.apache.commons.lang3.StringUtils.isNotEmpty(temp)) {
 | 
	
		
			
				|  |  | 					if (photos.length() == 0) {
 | 
	
		
			
				|  |  | 						photos = temp;
 | 
	
		
			
				|  |  | 					} else {
 | 
	
		
			
				|  |  | 						photos += "," + temp;
 | 
	
		
			
				|  |  | 					}
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 		} catch (Exception e) {
 | 
	
		
			
				|  |  | 			e.printStackTrace();
 | 
	
		
			
				|  |  | //			error(e);
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		return photos;
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	/**
 | 
	
		
			
				|  |  | 	 * 获取微信服务器语音
 | 
	
		
			
				|  |  | 	 *
 | 
	
	
		
			
				|  | @ -658,6 +691,63 @@ public class ImService {
 | 
	
		
			
				|  |  | 		return null;
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	/**
 | 
	
		
			
				|  |  | 	 * 获取下载图片信息(jpg)
 | 
	
		
			
				|  |  | 	 *
 | 
	
		
			
				|  |  | 	 * @param mediaId 文件的id
 | 
	
		
			
				|  |  | 	 * @param wechat_appid 微信appid
 | 
	
		
			
				|  |  | 	 * @throws Exception
 | 
	
		
			
				|  |  | 	 */
 | 
	
		
			
				|  |  | 	public String saveImageToDisk(String mediaId,String wechat_appid) throws Exception {
 | 
	
		
			
				|  |  | 		// 文件保存的临时路径
 | 
	
		
			
				|  |  | 		String tempPath = upload_temp_path + File.separator;
 | 
	
		
			
				|  |  | 		// 拼接年月日路径
 | 
	
		
			
				|  |  | 		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
 | 
	
		
			
				|  |  | 		// 重命名文件
 | 
	
		
			
				|  |  | 		String newFileName = DateUtil.dateToStr(new Date(), DateUtil.YYYYMMDDHHMMSS) + "_" + new Random().nextInt(1000) + ".png";
 | 
	
		
			
				|  |  | 		// 保存路径
 | 
	
		
			
				|  |  | 		File uploadFile = new File(tempPath + datePath + newFileName);
 | 
	
		
			
				|  |  | 		
 | 
	
		
			
				|  |  | 		InputStream inputStream = null;
 | 
	
		
			
				|  |  | 		FileOutputStream fileOutputStream = null;
 | 
	
		
			
				|  |  | 		try {
 | 
	
		
			
				|  |  | 			if (!uploadFile.getParentFile().exists()) {
 | 
	
		
			
				|  |  | 				uploadFile.getParentFile().mkdirs();
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			inputStream = getInputStream(mediaId,wechat_appid);
 | 
	
		
			
				|  |  | 			byte[] data = new byte[1024];
 | 
	
		
			
				|  |  | 			int len = 0;
 | 
	
		
			
				|  |  | 			fileOutputStream = new FileOutputStream(uploadFile);
 | 
	
		
			
				|  |  | 			while ((len = inputStream.read(data)) != -1) {
 | 
	
		
			
				|  |  | 				fileOutputStream.write(data, 0, len);
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			// 生成缩略图
 | 
	
		
			
				|  |  | 			ImageCompress.compress(uploadFile.getAbsolutePath(), uploadFile.getAbsolutePath() + "_small", 300, 300);
 | 
	
		
			
				|  |  | 			// 返回保存路径
 | 
	
		
			
				|  |  | 			return datePath + newFileName;
 | 
	
		
			
				|  |  | 		} catch (IOException e) {
 | 
	
		
			
				|  |  | 			e.printStackTrace();
 | 
	
		
			
				|  |  | 		} finally {
 | 
	
		
			
				|  |  | 			if (inputStream != null) {
 | 
	
		
			
				|  |  | 				try {
 | 
	
		
			
				|  |  | 					inputStream.close();
 | 
	
		
			
				|  |  | 				} catch (IOException e) {
 | 
	
		
			
				|  |  | 					e.printStackTrace();
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			if (fileOutputStream != null) {
 | 
	
		
			
				|  |  | 				try {
 | 
	
		
			
				|  |  | 					fileOutputStream.close();
 | 
	
		
			
				|  |  | 				} catch (IOException e) {
 | 
	
		
			
				|  |  | 					e.printStackTrace();
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		return null;
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	/**
 | 
	
		
			
				|  |  | 	 * 下载多媒体文件(请注意,视频文件不支持下载,调用该接口需http协议)
 | 
	
		
			
				|  |  | 	 *
 | 
	
	
		
			
				|  | @ -746,97 +836,6 @@ public class ImService {
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	/**
 | 
	
		
			
				|  |  | 	 * 获取微信服务器图片
 | 
	
		
			
				|  |  | 	 * @param wechat_appid 微信公众号appid
 | 
	
		
			
				|  |  | 	 * @return
 | 
	
		
			
				|  |  | 	 */
 | 
	
		
			
				|  |  | 	public String fetchWxImages(String wechat_appid) {
 | 
	
		
			
				|  |  | 		String photos = "";
 | 
	
		
			
				|  |  | 		try {
 | 
	
		
			
				|  |  | 			String images = request.getParameter("mediaIds");
 | 
	
		
			
				|  |  | 			if (org.apache.commons.lang3.StringUtils.isEmpty(images)) {
 | 
	
		
			
				|  |  | 				return photos;
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			String[] mediaIds = images.split(",");
 | 
	
		
			
				|  |  | 			for (String mediaId : mediaIds) {
 | 
	
		
			
				|  |  | 				if (org.apache.commons.lang3.StringUtils.isEmpty(mediaId)) {
 | 
	
		
			
				|  |  | 					continue;
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 				String temp = saveImageToDisk(mediaId,wechat_appid);
 | 
	
		
			
				|  |  | 				if (org.apache.commons.lang3.StringUtils.isNotEmpty(temp)) {
 | 
	
		
			
				|  |  | 					if (photos.length() == 0) {
 | 
	
		
			
				|  |  | 						photos = temp;
 | 
	
		
			
				|  |  | 					} else {
 | 
	
		
			
				|  |  | 						photos += "," + temp;
 | 
	
		
			
				|  |  | 					}
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 		} catch (Exception e) {
 | 
	
		
			
				|  |  | 			e.printStackTrace();
 | 
	
		
			
				|  |  | //			error(e);
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		return photos;
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	/**
 | 
	
		
			
				|  |  | 	 * 获取下载图片信息(jpg)
 | 
	
		
			
				|  |  | 	 *
 | 
	
		
			
				|  |  | 	 * @param mediaId 文件的id
 | 
	
		
			
				|  |  | 	 * @param wechat_appid 微信appid
 | 
	
		
			
				|  |  | 	 * @throws Exception
 | 
	
		
			
				|  |  | 	 */
 | 
	
		
			
				|  |  | 	public String saveImageToDisk(String mediaId,String wechat_appid) throws Exception {
 | 
	
		
			
				|  |  | 		// 文件保存的临时路径
 | 
	
		
			
				|  |  | 		String tempPath = upload_temp_path + File.separator;
 | 
	
		
			
				|  |  | 		// 拼接年月日路径
 | 
	
		
			
				|  |  | 		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
 | 
	
		
			
				|  |  | 		// 重命名文件
 | 
	
		
			
				|  |  | 		String newFileName = DateUtil.dateToStr(new Date(), DateUtil.YYYYMMDDHHMMSS) + "_" + new Random().nextInt(1000) + ".png";
 | 
	
		
			
				|  |  | 		// 保存路径
 | 
	
		
			
				|  |  | 		File uploadFile = new File(tempPath + datePath + newFileName);
 | 
	
		
			
				|  |  | 		
 | 
	
		
			
				|  |  | 		InputStream inputStream = null;
 | 
	
		
			
				|  |  | 		FileOutputStream fileOutputStream = null;
 | 
	
		
			
				|  |  | 		try {
 | 
	
		
			
				|  |  | 			if (!uploadFile.getParentFile().exists()) {
 | 
	
		
			
				|  |  | 				uploadFile.getParentFile().mkdirs();
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			inputStream = getInputStream(mediaId,wechat_appid);
 | 
	
		
			
				|  |  | 			byte[] data = new byte[1024];
 | 
	
		
			
				|  |  | 			int len = 0;
 | 
	
		
			
				|  |  | 			fileOutputStream = new FileOutputStream(uploadFile);
 | 
	
		
			
				|  |  | 			while ((len = inputStream.read(data)) != -1) {
 | 
	
		
			
				|  |  | 				fileOutputStream.write(data, 0, len);
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			// 生成缩略图
 | 
	
		
			
				|  |  | 			ImageCompress.compress(uploadFile.getAbsolutePath(), uploadFile.getAbsolutePath() + "_small", 300, 300);
 | 
	
		
			
				|  |  | 			// 返回保存路径
 | 
	
		
			
				|  |  | 			return datePath + newFileName;
 | 
	
		
			
				|  |  | 		} catch (IOException e) {
 | 
	
		
			
				|  |  | 			e.printStackTrace();
 | 
	
		
			
				|  |  | 		} finally {
 | 
	
		
			
				|  |  | 			if (inputStream != null) {
 | 
	
		
			
				|  |  | 				try {
 | 
	
		
			
				|  |  | 					inputStream.close();
 | 
	
		
			
				|  |  | 				} catch (IOException e) {
 | 
	
		
			
				|  |  | 					e.printStackTrace();
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			if (fileOutputStream != null) {
 | 
	
		
			
				|  |  | 				try {
 | 
	
		
			
				|  |  | 					fileOutputStream.close();
 | 
	
		
			
				|  |  | 				} catch (IOException e) {
 | 
	
		
			
				|  |  | 					e.printStackTrace();
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		return null;
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	/**
 | 
	
		
			
				|  |  | 	 * 患者端
 | 
	
		
			
				|  |  | 	 * 发起专家咨询
 |