Browse Source

调整日志

datasub12_fetal_heart_rate_0
H Vs 3 months ago
parent
commit
0c7ee67328
1 changed files with 7 additions and 4 deletions
  1. +7
    -4
      HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs

+ 7
- 4
HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs View File

@@ -90,7 +90,7 @@ namespace HealthMonitor.Service.Resolver
if (phr.Count >= 30) if (phr.Count >= 30)
{ {
// 获取最近的两个记录,并计算它们的 LastUpdate 时间差 // 获取最近的两个记录,并计算它们的 LastUpdate 时间差
var firstTwoPhr = phr.OrderByDescending(i => i.Timestamp).Take(2).Select(i => i.LastUpdate).ToList();
var firstTwoPhr = phr.OrderByDescending(i => i.LastUpdate).Take(2).Select(i => i.LastUpdate).ToList();
var timeDiff = firstTwoPhr[0] - firstTwoPhr[1]; var timeDiff = firstTwoPhr[0] - firstTwoPhr[1];


// 如果需要,将时间差转换为秒 // 如果需要,将时间差转换为秒
@@ -113,10 +113,12 @@ namespace HealthMonitor.Service.Resolver
// 高频心率启动 // 高频心率启动
if (timeDiffInSeconds<=highFreqSampleInterval) if (timeDiffInSeconds<=highFreqSampleInterval)
{ {
/// 设置高频状态
var phrFreqstatus =await _deviceCacheMgr.GetPregnancyHeartRateFreqStatusAsync(heartRate.Serialno); var phrFreqstatus =await _deviceCacheMgr.GetPregnancyHeartRateFreqStatusAsync(heartRate.Serialno);
if (phrFreqstatus == null) if (phrFreqstatus == null)
{ {
/// 设置高频状态
_logger.LogInformation($"进入高频心率启动状态 timeDiffInSeconds {timeDiffInSeconds},highFreqSampleInterval:{highFreqSampleInterval}");
// 设置高频状态 // 设置高频状态
var freqFirstPhr= phr.OrderByDescending(i => i.Timestamp).First(); var freqFirstPhr= phr.OrderByDescending(i => i.Timestamp).First();
await _deviceCacheMgr.SetPregnancyHeartRateFreqStatusAsync(heartRate.Serialno, freqFirstPhr); await _deviceCacheMgr.SetPregnancyHeartRateFreqStatusAsync(heartRate.Serialno, freqFirstPhr);
@@ -132,11 +134,9 @@ namespace HealthMonitor.Service.Resolver
if (lastPhr.All(i => i.PregnancyHeartRate >= triggerHighFreqLow && i.PregnancyHeartRate <= triggerHighFreqHigh)) if (lastPhr.All(i => i.PregnancyHeartRate >= triggerHighFreqLow && i.PregnancyHeartRate <= triggerHighFreqHigh))
{ {
var avgPhr = lastPhr.Select(i => i.PregnancyHeartRate).Average(); var avgPhr = lastPhr.Select(i => i.PregnancyHeartRate).Average();

// 计算一般心率得到胎心系数 // 计算一般心率得到胎心系数
await SaveAndPushFetalHeartRateAsync(heartRate, upperAlarmThreshold, lowerAlarmThreshold, avgPhr); await SaveAndPushFetalHeartRateAsync(heartRate, upperAlarmThreshold, lowerAlarmThreshold, avgPhr);



} }
#endregion #endregion
} }
@@ -189,6 +189,9 @@ namespace HealthMonitor.Service.Resolver


// 删除高频状态的首条记录 // 删除高频状态的首条记录
await _deviceCacheMgr.DelPregnancyHeartRateFreqStatusAsync(heartRate.Serialno); await _deviceCacheMgr.DelPregnancyHeartRateFreqStatusAsync(heartRate.Serialno);

/// 设置高频状态
_logger.LogInformation($"结束高频心率状态 timeDiffInSeconds {timeDiffInSeconds},highFreqSampleInterval:{highFreqSampleInterval}");
} }
} }
} }


Loading…
Cancel
Save