|
@ -11,6 +11,7 @@ import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
|
|
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
|
import com.yihu.wlyy.repository.patient.PatientDeviceDao;
|
|
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
|
|
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
|
|
import com.yihu.wlyy.service.app.device.DeviceDetailService;
|
|
import com.yihu.wlyy.service.app.device.DeviceDetailService;
|
|
import com.yihu.wlyy.service.app.device.DeviceWxMessageService;
|
|
import com.yihu.wlyy.service.app.device.DeviceWxMessageService;
|
|
@ -84,6 +85,8 @@ public class DoctorDeviceController extends BaseController {
|
|
private CommonUtil commonUtil;
|
|
private CommonUtil commonUtil;
|
|
@Autowired
|
|
@Autowired
|
|
private DeviceWxMessageService deviceWxMessageService;
|
|
private DeviceWxMessageService deviceWxMessageService;
|
|
|
|
@Autowired
|
|
|
|
private PatientDeviceDao patientDeviceDao;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private JmsTemplate jmsTemplate;
|
|
private JmsTemplate jmsTemplate;
|
|
@ -142,7 +145,7 @@ public class DoctorDeviceController extends BaseController {
|
|
deviceDetailService.updateAfterBinding(device,new Date(),flag);
|
|
deviceDetailService.updateAfterBinding(device,new Date(),flag);
|
|
Patient patient = patientDao.findByCode(device.getUser());
|
|
Patient patient = patientDao.findByCode(device.getUser());
|
|
//调用增加积分接口 海沧区的居民才能添加积分
|
|
//调用增加积分接口 海沧区的居民才能添加积分
|
|
if (flag && "350205".equals(patient.getTown())){
|
|
|
|
|
|
if (flag){
|
|
String creditDetail = "{\"tradeType\":\"HEALTH_TASK\",\"flag\":\"BIND\",\"tradeDirection\":1,\"status\":1,\"patientId\":\""+device.getUser()+"\",\"hospital\":\""+patient.getTown()+"\"}";
|
|
String creditDetail = "{\"tradeType\":\"HEALTH_TASK\",\"flag\":\"BIND\",\"tradeDirection\":1,\"status\":1,\"patientId\":\""+device.getUser()+"\",\"hospital\":\""+patient.getTown()+"\"}";
|
|
JSONObject jsonObject = JSONObject.parseObject(creditDetail);
|
|
JSONObject jsonObject = JSONObject.parseObject(creditDetail);
|
|
JSONObject response = creditLogService.insert(jsonObject);
|
|
JSONObject response = creditLogService.insert(jsonObject);
|
|
@ -236,8 +239,8 @@ public class DoctorDeviceController extends BaseController {
|
|
if(StringUtils.isNotBlank(pd.getDoctor())&&StringUtils.equals(pd.getDoctor(), getUID())){
|
|
if(StringUtils.isNotBlank(pd.getDoctor())&&StringUtils.equals(pd.getDoctor(), getUID())){
|
|
List<com.alibaba.fastjson.JSONObject> objects = patientDeviceService.deleteDevice(id,getUID());
|
|
List<com.alibaba.fastjson.JSONObject> objects = patientDeviceService.deleteDevice(id,getUID());
|
|
//全部解绑后去判断就更新设备表中是否绑定字段
|
|
//全部解绑后去判断就更新设备表中是否绑定字段
|
|
deviceDetailService.unBindUpdateIsBinding(pd.getDeviceSn());
|
|
|
|
patientDeviceLogService.savePatientDeviceLog(pd,pd.getDeviceSn(),1,2);
|
|
patientDeviceLogService.savePatientDeviceLog(pd,pd.getDeviceSn(),1,2);
|
|
|
|
deviceDetailService.unBindUpdateIsBinding(pd.getDeviceSn());
|
|
return write(200,"","data",objects);
|
|
return write(200,"","data",objects);
|
|
}
|
|
}
|
|
else if(StringUtils.isNotBlank(pd.getDoctor())&&!StringUtils.equals(pd.getDoctor(), getUID())){
|
|
else if(StringUtils.isNotBlank(pd.getDoctor())&&!StringUtils.equals(pd.getDoctor(), getUID())){
|
|
@ -249,8 +252,8 @@ public class DoctorDeviceController extends BaseController {
|
|
}
|
|
}
|
|
if(bo){//同行政团队
|
|
if(bo){//同行政团队
|
|
List<com.alibaba.fastjson.JSONObject> objects = patientDeviceService.deleteDevice(id,getUID());
|
|
List<com.alibaba.fastjson.JSONObject> objects = patientDeviceService.deleteDevice(id,getUID());
|
|
deviceDetailService.unBindUpdateIsBinding(pd.getDeviceSn());
|
|
|
|
patientDeviceLogService.savePatientDeviceLog(pd,pd.getDeviceSn(),1,2);
|
|
patientDeviceLogService.savePatientDeviceLog(pd,pd.getDeviceSn(),1,2);
|
|
|
|
deviceDetailService.unBindUpdateIsBinding(pd.getDeviceSn());
|
|
return write(200,"","data",objects);
|
|
return write(200,"","data",objects);
|
|
}else{
|
|
}else{
|
|
return error(-1, "只允许删除自己及自己行政团队绑定的设备!");
|
|
return error(-1, "只允许删除自己及自己行政团队绑定的设备!");
|
|
@ -280,10 +283,15 @@ public class DoctorDeviceController extends BaseController {
|
|
@ApiParam(name="type",value="设备类型")
|
|
@ApiParam(name="type",value="设备类型")
|
|
@RequestParam(value="type",required = true) String type) {
|
|
@RequestParam(value="type",required = true) String type) {
|
|
try{
|
|
try{
|
|
|
|
List<PatientDevice> patientDevices = patientDeviceDao.findByDeviceSnAndCategoryCode(deviceSn, type);
|
|
|
|
PatientDevice patientDevice = new PatientDevice();
|
|
|
|
if (patientDevices!=null && patientDevices.size()>0){
|
|
|
|
patientDevice = patientDevices.get(0);
|
|
|
|
}
|
|
patientDeviceService.deleteDevices(deviceSn,type,getUID());
|
|
patientDeviceService.deleteDevices(deviceSn,type,getUID());
|
|
//全部解绑后去判断就更新设备表中是否绑定字段
|
|
//全部解绑后去判断就更新设备表中是否绑定字段
|
|
|
|
patientDeviceLogService.savePatientDeviceLog(patientDevice,deviceSn,1,2);
|
|
deviceDetailService.unBindUpdateIsBinding(deviceSn);
|
|
deviceDetailService.unBindUpdateIsBinding(deviceSn);
|
|
patientDeviceLogService.savePatientDeviceLog(null,deviceSn,1,2);
|
|
|
|
return write(200,"解绑成功!");
|
|
return write(200,"解绑成功!");
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
error(e);
|
|
error(e);
|