Browse Source

调整

datasub12_fetal_heart_rate_0
H Vs 3 months ago
parent
commit
6a4c4feb78
1 changed files with 27 additions and 4 deletions
  1. +27
    -4
      HealthMonitor.WebApi/Worker.cs

+ 27
- 4
HealthMonitor.WebApi/Worker.cs View File

@@ -332,9 +332,12 @@ namespace HealthMonitor.WebApi
_logger.LogInformation($"{imeiDel} 平常心率数据是批量上报,需要计算每条心率对应的胎心数据");

#region 计算每条心率对应的胎心数据
//去除高频
PregnancyHeartRateModel? previousItem = null;
phr = phr.OrderByDescending(i => i.LastUpdate).ToList();
// 获取高频数据
var freqCollection = new List<PregnancyHeartRateModel>();
PregnancyHeartRateModel? previousItem = null;
foreach (var item in phr)
{
if (previousItem != null)
@@ -342,11 +345,31 @@ namespace HealthMonitor.WebApi
var timeNextDiff = (previousItem!.LastUpdate - item.LastUpdate).TotalSeconds;
if (timeNextDiff <= highFreqSampleInterval)
{
phr.Remove(item);
freqCollection.Add(item);
}
}
previousItem = item;
};
}
//去除高频
foreach (var item in freqCollection)
{
phr.Remove(item);
}


// 排序并过滤高频数据
//var previousItem = phr.OrderByDescending(i => i.LastUpdate).ToList().First();
//phr = phr.Skip(1)
// .Where(item =>
// {
// var timeNextDiff = (previousItem!.LastUpdate - item.LastUpdate).TotalSeconds;
// previousItem = item;
// return timeNextDiff > highFreqSampleInterval;
// })
// .Prepend(previousItem)
// .OrderByDescending(i => i.LastUpdate)
// .ToList();

var calFhrTasks = phr.Where(p => p.LastUpdate >= triggerHeartRate!.LastUpdate)
.Select( async p =>
{


Loading…
Cancel
Save