|
@ -3,6 +3,7 @@ package com.yihu.wlyy.web.doctor.device;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.yihu.wlyy.aop.ObserverRequired;
|
|
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.PatientDevice;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
@ -30,11 +31,18 @@ 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.beans.factory.annotation.Value;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
|
import org.springframework.jms.core.JmsTemplate;
|
|
|
|
import org.springframework.jms.core.MessageCreator;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.jms.JMSException;
|
|
|
|
import javax.jms.Message;
|
|
|
|
import javax.jms.Session;
|
|
|
|
import javax.jms.TextMessage;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@ -52,16 +60,12 @@ public class DoctorDeviceController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private PatientDeviceService patientDeviceService;
|
|
private PatientDeviceService patientDeviceService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private DeviceDetailService deviceDetailService;
|
|
private DeviceDetailService deviceDetailService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private AdminTeamService adminTeamService;
|
|
private AdminTeamService adminTeamService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private CreditLogService creditLogService;
|
|
private CreditLogService creditLogService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private WechatTemplateConfigDao templateConfigDao;
|
|
private WechatTemplateConfigDao templateConfigDao;
|
|
@Autowired
|
|
@Autowired
|
|
@ -77,6 +81,11 @@ public class DoctorDeviceController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private CommonUtil commonUtil;
|
|
private CommonUtil commonUtil;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private JmsTemplate jmsTemplate;
|
|
|
|
@Value("${activemq.queue.deviceMeasurementRemindingQueue}")
|
|
|
|
private String channelName;
|
|
|
|
|
|
private ObjectMapper objectMapper=new ObjectMapper();
|
|
private ObjectMapper objectMapper=new ObjectMapper();
|
|
|
|
|
|
@ApiOperation("设备保存接口--医生端")
|
|
@ApiOperation("设备保存接口--医生端")
|
|
@ -104,8 +113,8 @@ public class DoctorDeviceController extends BaseController {
|
|
@RequestMapping(value = "SavePatientDeviceAndCredit",method = RequestMethod.POST)
|
|
@RequestMapping(value = "SavePatientDeviceAndCredit",method = RequestMethod.POST)
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@ObserverRequired
|
|
@ObserverRequired
|
|
public String SavePatientDeviceAndCredit(@ApiParam(name="data",value="设备数据json",defaultValue = "{\"user\":\"915cca0a-5b1d-11e6-834 4-fa163e8aee56\",\"deviceId\": \"3\",\"deviceName\": \"血压计-优瑞恩\",\"deviceSn\": \"16C000337\",\"categoryCode\": \"1\",\"userType\": \"-1\",\"agreementPhoto\":\"www.baidu.com\"}")
|
|
|
|
@RequestParam(value="data",required = true) String data) {
|
|
|
|
|
|
public String SavePatientDeviceAndCredit(@ApiParam(name="data",value="设备数据json",defaultValue = "{\"user\":\"915cca0a-5b1d-11e6-834 4-fa163e8aee56\",\"deviceId\": \"3\",\"deviceName\": \"血压计-优瑞恩\",\"deviceSn\": \"16C000337\",\"categoryCode\": \"1\",\"userType\": \"-1\"}") @RequestParam(value="data",required = true) String data,
|
|
|
|
@ApiParam(name = "agreementPhoto",value = "协议图片临时路径")@RequestParam(value = "agreementPhoto",required = true)String agreementPhoto) {
|
|
try {
|
|
try {
|
|
PatientDevice device = objectMapper.readValue(data,PatientDevice.class);
|
|
PatientDevice device = objectMapper.readValue(data,PatientDevice.class);
|
|
// 设置操作医生标识
|
|
// 设置操作医生标识
|
|
@ -114,8 +123,8 @@ public class DoctorDeviceController extends BaseController {
|
|
if (doctor!=null){
|
|
if (doctor!=null){
|
|
device.setDoctorName(doctor.getName());
|
|
device.setDoctorName(doctor.getName());
|
|
}
|
|
}
|
|
if (StringUtils.isNotEmpty(device.getAgreementPhoto())){
|
|
|
|
device.setAgreementPhoto(commonUtil.copyTempImage(device.getAgreementPhoto()));
|
|
|
|
|
|
if (StringUtils.isNotEmpty(agreementPhoto)){
|
|
|
|
device.setAgreementPhoto(commonUtil.copyTempImage(agreementPhoto));
|
|
}
|
|
}
|
|
//首绑和设备类型判断 判断是否可以增加积分
|
|
//首绑和设备类型判断 判断是否可以增加积分
|
|
Map<String,Object> checkMap = patientDeviceService.checkBindingFirstAndType(device);
|
|
Map<String,Object> checkMap = patientDeviceService.checkBindingFirstAndType(device);
|
|
@ -400,9 +409,10 @@ public class DoctorDeviceController extends BaseController {
|
|
@RequestMapping(value = "/getDevicesList",method = RequestMethod.GET)
|
|
@RequestMapping(value = "/getDevicesList",method = RequestMethod.GET)
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@ApiOperation(value = "医生端-设备管理中设备列表",notes = "设备列表")
|
|
@ApiOperation(value = "医生端-设备管理中设备列表",notes = "设备列表")
|
|
public String getDevicesList(@ApiParam(value = "未测量天数(1今日为测量 2七天未测量 3本月未测量 4超过一个月未测量)", name = "noGaugeDay") @RequestParam(value = "noGaugeDay",required = false)String noGaugeDay,
|
|
|
|
@ApiParam(value = "是否绑定(1绑定 2解绑)", name = "isBinding") @RequestParam(value = "isBinding",required = false)String isBinding,
|
|
|
|
@ApiParam(value = "设备类型(1血糖仪 2血压计)", name = "categoryCode") @RequestParam(value = "categoryCode",required = false)String categoryCode,
|
|
|
|
|
|
public String getDevicesList(@ApiParam(value = "未测量天数(1今日为测量 2七天未测量 3本月未测量 4超过一个月未测量)", name = "noGaugeDay") @RequestParam(value = "noGaugeDay",required = true)String noGaugeDay,
|
|
|
|
@ApiParam(value = "是否绑定(1绑定 2解绑)", name = "isBinding") @RequestParam(value = "isBinding",required = true)String isBinding,
|
|
|
|
@ApiParam(value = "设备类型(1血糖仪 2血压计)", name = "categoryCode") @RequestParam(value = "categoryCode",required = true)String categoryCode,
|
|
|
|
@ApiParam(value = "今日是否发送消息(1未发送 2已发送)", name = "isSend") @RequestParam(value = "isSend",required = true)String isSend,
|
|
@ApiParam(name="page",value="第几页",defaultValue = "1") @RequestParam(value="page",required = true) String page,
|
|
@ApiParam(name="page",value="第几页",defaultValue = "1") @RequestParam(value="page",required = true) String page,
|
|
@ApiParam(name="pageSize",value="",defaultValue = "10") @RequestParam(value="pageSize",required = true) String pageSize) {
|
|
@ApiParam(name="pageSize",value="",defaultValue = "10") @RequestParam(value="pageSize",required = true) String pageSize) {
|
|
if (StringUtils.isBlank(pageSize)) {
|
|
if (StringUtils.isBlank(pageSize)) {
|
|
@ -412,10 +422,33 @@ public class DoctorDeviceController extends BaseController {
|
|
page = "1";
|
|
page = "1";
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
return write(200,"查找成功!","data",patientDeviceLogService.getDevicesList(noGaugeDay,isBinding,categoryCode,Integer.valueOf(page),Integer.valueOf(pageSize)));
|
|
|
|
|
|
return write(200,"查找成功!","data",patientDeviceLogService.getDevicesList(noGaugeDay,isBinding,categoryCode,isSend,Integer.valueOf(page),Integer.valueOf(pageSize)));
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
error(e);
|
|
error(e);
|
|
return error( -1, "查询失败!");
|
|
return error( -1, "查询失败!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(value = "/sendDeviceWxMessage",method = RequestMethod.POST)
|
|
|
|
@ApiOperation("给没有测量的居民发送微信消息提醒")
|
|
|
|
@ResponseBody
|
|
|
|
public String sendDevcieWxMessage(){
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
public void sender(List<DeviceWxMessage> deviceWxMessageList){
|
|
|
|
//发送到队列
|
|
|
|
deviceWxMessageList.stream().forEach(one->{
|
|
|
|
jmsTemplate.send(channelName, new MessageCreator() {
|
|
|
|
@Override
|
|
|
|
public Message createMessage(Session session) throws JMSException {
|
|
|
|
TextMessage textMessage = session.createTextMessage();
|
|
|
|
textMessage.setText(net.sf.json.JSONObject.fromObject(one).toString());
|
|
|
|
return textMessage;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|