From 09173ae78202d37a1c3ef39c9afca80c29878f44 Mon Sep 17 00:00:00 2001 From: H Vs Date: Thu, 31 Oct 2024 16:18:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=97=A5=E5=BF=97=E9=AB=98?= =?UTF-8?q?=E9=A2=91=E6=97=B6=E9=95=BF=E4=B8=8D=E8=B6=B310=E5=88=86?= =?UTF-8?q?=E9=92=9F=EF=BC=8C=E9=83=BD=E4=B8=8D=E4=BA=A7=E7=94=9F=E5=91=8A?= =?UTF-8?q?=E8=AD=A6=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cache/DeviceCacheManager.cs | 1 + .../Resolver/PregnancyHeartRateResolver.cs | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/HealthMonitor.Service/Cache/DeviceCacheManager.cs b/HealthMonitor.Service/Cache/DeviceCacheManager.cs index 9939e64..8d315e3 100644 --- a/HealthMonitor.Service/Cache/DeviceCacheManager.cs +++ b/HealthMonitor.Service/Cache/DeviceCacheManager.cs @@ -119,6 +119,7 @@ namespace HealthMonitor.Service.Cache { var key = CACHE_KEY_PHRFREQSTATUS + sn; await RedisHelper.DelAsync(key).ConfigureAwait(false); + _logger.LogInformation($"{sn} 结束高频状态"); } catch (Exception ex) { diff --git a/HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs b/HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs index c5f7774..197019c 100644 --- a/HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs +++ b/HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs @@ -374,9 +374,9 @@ namespace HealthMonitor.Service.Resolver if (phrFreqstatus == null) { /// 设置高频状态 - _logger.LogInformation($"{heartRate.Serialno} 进入高频心率启动状态 timeDiffInSeconds {timeDiffInSeconds},highFreqSampleInterval:{highFreqSampleInterval}"); + _logger.LogInformation($"{heartRate.Serialno} 进入高频心率启动状态,时间差 timeDiffInSeconds {timeDiffInSeconds},highFreqSampleInterval:{highFreqSampleInterval}"); // 设置高频状态 - _logger.LogInformation($"{heartRate.Serialno} phr.Count {phr.Count}"); + _logger.LogInformation($"{heartRate.Serialno} 前7天到当前记录数 {phr.Count},当前 {phr.First().MessageId}"); var freqFirstPhr = phr.OrderByDescending(i => i.LastUpdate) .Skip(1) //在高频第二条才能判断,所以要去除本条记录 .First(); @@ -397,6 +397,7 @@ namespace HealthMonitor.Service.Resolver PersonId = freqFirstPhr.PersonId, Serialno = freqFirstPhr.SerialNumber, }; + // 设置的续租周期要 await SetFreqHeartRateTriggerAsync(freqHearRateHey, heartRate.Serialno, highFreqSampleInterval, freqFirstHR); } // 续租延时计算高频心率的胎心 @@ -411,9 +412,9 @@ namespace HealthMonitor.Service.Resolver //var lastPhr = phr.OrderByDescending(i => i.LastUpdate).Take(stopHighFreqSampleCount).ToList(); var lastPhr = phr.Where(i => i.LastUpdate >= phrFreqstatus!.LastUpdate) .OrderByDescending(i => i.LastUpdate).Take(stopHighFreqSampleCount).ToList(); - _logger.LogInformation($"{heartRate.Serialno} lastPhr.Count {lastPhr.Count},stopHighFreqSampleCount {stopHighFreqSampleCount}"); - _logger.LogInformation($"{heartRate.Serialno} count :{lastPhr.Count >= stopHighFreqSampleCount}"); - _logger.LogInformation($"{heartRate.Serialno} All {lastPhr.All(i => i.PregnancyHeartRate >= triggerHighFreqLow && i.PregnancyHeartRate <= triggerHighFreqHigh)}"); + _logger.LogInformation($"{heartRate.Serialno} 最后段记录数量:lastPhr.Count {lastPhr.Count},stopHighFreqSampleCount {stopHighFreqSampleCount}"); + _logger.LogInformation($"{heartRate.Serialno} 条件1-数量 Count:{lastPhr.Count >= stopHighFreqSampleCount}"); + _logger.LogInformation($"{heartRate.Serialno} 条件2-是否正常值 ALL{lastPhr.All(i => i.PregnancyHeartRate >= triggerHighFreqLow && i.PregnancyHeartRate <= triggerHighFreqHigh)}"); // 检查是否连续12个值都是正常的 if ((lastPhr.Count >= stopHighFreqSampleCount) && @@ -1517,10 +1518,10 @@ namespace HealthMonitor.Service.Resolver /// /// 高频延时计算触发器 /// - /// - /// - /// - /// + /// 键 + /// IMEI + /// 高频采集间隔 + /// 首条高频心率 /// private async Task SetFreqHeartRateTriggerAsync(string key, string imei, long interval, HisGpsHeartRate? heartRate=null) { @@ -1537,11 +1538,13 @@ namespace HealthMonitor.Service.Resolver }; var result = JsonConvert.SerializeObject(data); await _serviceEtcd.PutValAsync(key, result, interval, false).ConfigureAwait(false); + _logger.LogInformation($"{imei} 心率高频状态创建首条高频心率的触发记录,创建高频延时计算触发器"); } else { // 不断修改时长,直到最后的一条高频胎心 await _serviceEtcd.PutValAsync(key, schedulePush, interval, false).ConfigureAwait(false); + _logger.LogInformation($"{imei} 心率高频状态续租"); } }