Ver código fonte

调整平均值精度

datasub12_previous
H Vs 11 meses atrás
pai
commit
7eb5f42c78
2 arquivos alterados com 12 adições e 12 exclusões
  1. +6
    -6
      HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs
  2. +6
    -6
      HealthMonitor.WebApi/Worker.cs

+ 6
- 6
HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs Ver arquivo

@@ -156,8 +156,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor
// 没有血压数据时增量值为0 // 没有血压数据时增量值为0
int systolicInc; int systolicInc;
int diastolicInc; int diastolicInc;
int systolicAvg;
int diastolicAvg;
decimal systolicAvg;
decimal diastolicAvg;


// 最后一次下发值 // 最后一次下发值
int lastPushSystolicInc = 0; int lastPushSystolicInc = 0;
@@ -195,8 +195,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor
//systolicAvg = (int)(hmBpParser?.AverageAfterRemovingOneMinMaxRef(i => i.SystolicValue, SafeType.SafeInt(systolicRefValue!)))!; //systolicAvg = (int)(hmBpParser?.AverageAfterRemovingOneMinMaxRef(i => i.SystolicValue, SafeType.SafeInt(systolicRefValue!)))!;
//diastolicAvg = (int)(hmBpParser?.AverageAfterRemovingOneMinMaxRef(i => i.DiastolicValue, SafeType.SafeInt(diastolicRefValue!)))!; //diastolicAvg = (int)(hmBpParser?.AverageAfterRemovingOneMinMaxRef(i => i.DiastolicValue, SafeType.SafeInt(diastolicRefValue!)))!;
var avgs = _serviceTDengine.AverageAfterRemovingOneMinMaxRef(SafeType.SafeInt(systolicRefValue!), hmBpParser!); var avgs = _serviceTDengine.AverageAfterRemovingOneMinMaxRef(SafeType.SafeInt(systolicRefValue!), hmBpParser!);
systolicAvg = (int)avgs[0];
diastolicAvg = (int)avgs[1];
systolicAvg = avgs[0];
diastolicAvg = avgs[1];
// 平均值为0,说明数据不足,不能计算增量值 // 平均值为0,说明数据不足,不能计算增量值
// 数据不足等同进行初始化,只下发标定值,增量值为0;remarks恢复到未校准状态,需要基于第一个测量值生成增量值。 // 数据不足等同进行初始化,只下发标定值,增量值为0;remarks恢复到未校准状态,需要基于第一个测量值生成增量值。
if (systolicAvg.Equals(0)) if (systolicAvg.Equals(0))
@@ -229,8 +229,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor
systolicInc = currentSystolicInc + lastPushSystolicInc; systolicInc = currentSystolicInc + lastPushSystolicInc;
diastolicInc = currentDiastolicInc + lastPushDiastolicInc; diastolicInc = currentDiastolicInc + lastPushDiastolicInc;
_logger.LogInformation($"{imei}--{nameof(Put)}--计算增量值" + _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},手工校准,发给设备的绝对增量值=(上次绝对增量值+新数据的增量值)"); _logger.LogInformation($"{imei},手工校准,发给设备的绝对增量值=(上次绝对增量值+新数据的增量值)");
return await IotSetBloodPressCalibrationConfigResponseAsync(imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc, systolicAvg, diastolicAvg, systolicAvgOffset, diastolicAvgOffset, startTime, endTime).ConfigureAwait(false); return await IotSetBloodPressCalibrationConfigResponseAsync(imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc, systolicAvg, diastolicAvg, systolicAvgOffset, diastolicAvgOffset, startTime, endTime).ConfigureAwait(false);
} }


+ 6
- 6
HealthMonitor.WebApi/Worker.cs Ver arquivo

@@ -169,8 +169,8 @@ namespace HealthMonitor.WebApi
int systolicRefValue; int systolicRefValue;
int diastolicRefValue; int diastolicRefValue;


int systolicAvg;
int diastolicAvg;
decimal systolicAvg;
decimal diastolicAvg;


int systolicMax = 0; int systolicMax = 0;
int diastolicMax = 0; int diastolicMax = 0;
@@ -253,8 +253,8 @@ namespace HealthMonitor.WebApi
//diastolicAvg = (int)(hmBpParser?.AverageAfterRemovingOneMinMaxRef(i => i.DiastolicValue, SafeType.SafeInt(diastolicRefValue!)))!; //diastolicAvg = (int)(hmBpParser?.AverageAfterRemovingOneMinMaxRef(i => i.DiastolicValue, SafeType.SafeInt(diastolicRefValue!)))!;


var avgs = _serviceTDengine.AverageAfterRemovingOneMinMaxRef(SafeType.SafeInt(systolicRefValue!), hmBpParser!); var avgs = _serviceTDengine.AverageAfterRemovingOneMinMaxRef(SafeType.SafeInt(systolicRefValue!), hmBpParser!);
systolicAvg = (int)avgs[0];
diastolicAvg = (int)avgs[1];
systolicAvg = avgs[0];
diastolicAvg = avgs[1];




// 2. 判断能否计算增量值 // 2. 判断能否计算增量值
@@ -277,8 +277,8 @@ namespace HealthMonitor.WebApi
diastolicInc = currentDiastolicInc + lastPushDiastolicInc; diastolicInc = currentDiastolicInc + lastPushDiastolicInc;


_logger.LogInformation($"{imeiDel}--{nameof(Worker)}--计算增量值" + _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)}-- 定时校准,发给设备的绝对增量值=(上次绝对增量值+新数据的增量值)"); _logger.LogInformation($"{imeiDel}--{nameof(Worker)}-- 定时校准,发给设备的绝对增量值=(上次绝对增量值+新数据的增量值)");






Carregando…
Cancelar
Salvar