|
|
@@ -1011,13 +1011,28 @@ namespace HealthMonitor.Service.Biz.db |
|
|
|
var filteredCollection = new List<PregnancyHeartRateModel>(); |
|
|
|
PregnancyHeartRateModel? previousItem = null; |
|
|
|
|
|
|
|
//foreach (var item in collection) |
|
|
|
//{ |
|
|
|
// if (previousItem == null || Math.Abs((previousItem.LastUpdate - item.LastUpdate).TotalSeconds) >= highFreqSampleInterval) |
|
|
|
// { |
|
|
|
// filteredCollection.Add(item); |
|
|
|
// previousItem = item; |
|
|
|
// } |
|
|
|
//} |
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in collection) |
|
|
|
{ |
|
|
|
if (previousItem == null || Math.Abs((previousItem.LastUpdate - item.LastUpdate).TotalSeconds) >= highFreqSampleInterval) |
|
|
|
if (previousItem!=null) |
|
|
|
{ |
|
|
|
filteredCollection.Add(item); |
|
|
|
previousItem = item; |
|
|
|
var timeDiff = (previousItem.LastUpdate - item.LastUpdate).TotalSeconds; |
|
|
|
Console.WriteLine($"previousItem:{previousItem.PregnancyHeartRate} -- item:{previousItem.PregnancyHeartRate} timeDiff:{timeDiff}--highFreqSampleInterval:{highFreqSampleInterval}"); |
|
|
|
if (timeDiff >= highFreqSampleInterval) |
|
|
|
{ |
|
|
|
filteredCollection.Add(item); |
|
|
|
} |
|
|
|
} |
|
|
|
previousItem = item; |
|
|
|
} |
|
|
|
|
|
|
|
// 心率数据量必须30个以上才进行计算 |
|
|
|