|
@ -1,29 +1,22 @@
|
|
|
package com.yihu.jw.care.endpoint;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.care.dao.device.DeviceDetailDao;
|
|
|
import com.yihu.jw.care.service.DeviceService;
|
|
|
import com.yihu.jw.care.service.YsDeviceService;
|
|
|
import com.yihu.jw.care.util.DeviceDataPushLogUtil;
|
|
|
import com.yihu.jw.entity.care.device.DeviceDetail;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import jxl.Sheet;
|
|
|
import jxl.Workbook;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.InputStream;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Created with IntelliJ IDEA.
|
|
@ -277,6 +270,37 @@ public class DeviceController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@ApiOperation("设备血氧接收")
|
|
|
@RequestMapping(value = "byBloodoxygen", method = {RequestMethod.POST,RequestMethod.GET})
|
|
|
public String byBloodoxygen(
|
|
|
@ApiParam(name="device_type",required = false,value="设备型号",defaultValue = "")
|
|
|
@RequestParam(value = "device_type",required = true) String device_type,
|
|
|
@ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
|
|
|
@RequestParam(value = "imei",required = true) String imei,
|
|
|
@ApiParam(name="time_begin_str",required = false,value="时间YYYYmmDDHHMMSS显示(将time_begin按YYYYmmDDHHMMSS格式化,字符串,长度固定14 )",defaultValue = "")
|
|
|
@RequestParam(value = "time_begin_str",required = true) String time_begin_str,
|
|
|
@ApiParam(name="time_begin",required = false,value="发生时间YYYY-MM-DD HH:mm:SS",defaultValue = "")
|
|
|
@RequestParam(value = "time_begin",required = true) String time_begin,
|
|
|
@ApiParam(name="bloodoxygen",required = false,value="血氧百分比",defaultValue = "")
|
|
|
@RequestParam(value = "bloodoxygen",required = true) Integer bloodoxygen,
|
|
|
@ApiParam(name="bloodoxygen_h",required = false,value="血氧报警上限")
|
|
|
@RequestParam(value = "bloodoxygen_h",required = false) Integer bloodoxygen_h,
|
|
|
@ApiParam(name="bloodoxygen_l",required = false,value="血氧报警下限")
|
|
|
@RequestParam(value = "bloodoxygen_l",required = false) Integer bloodoxygen_l,
|
|
|
HttpServletRequest request) {
|
|
|
try {
|
|
|
String paraString = JSON.toJSONString(request.getParameterMap());
|
|
|
logger.info("爱牵挂血氧接收,请求参数:\n"+paraString);
|
|
|
dataPushLogUtil.savePushLog(imei,paraString,"爱牵挂设备血氧数据接收");
|
|
|
deviceService.byBloodoxygen(device_type, imei, time_begin_str, time_begin, bloodoxygen, bloodoxygen_h, bloodoxygen_l);
|
|
|
dataPushLogUtil.updContactStatus(imei,1,false);
|
|
|
return success();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return error(-1,"Device data incoming failure");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*******************************************睡眠带begin****************************************************************/
|
|
|
@ApiOperation("爱牵挂-睡眠带睡眠接收")
|
|
|
@RequestMapping(value = "bySleep", method = {RequestMethod.POST,RequestMethod.GET})
|