From f86e3e0ada5975947529e864d21f79bef75ff708 Mon Sep 17 00:00:00 2001 From: H Vs Date: Fri, 16 Aug 2024 11:17:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HealthMonitor.WebApi/Worker.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/HealthMonitor.WebApi/Worker.cs b/HealthMonitor.WebApi/Worker.cs index 8f8668c..4361269 100644 --- a/HealthMonitor.WebApi/Worker.cs +++ b/HealthMonitor.WebApi/Worker.cs @@ -283,6 +283,9 @@ namespace HealthMonitor.WebApi // 告警下限阀值 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(imeiDel); // 最后一条孕妇心率 @@ -329,6 +332,21 @@ namespace HealthMonitor.WebApi _logger.LogInformation($"{imeiDel} 平常心率数据是批量上报,需要计算每条心率对应的胎心数据"); #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) .Select( async p => {