|
|
@@ -198,7 +198,7 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
TimeSpan timeUntilNextRun = nextRunTime - fmScheduleNow; |
|
|
|
var ttl = (long)timeUntilNextRun.TotalSeconds; |
|
|
|
|
|
|
|
await SetIntervalTriggerAsync(fetalMovementKey, heartRate.Serialno, ttl); |
|
|
|
await SetIntervalTriggerAsync(fetalMovementKey, heartRate.Serialno, ttl,heartRate); |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
@@ -247,13 +247,13 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
/// 取连续正常次数正常值的平均值,推送到api/v1/open/OpenIot/SetFetalHeartRateConfig |
|
|
|
#region 检查是否连续12个心率值都是正常的 |
|
|
|
// 获取最近连续正常次数个心率记录 |
|
|
|
_logger.LogInformation($"{heartRate.Serialno} 设置 stopHighFreqSampleCount {stopHighFreqSampleCount}"); |
|
|
|
//_logger.LogInformation($"{heartRate.Serialno} 设置 stopHighFreqSampleCount {stopHighFreqSampleCount}"); |
|
|
|
|
|
|
|
var lastPhr = phr.OrderByDescending(i => i.LastUpdate).Take(stopHighFreqSampleCount).ToList(); |
|
|
|
|
|
|
|
_logger.LogInformation($"{heartRate.Serialno} 设置 lastPhr {lastPhr.Count}"); |
|
|
|
_logger.LogInformation($"{heartRate.Serialno} 设置 triggerHighFreqLow {triggerHighFreqLow}"); |
|
|
|
_logger.LogInformation($"{heartRate.Serialno} 设置 triggerHighFreqHigh {triggerHighFreqHigh}"); |
|
|
|
//_logger.LogInformation($"{heartRate.Serialno} 设置 lastPhr {lastPhr.Count}"); |
|
|
|
//_logger.LogInformation($"{heartRate.Serialno} 设置 triggerHighFreqLow {triggerHighFreqLow}"); |
|
|
|
//_logger.LogInformation($"{heartRate.Serialno} 设置 triggerHighFreqHigh {triggerHighFreqHigh}"); |
|
|
|
// 检查是否连续12个值都是正常的 |
|
|
|
if (lastPhr.All(i => i.PregnancyHeartRate >= triggerHighFreqLow && i.PregnancyHeartRate <= triggerHighFreqHigh)) |
|
|
|
{ |
|
|
@@ -381,8 +381,8 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
//await CalculateNormalFetalHeartRateAsync(heartRate, upperAlarmThreshold, lowerAlarmThreshold, intervalFHR, commonPHR); |
|
|
|
// 使用延后计算 |
|
|
|
var fhrScheduleKey = $"health_monitor/schedule_push/cal_fetal_heart_rate/imei/{heartRate.Serialno}"; |
|
|
|
var fhrScheduleTTL = 10; |
|
|
|
await SetIntervalTriggerAsync(fhrScheduleKey, heartRate.Serialno, fhrScheduleTTL); |
|
|
|
var fhrScheduleTTL = 60; |
|
|
|
await SetIntervalTriggerAsync(fhrScheduleKey, heartRate.Serialno, fhrScheduleTTL, heartRate); |
|
|
|
} |
|
|
|
// 平常心率 |
|
|
|
else |
|
|
@@ -391,8 +391,8 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
//await CalculateNormalFetalHeartRateAsync(heartRate, upperAlarmThreshold, lowerAlarmThreshold, intervalFHR, commonPHR); |
|
|
|
// 使用延后计算 |
|
|
|
var fhrScheduleKey = $"health_monitor/schedule_push/cal_fetal_heart_rate/imei/{heartRate.Serialno}"; |
|
|
|
var fhrScheduleTTL = 10; |
|
|
|
await SetIntervalTriggerAsync(fhrScheduleKey, heartRate.Serialno, fhrScheduleTTL); |
|
|
|
var fhrScheduleTTL = 60; |
|
|
|
await SetIntervalTriggerAsync(fhrScheduleKey, heartRate.Serialno, fhrScheduleTTL, heartRate); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -586,7 +586,7 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private async Task SetIntervalTriggerAsync(string key,string imei, long interval) |
|
|
|
private async Task SetIntervalTriggerAsync(string key,string imei, long interval,HisGpsHeartRate heartRate) |
|
|
|
{ |
|
|
|
// var key = $"health_monitor/schedule_push/{type}/imei/{imei}"; |
|
|
|
var schedulePush = await _serviceEtcd.GetValAsync(key).ConfigureAwait(false); |
|
|
@@ -599,7 +599,9 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
imei, |
|
|
|
create_time = now.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
ttl = interval, |
|
|
|
next_run_time = timeNextRun.ToString("yyyy-MM-dd HH:mm:ss") |
|
|
|
next_run_time = timeNextRun.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
trigger= heartRate, |
|
|
|
|
|
|
|
}; |
|
|
|
var result = JsonConvert.SerializeObject(data); |
|
|
|
await _serviceEtcd.PutValAsync(key, result, interval, false).ConfigureAwait(false); |
|
|
|