Quellcode durchsuchen

调整胎心统计时间越界调整

master
H Vs vor 2 Monaten
Ursprung
Commit
6f2baebd56
1 geänderte Dateien mit 24 neuen und 15 gelöschten Zeilen
  1. +24
    -15
      HealthMonitor.WebApi/Worker.cs

+ 24
- 15
HealthMonitor.WebApi/Worker.cs Datei anzeigen

@@ -2475,19 +2475,20 @@ namespace HealthMonitor.WebApi


try try
{ {
var CalNow = DateTime.Now;
var during = TimeSpan.FromSeconds(300); //5分钟
//var CalNow = DateTime.Now;
//var during = TimeSpan.FromSeconds(300); //5分钟


var c = 0; var c = 0;
while (true) while (true)
{ {


if (DateTime.Now - CalNow > during)
{
_logger.LogInformation($"{heartRate.Serialno} 超过1分钟,迭代完成跳出循环 ");
break;
}
//if (DateTime.Now - CalNow > during)
//{
// _logger.LogInformation($"{heartRate.Serialno} 超过1分钟,迭代完成跳出循环 ");
// break;
//}


await Task.Delay(TimeSpan.FromSeconds(1));


var segmentStatStartTime = boundaryStatStartTime.AddMinutes(c * INTERVAL_FHR); var segmentStatStartTime = boundaryStatStartTime.AddMinutes(c * INTERVAL_FHR);
var segmentStatEndTime = segmentStatStartTime.AddMinutes(INTERVAL_FHR); var segmentStatEndTime = segmentStatStartTime.AddMinutes(INTERVAL_FHR);
@@ -2495,12 +2496,18 @@ namespace HealthMonitor.WebApi
var statStartTime = segmentStatStartTime; var statStartTime = segmentStatStartTime;
var statEndTime = segmentStatEndTime; var statEndTime = segmentStatEndTime;


//_logger.LogInformation($"{heartRate.Serialno} 当前统计周期{statStartTime.ToString("yyyy-MM-dd HH:mm:ss")}-{statEndTime.ToString("yyyy-MM-dd HH:mm:ss")}");
_logger.LogInformation($"{heartRate.Serialno} 当前统计周期{statStartTime.ToString("yyyy-MM-dd HH:mm:ss")}-{statEndTime.ToString("yyyy-MM-dd HH:mm:ss")}");

if (statEndTime > boundaryStatEndTime)
{
_logger.LogInformation($"{heartRate.Serialno} 超过时间边界,迭代完成跳出循环 ");
break;
}


var segmentPhr = normalPhr var segmentPhr = normalPhr
.Where(i => i.LastUpdate <= statEndTime && i.LastUpdate >= statStartTime) .Where(i => i.LastUpdate <= statEndTime && i.LastUpdate >= statStartTime)
.ToList(); .ToList();
if (segmentPhr.Count == 0) if (segmentPhr.Count == 0)
{ {
// 跳出当次迭代,进入下次迭代 // 跳出当次迭代,进入下次迭代
@@ -2510,6 +2517,8 @@ namespace HealthMonitor.WebApi


_logger.LogInformation($"{heartRate.Serialno} 当前统计周期{statStartTime.ToString("yyyy-MM-dd HH:mm:ss")}-{statEndTime.ToString("yyyy-MM-dd HH:mm:ss")},对应的常规心率ID{string.Join(",", segmentPhr.Select(i=>i.MessageId))}"); _logger.LogInformation($"{heartRate.Serialno} 当前统计周期{statStartTime.ToString("yyyy-MM-dd HH:mm:ss")}-{statEndTime.ToString("yyyy-MM-dd HH:mm:ss")},对应的常规心率ID{string.Join(",", segmentPhr.Select(i=>i.MessageId))}");



var sampleTime = DateTimeUtil.ConvertToTimeStamp(segmentStatStartTime).ToString(); var sampleTime = DateTimeUtil.ConvertToTimeStamp(segmentStatStartTime).ToString();
sampleTime = sampleTime.Length > 10 ? sampleTime.Substring(0, 10) : sampleTime; sampleTime = sampleTime.Length > 10 ? sampleTime.Substring(0, 10) : sampleTime;


@@ -2694,7 +2703,7 @@ namespace HealthMonitor.WebApi
{ {
_logger.LogInformation($"{heartRate.Serialno},统计周期:{statStartTime.ToString("yyyy-MM-dd HH:mm:ss")}----{statEndTime.ToString("yyyy-MM-dd HH:mm:ss")} ,胎心已处理"); _logger.LogInformation($"{heartRate.Serialno},统计周期:{statStartTime.ToString("yyyy-MM-dd HH:mm:ss")}----{statEndTime.ToString("yyyy-MM-dd HH:mm:ss")} ,胎心已处理");
} }
await Task.Delay(TimeSpan.FromSeconds(1));
//await Task.Delay(TimeSpan.FromSeconds(1));
// 跳出循环 // 跳出循环
if (statEndTime.ToString("yyyyMMddHHmm") == boundaryStatEndTime.ToString("yyyyMMddHHmm")) if (statEndTime.ToString("yyyyMMddHHmm") == boundaryStatEndTime.ToString("yyyyMMddHHmm"))
{ {
@@ -2702,11 +2711,11 @@ namespace HealthMonitor.WebApi
break; break;
} }


if (statEndTime>= boundaryStatEndTime)
{
_logger.LogInformation($"{heartRate.Serialno} 时间边界,迭代完成跳出循环 ");
break;
}
//if (statEndTime>= boundaryStatEndTime)
//{
// _logger.LogInformation($"{heartRate.Serialno} 时间边界,迭代完成跳出循环 ");
// break;
//}


} }


Laden…
Abbrechen
Speichern