Browse Source

最后一条常规心率计算的胎心数据到iot设备

datasub12_fetal_heart_rate_0
H Vs 3 months ago
parent
commit
e2e3438fca
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      HealthMonitor.WebApi/Worker.cs

+ 8
- 2
HealthMonitor.WebApi/Worker.cs View File

@@ -15,6 +15,7 @@ using HealthMonitor.Service.Etcd;
using HealthMonitor.Service.MessageQueue;
using HealthMonitor.Service.Sub;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.Extensions.Options;
using NetTaste;
@@ -1100,8 +1101,13 @@ namespace HealthMonitor.WebApi
await _hisFetalHeartApiClient.AddAsync(gpsFetalHeartRate).ConfigureAwait(false);

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

// 推送最后一条平常心率到iot设备
var lastPhr = await _serviceTDengine.GetLastAsync<PregnancyHeartRateModel>(heartRate.Serialno);
if (lastPhr.MessageId== heartRate.MessageId)
{
await _serviceIotApi.SetFetalHeartRateConfig(heartRate.Serialno, fetalHeartRate, sampleTime, isAbnormal);
_logger.LogInformation($"{heartRate.Serialno} 推送最后一条常规心率计算的胎心数据到iot设备");
}

var device = await _deviceCacheMgr.GetDeviceBySerialNoAsync(heartRate.Serialno).ConfigureAwait(false);
var fhrMsgId = $"{heartRate.Serialno}-{sampleTime}-{Guid.NewGuid().ToString("D")[^3..]}";


Loading…
Cancel
Save