Merge branch 'Test_IRC_Net8' of http://192.168.3.68:2000/XCKJ/irc-netcore-api into Test_IRC_Net8

IRC_NewDev
hang 2024-05-21 14:29:15 +08:00
commit 44d62b187f
4 changed files with 112 additions and 25 deletions

View File

@ -1578,6 +1578,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary> /// </summary>
public decimal? JudgeDifferenceValue { get; set; } public decimal? JudgeDifferenceValue { get; set; }
/// <summary>
/// 裁判百分比或绝对值的相差值匹配规则
/// </summary>
public JudgeDifferenceType JudgeDifferenceType { get; set; }
public bool IsHaveChange { get; set; } = false; public bool IsHaveChange { get; set; } = false;
public string VisitAnswer { get; set; } = string.Empty; public string VisitAnswer { get; set; } = string.Empty;
@ -1820,6 +1825,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary> /// </summary>
public decimal? JudgeDifferenceValue { get; set; } public decimal? JudgeDifferenceValue { get; set; }
/// <summary>
/// 裁判百分比或绝对值的相差值匹配规则
/// </summary>
public JudgeDifferenceType JudgeDifferenceType { get; set; }
public List<AnswerCombinationDto> AnswerCombination { get; set; } public List<AnswerCombinationDto> AnswerCombination { get; set; }
@ -1837,6 +1847,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary> /// </summary>
public decimal? JudgeDifferenceValue { get; set; } public decimal? JudgeDifferenceValue { get; set; }
/// <summary>
/// 裁判百分比或绝对值的相差值匹配规则
/// </summary>
public JudgeDifferenceType JudgeDifferenceType { get; set; }
public string QuestionName { get; set; } public string QuestionName { get; set; }
@ -2276,6 +2291,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// 裁判百分比或绝对值的相差值 /// 裁判百分比或绝对值的相差值
/// </summary> /// </summary>
public decimal? JudgeDifferenceValue { get; set; } public decimal? JudgeDifferenceValue { get; set; }
/// <summary>
/// 裁判百分比或绝对值的相差值匹配规则
/// </summary>
public JudgeDifferenceType JudgeDifferenceType { get; set; }
public string AnswerGroup { get; set; } public string AnswerGroup { get; set; }
@ -2325,6 +2345,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// 裁判百分比或绝对值的相差值 /// 裁判百分比或绝对值的相差值
/// </summary> /// </summary>
public decimal? JudgeDifferenceValue { get; set; } public decimal? JudgeDifferenceValue { get; set; }
/// <summary>
/// 裁判百分比或绝对值的相差值匹配规则
/// </summary>
public JudgeDifferenceType JudgeDifferenceType { get; set; }
} }

View File

@ -47,7 +47,8 @@ namespace IRaCIS.Application.Services
DictionaryCode=x.DictionaryCode, DictionaryCode=x.DictionaryCode,
JudgeType = x.JudgeType, JudgeType = x.JudgeType,
ReadingQuestionTrialId = x.Id, ReadingQuestionTrialId = x.Id,
JudgeDifferenceValue= x.JudgeDifferenceValue JudgeDifferenceValue= x.JudgeDifferenceValue,
JudgeDifferenceType=x.JudgeDifferenceType,
}).ToListAsync(); }).ToListAsync();
@ -72,7 +73,7 @@ namespace IRaCIS.Application.Services
AnswerGroup = JsonConvert.SerializeObject(inDto.AnswerGroup), AnswerGroup = JsonConvert.SerializeObject(inDto.AnswerGroup),
AnswerCombination = JsonConvert.SerializeObject(inDto.AnswerCombination), AnswerCombination = JsonConvert.SerializeObject(inDto.AnswerCombination),
JudgeDifferenceValue= inDto.JudgeDifferenceValue, JudgeDifferenceValue= inDto.JudgeDifferenceValue,
JudgeDifferenceType=inDto.JudgeDifferenceType,
JudgeType = inDto.JudgeType, JudgeType = inDto.JudgeType,
}); });
@ -617,6 +618,7 @@ namespace IRaCIS.Application.Services
JudgeType = question.JudgeType, JudgeType = question.JudgeType,
QuestionId = question.Id, QuestionId = question.Id,
JudgeDifferenceValue=question.JudgeDifferenceValue, JudgeDifferenceValue=question.JudgeDifferenceValue,
JudgeDifferenceType=question.JudgeDifferenceType,
VisitTaskId = questionAnswer.VisitTaskId, VisitTaskId = questionAnswer.VisitTaskId,
}; };
var globalVisitAnswerlist = await globalVisitQuestionQuery.ToListAsync(); var globalVisitAnswerlist = await globalVisitQuestionQuery.ToListAsync();
@ -625,13 +627,14 @@ namespace IRaCIS.Application.Services
foreach (var item in taskNums) foreach (var item in taskNums)
{ {
List<GroupTaskAnswerDto> groupTasks = globalVisitAnswerlist.Where(x => x.VisitTaskNum == item).GroupBy(x => new {x.JudgeDifferenceValue, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto List<GroupTaskAnswerDto> groupTasks = globalVisitAnswerlist.Where(x => x.VisitTaskNum == item).GroupBy(x => new {x.JudgeDifferenceValue,x.JudgeDifferenceType, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
{ {
QuestionId = x.Key.QuestionId, QuestionId = x.Key.QuestionId,
AnswerGroup = x.Key.AnswerGroup, AnswerGroup = x.Key.AnswerGroup,
AnswerCombination = x.Key.AnswerCombination, AnswerCombination = x.Key.AnswerCombination,
JudgeType = x.Key.JudgeType, JudgeType = x.Key.JudgeType,
JudgeDifferenceValue=x.Key.JudgeDifferenceValue, JudgeDifferenceValue=x.Key.JudgeDifferenceValue,
JudgeDifferenceType = x.Key.JudgeDifferenceType,
TaskAnswerList = x.Select(y => y.Answer).ToList(), TaskAnswerList = x.Select(y => y.Answer).ToList(),
}).ToList(); }).ToList();
noteEqual = noteEqual || ComputeJudgeResult(groupTasks); noteEqual = noteEqual || ComputeJudgeResult(groupTasks);
@ -650,18 +653,20 @@ namespace IRaCIS.Application.Services
JudgeType = question.JudgeType, JudgeType = question.JudgeType,
QuestionId = question.Id, QuestionId = question.Id,
JudgeDifferenceValue=question.JudgeDifferenceValue, JudgeDifferenceValue=question.JudgeDifferenceValue,
JudgeDifferenceType = question.JudgeDifferenceType,
VisitTaskId = questionAnswet.VisitTaskId, VisitTaskId = questionAnswet.VisitTaskId,
}; };
var questionAnswerlist = await query.ToListAsync(); var questionAnswerlist = await query.ToListAsync();
// 将答案进行分组 // 将答案进行分组
List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new {x.JudgeDifferenceValue, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new {x.JudgeDifferenceValue,x.JudgeDifferenceType, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
{ {
QuestionId = x.Key.QuestionId, QuestionId = x.Key.QuestionId,
AnswerGroup = x.Key.AnswerGroup, AnswerGroup = x.Key.AnswerGroup,
AnswerCombination = x.Key.AnswerCombination, AnswerCombination = x.Key.AnswerCombination,
JudgeType = x.Key.JudgeType, JudgeType = x.Key.JudgeType,
JudgeDifferenceValue=x.Key.JudgeDifferenceValue, JudgeDifferenceValue=x.Key.JudgeDifferenceValue,
JudgeDifferenceType = x.Key.JudgeDifferenceType,
TaskAnswerList = x.Select(y => y.Answer).ToList(), TaskAnswerList = x.Select(y => y.Answer).ToList(),
}).ToList(); }).ToList();
noteEqual = ComputeJudgeResult(groupTasks); noteEqual = ComputeJudgeResult(groupTasks);
@ -703,7 +708,7 @@ namespace IRaCIS.Application.Services
twoItem.AfterQuestionList.Where(x => x.QuestionId != null && x.IsJudgeQuestion).ToList() twoItem.AfterQuestionList.Where(x => x.QuestionId != null && x.IsJudgeQuestion).ToList()
).ToList(); ).ToList();
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination,x.JudgeDifferenceValue }).Select(x => new GroupTaskAnswerDto List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination,x.JudgeDifferenceValue,x.JudgeDifferenceType }).Select(x => new GroupTaskAnswerDto
{ {
QuestionId = x.Key.QuestionId!.Value, QuestionId = x.Key.QuestionId!.Value,
AnswerGroup = x.Key.AnswerGroup, AnswerGroup = x.Key.AnswerGroup,
@ -711,6 +716,7 @@ namespace IRaCIS.Application.Services
JudgeType = x.Key.JudgeType, JudgeType = x.Key.JudgeType,
TaskAnswerList = x.Select(y => y.Answer).ToList(), TaskAnswerList = x.Select(y => y.Answer).ToList(),
JudgeDifferenceValue= x.Key.JudgeDifferenceValue, JudgeDifferenceValue= x.Key.JudgeDifferenceValue,
JudgeDifferenceType = x.Key.JudgeDifferenceType,
}).ToList(); }).ToList();
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks); noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
} }
@ -755,6 +761,7 @@ namespace IRaCIS.Application.Services
JudgeType = question.JudgeType, JudgeType = question.JudgeType,
QuestionId = question.Id, QuestionId = question.Id,
JudgeDifferenceValue=question.JudgeDifferenceValue, JudgeDifferenceValue=question.JudgeDifferenceValue,
JudgeDifferenceType = question.JudgeDifferenceType,
}; };
var visitTaskQuestions = await query.ToListAsync(); var visitTaskQuestions = await query.ToListAsync();
@ -763,13 +770,14 @@ namespace IRaCIS.Application.Services
lastTask.AfterQuestionList.Where(x => x.QuestionId != null).ToList() lastTask.AfterQuestionList.Where(x => x.QuestionId != null).ToList()
).ToList(); ).ToList();
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new {x.JudgeDifferenceValue, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new {x.JudgeDifferenceValue,x.JudgeDifferenceType, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
{ {
QuestionId = x.Key.QuestionId!.Value, QuestionId = x.Key.QuestionId!.Value,
AnswerGroup = x.Key.AnswerGroup, AnswerGroup = x.Key.AnswerGroup,
AnswerCombination = x.Key.AnswerCombination, AnswerCombination = x.Key.AnswerCombination,
JudgeType = x.Key.JudgeType, JudgeType = x.Key.JudgeType,
JudgeDifferenceValue=x.Key.JudgeDifferenceValue, JudgeDifferenceValue=x.Key.JudgeDifferenceValue,
JudgeDifferenceType = x.Key.JudgeDifferenceType,
TaskAnswerList = x.Select(y => y.Answer).ToList(), TaskAnswerList = x.Select(y => y.Answer).ToList(),
}).ToList(); }).ToList();
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks); noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
@ -937,10 +945,23 @@ namespace IRaCIS.Application.Services
deffaultValue =0 -deffaultValue; deffaultValue =0 -deffaultValue;
} }
if (item.JudgeDifferenceType == JudgeDifferenceType.Greater)
{
if (deffaultValue > item.JudgeDifferenceValue)
{
noteEqual = true;
}
}
else if(item.JudgeDifferenceType == JudgeDifferenceType.AboveOrEqual)
{
if (deffaultValue >= item.JudgeDifferenceValue) if (deffaultValue >= item.JudgeDifferenceValue)
{ {
noteEqual = true; noteEqual = true;
} }
}
break; break;
case JudgeTypeEnum.PercentageDifference: case JudgeTypeEnum.PercentageDifference:
@ -951,16 +972,34 @@ namespace IRaCIS.Application.Services
noteEqual = true; noteEqual = true;
} }
else else
{
if (item.JudgeDifferenceType == JudgeDifferenceType.Greater)
{ {
if (value1 < value2) if (value1 < value2)
{ {
noteEqual = (value2 - value1)*100 / value1 >= item.JudgeDifferenceValue; noteEqual = (value2 - value1) * 100 / value1 > item.JudgeDifferenceValue;
} }
else else
{ {
noteEqual = (value1 - value2)*100 / value2 >= item.JudgeDifferenceValue; noteEqual = (value1 - value2) * 100 / value2 > item.JudgeDifferenceValue;
} }
}
else if (item.JudgeDifferenceType == JudgeDifferenceType.AboveOrEqual)
{
if (value1 < value2)
{
noteEqual = (value2 - value1) * 100 / value1 >= item.JudgeDifferenceValue;
}
else
{
noteEqual = (value1 - value2) * 100 / value2 >= item.JudgeDifferenceValue;
}
}
} }

View File

@ -17,6 +17,24 @@ namespace IRaCIS.Core.Domain.Share
} }
/// <summary>
/// 裁判匹配类型
/// </summary>
public enum JudgeDifferenceType
{
/// <summary>
/// >
/// </summary>
Greater = 0,
/// <summary>
/// ≥
/// </summary>
AboveOrEqual = 1,
}
/// <summary> /// <summary>
/// GetClinicalType /// GetClinicalType
/// </summary> /// </summary>

View File

@ -139,6 +139,11 @@ namespace IRaCIS.Core.Domain.Models
/// </summary> /// </summary>
public decimal? JudgeDifferenceValue { get; set; } public decimal? JudgeDifferenceValue { get; set; }
/// <summary>
/// 裁判百分比或绝对值的相差值匹配规则
/// </summary>
public JudgeDifferenceType JudgeDifferenceType { get; set; }
/// <summary> /// <summary>
/// 创建人 /// 创建人
/// </summary> /// </summary>