Jelajahi Sumber

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangzhinan 4 tahun lalu
induk
melakukan
5c394884af

+ 3 - 74
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -3648,12 +3648,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String remark = "";
        if ("doctorRefuseRemind".equalsIgnoreCase(titelType)) {
            if ("9".equals(type)) {
                contentMsg = "您的图文复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                contentMsg = "医生已取消您的复诊申请,取消原因:"+remindMsg;
                first = outpatientDO.getPatientName() + ",您好!您的图文复诊已取消";
            }
            if ("16".equals(type)) {
                contentMsg = "您的视频复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                contentMsg = "医生已取消您的复诊申请,取消原因:"+remindMsg;
                first = outpatientDO.getPatientName() + ",您好!您的视频复诊已取消";
            }
            logger.info("doctorRefuseRemind医生拒诊入参:outpatientId="+outpatientId);
@ -3996,78 +3996,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            logger.info("XZZX_Msg_" + titelType + "=" + responseMsg);
        } else if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
            if ("prescriptionPayRemind".equalsIgnoreCase(titelType)){
                return;
            }
            List<BasePatientWechatDo> ps = new ArrayList<BasePatientWechatDo>();
            if (StringUtils.isNotEmpty(outpatientId)){
                ps = basePatientWechatDao.findByWechatIdAndPatientId(wxId, outpatientDO.getPatient());
            }
            if (consultTeam!=null){
                ps = basePatientWechatDao.findByWechatIdAndPatientId(wxId, consultTeam.getPatient());
            }
            if (ps.isEmpty()) {
                logger.info("该用户" + outpatientDO.getPatientName() + "没有openid,无法推送模版消息,用户ID:" + outpatientDO.getPatient() + "wechatId:" + wxId);
                return;
            }
            String scene = "";
            WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
            if ("doctorRefuseRemind".equalsIgnoreCase(titelType)) {
                scene = "zsysqxts";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_doctor_notice", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getPatientName()));
                if ("9".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊")+"取消原因为:"+remindMsg);
                } else if ("16".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊")+"取消原因为:"+remindMsg);
                }
                newConfig.setKeyword1( outpatientDO.getHospitalName());
                newConfig.setKeyword2(outpatientDO.getDoctorName());
                newConfig.setKeyword3( doctorDO.getFee());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("中山医院消息模板推送 医生拒诊开始");
            }else if("outPatientTimeOutRemind".equalsIgnoreCase(titelType)){
                scene = "hzsjgctx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_doctor_notice", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getPatientName()));
                if ("9".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊"));
                } else if ("16".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
                }
                newConfig.setKeyword1( outpatientDO.getHospitalName());
                newConfig.setKeyword2(outpatientDO.getDoctorName());
                newConfig.setKeyword3( doctorDO.getFee());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("中山医院消息模板推送 候诊时间过长开始");
            }
            logger.info("=======setUrl========" + newConfig.getUrl());
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            for (BasePatientWechatDo one : ps) {
                logger.info("发送的消息="+ com.alibaba.fastjson.JSONObject.toJSONString(newConfig));
                try {
                    logger.info("调用中山微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+one.getOpenid());
                    weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), one.getOpenid(), newConfig);
                    logger.info("发送成功");
                } catch (Exception e) {
                    e.printStackTrace();
                    logger.info("发送失败,error="+e.getMessage());
                }
                //保存发送模板记录,
                WxPushLogDO wxPushLogDO = new WxPushLogDO();
                wxPushLogDO.setCreateTime(new Date());
                wxPushLogDO.setOpenid(one.getOpenid());
                wxPushLogDO.setReceiver(outpatientDO.getPatient());
                wxPushLogDO.setWechatId(wechatId);
                wxPushLogDO.setReceiverName(outpatientDO.getPatientName());
                wxPushLogDO.setScene(scene);
                wxPushLogDao.save(wxPushLogDO);
            }
            String responseMsg="";
            String prefix="https://hlwyy.xmzsh.com";
            if(StringUtils.isNotEmpty(outpatientId)){
@ -7763,6 +7691,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        String returnValue = "";
        Map<String, String> params = new HashedMap();
        params.put("type", "getPatInfoDataXml");
        params.put("data", data);
        returnValue = com.yihu.jw.utils.WebserviceUtil.post(url,
                "http://business.htemr.haitaiinc.com",