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
continuous-integration/drone/push Build is running
Details
commit
e40a9fe9cb
|
|
@ -15473,11 +15473,11 @@
|
|||
<param name="addOrEditSegmentation"></param>
|
||||
<returns></returns>
|
||||
</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>
|
||||
<param name="segmentationId"></param>
|
||||
<param name="inDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.GetSegmentationVersionList(IRaCIS.Core.Application.ViewModel.SegmentationVersionQuery)">
|
||||
|
|
|
|||
|
|
@ -2716,6 +2716,19 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|||
sv.ReviewAuditUserId = null;
|
||||
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)
|
||||
{
|
||||
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 });
|
||||
|
|
|
|||
|
|
@ -96,6 +96,11 @@ public class SegmentationVersionView
|
|||
public string CreateUserName { get; set; }
|
||||
}
|
||||
|
||||
public class SaveSegmentationVersionAsyncInDto
|
||||
{
|
||||
public Guid SegmentationId { get; set; }
|
||||
}
|
||||
|
||||
public class SegmentationVersionQuery : PageInput
|
||||
{
|
||||
public Guid SegmentationId { get; set; }
|
||||
|
|
|
|||
|
|
@ -4,15 +4,17 @@
|
|||
// 生成时间 2026-03-10 06:17:28Z
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.MassTransit.Command;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using System.Threading.Tasks;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
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.Extensions.Logging;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service;
|
||||
|
||||
|
|
@ -73,12 +75,11 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
|
|||
public async Task<IResponseOutput> AddOrUpdateSegmentation(SegmentationAddOrEdit addOrEditSegmentation)
|
||||
{
|
||||
|
||||
|
||||
if (addOrEditSegmentation.Id != null)
|
||||
{
|
||||
await SaveSegmentationVersionAsync(addOrEditSegmentation.Id.Value);
|
||||
}
|
||||
|
||||
await SaveSegmentationVersionAsync(new SaveSegmentationVersionAsyncInDto() { SegmentationId = addOrEditSegmentation.Id.Value });
|
||||
}
|
||||
var entity = await _segmentationRepository.InsertOrUpdateAsync(addOrEditSegmentation, true);
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
}
|
||||
|
|
@ -86,11 +87,12 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
|
|||
/// <summary>
|
||||
/// 添加新版本
|
||||
/// </summary>
|
||||
/// <param name="segmentationId"></param>
|
||||
/// <param name="inDto"></param>
|
||||
/// <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)
|
||||
{
|
||||
|
|
@ -102,6 +104,7 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
|
|||
.FirstOrDefaultAsync();
|
||||
|
||||
var newVersion = maxVersion + 1;
|
||||
|
||||
var versionEntity = new SegmentationVersion
|
||||
{
|
||||
SegmentationId = data.Id,
|
||||
|
|
@ -109,6 +112,7 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
|
|||
SegmentationJson = data.SegmentationJson,
|
||||
SEGUrl = data.SEGUrl,
|
||||
FileSize = data.FileSize,
|
||||
SegmentList= segmentList,
|
||||
};
|
||||
|
||||
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 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
|
||||
{
|
||||
SegmentationJson = version.SegmentationJson,
|
||||
SEGUrl = version.SEGUrl,
|
||||
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 DeleteBindingsAndAnswersAsync(inDto.SegmentationId, null);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
// 在此处拷贝automapper 映射
|
||||
|
||||
CreateMap<Segment, SegmentVersionData>();
|
||||
CreateMap<SegmentVersionData, Segment>();
|
||||
|
||||
CreateMap<Segment, SegmentView>();
|
||||
CreateMap<Segment, SegmentAddOrEdit>().ReverseMap();
|
||||
|
||||
|
|
|
|||
|
|
@ -476,7 +476,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
QuestionMark.FourthMeasurement,
|
||||
};
|
||||
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);
|
||||
avgAnswer = decimal.Round(avgAnswernum, inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString());
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
[Comment("分割")]
|
||||
[Table("Segment")]
|
||||
public class Segment : BaseFullDeleteAuditEntity
|
||||
public class Segment : BaseFullDeleteAuditEntity, ISegment
|
||||
{
|
||||
#region 导航属性
|
||||
[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; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,106 @@ public class SegmentationVersion : BaseAddAuditEntity
|
|||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 配置 暂时屏蔽
|
||||
//if (base.Database.IsNpgsql())
|
||||
//{
|
||||
|
|
|
|||
22221
IRaCIS.Core.Infra.EFCore/Migrations/20260507063845_segmentList.Designer.cs
generated
Normal file
22221
IRaCIS.Core.Infra.EFCore/Migrations/20260507063845_segmentList.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9571,6 +9571,10 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SegmentList")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<Guid>("SegmentationId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue