|
@ -2,6 +2,7 @@ package com.yihu.wlyy.activemq;
|
|
|
|
|
|
import com.yihu.es.entity.HealthEduArticleES;
|
|
import com.yihu.es.entity.HealthEduArticleES;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.service.app.consult.ConsultService;
|
|
import com.yihu.wlyy.service.app.consult.ConsultService;
|
|
import com.yihu.wlyy.service.common.account.PatientService;
|
|
import com.yihu.wlyy.service.common.account.PatientService;
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
@ -15,6 +16,7 @@ import org.json.JSONArray;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.jms.JMSException;
|
|
import javax.jms.JMSException;
|
|
@ -42,6 +44,8 @@ public class HealthArtListener implements MessageListener {
|
|
private ConsultService consultService;
|
|
private ConsultService consultService;
|
|
@Autowired
|
|
@Autowired
|
|
private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
|
|
private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
|
|
|
|
@Autowired
|
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onMessage(Message message) {
|
|
public void onMessage(Message message) {
|
|
@ -121,8 +125,20 @@ public class HealthArtListener implements MessageListener {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 推送消息给微信端
|
|
// 推送消息给微信端
|
|
|
|
String technicalName = "";
|
|
|
|
if(2 == one.getSendType()){
|
|
|
|
String sql = "select * from wlyy_sign_family f where (f.doctor = '"+one.getDoctorCode()+"' or f.doctor_health = '"+one.getDoctorCode()+"') and f.patient='"+one.getPatientCode()+"' and f.`status`>0";
|
|
|
|
SignFamily signFamily = jdbcTemplate.queryForObject(sql, SignFamily.class);
|
|
|
|
if(signFamily!=null){
|
|
|
|
if(one.getDoctorCode().equals(signFamily.getDoctor())){
|
|
|
|
technicalName = "医生";
|
|
|
|
}else{
|
|
|
|
technicalName = "健管师";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
org.json.JSONObject json = new org.json.JSONObject();
|
|
org.json.JSONObject json = new org.json.JSONObject();
|
|
json.put("first", one.getPatientName() + ",您好! " + one.getSendName() + (one.getSendType()==2 ? "":"医生") +"给您发来了一篇患教文章");
|
|
|
|
|
|
json.put("first", one.getPatientName() + ",您好! " + one.getSendName() + technicalName +"给您发来了一篇患教文章");
|
|
json.put("toUser", one.getPatientCode());
|
|
json.put("toUser", one.getPatientCode());
|
|
json.put("article", one.getArticleId() + "");
|
|
json.put("article", one.getArticleId() + "");
|
|
json.put("title", one.getArticleTitle());
|
|
json.put("title", one.getArticleTitle());
|