Explorar el Código

调整

datasub12_fetal_heart_rate_0
H Vs hace 3 meses
padre
commit
e85eb4cdd5
Se han modificado 5 ficheros con 567 adiciones y 508 borrados
  1. +12
    -0
      HealthMonitor.Service/Biz/db/TDengineService.cs
  2. +519
    -506
      HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs
  3. +25
    -0
      HealthMonitor.WebApi/Controllers/HealthMonitor/HmFetalController.cs
  4. +10
    -0
      HealthMonitor.WebApi/Model/Request/BaseReq.cs
  5. +1
    -2
      HealthMonitor.WebApi/Worker.cs

+ 12
- 0
HealthMonitor.Service/Biz/db/TDengineService.cs Ver fichero

@@ -820,6 +820,18 @@ namespace HealthMonitor.Service.Biz.db

return res;
}


public async Task<int> DeleteAllBySerialNoCMDAsync<T>(string serialNo) where T : class
{
var stbName = typeof(T)
.GetCustomAttribute<STableAttribute>()?
.STableName;
var endTime=DateTime.Now;
var startTime = DateTime.Now.AddYears(-1);
var sql = $"DELETE FROM {stbName} WHERE ts >= '{startTime:yyyy-MM-dd HH:mm:ss}' AND ts <= '{endTime:yyyy-MM-dd HH:mm:ss}' AND serialno='{serialNo}'";
return await _clientSqlSugar.Ado.ExecuteCommandAsync(sql);
}
#endregion

#region 胎心算法


+ 519
- 506
HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 25
- 0
HealthMonitor.WebApi/Controllers/HealthMonitor/HmFetalController.cs Ver fichero

@@ -2,8 +2,11 @@
using HealthMonitor.Service.Biz;
using HealthMonitor.Service.Biz.db;
using HealthMonitor.WebApi.Configs;
using HealthMonitor.WebApi.Controllers.Api;
using HealthMonitor.WebApi.Model.Request;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Metadata;
using SqlSugar.TDengine;

namespace HealthMonitor.WebApi.Controllers.HealthMonitor
{
@@ -99,5 +102,27 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor
};
}

[HttpPost]
public async Task<ApiResponse<object>> CleanFetal([FromHeader] string requestId, [FromBody] BaseReq req)
{
try
{
// 删除孕妇心率
await _serviceTDengine.DeleteAllBySerialNoCMDAsync<PregnancyHeartRateModel>(req.Serialno);
// 删除一般心率(建模数据)
await _serviceTDengine.DeleteAllBySerialNoCMDAsync<PregnancyCommonHeartRateModel>(req.Serialno);

var data = $"{req.Serialno} 清理胎心胎动建模数据成功";
return ApiResponse<object>.Success(data);
}
catch (Exception ex)
{
_logger.LogError($"{req.Serialno} 清理胎心胎动数据异常; {ex.Message}\n {ex.InnerException} \n{ex.StackTrace}");

}

return ApiResponse<object>.Fail(500, $"{req.Serialno} 清理胎心胎动数据异常");

}
}
}

+ 10
- 0
HealthMonitor.WebApi/Model/Request/BaseReq.cs Ver fichero

@@ -0,0 +1,10 @@
using Newtonsoft.Json;

namespace HealthMonitor.WebApi.Model.Request
{
public class BaseReq
{
[JsonProperty("serialno")]
public string Serialno { get; set; } = default!;
}
}

+ 1
- 2
HealthMonitor.WebApi/Worker.cs Ver fichero

@@ -441,11 +441,10 @@ namespace HealthMonitor.WebApi

#region 胎动延时计算
var watchConfig = await _deviceCacheMgr.GetGpsDeviceWatchConfigCacheObjectBySerialNoAsync(imeiDel, "0067");
_logger.LogInformation($"触发胎动计算,设备配置{JsonConvert.SerializeObject(watchConfig)}");
var isFetalHeartEnable = watchConfig != null && (int)watchConfig["enabled"]! == 1;
if (isFetalHeartEnable)
{

var edoc = DateTimeUtil.ToDateTime(watchConfig!["EDOC"]!.ToString());
// 已经建模
var commonPHR = await _serviceTDengine.GetLastAsync<PregnancyCommonHeartRateModel>(imeiDel);


Cargando…
Cancelar
Guardar