Commit 19788a3c by 汪志阳

fix:组织config查询

parent 521bbf36
......@@ -3,6 +3,7 @@ package com.makeit.mapper.platform.alarm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.makeit.dto.platform.alarm.PlatHealthConfigDTO;
import com.makeit.entity.platform.alarm.PlatAlarmConfig;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -21,4 +22,6 @@ public interface PlatAlarmConfigMapper extends BaseMapper<PlatAlarmConfig> {
* @return
*/
List<PlatHealthConfigDTO> getHealthConfigList();
List<PlatAlarmConfig> listOffBed(@Param("orgDeviceId") String orgDeviceId);
}
......@@ -42,4 +42,6 @@ public interface PlatAlarmConfigService extends IService<PlatAlarmConfig> {
List<PlatHealthConfigDTO> getHealthConfigList();
void initData();
List<PlatAlarmConfig> listOfBed(String orgId);
}
package com.makeit.service.platform.alarm.alarmStrategy;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSONObject;
import com.makeit.dto.platform.alarm.PlatAlarmCheckDTO;
......@@ -61,10 +62,16 @@ public class OffBedAlarm implements IAlarm {
log.error("离床告警心率设备未关联长者,设备plat_id:" + platAlarmCheckDTO.getPlatDevice().getId());
return;
}
PlatAlarmConfig config = alarmConfigCacheUtil.get(platDevice.getOrgId(), PlatAlarmConfigEnum.AlarmTypeEnum.OFF_BED.getValue());
// PlatAlarmConfig config = alarmConfigCacheUtil.get(platDevice.getOrgId(), PlatAlarmConfigEnum.AlarmTypeEnum.OFF_BED.getValue());
// PlatAlarmConfig platAlarmConfig = platAlarmCheckDTO.getPlatAlarmConfig();
log.info("离床告警dto,org_config:{}", config.getRuleConfig());
offBedCheckAlarm(config, platAlarmCheckDTO, platDevice);
List<PlatAlarmConfig> configList = platAlarmConfigService.listOfBed(platDevice.getOriDeviceId());
if(CollUtil.isNotEmpty(configList)) {
configList.forEach(c -> {
log.info("离床告警dto,org_config:{}", c.getRuleConfig());
offBedCheckAlarm(c, platAlarmCheckDTO, platDevice);
});
}
}
......@@ -224,10 +231,10 @@ public class OffBedAlarm implements IAlarm {
LocalTime endTimeLimit = endTime.plusMinutes(-duration);
// 离床时间在范围内
if (isInTime && isOverTime) {
// if (firstTime.isAfter(endTimeLimit)) {
// log.info("handleUnCrossDay第一次离床时间,{}+持续时间:{}将超过范围,{}", firstTime, duration, endTime);
// return;
// }
if (firstTime.isAfter(endTimeLimit)) {
log.info("handleUnCrossDay第一次离床时间,{}+持续时间:{}将超过范围,{}", firstTime, duration, endTime);
return;
}
platAlarmCheckDTO.setAbnormalValue(String.valueOf(currentTimeMillis - firstOffBedLong));
platAlarmCheckDTO.setPlatAlarmConfig(config);
log.info("uncross离床告警离床时间在范围时间内,配置:{}", config.getRuleConfig());
......@@ -236,7 +243,7 @@ public class OffBedAlarm implements IAlarm {
}
LocalDateTime now = currentTime();
LocalTime localTime = LocalTime.now();
LocalTime localTime = LocalTime.now().plusHours(13);
if (!isInTime && localTime.isAfter(startTime) && localTime.isBefore(endTime)) {
long mills = Duration.between(startLocalDteTime, now).toMillis() / 1000;
boolean noInOverTime = mills >= duration * 60;
......@@ -321,8 +328,8 @@ public class OffBedAlarm implements IAlarm {
}
private LocalDateTime currentTime() {
// return LocalDateTime.now().plusHours(3);
return LocalDateTime.now();
return LocalDateTime.now().plusHours(13);
// return LocalDateTime.now();
}
private LocalDateTime longToTime(Long longTime) {
......
......@@ -16,6 +16,7 @@ import com.makeit.enums.CodeMessageEnum;
import com.makeit.enums.CommonEnum;
import com.makeit.enums.id.IdConst;
import com.makeit.exception.BusinessException;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.global.aspect.tenant.TenantIdUtil;
import com.makeit.mapper.platform.alarm.PlatAlarmConfigMapper;
import com.makeit.service.platform.alarm.PlatAlarmConfigService;
......@@ -57,6 +58,8 @@ public class PlatAlarmConfigServiceImpl extends ServiceImpl<PlatAlarmConfigMappe
private AlarmConfigCacheUtil alarmConfigUtil;
@Resource
private PlatOrgService platOrgService;
@Resource
private PlatAlarmConfigMapper configMapper;
@Override
public List<PlatAlarmConfigListVO> list(PlatAlarmConfigQueryDTO dto) {
......@@ -256,4 +259,10 @@ public class PlatAlarmConfigServiceImpl extends ServiceImpl<PlatAlarmConfigMappe
saveBatch(saveList);
}
}
@Override
@TenantIdIgnore
public List<PlatAlarmConfig> listOfBed(String orgDeviceId) {
return configMapper.listOffBed(orgDeviceId);
}
}
......@@ -21,4 +21,13 @@
and pehi.respiratory_exception_time != '' and pehi.respiratory_rate != '')
)
</select>
<select id="listOffBed" resultType="com.makeit.entity.platform.alarm.PlatAlarmConfig">
select *
from plat_alarm_config
where org_id in (
select org_id from plat_device where ori_device_id = #{orgDeviceId} and del_flag = 0)
and alarm_type = 5 and tenant_id != 0
</select>
</mapper>
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