Browse Source

调整日志高频时长不足10分钟,都不产生告警信息

datasub12_fetal_heart_rate_1
H Vs 3 weeks ago
parent
commit
09173ae782
2 changed files with 13 additions and 9 deletions
  1. +1
    -0
      HealthMonitor.Service/Cache/DeviceCacheManager.cs
  2. +12
    -9
      HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs

+ 1
- 0
HealthMonitor.Service/Cache/DeviceCacheManager.cs View File

@@ -119,6 +119,7 @@ namespace HealthMonitor.Service.Cache
{
var key = CACHE_KEY_PHRFREQSTATUS + sn;
await RedisHelper.DelAsync(key).ConfigureAwait(false);
_logger.LogInformation($"{sn} 结束高频状态");
}
catch (Exception ex)
{


+ 12
- 9
HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs View File

@@ -374,9 +374,9 @@ namespace HealthMonitor.Service.Resolver
if (phrFreqstatus == null)
{
/// 设置高频状态
_logger.LogInformation($"{heartRate.Serialno} 进入高频心率启动状态 timeDiffInSeconds {timeDiffInSeconds},highFreqSampleInterval:{highFreqSampleInterval}");
_logger.LogInformation($"{heartRate.Serialno} 进入高频心率启动状态,时间差 timeDiffInSeconds {timeDiffInSeconds},highFreqSampleInterval:{highFreqSampleInterval}");
// 设置高频状态
_logger.LogInformation($"{heartRate.Serialno} phr.Count {phr.Count}");
_logger.LogInformation($"{heartRate.Serialno} 前7天到当前记录数 {phr.Count},当前 {phr.First().MessageId}");
var freqFirstPhr = phr.OrderByDescending(i => i.LastUpdate)
.Skip(1) //在高频第二条才能判断,所以要去除本条记录
.First();
@@ -397,6 +397,7 @@ namespace HealthMonitor.Service.Resolver
PersonId = freqFirstPhr.PersonId,
Serialno = freqFirstPhr.SerialNumber,
};
// 设置的续租周期要
await SetFreqHeartRateTriggerAsync(freqHearRateHey, heartRate.Serialno, highFreqSampleInterval, freqFirstHR);
}
// 续租延时计算高频心率的胎心
@@ -411,9 +412,9 @@ namespace HealthMonitor.Service.Resolver
//var lastPhr = phr.OrderByDescending(i => i.LastUpdate).Take(stopHighFreqSampleCount).ToList();
var lastPhr = phr.Where(i => i.LastUpdate >= phrFreqstatus!.LastUpdate)
.OrderByDescending(i => i.LastUpdate).Take(stopHighFreqSampleCount).ToList();
_logger.LogInformation($"{heartRate.Serialno} lastPhr.Count {lastPhr.Count},stopHighFreqSampleCount {stopHighFreqSampleCount}");
_logger.LogInformation($"{heartRate.Serialno} count :{lastPhr.Count >= stopHighFreqSampleCount}");
_logger.LogInformation($"{heartRate.Serialno} All {lastPhr.All(i => i.PregnancyHeartRate >= triggerHighFreqLow && i.PregnancyHeartRate <= triggerHighFreqHigh)}");
_logger.LogInformation($"{heartRate.Serialno} 最后段记录数量:lastPhr.Count {lastPhr.Count},stopHighFreqSampleCount {stopHighFreqSampleCount}");
_logger.LogInformation($"{heartRate.Serialno} 条件1-数量 Count:{lastPhr.Count >= stopHighFreqSampleCount}");
_logger.LogInformation($"{heartRate.Serialno} 条件2-是否正常值 ALL{lastPhr.All(i => i.PregnancyHeartRate >= triggerHighFreqLow && i.PregnancyHeartRate <= triggerHighFreqHigh)}");

// 检查是否连续12个值都是正常的
if ((lastPhr.Count >= stopHighFreqSampleCount) &&
@@ -1517,10 +1518,10 @@ namespace HealthMonitor.Service.Resolver
/// <summary>
/// 高频延时计算触发器
/// </summary>
/// <param name="key"></param>
/// <param name="imei"></param>
/// <param name="interval"></param>
/// <param name="heartRate"></param>
/// <param name="key"></param>
/// <param name="imei">IMEI</param>
/// <param name="interval">高频采集间隔</param>
/// <param name="heartRate">首条高频心率</param>
/// <returns></returns>
private async Task SetFreqHeartRateTriggerAsync(string key, string imei, long interval, HisGpsHeartRate? heartRate=null)
{
@@ -1537,11 +1538,13 @@ namespace HealthMonitor.Service.Resolver
};
var result = JsonConvert.SerializeObject(data);
await _serviceEtcd.PutValAsync(key, result, interval, false).ConfigureAwait(false);
_logger.LogInformation($"{imei} 心率高频状态创建首条高频心率的触发记录,创建高频延时计算触发器");
}
else
{
// 不断修改时长,直到最后的一条高频胎心
await _serviceEtcd.PutValAsync(key, schedulePush, interval, false).ConfigureAwait(false);
_logger.LogInformation($"{imei} 心率高频状态续租");
}

}


Loading…
Cancel
Save