|
@@ -181,8 +181,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
// 平均值: 计算去除最大值 MAX和最小值 MIN 和异常值 ABN 的平均值 |
|
|
// 平均值: 计算去除最大值 MAX和最小值 MIN 和异常值 ABN 的平均值 |
|
|
systolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("systolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}' and systolic_value < {systolicRefValue} "); |
|
|
|
|
|
diastolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("diastolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}' and diastolic_value < {diastolicRefValue}"); |
|
|
|
|
|
|
|
|
systolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("systolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}' and systolic_value < {systolicRefValue} "); |
|
|
|
|
|
diastolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("diastolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}' and diastolic_value < {diastolicRefValue}"); |
|
|
|
|
|
|
|
|
// 数据异常,不修改增量值 |
|
|
// 数据异常,不修改增量值 |
|
|
if (systolicAvg.Equals(0) || diastolicAvg.Equals(0)) |
|
|
if (systolicAvg.Equals(0) || diastolicAvg.Equals(0)) |
|
@@ -225,7 +225,7 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor |
|
|
endTime = DateTime.Now;//newTs; |
|
|
endTime = DateTime.Now;//newTs; |
|
|
startTime = newTs;//DateTime.Now; |
|
|
startTime = newTs;//DateTime.Now; |
|
|
|
|
|
|
|
|
int count = await _serviceTDengine.GetCount("stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}' "); |
|
|
|
|
|
|
|
|
int count = await _serviceTDengine.GetCount("stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}' "); |
|
|
// B.1.1 设备已经被重新设置, 从重置的ts 到 now 没有测量数据,inc=0 |
|
|
// B.1.1 设备已经被重新设置, 从重置的ts 到 now 没有测量数据,inc=0 |
|
|
if (count.Equals(0)) |
|
|
if (count.Equals(0)) |
|
|
{ |
|
|
{ |
|
@@ -236,8 +236,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
// 平均值: 计算去除最大值 MAX和最小值 MIN 和异常值 ABN 的平均值 |
|
|
// 平均值: 计算去除最大值 MAX和最小值 MIN 和异常值 ABN 的平均值 |
|
|
systolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("systolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}' and systolic_value < {systolicRefValue} "); |
|
|
|
|
|
diastolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("diastolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}' and diastolic_value < {diastolicRefValue}"); |
|
|
|
|
|
|
|
|
systolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("systolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}' and systolic_value < {systolicRefValue} "); |
|
|
|
|
|
diastolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("diastolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}' and diastolic_value < {diastolicRefValue}"); |
|
|
|
|
|
|
|
|
// 数据异常,不修改增量值 |
|
|
// 数据异常,不修改增量值 |
|
|
if (systolicAvg.Equals(0) || diastolicAvg.Equals(0)) |
|
|
if (systolicAvg.Equals(0) || diastolicAvg.Equals(0)) |
|
@@ -272,12 +272,12 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor |
|
|
startTime = newTs; |
|
|
startTime = newTs; |
|
|
|
|
|
|
|
|
// 最大值,最小值 |
|
|
// 最大值,最小值 |
|
|
var systolicAggregate = await _serviceTDengine.GetAggregateValueAsync("systolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}'"); |
|
|
|
|
|
var diastolicAggregate = await _serviceTDengine.GetAggregateValueAsync("diastolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}'"); |
|
|
|
|
|
|
|
|
var systolicAggregate = await _serviceTDengine.GetAggregateValueAsync("systolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}'"); |
|
|
|
|
|
var diastolicAggregate = await _serviceTDengine.GetAggregateValueAsync("diastolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}'"); |
|
|
|
|
|
|
|
|
// 平均值: 计算去除最大值 MAX和最小值 MIN 和异常值 ABN 的平均值 |
|
|
// 平均值: 计算去除最大值 MAX和最小值 MIN 和异常值 ABN 的平均值 |
|
|
systolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("systolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}' and systolic_value < {systolicRefValue} "); |
|
|
|
|
|
diastolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("diastolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}' and diastolic_value < {diastolicRefValue}"); |
|
|
|
|
|
|
|
|
systolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("systolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}' and systolic_value < {systolicRefValue} "); |
|
|
|
|
|
diastolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("diastolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}' and diastolic_value < {diastolicRefValue}"); |
|
|
// 偏移参数 |
|
|
// 偏移参数 |
|
|
//var avgOffset = 0.25M; |
|
|
//var avgOffset = 0.25M; |
|
|
//var systolicAvgOffset = avgOffset; |
|
|
//var systolicAvgOffset = avgOffset; |
|
@@ -295,7 +295,7 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor |
|
|
if (systolicAvg.Equals(0) || diastolicAvg.Equals(0)) |
|
|
if (systolicAvg.Equals(0) || diastolicAvg.Equals(0)) |
|
|
{ |
|
|
{ |
|
|
_logger.LogInformation("B.2.1 曾经下推过断言有测量记录,数据异常,平均值为0"); |
|
|
_logger.LogInformation("B.2.1 曾经下推过断言有测量记录,数据异常,平均值为0"); |
|
|
_logger.LogInformation($"{imei}本次计算结果\n{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}--{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}" + |
|
|
|
|
|
|
|
|
_logger.LogInformation($"{imei}本次计算结果\n{startTime:yyyy-MM-dd HH:mm:ss:fff}--{endTime:yyyy-MM-dd HH:mm:ss:fff}" + |
|
|
$"\n systolic:REF:{systolicRefValue} - Inc:{systolicInc} - AVG:{systolicAvg} - MAX:{systolicAggregate.Max} - MIN: {systolicAggregate.Min} " + |
|
|
$"\n systolic:REF:{systolicRefValue} - Inc:{systolicInc} - AVG:{systolicAvg} - MAX:{systolicAggregate.Max} - MIN: {systolicAggregate.Min} " + |
|
|
$"\n diastolic:REF:{diastolicRefValue} - Inc:{diastolicInc} - AVG:{diastolicAvg} - MAX:{diastolicAggregate.Max} - MIN: {diastolicAggregate.Min}"); |
|
|
$"\n diastolic:REF:{diastolicRefValue} - Inc:{diastolicInc} - AVG:{diastolicAvg} - MAX:{diastolicAggregate.Max} - MIN: {diastolicAggregate.Min}"); |
|
|
_logger.LogInformation($"上次下发的增量值:systolic:{(int)lastPush![4]}--diastolic:{(int)lastPush![5]}"); |
|
|
_logger.LogInformation($"上次下发的增量值:systolic:{(int)lastPush![4]}--diastolic:{(int)lastPush![5]}"); |
|
@@ -354,10 +354,10 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor |
|
|
//if (total >= 4) |
|
|
//if (total >= 4) |
|
|
if (lastBP?.Count != 0) |
|
|
if (lastBP?.Count != 0) |
|
|
{ |
|
|
{ |
|
|
//var systolicAggregate = await _serviceTDengine.GetAggregateValueAsync("systolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}'"); |
|
|
|
|
|
//var diastolicAggregate = await _serviceTDengine.GetAggregateValueAsync("diastolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}'"); |
|
|
|
|
|
//var systolicAggregate = _serviceTDengine.GetAggregateValue("systolic_value", "hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{bp.Serialno}'"); |
|
|
|
|
|
//var diastolicAggregate = _serviceTDengine.GetAggregateValue("diastolic_value", "hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{bp.Serialno}'"); |
|
|
|
|
|
|
|
|
//var systolicAggregate = await _serviceTDengine.GetAggregateValueAsync("systolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}'"); |
|
|
|
|
|
//var diastolicAggregate = await _serviceTDengine.GetAggregateValueAsync("diastolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}'"); |
|
|
|
|
|
//var systolicAggregate = _serviceTDengine.GetAggregateValue("systolic_value", "hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{bp.Serialno}'"); |
|
|
|
|
|
//var diastolicAggregate = _serviceTDengine.GetAggregateValue("diastolic_value", "hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{bp.Serialno}'"); |
|
|
|
|
|
|
|
|
//// 最大值 |
|
|
//// 最大值 |
|
|
//var systolicMax = systolicAggregate.Max; |
|
|
//var systolicMax = systolicAggregate.Max; |
|
@@ -368,8 +368,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 平均值: 计算去除最大值 MAX和最小值 MIN 和异常值 ABN 的平均值 |
|
|
// 平均值: 计算去除最大值 MAX和最小值 MIN 和异常值 ABN 的平均值 |
|
|
var systolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("systolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}' and systolic_value < {systolicRefValue} "); |
|
|
|
|
|
var diastolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("diastolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{imei}' and diastolic_value < {diastolicRefValue}"); |
|
|
|
|
|
|
|
|
var systolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("systolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}' and systolic_value < {systolicRefValue} "); |
|
|
|
|
|
var diastolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("diastolic_value", "stb_hm_bloodpress", $"ts>='{startTime:yyyy-MM-dd HH:mm:ss:fff}' and ts <='{endTime:yyyy-MM-dd HH:mm:ss:fff}' and serialno='{imei}' and diastolic_value < {diastolicRefValue}"); |
|
|
|
|
|
|
|
|
if (systolicAvg.Equals(0) || diastolicAvg.Equals(0)) |
|
|
if (systolicAvg.Equals(0) || diastolicAvg.Equals(0)) |
|
|
{ |
|
|
{ |
|
|