代码修改

This commit is contained in:
he
2023-04-24 11:27:50 +08:00
parent eac6fe52a6
commit 62a1200cf3
12 changed files with 152 additions and 87 deletions
@@ -22,8 +22,10 @@ namespace IRaCIS.Application.Services
private readonly IRepository<Trial> _trialRepository;
private readonly IRepository<SystemCriterionDictionaryCode> _systemCriterionDictionaryCodeRepository;
private readonly IRepository<TrialCriterionDictionaryCode> _trialCriterionDictionaryCodeRepository;
private readonly IRepository<ReadingCriterionDictionary> _readingCriterionDictionaryRepository;
private readonly IRepository<ReadingQuestionCriterionSystem> _readingQuestionCriterionSystem;
private readonly IRepository<ReadingTrialCriterionDictionary> _readingTrialCriterionDictionaryRepository;
private readonly IRepository<ReadingCriterionDictionary> _readingCriterionDictionaryRepository;
private readonly IRepository<ReadingQuestionCriterionSystem> _readingQuestionCriterionSystem;
private readonly IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrial;
private readonly IReadingQuestionService _readingQuestionService;
@@ -32,7 +34,8 @@ namespace IRaCIS.Application.Services
IRepository<SystemCriterionDictionaryCode> systemCriterionDictionaryCodeRepository,
IRepository<TrialCriterionDictionaryCode> trialCriterionDictionaryCodeRepository,
IRepository<ReadingCriterionDictionary> readingCriterionDictionaryRepository,
IRepository<ReadingTrialCriterionDictionary> readingTrialCriterionDictionaryRepository,
IRepository<ReadingCriterionDictionary> readingCriterionDictionaryRepository,
IRepository<ReadingQuestionCriterionSystem> readingQuestionCriterionSystem,
IRepository<ReadingQuestionCriterionTrial> readingQuestionCriterionTrial,
IReadingQuestionService readingQuestionService
@@ -47,7 +50,8 @@ namespace IRaCIS.Application.Services
_trialRepository = trialRepository;
this._systemCriterionDictionaryCodeRepository = systemCriterionDictionaryCodeRepository;
this._trialCriterionDictionaryCodeRepository = trialCriterionDictionaryCodeRepository;
this._readingCriterionDictionaryRepository = readingCriterionDictionaryRepository;
this._readingTrialCriterionDictionaryRepository = readingTrialCriterionDictionaryRepository;
this._readingCriterionDictionaryRepository = readingCriterionDictionaryRepository;
this._readingQuestionCriterionSystem = readingQuestionCriterionSystem;
this._readingQuestionCriterionTrial = readingQuestionCriterionTrial;
this._readingQuestionService = readingQuestionService;
@@ -179,7 +183,14 @@ namespace IRaCIS.Application.Services
//return ResponseOutput.NotOk(_localizer["Dictionary_DictionaryDeletion"]);
}
if (await _dicRepository.AnyAsync(t => t.ParentId == id))
if (await _readingTrialCriterionDictionaryRepository.AnyAsync(x => x.DictionaryId == id))
{
await _readingTrialCriterionDictionaryRepository.BatchDeleteNoTrackingAsync(t => t.DictionaryId == id);
//---当前字典在标准中被引用,不允许删除!
//return ResponseOutput.NotOk(_localizer["Dictionary_DictionaryDeletion"]);
}
if (await _dicRepository.AnyAsync(t => t.ParentId == id))
{
//---有子项数据,不允许直接删除!
return ResponseOutput.NotOk(_localizer["Dictionary_SubitemDeletion"]);
@@ -201,12 +212,6 @@ namespace IRaCIS.Application.Services
return ResponseOutput.NotOk(_localizer["Dictionary_ProjectReference"]);
}
if (await _readingCriterionDictionaryRepository.AnyAsync(x => x.DictionaryId == id))
{
await _readingCriterionDictionaryRepository.BatchDeleteNoTrackingAsync(t => t.DictionaryId == id);
//---当前条目已经在阅片标准中被引用。
//return ResponseOutput.NotOk(_localizer["Dictionary_StandardReference"]);
}
var success = await _dicRepository.BatchDeleteNoTrackingAsync(t => t.Id == id);
return ResponseOutput.Result(success);
@@ -293,7 +298,7 @@ namespace IRaCIS.Application.Services
{
var criterionCodes = await _trialCriterionDictionaryCodeRepository.Where(x => x.TrialCriterionId == inDto.TrialCriterionId).ToListAsync();
var parentCodes = await _readingCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.TrialCriterionId).Select(x => x.ParentCode).ToListAsync();
var parentCodes = await _readingTrialCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.TrialCriterionId).Select(x => x.ParentCode).ToListAsync();
var codes = criterionCodes.Select(x => x.Code).ToList();
@@ -337,16 +342,49 @@ namespace IRaCIS.Application.Services
else
{
List<string> selectCode = new List<string>();
List<BasicDicSelect> criterionDictionList = new List<BasicDicSelect>();
var isSystemCriterion = await _readingQuestionCriterionSystem.AnyAsync(x => x.Id == inDto.ReadingCriterionId);
var isSystemCriterion = await _readingQuestionCriterionSystem.AnyAsync(x => x.Id == inDto.ReadingCriterionId);
if (isSystemCriterion)
{
selectCode = await _systemCriterionDictionaryCodeRepository.Where(x => x.SystemCriterionId == inDto.ReadingCriterionId).Select(x => x.Code).ToListAsync();
}
criterionDictionList = await _readingCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.ReadingCriterionId).Select(x => new BasicDicSelect()
{
ChildGroup = x.Dictionary.ChildGroup,
Code = x.Dictionary.Code,
DataTypeEnum = x.Dictionary.DataTypeEnum,
ParentChildCodeEnum = x.Dictionary.Parent.ChildCodeEnum,
ShowOrder = x.Dictionary.ShowOrder,
ParentCode = x.ParentCode,
CrterionDictionaryGroup = x.CrterionDictionaryGroup,
Id = x.DictionaryId,
ParentId = x.Dictionary.ParentId,
Value = x.Dictionary.Value,
ValueCN = x.Dictionary.ValueCN
}).ToListAsync();
}
else
{
selectCode = await _trialCriterionDictionaryCodeRepository.Where(x => x.TrialCriterionId == inDto.ReadingCriterionId).Select(x => x.Code).ToListAsync();
}
criterionDictionList = await _readingTrialCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.ReadingCriterionId).Select(x => new BasicDicSelect()
{
ChildGroup = x.Dictionary.ChildGroup,
Code = x.Dictionary.Code,
DataTypeEnum = x.Dictionary.DataTypeEnum,
ParentChildCodeEnum = x.Dictionary.Parent.ChildCodeEnum,
ShowOrder = x.Dictionary.ShowOrder,
ParentCode = x.ParentCode,
CrterionDictionaryGroup = x.CrterionDictionaryGroup,
Id = x.DictionaryId,
ParentId = x.Dictionary.ParentId,
Value = x.Dictionary.Value,
ValueCN = x.Dictionary.ValueCN
}).ToListAsync();
}
var criterionCode = await _dicRepository.Where(x => x.ConfigDictionary.Code == "Reading_eCRF_Criterion").Select(x => x.Code).ToListAsync();
@@ -361,21 +399,7 @@ namespace IRaCIS.Application.Services
}
var criterionDictionList = await _readingCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.ReadingCriterionId).Select(x => new BasicDicSelect()
{
ChildGroup = x.Dictionary.ChildGroup,
Code = x.Dictionary.Code,
DataTypeEnum = x.Dictionary.DataTypeEnum,
ParentChildCodeEnum = x.Dictionary.Parent.ChildCodeEnum,
ShowOrder = x.Dictionary.ShowOrder,
ParentCode = x.ParentCode,
CrterionDictionaryGroup = x.CrterionDictionaryGroup,
Id = x.DictionaryId,
ParentId = x.Dictionary.ParentId,
Value = x.Dictionary.Value,
ValueCN = x.Dictionary.ValueCN
}).ToListAsync();
criterionDictionList = criterionDictionList.Where(x => selectCode.Contains(x.ParentCode)).ToList();
@@ -438,7 +462,7 @@ namespace IRaCIS.Application.Services
var criterionDictionList = await _readingCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.TrialReadingCriterionId).Select(x => new BasicDicSelect()
var criterionDictionList = await _readingTrialCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.TrialReadingCriterionId).Select(x => new BasicDicSelect()
{
ChildGroup = x.Dictionary.ChildGroup,
Code = x.Dictionary.Code,