|
|
@@ -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); |
|
|
|