|
|
@@ -173,7 +173,11 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var phr = await _serviceTDengine.GetBySerialNoAsync<PregnancyHeartRateModel>(heartRate.Serialno, 7); |
|
|
|
var daysPhr = await _serviceTDengine.GetBySerialNoAsync<PregnancyHeartRateModel>(heartRate.Serialno, 7); |
|
|
|
var phr = daysPhr |
|
|
|
.Where(p => p.LastUpdate >= heartRate.LastUpdate) |
|
|
|
.ToList(); |
|
|
|
|
|
|
|
if (phr.Count >= 30) |
|
|
|
{ |
|
|
|
#region 定时计算胎动数据触发器两小时间隔开始 |
|
|
@@ -245,17 +249,17 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
} |
|
|
|
/// phr PregnancyHeartRate 连续连续正常次数个值都是正常(大于等于triggerHighFreqLow,少于等于triggerHighFreqHig), |
|
|
|
/// 取连续正常次数正常值的平均值,推送到api/v1/open/OpenIot/SetFetalHeartRateConfig |
|
|
|
#region 检查是否连续12个心率值都是正常的 |
|
|
|
#region 检查高频状态是否连续12个心率值都是正常的 |
|
|
|
// 获取最近连续正常次数个心率记录 |
|
|
|
//_logger.LogInformation($"{heartRate.Serialno} 设置 stopHighFreqSampleCount {stopHighFreqSampleCount}"); |
|
|
|
|
|
|
|
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).Take(stopHighFreqSampleCount).ToList(); |
|
|
|
|
|
|
|
//_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)) |
|
|
|
if (lastPhr.Count >= stopHighFreqSampleCount && |
|
|
|
lastPhr.All(i => i.PregnancyHeartRate >= triggerHighFreqLow && i.PregnancyHeartRate <= triggerHighFreqHigh) |
|
|
|
) |
|
|
|
{ |
|
|
|
var avgPhr = lastPhr.Select(i => i.PregnancyHeartRate).Average(); |
|
|
|
// 计算一般心率得到胎心系数 |
|
|
@@ -512,7 +516,8 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
var isAbnormal = fetalHeartRate > upperAlarmThreshold ? 1 : (fetalHeartRate < lowerAlarmThreshold ? 2 : 0); |
|
|
|
var phrFreqstatus = await _deviceCacheMgr.GetPregnancyHeartRateFreqStatusAsync(heartRate.Serialno); |
|
|
|
if (phrFreqstatus == null) isAbnormal = 0; |
|
|
|
|
|
|
|
var statsusDesc = (phrFreqstatus == null) ? "平常" : "高频"; |
|
|
|
_logger.LogInformation($"{heartRate.Serialno} 在 {statsusDesc} 状态,生成胎心值:{fetalHeartRate},统计周期:{statStartTime.ToString("yyyy-MM-dd HH:mm:ss")}----{statEndTime.ToString("yyyy-MM-dd HH:mm:ss")}"); |
|
|
|
//if (!isFreq) |
|
|
|
//{ |
|
|
|
// statStartTime = heartRate.LastUpdate; |
|
|
|