Commit f1816774 by 朱淼
parents da52f87e 9a789806
...@@ -29,6 +29,7 @@ public enum CodeMessageEnum { ...@@ -29,6 +29,7 @@ public enum CodeMessageEnum {
SYSTEM_ERROR_NAME_DUPLICATE(500, "SYSTEM.ERROR.NAME.DUPLICATE"), SYSTEM_ERROR_NAME_DUPLICATE(500, "SYSTEM.ERROR.NAME.DUPLICATE"),
SYSTEM_ERROR_NAME_ENG_DUPLICATE(500, "SYSTEM.ERROR.NAME.ENG.DUPLICATE"), SYSTEM_ERROR_NAME_ENG_DUPLICATE(500, "SYSTEM.ERROR.NAME.ENG.DUPLICATE"),
SYSTEM_ERROR_CODE_DUPLICATE(500, "SYSTEM.ERROR.CODE.DUPLICATE"), SYSTEM_ERROR_CODE_DUPLICATE(500, "SYSTEM.ERROR.CODE.DUPLICATE"),
SYSTEM_ERROR_MENU_CODE_DUPLICATE(500, "SYSTEM.ERROR.MENU.CODE.DUPLICATE"),
SYSTEM_ERROR_TENANT_CODE_DUPLICATE(500, "SYSTEM.ERROR.TENANT.CODE.DUPLICATE"), SYSTEM_ERROR_TENANT_CODE_DUPLICATE(500, "SYSTEM.ERROR.TENANT.CODE.DUPLICATE"),
SYSTEM_ERROR_DICT_VALUE_DUPLICATE(500, "SYSTEM.ERROR.DICT.VALUE.DUPLICATE"), SYSTEM_ERROR_DICT_VALUE_DUPLICATE(500, "SYSTEM.ERROR.DICT.VALUE.DUPLICATE"),
SYSTEM_ERROR_DICT_NOT_EXIST(500, "SYSTEM.ERROR.DICT.NOT.EXIST"), SYSTEM_ERROR_DICT_NOT_EXIST(500, "SYSTEM.ERROR.DICT.NOT.EXIST"),
......
...@@ -9,7 +9,9 @@ import lombok.Getter; ...@@ -9,7 +9,9 @@ import lombok.Getter;
public enum DeviceState { public enum DeviceState {
notActive("notActive","禁用"), notActive("notActive","禁用"),
offline("offline","离线"), offline("offline","离线"),
online("online","在线"); online("online","在线"),
abnormal("abnormal","故障");
private final String value; private final String value;
private final String name; private final String name;
......
...@@ -113,3 +113,5 @@ PLATFORM.ERROR.ALARM.NOT.FOUND.ELDER=设备空间下无长者 ...@@ -113,3 +113,5 @@ PLATFORM.ERROR.ALARM.NOT.FOUND.ELDER=设备空间下无长者
SYSTEM.ERROR.TENANT.FORBIDDEN=该租户被禁用 SYSTEM.ERROR.TENANT.FORBIDDEN=该租户被禁用
SYSTEM.ERROR.ORG.FORBIDDEN=该组织被禁用 SYSTEM.ERROR.ORG.FORBIDDEN=该组织被禁用
SYSTEM.ERROR.MENU.CODE.DUPLICATE=跳转页面已存在
...@@ -38,20 +38,20 @@ public class PlatElderReportMonthController { ...@@ -38,20 +38,20 @@ public class PlatElderReportMonthController {
@ApiOperation("综合评价") @ApiOperation("综合评价")
@PostMapping("comprehensiveEvaluation") @PostMapping("comprehensiveEvaluation")
public ApiResponseEntity<PlatElderComprehensiveEvaluationVO> comprehensiveEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) { public ApiResponseEntity<PlatElderComprehensiveEvaluationVO> comprehensiveEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null; return ApiResponseUtils.success(platElderReportMonthService.comprehensiveEvaluation(platElderIdDTO));
} }
@ApiOperation("睡眠评价") @ApiOperation("睡眠评价")
@PostMapping("sleepEvaluation") @PostMapping("sleepEvaluation")
public ApiResponseEntity<PlatElderSleepEvaluationVO> sleepEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) { public ApiResponseEntity<PlatElderSleepEvaluationVO> sleepEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null; return ApiResponseUtils.success(platElderReportMonthService.sleepEvaluation(platElderIdDTO));
} }
@ApiOperation("心率呼吸评价") @ApiOperation("心率呼吸评价")
@PostMapping("heartRespiratoryEvaluation") @PostMapping("heartRespiratoryEvaluation")
public ApiResponseEntity<PlatElderHeartRespiratoryEvaluationVO> heartRespiratoryEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) { public ApiResponseEntity<PlatElderHeartRespiratoryEvaluationVO> heartRespiratoryEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null; return ApiResponseUtils.success(platElderReportMonthService.heartRespiratoryEvaluation(platElderIdDTO));
} }
@ApiOperation("月报表") @ApiOperation("月报表")
......
...@@ -26,7 +26,7 @@ public class SaasPrivacyConfigDTO implements Serializable { ...@@ -26,7 +26,7 @@ public class SaasPrivacyConfigDTO implements Serializable {
@ApiModelProperty("标题") @ApiModelProperty("标题")
private String title; private String title;
@Size(max = 1800, message = "申请说明最长为1800字符") @Size(max = 5000, message = "申请说明最长为5000字符")
@ApiModelProperty(value="内容") @ApiModelProperty(value="内容")
private String content; private String content;
......
...@@ -41,9 +41,11 @@ public class PlatDevice extends BaseBusEntity { ...@@ -41,9 +41,11 @@ public class PlatDevice extends BaseBusEntity {
private String firmwareVersion; private String firmwareVersion;
@ApiModelProperty(value = "注册时间") @ApiModelProperty(value = "注册时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime registrationDate; private LocalDateTime registrationDate;
@ApiModelProperty(value = "最后上线时间") @ApiModelProperty(value = "最后上线时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime lastOnlineData; private LocalDateTime lastOnlineData;
@ApiModelProperty(value = "说明") @ApiModelProperty(value = "说明")
......
...@@ -128,7 +128,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -128,7 +128,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
.le(Objects.nonNull(param.getCreateDateTo()), BaseEntity::getCreateDate, param.getCreateDateTo()) .le(Objects.nonNull(param.getCreateDateTo()), BaseEntity::getCreateDate, param.getCreateDateTo())
.eq(StringUtils.isNotBlank(param.getAlarmType()), PlatAlarmRecord::getAlarmType, param.getAlarmType()) .eq(StringUtils.isNotBlank(param.getAlarmType()), PlatAlarmRecord::getAlarmType, param.getAlarmType())
.eq(StringUtils.isNotBlank(param.getStatus()), PlatAlarmRecord::getStatus, param.getStatus()) .eq(StringUtils.isNotBlank(param.getStatus()), PlatAlarmRecord::getStatus, param.getStatus())
.eq(StringUtils.isNotBlank(param.getDealUser()), PlatAlarmRecord::getDealUser, param.getDealUser()) .like(StringUtils.isNotBlank(param.getDealUser()), PlatAlarmRecord::getDealUser, param.getDealUser())
.ge(Objects.nonNull(param.getDealDateFrom()), PlatAlarmRecord::getDealDate, param.getDealDateFrom()) .ge(Objects.nonNull(param.getDealDateFrom()), PlatAlarmRecord::getDealDate, param.getDealDateFrom())
.le(Objects.nonNull(param.getDealDateTo()), PlatAlarmRecord::getDealDate, param.getDealDateTo()) .le(Objects.nonNull(param.getDealDateTo()), PlatAlarmRecord::getDealDate, param.getDealDateTo())
.eq(StringUtils.isNotBlank(param.getOrgId()), PlatAlarmRecord::getOrgId, param.getOrgId()) .eq(StringUtils.isNotBlank(param.getOrgId()), PlatAlarmRecord::getOrgId, param.getOrgId())
......
...@@ -13,6 +13,7 @@ import com.makeit.entity.platform.auth.PlatOrg; ...@@ -13,6 +13,7 @@ import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.auth.PlatRole; import com.makeit.entity.platform.auth.PlatRole;
import com.makeit.entity.platform.auth.PlatRoleOrg; import com.makeit.entity.platform.auth.PlatRoleOrg;
import com.makeit.entity.platform.auth.PlatUserRole; import com.makeit.entity.platform.auth.PlatUserRole;
import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.enums.CodeMessageEnum; import com.makeit.enums.CodeMessageEnum;
import com.makeit.enums.CommonEnum; import com.makeit.enums.CommonEnum;
import com.makeit.enums.id.TreeConst; import com.makeit.enums.id.TreeConst;
...@@ -25,6 +26,7 @@ import com.makeit.service.platform.auth.PlatRoleOrgService; ...@@ -25,6 +26,7 @@ import com.makeit.service.platform.auth.PlatRoleOrgService;
import com.makeit.service.platform.auth.PlatRoleService; import com.makeit.service.platform.auth.PlatRoleService;
import com.makeit.service.platform.auth.PlatUserRoleService; import com.makeit.service.platform.auth.PlatUserRoleService;
import com.makeit.service.platform.auth.PlatUserService; import com.makeit.service.platform.auth.PlatUserService;
import com.makeit.service.platform.space.PlatSpaceService;
import com.makeit.utils.data.convert.PageUtil; import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil; import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.user.plat.PlatUserUtil; import com.makeit.utils.user.plat.PlatUserUtil;
...@@ -70,6 +72,8 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -70,6 +72,8 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
@Autowired @Autowired
private PlatAlarmConfigService platAlarmConfigService; private PlatAlarmConfigService platAlarmConfigService;
@Autowired
private PlatSpaceService platSpaceService;
@Override @Override
public List<PlatOrg> filter(List<PlatOrg> deptList, PlatOrgQueryDTO dto) { public List<PlatOrg> filter(List<PlatOrg> deptList, PlatOrgQueryDTO dto) {
...@@ -299,12 +303,22 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -299,12 +303,22 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
@Override @Override
public void edit(PlatOrg dto) { public void edit(PlatOrg dto) {
check(dto); check(dto);
PlatOrg platOrg = this.getById(dto.getId());
if (StringUtils.isBlank(dto.getParentId())||StringUtils.equals(dto.getParentId(),"1")) { if (StringUtils.isBlank(dto.getParentId())||StringUtils.equals(dto.getParentId(),"1")) {
} else { } else {
PlatOrg parent = getById(dto.getParentId()); PlatOrg parent = getById(dto.getParentId());
dto.setPath(parent.getPath() + "," + parent.getId()); dto.setPath(parent.getPath() + "," + parent.getId());
} }
if(!StringUtils.equals(dto.getType(),platOrg.getType())){
LambdaUpdateWrapper<PlatSpace> platSpaceLambdaUpdateWrapper = Wrappers.lambdaUpdate(PlatSpace.class)
.set(PlatSpace::getAttribute, dto.getType())
.eq(PlatSpace::getOrgId, dto.getId());
platSpaceService.update(platSpaceLambdaUpdateWrapper);
}
updateById(dto); updateById(dto);
} }
......
...@@ -82,6 +82,7 @@ implements PlatRoleService { ...@@ -82,6 +82,7 @@ implements PlatRoleService {
.like(StringUtils.isNotBlank(dto.getName()), PlatRole::getName, dto.getName()) .like(StringUtils.isNotBlank(dto.getName()), PlatRole::getName, dto.getName())
.in(dto.getNameList() != null, PlatRole::getName, dto.getNameList()) .in(dto.getNameList() != null, PlatRole::getName, dto.getNameList())
.eq(StringUtils.isNotBlank(dto.getOrgId()), PlatRole::getOrgId, dto.getOrgId()) .eq(StringUtils.isNotBlank(dto.getOrgId()), PlatRole::getOrgId, dto.getOrgId())
.eq(StringUtils.isNotBlank(dto.getStatus()),PlatRole::getStatus,dto.getStatus())
.orderByDesc(PlatRole::getCreateDate); .orderByDesc(PlatRole::getCreateDate);
} }
......
...@@ -387,11 +387,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -387,11 +387,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_AUTH_USER_PASSWORD); throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_AUTH_USER_PASSWORD);
} }
/**
* 校验机场
*/
//checkUserOrg(platUser);
PlatUserLoginVO userLoginVO = BeanDtoVoUtils.convert(platUser, PlatUserLoginVO.class); PlatUserLoginVO userLoginVO = BeanDtoVoUtils.convert(platUser, PlatUserLoginVO.class);
String token = IdGen.getUUID(); String token = IdGen.getUUID();
...@@ -404,14 +399,14 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -404,14 +399,14 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
return userLoginVO; return userLoginVO;
} }
@Override
public void checkTenantOrgStatus(PlatUser platUser) { public void checkTenantOrgStatus(PlatUser platUser) {
PlatTenant platTenant = platTenantService.getById(platUser.getTenantId()); PlatTenant platTenant = platTenantService.getById(platUser.getTenantId());
if(platTenant == null || StringUtils.equals(platTenant.getStatus(),CommonEnum.NO.getValue())){ if(platTenant == null || StringUtils.equals(platTenant.getStatus(),CommonEnum.NO.getValue())){
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_TENANT_FORBIDDEN); throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_TENANT_FORBIDDEN);
} }
PlatOrg platOrg = platOrgService.getById(platUser.getOrgId()); if(StringUtils.equals(platUser.getIsTenant(),CommonEnum.NO.getValue())) {
if(platOrg == null || StringUtils.equals(platOrg.getStatus(),CommonEnum.NO.getValue())){ checkUserOrg(platUser);
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_ORG_FORBIDDEN);
} }
} }
...@@ -434,7 +429,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -434,7 +429,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.eq(PlatOrg::getStatus, CommonEnum.NO.getValue()); .eq(PlatOrg::getStatus, CommonEnum.NO.getValue());
long count = platOrgService.count(platOrgLambdaQueryWrapper); long count = platOrgService.count(platOrgLambdaQueryWrapper);
if (count > 0) { if (count > 0) {
throw new BusinessException("禁用的子公司其下属账号无法登录"); throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_ORG_FORBIDDEN);
} }
} }
......
...@@ -8,6 +8,7 @@ import com.makeit.vo.platform.elder.report.week.PlatElderComprehensiveEvaluation ...@@ -8,6 +8,7 @@ import com.makeit.vo.platform.elder.report.week.PlatElderComprehensiveEvaluation
import com.makeit.vo.platform.elder.report.week.PlatElderRealTimeHeartRespiratoryWeekVO; import com.makeit.vo.platform.elder.report.week.PlatElderRealTimeHeartRespiratoryWeekVO;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import java.time.LocalDate;
import java.util.List; import java.util.List;
/** /**
...@@ -20,10 +21,16 @@ import java.util.List; ...@@ -20,10 +21,16 @@ import java.util.List;
*/ */
public interface PlatElderDayReportWeekService { public interface PlatElderDayReportWeekService {
PlatElderComprehensiveEvaluationVO comprehensiveEvaluationInternal(PlatElderSleepEvaluationVO platElderSleepEvaluationVO, PlatElderHeartRespiratoryEvaluationVO platElderHeartRespiratoryEvaluationVO);
PlatElderComprehensiveEvaluationVO comprehensiveEvaluation(PlatElderReportDTO platElderIdDTO); PlatElderComprehensiveEvaluationVO comprehensiveEvaluation(PlatElderReportDTO platElderIdDTO);
PlatElderSleepEvaluationVO sleepEvaluationInternal(PlatElderReportDTO platElderIdDTO, LocalDate weekStartDate, LocalDate weekEndDate);
PlatElderSleepEvaluationVO sleepEvaluation(PlatElderReportDTO platElderIdDTO); PlatElderSleepEvaluationVO sleepEvaluation(PlatElderReportDTO platElderIdDTO);
PlatElderHeartRespiratoryEvaluationVO heartRespiratoryEvaluationInternal(PlatElderReportDTO platElderIdDTO, LocalDate weekStartDate, LocalDate weekEndDate);
PlatElderHeartRespiratoryEvaluationVO heartRespiratoryEvaluation(PlatElderReportDTO platElderIdDTO); PlatElderHeartRespiratoryEvaluationVO heartRespiratoryEvaluation(PlatElderReportDTO platElderIdDTO);
List<PlatElderHeartRespiratoryEvaluationRecordVO> heartExceptionRecordList(PlatElderReportDTO platElderIdDTO); List<PlatElderHeartRespiratoryEvaluationRecordVO> heartExceptionRecordList(PlatElderReportDTO platElderIdDTO);
......
...@@ -3,7 +3,10 @@ package com.makeit.service.platform.elder; ...@@ -3,7 +3,10 @@ package com.makeit.service.platform.elder;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.dto.platform.elder.PlatElderReportDTO; import com.makeit.dto.platform.elder.PlatElderReportDTO;
import com.makeit.entity.platform.elder.PlatElderReportMonth; import com.makeit.entity.platform.elder.PlatElderReportMonth;
import com.makeit.vo.platform.elder.report.day.PlatElderHeartRespiratoryEvaluationVO;
import com.makeit.vo.platform.elder.report.day.PlatElderReportMonthVO; import com.makeit.vo.platform.elder.report.day.PlatElderReportMonthVO;
import com.makeit.vo.platform.elder.report.day.PlatElderSleepEvaluationVO;
import com.makeit.vo.platform.elder.report.week.PlatElderComprehensiveEvaluationVO;
import java.util.List; import java.util.List;
...@@ -17,6 +20,12 @@ import java.util.List; ...@@ -17,6 +20,12 @@ import java.util.List;
*/ */
public interface PlatElderReportMonthService extends IService<PlatElderReportMonth> { public interface PlatElderReportMonthService extends IService<PlatElderReportMonth> {
PlatElderComprehensiveEvaluationVO comprehensiveEvaluation(PlatElderReportDTO platElderIdDTO);
PlatElderSleepEvaluationVO sleepEvaluation(PlatElderReportDTO platElderIdDTO);
PlatElderHeartRespiratoryEvaluationVO heartRespiratoryEvaluation(PlatElderReportDTO platElderIdDTO);
List<PlatElderReportMonthVO> reportMonth(PlatElderReportDTO platElderIdDTO); List<PlatElderReportMonthVO> reportMonth(PlatElderReportDTO platElderIdDTO);
......
...@@ -62,7 +62,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek ...@@ -62,7 +62,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
private PlatElderBreatheDayStatService platElderBreatheDayStatService; private PlatElderBreatheDayStatService platElderBreatheDayStatService;
private LocalDateTime weekStartDateTime(LocalDateTime defaultTime) { private LocalDateTime weekStartDateTime(LocalDateTime defaultTime) {
return weekStartDateTime(LocalDate.now(), defaultTime); return weekStartDateTime(LocalDate.now().minusDays(1), defaultTime);
} }
private LocalDateTime weekStartDateTime(LocalDate now, LocalDateTime defaultTime) { private LocalDateTime weekStartDateTime(LocalDate now, LocalDateTime defaultTime) {
...@@ -79,7 +79,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek ...@@ -79,7 +79,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
} }
private LocalDateTime weekEndDateTime(LocalDateTime defaultTime) { private LocalDateTime weekEndDateTime(LocalDateTime defaultTime) {
return weekStartDateTime(LocalDate.now(), defaultTime); return weekStartDateTime(LocalDate.now().minusDays(1), defaultTime);
} }
private LocalDateTime weekEndDateTime(LocalDate now, LocalDateTime defaultTime) { private LocalDateTime weekEndDateTime(LocalDate now, LocalDateTime defaultTime) {
...@@ -97,7 +97,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek ...@@ -97,7 +97,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
private LocalDate weekStartDate(LocalDateTime defaultTime) { private LocalDate weekStartDate(LocalDateTime defaultTime) {
return weekStartDate(LocalDate.now(), defaultTime); return weekStartDate(LocalDate.now().minusDays(1), defaultTime);
} }
private LocalDate weekStartDate(LocalDate now, LocalDateTime defaultTime) { private LocalDate weekStartDate(LocalDate now, LocalDateTime defaultTime) {
...@@ -112,7 +112,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek ...@@ -112,7 +112,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
} }
private LocalDate weekEndDate(LocalDateTime defaultTime) { private LocalDate weekEndDate(LocalDateTime defaultTime) {
return weekStartDate(LocalDate.now(), defaultTime); return weekStartDate(LocalDate.now().minusDays(1), defaultTime);
} }
private LocalDate weekEndDate(LocalDate now, LocalDateTime defaultTime) { private LocalDate weekEndDate(LocalDate now, LocalDateTime defaultTime) {
...@@ -127,10 +127,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek ...@@ -127,10 +127,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
} }
@Override @Override
public PlatElderComprehensiveEvaluationVO comprehensiveEvaluation(PlatElderReportDTO platElderIdDTO) { public PlatElderComprehensiveEvaluationVO comprehensiveEvaluationInternal(PlatElderSleepEvaluationVO platElderSleepEvaluationVO, PlatElderHeartRespiratoryEvaluationVO platElderHeartRespiratoryEvaluationVO) {
PlatElderSleepEvaluationVO platElderSleepEvaluationVO = sleepEvaluation(platElderIdDTO);
PlatElderHeartRespiratoryEvaluationVO platElderHeartRespiratoryEvaluationVO = heartRespiratoryEvaluation(platElderIdDTO);
PlatElderComprehensiveEvaluationVO platElderComprehensiveEvaluationVO = new PlatElderComprehensiveEvaluationVO(); PlatElderComprehensiveEvaluationVO platElderComprehensiveEvaluationVO = new PlatElderComprehensiveEvaluationVO();
platElderComprehensiveEvaluationVO.setScore((platElderSleepEvaluationVO.getScore() + platElderHeartRespiratoryEvaluationVO.getScore()) / 2); platElderComprehensiveEvaluationVO.setScore((platElderSleepEvaluationVO.getScore() + platElderHeartRespiratoryEvaluationVO.getScore()) / 2);
...@@ -145,14 +142,22 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek ...@@ -145,14 +142,22 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
} }
@Override @Override
public PlatElderSleepEvaluationVO sleepEvaluation(PlatElderReportDTO platElderIdDTO) { public PlatElderComprehensiveEvaluationVO comprehensiveEvaluation(PlatElderReportDTO platElderIdDTO) {
LocalDate weekStartDate = weekStartDate(platElderIdDTO.getStartTime()); PlatElderSleepEvaluationVO platElderSleepEvaluationVO = sleepEvaluation(platElderIdDTO);
LocalDate weekEndDate = weekStartDate(platElderIdDTO.getEndTime()); PlatElderHeartRespiratoryEvaluationVO platElderHeartRespiratoryEvaluationVO = heartRespiratoryEvaluation(platElderIdDTO);
return comprehensiveEvaluationInternal(platElderSleepEvaluationVO, platElderHeartRespiratoryEvaluationVO);
}
@Override
public PlatElderSleepEvaluationVO sleepEvaluationInternal(PlatElderReportDTO platElderIdDTO, LocalDate weekStartDate, LocalDate weekEndDate) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
List<PlatElderSleepAnalysis> sleepAnalysisList = platElderSleepAnalysisService.list(new QueryWrapper<PlatElderSleepAnalysis>().lambda() List<PlatElderSleepAnalysis> sleepAnalysisList = platElderSleepAnalysisService.list(new QueryWrapper<PlatElderSleepAnalysis>().lambda()
.eq(PlatElderSleepAnalysis::getElderId, platElderIdDTO.getElderId())
.ge(PlatElderSleepAnalysis::getHappenDate, dateTimeFormatter.format(weekStartDate)) .ge(PlatElderSleepAnalysis::getHappenDate, dateTimeFormatter.format(weekStartDate))
.le(PlatElderSleepAnalysis::getHappenDate, dateTimeFormatter.format(weekEndDate)) .le(PlatElderSleepAnalysis::getHappenDate, dateTimeFormatter.format(weekEndDate))
); );
...@@ -184,12 +189,20 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek ...@@ -184,12 +189,20 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
} }
@Override @Override
public PlatElderHeartRespiratoryEvaluationVO heartRespiratoryEvaluation(PlatElderReportDTO platElderIdDTO) { public PlatElderSleepEvaluationVO sleepEvaluation(PlatElderReportDTO platElderIdDTO) {
LocalDate weekStartDate = weekStartDate(platElderIdDTO.getStartTime()); LocalDate weekStartDate = weekStartDate(platElderIdDTO.getStartTime());
LocalDate weekEndDate = weekStartDate(platElderIdDTO.getEndTime()); LocalDate weekEndDate = weekStartDate(platElderIdDTO.getEndTime());
return sleepEvaluationInternal(platElderIdDTO, weekStartDate, weekEndDate);
}
@Override
public PlatElderHeartRespiratoryEvaluationVO heartRespiratoryEvaluationInternal(PlatElderReportDTO platElderIdDTO, LocalDate weekStartDate, LocalDate weekEndDate) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
List<PlatElderBreatheAnalysis> breatheAnalyses = platElderBreatheAnalysisService.list(new QueryWrapper<PlatElderBreatheAnalysis>().lambda() List<PlatElderBreatheAnalysis> breatheAnalyses = platElderBreatheAnalysisService.list(new QueryWrapper<PlatElderBreatheAnalysis>().lambda()
...@@ -216,6 +229,17 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek ...@@ -216,6 +229,17 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
} }
@Override
public PlatElderHeartRespiratoryEvaluationVO heartRespiratoryEvaluation(PlatElderReportDTO platElderIdDTO) {
LocalDate weekStartDate = weekStartDate(platElderIdDTO.getStartTime());
LocalDate weekEndDate = weekStartDate(platElderIdDTO.getEndTime());
return heartRespiratoryEvaluationInternal(platElderIdDTO, weekStartDate, weekEndDate);
}
@Override @Override
public List<PlatElderHeartRespiratoryEvaluationRecordVO> heartExceptionRecordList(PlatElderReportDTO platElderIdDTO) { public List<PlatElderHeartRespiratoryEvaluationRecordVO> heartExceptionRecordList(PlatElderReportDTO platElderIdDTO) {
......
...@@ -5,10 +5,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -5,10 +5,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.dto.platform.elder.PlatElderReportDTO; import com.makeit.dto.platform.elder.PlatElderReportDTO;
import com.makeit.entity.platform.elder.PlatElderReportMonth; import com.makeit.entity.platform.elder.PlatElderReportMonth;
import com.makeit.mapper.platform.elder.PlatElderReportMonthMapper; import com.makeit.mapper.platform.elder.PlatElderReportMonthMapper;
import com.makeit.service.platform.elder.PlatElderDayReportWeekService;
import com.makeit.service.platform.elder.PlatElderReportMonthService; import com.makeit.service.platform.elder.PlatElderReportMonthService;
import com.makeit.utils.data.convert.BeanDtoVoUtils; import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.time.LocalDateTimeUtils; import com.makeit.utils.time.LocalDateTimeUtils;
import com.makeit.vo.platform.elder.report.day.PlatElderHeartRespiratoryEvaluationVO;
import com.makeit.vo.platform.elder.report.day.PlatElderReportMonthVO; import com.makeit.vo.platform.elder.report.day.PlatElderReportMonthVO;
import com.makeit.vo.platform.elder.report.day.PlatElderSleepEvaluationVO;
import com.makeit.vo.platform.elder.report.week.PlatElderComprehensiveEvaluationVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate; import java.time.LocalDate;
...@@ -25,6 +30,57 @@ import java.util.List; ...@@ -25,6 +30,57 @@ import java.util.List;
@Service @Service
public class PlatElderReportMonthServiceImpl extends ServiceImpl<PlatElderReportMonthMapper, PlatElderReportMonth> implements PlatElderReportMonthService { public class PlatElderReportMonthServiceImpl extends ServiceImpl<PlatElderReportMonthMapper, PlatElderReportMonth> implements PlatElderReportMonthService {
@Autowired
private PlatElderDayReportWeekService platElderDayReportWeekService;
public LocalDate monthStartDate(PlatElderReportDTO platElderIdDTO) {
return monthStartDate(platElderIdDTO.getYear(), platElderIdDTO.getMonth());
}
public LocalDate monthStartDate(Integer year, Integer month) {
if (year != null && month == null) {
throw new RuntimeException();
}
if (year == null && month != null) {
throw new RuntimeException();
}
if (year != null) {
return LocalDate.of(year, month, 1);
}
return LocalDateTimeUtils.getMonthMin(LocalDate.now().minusMonths(1));
}
public LocalDate monthEndDate(PlatElderReportDTO platElderIdDTO) {
return monthEndDate(platElderIdDTO.getYear(), platElderIdDTO.getMonth());
}
public LocalDate monthEndDate(Integer year, Integer month) {
return LocalDateTimeUtils.getMonthMax(monthStartDate(year, month));
}
@Override
public PlatElderComprehensiveEvaluationVO comprehensiveEvaluation(PlatElderReportDTO platElderIdDTO) {
PlatElderSleepEvaluationVO platElderSleepEvaluationVO = sleepEvaluation(platElderIdDTO);
PlatElderHeartRespiratoryEvaluationVO platElderHeartRespiratoryEvaluationVO = heartRespiratoryEvaluation(platElderIdDTO);
return platElderDayReportWeekService.comprehensiveEvaluationInternal(platElderSleepEvaluationVO, platElderHeartRespiratoryEvaluationVO);
}
@Override
public PlatElderSleepEvaluationVO sleepEvaluation(PlatElderReportDTO platElderIdDTO) {
return platElderDayReportWeekService.sleepEvaluationInternal(platElderIdDTO, monthStartDate(platElderIdDTO), monthEndDate(platElderIdDTO));
}
@Override
public PlatElderHeartRespiratoryEvaluationVO heartRespiratoryEvaluation(PlatElderReportDTO platElderIdDTO) {
return platElderDayReportWeekService.heartRespiratoryEvaluationInternal(platElderIdDTO, monthStartDate(platElderIdDTO), monthEndDate(platElderIdDTO));
}
@Override @Override
public List<PlatElderReportMonthVO> reportMonth(PlatElderReportDTO platElderIdDTO) { public List<PlatElderReportMonthVO> reportMonth(PlatElderReportDTO platElderIdDTO) {
......
...@@ -172,7 +172,7 @@ public class PlatMenuServiceImpl extends ServiceImpl<PlatMenuMapper, PlatMenu> ...@@ -172,7 +172,7 @@ public class PlatMenuServiceImpl extends ServiceImpl<PlatMenuMapper, PlatMenu>
PlatMenu old = getOne(new QueryWrapper<PlatMenu>().lambda() PlatMenu old = getOne(new QueryWrapper<PlatMenu>().lambda()
.eq(PlatMenu::getCode, dto.getCode())); .eq(PlatMenu::getCode, dto.getCode()));
if (old != null && !old.getId().equals(dto.getId())) { if (old != null && !old.getId().equals(dto.getId())) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_CODE_DUPLICATE); throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_MENU_CODE_DUPLICATE);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment