Browse Source

1119

master
wxd 5 months ago
parent
commit
b86bd76c4e
  1. 3
      src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs
  2. 50
      src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs
  3. 2
      src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
  4. 4
      src/Shentun.Peis.DbMigrator/appsettings.json
  5. 44
      src/Shentun.Peis.Domain/IDuplicateRequestService.cs
  6. 2
      src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs
  7. 1
      src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs
  8. 2
      src/Shentun.Peis.HttpApi.Host/appsettings.json

3
src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs

@ -890,7 +890,8 @@ namespace Shentun.Peis.DiagnosisFunctions
result = result.Replace(num, "");
}
//将结果通过英文;解析到数组中
string[] resultArry = result.Split(";");
//string[] resultArry = result.Split(";");
string[] resultArry = result.Split(";",StringSplitOptions.RemoveEmptyEntries);
return resultArry;
}
#region 执行项目计算函数

50
src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs

@ -79,6 +79,7 @@ namespace Shentun.Peis.PacsBusiness
private readonly ICurrentPrincipalAccessor _principalAccessor;
private readonly SignInManager<IdentityUser> _signInManager;
private readonly IRepository<IdentityUser, Guid> _userRepository;
private readonly IDuplicateRequestService _duplicateRequestService;
public PacsBusinessAppService(
IConfiguration configuration,
@ -108,7 +109,8 @@ namespace Shentun.Peis.PacsBusiness
DiagnosisFunctionAppService diagnosisFunctionAppService,
ICurrentPrincipalAccessor principalAccessor,
SignInManager<IdentityUser> signInManager,
IRepository<IdentityUser, Guid> userRepository)
IRepository<IdentityUser, Guid> userRepository,
IDuplicateRequestService duplicateRequestService)
{
_configuration = configuration;
_registerCheckRepository = registerCheckRepository;
@ -138,6 +140,7 @@ namespace Shentun.Peis.PacsBusiness
_principalAccessor = principalAccessor;
_signInManager = signInManager;
_userRepository = userRepository;
_duplicateRequestService = duplicateRequestService;
}
@ -240,6 +243,15 @@ namespace Shentun.Peis.PacsBusiness
[HttpPost("api/app/PacsBusiness/ImportElectrocardiogramPictureByPatientRegisterNo")]
public async Task ImportElectrocardiogramPictureByPatientRegisterNoAsync(ImportElectrocardiogramPictureByPatientRegisterNoInputDto input)
{
// 生成请求唯一标识
var requestKey = $"ElectrocardiogramPicture_{input.PatientRegisterNo}";
// 检查是否重复请求(5秒内)
if (await _duplicateRequestService.IsDuplicateAsync(requestKey, TimeSpan.FromSeconds(120)))
{
throw new UserFriendlyException("请求过于频繁,请稍后重试");
}
Random rd = new Random();
string AbsolutePath = _configuration.GetValue<string>("PacsVirtualPath:RealPath");
@ -352,6 +364,31 @@ namespace Shentun.Peis.PacsBusiness
[DisableAuditing]
public async Task ImportElectrocardiogramResultByPatientRegisterNoAsync(ImportElectrocardiogramResultByPatientRegisterNoInputDto input)
{
// 生成请求唯一标识
var requestKey = $"ElectrocardiogramResult_{input.PatientRegisterNo}";
// 检查是否重复请求(5秒内)
if (await _duplicateRequestService.IsDuplicateAsync(requestKey, TimeSpan.FromSeconds(120)))
{
throw new UserFriendlyException("请求过于频繁,请稍后重试");
}
#region 处理结果
if (string.IsNullOrWhiteSpace(input.ItemResult))
{
throw new UserFriendlyException("结果不能为空");
}
StringBuilder itemResult = new StringBuilder();
var resultList = input.ItemResult.Split("\r\n", StringSplitOptions.RemoveEmptyEntries).ToList();
foreach (var itemRes in resultList)
{
itemResult.Append($"{resultList.IndexOf(itemRes) + 1}.{itemRes} ");
}
input.ItemResult = itemResult.ToString();
#endregion
Random rd = new Random();
string AbsolutePath = _configuration.GetValue<string>("PacsVirtualPath:RealPath");
@ -468,6 +505,15 @@ namespace Shentun.Peis.PacsBusiness
[DisableAuditing]
public async Task ImportDeviceReportFileByPatientRegisterNoAsync(ImportDeviceReportFileByPatientRegisterNoInputDto input)
{
// 生成请求唯一标识
var requestKey = $"DeviceReport_{input.PatientRegisterNo}";
// 检查是否重复请求(5秒内)
if (await _duplicateRequestService.IsDuplicateAsync(requestKey, TimeSpan.FromSeconds(120)))
{
throw new UserFriendlyException("请求过于频繁,请稍后重试");
}
Random rd = new Random();
string AbsolutePath = _configuration.GetValue<string>("PacsVirtualPath:RealPath");
@ -596,7 +642,7 @@ namespace Shentun.Peis.PacsBusiness
}
/// <summary>
/// 导入pacs dicom数据

2
src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs

@ -986,7 +986,7 @@ namespace Shentun.Peis.PatientRegisters
}
else if (!string.IsNullOrWhiteSpace(input.IdNo))
{
patientRegisterList = query.Where(m => m.Patient.IdNo == input.IdNo).OrderByDescending(o => o.MedicalTimes).ToList();
patientRegisterList = query.Where(m => m.Patient.IdNo == input.IdNo).OrderByDescending(o => o.CreationTime).ToList();
if (patientRegisterList.Count == 0)
{
throw new UserFriendlyException("未找到人员信息");

4
src/Shentun.Peis.DbMigrator/appsettings.json

@ -3,8 +3,8 @@
//"Default": "Host=140.143.162.39;Port=5432;Database=ShentunPeis240701;User ID=postgres;Password=shentun123;"
//"Default": "Host=192.168.2.67;Port=5432;Database=ShentunPeis;User ID=postgres;Password=st123;"
//"Default": "Host=localhost;Port=5432;Database=ShentunPeis1218;User ID=postgres;Password=wxd123;"
//"Default": "Host=10.1.12.140;Port=5432;Database=ShentunPeis0508;User ID=postgres;Password=st123;"
"Default": "Host=192.168.0.188;Port=5432;Database=ShentunPeis;User ID=postgres;Password=St123456;"
"Default": "Host=10.1.12.140;Port=5432;Database=ShentunPeis0508;User ID=postgres;Password=st123;"
//"Default": "Host=192.168.0.188;Port=5432;Database=ShentunPeis;User ID=postgres;Password=St123456;"
},
"OpenIddict": {
"Applications": {

44
src/Shentun.Peis.Domain/IDuplicateRequestService.cs

@ -0,0 +1,44 @@
using Microsoft.Extensions.Caching.Distributed;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
namespace Shentun.Peis
{
public interface IDuplicateRequestService
{
Task<bool> IsDuplicateAsync(string key, TimeSpan expiration);
}
public class DuplicateRequestService : IDuplicateRequestService, ITransientDependency
{
private readonly IDistributedCache<string> _cache;
public DuplicateRequestService(IDistributedCache<string> cache)
{
_cache = cache;
}
public async Task<bool> IsDuplicateAsync(string key, TimeSpan expiration)
{
var cacheKey = $"DuplicateRequest:{key}";
var existing = await _cache.GetAsync(cacheKey);
if (existing != null)
{
return true;
}
await _cache.SetAsync(cacheKey, DateTime.UtcNow.ToString(), new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = expiration
});
return false;
}
}
}

2
src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs

@ -399,8 +399,6 @@ namespace Shentun.Peis.RegisterChecks
/// <summary>
/// 生成检查单号(规则,先找体检中心的配置,如未找到,就直接使用全局的)
/// 模式(0 日期+尾号 1.顺序递增)

1
src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs

@ -88,7 +88,6 @@ namespace Shentun.Peis;
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule),
typeof(AbpBackgroundWorkersHangfireModule)
)]
public class PeisHttpApiHostModule : AbpModule
{

2
src/Shentun.Peis.HttpApi.Host/appsettings.json

@ -63,7 +63,7 @@
"IsEnabled": true,
"IsEnabledDashboard": true,
"ConnectionStrings": "192.168.0.188:6379,password=shentun123",
"Db": 4
"Db": 6
},
"Pacs": {
"AuthString": "peis:peis@123",

Loading…
Cancel
Save