Explorar el Código

调整日志

datasub12_fetal_heart_rate_0
H Vs hace 3 meses
padre
commit
27a7aadc45
Se han modificado 1 ficheros con 12 adiciones y 3 borrados
  1. +12
    -3
      HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs

+ 12
- 3
HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs Ver fichero

@@ -513,7 +513,7 @@ namespace HealthMonitor.Service.Resolver
// 正常心率
else
{
_logger.LogInformation($"{heartRate.Serialno} 计算胎心数据");
// 上15分钟的数据
// 获取当前时间
DateTime nowInterval = (DateTime)heartRate.LastUpdate!;
@@ -542,11 +542,20 @@ namespace HealthMonitor.Service.Resolver

var daysPhr = await _serviceTDengine.GetBySerialNoAsync<PregnancyHeartRateModel>(heartRate.Serialno, 7);

var normalPhrStatStartTime = nextInterval;

var normalPhrStatEndTime = nextInterval.AddMinutes(-intervalFHR);

_logger.LogInformation($"{heartRate.Serialno} 计算胎心数据, 周期:{normalPhrStatStartTime}-{normalPhrStatEndTime} ");
var filteredPhr = daysPhr
// 使用 last_update 下一刻
.Where(i => i.LastUpdate <= nextInterval && i.LastUpdate >= nextInterval.AddMinutes(-intervalFHR))
.Where(i => i.LastUpdate <= normalPhrStatStartTime && i.LastUpdate >= normalPhrStatEndTime)
.ToList();

if (filteredPhr.Count == 0)
{
_logger.LogWarning($"{heartRate.Serialno} 周期:{normalPhrStatStartTime}-{normalPhrStatEndTime} 孕妇心率数据不足,{filteredPhr.Count}条记录");
return;
}
var phrValue = filteredPhr.Count == 1
? filteredPhr.First().PregnancyHeartRate
: filteredPhr.Average(i => i.PregnancyHeartRate);


Cargando…
Cancelar
Guardar