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 running Details

Uat_IRC_Net8
hang 2026-05-08 17:04:02 +08:00
commit e40a9fe9cb
12 changed files with 22506 additions and 15 deletions

View File

@ -15473,11 +15473,11 @@
<param name="addOrEditSegmentation"></param> <param name="addOrEditSegmentation"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.SaveSegmentationVersionAsync(System.Guid)"> <member name="M:IRaCIS.Core.Application.Service.SegmentationService.SaveSegmentationVersionAsync(IRaCIS.Core.Application.ViewModel.SaveSegmentationVersionAsyncInDto)">
<summary> <summary>
添加新版本 添加新版本
</summary> </summary>
<param name="segmentationId"></param> <param name="inDto"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.GetSegmentationVersionList(IRaCIS.Core.Application.ViewModel.SegmentationVersionQuery)"> <member name="M:IRaCIS.Core.Application.Service.SegmentationService.GetSegmentationVersionList(IRaCIS.Core.Application.ViewModel.SegmentationVersionQuery)">

View File

@ -2716,6 +2716,19 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
sv.ReviewAuditUserId = null; sv.ReviewAuditUserId = null;
sv.SecondReviewState = SecondReviewState.None; sv.SecondReviewState = SecondReviewState.None;
// 处理阅片期的临床数据
var readModuleIdList =await _readModuleRepository.Where(x => x.SubjectVisitId == sv.Id).Select(x => x.Id).ToListAsync();
await _readingClinicalDataReposiotry.UpdatePartialFromQueryAsync(t => readModuleIdList.Contains(t.ReadingId), c => new ReadingClinicalData()
{
IsSign = false,
ReadingClinicalDataState = ReadingClinicalDataStatus.HaveUploaded,
});
if (sv.IsBaseLine) if (sv.IsBaseLine)
{ {
await _readingClinicalDataReposiotry.UpdatePartialFromQueryAsync(t => t.ReadingId == sv.Id && (t.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.Subject || t.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.SubjectVisit), c => new ReadingClinicalData() { IsSign = false, ReadingClinicalDataState = ReadingClinicalDataStatus.HaveUploaded }); await _readingClinicalDataReposiotry.UpdatePartialFromQueryAsync(t => t.ReadingId == sv.Id && (t.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.Subject || t.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.SubjectVisit), c => new ReadingClinicalData() { IsSign = false, ReadingClinicalDataState = ReadingClinicalDataStatus.HaveUploaded });

View File

@ -96,6 +96,11 @@ public class SegmentationVersionView
public string CreateUserName { get; set; } public string CreateUserName { get; set; }
} }
public class SaveSegmentationVersionAsyncInDto
{
public Guid SegmentationId { get; set; }
}
public class SegmentationVersionQuery : PageInput public class SegmentationVersionQuery : PageInput
{ {
public Guid SegmentationId { get; set; } public Guid SegmentationId { get; set; }

View File

@ -4,15 +4,17 @@
// 生成时间 2026-03-10 06:17:28Z // 生成时间 2026-03-10 06:17:28Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Models;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.MassTransit.Command;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Infrastructure.Extention; using IRaCIS.Core.Domain.Models;
using System.Threading.Tasks;
using IRaCIS.Core.Infra.EFCore; using IRaCIS.Core.Infra.EFCore;
using Microsoft.Extensions.Logging; using IRaCIS.Core.Infrastructure.Extention;
using MassTransit;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service; namespace IRaCIS.Core.Application.Service;
@ -73,12 +75,11 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
public async Task<IResponseOutput> AddOrUpdateSegmentation(SegmentationAddOrEdit addOrEditSegmentation) public async Task<IResponseOutput> AddOrUpdateSegmentation(SegmentationAddOrEdit addOrEditSegmentation)
{ {
if (addOrEditSegmentation.Id != null) if (addOrEditSegmentation.Id != null)
{ {
await SaveSegmentationVersionAsync(addOrEditSegmentation.Id.Value);
}
await SaveSegmentationVersionAsync(new SaveSegmentationVersionAsyncInDto() { SegmentationId = addOrEditSegmentation.Id.Value });
}
var entity = await _segmentationRepository.InsertOrUpdateAsync(addOrEditSegmentation, true); var entity = await _segmentationRepository.InsertOrUpdateAsync(addOrEditSegmentation, true);
return ResponseOutput.Ok(entity.Id.ToString()); return ResponseOutput.Ok(entity.Id.ToString());
} }
@ -86,11 +87,12 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
/// <summary> /// <summary>
/// 添加新版本 /// 添加新版本
/// </summary> /// </summary>
/// <param name="segmentationId"></param> /// <param name="inDto"></param>
/// <returns></returns> /// <returns></returns>
private async Task SaveSegmentationVersionAsync(Guid segmentationId) private async Task SaveSegmentationVersionAsync(SaveSegmentationVersionAsyncInDto inDto)
{ {
var data = await _segmentationRepository.FirstOrDefaultNoTrackingAsync(x => x.Id == segmentationId); var data = await _segmentationRepository.FirstOrDefaultNoTrackingAsync(x => x.Id == inDto.SegmentationId);
var segmentList = await _segmentRepository.Where(x => x.SegmentationId == inDto.SegmentationId).OrderBy(x=>x.SegmentNumber).ProjectTo<SegmentVersionData>(_mapper.ConfigurationProvider).ToListAsync();
if (data.SEGUrl != string.Empty) if (data.SEGUrl != string.Empty)
{ {
@ -102,6 +104,7 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
var newVersion = maxVersion + 1; var newVersion = maxVersion + 1;
var versionEntity = new SegmentationVersion var versionEntity = new SegmentationVersion
{ {
SegmentationId = data.Id, SegmentationId = data.Id,
@ -109,6 +112,7 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
SegmentationJson = data.SegmentationJson, SegmentationJson = data.SegmentationJson,
SEGUrl = data.SEGUrl, SEGUrl = data.SEGUrl,
FileSize = data.FileSize, FileSize = data.FileSize,
SegmentList= segmentList,
}; };
await _segmentationVersionRepository.AddAsync(versionEntity); await _segmentationVersionRepository.AddAsync(versionEntity);
@ -146,14 +150,23 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
{ {
var version = await _segmentationVersionRepository.Where(x => x.Id == inDto.VersionId && x.SegmentationId == inDto.SegmentationId).FirstNotNullAsync(); var version = await _segmentationVersionRepository.Where(x => x.Id == inDto.VersionId && x.SegmentationId == inDto.SegmentationId).FirstNotNullAsync();
var segmentation = await _segmentationRepository.Where(x => x.Id == inDto.SegmentationId).FirstNotNullAsync(); var segmentation = await _segmentationRepository.Where(x => x.Id == inDto.SegmentationId).FirstNotNullAsync();
await SaveSegmentationVersionAsync(new SaveSegmentationVersionAsyncInDto() { SegmentationId=inDto.SegmentationId});
await _segmentationRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.SegmentationId, t => new Segmentation await _segmentationRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.SegmentationId, t => new Segmentation
{ {
SegmentationJson = version.SegmentationJson, SegmentationJson = version.SegmentationJson,
SEGUrl = version.SEGUrl, SEGUrl = version.SEGUrl,
FileSize = version.FileSize, FileSize = version.FileSize,
}); });
var segmentList = _mapper.Map<List<Segment>>(version.SegmentList);
await _segmentRepository.BatchDeleteNoTrackingAsync(x => x.SegmentationId == inDto.SegmentationId);
await _segmentRepository.AddRangeAsync(segmentList);
await _segmentationRepository.SaveChangesAsync(); await _segmentationRepository.SaveChangesAsync();
await DeleteBindingsAndAnswersAsync(inDto.SegmentationId, null);
return ResponseOutput.Ok(); return ResponseOutput.Ok();
} }

View File

@ -17,6 +17,9 @@ namespace IRaCIS.Core.Application.Service
// 在此处拷贝automapper 映射 // 在此处拷贝automapper 映射
CreateMap<Segment, SegmentVersionData>();
CreateMap<SegmentVersionData, Segment>();
CreateMap<Segment, SegmentView>(); CreateMap<Segment, SegmentView>();
CreateMap<Segment, SegmentAddOrEdit>().ReverseMap(); CreateMap<Segment, SegmentAddOrEdit>().ReverseMap();

View File

@ -476,7 +476,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
QuestionMark.FourthMeasurement, QuestionMark.FourthMeasurement,
}; };
var answers = item.TableQuestionList.Where(x => questionMarks.Contains(x.QuestionMark)).Select(x=>x.Answer).ToList(); var answers = item.TableQuestionList.Where(x => questionMarks.Contains(x.QuestionMark)).Select(x=>x.Answer).ToList();
if (answers.Count() == 3 && !answers.Any(x => x.IsNullOrEmpty())) if (answers.Count() == 4 && !answers.Any(x => x.IsNullOrEmpty()))
{ {
var avgAnswernum= answers.Select(x=>x.IsNullOrEmptyReturn0()).Average(x=>x); var avgAnswernum= answers.Select(x=>x.IsNullOrEmptyReturn0()).Average(x=>x);
avgAnswer = decimal.Round(avgAnswernum, inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString()); avgAnswer = decimal.Round(avgAnswernum, inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString());

View File

@ -11,7 +11,7 @@ namespace IRaCIS.Core.Domain.Models
[Comment("分割")] [Comment("分割")]
[Table("Segment")] [Table("Segment")]
public class Segment : BaseFullDeleteAuditEntity public class Segment : BaseFullDeleteAuditEntity, ISegment
{ {
#region 导航属性 #region 导航属性
[JsonIgnore] [JsonIgnore]
@ -114,4 +114,99 @@ namespace IRaCIS.Core.Domain.Models
} }
/// <summary>
/// 继承这个接口 因为版本里面需要复制这个表的数据
/// </summary>
public interface ISegment
{
/// <summary>
/// 分割Id
/// </summary>
Guid SegmentationId { get; set; }
/// <summary>
/// 任务Id
/// </summary>
Guid VisitTaskId { get; set; }
/// <summary>
/// 分割的序号
/// </summary>
public int SegmentNumber { get; set; }
/// <summary>
/// 分割的Json
/// </summary>
string SegmentJson { get; set; }
/// <summary>
/// SegmentName
/// </summary>
string SegmentName { get; set; }
/// <summary>
/// 颜色
/// </summary>
string ColorRgb { get; set; }
/// <summary>
/// 均值
/// </summary>
decimal? AvgValue { get; set; }
/// <summary>
/// 最大值
/// </summary>
decimal? MaxValue { get; set; }
/// <summary>
/// 最小值
/// </summary>
decimal? MinValue { get; set; }
/// <summary>
/// 方差
/// </summary>
decimal? Variance { get; set; }
/// <summary>
/// 中位数
/// </summary>
decimal? Median { get; set; }
/// <summary>
/// 体积
/// </summary>
decimal? Volume { get; set; }
/// <summary>
/// 长径
/// </summary>
decimal? MajorAxis { get; set; }
/// <summary>
/// 短径
/// </summary>
decimal? ShortAxis { get; set; }
/// <summary>
/// Peak
/// </summary>
decimal? Peak { get; set; }
/// <summary>
/// TLG
/// </summary>
decimal? TLG { get; set; }
/// <summary>
/// MTV
/// </summary>
decimal? MTV { get; set; }
/// <summary>
/// 是否锁定
/// </summary>
bool IsLock { get; set; }
}
} }

View File

@ -39,6 +39,106 @@ public class SegmentationVersion : BaseAddAuditEntity
/// </summary> /// </summary>
public long FileSize { get; set; } = 0; public long FileSize { get; set; } = 0;
/// <summary>
/// SgenmentList
/// </summary>
[MaxLength]
public List<SegmentVersionData> SegmentList { get; set; } = new List<SegmentVersionData>();
} }
public class SegmentVersionData: ISegment
{
/// <summary>
/// 分割Id
/// </summary>
public Guid SegmentationId { get; set; }
/// <summary>
/// 任务Id
/// </summary>
public Guid VisitTaskId { get; set; }
/// <summary>
/// 分割的序号
/// </summary>
public int SegmentNumber { get; set; }
/// <summary>
/// 分割的Json
/// </summary>
[MaxLength]
public string SegmentJson { get; set; } = string.Empty;
/// <summary>
/// SegmentName
/// </summary>
public string SegmentName { get; set; } = string.Empty;
/// <summary>
/// 颜色
/// </summary>
public string ColorRgb { get; set; } = string.Empty;
/// <summary>
/// 均值
/// </summary>
public decimal? AvgValue { get; set; }
/// <summary>
/// 最大值
/// </summary>
public decimal? MaxValue { get; set; }
/// <summary>
/// 最小值
/// </summary>
public decimal? MinValue { get; set; }
/// <summary>
/// 方差
/// </summary>
public decimal? Variance { get; set; }
/// <summary>
/// 中位数
/// </summary>
public decimal? Median { get; set; }
/// <summary>
/// 体积
/// </summary>
public decimal? Volume { get; set; }
/// <summary>
/// 长径
/// </summary>
public decimal? MajorAxis { get; set; }
/// <summary>
/// 短径
/// </summary>
public decimal? ShortAxis { get; set; }
/// <summary>
/// Peak
/// </summary>
public decimal? Peak { get; set; }
/// <summary>
/// TLG
/// </summary>
public decimal? TLG { get; set; }
/// <summary>
/// MTV
/// </summary>
public decimal? MTV { get; set; }
/// <summary>
/// 是否锁定
/// </summary>
public bool IsLock { get; set; } = false;
}

View File

@ -111,6 +111,14 @@ public class IRaCISDBContext : DbContext
); );
}); });
modelBuilder.Entity<SegmentationVersion>(entity =>
{
entity.Property(e => e.SegmentList).HasConversion(
v => v == null ? null : JsonConvert.SerializeObject(v),
v => string.IsNullOrEmpty(v) ? new List<SegmentVersionData>() {} : JsonConvert.DeserializeObject<List<SegmentVersionData>>(v)
);
});
#region pgsql codefirst 配置 暂时屏蔽 #region pgsql codefirst 配置 暂时屏蔽
//if (base.Database.IsNpgsql()) //if (base.Database.IsNpgsql())
//{ //{

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class segmentList : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "SegmentList",
table: "SegmentationVersion",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SegmentList",
table: "SegmentationVersion");
}
}
}

View File

@ -9571,6 +9571,10 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("SegmentList")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<Guid>("SegmentationId") b.Property<Guid>("SegmentationId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");