From 225b1ff479716156e2856f27232effb783fa38c2 Mon Sep 17 00:00:00 2001 From: H Vs Date: Thu, 23 Nov 2023 18:20:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=B7=A5=E6=A0=A1=E5=87=86=E5=A2=9E?= =?UTF-8?q?=E9=87=8F=E5=80=BC=E6=8C=89=E6=9C=80=E8=BF=91=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E7=B4=AF=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...dPressConfigManualCalibrationController.cs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs b/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs index b57fc44..269f0f7 100644 --- a/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs +++ b/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressConfigManualCalibrationController.cs @@ -213,8 +213,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor // 增量值=(标定值-平均值)* 0.25 - systolicInc = systolicAvg.Equals(0M) ? 0 : (int)Math.Round((systolicRefValue - systolicAvg) * systolicAvgOffset)!; - diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)Math.Round((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; + systolicInc = systolicAvg.Equals(0M) ? 0 : (int)((systolicRefValue - systolicAvg) * systolicAvgOffset)!; + diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; _logger.LogInformation(" A.2 没有下推记录,有测量记录,正常计算增量值 ,增量值将正常下发"); // return await IotSetBloodPressCalibrationConfigResponseAsync(imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc).ConfigureAwait(false); return await IotSetBloodPressCalibrationConfigResponseAsync(imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc, systolicAvg, diastolicAvg, systolicAvgOffset, diastolicAvgOffset, startTime, endTime).ConfigureAwait(false); @@ -276,8 +276,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor //var systolicAvgOffset = avgOffset; //var diastolicAvgOffset = avgOffset; // 增量值=(标定值-平均值)* 0.25 - systolicInc = systolicAvg.Equals(0M) ? 0 : (int)Math.Round((systolicRefValue - systolicAvg) * systolicAvgOffset)!; - diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)Math.Round((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; + systolicInc = systolicAvg.Equals(0M) ? 0 : (int)((systolicRefValue - systolicAvg) * systolicAvgOffset)! + SafeType.SafeInt(lastPush![4]); ; + diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)! + SafeType.SafeInt(lastPush![5]); ; _logger.LogInformation("B.1.2 设备已经被重新设置, 从重置的ts 到 now 有测量数据 ,增量值将正常下发"); //return await IotSetBloodPressCalibrationConfigResponseAsync(imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc).ConfigureAwait(false); return await IotSetBloodPressCalibrationConfigResponseAsync(imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc, systolicAvg, diastolicAvg, systolicAvgOffset, diastolicAvgOffset, startTime, endTime).ConfigureAwait(false); @@ -311,8 +311,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)Math.Round((systolicRefValue - systolicAvg) * systolicAvgOffset)!; - diastolicInc = (int)Math.Round((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; + systolicInc = (int)((systolicRefValue - systolicAvg) * systolicAvgOffset)! + SafeType.SafeInt(lastPush![4]); ; + diastolicInc = (int)((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)! + SafeType.SafeInt(lastPush![5]); ; // B.2.1 数据异常,将按最后一次测量值的offeset下发 if (systolicAvg.Equals(0) || diastolicAvg.Equals(0)) @@ -323,15 +323,15 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor $"\n diastolic:REF:{diastolicRefValue} - Inc:{diastolicInc} - AVG:{diastolicAvg} - MAX:{diastolicAggregate.Max} - MIN: {diastolicAggregate.Min}"); _logger.LogInformation($"上次下发的增量值:systolic:{(int)lastPush![4]}--diastolic:{(int)lastPush![5]}"); - if (systolicAvg.Equals(0)) - { - systolicInc = (int)lastPush[4]; - } + //if (systolicAvg.Equals(0)) + //{ + // systolicInc = (int)lastPush[4]; + //} - if (diastolicAvg.Equals(0)) - { - diastolicInc = (int)lastPush[5]; - } + //if (diastolicAvg.Equals(0)) + //{ + // diastolicInc = (int)lastPush[5]; + //} //return await IotSetBloodPressCalibrationConfigResponseAsync(model.Imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc).ConfigureAwait(false); return await IotSetBloodPressCalibrationConfigResponseAsync(imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc, systolicAvg, diastolicAvg, systolicAvgOffset, diastolicAvgOffset, startTime, endTime).ConfigureAwait(false); @@ -341,8 +341,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor { // 增量值=(标定值-平均值)* 0.25 - systolicInc = systolicAvg.Equals(0M) ? 0 : (int)Math.Round((systolicRefValue - systolicAvg) * systolicAvgOffset)!; - diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)Math.Round((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)!; + systolicInc = systolicAvg.Equals(0M) ? 0 : (int)((systolicRefValue - systolicAvg) * systolicAvgOffset)! + SafeType.SafeInt(lastPush![4]); + diastolicInc = diastolicAvg.Equals(0M) ? 0 : (int)((diastolicRefValue - diastolicAvg) * diastolicAvgOffset)! + SafeType.SafeInt(lastPush![5]); _logger.LogInformation("B.2.2 曾经下推过断言有测量记录,数据正常,按正常计算 ,增量值将正常下发"); return await IotSetBloodPressCalibrationConfigResponseAsync(imei, systolicRefValue, diastolicRefValue, systolicInc, diastolicInc,systolicAvg, diastolicAvg,systolicAvgOffset,diastolicAvgOffset,startTime,endTime).ConfigureAwait(false); }