Browse Source

调整日志

datasub12_fetal_heart_rate_0
H Vs 3 months ago
parent
commit
27a7aadc45
1 changed files with 12 additions and 3 deletions
  1. +12
    -3
      HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs

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

@@ -513,7 +513,7 @@ namespace HealthMonitor.Service.Resolver
// 正常心率
else
{
_logger.LogInformation($"{heartRate.Serialno} 计算胎心数据");
// 上15分钟的数据
// 获取当前时间
DateTime nowInterval = (DateTime)heartRate.LastUpdate!;
@@ -542,11 +542,20 @@ namespace HealthMonitor.Service.Resolver

var daysPhr = await _serviceTDengine.GetBySerialNoAsync<PregnancyHeartRateModel>(heartRate.Serialno, 7);

var normalPhrStatStartTime = nextInterval;

var normalPhrStatEndTime = nextInterval.AddMinutes(-intervalFHR);

_logger.LogInformation($"{heartRate.Serialno} 计算胎心数据, 周期:{normalPhrStatStartTime}-{normalPhrStatEndTime} ");
var filteredPhr = daysPhr
// 使用 last_update 下一刻
.Where(i => i.LastUpdate <= nextInterval && i.LastUpdate >= nextInterval.AddMinutes(-intervalFHR))
.Where(i => i.LastUpdate <= normalPhrStatStartTime && i.LastUpdate >= normalPhrStatEndTime)
.ToList();

if (filteredPhr.Count == 0)
{
_logger.LogWarning($"{heartRate.Serialno} 周期:{normalPhrStatStartTime}-{normalPhrStatEndTime} 孕妇心率数据不足,{filteredPhr.Count}条记录");
return;
}
var phrValue = filteredPhr.Count == 1
? filteredPhr.First().PregnancyHeartRate
: filteredPhr.Average(i => i.PregnancyHeartRate);


Loading…
Cancel
Save