|
|
@@ -291,6 +291,7 @@ namespace HealthMonitor.WebApi |
|
|
|
// 判断最后一条孕妇心率与解析器的触发心率是否一致 |
|
|
|
if (isNormalHeartRate) |
|
|
|
{ |
|
|
|
//最后一条孕妇心率与解析器的触发心率一致 |
|
|
|
HisGpsHeartRate heartRate = new() |
|
|
|
{ |
|
|
|
CreateTime = lastPhr.CreateTime, |
|
|
@@ -316,12 +317,39 @@ namespace HealthMonitor.WebApi |
|
|
|
var phrFreqstatus = await _deviceCacheMgr.GetPregnancyHeartRateFreqStatusAsync(imeiDel); |
|
|
|
if (phrFreqstatus != null) |
|
|
|
{ |
|
|
|
#region 修改首条高频心率 |
|
|
|
await _deviceCacheMgr.SetPregnancyHeartRateFreqStatusAsync(imeiDel, freqFirstPhr); |
|
|
|
_logger.LogInformation($"{imeiDel} 设置高频状态,修正触发的孕妇心率记录"); |
|
|
|
#endregion |
|
|
|
} |
|
|
|
// 不在高频状态状态,但触发孕妇心率与最后一条孕妇心率不一致, |
|
|
|
// 平常心率数据是批量上报,需要计算每条心率对应的胎心数据 |
|
|
|
else |
|
|
|
{ |
|
|
|
_logger.LogWarning($"{imeiDel} 不在高频状态状态,但触发孕妇心率与最后一条孕妇心率不一致"); |
|
|
|
_logger.LogInformation($"{imeiDel} 平常心率数据是批量上报,需要计算每条心率对应的胎心数据"); |
|
|
|
|
|
|
|
#region 计算每条心率对应的胎心数据 |
|
|
|
var calFhrTasks = phr.Where(p => p.LastUpdate >= triggerHeartRate!.LastUpdate) |
|
|
|
.Select( async p => |
|
|
|
{ |
|
|
|
HisGpsHeartRate heartRate = new() |
|
|
|
{ |
|
|
|
CreateTime = p.CreateTime, |
|
|
|
DeviceKey = p.DeviceKey, |
|
|
|
HeartRate = p.PregnancyHeartRate, |
|
|
|
HeartRateId = p.PregnancyHeartRateId, |
|
|
|
IsDisplay = p.IsDisplay ? 1 : 0, |
|
|
|
MessageId = p.MessageId, |
|
|
|
LastUpdate = p.LastUpdate, |
|
|
|
Method = p.Method, |
|
|
|
PersonId = p.PersonId, |
|
|
|
Serialno = p.SerialNumber |
|
|
|
}; |
|
|
|
var intervalFHR = 15; |
|
|
|
await CalculateNormalFetalHeartRateAsync(heartRate, upperAlarmThreshold, lowerAlarmThreshold, intervalFHR, commonPHR); |
|
|
|
}); |
|
|
|
await Task.WhenAll(calFhrTasks); |
|
|
|
#endregion |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|