diff --git a/HealthMonitor.WebApi/Worker.cs b/HealthMonitor.WebApi/Worker.cs index 33c417e..31e94ed 100644 --- a/HealthMonitor.WebApi/Worker.cs +++ b/HealthMonitor.WebApi/Worker.cs @@ -541,54 +541,78 @@ namespace HealthMonitor.WebApi if (true) { var step = await _personCacheMgr.GetStepPeriodicityAsync(imeiDel); - if (DateTime.Now.Hour - ((DateTime)step?.LastUpdate!).Hour <= 2) + if (step != null) { - if (step.Steps > 1500) fetalMovementStepVar = 1; + if (DateTime.Now.Hour - ((DateTime)step?.LastUpdate!).Hour <= 2) + { + if (step.Steps > 1500) fetalMovementStepVar = 1; + } + else + { + _logger.LogWarning($"{imeiDel} 周期步数 时间无效"); + } } else { - _logger.LogWarning($"{imeiDel} 周期步数 时间无效"); + _logger.LogWarning($"{imeiDel} 周期步数无数据"); } + } // 体温 if (true) { var temp = await _personCacheMgr.GetTemperaturePeriodicityAsync(imeiDel); - if (DateTime.Now.Hour - ((DateTime)temp?.LastUpdate!).Hour <= 2) + if (temp != null) { - // 中烧 - if (temp.Temperature>=37.3M&& temp.Temperature<= 38.5M) + if (DateTime.Now.Hour - ((DateTime)temp?.LastUpdate!).Hour <= 2) { - fetalMovementTempVar = -1; + // 中烧 + if (temp.Temperature >= 37.3M && temp.Temperature <= 38.5M) + { + fetalMovementTempVar = -1; + } + // 高烧 + if (temp.Temperature >= 38.6M) + { + fetalMovementTempVar = -2; + } } - // 高烧 - if (temp.Temperature >= 38.6M) + else { - fetalMovementTempVar = -2; + _logger.LogWarning($"{imeiDel} 周期体温 时间无效"); } } else { - _logger.LogWarning($"{imeiDel} 周期体温 时间无效"); + _logger.LogWarning($"{imeiDel} 周期体温无数据"); } + } // 血压 if (true) { var bp = await _personCacheMgr.GetBloodPressPeriodicityAsync(imeiDel); - if (DateTime.Now.Hour - ((DateTime)bp?.LastUpdate!).Hour <= 2) + if (bp != null) { - if (bp.SystolicValue>160) + if (DateTime.Now.Hour - ((DateTime)bp?.LastUpdate!).Hour <= 2) + { + if (bp.SystolicValue > 160) + { + fetalMovementBpVar = 1; + } + } + else { - fetalMovementBpVar = 1; + _logger.LogWarning($"{imeiDel} 周期血压 时间无效"); } } else { - _logger.LogWarning($"{imeiDel} 周期血压 时间无效"); + _logger.LogWarning($"{imeiDel} 周期血压无数据"); } + } // 心理 if (true) @@ -626,16 +650,23 @@ namespace HealthMonitor.WebApi } }; var psych = await _hisPsychResultApiClient.GetFirstAsync(psychResultParam, imeiDel[^2..], null, new RequestHeader { RequestId = Guid.NewGuid().ToString("D") }); - - if (psych?.StressScore == 2) + if (psych != null) { - fetalMovementPpVar = 1; - } + if (psych?.StressScore == 2) + { + fetalMovementPpVar = 1; + } - if (psych?.StressScore == 3) + if (psych?.StressScore == 3) + { + fetalMovementPpVar = 2; + } + } + else { - fetalMovementPpVar = 2; + _logger.LogWarning($"{imeiDel} 周期心理压力无数据"); } + } #endregion @@ -1089,7 +1120,7 @@ namespace HealthMonitor.WebApi } catch (Exception ex) { - _logger.LogInformation($"{nameof(WatchEvents)},出错: |{ex.Message}|{ex.StackTrace}"); + _logger.LogError($"{nameof(WatchEvents)},出错: |{ex.Message}|{ex.StackTrace}"); }