Browse Source

调整

datasub12_fetal_heart_rate_0
H Vs 3 months ago
parent
commit
f86e3e0ada
1 changed files with 18 additions and 0 deletions
  1. +18
    -0
      HealthMonitor.WebApi/Worker.cs

+ 18
- 0
HealthMonitor.WebApi/Worker.cs View File

@@ -283,6 +283,9 @@ namespace HealthMonitor.WebApi
// 告警下限阀值 // 告警下限阀值
var lowerAlarmThreshold = (int)watchConfig["lowerAlarmThreshold"]!; var lowerAlarmThreshold = (int)watchConfig["lowerAlarmThreshold"]!;


// 高频心率采样间隔 highFreqSampleInterval = highFreqSampleInterval+5,增加5秒兼容(最小highFreqSampleInterval=60)
var highFreqSampleInterval = (int)watchConfig!["highFreqSampleInterval"]! >= 60 ? (int)watchConfig!["highFreqSampleInterval"]! + 5 : 60;

var commonPHR = await _serviceTDengine.GetLastAsync<PregnancyCommonHeartRateModel>(imeiDel); var commonPHR = await _serviceTDengine.GetLastAsync<PregnancyCommonHeartRateModel>(imeiDel);


// 最后一条孕妇心率 // 最后一条孕妇心率
@@ -329,6 +332,21 @@ namespace HealthMonitor.WebApi
_logger.LogInformation($"{imeiDel} 平常心率数据是批量上报,需要计算每条心率对应的胎心数据"); _logger.LogInformation($"{imeiDel} 平常心率数据是批量上报,需要计算每条心率对应的胎心数据");


#region 计算每条心率对应的胎心数据 #region 计算每条心率对应的胎心数据
//去除高频
PregnancyHeartRateModel? previousItem = null;
phr = phr.OrderByDescending(i => i.LastUpdate).ToList();
foreach (var item in phr)
{
if (previousItem != null)
{
var timeNextDiff = (previousItem!.LastUpdate - item.LastUpdate).TotalSeconds;
if (timeNextDiff <= highFreqSampleInterval)
{
phr.Remove(item);
}
}
previousItem = item;
};
var calFhrTasks = phr.Where(p => p.LastUpdate >= triggerHeartRate!.LastUpdate) var calFhrTasks = phr.Where(p => p.LastUpdate >= triggerHeartRate!.LastUpdate)
.Select( async p => .Select( async p =>
{ {


Loading…
Cancel
Save