diff --git a/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs b/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs index bf1e768..7adf1a3 100644 --- a/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs +++ b/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs @@ -156,8 +156,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor // 没有血压数据时增量值为0 int systolicInc; int diastolicInc; - int systolicAvg; - int diastolicAvg; + decimal systolicAvg; + decimal diastolicAvg; // 最后一次下发值 int lastPushSystolicInc = 0; @@ -195,8 +195,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor //systolicAvg = (int)(hmBpParser?.AverageAfterRemovingOneMinMaxRef(i => i.SystolicValue, SafeType.SafeInt(systolicRefValue!)))!; //diastolicAvg = (int)(hmBpParser?.AverageAfterRemovingOneMinMaxRef(i => i.DiastolicValue, SafeType.SafeInt(diastolicRefValue!)))!; var avgs = _serviceTDengine.AverageAfterRemovingOneMinMaxRef(SafeType.SafeInt(systolicRefValue!), hmBpParser!); - systolicAvg = (int)avgs[0]; - diastolicAvg = (int)avgs[1]; + systolicAvg = avgs[0]; + diastolicAvg = avgs[1]; // 平均值为0,说明数据不足,不能计算增量值 // 数据不足等同进行初始化,只下发标定值,增量值为0;remarks恢复到未校准状态,需要基于第一个测量值生成增量值。 if (systolicAvg.Equals(0)) @@ -229,8 +229,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor systolicInc = currentSystolicInc + lastPushSystolicInc; diastolicInc = currentDiastolicInc + lastPushDiastolicInc; _logger.LogInformation($"{imei}--{nameof(Put)}--计算增量值" + - $"\n systolicInc:{systolicInc}-- currentSystolicInc:{currentSystolicInc} -- lastPushSystolicInc:{lastPushSystolicInc}" + - $"\n diastolicInc:{diastolicInc} --currentDiastolicInc:{currentDiastolicInc} -- lastPushDiastolicInc:{lastPushDiastolicInc}"); + $"\n {imei}-- systolicAvg:{systolicAvg}--systolicInc:{systolicInc}-- currentSystolicInc:{currentSystolicInc} -- lastPushSystolicInc:{lastPushSystolicInc}" + + $"\n {imei}-- diastolicAvg:{diastolicAvg}--diastolicInc:{diastolicInc} --currentDiastolicInc:{currentDiastolicInc} -- lastPushDiastolicInc:{lastPushDiastolicInc}"); _logger.LogInformation($"{imei},手工校准,发给设备的绝对增量值=(上次绝对增量值+新数据的增量值)"); return await IotSetBloodPressCalibrationConfigResponseAsync(imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc, systolicAvg, diastolicAvg, systolicAvgOffset, diastolicAvgOffset, startTime, endTime).ConfigureAwait(false); } diff --git a/HealthMonitor.WebApi/Worker.cs b/HealthMonitor.WebApi/Worker.cs index 5e763f6..feb6066 100644 --- a/HealthMonitor.WebApi/Worker.cs +++ b/HealthMonitor.WebApi/Worker.cs @@ -169,8 +169,8 @@ namespace HealthMonitor.WebApi int systolicRefValue; int diastolicRefValue; - int systolicAvg; - int diastolicAvg; + decimal systolicAvg; + decimal diastolicAvg; int systolicMax = 0; int diastolicMax = 0; @@ -253,8 +253,8 @@ namespace HealthMonitor.WebApi //diastolicAvg = (int)(hmBpParser?.AverageAfterRemovingOneMinMaxRef(i => i.DiastolicValue, SafeType.SafeInt(diastolicRefValue!)))!; var avgs = _serviceTDengine.AverageAfterRemovingOneMinMaxRef(SafeType.SafeInt(systolicRefValue!), hmBpParser!); - systolicAvg = (int)avgs[0]; - diastolicAvg = (int)avgs[1]; + systolicAvg = avgs[0]; + diastolicAvg = avgs[1]; // 2. 判断能否计算增量值 @@ -277,8 +277,8 @@ namespace HealthMonitor.WebApi diastolicInc = currentDiastolicInc + lastPushDiastolicInc; _logger.LogInformation($"{imeiDel}--{nameof(Worker)}--计算增量值" + - $"\n systolicInc:{systolicInc}-- currentSystolicInc:{currentSystolicInc} -- lastPushSystolicInc:{lastPushSystolicInc}" + - $"\n diastolicInc:{diastolicInc} --currentDiastolicInc:{currentDiastolicInc} -- lastPushDiastolicInc:{lastPushDiastolicInc}"); + $"\n {imeiDel} -- systolicAvg:{systolicAvg}-- systolicInc:{systolicInc}-- currentSystolicInc:{currentSystolicInc} -- lastPushSystolicInc:{lastPushSystolicInc}" + + $"\n {imeiDel} -- diastolicAvg:{diastolicAvg}-- diastolicInc:{diastolicInc} --currentDiastolicInc:{currentDiastolicInc} -- lastPushDiastolicInc:{lastPushDiastolicInc}"); _logger.LogInformation($"{imeiDel}--{nameof(Worker)}-- 定时校准,发给设备的绝对增量值=(上次绝对增量值+新数据的增量值)");