Browse Source

代码修改

liubing 3 years ago
parent
commit
df3e8df625

+ 2 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java

@ -24,7 +24,8 @@ public class ConsultTeamDo extends UuidIdentityEntity {
	// 6、患者名医咨询 7医生名医咨询 8续方咨询 9、16在线复诊咨询(居民直接咨询专家)
	// 10医生发起的求助 11思明区上门服务在线咨询
	// 13、互联网医院专家咨询, 20紧急救助咨询, 21上门辅导咨询, 22安防警报咨询
	// 23 在线咨询
	// 23 新生儿在线咨询
	// 24 老人在线咨询
	private String patient;         // 提问者标识
	private String name;            // 患者姓名
	private Integer sex;            // 患者性别

+ 3 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java

@ -19,7 +19,9 @@ public class SystemMessageDO extends UuidIdentityEntity {
    /**
     *消息类型 上门服务400开头,生活照料500开头 ,安防监控600开头, 上门辅导700开头,紧急救助800开头
     * 在线咨询 850
     * 家属紧急预警系统消息 50
     * 新生儿在线咨询 850
     * 老人在线咨询 851
     */
    private String type;
    /**

+ 20 - 8
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.endpoint.consult;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.course.DoctorPatientTmpDao;
import com.yihu.jw.care.service.consult.ConsultService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
@ -10,6 +11,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.care.course.DoctorPatientTmpDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.family.service.WlyyFamilyMemberService;
@ -111,12 +113,14 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "sessionId", value = "会话id")
            @RequestParam(value = "sessionId",required = false) String sessionId,
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient)throws Exception {
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type)throws Exception {
		try {
			if (StringUtils.isBlank(orgCode)&&StringUtils.isBlank(sessionId)){
				return Envelop.getError("参数错误请求失败");
			}
			return success("请求成功",consultService.findLastOnlineConsult(patient, orgCode,sessionId));
			return success("请求成功",consultService.findLastOnlineConsult(patient, orgCode,sessionId,type));
		}catch (Exception e){
			return failedException(e);
		}
@ -128,9 +132,11 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "doctor", value = "医生CODE")
			@RequestParam(value = "doctor",required = false) String doctor,
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient)throws Exception {
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type)throws Exception {
		try {
			String consultCode = consultService.getUnfinishedConsult(patient, doctor);
			String consultCode = consultService.getUnfinishedConsult(patient, doctor, type);
			return success("请求成功",consultCode);
		}catch (Exception e){
			return failedException(e);
@ -150,7 +156,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "images",required = false) String images,
			@ApiParam(name = "voice", value = "语音")
			@RequestParam(value = "voice",required = false) String voice,
			@ApiParam(name = "type", value = "咨询类型:23在线咨询")
			@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询")
			@RequestParam(value = "type",required = false) Integer type,
			@ApiParam(name = "source", value = "咨询类型来源")
			@RequestParam(value = "source",required = false) String source)throws Exception{
@ -161,7 +167,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			type = 23;
		}
		ConsultTeamDo consult = new ConsultTeamDo();
		// 设置咨询类型:23 在线咨询
		// 设置咨询类型:23 在线咨询 24老人在线咨询
		consult.setType(type);
		// 设置主要症状
		consult.setSymptoms(symptoms);
@ -179,6 +185,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			SystemMessageDO systemMessageDO = new SystemMessageDO();
			systemMessageDO.setTitle("新增在线咨询");
			systemMessageDO.setType("850");
			if (type==24){
				systemMessageDO.setType("851");
			}
			systemMessageDO.setReceiver(re.getString("doctor"));
			systemMessageDO.setReceiverName(re.getString("doctorName"));
			systemMessageDO.setRelationCode(re.getString("sessiond_id"));
@ -192,6 +201,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			data.put("question",symptoms);
			data.put("type",1);
			systemMessageDO.setData(data.toString());
			consultService.saveMessage(systemMessageDO);
		}
@ -205,12 +215,14 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name = "orgCode", value = "机构code")
			@RequestParam(value = "orgCode",required = true) String orgCode,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type,
			@ApiParam(name = "page", value = "第几页")
			@RequestParam(value = "page",required = false) int page,
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize)throws Exception{
		try {
			List<Map<String,Object>>  data = consultService.findConsultDoctor(orgCode, patient, page,pagesize);
			List<Map<String,Object>>  data = consultService.findConsultDoctor(orgCode, patient,type,page,pagesize);
			return success(data);
		}catch (Exception e){
			return failedException(e);
@ -228,7 +240,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "symptoms",required = false) String symptoms,
			@ApiParam(name = "id", value = "咨询ID")
			@RequestParam(value = "id",required = false) String id,
			@ApiParam(name = "type", value = "咨询类型")
			@ApiParam(name = "type", value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@RequestParam(value = "type",required = true) String type,
			@ApiParam(name = "status", value = "咨询状态:0进行中,1已完成,-1患者取消,-2超时未响应自动关闭")
			@RequestParam(value = "status",required = false) Integer status,

+ 26 - 11
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultService.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.service.consult;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.course.DoctorPatientTmpDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -10,6 +11,7 @@ import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamDoctorDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.course.DoctorPatientTmpDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
@ -69,13 +71,15 @@ public class ConsultService {
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private DoctorPatientTmpDao doctorPatientTmpDao;
    /**
     * 获取居民该机构的最近一次在线咨询
     * @param patient
     * @param orgCode
     */
    public Map<String,Object> findLastOnlineConsult(String patient,String orgCode,String sessionId){
    public Map<String,Object> findLastOnlineConsult(String patient,String orgCode,String sessionId,Integer type){
        Map<String,Object> map = new HashedMap();
        String sql = "SELECT " +
                " b.consult,b.doctor, " +
@ -86,7 +90,7 @@ public class ConsultService {
                "WHERE " +
                " b.doctor = h.doctor_code " +
                "AND b.patient = '"+patient+"' " +
                "AND b.type = 23 ";
                "AND b.type = "+type;
        if(StringUtils.isEmpty(orgCode)){
            String doctor = sessionId.split("_")[1];
            sql += "AND b.doctor = '"+doctor+"' ";
@ -97,7 +101,7 @@ public class ConsultService {
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list.size()>0){
            map = list.get(0);
            map.put("sessionId",patient+"_"+String.valueOf(map.get("doctor"))+"_23");
            map.put("sessionId",patient+"_"+String.valueOf(map.get("doctor"))+"_"+type);
            BaseDoctorDO doctorDO = baseDoctorDao.findById(String.valueOf(map.get("doctor")));
            map.put("doctorName",doctorDO.getName());
        }
@ -222,7 +226,7 @@ public class ConsultService {
        Map<String,Integer> unreadNum = new HashedMap();
        for (Map<String,Object> map:result){
            if(type.equals(ImUtil.SESSION_TYPE_ONLINE)){
                String sessionId = patient+"_"+String.valueOf(map.get("doctorCode"))+"_23";
                String sessionId = patient+"_"+String.valueOf(map.get("doctorCode"))+"_"+type;
                //新增未读消息数量
                if(unreadNum.containsKey(sessionId)){
                    map.put("count",0);
@ -347,7 +351,7 @@ public class ConsultService {
     * @param patient
     * @return
     */
    public List<Map<String,Object>> findConsultDoctor(String orgCode,String patient,int page,int pagesize){
    public List<Map<String,Object>> findConsultDoctor(String orgCode,String patient,Integer type,int page,int pagesize){
        String sql = "SELECT  DISTINCT " +
                " a.type AS type, " +
                " d.name AS doctorName, " +
@ -359,7 +363,7 @@ public class ConsultService {
                " FROM wlyy_consult a,wlyy_consult_team b, " +
                " base_doctor d,base_doctor_hospital h  " +
                " WHERE a.id=b.consult and d.id = h.doctor_code  " +
                " AND b.doctor=d.id  AND a.type = 23 and h.org_code = '"+orgCode+"' " +
                " AND b.doctor=d.id  AND a.type = "+type+" and h.org_code = '"+orgCode+"' " +
                " and a.patient = '"+patient +"' "+
                " ORDER BY a.czrq desc";
        List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,pagesize);
@ -456,7 +460,7 @@ public class ConsultService {
            }
            if(type.equals(ImUtil.SESSION_TYPE_ONLINE)){
                String sessionId = String.valueOf(map.get("patient"))+"_"+doctor+"_23";
                String sessionId = String.valueOf(map.get("patient"))+"_"+doctor+"_"+type;
                //新增未读消息数量
                Integer count = imUtil.UserSessionsUnreadMessageCount(sessionId,doctor);
                map.put("sessionId",sessionId);
@ -495,7 +499,7 @@ public class ConsultService {
     */
    public JSONObject addTeamConsult(ConsultTeamDo ct, String patient, String doctor, String source) throws Exception {
        JSONObject re = new JSONObject();
        boolean boo = StringUtils.isEmpty(getUnfinishedConsult(patient, doctor));
        boolean boo = StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()));
        logger.info("boo"+boo);
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("consultClose");
        boolean flag = false;
@ -505,7 +509,7 @@ public class ConsultService {
            }
        }
        if (!flag){
            if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor))) {
            if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()))) {
                throw new RuntimeException("居民还有未结束的在线咨询!");
            }
        }
@ -584,6 +588,17 @@ public class ConsultService {
            consultTeamDoctorDao.save(cd);
        }
        if (ct.getType()==23){
            DoctorPatientTmpDO tmpDO = new DoctorPatientTmpDO();
            tmpDO.setDoctorCode(doctor);
            tmpDO.setPatient(patient);
            tmpDO.setType(1);
            tmpDO.setRelationCode(ct.getConsult());
            doctorPatientTmpDao.save(tmpDO);
        }
        // 保存医生咨询信息
        // 添加咨询转发记录
        // 添加医生咨询日志
@ -607,7 +622,7 @@ public class ConsultService {
     * @param doctor  医生
     * @return
     */
    public String  getUnfinishedConsult(String patient, String doctor) {
    public String  getUnfinishedConsult(String patient, String doctor,Integer type) {
        String totalSql = "SELECT a.consult as \"consultCode\" " +
                "FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
@ -615,7 +630,7 @@ public class ConsultService {
                "AND a.patient= '" +patient+"' "+
//                "AND b.to_doctor='" +doctor+"' "+
                "AND a.del='1' " +
                "AND type = 23 " +
                "AND type = "+type+" " +
                "AND a.status=0";
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);

+ 9 - 8
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java

@ -315,22 +315,22 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        List<Map<String,Object>> list = new ArrayList<>();
        //未入学
        String sql0 = "select * from  " +
                " (select Distinct patient from base_doctor_patient_tmp where type=1 and doctor_code='"+doctor+"' and del=1 " +
                " (select Distinct patient,'1' as type from base_doctor_patient_tmp where type=1 and doctor_code='"+doctor+"' and del=1 " +
                " UNION " +
                " select Distinct patient from base_doctor_patient_tmp where type=2 and doctor_code='"+doctor+"' and del=1 " +
                " select Distinct patient,'2' as type from base_doctor_patient_tmp where type=2 and doctor_code='"+doctor+"' and del=1 " +
                " UNION " +
                " select Distinct patient from base_doctor_patient_tmp where type=4 and doctor_code='"+doctor+"' and del=1 " +
                " select Distinct patient,'4' as type from base_doctor_patient_tmp where type=4 and doctor_code='"+doctor+"' and del=1 " +
                " UNION " +
                " select tmp.patient from base_doctor_patient_tmp tmp INNER JOIN base_doctor_hospital dh on dh.org_code = tmp.doctor_code " +
                " select tmp.patient,'3' as type from base_doctor_patient_tmp tmp INNER JOIN base_doctor_hospital dh on dh.org_code = tmp.doctor_code " +
                " and dh.del =1 where tmp.type=3 and dh.doctor_code='"+doctor+"' and tmp.del=1 and tmp.`status`=0)B where  " +
                " not EXISTS (select DISTINCT rsr.patient  from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " +
                " and org.del=1  INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where rsr.patient=B.patient and " +
                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 2 )";
        //已入学
        String sql1=" select DISTINCT rsr.patient from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " +
        String sql1=" select DISTINCT rsr.patient,null as type from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " +
                "and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where dh.doctor_code='"+doctor+"' " +
                "and rsr.del<>0  and rsr.`status` = 2   ";
        String sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp " +
        String sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat(tmp.type) type,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp " +
                " Inner JOIN base_patient p on tmp.patient  = p.id " +
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 GROUP BY p.id limit "+page*size+","+size;
        String sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
@ -338,7 +338,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        Long count = 0L;
        if (StringUtils.isNotBlank(name)){
             sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp " +
             sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat(tmp.type) type,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp " +
                     " Inner JOIN base_patient p on tmp.patient  = p.id and p.name like '%"+name+"%' " +
                     " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 " +
                     " GROUP BY p.id limit "+page*size+","+size;
@ -422,7 +422,8 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            object.put("unreadMessageCount",unreadMessageCount);//未读消息数量
            object.put("doorCoachOrder",coachOrderDOList.size());//上门辅导待完成数量
            Integer unConsultMsgCount = imService.SessionsUnreadMessageCount(doctor,"23");
            object.put("unConsultMsgCount",unConsultMsgCount);//咨询未读消息数量
            Integer unConsultMsgCount2 = imService.SessionsUnreadMessageCount(doctor,"24");
            object.put("unConsultMsgCount",unConsultMsgCount+unConsultMsgCount2);//咨询未读消息数量
            return object;
//        }

+ 2 - 2
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/consult/FinishConsultJob.java

@ -59,7 +59,7 @@ public class FinishConsultJob implements Job {
            sql.append("SELECT s.id session_id, s.name session_name, s.create_date session_create_time, s.last_message_time, ")
            .append("t.id topic_id, t.name topic_name, t.create_time topic_create_time, t.start_message_id ")
            .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
            .append("WHERE s.id = t.session_id AND s.type=23  AND t.end_message_id IS NULL AND s.last_content_type in(1,2,3,4,15,16,17) and s.last_sender_id IN ( ")
            .append("WHERE s.id = t.session_id AND s.type in(23,24)  AND t.end_message_id IS NULL AND s.last_content_type in(1,2,3,4,15,16,17) and s.last_sender_id IN ( ")
            .append("SELECT id FROM ").append(imDb).append(".doctors d where d.id<>t.patient) ")
            .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600 ")
            .append("ORDER BY t.create_time");
@ -82,7 +82,7 @@ public class FinishConsultJob implements Job {
            sql = new StringBuffer();
            sql.append("SELECT s.id session_id,t.id topic_id, t.name topic_name ")
             .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
             .append("WHERE s.id = t.session_id AND s.type=23 AND t.end_message_id IS NULL AND t.reply=1 AND s.last_content_type =14 ")
             .append("WHERE s.id = t.session_id AND s.type in (23,24) AND t.end_message_id IS NULL AND t.reply=1 AND s.last_content_type =14 ")
             .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600  ");
            StringBuffer sql2 = new StringBuffer();

+ 73 - 64
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/MessageUtil.java

@ -14,6 +14,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
@ -32,75 +33,80 @@ public class MessageUtil {
    @Autowired
    private TXYSmsService txySmsService;
    @Value("${sendTXMessage.flag}")
    private Boolean sendTXMessageFlag;
    private static Logger logger = LoggerFactory.getLogger(MessageUtil.class);
    public void putTemplateWxMessage(String wechatId, String templateName, String scene, String openId, String first
            ,String url, String remark, Integer type,JSONObject json,String ...keywords) {
        try {
            System.out.println(wechatId);
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            if (sendTXMessageFlag){
                System.out.println(wechatId);
                WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            if (wxAccessTokenDO == null) {
                logger.info("wx_access_token表获取为空,wechatId" + wechatId);
                return;
            }
            WxTemplateConfigDO templateConfig = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, templateName, scene, 1);
            WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
            BeanUtils.copyProperties(templateConfig,newConfig);
            if (newConfig == null) {
                logger.info("微信模板不存在!请确认wechatId:" + wechatId + ",templateName:" + templateName + ",scene:" + scene);
                return;
            }
            logger.info("微信模板推送前");
            if (StringUtils.isNoneBlank(first)){
                newConfig.setFirst(first);
            }
            if (StringUtils.isNoneBlank(url)){
                newConfig.setUrl(url);
            }
            if (StringUtils.isNoneBlank(remark)){
                newConfig.setRemark(remark);
            }
            newConfig = setTemPlateUrl(newConfig,type,openId,json);
            int keyLength = keywords.length;
            if (keyLength >= 1) {
                if(StringUtils.isNoneBlank(keywords[0])){
                    newConfig.setKeyword1(keywords[0]);
                if (wxAccessTokenDO == null) {
                    logger.info("wx_access_token表获取为空,wechatId" + wechatId);
                    return;
                }
            }
            if (keyLength >= 2) {
                if(StringUtils.isNoneBlank(keywords[1])){
                    newConfig.setKeyword2(keywords[1]);
                WxTemplateConfigDO templateConfig = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, templateName, scene, 1);
                WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                BeanUtils.copyProperties(templateConfig,newConfig);
                if (newConfig == null) {
                    logger.info("微信模板不存在!请确认wechatId:" + wechatId + ",templateName:" + templateName + ",scene:" + scene);
                    return;
                }
            }
            if (keyLength >= 3) {
                if(StringUtils.isNoneBlank(keywords[2])){
                    newConfig.setKeyword3(keywords[2]);
                logger.info("微信模板推送前");
                if (StringUtils.isNoneBlank(first)){
                    newConfig.setFirst(first);
                }
            }
            if (keyLength >= 4) {
                if(StringUtils.isNoneBlank(keywords[3])){
                    newConfig.setKeyword4(keywords[3]);
                if (StringUtils.isNoneBlank(url)){
                    newConfig.setUrl(url);
                }
            }
            if (keyLength >= 5) {
                if(StringUtils.isNoneBlank(keywords[4])){
                    newConfig.setKeyword5(keywords[4]);
                if (StringUtils.isNoneBlank(remark)){
                    newConfig.setRemark(remark);
                }
            }
            if (keyLength >= 6) {
                if(StringUtils.isNoneBlank(keywords[5])){
                    newConfig.setKeyword6(keywords[5]);
                newConfig = setTemPlateUrl(newConfig,type,openId,json);
                int keyLength = keywords.length;
                if (keyLength >= 1) {
                    if(StringUtils.isNoneBlank(keywords[0])){
                        newConfig.setKeyword1(keywords[0]);
                    }
                }
            }
            if (keyLength >= 7) {
                if(StringUtils.isNoneBlank(keywords[6])){
                    newConfig.setKeyword7(keywords[6]);
                if (keyLength >= 2) {
                    if(StringUtils.isNoneBlank(keywords[1])){
                        newConfig.setKeyword2(keywords[1]);
                    }
                }
                if (keyLength >= 3) {
                    if(StringUtils.isNoneBlank(keywords[2])){
                        newConfig.setKeyword3(keywords[2]);
                    }
                }
                if (keyLength >= 4) {
                    if(StringUtils.isNoneBlank(keywords[3])){
                        newConfig.setKeyword4(keywords[3]);
                    }
                }
                if (keyLength >= 5) {
                    if(StringUtils.isNoneBlank(keywords[4])){
                        newConfig.setKeyword5(keywords[4]);
                    }
                }
                if (keyLength >= 6) {
                    if(StringUtils.isNoneBlank(keywords[5])){
                        newConfig.setKeyword6(keywords[5]);
                    }
                }
                if (keyLength >= 7) {
                    if(StringUtils.isNoneBlank(keywords[6])){
                        newConfig.setKeyword7(keywords[6]);
                    }
                }
                //发起微信消息模板推送
                weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), openId, newConfig);
                logger.info("微信模板消息推送后");
            }
            //发起微信消息模板推送
            weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), openId, newConfig);
            logger.info("微信模板消息推送后");
        } catch (Exception e) {
            logger.info("微信模板推送异常");
            e.printStackTrace();
@ -121,15 +127,18 @@ public class MessageUtil {
    }
    public String sendTXYSJson(String templateCode,String mobile,String ...params)throws Exception{
        JSONObject sendObj = new JSONObject();
        sendObj.put("templateCode",templateCode);
        if (params.length>0){
            JSONArray paramArr =JSONArray.parseArray(JSON.toJSONString(params));
            sendObj.put("templateParamArr",paramArr);
        }else {
            JSONArray paramArr =new JSONArray();
            sendObj.put("templateParamArr",paramArr);
        if (sendTXMessageFlag){
            JSONObject sendObj = new JSONObject();
            sendObj.put("templateCode",templateCode);
            if (params.length>0){
                JSONArray paramArr =JSONArray.parseArray(JSON.toJSONString(params));
                sendObj.put("templateParamArr",paramArr);
            }else {
                JSONArray paramArr =new JSONArray();
                sendObj.put("templateParamArr",paramArr);
            }
            return txySmsService.sendMessageJson(mobile,sendObj);
        }
        return txySmsService.sendMessageJson(mobile,sendObj);
        return null;
    }
}

+ 5 - 7
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/web/JobController.java

@ -257,14 +257,12 @@ public class JobController extends BaseController {
    @RequestMapping(value = "/testNow", method = RequestMethod.POST)
    @ApiOperation("立即执行")
    public String executeSignFamilyPayResultJob() {
    public String executeSignFamilyPayResultJob(String className) {
        try {
//            quartzHelper.removeJob("finish_consult_job3");
//            quartzHelper.removeJob("finish_consult_job4");
            quartzHelper.removeJob("PATIENT_SEND_UNREAD_MES_JOB3");
//            quartzHelper.startNow(FinishConsultJob.class, "finish_consult_job3", null);
//            quartzHelper.startNow(DoctorSendUnreadJob.class, "finish_consult_job4", null);
            quartzHelper.startNow(PatientSendUnreadJob.class, "PATIENT_SEND_UNREAD_MES_JOB3", null);
            String uuid = getUID();
            Class c1 = Class.forName(className);//com.yihu.jw.care.job.consult.FinishConsultJob
            quartzHelper.startNow(c1, uuid, null);
            quartzHelper.removeJob(uuid);
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);

+ 10 - 0
svr/svr-cloud-job/src/main/resources/application.yml

@ -100,6 +100,10 @@ cloudServer:
  server_url: http://172.26.0.107:10301/
pay:
  flag: true
##是否发送短信消息 无测试公众号测试线也不发送模板消息
sendTXMessage:
  flag: false
---
spring:
  profiles: jwprod
@ -142,6 +146,9 @@ cloudServer:
  server_url: http://172.26.0.12:10301/
pay:
  flag: true
##是否发送短信消息
sendTXMessage:
  flag: true
---
spring:
  profiles: hzprod
@ -197,3 +204,6 @@ cloudServer:
  server_url: http://10.18.43.41:10301/
pay:
  flag: true
##是否发送短信消息
sendTXMessage:
  flag: true