From 880434d9b813ea8a186dd3fde0278155eed089c9 Mon Sep 17 00:00:00 2001 From: H Vs Date: Wed, 22 Nov 2023 21:58:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E5=87=86=E5=9B=9B=E8=88=8D=E4=BA=94?= =?UTF-8?q?=E5=85=A5=E5=8E=BB=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...loodPressConfigManualCalibrationController.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs b/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs index 85ed19d..830e42d 100644 --- a/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs +++ b/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs @@ -201,8 +201,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor // 增量值=(标定值-平均值)* 0.25 - systolicInc = systolicAvg.Equals(0M) ? 0 : (int)((systolicRefValue - systolicAvg) * systolicAvgOffset)!; - diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; + systolicInc = systolicAvg.Equals(0M) ? 0 : (int)Math.Round((systolicRefValue - systolicAvg) * systolicAvgOffset)!; + diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)Math.Round((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; _logger.LogInformation(" A.2 没有下推记录,有测量记录,正常计算增量值 ,增量值将正常下发"); return await IotSetBloodPressCalibrationConfigResponseAsync(imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc).ConfigureAwait(false); } @@ -254,8 +254,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor //var systolicAvgOffset = avgOffset; //var diastolicAvgOffset = avgOffset; // 增量值=(标定值-平均值)* 0.25 - systolicInc = systolicAvg.Equals(0M) ? 0 : (int)((systolicRefValue - systolicAvg) * systolicAvgOffset)!; - diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; + systolicInc = systolicAvg.Equals(0M) ? 0 : (int)Math.Round((systolicRefValue - systolicAvg) * systolicAvgOffset)!; + diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)Math.Round((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; _logger.LogInformation("B.1.2 设备已经被重新设置, 从重置的ts 到 now 有测量数据 ,增量值将正常下发"); return await IotSetBloodPressCalibrationConfigResponseAsync(imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc).ConfigureAwait(false); } @@ -288,8 +288,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor //systolicInc = systolicAvg.Equals(0M) ? 0 : (int)((systolicRefValue - systolicAvg) * systolicAvgOffset)!; //diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; - systolicInc = (int)((systolicRefValue - systolicAvg) * systolicAvgOffset)!; - diastolicInc = (int)((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; + systolicInc = (int)Math.Round((systolicRefValue - systolicAvg) * systolicAvgOffset)!; + diastolicInc = (int)Math.Round((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; // B.2.1 数据异常,将按最后一次测量值的offeset下发 if (systolicAvg.Equals(0) || diastolicAvg.Equals(0)) @@ -318,8 +318,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor { // 增量值=(标定值-平均值)* 0.25 - systolicInc = systolicAvg.Equals(0M) ? 0 : (int)((systolicRefValue - systolicAvg) * systolicAvgOffset)!; - diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; + systolicInc = systolicAvg.Equals(0M) ? 0 : (int)Math.Round((systolicRefValue - systolicAvg) * systolicAvgOffset)!; + diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)Math.Round((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; _logger.LogInformation("B.2.2 曾经下推过断言有测量记录,数据正常,按正常计算 ,增量值将正常下发"); return await IotSetBloodPressCalibrationConfigResponseAsync(imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc).ConfigureAwait(false); }