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

This commit is contained in:
2025-06-06 11:12:51 +08:00
15 changed files with 20045 additions and 9 deletions
@@ -370,6 +370,52 @@ namespace IRaCIS.Core.Application.Contracts
public List<Guid> Ids { get; set; }
}
public class TrialDocumentAttachmentView : TrialDocumentAttachmentAddOrEdit
{
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
}
public class TrialDocumentAttachmentAddOrEdit
{
public Guid? Id { get; set; }
public string FileFormat { get; set; }
public string FileName { get; set; }
public string FilePath { get; set; }
public decimal? FileSize { get; set; }
public string Name { get; set; }
public bool OffLine { get; set; }
public Guid TrialDocumentId { get; set; }
}
public class TrialDocumentAttachmentQuery : PageInput
{
public string? FileFormat { get; set; }
public string? FileName { get; set; }
public string? FilePath { get; set; }
public decimal? FileSize { get; set; }
public string? Name { get; set; }
public bool? OffLine { get; set; }
public Guid? TrialDocumentId { get; set; }
}
public class AddOrEditSystemDocument : SystemDocumentAddOrEdit
{
@@ -13,6 +13,7 @@ namespace IRaCIS.Core.Application.Contracts
{
public string FullFilePath { get; set; } = String.Empty;
public int AttachmentCount { get; set; }
public bool IsSomeUserSigned { get; set; }
public DateTime CreateTime { get; set; }
@@ -26,6 +26,7 @@ namespace IRaCIS.Core.Application.Services
[ApiExplorerSettings(GroupName = "Trial")]
public class TrialDocumentService(IRepository<TrialDocument> _trialDocumentRepository,
IRepository<Trial> _trialRepository,
IRepository<TrialDocumentAttachment> _trialDocumentAttachmentRepository,
ISystemDocumentService _systemDocumentService,
IRepository<SystemDocConfirmedIdentityUser> _systemDocConfirmedUserRepository,
IRepository<SystemDocNeedConfirmedUserType> _systemDocNeedConfirmedUserTypeRepository,
@@ -39,6 +40,55 @@ namespace IRaCIS.Core.Application.Services
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialDocumentService
{
/// <summary>
/// 获取项目文档附件列表
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<PageOutput<TrialDocumentAttachmentView>> GetTrialDocumentAttachmentList(TrialDocumentAttachmentQuery inQuery)
{
var trialDocumentAttachmentQueryable = _trialDocumentAttachmentRepository
.WhereIf(inQuery.TrialDocumentId!=null,x=>x.TrialDocumentId==inQuery.TrialDocumentId)
.WhereIf(inQuery.Name != null, x => x.Name.Contains(inQuery.Name))
.WhereIf(inQuery.FileFormat != null, x => x.FileFormat == inQuery.FileFormat)
.ProjectTo<TrialDocumentAttachmentView>(_mapper.ConfigurationProvider);
var pageList = await trialDocumentAttachmentQueryable.ToPagedListAsync(inQuery);
return pageList;
}
/// <summary>
/// 添加或更新项目文档附件
/// </summary>
/// <param name="addOrEditTrialDocumentAttachment"></param>
/// <returns></returns>
public async Task<IResponseOutput> AddOrUpdateTrialDocumentAttachment(TrialDocumentAttachmentAddOrEdit addOrEditTrialDocumentAttachment)
{
// 在此处拷贝automapper 映射
var entity = await _trialDocumentAttachmentRepository.InsertOrUpdateAsync(addOrEditTrialDocumentAttachment, true);
return ResponseOutput.Ok(entity.Id.ToString());
}
/// <summary>
/// 删除项目文档附件
/// </summary>
/// <param name="trialDocumentAttachmentId"></param>
/// <returns></returns>
[HttpDelete("{trialDocumentAttachmentId:guid}")]
public async Task<IResponseOutput> DeleteTrialDocumentAttachment(Guid trialDocumentAttachmentId)
{
var success = await _trialDocumentAttachmentRepository.DeleteFromQueryAsync(t => t.Id == trialDocumentAttachmentId, true);
return ResponseOutput.Ok();
}
/// <summary>
/// 发布项目文档
/// </summary>
@@ -448,15 +498,27 @@ namespace IRaCIS.Core.Application.Services
var sysids = result.CurrentPageData.Where(t => t.IsSystemDoc == true).Select(t => t.Id).ToList();
var sysDataList = await _systemDocumentRepository.Where(x => sysids.Contains(x.Id)).Include(x => x.SystemDocumentAttachmentList).ToListAsync();
result.CurrentPageData.ForEach(x =>
{
if (sysDataList.Any(y => y.Id == x.Id))
{
x.AttachmentCount = sysDataList.Where(y => y.Id == x.Id).Select(x => x.SystemDocumentAttachmentList.Where(z => !z.OffLine).Count()).FirstOrDefault();
}
});
var trialids = result.CurrentPageData.Where(t => t.IsSystemDoc == false).Select(t => t.Id).ToList();
var trialDataList = await _trialDocumentRepository.Where(x => trialids.Contains(x.Id)).Include(x => x.TrialDocumentAttachmentList).ToListAsync();
result.CurrentPageData.ForEach(x =>
{
if (trialDataList.Any(y => y.Id == x.Id))
{
x.AttachmentCount = trialDataList.Where(y => y.Id == x.Id).Select(x => x.TrialDocumentAttachmentList.Where(z => !z.OffLine).Count()).FirstOrDefault();
}
});
#endregion
@@ -16,6 +16,8 @@ namespace IRaCIS.Core.Application.Service
var isEn_Us = false;
// 在此处拷贝automapper 映射
CreateMap<TrialDocumentAttachment, TrialDocumentAttachmentView>();
CreateMap<TrialDocumentAttachment, TrialDocumentAttachmentAddOrEdit>().ReverseMap();
CreateMap<SystemDocumentAttachment, SystemDocumentAttachmentView>();
CreateMap<SystemDocumentAttachment, SystemDocumentAttachmentAddOrEdit>().ReverseMap();
@@ -40,6 +42,7 @@ namespace IRaCIS.Core.Application.Service
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
CreateMap<TrialDocument, TrialDocumentView>()
.ForMember(d => d.AttachmentCount, u => u.MapFrom(s =>s.TrialDocumentAttachmentList.Count()))
.ForMember(d => d.FileType, u => u.MapFrom(s => isEn_Us ? s.FileType.Value : s.FileType.ValueCN))
.ForMember(d => d.IsSomeUserSigned, u => u.MapFrom(s => s.TrialDocConfirmedUserList.Any(t => t.ConfirmTime != null)))
.ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path));
@@ -1150,7 +1150,7 @@ namespace IRaCIS.Core.Application.Service
var allfront = await (from data in _frontAuditConfigRepository.AsQueryable()
var allfront = await (from data in _frontAuditConfigRepository.Where(x=>x.IsEnable && x.ConfigType == "M")
join dic in _dictionaryRepository.Where(x => x.Parent.Code == "ModuleType" && x.IsEnable) on data.ModuleTypeId equals dic.Id
join trialshow in _trialAuditShowRepository.Where(x => x.TrialId == inDto.TrialId) on data.Id equals trialshow.FrontAuditConfigId into trialshowtemp
from lefttrialshow in trialshowtemp.DefaultIfEmpty()
@@ -1164,7 +1164,7 @@ namespace IRaCIS.Core.Application.Service
DictionaryValue = _userInfo.IsEn_Us ? dic.Value : dic.ValueCN,
}).ToListAsync();
var result = allfront.Where(x => x.IsShow).ToList();
var result = allfront.Where(x => x.IsShow && x.ParentId!=null).ToList();
FindParent(result, result.Select(x => x.ParentId).ToList());
void FindParent(List<ModuleTypeData> re, List<Guid?> Parentids)
{
@@ -1202,7 +1202,7 @@ namespace IRaCIS.Core.Application.Service
{
var result = from data in _frontAuditConfigRepository.Where(x => x.ModuleTypeId == moduleTypeId && x.ObjectTypeId != null && x.OptTypeId != null && x.Description.Length > 0)
var result = from data in _frontAuditConfigRepository.Where(x =>x.IsEnable && x.ModuleTypeId == moduleTypeId && x.ObjectTypeId != null && x.OptTypeId != null && x.Description.Length > 0)
join trialshow in _trialAuditShowRepository.Where(x => x.TrialId == trialId) on data.Id equals trialshow.FrontAuditConfigId into trialshowtemp
from lefttrialshow in trialshowtemp.DefaultIfEmpty()
select new
@@ -1460,7 +1460,26 @@ namespace IRaCIS.Core.Application.Service
[HttpPost]
public async Task<NeedSynchronize> VerifyeCriterionNeedSynchronize(VerifyeCriterionNeedSynchronizeInDto inDto)
{
var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstOrDefaultAsync();
#region
var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync();
var toolList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).Where(x => x.ImageTool != string.Empty).Select(x => x.ImageTool).ToListAsync();
var tabletoolList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionTrial.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).Where(x => x.ImageTool != string.Empty).Select(x => x.ImageTool).ToListAsync();
toolList.AddRange(tabletoolList);
toolList = toolList.Distinct().ToList();
if (tabletoolList.Except(trialCriterion.ReadingToolList).Count() > 0)
{
//---问题的阅片工具不在标准配置的阅片工具列表中
throw new BusinessValidationFailedException(_localizer["TrialConfig_TableToolNotInStdTool"]);
}
#endregion
if (trialCriterion == null)
{
return NeedSynchronize.NotNeed;
@@ -732,7 +732,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
try
{
List<QuestionMark?> questionMarkList = new List<QuestionMark?>() { QuestionMark.FirstMeasurement, QuestionMark.SecondMeasurement, QuestionMark.ThirdMeasurement };
var measuredValueList = rowInfo.SelectMany(x => x.TableQuestionList).Where(x => questionMarkList.Contains(x.QuestionMark)).Select(x => decimal.Parse(x.Answer)).ToList();
var measuredValueList = rowInfo.SelectMany(x => x.TableQuestionList).Where(x =>x.Answer.IsNotNullOrEmpty()&& questionMarkList.Contains(x.QuestionMark)).Select(x => decimal.Parse(x.Answer)).ToList();
if (measuredValueList.Any(x => x > 100))
{
throw new BusinessValidationFailedException(_localizer["MRIPDFF_MeasurementGT100"]);
@@ -484,7 +484,7 @@ namespace IRaCIS.Core.Application
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<(GetTrialReadingCriterionInfoOutDto, bool)> GetTrialReadingCriterionInfo(GetTrialReadingInfoInDto inDto)
public async Task<(GetTrialReadingCriterionInfoOutDto, object)> GetTrialReadingCriterionInfo(GetTrialReadingInfoInDto inDto)
{
GetTrialReadingCriterionInfoOutDto result = new GetTrialReadingCriterionInfoOutDto();
result.ReadingCriterionPageList = await _readingCriterionPageRepository.Where(x => x.TrialId == inDto.TrialId).ProjectTo<ReadingCriterionPageDto>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
@@ -503,7 +503,9 @@ namespace IRaCIS.Core.Application
&& x.ReadingCriterionPageId == null)
.ProjectTo<TrialReadQuestion>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
return (result, true);
return (result, new {
ReadingVersionEnum= trialCriterion.ReadingVersionEnum
});
}
@@ -553,6 +555,27 @@ namespace IRaCIS.Core.Application
[TrialGlobalLimit("AfterStopCannNotOpt")]
public async Task<IResponseOutput> SetCriterionReadingInfo(SetCriterionReadingInfoInDto inDto)
{
#region
var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync();
var toolList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).Where(x => x.ImageTool != string.Empty).Select(x => x.ImageTool).ToListAsync();
var tabletoolList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionTrial.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).Where(x => x.ImageTool != string.Empty).Select(x => x.ImageTool).ToListAsync();
toolList.AddRange(tabletoolList);
toolList = toolList.Distinct().ToList();
if (tabletoolList.Except(trialCriterion.ReadingToolList).Count() > 0)
{
//---问题的阅片工具不在标准配置的阅片工具列表中
throw new BusinessValidationFailedException(_localizer["TrialConfig_TableToolNotInStdTool"]);
}
#endregion
ArbitrationRule arbitration = ArbitrationRule.NA;
if (inDto.IsArbitrationReading)