|
|
@@ -106,8 +106,8 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
DateTime endTime = now; |
|
|
|
|
|
|
|
// |
|
|
|
var systolicAggregate = await _serviceTDengine.GetAggregateValueAsync("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 = await _serviceTDengine.GetAggregateValueAsync("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-ddTHH:mm:ss.fffZ}' and ts <='{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}' and serialno='{bp.Serialno}'"); |
|
|
|
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='{bp.Serialno}'"); |
|
|
|
//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}'"); |
|
|
|
|
|
|
@@ -120,8 +120,8 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
|
|
|
|
|
|
|
|
// 计算去除最大值和最小值和异常值的平均值 |
|
|
|
var systolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("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}' and systolic_value < {systolicRefValue} "); |
|
|
|
var diastolicAvg = await _serviceTDengine.GetAvgExceptMaxMinValueAsync("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}' and diastolic_value < {diastolicRefValue}"); |
|
|
|
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='{bp.Serialno}' 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='{bp.Serialno}' and diastolic_value < {diastolicRefValue}"); |
|
|
|
|
|
|
|
//var systolicAvg = _serviceTDengine.GetAvgExceptMaxMinValue("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}' and systolic_value < {systolicRefValue} "); |
|
|
|
//var diastolicAvg = _serviceTDengine.GetAvgExceptMaxMinValue("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}' and diastolic_value < {diastolicRefValue}"); |
|
|
@@ -141,9 +141,78 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// _logger.LogInformation($"health_monitor.hm_bp_stats_inc_{bp.Serialno.Substring(bp.Serialno.Length - 2)}"); |
|
|
|
//if (bp.MessageId.Equals("1674952622991276544")) |
|
|
|
//{ |
|
|
|
// var aa = bp; |
|
|
|
// var cc = aa; |
|
|
|
//} |
|
|
|
|
|
|
|
#region 插入BP增量值 hm_bloodpress_stats_inc |
|
|
|
var sql = $"INSERT INTO health_monitor.hm_bloodpress_stats_inc VALUES(" + |
|
|
|
$"'{bp.LastUpdate:yyyy-MM-ddTHH:mm:ss.fffZ}'," + |
|
|
|
//var sql = $"INSERT INTO health_monitor.hm_bp_stats_inc_{bp.Serialno.Substring(bp.Serialno.Length - 2)} VALUES(" + |
|
|
|
// $"{DateTimeUtil.ConvertToTimeStamp((DateTime)bp.LastUpdate)* 1000000}" + |
|
|
|
// $"'{bp.BloodPressId}'," + |
|
|
|
// $"'{bp.MessageId}'," + |
|
|
|
// $"'{bp.Serialno}'," + |
|
|
|
// $"{bp.SystolicValue}," + |
|
|
|
// $"{systolicRefValue}," + |
|
|
|
// $"{systolicAvg}," + |
|
|
|
// $"{systolicMax}," + |
|
|
|
// $"{systolicMin}," + |
|
|
|
// $"{systolicAvgOffset}," + |
|
|
|
// $"{systolicInc}," + |
|
|
|
// $"{bp.DiastolicValue}," + |
|
|
|
// $"{diastolicRefValue}," + |
|
|
|
// $"{diastolicAvg}," + |
|
|
|
// $"{diastolicMax}," + |
|
|
|
// $"{diastolicMin}," + |
|
|
|
// $"{diastolicAvgOffset}," + |
|
|
|
// $"{diastolicInc}," + |
|
|
|
// $"{gender}," + |
|
|
|
// $"{age}," + |
|
|
|
// $"{height}," + |
|
|
|
// $"{weight}," + |
|
|
|
// $"'{bp.LastUpdate:yyyy-MM-ddTHH:mm:ss.fffZ}'," + |
|
|
|
// $"{duration}," + |
|
|
|
// $"'{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}'," + |
|
|
|
// $"'{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}'," + |
|
|
|
// $"'{string.Empty}')"; |
|
|
|
|
|
|
|
//var sql = $"INSERT INTO health_monitor.hm_bp_stats_inc_{bp.Serialno.Substring(bp.Serialno.Length - 2)} VALUES(" + |
|
|
|
// $"'{bp.LastUpdate:yyyy-MM-ddTHH:mm:ss.fffZ}'," + |
|
|
|
// $"'{bp.BloodPressId}'," + |
|
|
|
// $"'{bp.MessageId}'," + |
|
|
|
// $"'{bp.Serialno}'," + |
|
|
|
// $"{bp.SystolicValue}," + |
|
|
|
// $"{systolicRefValue}," + |
|
|
|
// $"{systolicAvg}," + |
|
|
|
// $"{systolicMax}," + |
|
|
|
// $"{systolicMin}," + |
|
|
|
// $"{systolicAvgOffset}," + |
|
|
|
// $"{systolicInc}," + |
|
|
|
// $"{bp.DiastolicValue}," + |
|
|
|
// $"{diastolicRefValue}," + |
|
|
|
// $"{diastolicAvg}," + |
|
|
|
// $"{diastolicMax}," + |
|
|
|
// $"{diastolicMin}," + |
|
|
|
// $"{diastolicAvgOffset}," + |
|
|
|
// $"{diastolicInc}," + |
|
|
|
// $"{gender}," + |
|
|
|
// $"{age}," + |
|
|
|
// $"{height}," + |
|
|
|
// $"{weight}," + |
|
|
|
// $"'{bp.LastUpdate:yyyy-MM-ddTHH:mm:ss.fffZ}'," + |
|
|
|
// $"{duration}," + |
|
|
|
// $"'{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}'," + |
|
|
|
// $"'{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}'," + |
|
|
|
// $"'{string.Empty}')"; |
|
|
|
//var res = await _serviceTDengine.GernalRestSql(sql); |
|
|
|
|
|
|
|
var sql = $"INSERT INTO health_monitor.hm_bp_stats_inc_{bp.Serialno.Substring(bp.Serialno.Length - 2)} VALUES(" + |
|
|
|
$"'{bp.LastUpdate:yyyy-MM-dd HH:mm:ss.fff}'," + |
|
|
|
$"'{bp.BloodPressId}'," + |
|
|
|
$"'{bp.MessageId}'," + |
|
|
|
$"'{bp.Serialno}'," + |
|
|
@@ -165,13 +234,12 @@ namespace HealthMonitor.Service.Resolver |
|
|
|
$"{age}," + |
|
|
|
$"{height}," + |
|
|
|
$"{weight}," + |
|
|
|
$"'{bp.LastUpdate:yyyy-MM-ddTHH:mm:ss.fffZ}'," + |
|
|
|
$"'{bp.LastUpdate:yyyy-MM-dd HH:mm:ss.fff}'," + |
|
|
|
$"{duration}," + |
|
|
|
$"'{startTime:yyyy-MM-ddTHH:mm:ss.fffZ}'," + |
|
|
|
$"'{endTime:yyyy-MM-ddTHH:mm:ss.fffZ}'," + |
|
|
|
$"'{startTime:yyyy-MM-dd HH:mm:ss.fff}'," + |
|
|
|
$"'{endTime:yyyy-MM-dd HH:mm:ss.fff}'," + |
|
|
|
$"'{string.Empty}')"; |
|
|
|
//var res = await _serviceTDengine.GernalRestSql(sql); |
|
|
|
_serviceTDengine.ExecuteInsertSQL(sql); |
|
|
|
_serviceTDengine.ExecuteInsertSQL(sql); |
|
|
|
#endregion |
|
|
|
} |
|
|
|
|
|
|
|