完整返回字典选项
parent
d9bc12c8d4
commit
b9c55871b8
|
|
@ -21,6 +21,7 @@ public class TrialStatService(
|
|||
IRepository<SystemDocument> _systemDocumentRepository,
|
||||
IRepository<SystemNotice> _systemNoticeRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<Dictionary> _dictionaryRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
|
||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService
|
||||
{
|
||||
|
|
@ -144,6 +145,7 @@ public class TrialStatService(
|
|||
|
||||
}
|
||||
|
||||
|
||||
var query = _visitTaskRepository.WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId)
|
||||
.Where(t => t.TrialId == inQuery.TrialId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze))
|
||||
|
||||
|
|
@ -179,6 +181,8 @@ public class TrialStatService(
|
|||
|
||||
var list = await query.ToListAsync();
|
||||
|
||||
var dicName = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == trialReadingCriterionId).SelectMany(t => t.ReadingQuestionTrialList.Where(t => t.QuestionType == questionType))
|
||||
.Select(t => t.DictionaryCode).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
if (criterion.IsArbitrationReading)
|
||||
|
|
@ -197,8 +201,9 @@ public class TrialStatService(
|
|||
list = DealJudgeMark(criterion.ArbitrationRule, criterion.IsGlobalReading, list);
|
||||
|
||||
|
||||
|
||||
//判断subject的逻辑需要确认,这么多次访视任务,有的符合,有的不符合,准则是什么?
|
||||
return list.GroupBy(t => t.OverallTumorEvaluation).Select(g => new EfficacyEvaluationStatViewModel()
|
||||
var resultList = list.GroupBy(t => t.OverallTumorEvaluation).Select(g => new EfficacyEvaluationStatViewModel()
|
||||
{
|
||||
DictionaryCode = g.FirstOrDefault()?.DictionaryCode,
|
||||
OverallTumorEvaluation = g.Key,
|
||||
|
|
@ -206,6 +211,26 @@ public class TrialStatService(
|
|||
}).ToList();
|
||||
|
||||
|
||||
// 先把 resultList 转成内存字典
|
||||
var resultDict = resultList.ToDictionary(r => r.OverallTumorEvaluation, r => r.SubjectCount);
|
||||
|
||||
// 查询字典表,先把数据拉出来到内存,再合并
|
||||
var dicList = _dictionaryRepository
|
||||
.Where(t => t.Parent.Code == dicName)
|
||||
.Select(t => new
|
||||
{
|
||||
t.Code
|
||||
})
|
||||
.ToList()
|
||||
.Select(t => new EfficacyEvaluationStatViewModel
|
||||
{
|
||||
DictionaryCode = dicName,
|
||||
OverallTumorEvaluation = t.Code,
|
||||
SubjectCount = resultDict.ContainsKey(t.Code) ? resultDict[t.Code] : 0
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return dicList;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue