소스 검색

im消息内容展示

wujunjie 7 년 전
부모
커밋
236be37d87

+ 80 - 2
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/service/template/DoctorFeldsherTemplateService.java

@ -64,7 +64,7 @@ public class DoctorFeldsherTemplateService extends BaseService {
     * @param content      消息内容
     * @return
     */
    public Boolean sendDoctorTemplate(String doctorCode, String sessionId, String sessionType, String businessType, String from, String content) {
    public Boolean sendDoctorTemplate(String doctorCode, String sessionId, String sessionType, String businessType,String contentType, String from, String content) {
        try {
            String remark = "请进入手机APP查看,如尚未安装APP请点击详情下载安装";
            String url = server_url + "wx_doctor/html/home/html/jumpApp.html";
@ -74,7 +74,8 @@ public class DoctorFeldsherTemplateService extends BaseService {
            String doctorName = doctor.getName();
            String doctorOpenId = doctor.getOpenid();
            businessType = parseBusinessType(businessType);
            JSONObject sendJson = weiXinTempMsgSendUtils.packageTemplate(businessType, remark, content, dateFormat.format(new Date()));
            String responseContent = parseContentType(contentType,content);
            JSONObject sendJson = weiXinTempMsgSendUtils.packageTemplate(businessType, remark, responseContent, dateFormat.format(new Date()));
            Boolean flag = weiXinTempMsgSendUtils.sendTemplateMessage(templateId, doctorOpenId, url, sendJson, doctor);
            logger.info("send wechat message param : " + doctorOpenId + " =======> " + content);
            logger.info("send wechat message retuen : " + flag + " =======> " + flag);
@ -205,6 +206,83 @@ public class DoctorFeldsherTemplateService extends BaseService {
        }
    }
    /**
     * 解析contentType
     *   PlainText: 1,   // 信息
         Image: 2,       // 图片信息
         Audio: 3,       // 语音信息
         Article: 4,     // 文章信息
         GoTo: 5,        // 跳转信息,求组其他医生或者邀请其他医生发送的推送消息
         TopicBegin: 6,  // 议题开始
         TopicEnd: 7,    // 议题结束 10 11 系统发送的会话消息
         TopicInto: 14,    // 进入议题 系统发送的会话消息
         Video:12,//视频
         System:13,//系统消息
         PrescriptionCheck:15,//续方审核消息消息
         PrescriptionBloodStatus:16,//续方咨询血糖血压咨询消息
         PrescriptionFollowupContent:17,//续方咨询随访问卷消息
     * @param contentType 消息类型
     * @return
     */
    private String parseContentType(String contentType,String content) {
        String responseContent = "";
        try {
            switch (contentType) {
                case "1":
                    responseContent = content;
                    break;
                case "2":
                    responseContent = "[图片消息]";
                    break;
                case "3":
                    responseContent = "[语音消息]";
                    break;
                case "4":
                    responseContent = "[文章消息]";
                    break;
                case "5":
                    responseContent = "[跳转链接消息]";
                    break;
                case "6":
                    responseContent = content;
                    break;
                case "7":
                    responseContent = content;
                    break;
                case "10":
                    responseContent = content;
                    break;
                case "11":
                    responseContent = content;
                    break;
                case "12":
                    responseContent = "[视频消息]";
                    break;
                case "13":
                    responseContent = content;
                    break;
                case "14":
                    responseContent = content;
                    break;
                case "15":
                    responseContent = "[续方审核消息]";
                    break;
                case "16":
                    responseContent = "[体征记录咨询消息]";
                    break;
                case "17":
                    responseContent = "[随访问卷咨询消息]";
                    break;
                default:
                    responseContent = "[咨询消息]";
                    break;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return responseContent;
    }
    /**
     * i健康往医生助手 医生端推送模板消息
     * @param type

+ 2 - 1
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/web/third/template/DoctorFeldsherTemplateController.java

@ -42,10 +42,11 @@ public class DoctorFeldsherTemplateController extends BaseController {
                                     @RequestParam @ApiParam(value = "会话Id", required = false) String sessionId,
                                     @RequestParam @ApiParam(value = "会话类型", required = false) String sessionType,
                                     @RequestParam @ApiParam(value = "消息类型") String businessType,
                                     @RequestParam @ApiParam(value = "内容类型") String contentType,
                                     @RequestParam @ApiParam(value = "发送者", required = false) String from,
                                     @RequestParam @ApiParam(value = "消息内容") String content) {
        try {
            Boolean flag = feldsherTemplateService.sendDoctorTemplate(doctorCode, sessionId, sessionType, businessType, from, content);
            Boolean flag = feldsherTemplateService.sendDoctorTemplate(doctorCode, sessionId, sessionType, businessType,contentType, from, content);
            if (flag) {
                return write(200, "发送成功!");
            } else {