浏览代码

微信消息模板修改

mengkang 4 年之前
父节点
当前提交
02a76ddbdd

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

@ -13,6 +13,8 @@ import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
@ -243,7 +245,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private DictDeptDescDao dictDeptDescDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
    @Value("${wechat.id}")
@ -3316,12 +3317,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                    data.put("type", "9");
                    msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个图文复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(), "9", "doctorRefuse", null);
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "doctorRefuse", "");
                }
                if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                    data.put("type", "16");
                    msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个视频复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(), "16", "doctorRefuse", null);
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "doctorRefuse", "");
                }
                data.put("msg", msg);
                messageDO.setData(data.toString());
@ -3368,72 +3369,101 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param titelType
     * @param remindMsg
     */
    public void sendWxTemplateMsg(String wxId, String outpatientId, String type, String titelType, String remindMsg) {
    public void sendWxTemplateMsg(String wxId, String outpatientId,ConsultTeamDo consultTeam,  String type, String titelType, String remindMsg) {
        BaseDoctorDO consDoctorDO = new BaseDoctorDO();
        BasePatientDO consPatientDO = new BasePatientDO();
        //获取咨询的信息
        if (consultTeam!=null){
            consDoctorDO = baseDoctorDao.findById(consultTeam.getDoctor());
            consPatientDO = basePatientDao.findById(consultTeam.getPatient());
        }
        WlyyOutpatientDO outpatientDO = new WlyyOutpatientDO();
        BaseDoctorDO doctorDO = new BaseDoctorDO();
        BasePatientDO patientDO = new BasePatientDO();
        if (StringUtils.isNotEmpty(outpatientId)){
            outpatientDO = outpatientDao.findById(outpatientId);
            doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
            patientDO = basePatientDao.findById(outpatientDO.getPatient());
        }
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        BaseDoctorDO doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
        String contentMsg = "";
        String first = "";
        String remark = "";
        if ("doctorRefuseRemind".equalsIgnoreCase(titelType)) {
            if ("9".equals(type)) {
                contentMsg = "通知内容:您的图文复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                contentMsg = "您的图文复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                first = outpatientDO.getPatientName() + ",您好!您的图文复诊已取消";
            }
            if ("16".equals(type)) {
                contentMsg = "通知内容:您的视频复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                contentMsg = "您的视频复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                first = outpatientDO.getPatientName() + ",您好!您的视频复诊已取消";
            }
        } else if ("payRemind".equalsIgnoreCase(titelType)) {
            if ("9".equals(type)) {
                contentMsg = "通知内容:您有一个图文复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                contentMsg = "您有一个图文复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。";
            } else if ("16".equals(type)) {
                contentMsg = "通知内容:您有一个视频复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                contentMsg = "您有一个视频复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。";
            } else if ("1".equals(type)) {
                contentMsg = "通知内容:您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
            }
            if ("1".equals(type)) {
                contentMsg = "您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = consPatientDO.getName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
            } else if ("17".equals(type)) {
                contentMsg = "通知内容:您有一个视频咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
                contentMsg = "您有一个视频咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first =  consPatientDO.getName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
            }
        } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
            first = outpatientDO.getPatientName() + ",您好! 医生已为您开具处方,请及时支付。";
            contentMsg = "通知内容:医生已为您开具处方,请及时支付。";
            remark = "备注:点击完成支付,如您已支付请忽略本条信息";
            contentMsg = "医生已为您开具处方,请及时支付。";
            remark = "点击完成支付,如您已支付请忽略本条信息";
        } else if ("msgRemind".equalsIgnoreCase(titelType)) {
            first = outpatientDO.getPatientName() + ",您好!";
            contentMsg = "通知内容:" + remindMsg;
            remark = "备注:请您尽快回复";
            contentMsg = "" + remindMsg;
            remark = "请您尽快回复";
        } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
            first = doctorDO.getName() + doctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
            if ("16".equals(type)) {
                contentMsg = "通知内容:您的视频复诊已开始,错过将重新排队";
                remark = "备注:点击消息进入视频诊室接听视频通话,开始视频咨询。";
                contentMsg = "您的视频复诊已开始,错过将重新排队";
                remark = "点击消息进入视频诊室接听视频通话,开始视频咨询。";
            } else if ("17".equals(type)) {
                contentMsg = "通知内容:您的视频咨询已开始,错过将重新排队";
                remark = "备注:点击消息进入视频诊室接听视频通话,开始视频复诊。";
                contentMsg = "您的视频咨询已开始,错过将重新排队";
                remark = "点击消息进入视频诊室接听视频通话,开始视频复诊。";
            }
        } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
            if ("16".equals(type)) {
                first = "您的视频复诊已预约成功。";
                contentMsg = "通知内容:预计" + outpatientDO.getDoctorName() + "医生将于" + outpatientDO.getRegisterDate() + " 与您进行视频复诊。请留意微信公众号消息。";
                contentMsg = "预计" + outpatientDO.getDoctorName() + "医生将于" + DateUtil.dateToStrLong(outpatientDO.getRegisterDate()) + " 与您进行视频复诊。请留意微信公众号消息。";
            } else if ("17".equals(type)) {
                first = "您的视频咨询已预约成功。";
                contentMsg = "通知内容:预计" + outpatientDO.getDoctorName() + "医生将于" + outpatientDO.getRegisterDate() + " 与您进行视频咨询。请留意微信公众号消息。";
                contentMsg = "预计" + consDoctorDO.getName() + "医生将于" + DateUtil.dateToStrLong(consultTeam.getCzrq()) + " 与您进行视频咨询。请留意微信公众号消息。";
            }
            remark = "备注:咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
            remark = "咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
        } else if ("evaluateRemind".equalsIgnoreCase(titelType)) {
            first = outpatientDO.getPatientName() + ",您好!您有1条专家咨询已结束,请及时对咨询医生进行评价。";
            contentMsg = "通知内容:请对" + outpatientDO.getDoctorName() + "医生的服务进行评价";
            if (consultTeam.getType()!=null&&1==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条图文咨询已结束,请及时对咨询医生进行评价。";
            }
            if (consultTeam.getType()!=null&&9==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条图文复诊已结束,请及时对咨询医生进行评价。";
            }
            if (consultTeam.getType()!=null&&16==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条视频复诊已结束,请及时对咨询医生进行评价。";
            }
            if (consultTeam.getType()!=null&&17==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条视频咨询已结束,请及时对咨询医生进行评价。";
            }
            contentMsg = "请对" + consDoctorDO.getName() + "医生的服务进行评价";
        }
@ -5248,11 +5278,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if ("1".equals(outpatient.getType())) {
                    systemMessageDO.setTitle("图文复诊");
                    systemMessageDO.setType("1");
                    saveInquirySystemMessage(outpatient);
                    saveInquirySystemMessage(outpatient,null);
                } else {
                    systemMessageDO.setTitle("视频复诊预约成功");
                    systemMessageDO.setType("2");
                    saveInquirySystemMessage(outpatient);
                    saveInquirySystemMessage(outpatient,null);
                    msg = "您的视频复诊已预约成功。\n" +
                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                    systemMessageDO.setReceiver(outpatient.getDoctor());
@ -5270,7 +5300,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    data.put("msg", msg);
                    systemMessageDO.setData(data.toString());
                    systemMessageService.saveMessage(systemMessageDO);
                    sendWxTemplateMsg(wechatId, outpatient.getId(), "17", "videoOrderRemind", null);
                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "17", "videoOrderRemind", "");
                }
            }
@ -5286,44 +5316,86 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return systemMessageDO;
    }
    public void saveInquirySystemMessage(WlyyOutpatientDO outpatient) {
    public void saveInquirySystemMessage(WlyyOutpatientDO outpatient,ConsultTeamDo consultTeamDo) {
        SystemMessageDO systemMessageDO = new SystemMessageDO();
        String msg = "";
        String type = "";
        if ("1".equals(outpatient.getType())) {
            type = "9";
            msg = outpatient.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
        } else {
            type = "16";
            msg = outpatient.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
        }
        systemMessageDO.setTitle("支付提醒");
        systemMessageDO.setType("11");
        systemMessageDO.setSender(outpatient.getDoctor());
        systemMessageDO.setSenderName(outpatient.getDoctorName());
        systemMessageDO.setRelationCode(outpatient.getId());
        systemMessageDO.setReceiver(outpatient.getPatient());
        systemMessageDO.setReceiverName(outpatient.getPatientName());
        JSONObject data = new JSONObject();
        try {
            data.put("name", outpatient.getPatientName());
            data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
            data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
            data.put("question", outpatient.getDescription());
            data.put("msg", msg);
            data.put("type", type);
            systemMessageDO.setData(data.toString());
            systemMessageService.saveMessage(systemMessageDO);
        } catch (Exception e) {
            e.printStackTrace();
        if (outpatient!=null){
            if ("1".equals(outpatient.getType())) {
                type = "9";
                msg = outpatient.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
            } else if ("2".equals(outpatient.getType())){
                type = "16";
                msg = outpatient.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
            }
            systemMessageDO.setSender(outpatient.getDoctor());
            systemMessageDO.setSenderName(outpatient.getDoctorName());
            systemMessageDO.setRelationCode(outpatient.getId());
            systemMessageDO.setReceiver(outpatient.getPatient());
            systemMessageDO.setReceiverName(outpatient.getPatientName());
           data = new JSONObject();
            try {
                data.put("name", outpatient.getPatientName());
                data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
                data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
                data.put("question", outpatient.getDescription());
                data.put("msg", msg);
                data.put("type", type);
                systemMessageDO.setData(data.toString());
                systemMessageService.saveMessage(systemMessageDO);
            } catch (Exception e) {
                e.printStackTrace();
            }
            sendWxTemplateMsg(wechatId, outpatient.getId(),null, type, "payRemind", "");
        }
        if (consultTeamDo!=null){
            if (consultTeamDo.getType().equals("17")){
                type = "17";
                msg = outpatient.getPatientName() + ",您好!您有一个视频咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
            }else if (consultTeamDo.getType().equals("1")){
                type = "1";
                msg = outpatient.getPatientName() + ",您好!您有一个图文咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
            }
            BaseDoctorDO doctorDO = baseDoctorDao.findById(consultTeamDo.getDoctor());
            BasePatientDO patientDO = basePatientDao.findById(consultTeamDo.getPatient());
            systemMessageDO.setSender(consultTeamDo.getDoctor());
            systemMessageDO.setSenderName(doctorDO.getName());
            systemMessageDO.setRelationCode(consultTeamDo.getConsult());
            systemMessageDO.setReceiver(consultTeamDo.getPatient());
            systemMessageDO.setReceiverName(consultTeamDo.getName());
           data = new JSONObject();
            try {
                data.put("name", outpatient.getPatientName());
                data.put("age", IdCardUtil.getAgeForIdcard(patientDO.getIdcard()));
                data.put("gender", IdCardUtil.getSexForIdcard_new(patientDO.getIdcard()));
                data.put("question", consultTeamDo.getSymptoms());
                data.put("msg", msg);
                data.put("type", type);
                systemMessageDO.setData(data.toString());
                systemMessageService.saveMessage(systemMessageDO);
            } catch (Exception e) {
                e.printStackTrace();
            }
            sendWxTemplateMsg(wechatId, "",consultTeamDo, type, "payRemind", "");
        }
        BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
            ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
        }
        sendWxTemplateMsg(wechatId, outpatient.getId(), type, "payRemind", null);
    }
@ -6372,7 +6444,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), messageDO.getTitle(), data.get("msg").toString());
            }
            sendWxTemplateMsg(wxId, outpatientDO.getId(), "", "prescriptionPayRemind", null);
            sendWxTemplateMsg(wxId, outpatientDO.getId(), null,"", "prescriptionPayRemind", "");
        } else {
            wlyyPrescriptionDO.setId(prescriptionId);
            wlyyPrescriptionDO.setCheckStatus(status);

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

@ -1527,7 +1527,7 @@ public class ImService {
			ykyyService.pushNotificationToYktPatient(patient.getYktId(),messageDO.getTitle(),data.get("msg").toString());
		}
		prescriptionService.sendWxTemplateMsg(wxId,cons.getRelationCode(),type,"evaluateRemind",null);
		prescriptionService.sendWxTemplateMsg(wxId,"",consultTeam,type,"evaluateRemind","");
	}

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

@ -440,10 +440,11 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				String msg= "";
				if (type==17){
					msg=re.getString("patientName")+",您好!您有一个视频咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
					prescriptionService.sendWxTemplateMsg(wxId,null,type+"","videoOrderRemind",null);
					prescriptionService.sendWxTemplateMsg(wxId,"",consult,type+"","videoOrderRemind","");
				}else {
					msg=re.getString("patientName")+",您好!您有一个图文咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
				}
				prescriptionService.saveInquirySystemMessage(null,consult);
				data.put("msg",msg);
				systemMessageDO.setData(data.toString());
				systemMessageService.saveMessage(systemMessageDO);