MRIPDFF 修改1
parent
7bc0d7f3dc
commit
c0a383ef58
|
|
@ -170,7 +170,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
|
||||
|
||||
var dictionList = await _dictionaryRepository.Where(x => x.Parent.Code == "LiverSegmentation").OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
var dictionList = await _dictionaryRepository.Where(x => x.Parent.Code == "Liver4Segmentation").OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
|
||||
var tableQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.FatFraction).FirstNotNullAsync();
|
||||
|
|
@ -297,7 +297,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
|
||||
{
|
||||
|
||||
await this.CalculateAvg(inDto);
|
||||
//await this.CalculateAvg(inDto);
|
||||
inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
||||
var needAddList = new List<ReadingTaskQuestionAnswer>();
|
||||
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
||||
|
|
@ -456,54 +456,54 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
/// 计算平均值
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task CalculateAvg(ReadingCalculateDto inDto)
|
||||
{
|
||||
// 脂肪分数的表格问题Id
|
||||
var questionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction).FirstOrDefault();
|
||||
//public async Task CalculateAvg(ReadingCalculateDto inDto)
|
||||
//{
|
||||
// // 脂肪分数的表格问题Id
|
||||
// var questionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction).FirstOrDefault();
|
||||
|
||||
List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
|
||||
// List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
|
||||
|
||||
|
||||
foreach (var item in questionInfo.TableRowInfoList)
|
||||
{
|
||||
var avg = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).FirstOrDefault();
|
||||
var avgAnswer = string.Empty;
|
||||
List<QuestionMark?> questionMarks = new List<QuestionMark?>()
|
||||
{
|
||||
QuestionMark.FirstMeasurement,
|
||||
QuestionMark.SecondMeasurement,
|
||||
QuestionMark.ThirdMeasurement,
|
||||
QuestionMark.FourthMeasurement,
|
||||
};
|
||||
var answers = item.TableQuestionList.Where(x => questionMarks.Contains(x.QuestionMark)).Select(x=>x.Answer).ToList();
|
||||
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());
|
||||
}
|
||||
if(item.TableQuestionList.Where(x => x.QuestionMark== QuestionMark.IsMeasurable).Select(x => x.Answer).FirstOrDefault().EqEnum(YesOrNoOrNa.No))
|
||||
{
|
||||
avgAnswer = "NE";
|
||||
}
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = avgAnswer,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
QuestionId = avg.QuestionId,
|
||||
TableQuestionId = avg.TableQuestionId,
|
||||
TrialId = inDto.TrialId,
|
||||
RowIndex = avg.RowIndex,
|
||||
RowId = avg.RowId,
|
||||
// foreach (var item in questionInfo.TableRowInfoList)
|
||||
// {
|
||||
// var avg = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).FirstOrDefault();
|
||||
// var avgAnswer = string.Empty;
|
||||
// List<QuestionMark?> questionMarks = new List<QuestionMark?>()
|
||||
// {
|
||||
// QuestionMark.FirstMeasurement,
|
||||
// QuestionMark.SecondMeasurement,
|
||||
// QuestionMark.ThirdMeasurement,
|
||||
// QuestionMark.FourthMeasurement,
|
||||
// };
|
||||
// var answers = item.TableQuestionList.Where(x => questionMarks.Contains(x.QuestionMark)).Select(x=>x.Answer).ToList();
|
||||
// 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());
|
||||
// }
|
||||
// if(item.TableQuestionList.Where(x => x.QuestionMark== QuestionMark.IsMeasurable).Select(x => x.Answer).FirstOrDefault().EqEnum(YesOrNoOrNa.No))
|
||||
// {
|
||||
// avgAnswer = "NE";
|
||||
// }
|
||||
// tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
// {
|
||||
// Answer = avgAnswer,
|
||||
// VisitTaskId = inDto.VisitTaskId,
|
||||
// QuestionId = avg.QuestionId,
|
||||
// TableQuestionId = avg.TableQuestionId,
|
||||
// TrialId = inDto.TrialId,
|
||||
// RowIndex = avg.RowIndex,
|
||||
// RowId = avg.RowId,
|
||||
|
||||
});
|
||||
// });
|
||||
|
||||
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowId == item.RowId && x.TableQuestionId == avg.TableQuestionId);
|
||||
}
|
||||
// await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowId == item.RowId && x.TableQuestionId == avg.TableQuestionId);
|
||||
// }
|
||||
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
// await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||
// await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
|
@ -523,12 +523,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var rowInfo = readingData.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction)
|
||||
.SelectMany(x => x.TableRowInfoList).ToList();
|
||||
|
||||
var tableQuestionList = rowInfo.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.AverageValue && x.Answer.IsNotNullOrEmpty())).ToList();
|
||||
//var tableQuestionList = rowInfo.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.AverageValue && x.Answer.IsNotNullOrEmpty())).ToList();
|
||||
|
||||
if (tableQuestionList.Count() != 8)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["MRIPDFF_AllNeedToBeMark"]);
|
||||
}
|
||||
//if (tableQuestionList.Count() != 4)
|
||||
//{
|
||||
// throw new BusinessValidationFailedException(_localizer["MRIPDFF_AllNeedToBeMark"]);
|
||||
//}
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue