|
@ -1,20 +1,18 @@
|
|
|
package com.yihu.jw.care.endpoint.device;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.care.aop.ObserverRequired;
|
|
|
import com.yihu.jw.care.dao.device.PatientDeviceDao;
|
|
|
import com.yihu.jw.care.endpoint.BaseController;
|
|
|
import com.yihu.jw.care.service.common.PermissionService;
|
|
|
import com.yihu.jw.care.service.contacts.ContactsService;
|
|
|
import com.yihu.jw.care.service.device.DeviceDetailService;
|
|
|
import com.yihu.jw.care.service.device.DeviceManageService;
|
|
|
import com.yihu.jw.care.service.device.PatientDeviceService;
|
|
|
import com.yihu.jw.care.util.CommonUtil;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.care.useragent.UserAgent;
|
|
|
import com.yihu.jw.entity.care.device.DevicePatientDevice;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.entity.patient.BaseDeviceRepairEntity;
|
|
|
import com.yihu.jw.restmodel.ResponseContant;
|
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
@ -23,10 +21,11 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.jms.core.JmsTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@ -44,20 +43,13 @@ public class DoctorDeviceController extends BaseController {
|
|
|
@Autowired
|
|
|
private PatientDeviceService patientDeviceService;
|
|
|
@Autowired
|
|
|
private DeviceDetailService deviceDetailService;
|
|
|
DeviceManageService deviceManageService;
|
|
|
@Autowired
|
|
|
private BasePatientDao patientDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorDao doctorDao;
|
|
|
@Autowired
|
|
|
private CommonUtil commonUtil;
|
|
|
@Autowired
|
|
|
private PatientDeviceDao patientDeviceDao;
|
|
|
|
|
|
@Autowired
|
|
|
private JmsTemplate jmsTemplate;
|
|
|
PermissionService permissionService;
|
|
|
@Autowired
|
|
|
private ContactsService contactsService;
|
|
|
@Autowired
|
|
|
UserAgent userAgent;
|
|
|
|
|
|
|
|
|
private ObjectMapper objectMapper=new ObjectMapper();
|
|
@ -153,5 +145,141 @@ public class DoctorDeviceController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/getDeviceList", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "获取居民设备绑定列表")
|
|
|
public String getDeviceList(@ApiParam(name = "doctor", value = "医生code")
|
|
|
@RequestParam(value = "doctor", required = false) String doctor,
|
|
|
@ApiParam(name = "patientName", value = "居民名字或者idCard")
|
|
|
@RequestParam(value = "patientName", required = false) String patientName,
|
|
|
@ApiParam(name = "categoryCode", value = "设备类型标识 1血糖仪,2.血压计,3药盒,4智能手表,7 = 居家报警器,12 监控器 13 睡眠带 14气感报警器 15烟感报警器 16拐杖 17随身wifi")
|
|
|
@RequestParam(value = "categoryCode", required = false) String categoryCode,
|
|
|
@ApiParam(name = "page", value = "分页起始id", defaultValue = "1")
|
|
|
@RequestParam(value = "page", required = true) int page,
|
|
|
@ApiParam(name = "pagesize", value = "每页条数", defaultValue = "10")
|
|
|
@RequestParam(value = "pagesize", required = true) int pagesize) {
|
|
|
|
|
|
List<Map<String, Object>> deviceList = null;
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("doctorId",doctor);
|
|
|
if(permissionService.noPermission(2,param)){
|
|
|
return write(-1,"该操作没有权限");
|
|
|
}
|
|
|
return write(200,"成功","data",deviceManageService.getDeviceList(doctor, patientName, categoryCode, page, pagesize));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return errorResult(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/getDeviceInfo",method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "设备详细信息")
|
|
|
public String getDeviceInfo(@ApiParam(name = "patient",value = "居民code")
|
|
|
@RequestParam(value = "patient")String patient,
|
|
|
@ApiParam(name = "deviceSn",value = "设备SN码")
|
|
|
@RequestParam(value = "deviceSn")String deviceSn){
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("doctorId",permissionService.getUID());
|
|
|
if(permissionService.noPermission(2,param)){
|
|
|
return write(-1,"该操作没有权限");
|
|
|
}
|
|
|
|
|
|
|
|
|
org.json.JSONObject result = deviceManageService.getDeviceInfo(patient, deviceSn);
|
|
|
if (result.getInt(ResponseContant.resultFlag)==ResponseContant.success){
|
|
|
return write(200,"获取成功","data", JSON.parseObject(result.getString(ResponseContant.resultMsg)));
|
|
|
}else {
|
|
|
return error(-1,result.getString(ResponseContant.resultMsg));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return errorResult(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/getMonitoring",method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "监护信息")
|
|
|
public String getMonitoring(@ApiParam(name = "patient", value = "居民code")
|
|
|
@RequestParam(value = "patient") String patient,
|
|
|
@ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典", required = false)
|
|
|
@RequestParam(value = "topicItem",required = false,defaultValue = "preventLost") String topicItem){
|
|
|
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("doctorId",permissionService.getUID());
|
|
|
if(permissionService.noPermission(2,param)){
|
|
|
return write(-1,"该操作没有权限");
|
|
|
}
|
|
|
return write(200,"成功","data",deviceManageService.getMonitoring(patient,topicItem));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return errorResult(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/getRepairList",method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "报修列表")
|
|
|
public String getRepairList(@ApiParam(name = "doctor",value = "医生code")
|
|
|
@RequestParam(value = "doctor")String doctor,
|
|
|
@ApiParam(name = "categoryCode",value = "设备类型标识")
|
|
|
@RequestParam(name = "categoryCode",required = false)String categoryCode,
|
|
|
@ApiParam(name = "patientName",value = "居民code 或 身份证")
|
|
|
@RequestParam(value = "patientName",required = false)String patientName,
|
|
|
@ApiParam(name = "page")
|
|
|
@RequestParam(value = "page")Integer page,
|
|
|
@ApiParam(name = "pageSize")
|
|
|
@RequestParam(value = "pageSize")Integer pageSize
|
|
|
){
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("doctorId",doctor);
|
|
|
if(permissionService.noPermission(2,param)){
|
|
|
return write(-1,"该操作没有权限");
|
|
|
}
|
|
|
return write(200,"成功","data",deviceManageService.getRepairList(doctor,categoryCode,patientName,page,pageSize));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return errorResult(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/getRepairInfo",method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "报修详细信息")
|
|
|
public String getRepairInfo(@ApiParam(name = "orderId", value = "报修id")
|
|
|
@RequestParam(value = "orderId") String orderId) {
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("doctorId",permissionService.getUID());
|
|
|
if(permissionService.noPermission(2,param)){
|
|
|
return write(-1,"该操作没有权限");
|
|
|
}
|
|
|
return write(200,"成功","data",deviceManageService.getRepairInfo(orderId));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return errorResult(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/deviceRepair",method = RequestMethod.POST)
|
|
|
@ApiOperation(value="报修")
|
|
|
public String deviceRepair(@ApiParam(name = "repairJson",value = "报修对象")
|
|
|
@RequestParam(value = "repairJson")String repairJson){
|
|
|
try {
|
|
|
String doctor = permissionService.getUID();
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("doctorId",userAgent.getUID());
|
|
|
if(permissionService.noPermission(2,param)){
|
|
|
return write(-1,"该操作没有权限");
|
|
|
}
|
|
|
|
|
|
BaseDeviceRepairEntity baseDeviceRepairEntity = JSON.parseObject(repairJson, BaseDeviceRepairEntity.class);
|
|
|
return write(200,"成功","data",deviceManageService.deviceRepair(baseDeviceRepairEntity,doctor));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return errorResult(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|