|
@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.wlyy.aop.ObserverRequired;
|
|
|
import com.yihu.wlyy.entity.device.DeviceWxMessage;
|
|
|
import com.yihu.wlyy.entity.device.PatientDevice;
|
|
|
import com.yihu.wlyy.entity.device.vo.DeviceWxMessageDTO;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
@ -12,6 +13,7 @@ import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
|
|
|
import com.yihu.wlyy.service.app.device.DeviceDetailService;
|
|
|
import com.yihu.wlyy.service.app.device.DeviceWxMessageService;
|
|
|
import com.yihu.wlyy.service.app.device.PatientDeviceLogService;
|
|
|
import com.yihu.wlyy.service.app.device.PatientDeviceService;
|
|
|
import com.yihu.wlyy.service.app.team.AdminTeamService;
|
|
@ -80,11 +82,13 @@ public class DoctorDeviceController extends BaseController {
|
|
|
private PatientDeviceLogService patientDeviceLogService;
|
|
|
@Autowired
|
|
|
private CommonUtil commonUtil;
|
|
|
@Autowired
|
|
|
private DeviceWxMessageService deviceWxMessageService;
|
|
|
|
|
|
@Autowired
|
|
|
private JmsTemplate jmsTemplate;
|
|
|
@Value("${activemq.queue.deviceMeasurementRemindingQueue}")
|
|
|
private String channelName;
|
|
|
private String devcieChannelName;
|
|
|
|
|
|
private ObjectMapper objectMapper=new ObjectMapper();
|
|
|
|
|
@ -422,7 +426,7 @@ public class DoctorDeviceController extends BaseController {
|
|
|
page = "1";
|
|
|
}
|
|
|
try {
|
|
|
return write(200,"查找成功!","data",patientDeviceLogService.getDevicesList(noGaugeDay,isBinding,categoryCode,isSend,Integer.valueOf(page),Integer.valueOf(pageSize)));
|
|
|
return write(200,"查找成功!","data",patientDeviceLogService.getDevicesList(getUID(),noGaugeDay,isBinding,categoryCode,isSend,Integer.valueOf(page),Integer.valueOf(pageSize)));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error( -1, "查询失败!");
|
|
@ -432,14 +436,22 @@ public class DoctorDeviceController extends BaseController {
|
|
|
@RequestMapping(value = "/sendDeviceWxMessage",method = RequestMethod.POST)
|
|
|
@ApiOperation("给没有测量的居民发送微信消息提醒")
|
|
|
@ResponseBody
|
|
|
public String sendDevcieWxMessage(){
|
|
|
return "";
|
|
|
public String sendDevcieWxMessage(@ApiParam(name = "data",value = "[{\"patient\":\"1\",\"deviceName\":\"同学1\",\"deviceSn\":\"123\",\"categoryCode\":\"1\"}]")
|
|
|
@RequestParam(value = "data",required = true)String data){
|
|
|
try {
|
|
|
List<DeviceWxMessageDTO> deviceWxMessageDTOList = deviceWxMessageService.batchSaveAndSendActiveMq(data);
|
|
|
sender(deviceWxMessageDTOList);
|
|
|
return write(200,"提醒成功!");
|
|
|
}catch (Exception e){
|
|
|
error(e);
|
|
|
return error( -1, "提醒失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void sender(List<DeviceWxMessage> deviceWxMessageList){
|
|
|
public void sender(List<DeviceWxMessageDTO> deviceWxMessageList){
|
|
|
//发送到队列
|
|
|
deviceWxMessageList.stream().forEach(one->{
|
|
|
jmsTemplate.send(channelName, new MessageCreator() {
|
|
|
jmsTemplate.send(devcieChannelName, new MessageCreator() {
|
|
|
@Override
|
|
|
public Message createMessage(Session session) throws JMSException {
|
|
|
TextMessage textMessage = session.createTextMessage();
|