Browse Source

调整胎心的最大值调整为220,超过都按该值220输出

datasub12_fetal_heart_rate
H Vs 2 months ago
parent
commit
1e8269c722
1 changed files with 38 additions and 2 deletions
  1. +38
    -2
      HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs

+ 38
- 2
HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs View File

@@ -236,7 +236,6 @@ namespace HealthMonitor.Service.Resolver
// 高频心率启动(在高频第二条才能判断)
if (timeDiffInSeconds <= highFreqSampleInterval)
{

var phrFreqstatus = await _deviceCacheMgr.GetPregnancyHeartRateFreqStatusAsync(heartRate.Serialno);
if (phrFreqstatus == null)
{
@@ -250,6 +249,7 @@ namespace HealthMonitor.Service.Resolver
await _deviceCacheMgr.SetPregnancyHeartRateFreqStatusAsync(heartRate.Serialno, freqFirstPhr);
_logger.LogInformation($"{heartRate.Serialno} 设置高频状态");
phrFreqstatus = await _deviceCacheMgr.GetPregnancyHeartRateFreqStatusAsync(heartRate.Serialno);
// 通过续租 延时计算高频心率的胎心
}

/// phr PregnancyHeartRate 连续连续正常次数个值都是正常(大于等于triggerHighFreqLow,少于等于triggerHighFreqHig),
@@ -642,7 +642,8 @@ namespace HealthMonitor.Service.Resolver
#endregion

var fetalHeartRate = SafeType.SafeInt(phrValue * coefficient);

// 胎心的最大值调整为220,超过都按该值220输出
fetalHeartRate = fetalHeartRate>= 220 ? 220 : fetalHeartRate;

var isAbnormal = fetalHeartRate > upperAlarmThreshold ? 1 : (fetalHeartRate < lowerAlarmThreshold ? 2 : 0);
var phrFreqstatus = await _deviceCacheMgr.GetPregnancyHeartRateFreqStatusAsync(heartRate.Serialno);
@@ -795,6 +796,7 @@ namespace HealthMonitor.Service.Resolver
/// 去除高频数据
/// </summary>
/// <param name="phr"></param>
/// <param name="highFreqSampleInterva"></param>
/// <returns></returns>
private static List<PregnancyHeartRateModel> GetNonFreqPregnancyHeartRate(List<PregnancyHeartRateModel> phr,int highFreqSampleInterval)
{
@@ -825,5 +827,39 @@ namespace HealthMonitor.Service.Resolver
}


/// <summary>
/// 获取高频数据
/// </summary>
/// <param name="phr"></param>
/// <param name="highFreqSampleInterval"></param>
/// <returns></returns>
private static List<PregnancyHeartRateModel> GetFreqPregnancyHeartRate(List<PregnancyHeartRateModel> phr, int highFreqSampleInterval)
{
phr = phr.OrderByDescending(i => i.LastUpdate).ToList();
var freqCollection = new List<PregnancyHeartRateModel>();
PregnancyHeartRateModel? previousItem = null;

foreach (var item in phr)
{
if (previousItem != null)
{
var timeNextDiff = (previousItem.LastUpdate - item.LastUpdate).TotalSeconds;
if (timeNextDiff <= highFreqSampleInterval)
{
freqCollection.Add(previousItem);
}
}
previousItem = item;
}

// 检查最后一条是否高频
if (previousItem != null && (phr.Last().LastUpdate - previousItem.LastUpdate).TotalSeconds <= highFreqSampleInterval)
{
freqCollection.Add(previousItem);
}

return freqCollection;
}

}
}

Loading…
Cancel
Save