소스 검색

调整平均值精度

datasub12_previous
H Vs 11 달 전
부모
커밋
7eb5f42c78
2개의 변경된 파일12개의 추가작업 그리고 12개의 파일을 삭제
  1. +6
    -6
      HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs
  2. +6
    -6
      HealthMonitor.WebApi/Worker.cs

+ 6
- 6
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);
}


+ 6
- 6
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)}-- 定时校准,发给设备的绝对增量值=(上次绝对增量值+新数据的增量值)");




Loading…
취소
저장