Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
fe34788cff
|
|
@ -1,4 +1,5 @@
|
||||||
using IRaCIS.Core.API;
|
using FellowOakDicom;
|
||||||
|
using IRaCIS.Core.API;
|
||||||
using IRaCIS.Core.API.HostService;
|
using IRaCIS.Core.API.HostService;
|
||||||
using IRaCIS.Core.Application.BusinessFilter;
|
using IRaCIS.Core.Application.BusinessFilter;
|
||||||
using IRaCIS.Core.Application.BusinessFilter.LegacyController.Database.Api;
|
using IRaCIS.Core.Application.BusinessFilter.LegacyController.Database.Api;
|
||||||
|
|
@ -178,6 +179,7 @@ var env = app.Environment;
|
||||||
|
|
||||||
#region 配置中间件
|
#region 配置中间件
|
||||||
|
|
||||||
|
DicomSetupBuilder.UseServiceProvider(app.Services);
|
||||||
|
|
||||||
app.UseMiddleware<EncryptionRequestMiddleware>();
|
app.UseMiddleware<EncryptionRequestMiddleware>();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,21 @@ namespace IRaCIS.Core.API
|
||||||
{
|
{
|
||||||
public static void AddDicomSetup(this IServiceCollection services)
|
public static void AddDicomSetup(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// ⭐ 先做全局 DICOM 配置
|
||||||
new DicomSetupBuilder()
|
new DicomSetupBuilder()
|
||||||
.RegisterServices(s => s.AddFellowOakDicom()
|
.SkipValidation() // 👈 在这里设置
|
||||||
.AddTranscoderManager<FellowOakDicom.Imaging.NativeCodec.NativeTranscoderManager>()
|
.Build();
|
||||||
.AddImageManager<ImageSharpImageManager>()
|
|
||||||
)
|
services.AddFellowOakDicom().AddTranscoderManager<FellowOakDicom.Imaging.NativeCodec.NativeTranscoderManager>().AddImageManager<ImageSharpImageManager>();
|
||||||
.SkipValidation()
|
|
||||||
.Build();
|
// new DicomSetupBuilder()
|
||||||
|
// .RegisterServices(s => s.AddFellowOakDicom()
|
||||||
|
//.AddTranscoderManager<FellowOakDicom.Imaging.NativeCodec.NativeTranscoderManager>()
|
||||||
|
// .AddImageManager<ImageSharpImageManager>()
|
||||||
|
// )
|
||||||
|
// .SkipValidation()
|
||||||
|
// .Build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,13 +163,14 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
//默认会是0
|
//默认会是0
|
||||||
var code = await _noneDicomStudyRepository.Where(t => t.TrialId == addOrEditNoneDicomStudy.TrialId,ignoreQueryFilters:true).Select(x => x.Code).DefaultIfEmpty().MaxAsync();
|
var code = await _trialRepository.Where(t => t.Id == addOrEditNoneDicomStudy.TrialId, ignoreQueryFilters: true).Select(x => x.MaxNoneDicomCode).DefaultIfEmpty().MaxAsync();
|
||||||
|
|
||||||
|
|
||||||
optEntity = await _noneDicomStudyRepository.InsertFromDTOAsync(addOrEditNoneDicomStudy);
|
optEntity = await _noneDicomStudyRepository.InsertFromDTOAsync(addOrEditNoneDicomStudy);
|
||||||
|
|
||||||
optEntity.Code = code + 1;
|
optEntity.Code = code + 1;
|
||||||
|
|
||||||
|
await _trialRepository.BatchUpdateNoTrackingAsync(t => t.Id == addOrEditNoneDicomStudy.TrialId, u => new Trial() { MaxNoneDicomCode = optEntity.Code });
|
||||||
|
|
||||||
optEntity.StudyCode = AppSettings.GetCodeStr(optEntity.Code, nameof(NoneDicomStudy));
|
optEntity.StudyCode = AppSettings.GetCodeStr(optEntity.Code, nameof(NoneDicomStudy));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -396,7 +396,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
using (await @lock.AcquireAsync())
|
using (await @lock.AcquireAsync())
|
||||||
{
|
{
|
||||||
//查询数据库获取最大的Code 没有记录则为0
|
//查询数据库获取最大的Code 没有记录则为0
|
||||||
var dbStudyCodeIntMax = _dicomStudyRepository.Where(s => s.TrialId == trialId, ignoreQueryFilters: true).Select(t => t.Code).DefaultIfEmpty().Max();
|
var dbStudyCodeIntMax = _trialRepository.Where(s => s.Id == trialId, ignoreQueryFilters: true).Select(t => t.MaxDicomCode).DefaultIfEmpty().Max();
|
||||||
|
|
||||||
//获取缓存中的值 并发的时候,需要记录,已被占用的值 这样其他线程在此占用的最大的值上递增
|
//获取缓存中的值 并发的时候,需要记录,已被占用的值 这样其他线程在此占用的最大的值上递增
|
||||||
var cacheMaxCodeInt = await _fusionCache.GetOrDefaultAsync<int>(CacheKeys.TrialStudyMaxCode(trialId));
|
var cacheMaxCodeInt = await _fusionCache.GetOrDefaultAsync<int>(CacheKeys.TrialStudyMaxCode(trialId));
|
||||||
|
|
@ -405,6 +405,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
|
|
||||||
addStudy.Code = currentNextCodeInt;
|
addStudy.Code = currentNextCodeInt;
|
||||||
|
|
||||||
|
await _trialRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialId, u => new Trial() { MaxDicomCode = addStudy.Code });
|
||||||
|
|
||||||
addStudy.StudyCode = AppSettings.GetCodeStr(currentNextCodeInt, nameof(DicomStudy));
|
addStudy.StudyCode = AppSettings.GetCodeStr(currentNextCodeInt, nameof(DicomStudy));
|
||||||
|
|
||||||
await _fusionCache.SetAsync<int>(CacheKeys.TrialStudyMaxCode(trialId), addStudy.Code, TimeSpan.FromMinutes(30));
|
await _fusionCache.SetAsync<int>(CacheKeys.TrialStudyMaxCode(trialId), addStudy.Code, TimeSpan.FromMinutes(30));
|
||||||
|
|
|
||||||
|
|
@ -318,6 +318,12 @@ public partial class Trial : BaseFullDeleteAuditEntity
|
||||||
|
|
||||||
public TrialDataStore TrialDataStoreType { get; set; }
|
public TrialDataStore TrialDataStoreType { get; set; }
|
||||||
|
|
||||||
|
[Comment("最大的Dicom检查编号 整型")]
|
||||||
|
public int MaxDicomCode { get; set; }
|
||||||
|
|
||||||
|
[Comment("最大的NoneDicom检查编号 整型")]
|
||||||
|
public int MaxNoneDicomCode { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TrialDataStore
|
public enum TrialDataStore
|
||||||
|
|
|
||||||
22153
IRaCIS.Core.Infra.EFCore/Migrations/20260506055909_AddTrialMaxCode.Designer.cs
generated
Normal file
22153
IRaCIS.Core.Infra.EFCore/Migrations/20260506055909_AddTrialMaxCode.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,54 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddTrialMaxCode : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "MaxDicomCode",
|
||||||
|
table: "Trial",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0,
|
||||||
|
comment: "最大的Dicom检查编号 整型");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "MaxNoneDicomCode",
|
||||||
|
table: "Trial",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0,
|
||||||
|
comment: "最大的NoneDicom检查编号 整型");
|
||||||
|
|
||||||
|
//migrationBuilder.AddForeignKey(
|
||||||
|
// name: "FK_Segmentation_VisitTask_VisitTaskId",
|
||||||
|
// table: "Segmentation",
|
||||||
|
// column: "VisitTaskId",
|
||||||
|
// principalTable: "VisitTask",
|
||||||
|
// principalColumn: "Id",
|
||||||
|
// onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Segmentation_VisitTask_VisitTaskId",
|
||||||
|
table: "Segmentation");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "MaxDicomCode",
|
||||||
|
table: "Trial");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "MaxNoneDicomCode",
|
||||||
|
table: "Trial");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12689,6 +12689,14 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
.HasColumnType("nvarchar(400)")
|
.HasColumnType("nvarchar(400)")
|
||||||
.HasComment("主研单位");
|
.HasComment("主研单位");
|
||||||
|
|
||||||
|
b.Property<int>("MaxDicomCode")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("最大的Dicom检查编号 整型");
|
||||||
|
|
||||||
|
b.Property<int>("MaxNoneDicomCode")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("最大的NoneDicom检查编号 整型");
|
||||||
|
|
||||||
b.Property<string>("MessageFromClient")
|
b.Property<string>("MessageFromClient")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(400)
|
.HasMaxLength(400)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue