Browse Source

新增自动建表

td_orm
H Vs 1 year ago
parent
commit
8d43b46970
1 changed files with 4 additions and 66 deletions
  1. +4
    -66
      HealthMonitor.Service/Resolver/BloodpressResolver.cs

+ 4
- 66
HealthMonitor.Service/Resolver/BloodpressResolver.cs View File

@@ -151,74 +151,11 @@ namespace HealthMonitor.Service.Resolver



// _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_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(" +
// 自动建表
var sql = $"INSERT INTO health_monitor.hm_bp_stats_inc_{bp.Serialno.Substring(bp.Serialno.Length - 2)} USING health_monitor.stb_hm_bloodpress_stats_inc TAGS ('{bp.Serialno.Substring(bp.Serialno.Length - 2)}') VALUES(" +
$"'{bp.LastUpdate:yyyy-MM-dd HH:mm:ss.fff}'," +
$"'{bp.BloodPressId}'," +
$"'{bp.MessageId}'," +
@@ -246,6 +183,7 @@ namespace HealthMonitor.Service.Resolver
$"'{startTime:yyyy-MM-dd HH:mm:ss.fff}'," +
$"'{endTime:yyyy-MM-dd HH:mm:ss.fff}'," +
$"'{string.Empty}')";

_serviceTDengine.ExecuteInsertSQL(sql);
#endregion
}


Loading…
Cancel
Save