From 0c7ee67328b05ef20623f7a2583cd0b3ce727903 Mon Sep 17 00:00:00 2001 From: H Vs Date: Mon, 22 Jul 2024 15:48:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resolver/PregnancyHeartRateResolver.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs b/HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs index efd218f..746894d 100644 --- a/HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs +++ b/HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs @@ -90,7 +90,7 @@ namespace HealthMonitor.Service.Resolver if (phr.Count >= 30) { // 获取最近的两个记录,并计算它们的 LastUpdate 时间差 - var firstTwoPhr = phr.OrderByDescending(i => i.Timestamp).Take(2).Select(i => i.LastUpdate).ToList(); + var firstTwoPhr = phr.OrderByDescending(i => i.LastUpdate).Take(2).Select(i => i.LastUpdate).ToList(); var timeDiff = firstTwoPhr[0] - firstTwoPhr[1]; // 如果需要,将时间差转换为秒 @@ -113,10 +113,12 @@ namespace HealthMonitor.Service.Resolver // 高频心率启动 if (timeDiffInSeconds<=highFreqSampleInterval) { - /// 设置高频状态 + var phrFreqstatus =await _deviceCacheMgr.GetPregnancyHeartRateFreqStatusAsync(heartRate.Serialno); if (phrFreqstatus == null) { + /// 设置高频状态 + _logger.LogInformation($"进入高频心率启动状态 timeDiffInSeconds {timeDiffInSeconds},highFreqSampleInterval:{highFreqSampleInterval}"); // 设置高频状态 var freqFirstPhr= phr.OrderByDescending(i => i.Timestamp).First(); await _deviceCacheMgr.SetPregnancyHeartRateFreqStatusAsync(heartRate.Serialno, freqFirstPhr); @@ -132,11 +134,9 @@ namespace HealthMonitor.Service.Resolver if (lastPhr.All(i => i.PregnancyHeartRate >= triggerHighFreqLow && i.PregnancyHeartRate <= triggerHighFreqHigh)) { var avgPhr = lastPhr.Select(i => i.PregnancyHeartRate).Average(); - // 计算一般心率得到胎心系数 await SaveAndPushFetalHeartRateAsync(heartRate, upperAlarmThreshold, lowerAlarmThreshold, avgPhr); - } #endregion } @@ -189,6 +189,9 @@ namespace HealthMonitor.Service.Resolver // 删除高频状态的首条记录 await _deviceCacheMgr.DelPregnancyHeartRateFreqStatusAsync(heartRate.Serialno); + + /// 设置高频状态 + _logger.LogInformation($"结束高频心率状态 timeDiffInSeconds {timeDiffInSeconds},highFreqSampleInterval:{highFreqSampleInterval}"); } } }