|
@@ -374,9 +374,9 @@ namespace HealthMonitor.Service.Resolver |
|
|
if (phrFreqstatus == null) |
|
|
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) |
|
|
var freqFirstPhr = phr.OrderByDescending(i => i.LastUpdate) |
|
|
.Skip(1) //在高频第二条才能判断,所以要去除本条记录 |
|
|
.Skip(1) //在高频第二条才能判断,所以要去除本条记录 |
|
|
.First(); |
|
|
.First(); |
|
@@ -397,6 +397,7 @@ namespace HealthMonitor.Service.Resolver |
|
|
PersonId = freqFirstPhr.PersonId, |
|
|
PersonId = freqFirstPhr.PersonId, |
|
|
Serialno = freqFirstPhr.SerialNumber, |
|
|
Serialno = freqFirstPhr.SerialNumber, |
|
|
}; |
|
|
}; |
|
|
|
|
|
// 设置的续租周期要 |
|
|
await SetFreqHeartRateTriggerAsync(freqHearRateHey, heartRate.Serialno, highFreqSampleInterval, freqFirstHR); |
|
|
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.OrderByDescending(i => i.LastUpdate).Take(stopHighFreqSampleCount).ToList(); |
|
|
var lastPhr = phr.Where(i => i.LastUpdate >= phrFreqstatus!.LastUpdate) |
|
|
var lastPhr = phr.Where(i => i.LastUpdate >= phrFreqstatus!.LastUpdate) |
|
|
.OrderByDescending(i => i.LastUpdate).Take(stopHighFreqSampleCount).ToList(); |
|
|
.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个值都是正常的 |
|
|
// 检查是否连续12个值都是正常的 |
|
|
if ((lastPhr.Count >= stopHighFreqSampleCount) && |
|
|
if ((lastPhr.Count >= stopHighFreqSampleCount) && |
|
@@ -1517,10 +1518,10 @@ namespace HealthMonitor.Service.Resolver |
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 高频延时计算触发器 |
|
|
/// 高频延时计算触发器 |
|
|
/// </summary> |
|
|
/// </summary> |
|
|
/// <param name="key"></param> |
|
|
|
|
|
/// <param name="imei"></param> |
|
|
|
|
|
/// <param name="interval"></param> |
|
|
|
|
|
/// <param name="heartRate"></param> |
|
|
|
|
|
|
|
|
/// <param name="key">键</param> |
|
|
|
|
|
/// <param name="imei">IMEI</param> |
|
|
|
|
|
/// <param name="interval">高频采集间隔</param> |
|
|
|
|
|
/// <param name="heartRate">首条高频心率</param> |
|
|
/// <returns></returns> |
|
|
/// <returns></returns> |
|
|
private async Task SetFreqHeartRateTriggerAsync(string key, string imei, long interval, HisGpsHeartRate? heartRate=null) |
|
|
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); |
|
|
var result = JsonConvert.SerializeObject(data); |
|
|
await _serviceEtcd.PutValAsync(key, result, interval, false).ConfigureAwait(false); |
|
|
await _serviceEtcd.PutValAsync(key, result, interval, false).ConfigureAwait(false); |
|
|
|
|
|
_logger.LogInformation($"{imei} 心率高频状态创建首条高频心率的触发记录,创建高频延时计算触发器"); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
// 不断修改时长,直到最后的一条高频胎心 |
|
|
// 不断修改时长,直到最后的一条高频胎心 |
|
|
await _serviceEtcd.PutValAsync(key, schedulePush, interval, false).ConfigureAwait(false); |
|
|
await _serviceEtcd.PutValAsync(key, schedulePush, interval, false).ConfigureAwait(false); |
|
|
|
|
|
_logger.LogInformation($"{imei} 心率高频状态续租"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|