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
continuous-integration/drone/push Build is running
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user