Kaynağa Gözat

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

wangzhinan 4 yıl önce
ebeveyn
işleme
6491683803

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

@ -3398,10 +3398,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        BaseDoctorDO consDoctorDO = new BaseDoctorDO();
        BasePatientDO consPatientDO = new BasePatientDO();
        BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
        //获取咨询的信息
        String msgUrl="";
        if (consultTeam!=null){
            consDoctorDO = baseDoctorDao.findById(consultTeam.getDoctor());
            consPatientDO = basePatientDao.findById(consultTeam.getPatient());
            List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(consultTeam.getDoctor());
            if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()>=0){
                hospitalDO=doctorHospitalDOS.get(0);
            }
        }
        WlyyOutpatientDO outpatientDO = new WlyyOutpatientDO();
@ -3427,23 +3433,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                contentMsg = "您的视频复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                first = outpatientDO.getPatientName() + ",您好!您的视频复诊已取消";
            }
            msgUrl="/ims-wx/#/returnVisit/record?outpatientId="+outpatientId;
        } else if ("payRemind".equalsIgnoreCase(titelType)) {
            if ("9".equals(type)) {
                contentMsg = "您有一个图文复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。";
                msgUrl="/ims-wx/#/returnVisit/record?outpatientId="+outpatientId;
            } else if ("16".equals(type)) {
                contentMsg = "您有一个视频复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。";
                msgUrl="/ims-wx/#/returnVisit/record?outpatientId="+outpatientId;
            }
            if ("1".equals(type)) {
                contentMsg = "您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = consPatientDO.getName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
                msgUrl="/ims-wx/#/chatRoom?type=1&consultCode="+consultTeam.getConsult();
            } else if ("17".equals(type)) {
                contentMsg = "您有一个视频咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first =  consPatientDO.getName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
                msgUrl="/ims-wx/#/chatRoom?type=1&consultCode="+consultTeam.getConsult();
            }
        } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
@ -3463,15 +3472,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                contentMsg = "您的视频咨询已开始,错过将重新排队";
                remark = "点击消息进入视频诊室接听视频通话,开始视频复诊。";
            }
            msgUrl="/ims-wx/#/returnVisit/prescriptionDetail?outpatientId="+outpatientId;
        } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
            if ("16".equals(type)) {
                first = "您的视频复诊已预约成功。";
                contentMsg = "预计" + outpatientDO.getDoctorName() + "医生将于" + DateUtil.dateToStrLong(outpatientDO.getRegisterDate()) + " 与您进行视频复诊。请留意微信公众号消息。";
                msgUrl="/ims-wx/#/returnVisit/preChat?type=16&outpatientId="+outpatientId;
            } else if ("17".equals(type)) {
                first = "您的视频咨询已预约成功。";
                contentMsg = "预计" + consDoctorDO.getName() + "医生将于" + DateUtil.dateToStrLong(consultTeam.getCzrq()) + " 与您进行视频咨询。请留意微信公众号消息。";
                msgUrl="/ims-wx/#/zx/prechat?consultCode="+consultTeam.getConsult();
            }
            remark = "咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
@ -3489,6 +3500,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                first = consultTeam.getName() + ",您好!您有1条视频咨询已结束,请及时对咨询医生进行评价。";
            }
            contentMsg = "请对" + consDoctorDO.getName() + "医生的服务进行评价";
            msgUrl="/ims-wx/#/fuwupingjia?consultCode="+consultTeam.getConsult();
        }
@ -3521,27 +3533,46 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getDoctorName());
                newConfig.setKeyword3(config.getKeyword3() + doctorDO.getFee());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
            } else if ("payRemind".equalsIgnoreCase(titelType)) {
                scene = "zxzfts";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_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", "图文复诊"));
                    newConfig.setKeyword1(config.getKeyword1() + "图文复诊支付");
                } else if ("16".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
                    newConfig.setKeyword1(config.getKeyword1() + "视频复诊支付");
                } else if ("1".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
                    newConfig.setKeyword1(config.getKeyword1() + "图文咨询支付");
                } else if ("17".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
                    newConfig.setKeyword1(config.getKeyword1() + "视频咨询支付");
                //就诊支付
                if (StringUtils.isNotEmpty(outpatientId)){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_jz", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getPatientName()));
                    if ("9".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊"));
                        newConfig.setKeyword1(config.getKeyword1() + "图文复诊支付");
                    } else if ("16".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
                        newConfig.setKeyword1(config.getKeyword1() + "视频复诊支付");
                    }
                    newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getHospitalName());
                    newConfig.setKeyword3(config.getKeyword3() + outpatientDO.getDoctorName());
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                }
                //咨询支付
                if (consultTeam!=null){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_zx", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()));
                    if ("1".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
                        newConfig.setKeyword1(config.getKeyword1() + "图文咨询支付");
                    } else if ("17".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
                        newConfig.setKeyword1(config.getKeyword1() + "视频咨询支付");
                    }
                    newConfig.setKeyword2(config.getKeyword2() + hospitalDO.getOrgName());
                    newConfig.setKeyword3(config.getKeyword3() + consDoctorDO.getName());
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                }
                newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getHospitalName());
                newConfig.setKeyword3(config.getKeyword3() + outpatientDO.getDoctorName());
            } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
                scene = "cfzfts";
@ -3552,6 +3583,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setKeyword1(config.getKeyword1() + "处方支付");
                newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getHospitalName());
                newConfig.setKeyword3(config.getKeyword3() + outpatientDO.getDoctorName());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
            } else if ("msgRemind".equalsIgnoreCase(titelType)) {
                scene = "zxxxtx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_msg_notice", scene, 1);
@ -3559,6 +3592,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getPatientName()));
                newConfig.setKeyword1(config.getKeyword1() + remindMsg);
                newConfig.setKeyword2(config.getKeyword2() + DateUtil.getStringDate());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
            } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
                scene = "mzxxtx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice", scene, 1);
@ -3575,35 +3610,59 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                } else if ("17".equals(type)) {
                    newConfig.setRemark(config.getRemark().replaceFirst("key1", "视频咨询"));
                }
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
            } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
                scene = "spwzyytx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                if ("16".equals(type)) {
                    newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频复诊"));
                } else if ("17".equals(type)) {
                    newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
                if (StringUtils.isNotEmpty(outpatientId)){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice_fz", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    if ("16".equals(type)) {
                        newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频复诊"));
                    }
                    newConfig.setKeyword1(config.getKeyword1() + outpatientDO.getPatientName());
                    newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getDeptName());
                    newConfig.setKeyword3(config.getKeyword3() + outpatientDO.getDoctorName());
                    newConfig.setKeyword4(config.getKeyword4() + outpatientDO.getRegisterDate());
                    newConfig.setKeyword5(config.getKeyword5() + generalDoctorWaitingNumber(doctorDO.getId(), wxId, outpatientId));
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                }
                newConfig.setKeyword1(config.getKeyword1() + outpatientDO.getPatientName());
                newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getDeptName());
                newConfig.setKeyword3(config.getKeyword3() + outpatientDO.getDoctorName());
                newConfig.setKeyword4(config.getKeyword4() + outpatientDO.getRegisterDate());
                newConfig.setKeyword5(config.getKeyword5() + generalDoctorWaitingNumber(doctorDO.getId(), wxId, outpatientId));
                if (consultTeam!=null){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice_zx", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    if ("17".equals(type)) {
                        newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
                    }
                    newConfig.setKeyword1(config.getKeyword1() + consPatientDO.getName());
                    newConfig.setKeyword2(config.getKeyword2() + hospitalDO.getDeptName());
                    newConfig.setKeyword3(config.getKeyword3() + consDoctorDO.getName());
                    newConfig.setKeyword4(config.getKeyword4() + consultTeam.getCzrq());
                    newConfig.setKeyword5(config.getKeyword5() + generalDoctorWaitingNumber(consDoctorDO.getId(), wxId, outpatientId));
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                }
            } else if ("evaluateRemind".equalsIgnoreCase(titelType)) {
                scene = "fwqjtx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_evaluate_notice", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                newConfig.setFirst(config.getFirst().replaceFirst("key1", outpatientDO.getPatientName()));
                newConfig.setKeyword1(config.getKeyword1() + outpatientDO.getHospitalName());
                newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getDoctorName());
                newConfig.setFirst(config.getFirst().replaceFirst("key1", consPatientDO.getName()));
                newConfig.setKeyword1(config.getKeyword1() + hospitalDO.getOrgName());
                newConfig.setKeyword2(config.getKeyword2() + consDoctorDO.getName());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
            }
            //发起微信消息模板推送
            newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
            logger.info("=======setUrl========" + newConfig.getUrl());
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            for (BasePatientWechatDo one : ps) {
                logger.info("发送的消息="+ com.alibaba.fastjson.JSONObject.toJSONString(newConfig));
                weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), one.getOpenid(), newConfig);
                //保存发送模板记录,
                WxPushLogDO wxPushLogDO = new WxPushLogDO();
@ -3618,64 +3677,63 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else if ("xm_xzzx_wx".equalsIgnoreCase(wxId)) {
            String MsgUrl ="";
            String responseMsg="";
            String prefix="https://www.xmheart.com";
            if(StringUtils.isNotEmpty(outpatientId)){
                MsgUrl = "https://www.xmheart.com/ims-wx/index.html#/returnVisit/record?outpatientId=" + outpatientDO.getPatient();
                responseMsg = xzzxEntranceService.sendXCXMes(wxId,
                        patientDO.getId(),
                        patientDO.getIdcard(),
                        first,
                        contentMsg,
                        remark,
                        MsgUrl,
                        prefix+msgUrl,
                        "wx53f6bb4ac081d840");
            }
            if (consPatientDO!=null&&consultTeam!=null){
                MsgUrl = "https://www.xmheart.com/ims-wx/index.html#/returnVisit/record?outpatientId=" + consultTeam.getConsult();
            if (consultTeam!=null&&consPatientDO!=null){
                responseMsg = xzzxEntranceService.sendXCXMes(wxId,
                        consPatientDO.getId(),
                        consPatientDO.getIdcard(),
                        first,
                        contentMsg,
                        remark,
                        MsgUrl,
                        prefix+msgUrl,
                        "wx53f6bb4ac081d840");
            }
            logger.info("url="+(prefix+msgUrl));
            String msg="first:"+first+"contentMsg:"+contentMsg+"remark:"+remark;
            logger.info("发送的信息="+msg);
            logger.info("XZZX_Msg_" + titelType + "=" + responseMsg);
        } else if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
            String MsgUrl ="";
            String responseMsg="";
            String prefix="https://hlwyy.xmzsh.com";
            if(StringUtils.isNotEmpty(outpatientId)){
                MsgUrl = "https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId=" + outpatientDO.getPatient();
                responseMsg = entranceService.ehospitalNotice(
                        patientDO.getName(),
                        patientDO.getIdcard(),
                        patientDO.getMobile(),
                        first,
                        MsgUrl,
                        prefix+msgUrl,
                        contentMsg,
                        remark
                );
            }
            if (consPatientDO!=null&&consultTeam!=null){
                MsgUrl = "https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId=" + consultTeam.getConsult();
            if (consultTeam!=null&&consPatientDO!=null){
                responseMsg = entranceService.ehospitalNotice(
                        consPatientDO.getName(),
                        consPatientDO.getIdcard(),
                        consPatientDO.getMobile(),
                        first,
                        MsgUrl,
                        prefix+msgUrl,
                        contentMsg,
                        remark
                );
            }
            logger.info("url="+(prefix+msgUrl));
            String msg="first:"+first+"contentMsg:"+contentMsg+"remark:"+remark;
            logger.info("发送的信息="+msg);
            logger.info("ZSYY_Msg" + titelType + "=" + responseMsg);
        }
    }