浏览代码

保存到数据服务

datasub12_fetal_heart_rate_0
H Vs 3 个月前
父节点
当前提交
fb770fe912
共有 3 个文件被更改,包括 28 次插入3 次删除
  1. +1
    -1
      HealthMonitor.Service/HealthMonitor.Service.csproj
  2. +26
    -1
      HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs
  3. +1
    -1
      HealthMonitor.WebApi/HealthMonitor.WebApi.csproj

+ 1
- 1
HealthMonitor.Service/HealthMonitor.Service.csproj 查看文件

@@ -15,7 +15,7 @@
<PackageReference Include="SqlSugarCore" Version="5.1.4.160" />
<PackageReference Include="System.Collections.Concurrent" Version="4.3.0" />
<PackageReference Include="TDengine.Connector" Version="3.0.2" />
<PackageReference Include="TelpoDataService.Util" Version="1.6.9.16-beta1" />
<PackageReference Include="TelpoDataService.Util" Version="1.6.9.30-beta1" />
</ItemGroup>

<ItemGroup>


+ 26
- 1
HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs 查看文件

@@ -16,6 +16,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TelpoDataService.Util.Clients;
using TelpoDataService.Util.Entities.GpsLocationHistory;

namespace HealthMonitor.Service.Resolver
@@ -34,9 +35,13 @@ namespace HealthMonitor.Service.Resolver
private readonly HttpHelper _httpHelper = default!;
private readonly EtcdService _serviceEtcd;

private readonly GpsLocationHistoryAccessorClient<HisGpsFetalHeartRate> _hisFetalHeartApiClient;



public PregnancyHeartRateResolver(ILogger<PregnancyHeartRateResolver> logger,
HttpHelper httpHelper, EtcdService serviceEtcd, DeviceCacheManager deviceCacheMgr, IotApiService iotApiService, TDengineService serviceDengine)
HttpHelper httpHelper, EtcdService serviceEtcd, DeviceCacheManager deviceCacheMgr,
IotApiService iotApiService, TDengineService serviceDengine, GpsLocationHistoryAccessorClient<HisGpsFetalHeartRate> hisFetalHeartApiClient)
{
_logger = logger;
_httpHelper = httpHelper;
@@ -44,6 +49,7 @@ namespace HealthMonitor.Service.Resolver
_serviceTDengine = serviceDengine;
_deviceCacheMgr = deviceCacheMgr;
_serviceIotApi = iotApiService;
_hisFetalHeartApiClient = hisFetalHeartApiClient;
}

public void SetResolveInfo(PackageMsgModel msg)
@@ -271,6 +277,25 @@ namespace HealthMonitor.Service.Resolver
var fetalHeartRate = SafeType.SafeInt(avgPhr * commonPHR?.StatModeAvgFprCoefficient!);
var sampleTime = DateTimeUtil.ConvertToTimeStamp(DateTime.Now).ToString();
var isAbnormal = fetalHeartRate > upperAlarmThreshold ? 1 : (fetalHeartRate < lowerAlarmThreshold ? 2 : 0);

// 保存到 数据服务 MySQL 数据库
HisGpsFetalHeartRate gpsFetalHeartRate = new ()
{
FetalHeartRateId = Guid.NewGuid().ToString("D"),
PersonId = commonPHR!.PersonId,
Serialno = heartRate.Serialno,
HeartRate = fetalHeartRate,
SampleTime = sampleTime,
IsAbnormal = isAbnormal,
StatStartTime = commonPHR.StatStartTime,
StatEndTime = commonPHR.StatEndTime,
CreateTime = DateTime.Now,
Method = 1,
IsDisplay = 1,
DeviceKey = commonPHR!.DeviceKey
};
await _hisFetalHeartApiClient.AddAsync(gpsFetalHeartRate).ConfigureAwait(false);

// 推送到api/v1/open/OpenIot/SetFetalHeartRateConfig
await _serviceIotApi.SetFetalHeartRateConfig(heartRate.Serialno, fetalHeartRate, sampleTime, isAbnormal);
}


+ 1
- 1
HealthMonitor.WebApi/HealthMonitor.WebApi.csproj 查看文件

@@ -11,7 +11,7 @@
<PackageReference Include="Serilog.Expressions" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="TelpoDataService.Util" Version="1.6.9.22-beta1" />
<PackageReference Include="TelpoDataService.Util" Version="1.6.9.30-beta1" />
</ItemGroup>

<ItemGroup>


正在加载...
取消
保存