|
|
@@ -231,12 +231,17 @@ namespace HealthMonitor.WebApi |
|
|
|
var hmBpResponse = await _serviceTDengine.ExecuteSelectRestResponseAsync("stb_hm_bloodpress", condition); |
|
|
|
var hmBpParser = JsonConvert.DeserializeObject<ParseTDengineRestResponse<BloodPressureModel>>(hmBpResponse!); |
|
|
|
var hmBp = hmBpParser?.Select(); |
|
|
|
if (hmBp?.ToList().Count < 2) |
|
|
|
//if (hmBp?.ToList().Count < 2) |
|
|
|
// 1. 判断数据样本数量 |
|
|
|
if(hmBpParser!.Rows < 5) |
|
|
|
{ |
|
|
|
_logger.LogInformation($"{imeiDel} -- {nameof(Worker)} --{nameof(WatchEvents)} -- 统计定时下发,计算增量值的数据条目不足"); |
|
|
|
_logger.LogInformation($"{imeiDel} -- {nameof(Worker)} --{nameof(WatchEvents)} -- 统计定时下发,计算增量值的数据条目不足:{hmBpParser!.Rows} < 5"); |
|
|
|
_logger.LogInformation($"{imeiDel} -- {nameof(Worker)} --{nameof(WatchEvents)} 没有足够的数据样本,不会定时下发"); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 最大值 |
|
|
|
systolicMax = (int)hmBpParser?.Select(i => i.SystolicValue).Max()!; |
|
|
|
diastolicMax = (int)hmBpParser?.Select(i => i.DiastolicValue).Max()!; |
|
|
@@ -246,6 +251,15 @@ namespace HealthMonitor.WebApi |
|
|
|
|
|
|
|
systolicAvg = (int)(hmBpParser?.AverageAfterRemovingOneMinMaxRef(i => i.SystolicValue, SafeType.SafeInt(systolicRefValue!)))!; |
|
|
|
diastolicAvg = (int)(hmBpParser?.AverageAfterRemovingOneMinMaxRef(i => i.DiastolicValue, SafeType.SafeInt(diastolicRefValue!)))!; |
|
|
|
// 2. 判断能否计算增量值 |
|
|
|
if (systolicAvg.Equals(0) || diastolicAvg.Equals(0)) |
|
|
|
{ |
|
|
|
_logger.LogInformation($"{imeiDel}--{nameof(Worker)}--计算平均值" + |
|
|
|
$"\n currentSystolicAvg:{systolicAvg} -- lastPushSystolicInc:{lastPushSystolicInc}" + |
|
|
|
$"\n currentDiastolicInc:{diastolicAvg} -- lastPushDiastolicInc:{lastPushDiastolicInc}"); |
|
|
|
_logger.LogInformation($"{imeiDel}--{nameof(Worker)} 没有足够的数据样本计算平均值,不会定时下发"); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
// 增量值=(标定值-平均值)* 0.25 |
|
|
|
var currentSystolicInc = (int)((systolicRefValue - systolicAvg) * systolicAvgOffset)!; |
|
|
|