|
|
@ -83,13 +83,13 @@ public class HealthService implements IHealthService{ |
|
|
|
|
|
|
|
/** |
|
|
|
* 上报健康信息 |
|
|
|
* |
|
|
|
* @param params |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public HealthVo.HealthInfo addHealthInfo(QueryDto<HealthDto.healthInfo> params) throws Exception { |
|
|
|
log.info("保存健康码:{}", params); |
|
|
|
|
|
|
|
HealthVo.HealthInfo healthInfoVo = new HealthVo.HealthInfo(); |
|
|
|
//1、获取健康信息和userId
|
|
|
|
HealthDto.healthInfo healthInfo = params.getParam(); |
|
|
@ -133,6 +133,7 @@ public class HealthService implements IHealthService{ |
|
|
|
} |
|
|
|
healthInfoVo.setHealthTypeName(healthType.getName()); |
|
|
|
} |
|
|
|
Long aa2 = System.currentTimeMillis(); |
|
|
|
//TODO 4、生成健康码,返回地址
|
|
|
|
// String fileName = "/qrCode/" + cn.hutool.core.date.DateUtil.today() + "/" + System.currentTimeMillis() + ".png";
|
|
|
|
// String path = WebConstant.UPLOAD_PATH_BASE+fileName;
|
|
|
@ -140,10 +141,8 @@ public class HealthService implements IHealthService{ |
|
|
|
// ,"d="+userId,color,path);
|
|
|
|
// String qrcodePath = PropUtil.qrCode + fileName;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//关联备注文件信息
|
|
|
|
List<HealthVo.HealthRemarkFileInfo> healthRemarkFileInfoList = new ArrayList<>(); |
|
|
|
List<String> filePath = new ArrayList<>(); |
|
|
|
if (CollectionUtil.isNotEmpty(healthInfo.getFileIdList())) { |
|
|
|
for (Long fileId : healthInfo.getFileIdList()) { |
|
|
|
HealthRemarkFile healthRemarkFile = healthRemarkFileDao.selectByPrimaryKey(fileId); |
|
|
@ -153,12 +152,13 @@ public class HealthService implements IHealthService{ |
|
|
|
healthRemarkFile.setHealthRecordsId(healthRecords.getId()); |
|
|
|
healthRemarkFileDao.updateByPrimaryKeySelective(healthRemarkFile); |
|
|
|
//添加至返回信息
|
|
|
|
HealthVo.HealthRemarkFileInfo fileInfo = new HealthVo.HealthRemarkFileInfo(); |
|
|
|
fileInfo.setFileId(healthRemarkFile.getId()); |
|
|
|
fileInfo.setFileName(healthRemarkFile.getName()); |
|
|
|
fileInfo.setFilePath(healthRemarkFile.getPath()); |
|
|
|
fileInfo.setTime(healthRemarkFile.getTime()); |
|
|
|
healthRemarkFileInfoList.add(fileInfo); |
|
|
|
filePath.add(healthRemarkFile.getPath()); |
|
|
|
// HealthVo.HealthRemarkFileInfo fileInfo = new HealthVo.HealthRemarkFileInfo();
|
|
|
|
// fileInfo.setFileId(healthRemarkFile.getId());
|
|
|
|
// fileInfo.setFileName(healthRemarkFile.getName());
|
|
|
|
// fileInfo.setFilePath(healthRemarkFile.getPath());
|
|
|
|
// fileInfo.setTime(healthRemarkFile.getTime());
|
|
|
|
// healthRemarkFileInfoList.add(fileInfo);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -175,11 +175,13 @@ public class HealthService implements IHealthService{ |
|
|
|
healthQRCode.setQrcodePath(qrcodePath); |
|
|
|
healthQRCode.setTime(System.currentTimeMillis()); |
|
|
|
healthQRCodeDao.insertSelective(healthQRCode); |
|
|
|
|
|
|
|
//6、查询健康信息和健康码地址返回前端
|
|
|
|
BeanUtil.copyProperties(healthRecords, healthInfoVo); |
|
|
|
healthInfoVo.setUserId(userId); |
|
|
|
healthInfoVo.setHealthCode(qrcodePath); |
|
|
|
healthInfoVo.setFileInfoList(healthRemarkFileInfoList); |
|
|
|
healthInfoVo.setFilePath(filePath); |
|
|
|
|
|
|
|
return healthInfoVo; |
|
|
|
} |
|
|
|
|
|
|
@ -199,6 +201,7 @@ public class HealthService implements IHealthService{ |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取个人健康信息 |
|
|
|
* |
|
|
|
* @param params |
|
|
|
* @return |
|
|
|
*/ |
|
|
@ -209,34 +212,32 @@ public class HealthService implements IHealthService{ |
|
|
|
Long startTime = selectDate.getStartTime() == null ? DateUtil.getZeroTime(new Date()) : selectDate.getStartTime(); |
|
|
|
Long endTime = selectDate.getEndTime() == null ? System.currentTimeMillis() : selectDate.getEndTime(); |
|
|
|
Long userId = params.getUserId(); |
|
|
|
// if(StrUtil.isEmpty(userId)){
|
|
|
|
// throw new BaseException(CodeEnum.NOT_LOGIN);
|
|
|
|
// }
|
|
|
|
// //2、通过userid查询出成员id
|
|
|
|
// Employee employee = userService.getEmployeeByUserId(Long.valueOf(userId));
|
|
|
|
log.info("获取个人健康打卡记录 userid:{}", userId); |
|
|
|
|
|
|
|
//3、查询该成员符合时间的记录
|
|
|
|
List<HealthVo.HealthInfo> healthInfoList = healthRecordsDao.selectHealthInfoByDate(userId, startTime, endTime); |
|
|
|
if(CollectionUtil.isNotEmpty(healthInfoList)){ |
|
|
|
for(HealthVo.HealthInfo healthInfo : healthInfoList){ |
|
|
|
healthInfo.setHealthLevel(0); |
|
|
|
//获取健康状态
|
|
|
|
HealthType healthType = healthTypeDao.selectByPrimaryKey(healthInfo.getHealthTypeId()); |
|
|
|
if(ObjectUtil.isNotNull(healthType)){ |
|
|
|
//如果健康状态异常,健康码为橙色
|
|
|
|
if(healthType.getQuarantine() != 0){ |
|
|
|
healthInfo.setHealthLevel(1); |
|
|
|
} |
|
|
|
healthInfo.setHealthTypeName(healthType.getName()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// if(CollectionUtil.isNotEmpty(healthInfoList)){
|
|
|
|
// for(HealthVo.HealthInfo healthInfo : healthInfoList){
|
|
|
|
// healthInfo.setHealthLevel(0);
|
|
|
|
// //获取健康状态
|
|
|
|
// HealthType healthType = healthTypeDao.selectByPrimaryKey(healthInfo.getHealthTypeId());
|
|
|
|
// if(ObjectUtil.isNotNull(healthType)){
|
|
|
|
// //如果健康状态异常,健康码为橙色
|
|
|
|
// if(healthType.getQuarantine() != 0){
|
|
|
|
// healthInfo.setHealthLevel(1);
|
|
|
|
// }
|
|
|
|
// healthInfo.setHealthTypeName(healthType.getName());
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//4、返回
|
|
|
|
return healthInfoList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取健康类型 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
@ -259,6 +260,7 @@ public class HealthService implements IHealthService{ |
|
|
|
|
|
|
|
/** |
|
|
|
* 健康状态统计 |
|
|
|
* |
|
|
|
* @param |
|
|
|
* @return |
|
|
|
*/ |
|
|
@ -270,32 +272,25 @@ public class HealthService implements IHealthService{ |
|
|
|
Long startTime = statisticsDate.getStartTime() == null ? DateUtil.getZeroTime(new Date()) : statisticsDate.getStartTime(); |
|
|
|
Long endTime = statisticsDate.getEndTime() == null ? System.currentTimeMillis() : statisticsDate.getEndTime(); |
|
|
|
|
|
|
|
//2、获取所有健康状态
|
|
|
|
int otherNumber = 0; |
|
|
|
HealthTypeExample healthTypeExample = new HealthTypeExample(); |
|
|
|
healthTypeExample.clear(); |
|
|
|
List<HealthType> healthTypeList = healthTypeDao.selectByExample(healthTypeExample); |
|
|
|
if(CollectionUtil.isNotEmpty(healthTypeList)){ |
|
|
|
for(HealthType healthType : healthTypeList){ |
|
|
|
//3、若需要单独统计则单独返回,否则都归为其他类返回总数
|
|
|
|
if(healthType.getIndependent() == 1){ |
|
|
|
//查询此状态在时间内的打卡人数
|
|
|
|
int number = healthRecordsDao.selectByTypeId(healthType.getId(),startTime,endTime); |
|
|
|
|
|
|
|
List<HealthVo.HealthTypeNumber> healthTypeNumberList = healthRecordsDao.selectHealthTypeNumber(startTime, endTime); |
|
|
|
int other = 0; |
|
|
|
if(CollectionUtil.isNotEmpty(healthTypeNumberList)){ |
|
|
|
for(HealthVo.HealthTypeNumber healthTypeNumber : healthTypeNumberList){ |
|
|
|
if(healthTypeNumber.getIndependent() == 0){ |
|
|
|
other += healthTypeNumber.getNumber(); |
|
|
|
}else { |
|
|
|
HealthVo.HealthTypeStatistics healthTypeStatistics = new HealthVo.HealthTypeStatistics(); |
|
|
|
healthTypeStatistics.setName(healthType.getName()); |
|
|
|
healthTypeStatistics.setNumber(number); |
|
|
|
healthTypeStatistics.setName(healthTypeNumber.getName()); |
|
|
|
healthTypeStatistics.setNumber(healthTypeNumber.getNumber()); |
|
|
|
healthTypeStatisticsList.add(healthTypeStatistics); |
|
|
|
}else { |
|
|
|
//查询此状态在时间内的打卡人数
|
|
|
|
int number = healthRecordsDao.selectByTypeId(healthType.getId(),startTime,endTime); |
|
|
|
otherNumber += number; |
|
|
|
} |
|
|
|
} |
|
|
|
HealthVo.HealthTypeStatistics healthTypeStatistics = new HealthVo.HealthTypeStatistics(); |
|
|
|
healthTypeStatistics.setName("其他"); |
|
|
|
healthTypeStatistics.setNumber(otherNumber); |
|
|
|
healthTypeStatistics.setNumber(other); |
|
|
|
healthTypeStatisticsList.add(healthTypeStatistics); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//获取查询的天数(正常应该一天打卡一次)
|
|
|
|
Long days = (endTime - startTime) / (3600 * 24 * 1000) + 1; |
|
|
@ -310,7 +305,48 @@ public class HealthService implements IHealthService{ |
|
|
|
notUploadStatistics.setNumber(0); |
|
|
|
} |
|
|
|
healthTypeStatisticsList.add(notUploadStatistics); |
|
|
|
} |
|
|
|
|
|
|
|
// //2、获取所有健康状态
|
|
|
|
// int otherNumber = 0;
|
|
|
|
// HealthTypeExample healthTypeExample = new HealthTypeExample();
|
|
|
|
// healthTypeExample.clear();
|
|
|
|
// List<HealthType> healthTypeList = healthTypeDao.selectByExample(healthTypeExample);
|
|
|
|
// if(CollectionUtil.isNotEmpty(healthTypeList)){
|
|
|
|
// for(HealthType healthType : healthTypeList){
|
|
|
|
// //3、若需要单独统计则单独返回,否则都归为其他类返回总数
|
|
|
|
// if(healthType.getIndependent() == 1){
|
|
|
|
// //查询此状态在时间内的打卡人数
|
|
|
|
// int number = healthRecordsDao.selectByTypeId(healthType.getId(),startTime,endTime);
|
|
|
|
// HealthVo.HealthTypeStatistics healthTypeStatistics = new HealthVo.HealthTypeStatistics();
|
|
|
|
// healthTypeStatistics.setName(healthType.getName());
|
|
|
|
// healthTypeStatistics.setNumber(number);
|
|
|
|
// healthTypeStatisticsList.add(healthTypeStatistics);
|
|
|
|
// }else {
|
|
|
|
// //查询此状态在时间内的打卡人数
|
|
|
|
// int number = healthRecordsDao.selectByTypeId(healthType.getId(),startTime,endTime);
|
|
|
|
// otherNumber += number;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// HealthVo.HealthTypeStatistics healthTypeStatistics = new HealthVo.HealthTypeStatistics();
|
|
|
|
// healthTypeStatistics.setName("其他");
|
|
|
|
// healthTypeStatistics.setNumber(otherNumber);
|
|
|
|
// healthTypeStatisticsList.add(healthTypeStatistics);
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// //获取查询的天数(正常应该一天打卡一次)
|
|
|
|
// Long days = (endTime - startTime) / (3600 * 24 * 1000) + 1;
|
|
|
|
// //未上报的次数
|
|
|
|
// HealthVo.NotUpload notUpload = healthRecordsDao.getNotUpload(days,startTime,endTime);
|
|
|
|
//
|
|
|
|
// HealthVo.HealthTypeStatistics notUploadStatistics = new HealthVo.HealthTypeStatistics();
|
|
|
|
// notUploadStatistics.setName("未上报");
|
|
|
|
// if(ObjectUtil.isNotNull(notUpload)){
|
|
|
|
// notUploadStatistics.setNumber((int) (notUpload.getNumber() * days - notUpload.getTimes()));
|
|
|
|
// }else {
|
|
|
|
// notUploadStatistics.setNumber(0);
|
|
|
|
// }
|
|
|
|
// healthTypeStatisticsList.add(notUploadStatistics);
|
|
|
|
// }
|
|
|
|
return healthTypeStatisticsList; |
|
|
|
} |
|
|
|
|
|
|
@ -324,6 +360,7 @@ public class HealthService implements IHealthService{ |
|
|
|
|
|
|
|
/** |
|
|
|
* 上传备注文件 |
|
|
|
* |
|
|
|
* @param filePath |
|
|
|
* @param name |
|
|
|
* @return |
|
|
|