Ver código fonte

居民端IM接口提交

huangwenjie 6 anos atrás
pai
commit
4ca39dc231

+ 200 - 112
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -7,13 +7,14 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.im.util.ImageCompress;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.FileUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@ -51,6 +52,29 @@ public class ImService {
	@Autowired
	protected HttpServletRequest request;
	
	@Autowired
	public WxAccessTokenService wxAccessTokenService;
	
	@Value("${im.data_base_name}")
	private String data_base_name;
	
	@Value("${FileTempPath.upload_temp_path}")
	private String upload_temp_path;
	
	@Value("${FileTempPath.image_path}")
	private String image_path;
	
	@Value("${FileTempPath.voice_path}")
	private String voice_path;
	
	@Value("${FileTempPath.chat_file_path}")
	private String chat_file_path;
	
	@Value("${fastDFS.fastdfs_file_url}")
	private String fastdfs_file_url;
	
	
	
	/**
	 * 查询患者所有的咨询记录
	 * @param patient 患者标识
@ -160,9 +184,11 @@ public class ImService {
	 * @param content 消息内容
	 * @param type 消息类型
	 * @param times 次数
	 * @param patientcode 发送的居民CODE
	 * @param wechat_appid 微信公众号appid
	 * @return
	 */
	public List<String> append(String consult, String content, Integer type, Integer times,String patientcode) throws Exception {
	public List<String> append(String consult, String content, Integer type, Integer times,String patientcode,String wechat_appid) throws Exception {
		List<ConsultTeamLogDo> logs = new ArrayList<ConsultTeamLogDo>();
		ConsultTeamDo consultModel = consultTeamDao.findByConsult(consult);
		
@ -176,11 +202,11 @@ public class ImService {
		
		String[] arr = null;
		if (type == 3) {
			String path = fetchWxVoices();
			String path = fetchWxVoices(wechat_appid);
			JSONObject obj = new JSONObject();
			// 将临时语音拷贝到正式存储路径下
			if (org.apache.commons.lang3.StringUtils.isNotEmpty(path)) {
				content = CommonUtil.copyTempVoice(path);
				content = fileUtil.copyTempVoice(path,fastdfs_file_url);
				obj.put("path", content);
				obj.put("times", times);
				content = obj.toString();
@ -194,13 +220,14 @@ public class ImService {
			logs.add(log);
		} else if (type == 2) {
			// 图片消息
			content = fetchWxImages();
			content = fetchWxImages(wechat_appid);
			// 将临时图片拷贝到正式存储路径下
			if (org.apache.commons.lang3.StringUtils.isNotEmpty(content)) {
				content = CommonUtil.copyTempImage(content);
				content = fileUtil.copyTempImage(content,upload_temp_path);
			}
			if (org.apache.commons.lang3.StringUtils.isEmpty(content)) {
				return error(-1, "图片上传失败!");
				throw new Exception("图片上传失败!");
//				return error(-1, "图片上传失败!");
			}
			String[] images = content.split(",");
			for (String image : images) {
@ -228,118 +255,90 @@ public class ImService {
		int i = 0;
		List<String> failed = new ArrayList<>();
		
		String agent = getUID()==getRepUID()?null:getUID();
		for (ConsultTeamLogDo log : logs) {
//                String response = ImUtill.sendTopicIM(getUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent());
			String response = ImUtill.sendTopicIM(getRepUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent(),agent);
			String response = imUtil.sendTopicIM(patientcode, patient.getName(), consult, String.valueOf(log.getType()), log.getContent(),null);
			
			if (org.apache.commons.lang3.StringUtils.isNotEmpty(response)) {
				JSONObject resObj = new JSONObject(response);
				if (resObj.getInt("status") == -1) {
					return invalidUserException(new RuntimeException(resObj.getString("message")), -1, "追问失败!" + resObj.getString("message"));
					throw new Exception("追问失败!" + resObj.getString("message"));
//					return invalidUserException(new RuntimeException(resObj.getString("message")), -1, "追问失败!" + resObj.getString("message"));
				}
				failed.add(String.valueOf(resObj.get("data")));
				try {
                         /*if(messageService.getMessageNoticeSettingByMessageType(consultModel.getDoctor(),"1",MessageNoticeSetting.MessageTypeEnum.imSwitch.getValue())){
                            //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                            Doctor doctor = doctorDao.findByCode(consultModel.getDoctor());
                            String doctorOpenID = doctor.getOpenid();
                            if (StringUtils.isNotEmpty(doctorOpenID)) {
                                String title = "";
                                Consult consultSingle = consultDao.findByCode(log.getConsult());
                                if (consultSingle!=null){
                                    Integer singleType = consultSingle .getType();
                                    if (singleType != null && singleType ==8 ){
                                        title = consultSingle.getTitle();
                                    }else if(singleType != null && singleType !=8 ){
                                        title = consultSingle.getSymptoms();
                                    }
                                    String repContent = parseContentType(type+"",content);
                                    String first = "居民" +patient.getName()+"的健康咨询有新的回复。";
                                    String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                                    List<NameValuePair> params = new ArrayList<>();
                                    params.add(new BasicNameValuePair("type", "8"));
                                    params.add(new BasicNameValuePair("openId", doctorOpenID));
                                    params.add(new BasicNameValuePair("url", targetUrl));
                                    params.add(new BasicNameValuePair("first",  first));
                                    params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
                                    String keywords = title + "," + repContent +","+ doctor.getName();
                                    params.add(new BasicNameValuePair("keywords", keywords));
                                    httpClientUtil.post(url, params, "UTF-8");
                                }
                            }
                        }*/
					
					String sql = "";
					if (consultModel.getType() == 2){
						//家庭咨询
						sql = "SELECT t.participant_id FROM " + im +
								".participants t where t.session_id = '" +
								patient.getId() + "_" + consultModel.getTeam() + "_" + consultModel.getType() +
								"' and t.participant_role = 0";
					}else if (consultModel.getType() == 8 || consultModel.getType() == 9 || consultModel.getType() == 11){
						//8-续方咨询 9-在线复诊咨询 11-上门预约服务
						sql = "SELECT t.participant_id FROM " + im +
								".participants t where t.session_id = '" +
								patient.getId() + "_" + consultModel.getConsult() + "_" + consultModel.getType() +
								"' and t.participant_role = 0";
					}
//				try {
//
//					String sql = "";
//					if (consultModel.getType() == 2){
//						//家庭咨询
//						sql = "SELECT t.participant_id FROM " + data_base_name +
//								".participants t where t.session_id = '" +
//								patient.getId() + "_" + consultModel.getTeam() + "_" + consultModel.getType() +
//								"' and t.participant_role = 0";
//					}else if (consultModel.getType() == 8 || consultModel.getType() == 9 || consultModel.getType() == 11){
//						//8-续方咨询 9-在线复诊咨询 11-上门预约服务
//						sql = "SELECT t.participant_id FROM " + data_base_name +
//								".participants t where t.session_id = '" +
//								patient.getId() + "_" + consultModel.getConsult() + "_" + consultModel.getType() +
//								"' and t.participant_role = 0";
//					}
					
					if(org.apache.commons.lang3.StringUtils.isEmpty(sql)){
						return write(-1, "追问失败!", "data", "不存在该类型!【type】:" + type);
					}
					List<Map<String, Object>> participants = jdbcTemplate.queryForList(sql);
					
					for (Map<String, Object> participant : participants) {
//					if(org.apache.commons.lang3.StringUtils.isEmpty(sql)){
//						throw new Exception("追问失败!不存在该类型!【type】:" + type);
//						return write(-1, "追问失败!", "data", "不存在该类型!【type】:" + type);
//					}
//					List<Map<String, Object>> participants = jdbcTemplate.queryForList(sql);
//
//					for (Map<String, Object> participant : participants) {
//                          //有居民、健管、全科
						String doctorCode = participant.get("participant_id").toString();
						if (doctorCode.equals(patient.getCode())) {
							continue;
						}
//						String doctorCode = participant.get("participant_id").toString();
//						if (doctorCode.equals(patient.getCode())) {
//							continue;
//						}
						//健管
						Boolean flag = messageService.getMessageNoticeSettingByMessageType(doctorCode, "1", MessageNoticeSetting.MessageTypeEnum.imSwitch.getValue());
//						Boolean flag = messageService.getMessageNoticeSettingByMessageType(doctorCode, "1", MessageNoticeSetting.MessageTypeEnum.imSwitch.getValue());
						//全科
//                            Boolean flag2 = !messageService.getMessageNoticeSettingByMessageType(doctorCode, "1", MessageNoticeSetting.MessageTypeEnum.familyTopicSwitch.getValue());
						if (flag) {
							//            新增发送医生助手模板消息 v1.4.0 by wujunjie
							Doctor doctor = doctorDao.findByCode(doctorCode);
							String doctorOpenID = doctor.getOpenid();
							if (org.apache.commons.lang3.StringUtils.isNotEmpty(doctorOpenID)) {
								String title = "";
								Consult consultSingle = consultDao.findByCode(log.getConsult());
								if (consultSingle != null) {
									Integer singleType = consultSingle.getType();
									if (singleType != null && singleType == 8) {
										title = consultSingle.getTitle();
									} else if (singleType != null && singleType != 8) {
										title = consultSingle.getSymptoms();
									}
									String repContent = parseContentType(type + "", content);
									String first = "居民" + patient.getName() + "的咨询有新的回复。";
									String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
									List<NameValuePair> params = new ArrayList<>();
									params.add(new BasicNameValuePair("type", "8"));
									params.add(new BasicNameValuePair("openId", doctorOpenID));
									params.add(new BasicNameValuePair("url", targetUrl));
									params.add(new BasicNameValuePair("first", first));
									params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
									String keywords = title + "," + repContent + "," + doctor.getName();
									params.add(new BasicNameValuePair("keywords", keywords));
									
									httpClientUtil.post(url, params, "UTF-8");
									System.out.println("发送对象:"+doctorCode);
									System.out.println("发送对象名字:"+doctor.getName());
								}
							}
						}
					}
				} catch (Exception e) {
					e.printStackTrace();
				}
//						if (flag) {
//							//            新增发送医生助手模板消息 v1.4.0 by wujunjie
//							Doctor doctor = doctorDao.findByCode(doctorCode);
//							String doctorOpenID = doctor.getOpenid();
//							if (org.apache.commons.lang3.StringUtils.isNotEmpty(doctorOpenID)) {
//								String title = "";
//								Consult consultSingle = consultDao.findByCode(log.getConsult());
//								if (consultSingle != null) {
//									Integer singleType = consultSingle.getType();
//									if (singleType != null && singleType == 8) {
//										title = consultSingle.getTitle();
//									} else if (singleType != null && singleType != 8) {
//										title = consultSingle.getSymptoms();
//									}
//									String repContent = parseContentType(type + "", content);
//									String first = "居民" + patient.getName() + "的咨询有新的回复。";
//									String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
//									List<NameValuePair> params = new ArrayList<>();
//									params.add(new BasicNameValuePair("type", "8"));
//									params.add(new BasicNameValuePair("openId", doctorOpenID));
//									params.add(new BasicNameValuePair("url", targetUrl));
//									params.add(new BasicNameValuePair("first", first));
//									params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
//									String keywords = title + "," + repContent + "," + doctor.getName();
//									params.add(new BasicNameValuePair("keywords", keywords));
//
//									httpClientUtil.post(url, params, "UTF-8");
//									System.out.println("发送对象:"+doctorCode);
//									System.out.println("发送对象名字:"+doctor.getName());
//								}
//							}
//						}
//					}
//				} catch (Exception e) {
//					e.printStackTrace();
//				}
				
			}
		}
		return failed;
	}
	
	/**
@ -347,7 +346,7 @@ public class ImService {
	 *
	 * @return
	 */
	public String fetchWxVoices() {
	public String fetchWxVoices(String wecha_appid) {
		String voiceIds = "";
		try {
			String voices = request.getParameter("voices");
@ -359,7 +358,7 @@ public class ImService {
				if (org.apache.commons.lang3.StringUtils.isEmpty(mediaId)) {
					continue;
				}
				String temp = saveVoiceToDisk(mediaId);
				String temp = saveVoiceToDisk(mediaId,wecha_appid);
				if (org.apache.commons.lang3.StringUtils.isNotEmpty(temp)) {
					if (voiceIds.length() == 0) {
						voiceIds = temp;
@ -369,7 +368,8 @@ public class ImService {
				}
			}
		} catch (Exception e) {
			error(e);
			e.printStackTrace();
//			error(e);
		}
		return voiceIds;
	}
@ -380,9 +380,9 @@ public class ImService {
	 * @param mediaId 文件的id
	 * @throws Exception
	 */
	public String saveVoiceToDisk(String mediaId) throws Exception {
	public String saveVoiceToDisk(String mediaId,String wechat_appid) throws Exception {
		// 文件保存的临时路径
		String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
		String tempPath = upload_temp_path + File.separator;
		// 拼接年月日路径
		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
		// 重命名文件
@ -398,7 +398,7 @@ public class ImService {
			if (!uploadFile.getParentFile().exists()) {
				uploadFile.getParentFile().mkdirs();
			}
			inputStream = getInputStream(mediaId);
			inputStream = getInputStream(mediaId,wechat_appid);
			byte[] data = new byte[1024];
			int len = 0;
			fileOutputStream = new FileOutputStream(uploadFile);
@ -436,8 +436,8 @@ public class ImService {
	 *
	 * @return
	 */
	public InputStream getInputStream(String mediaId) {
		String accessToken = getAccessToken();
	public InputStream getInputStream(String mediaId,String wechat_appid) {
		String accessToken = wxAccessTokenService.getWxAccessTokenById(wechat_appid).getAccessToken();
		InputStream is = null;
		String url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=" + accessToken + "&media_id=" + mediaId;
		try {
@ -458,4 +458,92 @@ public class ImService {
		return is;
	}
	
	/**
	 * 获取微信服务器图片
	 * @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;
	}
	
}

+ 91 - 0
business/im-service/src/main/java/com/yihu/jw/im/util/ImageCompress.java

@ -0,0 +1,91 @@
package com.yihu.jw.im.util;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/**
 * 图片压缩处理
 * @author huangwenjie
 */
public class ImageCompress {
	private Image img;
	private int width;
	private int height;
	
	/**
	 * 构造函数
	 */
	public ImageCompress(String fileName) throws IOException {
		File file = new File(fileName);// 读入文件
		img = ImageIO.read(file); // 构造Image对象
		width = img.getWidth(null); // 得到源图宽
		height = img.getHeight(null); // 得到源图长
	}
	
	/**
	 * 按照宽度还是高度进行压缩
	 * @param w int 最大宽度
	 * @param h int 最大高度
	 */
	public void resizeFix(int w, int h, File destFile) throws IOException {
		if (width / height > w / h) {
			resizeByWidth(w, destFile);
		} else {
			resizeByHeight(h, destFile);
		}
	}
	
	/**
	 * 以宽度为基准,等比例放缩图片
	 * @param w int 新宽度
	 */
	public void resizeByWidth(int w, File destFile) throws IOException {
		int h = (int) (height * w / width);
		resize(w, h, destFile);
	}
	
	/**
	 * 以高度为基准,等比例缩放图片
	 * @param h int 新高度
	 */
	public void resizeByHeight(int h, File destFile) throws IOException {
		int w = (int) (width * h / height);
		resize(w, h, destFile);
	}
	
	/**
	 * 强制压缩/放大图片到固定的大小
	 * @param w int 新宽度
	 * @param h int 新高度
	 */
	public void resize(int w, int h, File destFile) throws IOException {
		// SCALE_SMOOTH 的缩略算法 生成缩略图片的平滑度的 优先级比速度高 生成的图片质量比较好 但速度慢
		BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
		image.getGraphics().drawImage(img, 0, 0, w, h, null); // 绘制缩小后的图
		FileOutputStream out = new FileOutputStream(destFile); // 输出到文件流
		// 可以正常实现bmp、png、gif转jpg
		JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
		encoder.encode(image); // JPEG编码
		out.close();
	}
	
	/**
	 * 图片压缩
	 * @param source
	 * @param target
	 * @param width
	 * @param height
	 * @throws IOException
	 */
	public static void compress(String source, String target, int width, int height) throws IOException{
		ImageCompress imgCom = new ImageCompress(source);
		imgCom.resizeFix(width, height, new File(target));
	}
}

+ 4 - 0
common/common-util/pom.xml

@ -74,5 +74,9 @@
            <artifactId>jave-ffmpegjave</artifactId>
            <version>1.0.4</version>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>fastdfs-starter</artifactId>
        </dependency>
    </dependencies>
</project>

+ 48 - 7
common/common-util/src/main/java/com/yihu/jw/util/common/FileUtil.java

@ -1,8 +1,10 @@
package com.yihu.jw.util.common;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
import it.sauronsoftware.jave.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.File;
import java.io.FileInputStream;
@ -10,10 +12,14 @@ import java.io.IOException;
import java.io.InputStream;
/**
 * 文件处理工具类
 * @author huangwenjie
 * @date 2019/6/12 10:34
 */
public class FileUtil {
	
	@Autowired
	private FastDFSUtil fastDFSHelper;
	
	public void changeToMp3(String sourcePath, String targetPath) {
		File source = new File(sourcePath);
		File target = new File(targetPath);
@ -36,26 +42,25 @@ public class FileUtil {
	
	/**
	 * 拷贝临时语音文件到存储目录
	 *
	 * @param voices
	 * @param voices_Path
	 * @param fastdfs_file_url
	 * @return
	 * @throws IOException
	 */
	
	
	public String copyTempVoice(String voices) throws Exception {
	public String copyTempVoice(String voices_Path,String fastdfs_file_url) throws Exception {
		// 文件保存的临时路径
		String serverUrl = fastdfs_file_url;
		FastDFSUtil fastDFSUtil = new FastDFSUtil();
		String fileUrls = "";
		File f = new File(voices);
		File f = new File(voices_Path);
		if (f.exists()) {
			String fileName = f.getName();
			InputStream in = new FileInputStream(f);
			ObjectNode result = fastDFSUtil.upload(in, fileName.substring(fileName.lastIndexOf(".") + 1), "");
			in.close();
			if (result != null) {
				fileUrls += (StringUtils.isEmpty(fileUrls) ? "" : ",") + serverUrl
				fileUrls += (StringUtils.isEmpty(fileUrls) ? "" : ",") + fastdfs_file_url
						+ result.get("groupName").toString().replaceAll("\"", "") + "/"
						+ result.get("remoteFileName").toString().replaceAll("\"", "");
				f.delete();
@ -63,4 +68,40 @@ public class FileUtil {
		}
		return fileUrls;
	}
	
	/**
	 * 上传文件到FastDFS
	 *
	 * @param files 临时文件
	 * @return
	 * @throws Exception
	 */
	public String copyTempImage(String files,String tempPath) throws Exception {
		// 文件保存的临时路径
		String[] fileArray = files.split(",");
		FastDFSUtil fastDFSUtil = new FastDFSUtil();
		String fileUrls = "";
		for (String file : fileArray) {
			File f = new File(tempPath + file);
			File fs = new File(tempPath + file + "_small");
			if (f.exists()) {
				String fileName = f.getName();
				InputStream in = new FileInputStream(f);
				ObjectNode result = fastDFSUtil.upload(in, fileName.substring(fileName.lastIndexOf(".") + 1), "");
				in.close();
				if (result != null) {
					//1.3.7去掉前缀
					fileUrls += (StringUtils.isEmpty(fileUrls) ? "" : ",")
							+ result.get("groupName").toString().replaceAll("\"", "") + "/"
							+ result.get("remoteFileName").toString().replaceAll("\"", "");
					f.delete();
					if (fs.exists()) {
						fs.delete();
					}
				}
			}
		}
		
		return fileUrls;
	}
}

+ 4 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -151,9 +151,11 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "type", value = "追问内容类型:1文字,2图片,3语音  ... (im消息类型)")
			@RequestParam(value = "type",required = true) Integer type,
			@ApiParam(name = "times", value = "")
			@RequestParam(value = "times",required = false) Integer times){
			@RequestParam(value = "times",required = false) Integer times,
			@ApiParam(name = "wechat_appid", value = "")
			@RequestParam(value = "wechat_appid",required = true) String wechat_appid) throws Exception {
		List<String> failed = new ArrayList<>();
		failed = imService.append(consult,content,type,times)
		failed = imService.append(consult,content,type,times,getUID(),wechat_appid);
		return success(failed);
	}
}

+ 22 - 1
svr/svr-internet-hospital/src/main/resources/application.yml

@ -124,6 +124,13 @@ hospital:
im:
  im_list_get: http://172.26.0.118:3000/
  data_base_name: im_new
# 上传文件临时路径配置
FileTempPath:
  upload_temp_path : /var/local/temp
  image_path : /var/local/upload/images
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
---
spring:
  profiles: jwtest
@ -169,6 +176,13 @@ hospital:
im:
  im_list_get: http://172.26.0.118:3000/
  data_base_name: im_new
# 上传文件临时路径配置
FileTempPath:
  upload_temp_path : /var/local/temp
  image_path : /var/local/upload/images
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
---
spring:
  profiles: prod
@ -210,4 +224,11 @@ hospital:
  TargetSysCode: S01
im:
  im_list_get: http://172.26.0.118:3000/
  data_base_name: im
  data_base_name: im
# 上传文件临时路径配置
FileTempPath:
  upload_temp_path : /var/local/temp
  image_path : /var/local/upload/images
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat