设备导入修改及最新值
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
--心率
|
||||
ALTER TABLE `watch_stat_user_info_day_heart_rate`
|
||||
ADD COLUMN `new_value` int NULL DEFAULT NULL COMMENT '最新值' AFTER `last_upload_time`,
|
||||
ADD COLUMN `silence_new_value` int NULL COMMENT '静息心率最新值' AFTER `new_value`;
|
||||
|
||||
-- 血氧
|
||||
ALTER TABLE `watch_stat_user_info_day_spo2`
|
||||
ADD COLUMN `new_value` decimal(4, 0) NULL COMMENT '最新值' AFTER `last_upload_time`;
|
||||
|
||||
-- 压力
|
||||
ALTER TABLE `watch_stat_user_info_day_stress`
|
||||
ADD COLUMN `new_value` decimal(4, 0) NULL COMMENT '最新值' AFTER `last_upload_time`;
|
||||
|
||||
-- 体温
|
||||
ALTER TABLE `watch_stat_user_info_day_temp`
|
||||
ADD COLUMN `new_value` decimal(5, 2) NULL COMMENT '最新值' AFTER `last_upload_time`,
|
||||
ADD COLUMN `skin_new_value` decimal(5, 2) NULL COMMENT '体表温度最新值' AFTER `new_value`;
|
||||
+1
-1
@@ -13,7 +13,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||
@Data
|
||||
public class WatchDeviceExcel {
|
||||
private String watchNo;
|
||||
private String idCard;
|
||||
private String workNo;
|
||||
private String realName;
|
||||
/**
|
||||
* 绑定日期
|
||||
|
||||
+13
@@ -99,4 +99,17 @@ public class WatchStatUserInfoDayHeartRate implements Serializable {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(title = "最后上传时间")
|
||||
private Date lastUploadTime;
|
||||
|
||||
/**
|
||||
* 最新值
|
||||
*/
|
||||
@Excel(name = "最新值", width = 15)
|
||||
@Schema(title = "最新值")
|
||||
private Integer newValue;
|
||||
/**
|
||||
* 静息心率最新值
|
||||
*/
|
||||
@Excel(name = "静息心率最新值", width = 15)
|
||||
@Schema(title = "静息心率最新值")
|
||||
private Integer silenceNewValue;
|
||||
}
|
||||
|
||||
+5
@@ -67,4 +67,9 @@ public class WatchStatUserInfoDaySpo2 implements Serializable {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(title = "最后上传时间")
|
||||
private Date lastUploadTime;
|
||||
|
||||
/**最新值*/
|
||||
@Excel(name = "最新值", width = 15)
|
||||
@Schema(title = "最新值")
|
||||
private BigDecimal newValue;
|
||||
}
|
||||
|
||||
+6
@@ -80,4 +80,10 @@ public class WatchStatUserInfoDayStress implements Serializable {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(title = "最后上传时间")
|
||||
private Date lastUploadTime;
|
||||
/**
|
||||
* 最新值
|
||||
*/
|
||||
@Excel(name = "最新值", width = 15)
|
||||
@Schema(title = "最新值")
|
||||
private Integer newValue;
|
||||
}
|
||||
|
||||
+10
@@ -81,4 +81,14 @@ public class WatchStatUserInfoDayTemp implements Serializable {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(title = "最后上传时间")
|
||||
private Date lastUploadTime;
|
||||
|
||||
/**温度最新值*/
|
||||
@Excel(name = "温度最新值", width = 15)
|
||||
@Schema(title = "温度最新值")
|
||||
private BigDecimal newValue;
|
||||
|
||||
/**体表温度最新值*/
|
||||
@Excel(name = "体表温度最新值", width = 15)
|
||||
@Schema(title = "体表温度最新值")
|
||||
private BigDecimal skinNewValue;
|
||||
}
|
||||
|
||||
+6
-6
@@ -206,11 +206,11 @@ public class AsyncImportService {
|
||||
|
||||
// 取出编号数据
|
||||
List<String> watchNoList = excelWatchDevice.stream().map(WatchDevice::getWatchNo).collect(Collectors.toList());
|
||||
// 取出身份证
|
||||
List<String> idCardList = excelWatchDevice.stream().map(WatchDevice::getBindUserId).collect(Collectors.toList());
|
||||
// 取出工号
|
||||
List<String> workNoList = excelWatchDevice.stream().map(WatchDevice::getBindUserId).collect(Collectors.toList());
|
||||
GlobalUtils.setHttpFeignToken();
|
||||
// 用户数据
|
||||
List<SysUser> userList = sysBaseAPI.getUserByIdCardList(new ListUser(idCardList));
|
||||
List<SysUser> userList = sysBaseAPI.getUserListByWorkNoList(workNoList);
|
||||
// 查询设备
|
||||
List<WatchDevice> watchDeviceList = watchDeviceService.list(new QueryWrapper<WatchDevice>().in("watch_no", watchNoList));
|
||||
int count = excelWatchDevice.size();
|
||||
@@ -310,7 +310,7 @@ public class AsyncImportService {
|
||||
if (device != null) {
|
||||
WatchDevice updatedWatchDevice = new WatchDevice();
|
||||
SysUser user =
|
||||
userList.stream().filter(sysuser -> cleanIdCard(sysuser.getIdCard()).equals(cleanIdCard(watchDevice.getBindUserId()))).findFirst().orElse(null);
|
||||
userList.stream().filter(sysuser -> cleanIdCard(sysuser.getWorkNo()).equals(cleanIdCard(watchDevice.getBindUserId()))).findFirst().orElse(null);
|
||||
if (user == null){
|
||||
// 未找到该用户 跳过
|
||||
continue;
|
||||
@@ -363,7 +363,7 @@ public class AsyncImportService {
|
||||
for (WatchDevice watchDevice : list) {
|
||||
WatchBindHis watchBindHis = noHisList.stream().filter(noHis -> noHis.getWatchNo().equals(watchDevice.getWatchNo())).findFirst().orElse(null);
|
||||
SysUser user =
|
||||
userList.stream().filter(sysuser -> sysuser.getIdCard().equals(watchDevice.getBindUserId())).findFirst().orElse(null);
|
||||
userList.stream().filter(sysuser -> sysuser.getWorkNo().equals(watchDevice.getBindUserId())).findFirst().orElse(null);
|
||||
if (user == null){
|
||||
// 未找到该用户 跳过
|
||||
noImportList.add(watchDevice.getBindUserId());
|
||||
@@ -431,7 +431,7 @@ public class AsyncImportService {
|
||||
private WatchDevice convertExcelToDevice(WatchDeviceExcel deviceExcel) {
|
||||
WatchDevice watchDevice = new WatchDevice();
|
||||
watchDevice.setWatchNo(deviceExcel.getWatchNo());
|
||||
watchDevice.setBindUserId(deviceExcel.getIdCard());
|
||||
watchDevice.setBindUserId(deviceExcel.getWorkNo());
|
||||
watchDevice.setBindRealName(deviceExcel.getRealName());
|
||||
watchDevice.setBindDate(deviceExcel.getBindDate());
|
||||
return watchDevice;
|
||||
|
||||
+7
-1
@@ -336,7 +336,7 @@
|
||||
|
||||
<insert id="insertStat">
|
||||
insert into watch_stat_user_info_day_heart_rate(id, user_id, max_value, min_value, avg_value, silence_max_value,
|
||||
silence_min_value, silence_avg_value, last_upload_time, data_date, org_code)
|
||||
silence_min_value, silence_avg_value, last_upload_time, new_value, silence_new_value, data_date, org_code)
|
||||
(select #{id,jdbcType=VARCHAR},
|
||||
bind_user_id,
|
||||
ifnull(max(data_value), 0),
|
||||
@@ -346,6 +346,8 @@
|
||||
ifnull(min(silence_value), 0),
|
||||
ifnull(avg(silence_value), 0),
|
||||
ifnull(max(time_stamp), NOW()),
|
||||
ifnull(data_value, 0),
|
||||
ifnull(silence_value, 0),
|
||||
data_date,
|
||||
#{orgCode,jdbcType=VARCHAR}
|
||||
from watch_data_heart_rate
|
||||
@@ -364,6 +366,8 @@
|
||||
ifnull(min(silence_value), 0) as silence_min_value,
|
||||
ifnull(avg(silence_value), 0) as silence_avg_value,
|
||||
ifnull(max(time_stamp), NOW()) as last_upload_time,
|
||||
ifnull(data_value, 0) as new_value,
|
||||
ifnull(silence_value, 0) as silence_new_value,
|
||||
data_date
|
||||
from watch_data_heart_rate
|
||||
where bind_user_id = #{userId,jdbcType=VARCHAR}
|
||||
@@ -376,6 +380,8 @@
|
||||
stat.silence_min_value = data.silence_min_value,
|
||||
stat.silence_avg_value = data.silence_avg_value,
|
||||
stat.last_upload_time = data.last_upload_time,
|
||||
stat.new_value = data.new_value,
|
||||
stat.silence_new_value = data.silence_new_value,
|
||||
stat.org_code = #{orgCode,jdbcType=VARCHAR}
|
||||
where stat.user_id = #{userId,jdbcType=VARCHAR}
|
||||
and stat.data_date = #{dataDate,jdbcType=DATE};
|
||||
|
||||
+4
-1
@@ -37,13 +37,14 @@
|
||||
</select>
|
||||
|
||||
<insert id="insertStat">
|
||||
insert into watch_stat_user_info_day_spo2(id, user_id, max_value, min_value, avg_value, last_upload_time, data_date, org_code)
|
||||
insert into watch_stat_user_info_day_spo2(id, user_id, max_value, min_value, avg_value, last_upload_time, new_value, data_date, org_code)
|
||||
(select #{id,jdbcType=VARCHAR},
|
||||
bind_user_id,
|
||||
ifnull(max(data_value), 0),
|
||||
ifnull(min(data_value), 0),
|
||||
ifnull(avg(data_value), 0),
|
||||
ifnull(max(time_stamp), NOW()),
|
||||
ifnull(data_value, 0),
|
||||
data_date,
|
||||
#{orgCode,jdbcType=VARCHAR}
|
||||
from watch_data_spo2
|
||||
@@ -59,6 +60,7 @@
|
||||
ifnull(min(data_value), 0) as min_value,
|
||||
ifnull(avg(data_value), 0) as avg_value,
|
||||
ifnull(max(time_stamp), 0) as last_upload_time,
|
||||
ifnull(data_value, 0) as new_value,
|
||||
data_date
|
||||
from watch_data_spo2
|
||||
where bind_user_id = #{userId,jdbcType=VARCHAR}
|
||||
@@ -68,6 +70,7 @@
|
||||
stat.min_value = data.min_value,
|
||||
stat.avg_value = data.avg_value,
|
||||
stat.last_upload_time = data.last_upload_time,
|
||||
stat.new_value = data.new_value,
|
||||
stat.org_code = #{orgCode,jdbcType=VARCHAR}
|
||||
where stat.user_id = #{userId,jdbcType=VARCHAR}
|
||||
and stat.data_date = #{dataDate,jdbcType=DATE};
|
||||
|
||||
+4
-1
@@ -21,13 +21,14 @@
|
||||
|
||||
|
||||
<insert id="insertStat">
|
||||
insert into watch_stat_user_info_day_stress(id, user_id, max_value, min_value, avg_value, data_date, last_upload_time, org_code)
|
||||
insert into watch_stat_user_info_day_stress(id, user_id, max_value, min_value, avg_value, data_date, last_upload_time, new_value, org_code)
|
||||
(select #{id,jdbcType=VARCHAR},
|
||||
bind_user_id,
|
||||
ifnull(max(data_value), 0),
|
||||
ifnull(min(data_value), 0),
|
||||
ifnull(avg(data_value), 0),
|
||||
ifnull(max(end_time_stamp), NOW()),
|
||||
ifnull(data_value, 0),
|
||||
data_date,
|
||||
#{orgCode,jdbcType=VARCHAR}
|
||||
from watch_data_stress
|
||||
@@ -43,6 +44,7 @@
|
||||
ifnull(min(data_value), 0) as min_value,
|
||||
ifnull(avg(data_value), 0) as avg_value,
|
||||
ifnull(max(end_time_stamp), NOW()) as last_upload_time,
|
||||
ifnull(data_value, 0) as new_value,
|
||||
data_date
|
||||
from watch_data_stress
|
||||
where bind_user_id = #{userId,jdbcType=VARCHAR}
|
||||
@@ -52,6 +54,7 @@
|
||||
stat.min_value = data.min_value,
|
||||
stat.avg_value = data.avg_value,
|
||||
stat.last_upload_time = data.last_upload_time,
|
||||
stat.new_value = data.new_value,
|
||||
stat.org_code = #{orgCode,jdbcType=VARCHAR}
|
||||
where stat.user_id = #{userId,jdbcType=VARCHAR}
|
||||
and stat.data_date = #{dataDate,jdbcType=DATE};
|
||||
|
||||
+7
-1
@@ -36,7 +36,7 @@
|
||||
|
||||
<insert id="insertStat">
|
||||
insert into watch_stat_user_info_day_temp(id, user_id, max_value, min_value, avg_value, skin_max_value,
|
||||
skin_min_value, skin_avg_value, last_upload_time, data_date, org_code)
|
||||
skin_min_value, skin_avg_value, last_upload_time, new_value, skin_new_value, data_date, org_code)
|
||||
(select #{id,jdbcType=VARCHAR},
|
||||
bind_user_id,
|
||||
ifnull(max(data_value), 0),
|
||||
@@ -46,6 +46,8 @@
|
||||
ifnull(min(skin_tempera), 0),
|
||||
ifnull(avg(skin_tempera), 0),
|
||||
ifnull(max(time_stamp), NOW()),
|
||||
ifnull(data_value, 0),
|
||||
ifnull(skin_tempera, 0),
|
||||
data_date,
|
||||
#{orgCode,jdbcType=VARCHAR}
|
||||
from watch_data_temperature
|
||||
@@ -64,6 +66,8 @@
|
||||
ifnull(min(skin_tempera), 0) as skin_min_value,
|
||||
ifnull(avg(skin_tempera), 0) as skin_avg_value,
|
||||
ifnull(max(time_stamp), NOW()) as last_upload_time,
|
||||
ifnull(data_value, 0) as new_value,
|
||||
ifnull(skin_tempera, 0) as skin_new_value,
|
||||
data_date
|
||||
from watch_data_temperature
|
||||
where bind_user_id = #{userId,jdbcType=VARCHAR}
|
||||
@@ -76,6 +80,8 @@
|
||||
stat.skin_min_value = data.skin_min_value,
|
||||
stat.skin_avg_value = data.skin_avg_value,
|
||||
stat.last_upload_time = data.last_upload_time,
|
||||
stat.new_value = data.new_value,
|
||||
stat.skin_new_value = data.skin_new_value,
|
||||
stat.org_code = #{orgCode,jdbcType=VARCHAR}
|
||||
where stat.user_id = #{userId,jdbcType=VARCHAR}
|
||||
and stat.data_date = #{dataDate,jdbcType=DATE};
|
||||
|
||||
+6
@@ -488,6 +488,8 @@ public class SyncUserStatJob {
|
||||
rate.setSkinMinValue(BigDecimal.valueOf(skinMin));
|
||||
rate.setSkinAvgValue(BigDecimal.valueOf(skinAvg));
|
||||
rate.setLastUploadTime(watchDataTemperature.getTimeStamp());
|
||||
rate.setNewValue(BigDecimal.valueOf(currentDataValue));
|
||||
rate.setSkinNewValue(BigDecimal.valueOf(watchDataTemperature.getSkinTempera()));
|
||||
SyncUserStatJob bean = SpringContextUtils.getBean(SyncUserStatJob.class);
|
||||
bean.saveTemp(userId, dateStr, req.getDataDate(), currentDataValue, list.get(0).getWatchNo(), userInfo, rate);
|
||||
}
|
||||
@@ -711,6 +713,7 @@ public class SyncUserStatJob {
|
||||
rate.setMinValue((int) min);
|
||||
rate.setAvgValue((int) avg);
|
||||
rate.setLastUploadTime(watchDataStress.getEndTimeStamp());
|
||||
rate.setNewValue(currentDataValue.intValue());
|
||||
SyncUserStatJob bean = SpringContextUtils.getBean(SyncUserStatJob.class);
|
||||
bean.saveStress(userId, dateStr, req.getDataDate(), currentDataValue, list.get(0).getWatchNo(), userInfo, rate);
|
||||
}
|
||||
@@ -780,6 +783,7 @@ public class SyncUserStatJob {
|
||||
rate.setMinValue(BigDecimal.valueOf(min));
|
||||
rate.setAvgValue(BigDecimal.valueOf(avg));
|
||||
rate.setLastUploadTime(watchDataSpo2.getTimeStamp());
|
||||
rate.setNewValue(BigDecimal.valueOf(currentDataValue));
|
||||
SyncUserStatJob bean = SpringContextUtils.getBean(SyncUserStatJob.class);
|
||||
bean.saveSpo2(userId, dateStr, req.getDataDate(), currentDataValue, list.get(0).getWatchNo(), userInfo, rate);
|
||||
}
|
||||
@@ -828,6 +832,8 @@ public class SyncUserStatJob {
|
||||
rate.setSilenceMaxValue((int) silenceMax);
|
||||
rate.setSilenceMinValue((int) silenceMin);
|
||||
rate.setSilenceAvgValue((int) silenceSize);
|
||||
rate.setNewValue(currentDataValue.intValue());
|
||||
rate.setSilenceNewValue(watchDataHeartRate.getSilenceValue().intValue());
|
||||
rate.setLastUploadTime(watchDataHeartRate.getTimeStamp());
|
||||
|
||||
SyncUserStatJob bean = SpringContextUtils.getBean(SyncUserStatJob.class);
|
||||
|
||||
+2
@@ -1352,4 +1352,6 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
@GetMapping(value = "/familyMembers/app/list")
|
||||
Result<List<FamilyMembersVO>> userFamilyMembersList(@RequestParam(name = "userId", required = false) String userId);
|
||||
|
||||
@PostMapping("/sys/api/getUserListByWorkNoList")
|
||||
List<SysUser> getUserListByWorkNoList(@RequestParam(name = "workNoList") List<String> workNoList);
|
||||
}
|
||||
|
||||
+5
@@ -897,4 +897,9 @@ public class SysBaseAPIFallback implements ISysBaseAPI {
|
||||
public Result<List<FamilyMembersVO>> userFamilyMembersList(@RequestParam(name = "userId", required = false) String userId){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> getUserListByWorkNoList(List<String> workNoList) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -558,4 +558,6 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
void sendSmsNotSignV2(List<UserWeightSign> usersSign);
|
||||
|
||||
List<WeightHeightDayVO> userBodyInfoLatest(SendSmsReq req);
|
||||
|
||||
List<SysUser> getUserListByWorkNoList(List<String> workNoList);
|
||||
}
|
||||
|
||||
+5
@@ -285,6 +285,11 @@ public class SystemApiController {
|
||||
return sysBaseApi.getUserByIdCardList(listUser);
|
||||
}
|
||||
|
||||
@PostMapping("getUserListByWorkNoList")
|
||||
List<SysUser> getUserByIdCardList(@RequestParam(name = "workNoList") List<String> workNoList){
|
||||
return sysBaseApi.getUserListByWorkNoList(workNoList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送系统消息
|
||||
|
||||
+8
@@ -2388,4 +2388,12 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
sendBusSms(data);
|
||||
});
|
||||
}
|
||||
|
||||
public List<SysUser> getUserListByWorkNoList(List<String> workNoList){
|
||||
return sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
|
||||
.in(SysUser::getWorkNo, workNoList)
|
||||
.eq(SysUser::getPersonType,1)
|
||||
.eq(SysUser::getDelFlag,0)
|
||||
.eq(SysUser::getStatus,1));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user