Commit 19788a3c by 汪志阳

fix:组织config查询

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