|
|
@@ -10,9 +10,12 @@ import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
+import com.fs.his.domain.FsThirdDeviceData;
|
|
|
+import com.fs.his.service.IFsThirdDeviceDataService;
|
|
|
import com.fs.watch.domain.*;
|
|
|
import com.fs.watch.domain.vo.*;
|
|
|
import com.fs.watch.param.WatchDataQueryParam;
|
|
|
+import com.fs.watch.param.WatchUserByDeviceIdParam;
|
|
|
import com.fs.watch.service.*;
|
|
|
import com.fs.watch.utils.GeocodingUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
|
@@ -20,10 +23,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@@ -91,6 +91,8 @@ public class WatchController extends AppBaseController {
|
|
|
private WatchSportDataService watchSportDataService;
|
|
|
@Autowired
|
|
|
private WatchFatigueDataService watchFatigueDataService;
|
|
|
+ @Autowired
|
|
|
+ private IFsThirdDeviceDataService fsThirdDeviceDataService;
|
|
|
|
|
|
/**
|
|
|
* 活动详情统计
|
|
|
@@ -103,17 +105,36 @@ public class WatchController extends AppBaseController {
|
|
|
public R sportDataByDate(
|
|
|
@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
- @RequestParam(value = "deviceId") String deviceId) {
|
|
|
- List<WatchSportDataByDateVo> data = watchSportDataService.sportDataByDate(startTime, endTime, deviceId);
|
|
|
+ @RequestParam(value = "deviceId") String deviceId,
|
|
|
+ @RequestParam(value = "deviceType",required = false) Integer deviceType) {
|
|
|
+ List<WatchSportDataByDateVo> data = new ArrayList<>();
|
|
|
+ Float activityTime = null;
|
|
|
+ if (deviceType == null || deviceType == 0) {
|
|
|
+ data = watchSportDataService.sportDataByDate(startTime, endTime, deviceId);
|
|
|
+ } else {
|
|
|
+ data = fsThirdDeviceDataService.sportDataByDate(startTime, endTime, deviceId);
|
|
|
+ WatchSportRecordVo otherData = fsThirdDeviceDataService.getOtherData(startTime, endTime, deviceId, 6, null);
|
|
|
+ if (otherData != null && otherData.getTime() != null) {
|
|
|
+ activityTime = otherData.getTime()*60*60;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Float distanceTotal = 0f;
|
|
|
Float calorieTotal = 0f;
|
|
|
Float timeTotal = 0f;
|
|
|
- for (WatchSportDataByDateVo vo : data) {
|
|
|
- distanceTotal = vo.getDistance() + distanceTotal;
|
|
|
- calorieTotal = vo.getCalorie() + calorieTotal;
|
|
|
- timeTotal = vo.getTime() + timeTotal;
|
|
|
+ Float speedTotal = 0f;
|
|
|
+ if (data != null && !data.isEmpty()) {
|
|
|
+ for (WatchSportDataByDateVo vo : data) {
|
|
|
+ distanceTotal = vo.getDistance() + distanceTotal;
|
|
|
+ calorieTotal = vo.getCalorie() + calorieTotal;
|
|
|
+ timeTotal = vo.getTime() + timeTotal;
|
|
|
+ }
|
|
|
+ speedTotal = Math.round((distanceTotal / (timeTotal/60/60)) * 100) / 100f;
|
|
|
}
|
|
|
- Float speedTotal = Math.round((distanceTotal / (timeTotal/60/60)) * 100) / 100f;
|
|
|
+ if (deviceType != null && deviceType != 0) {
|
|
|
+ timeTotal = activityTime == null?0f:activityTime;
|
|
|
+ }
|
|
|
+
|
|
|
return R.ok().put("data",data)
|
|
|
.put("distanceTotal",distanceTotal)
|
|
|
.put("calorieTotal",calorieTotal)
|
|
|
@@ -131,6 +152,7 @@ public class WatchController extends AppBaseController {
|
|
|
@GetMapping("/sport/dataByType")
|
|
|
public AjaxResult dataByType(@RequestParam(value = "deviceId") String deviceId,
|
|
|
@RequestParam(value = "type")String type,
|
|
|
+ @RequestParam(value = "deviceType",required = false)Integer deviceType,
|
|
|
@RequestParam(value = "pageNum", required = false) Integer pageNum,
|
|
|
@RequestParam(value = "pageSize", required = false) Integer pageSize
|
|
|
) {
|
|
|
@@ -140,7 +162,13 @@ public class WatchController extends AppBaseController {
|
|
|
if (pageSize == null || pageSize < 1) {
|
|
|
pageSize = 10; // 默认页面大小
|
|
|
}
|
|
|
- WatchSportDetailDataVo vo = watchSportDataService.dataByType(deviceId, type);
|
|
|
+ WatchSportDetailDataVo vo = null;
|
|
|
+ if (deviceType == null || deviceType == 0) {
|
|
|
+ vo = watchSportDataService.dataByType(deviceId, type);
|
|
|
+ } else {
|
|
|
+ vo = fsThirdDeviceDataService.dataByType(deviceId, type);
|
|
|
+ }
|
|
|
+
|
|
|
if (vo != null) {
|
|
|
List<WatchSportDataByDateVo> list = vo.getList();
|
|
|
if (list!=null && !list.isEmpty()) {
|
|
|
@@ -162,9 +190,11 @@ public class WatchController extends AppBaseController {
|
|
|
*/
|
|
|
@Login
|
|
|
@GetMapping("/sport/data")
|
|
|
- public AjaxResult sportData(@RequestParam(value = "deviceId") String deviceId,@RequestParam(value = "isFamily",required = false) Boolean isFamily) {
|
|
|
+ public AjaxResult sportData(@RequestParam(value = "deviceId") String deviceId,
|
|
|
+ @RequestParam(value = "isFamily",required = false) Boolean isFamily,
|
|
|
+ @RequestParam(value = "deviceType",required = false) Integer deviceType) {
|
|
|
String userId = getUserId();
|
|
|
- return AjaxResult.success(watchSportDataService.sportData(userId,deviceId,isFamily));
|
|
|
+ return AjaxResult.success(watchSportDataService.sportData(userId,deviceId,isFamily,deviceType));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -174,8 +204,9 @@ public class WatchController extends AppBaseController {
|
|
|
*/
|
|
|
@Login
|
|
|
@GetMapping("/sport/queryRecord")
|
|
|
- public AjaxResult queryRecord(@RequestParam(value = "deviceId") String deviceId) {
|
|
|
- return AjaxResult.success(watchSportDataService.queryRecord(deviceId));
|
|
|
+ public AjaxResult queryRecord(@RequestParam(value = "deviceId") String deviceId,
|
|
|
+ @RequestParam(value = "deviceType",required = false) Integer deviceType) {
|
|
|
+ return AjaxResult.success(watchSportDataService.queryRecord(deviceId,deviceType));
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -194,7 +225,8 @@ public class WatchController extends AppBaseController {
|
|
|
@RequestParam(value = "deviceId") String deviceId,
|
|
|
@RequestParam(value = "pageNum", required = false) Integer pageNum,
|
|
|
@RequestParam(value = "pageSize", required = false) Integer pageSize,
|
|
|
- @RequestParam(value = "status", required = false) Integer status
|
|
|
+ @RequestParam(value = "status", required = false) Integer status,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType
|
|
|
) {
|
|
|
if (pageNum == null || pageNum < 1) {
|
|
|
pageNum = 1;
|
|
|
@@ -204,11 +236,11 @@ public class WatchController extends AppBaseController {
|
|
|
}
|
|
|
|
|
|
// 获取总记录数
|
|
|
- int total = this.watchThirdUaDataService.countTotalDate(startTime, endTime, deviceId,status);
|
|
|
+ int total = this.watchThirdUaDataService.countTotalDate(startTime, endTime, deviceId,status,deviceType);
|
|
|
|
|
|
// 获取分页数据
|
|
|
List<WatchThirdUaData> list = this.watchThirdUaDataService.queryListByDate
|
|
|
- (startTime, endTime, deviceId, ((pageNum - 1) * pageSize), pageSize,status
|
|
|
+ (startTime, endTime, deviceId, ((pageNum - 1) * pageSize), pageSize,status,deviceType
|
|
|
);
|
|
|
|
|
|
// 返回包含数据的TableDataInfo对象
|
|
|
@@ -228,8 +260,9 @@ public class WatchController extends AppBaseController {
|
|
|
@GetMapping("/ua/count")
|
|
|
public AjaxResult countUaByDate(@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
- @RequestParam(value = "deviceId") String deviceId) {
|
|
|
- return AjaxResult.success(this.watchThirdUaDataService.countUaByDate(startTime, endTime, deviceId));
|
|
|
+ @RequestParam(value = "deviceId") String deviceId,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
+ return AjaxResult.success(this.watchThirdUaDataService.countUaByDate(startTime, endTime, deviceId,deviceType));
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -244,8 +277,9 @@ public class WatchController extends AppBaseController {
|
|
|
@GetMapping("/ua/list")
|
|
|
public AjaxResult queryUaByDate(@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
- @RequestParam(value = "deviceId") String deviceId) {
|
|
|
- return AjaxResult.success(this.watchThirdUaDataService.list(startTime, endTime, deviceId));
|
|
|
+ @RequestParam(value = "deviceId") String deviceId,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
+ return AjaxResult.success(this.watchThirdUaDataService.list(startTime, endTime, deviceId,deviceType));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -288,8 +322,9 @@ public class WatchController extends AppBaseController {
|
|
|
@GetMapping("/heart/rate/list")
|
|
|
public AjaxResult queryHeartByDate(@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
- @RequestParam(value = "deviceId") String deviceId) {
|
|
|
- return AjaxResult.success(this.watchHeartRateDataService.list(startTime, endTime, deviceId));
|
|
|
+ @RequestParam(value = "deviceId") String deviceId,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
+ return AjaxResult.success(this.watchHeartRateDataService.list(startTime, endTime, deviceId,deviceType));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -304,8 +339,9 @@ public class WatchController extends AppBaseController {
|
|
|
@GetMapping("/heart/rate/count")
|
|
|
public AjaxResult countHeartByDate(@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
- @RequestParam(value = "deviceId") String deviceId) {
|
|
|
- return AjaxResult.success(this.watchHeartRateDataService.countHeartByDate(startTime, endTime, deviceId));
|
|
|
+ @RequestParam(value = "deviceId") String deviceId,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
+ return AjaxResult.success(this.watchHeartRateDataService.countHeartByDate(startTime, endTime, deviceId,deviceType));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -355,8 +391,9 @@ public class WatchController extends AppBaseController {
|
|
|
@GetMapping("/sleep/list")
|
|
|
public AjaxResult querySleepByDate(@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
- @RequestParam(value = "deviceId") String deviceId) {
|
|
|
- return AjaxResult.success(this.watchSleepDataService.list(startTime, endTime, deviceId));
|
|
|
+ @RequestParam(value = "deviceId") String deviceId,
|
|
|
+ @RequestParam(value = "deviceType",required = false) Integer deviceType) {
|
|
|
+ return AjaxResult.success(this.watchSleepDataService.list(startTime, endTime, deviceId,deviceType));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -373,12 +410,13 @@ public class WatchController extends AppBaseController {
|
|
|
public AjaxResult queryBpByDate(@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
@RequestParam(value = "deviceId") String deviceId,
|
|
|
- @RequestParam(value = "status", required = false) Integer status) {
|
|
|
+ @RequestParam(value = "status", required = false) Integer status,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
return AjaxResult.success(this.watchThirdBpDataService.queryBpByDate(
|
|
|
DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, startTime),
|
|
|
DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, endTime),
|
|
|
deviceId,
|
|
|
- status));
|
|
|
+ status,deviceType));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -393,8 +431,9 @@ public class WatchController extends AppBaseController {
|
|
|
@GetMapping("/bp/count")
|
|
|
public AjaxResult countBpByDate(@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
- @RequestParam(value = "deviceId") String deviceId) {
|
|
|
- return AjaxResult.success(this.watchThirdBpDataService.countBpByDate(startTime, endTime, deviceId));
|
|
|
+ @RequestParam(value = "deviceId") String deviceId,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
+ return AjaxResult.success(this.watchThirdBpDataService.countBpByDate(startTime, endTime, deviceId,deviceType));
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -413,7 +452,8 @@ public class WatchController extends AppBaseController {
|
|
|
@RequestParam(value = "deviceId") String deviceId,
|
|
|
@RequestParam(value = "status", required = false) Integer status,
|
|
|
@RequestParam(value = "pageNum", required = false) Integer pageNum,
|
|
|
- @RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
|
|
+ @RequestParam(value = "pageSize", required = false) Integer pageSize,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
if (pageNum == null || pageNum < 1) {
|
|
|
pageNum = 1;
|
|
|
}
|
|
|
@@ -423,11 +463,11 @@ public class WatchController extends AppBaseController {
|
|
|
|
|
|
// 获取总记录数
|
|
|
// int total = this.watchBloodPressureDataService.countBpPageByDate(startTime, endTime, deviceId, status);
|
|
|
- int total = this.watchThirdBpDataService.countBpPageByDate(startTime, endTime, deviceId, status);
|
|
|
+ int total = this.watchThirdBpDataService.countBpPageByDate(startTime, endTime, deviceId, status,deviceType);
|
|
|
|
|
|
// 获取分页数据
|
|
|
// List<WatchBloodPressureData> list = this.watchBloodPressureDataService.queryBgPageByDate(startTime, endTime, deviceId, status, ((pageNum - 1) * pageSize), pageSize);
|
|
|
- List<WatchThirdBpData> list = this.watchThirdBpDataService.queryBgPageByDate(startTime, endTime, deviceId, status, ((pageNum - 1) * pageSize), pageSize);
|
|
|
+ List<WatchThirdBpData> list = this.watchThirdBpDataService.queryBgPageByDate(startTime, endTime, deviceId, status, ((pageNum - 1) * pageSize), pageSize,deviceType);
|
|
|
|
|
|
// 返回包含数据的TableDataInfo对象
|
|
|
return new TableDataInfo(list, total);
|
|
|
@@ -446,8 +486,9 @@ public class WatchController extends AppBaseController {
|
|
|
public AjaxResult queryBgByDate(@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
@RequestParam(value = "deviceId") String deviceId,
|
|
|
- @RequestParam(value = "status", required = false) Integer status) {
|
|
|
- return AjaxResult.success(this.watchBloodGlucoseDataService.queryBgByDate(startTime, endTime, deviceId, status));
|
|
|
+ @RequestParam(value = "status", required = false) Integer status,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
+ return AjaxResult.success(this.watchBloodGlucoseDataService.queryBgByDate(startTime, endTime, deviceId, status,deviceType));
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -466,7 +507,8 @@ public class WatchController extends AppBaseController {
|
|
|
@RequestParam(value = "deviceId") String deviceId,
|
|
|
@RequestParam(value = "status", required = false) Integer status,
|
|
|
@RequestParam(value = "pageNum", required = false) Integer pageNum,
|
|
|
- @RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
|
|
+ @RequestParam(value = "pageSize", required = false) Integer pageSize,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
if (pageNum == null || pageNum < 1) {
|
|
|
pageNum = 1;
|
|
|
}
|
|
|
@@ -475,11 +517,11 @@ public class WatchController extends AppBaseController {
|
|
|
}
|
|
|
|
|
|
// 获取总记录数
|
|
|
- int total = this.watchBloodGlucoseDataService.countBgPageByDate(startTime, endTime, deviceId, status);
|
|
|
+ int total = watchBloodGlucoseDataService.countBgPageByDate(startTime, endTime, deviceId, status,deviceType);
|
|
|
|
|
|
// 获取分页数据
|
|
|
- List<WatchBloodGlucoseData> list = this.watchBloodGlucoseDataService.queryBgPageByDate
|
|
|
- (startTime, endTime, deviceId, status, ((pageNum - 1) * pageSize), pageSize
|
|
|
+ List<WatchBloodGlucoseData> list = watchBloodGlucoseDataService.queryBgPageByDate
|
|
|
+ (startTime, endTime, deviceId, status, ((pageNum - 1) * pageSize), pageSize,deviceType
|
|
|
);
|
|
|
|
|
|
// 返回包含数据的TableDataInfo对象
|
|
|
@@ -499,8 +541,9 @@ public class WatchController extends AppBaseController {
|
|
|
@GetMapping("/bg/count")
|
|
|
public AjaxResult countBgByDate(@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
- @RequestParam(value = "deviceId") String deviceId) {
|
|
|
- return AjaxResult.success(this.watchBloodGlucoseDataService.countBgByDate(startTime, endTime, deviceId));
|
|
|
+ @RequestParam(value = "deviceId") String deviceId,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
+ return AjaxResult.success(this.watchBloodGlucoseDataService.countBgByDate(startTime, endTime, deviceId,deviceType));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -515,8 +558,9 @@ public class WatchController extends AppBaseController {
|
|
|
@GetMapping("/sp/list")
|
|
|
public AjaxResult querySpByDate(@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
- @RequestParam(value = "deviceId") String deviceId) {
|
|
|
- return AjaxResult.success(this.watchSpo2DataService.querySpByDate(startTime, endTime, deviceId));
|
|
|
+ @RequestParam(value = "deviceId") String deviceId,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
+ return AjaxResult.success(this.watchSpo2DataService.querySpByDate(startTime, endTime, deviceId,deviceType));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -565,8 +609,9 @@ public class WatchController extends AppBaseController {
|
|
|
@GetMapping("/sp/count")
|
|
|
public AjaxResult countSpByDate(@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
- @RequestParam(value = "deviceId") String deviceId) {
|
|
|
- return AjaxResult.success(this.watchSpo2DataService.countSpByDate(startTime, endTime, deviceId));
|
|
|
+ @RequestParam(value = "deviceId") String deviceId,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
+ return AjaxResult.success(this.watchSpo2DataService.countSpByDate(startTime, endTime, deviceId,deviceType));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -710,13 +755,13 @@ public class WatchController extends AppBaseController {
|
|
|
*/
|
|
|
@GetMapping("/queryIndexWatchData")
|
|
|
@Login
|
|
|
- public AjaxResult queryIndexWatchData(String type, String deviceId) {
|
|
|
+ public AjaxResult queryIndexWatchData(String type, String deviceId,Integer deviceType) {
|
|
|
if (StringUtils.isBlank(type)) {
|
|
|
return null;
|
|
|
}
|
|
|
String userId = getUserId();
|
|
|
List<String> types = Arrays.stream(type.split(",")).collect(Collectors.toList());
|
|
|
- return AjaxResult.success(this.watchDataService.queryIndexWatchData(types, deviceId,userId));
|
|
|
+ return AjaxResult.success(this.watchDataService.queryIndexWatchData(types, deviceId,userId,deviceType));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -779,13 +824,14 @@ public class WatchController extends AppBaseController {
|
|
|
@GetMapping("/queryMonthByDeviceId")
|
|
|
public TableDataInfo queryMonthByDeviceId(@RequestParam(value = "deviceId") String deviceId,
|
|
|
@RequestParam("pageSize") Integer pageSize,
|
|
|
- @RequestParam("pageNum") Integer pageNum
|
|
|
+ @RequestParam("pageNum") Integer pageNum,
|
|
|
+ @RequestParam("deviceType") Integer deviceType
|
|
|
) {
|
|
|
if (StringUtils.isBlank(deviceId)) {
|
|
|
return null;
|
|
|
}
|
|
|
TableDataInfo tableDataInfo = new TableDataInfo();
|
|
|
- QueryPageMonthVo vo = this.watchDataService.queryMonthByDeviceId(deviceId, pageSize, pageNum);
|
|
|
+ QueryPageMonthVo vo = this.watchDataService.queryMonthByDeviceId(deviceId, pageSize, pageNum,deviceType);
|
|
|
tableDataInfo.setTotal(vo.getTotal());
|
|
|
tableDataInfo.setRows(vo.getMonth());
|
|
|
return tableDataInfo;
|
|
|
@@ -1277,16 +1323,16 @@ public class WatchController extends AppBaseController {
|
|
|
/**
|
|
|
* 首页绑定-设备信息
|
|
|
*/
|
|
|
- @GetMapping("/getInfoByDeviceIds")
|
|
|
+ @PostMapping("/getInfoByDeviceIds")
|
|
|
@Login
|
|
|
@ApiOperation("首页绑定-设备信息")
|
|
|
- public AjaxResult getUserByDeviceId(@RequestParam("deviceIds") String deviceIds,
|
|
|
- @RequestParam(value = "isFamily") Boolean isFamily) {
|
|
|
- if (StringUtils.isBlank(deviceIds)) {
|
|
|
+ public AjaxResult getUserByDeviceId(@RequestBody WatchUserByDeviceIdParam watchUserByDeviceIdParam) {
|
|
|
+ List<WatchUserByDeviceIdParam.WatchUserByDeviceIdTemp> params = watchUserByDeviceIdParam.getParams();
|
|
|
+ if (params == null || params.isEmpty()) {
|
|
|
return null;
|
|
|
}
|
|
|
String userId = getUserId();
|
|
|
- return AjaxResult.success(watchDataService.getUserByDeviceId(deviceIds, isFamily,Long.valueOf(userId)));
|
|
|
+ return AjaxResult.success(watchDataService.getUserByDeviceId(watchUserByDeviceIdParam,Long.valueOf(userId)));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1344,14 +1390,16 @@ public class WatchController extends AppBaseController {
|
|
|
@RequestParam(value = "deviceId",required = false) String deviceId,
|
|
|
@RequestParam(value = "isFamily",required = false) Boolean isFamily,
|
|
|
@RequestParam(value = "userId",required = false) Long userId,
|
|
|
- @RequestParam(value = "isRefresh",required = false) Integer isRefresh) {
|
|
|
+ @RequestParam(value = "isRefresh",required = false) Integer isRefresh,
|
|
|
+ @RequestParam(value = "deviceType",required = false) Integer deviceType) {
|
|
|
if (userId == null){
|
|
|
userId = Long.valueOf(getUserId());
|
|
|
}
|
|
|
if (isFamily == null){
|
|
|
isFamily = Boolean.FALSE;
|
|
|
}
|
|
|
- return AjaxResult.success(watchBasicInfoService.getAppFsUserHealthReportVo(startTime,endTime, deviceId,userId,isFamily,isRefresh));
|
|
|
+ return AjaxResult.success(watchBasicInfoService.getAppFsUserHealthReportVo(startTime,endTime,
|
|
|
+ deviceId,userId,isFamily,isRefresh,deviceType));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1411,11 +1459,115 @@ public class WatchController extends AppBaseController {
|
|
|
public AjaxResult getUserHealthInfoByDeviceId(@RequestParam(value = "startTime") Date startTime,
|
|
|
@RequestParam(value = "endTime") Date endTime,
|
|
|
@RequestParam(value = "deviceId",required = false) String deviceId,
|
|
|
- @RequestParam(value = "userId",required = false) Long userId) {
|
|
|
+ @RequestParam(value = "userId",required = false) Long userId,
|
|
|
+ @RequestParam(value = "deviceType") Integer deviceType) {
|
|
|
if (userId == null){
|
|
|
userId = Long.valueOf(getUserId());
|
|
|
}
|
|
|
- return AjaxResult.success(watchSportDataService.getUserHealthInfoByDeviceId(deviceId,startTime,endTime,userId));
|
|
|
+ return AjaxResult.success(watchSportDataService.getUserHealthInfoByDeviceId(deviceId,startTime,endTime,userId,deviceType));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增三方设备健康数据
|
|
|
+ */
|
|
|
+ @Login
|
|
|
+ @PostMapping("/xhsDataAdd")
|
|
|
+ public R add(@RequestBody FsThirdDeviceData fsThirdDeviceData)
|
|
|
+ {
|
|
|
+ Long userId = Long.valueOf(getUserId());
|
|
|
+ fsThirdDeviceData.setUserId(userId);
|
|
|
+ setStatus(fsThirdDeviceData);
|
|
|
+ fsThirdDeviceDataService.insertFsThirdDeviceData(fsThirdDeviceData);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增三方设备健康数据
|
|
|
+ */
|
|
|
+ @Login
|
|
|
+ @PostMapping("/xhsDataAddList")
|
|
|
+ public R add(@RequestBody List<FsThirdDeviceData> fsThirdDeviceData)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (fsThirdDeviceData == null || fsThirdDeviceData.isEmpty()){
|
|
|
+ return R.error("没有所需要记录的数据!");
|
|
|
+ }
|
|
|
+ Long userId = Long.valueOf(getUserId());
|
|
|
+ for (FsThirdDeviceData deviceData : fsThirdDeviceData) {
|
|
|
+ deviceData.setUserId(userId);
|
|
|
+ if (deviceData.getCreateTime() == null){
|
|
|
+ deviceData.setCreateTime(new Date());
|
|
|
+ }
|
|
|
+ setStatus(deviceData);
|
|
|
+
|
|
|
+ }
|
|
|
+ fsThirdDeviceDataService.insertFsThirdDeviceDataList(fsThirdDeviceData);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setStatus(FsThirdDeviceData deviceData) {
|
|
|
+ String recordValue = deviceData.getRecordValue();
|
|
|
+ Integer recordType = deviceData.getRecordType();
|
|
|
+ Long userId = deviceData.getUserId();
|
|
|
+ if (StringUtils.isNotBlank(recordValue)){
|
|
|
+ switch (recordType) {
|
|
|
+ //血压
|
|
|
+ case 0:
|
|
|
+ if (StringUtils.isNotBlank(recordValue)){
|
|
|
+ JSONObject record = JSONObject.parseObject(recordValue);
|
|
|
+ deviceData.setStatus(watchBloodPressureDataService.getStatus(Integer.parseInt(record.get("sdb").toString()),
|
|
|
+ Integer.valueOf(record.get("dbp").toString())));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ //血糖
|
|
|
+ case 1:
|
|
|
+ deviceData.setStatus(watchBloodGlucoseDataService.getStatus(Double.valueOf(recordValue)));
|
|
|
+ break;
|
|
|
+ //心率
|
|
|
+ case 2:
|
|
|
+ deviceData.setStatus(watchHeartRateDataService.getStatus(Integer.parseInt(recordValue),Integer.parseInt(recordValue)));
|
|
|
+ break;
|
|
|
+ //尿酸
|
|
|
+ case 3:
|
|
|
+ Integer deviceType = deviceData.getDeviceType();
|
|
|
+ deviceData.setStatus(watchThirdUaDataService.getStatus(deviceData.getDeviceId(),Integer.parseInt(recordValue), userId, deviceType ==0?0:(deviceType ==1?2:4)));
|
|
|
+ break;
|
|
|
+ //血氧
|
|
|
+ case 4:
|
|
|
+ deviceData.setStatus(watchSpo2DataService.getStatus(Integer.parseInt(recordValue),Integer.parseInt(recordValue)));
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询三方设备健康数据列表
|
|
|
+ */
|
|
|
+ @Login
|
|
|
+ @GetMapping("/xhsDataList")
|
|
|
+ public R list(FsThirdDeviceData fsThirdDeviceData)
|
|
|
+ {
|
|
|
+ String userId = getUserId();
|
|
|
+ fsThirdDeviceData.setUserId(Long.valueOf(userId));
|
|
|
+ startPage();
|
|
|
+ List<FsThirdDeviceData> list = fsThirdDeviceDataService.selectFsThirdDeviceDataList(fsThirdDeviceData);
|
|
|
+ return R.ok().put("data", list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询三方设备最新数据
|
|
|
+ * deviceType 1小护士设备 2手表
|
|
|
+ */
|
|
|
+ @Login
|
|
|
+ @GetMapping("/getLastData")
|
|
|
+ public R getLastData(@RequestParam("deviceType") Integer deviceType,@RequestParam("deviceId")String deviceId)
|
|
|
+ {
|
|
|
+ String userId = getUserId();
|
|
|
+ List<FsThirdDeviceData> list = fsThirdDeviceDataService.getLastData(Long.valueOf(userId),deviceType,deviceId);
|
|
|
+ return R.ok().put("data", list);
|
|
|
}
|
|
|
|
|
|
|