|
@@ -28,10 +28,23 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor |
|
|
_configTDengineService = configTDengineService.Value; |
|
|
_configTDengineService = configTDengineService.Value; |
|
|
} |
|
|
} |
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public async Task<ApiResponse<object>> Add([FromBody] HisGpsBloodPress model, [FromHeader] string requestId) |
|
|
|
|
|
|
|
|
public async Task<ApiResponse<object>> Add([FromBody] HmBloodPress reqModel, [FromHeader] string requestId) |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
|
|
|
HisGpsBloodPress model = new HisGpsBloodPress() |
|
|
|
|
|
{ |
|
|
|
|
|
BloodPressId = reqModel.BloodPressId, |
|
|
|
|
|
DiastolicValue = reqModel.DiastolicValue, |
|
|
|
|
|
IsDisplay = reqModel.IsDisplay, |
|
|
|
|
|
MessageId = reqModel.MessageId, |
|
|
|
|
|
Method = reqModel.Method, |
|
|
|
|
|
Serialno = reqModel.Serialno, |
|
|
|
|
|
SystolicValue = reqModel.SystolicValue, |
|
|
|
|
|
CreateTime = DateTime.Parse(reqModel.CreateTime.ToString()), |
|
|
|
|
|
LastUpdate = DateTime.Parse(reqModel.LastUpdate.ToString()), |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
var serial_tail_no = model.Serialno.Substring(model.Serialno.Length - 2); |
|
|
var serial_tail_no = model.Serialno.Substring(model.Serialno.Length - 2); |
|
|
var sql = $"INSERT INTO {_configTDengineService.DB}.hm_bp_{serial_tail_no} USING {_configTDengineService.DB}.stb_hm_bloodpress TAGS ('{serial_tail_no}') VALUES(" + |
|
|
var sql = $"INSERT INTO {_configTDengineService.DB}.hm_bp_{serial_tail_no} USING {_configTDengineService.DB}.stb_hm_bloodpress TAGS ('{serial_tail_no}') VALUES(" + |
|
|
$"'{model.LastUpdate:yyyy-MM-dd HH:mm:ss.fff}'," + |
|
|
$"'{model.LastUpdate:yyyy-MM-dd HH:mm:ss.fff}'," + |
|
@@ -53,11 +66,11 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|
_logger.LogInformation($"{model.Serialno} -- {model.MessageId} -- 血压数据插入失败; {ex.Message}\n {ex.InnerException} \n{ex.StackTrace}"); |
|
|
|
|
|
|
|
|
_logger.LogInformation($"{reqModel.Serialno} -- {reqModel.MessageId} -- 血压数据插入失败; {ex.Message}\n {ex.InnerException} \n{ex.StackTrace}"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return ApiResponse<object>.Fail(500, $"{model.Serialno} -- {model.MessageId} -- 血压数据插入失败"); |
|
|
|
|
|
|
|
|
return ApiResponse<object>.Fail(500, $"{reqModel.Serialno} -- {reqModel.MessageId} -- 血压数据插入失败"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |