Merge branch 'Test_IRC_Net10' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net10
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
92fc9222db
|
|
@ -351,6 +351,23 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 提交阅片裁判表单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="opt"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost, Route("Inspection/ReadingImageTask/SubmitJudgeForm")]
|
||||||
|
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||||
|
|
||||||
|
[UnitOfWork]
|
||||||
|
|
||||||
|
public async Task<IResponseOutput> SubmitJudgeForm(DataInspectionDto<SetJudgeFormInDto> opt)
|
||||||
|
{
|
||||||
|
var singid = await _inspectionService.RecordSing(opt.SignInfo);
|
||||||
|
var result = await _iReadingImageTaskService.SubmitJudgeForm(opt.Data);
|
||||||
|
await _inspectionService.CompletedSign(singid, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 配置 基础逻辑信息并确认
|
/// 配置 基础逻辑信息并确认
|
||||||
|
|
|
||||||
|
|
@ -767,6 +767,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt, nameof(VisitTask)),
|
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt, nameof(VisitTask)),
|
||||||
ReadingCategory = ReadingCategory.Visit,
|
ReadingCategory = ReadingCategory.Visit,
|
||||||
|
|
||||||
|
|
||||||
TrialReadingCriterionId = trialReadingCriterionConfig.TrialReadingCriterionId,
|
TrialReadingCriterionId = trialReadingCriterionConfig.TrialReadingCriterionId,
|
||||||
IsNeedClinicalDataSign = isNeedClinicalDataSign,
|
IsNeedClinicalDataSign = isNeedClinicalDataSign,
|
||||||
IsClinicalDataSign = isClinicalDataSign,
|
IsClinicalDataSign = isClinicalDataSign,
|
||||||
|
|
@ -1421,6 +1422,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
// AllocateTime = DateTime.Now,
|
// AllocateTime = DateTime.Now,
|
||||||
//DoctorUserId = reReadingVisitTask.DoctorUserId,
|
//DoctorUserId = reReadingVisitTask.DoctorUserId,
|
||||||
|
|
||||||
|
IsIRImageDownloaded= reReadingVisitTask.IsIRImageDownloaded,
|
||||||
});
|
});
|
||||||
|
|
||||||
generateTaskCommand.Action(newTask);
|
generateTaskCommand.Action(newTask);
|
||||||
|
|
|
||||||
|
|
@ -2199,6 +2199,21 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DefaultSegmentNameDto DefaultSegmentName { get; set; }
|
public DefaultSegmentNameDto DefaultSegmentName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 仲裁模式
|
||||||
|
/// </summary>
|
||||||
|
public JudgeMode JudgeModeEnum { get; set; } = JudgeMode.SelectOne;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 裁判规则
|
||||||
|
/// </summary>
|
||||||
|
public JudgeRule JudgeRuleEnum { get; set; } = JudgeRule.Consistent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 仲裁对象
|
||||||
|
/// </summary>
|
||||||
|
public ArbitrationRule ArbitrationRule { get; set; } = ArbitrationRule.Reading;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetReadingImgInDto
|
public class GetReadingImgInDto
|
||||||
|
|
@ -2437,6 +2452,81 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
public Guid VisitTaskId { get; set; }
|
public Guid VisitTaskId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GetSingleVisitJudgeAnswerInDto
|
||||||
|
{
|
||||||
|
[NotDefault]
|
||||||
|
public Guid VisitTaskId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetSingleVisitJudgeAnswerOutDto
|
||||||
|
{
|
||||||
|
public Guid R1VisitTaskId { get; set; }
|
||||||
|
public Guid R2VisitTaskId { get; set; }
|
||||||
|
public List<SingleVisitJudgeAnswerItemDto> QuestionList { get; set; } = new List<SingleVisitJudgeAnswerItemDto>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SingleVisitJudgeAnswerItemDto
|
||||||
|
{
|
||||||
|
public Guid ReadingQuestionId { get; set; }
|
||||||
|
public string QuestionName { get; set; } = string.Empty;
|
||||||
|
public string Type { get; set; } = string.Empty;
|
||||||
|
public string TypeValue { get; set; } = string.Empty;
|
||||||
|
public int ShowOrder { get; set; }
|
||||||
|
public string R1Answer { get; set; } = string.Empty;
|
||||||
|
public string R2Answer { get; set; } = string.Empty;
|
||||||
|
public TableQuestionType? QuestionGenre { get; set; }
|
||||||
|
public string DictionaryCode { get; set; } = string.Empty;
|
||||||
|
public ValueUnit? Unit { get; set; }
|
||||||
|
public string? CustomUnit { get; set; }
|
||||||
|
public ValueOfType? ValueType { get; set; }
|
||||||
|
public JudgeReadingQuestionType QuestionType { get; set; } = JudgeReadingQuestionType.Question;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetJudgeFormInDto
|
||||||
|
{
|
||||||
|
[NotDefault]
|
||||||
|
public Guid VisitTaskId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetJudgeFormOutDto
|
||||||
|
{
|
||||||
|
public List<JudgeFormQuestionDto> QuestionList { get; set; } = new List<JudgeFormQuestionDto>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class JudgeFormQuestionDto
|
||||||
|
{
|
||||||
|
public Guid ReadingQuestionId { get; set; }
|
||||||
|
public string QuestionName { get; set; } = string.Empty;
|
||||||
|
public string Type { get; set; } = string.Empty;
|
||||||
|
public string TypeValue { get; set; } = string.Empty;
|
||||||
|
public int ShowOrder { get; set; }
|
||||||
|
public string Answer { get; set; } = string.Empty;
|
||||||
|
public TableQuestionType? QuestionGenre { get; set; }
|
||||||
|
public string DictionaryCode { get; set; } = string.Empty;
|
||||||
|
public ValueUnit? Unit { get; set; }
|
||||||
|
public string? CustomUnit { get; set; }
|
||||||
|
public ValueOfType? ValueType { get; set; }
|
||||||
|
public JudgeReadingQuestionType QuestionType { get; set; } = JudgeReadingQuestionType.Question;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetJudgeFormInDto
|
||||||
|
{
|
||||||
|
[NotDefault]
|
||||||
|
public Guid VisitTaskId { get; set; }
|
||||||
|
|
||||||
|
public string JudgeResultRemark { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public List<string> JudgeResultImagePathList { get; set; } = new List<string>();
|
||||||
|
|
||||||
|
public List<JudgeFormAnswerDto> QuestionList { get; set; } = new List<JudgeFormAnswerDto>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class JudgeFormAnswerDto
|
||||||
|
{
|
||||||
|
public Guid ReadingQuestionId { get; set; }
|
||||||
|
public string Answer { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
public class JudgeReadingInfoDto
|
public class JudgeReadingInfoDto
|
||||||
{
|
{
|
||||||
public string VisitName { get; set; }
|
public string VisitName { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,43 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||||
namespace IRaCIS.Core.Application.Service.Reading.Dto
|
namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public class GetTrialQuestionVisitJudgeRuleInDto
|
||||||
|
{
|
||||||
|
[NotDefault]
|
||||||
|
public Guid TrialId { get; set; }
|
||||||
|
|
||||||
|
[NotDefault]
|
||||||
|
public Guid TrialReadingCriterionId { get; set; }
|
||||||
|
|
||||||
|
[NotDefault]
|
||||||
|
public decimal VisitNum { get; set; }
|
||||||
|
|
||||||
|
public Guid? ReadingQuestionId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetTrialQuestionVisitJudgeRuleInDto
|
||||||
|
{
|
||||||
|
[NotDefault]
|
||||||
|
public Guid TrialReadingCriterionId { get; set; }
|
||||||
|
|
||||||
|
[NotDefault]
|
||||||
|
public decimal VisitNum { get; set; }
|
||||||
|
|
||||||
|
public List<TrialQuestionVisitJudgeRuleItemDto> QuestionList { get; set; } = new List<TrialQuestionVisitJudgeRuleItemDto>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TrialQuestionVisitJudgeRuleItemDto
|
||||||
|
{
|
||||||
|
public Guid ReadingQuestionId { get; set; }
|
||||||
|
public string QuestionName { get; set; } = string.Empty;
|
||||||
|
public int ShowOrder { get; set; }
|
||||||
|
public List<string> AnswerGroup { get; set; } = new List<string>();
|
||||||
|
public List<string> AnswerCombination { get; set; } = new List<string>();
|
||||||
|
public JudgeTypeEnum JudgeType { get; set; }
|
||||||
|
public decimal? JudgeDifferenceValue { get; set; }
|
||||||
|
public JudgeDifferenceType JudgeDifferenceType { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public class TumorAssessmentView : AddOrUpdateTumorAssessmentInDto
|
public class TumorAssessmentView : AddOrUpdateTumorAssessmentInDto
|
||||||
{
|
{
|
||||||
|
|
@ -702,6 +739,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
public Guid TrialReadingCriterionId { get; set; }
|
public Guid TrialReadingCriterionId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SetTrialJudgeRuleInfoInDto
|
||||||
|
{
|
||||||
|
[NotDefault]
|
||||||
|
public Guid TrialReadingCriterionId { get; set; }
|
||||||
|
|
||||||
|
public JudgeMode JudgeModeEnum { get; set; } = JudgeMode.SelectOne;
|
||||||
|
public JudgeRule JudgeRuleEnum { get; set; } = JudgeRule.Consistent;
|
||||||
|
public JudgeGenerate JudgeGenerateEnum { get; set; } = JudgeGenerate.Instant;
|
||||||
|
}
|
||||||
|
|
||||||
public class GetTrialJudgyInfoOutDto
|
public class GetTrialJudgyInfoOutDto
|
||||||
{
|
{
|
||||||
public Guid TrialId { get; set; }
|
public Guid TrialId { get; set; }
|
||||||
|
|
@ -717,6 +764,21 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
/// 仲裁规则
|
/// 仲裁规则
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ArbitrationRule ArbitrationRule { get; set; }
|
public ArbitrationRule ArbitrationRule { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 仲裁模式
|
||||||
|
/// </summary>
|
||||||
|
public JudgeMode JudgeModeEnum { get; set; } = JudgeMode.SelectOne;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 裁判规则
|
||||||
|
/// </summary>
|
||||||
|
public JudgeRule JudgeRuleEnum { get; set; } = JudgeRule.Consistent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 裁判任务生成
|
||||||
|
/// </summary>
|
||||||
|
public JudgeGenerate JudgeGenerateEnum { get; set; } = JudgeGenerate.Instant;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum NeedSynchronize
|
public enum NeedSynchronize
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
Task TriggerJudgeQuestion(Guid visitTaskId);
|
Task TriggerJudgeQuestion(Guid visitTaskId);
|
||||||
Task<IResponseOutput> SubmitVisitTaskQuestions(SubmitVisitTaskQuestionsInDto inDto);
|
Task<IResponseOutput> SubmitVisitTaskQuestions(SubmitVisitTaskQuestionsInDto inDto);
|
||||||
|
|
||||||
|
Task<IResponseOutput> SubmitJudgeForm(SetJudgeFormInDto inDto);
|
||||||
Task<IResponseOutput> SubmitJudgeVisitTaskResult(SaveJudgeVisitTaskResult inDto);
|
Task<IResponseOutput> SubmitJudgeVisitTaskResult(SaveJudgeVisitTaskResult inDto);
|
||||||
|
|
||||||
Task<GetOncologyReadingInfoOutDto> GetOncologyReadingInfo(GetOncologyReadingInfoInDto inDto);
|
Task<GetOncologyReadingInfoOutDto> GetOncologyReadingInfo(GetOncologyReadingInfoInDto inDto);
|
||||||
|
|
|
||||||
|
|
@ -370,13 +370,32 @@ namespace IRaCIS.Core.Application.Service.RC
|
||||||
TrialId = x.TrialId,
|
TrialId = x.TrialId,
|
||||||
IsReadingTaskViewInOrder = x.IsReadingTaskViewInOrder,
|
IsReadingTaskViewInOrder = x.IsReadingTaskViewInOrder,
|
||||||
ArbitrationRule = x.ArbitrationRule,
|
ArbitrationRule = x.ArbitrationRule,
|
||||||
IsArbitrationReading = x.IsArbitrationReading
|
IsArbitrationReading = x.IsArbitrationReading,
|
||||||
|
JudgeModeEnum = x.JudgeModeEnum,
|
||||||
|
JudgeRuleEnum = x.JudgeRuleEnum,
|
||||||
|
JudgeGenerateEnum = x.JudgeGenerateEnum,
|
||||||
|
|
||||||
}).FirstNotNullAsync();
|
}).FirstNotNullAsync();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编辑裁判规则配置
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IResponseOutput> SetTrialJudgeRuleInfo(SetTrialJudgeRuleInfoInDto inDto)
|
||||||
|
{
|
||||||
|
await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.TrialReadingCriterionId, x => new ReadingQuestionCriterionTrial()
|
||||||
|
{
|
||||||
|
JudgeModeEnum = inDto.JudgeModeEnum,
|
||||||
|
JudgeRuleEnum = inDto.JudgeRuleEnum,
|
||||||
|
JudgeGenerateEnum = inDto.JudgeGenerateEnum,
|
||||||
|
});
|
||||||
|
|
||||||
|
return ResponseOutput.Ok(await _readingQuestionCriterionTrialRepository.SaveChangesAsync());
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 新增修改项目问题标准(项目)
|
/// 新增修改项目问题标准(项目)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -482,7 +501,6 @@ namespace IRaCIS.Core.Application.Service.RC
|
||||||
return ResponseOutput.Ok(result);
|
return ResponseOutput.Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 项目阅片标准问题分页
|
#region 项目阅片标准问题分页
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,92 @@ namespace IRaCIS.Core.Application.Service
|
||||||
IRepository<OrganInfo> _organInfoRepository,
|
IRepository<OrganInfo> _organInfoRepository,
|
||||||
IRepository<ReadingTableQuestionSystem> _readingTableQuestionSystemRepository,
|
IRepository<ReadingTableQuestionSystem> _readingTableQuestionSystemRepository,
|
||||||
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswer,
|
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswer,
|
||||||
IRepository<PreviousPDF> _previousPDFRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IReadingQuestionService
|
IRepository<PreviousPDF> _previousPDFRepository,
|
||||||
|
IRepository<ReadingQuestionVisitJudgeRule> _readingQuestionVisitJudgeRuleRepository,
|
||||||
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IReadingQuestionService
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#region 项目访视裁判规则
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取项目阅片标准各访视的裁判规则配置。
|
||||||
|
/// 未配置规则的访视问题也会返回,供前端直接进行配置。
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<List<TrialQuestionVisitJudgeRuleItemDto>> GetTrialQuestionVisitJudgeRule(GetTrialQuestionVisitJudgeRuleInDto inDto)
|
||||||
|
{
|
||||||
|
var questionList = await _readingQuestionTrialRepository
|
||||||
|
.Where(x=>!x.ExcludeShowVisitList.Contains(inDto.VisitNum))
|
||||||
|
.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId && x.IsJudgeQuestion)
|
||||||
|
.WhereIf(inDto.ReadingQuestionId != null, x => x.Id == inDto.ReadingQuestionId)
|
||||||
|
.OrderBy(x => x.ShowOrder)
|
||||||
|
.Select(x => new TrialQuestionVisitJudgeRuleItemDto
|
||||||
|
{
|
||||||
|
ReadingQuestionId = x.Id,
|
||||||
|
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||||
|
ShowOrder = x.ShowOrder,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var questionIds = questionList.Select(x => x.ReadingQuestionId).ToList();
|
||||||
|
var ruleList = await _readingQuestionVisitJudgeRuleRepository
|
||||||
|
.Where(x => x.VisitNum == inDto.VisitNum && questionIds.Contains(x.ReadingQuestionId))
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return questionList.Select(question =>
|
||||||
|
{
|
||||||
|
var rule = ruleList.FirstOrDefault(x => x.ReadingQuestionId == question.ReadingQuestionId);
|
||||||
|
return new TrialQuestionVisitJudgeRuleItemDto
|
||||||
|
{
|
||||||
|
ReadingQuestionId = question.ReadingQuestionId,
|
||||||
|
QuestionName = question.QuestionName,
|
||||||
|
ShowOrder = question.ShowOrder,
|
||||||
|
AnswerGroup = rule?.AnswerGroup ?? new List<string>(),
|
||||||
|
AnswerCombination = rule?.AnswerCombination ?? new List<string>(),
|
||||||
|
JudgeType = rule?.JudgeType ?? JudgeTypeEnum.None,
|
||||||
|
JudgeDifferenceValue = rule?.JudgeDifferenceValue,
|
||||||
|
JudgeDifferenceType = rule?.JudgeDifferenceType ?? default,
|
||||||
|
};
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编辑项目阅片标准各访视的裁判规则配置。
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IResponseOutput> SetTrialQuestionVisitJudgeRule(SetTrialQuestionVisitJudgeRuleInDto inDto)
|
||||||
|
{
|
||||||
|
var questionIds = await _readingQuestionTrialRepository
|
||||||
|
.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId && x.IsJudgeQuestion)
|
||||||
|
.Select(x => x.Id)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
await _readingQuestionVisitJudgeRuleRepository.BatchDeleteNoTrackingAsync(x =>
|
||||||
|
x.VisitNum == inDto.VisitNum && questionIds.Contains(x.ReadingQuestionId));
|
||||||
|
|
||||||
|
var rules = inDto.QuestionList.Select(question => new ReadingQuestionVisitJudgeRule
|
||||||
|
{
|
||||||
|
Id = NewId.NextGuid(),
|
||||||
|
ReadingQuestionId = question.ReadingQuestionId,
|
||||||
|
VisitNum = inDto.VisitNum,
|
||||||
|
AnswerGroup = question.AnswerGroup ?? new List<string>(),
|
||||||
|
AnswerCombination = question.AnswerCombination ?? new List<string>(),
|
||||||
|
JudgeType = question.JudgeType,
|
||||||
|
JudgeDifferenceValue = question.JudgeDifferenceValue,
|
||||||
|
JudgeDifferenceType = question.JudgeDifferenceType,
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
if (rules.Count > 0)
|
||||||
|
{
|
||||||
|
await _readingQuestionVisitJudgeRuleRepository.AddRangeAsync(rules);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseOutput.Result(await _readingQuestionVisitJudgeRuleRepository.SaveChangesAsync());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region 获取计算问题
|
#region 获取计算问题
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository,
|
IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository,
|
||||||
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository,
|
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository,
|
||||||
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
|
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
|
||||||
|
IRepository<ReadingQuestionVisitJudgeRule> _readingQuestionVisitJudgeRuleRepository,
|
||||||
IRepository<ReadingQuestionSystem> _readingQuestionSystem,
|
IRepository<ReadingQuestionSystem> _readingQuestionSystem,
|
||||||
IRepository<CriterionKeyFileRead> _criterionKeyFileReadRepository,
|
IRepository<CriterionKeyFileRead> _criterionKeyFileReadRepository,
|
||||||
IRepository<TrialCriterionKeyFile> _trialCriterionKeyFileRepository,
|
IRepository<TrialCriterionKeyFile> _trialCriterionKeyFileRepository,
|
||||||
|
|
@ -3934,6 +3935,10 @@ namespace IRaCIS.Core.Application.Service
|
||||||
x.ReadingToolList,
|
x.ReadingToolList,
|
||||||
x.CircleRadius,
|
x.CircleRadius,
|
||||||
x.DefaultSegmentName,
|
x.DefaultSegmentName,
|
||||||
|
x.JudgeGenerateEnum,
|
||||||
|
x.JudgeModeEnum,
|
||||||
|
x.JudgeRuleEnum,
|
||||||
|
x.ArbitrationRule,
|
||||||
}).FirstNotNullAsync();
|
}).FirstNotNullAsync();
|
||||||
|
|
||||||
task.IsReadingShowPreviousResults = criterionInfo.IsReadingShowPreviousResults;
|
task.IsReadingShowPreviousResults = criterionInfo.IsReadingShowPreviousResults;
|
||||||
|
|
@ -3997,6 +4002,9 @@ namespace IRaCIS.Core.Application.Service
|
||||||
task.IsViewStudyPart = visitTaskInfo.ReadingCategory == ReadingCategory.Judge || visitTaskInfo.IsViewStudyPart;
|
task.IsViewStudyPart = visitTaskInfo.ReadingCategory == ReadingCategory.Judge || visitTaskInfo.IsViewStudyPart;
|
||||||
task.IsReadKeyFile = await _criterionKeyFileReadRepository.AnyAsync(x => x.IdentityUserId == _userInfo.IdentityUserId && x.TrialCriterionId == task.TrialReadingCriterionId);
|
task.IsReadKeyFile = await _criterionKeyFileReadRepository.AnyAsync(x => x.IdentityUserId == _userInfo.IdentityUserId && x.TrialCriterionId == task.TrialReadingCriterionId);
|
||||||
task.IsHaveKeyFile = await _trialCriterionKeyFileRepository.AnyAsync(x => x.TrialCriterionId == task.TrialReadingCriterionId);
|
task.IsHaveKeyFile = await _trialCriterionKeyFileRepository.AnyAsync(x => x.TrialCriterionId == task.TrialReadingCriterionId);
|
||||||
|
task.JudgeModeEnum = criterionInfo.JudgeModeEnum;
|
||||||
|
task.JudgeRuleEnum = criterionInfo.JudgeRuleEnum;
|
||||||
|
task.ArbitrationRule = criterionInfo.ArbitrationRule;
|
||||||
// 添加默认答案
|
// 添加默认答案
|
||||||
if (inDto.VisitTaskId == null && visitTaskInfo.ReadingTaskState != ReadingTaskState.HaveSigned)
|
if (inDto.VisitTaskId == null && visitTaskInfo.ReadingTaskState != ReadingTaskState.HaveSigned)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,198 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
#region 获取裁判阅片任务信息
|
#region 获取裁判阅片任务信息
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取单访视裁判答案
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<GetSingleVisitJudgeAnswerOutDto> GetSingleVisitJudgeAnswer(GetSingleVisitJudgeAnswerInDto inDto)
|
||||||
|
{
|
||||||
|
var judgeDataInfo = await _readingJudgeInfoRepository
|
||||||
|
.Where(x => x.JudgeTaskId == inDto.VisitTaskId)
|
||||||
|
.FirstNotNullAsync();
|
||||||
|
|
||||||
|
var taskIds = new List<Guid> { judgeDataInfo.TaskIdOne, judgeDataInfo.TaskIdTwo };
|
||||||
|
var readingTasks = await _visitTaskRepository
|
||||||
|
.Where(x => taskIds.Contains(x.Id))
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
x.Id,
|
||||||
|
x.ArmEnum,
|
||||||
|
x.TrialReadingCriterionId,
|
||||||
|
x.VisitTaskNum,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var r1Task = readingTasks.First(x => x.ArmEnum == Arm.DoubleReadingArm1);
|
||||||
|
var r2Task = readingTasks.First(x => x.ArmEnum == Arm.DoubleReadingArm2);
|
||||||
|
|
||||||
|
var judgeRule = await _readingQuestionCriterionTrialRepository
|
||||||
|
.Where(x => x.Id == r1Task.TrialReadingCriterionId)
|
||||||
|
.Select(x => x.JudgeRuleEnum)
|
||||||
|
.FirstNotNullAsync();
|
||||||
|
|
||||||
|
var displayQuestions = await GetJudgeDisplayQuestions(r1Task.TrialReadingCriterionId, r1Task.VisitTaskNum, judgeRule);
|
||||||
|
var judgeAnswers = displayQuestions
|
||||||
|
.Select(x => new SingleVisitJudgeAnswerItemDto
|
||||||
|
{
|
||||||
|
ReadingQuestionId = x.Id,
|
||||||
|
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||||
|
Type = x.Type,
|
||||||
|
TypeValue = x.TypeValue,
|
||||||
|
ShowOrder = x.ShowOrder,
|
||||||
|
QuestionGenre = x.QuestionGenre,
|
||||||
|
DictionaryCode = x.DictionaryCode,
|
||||||
|
Unit = x.Unit,
|
||||||
|
CustomUnit = x.CustomUnit,
|
||||||
|
ValueType = x.ValueType,
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var displayQuestionIds = judgeAnswers.Select(x => x.ReadingQuestionId).ToList();
|
||||||
|
var answerList = await _readingTaskQuestionAnswerRepository
|
||||||
|
.Where(x => taskIds.Contains(x.VisitTaskId) && displayQuestionIds.Contains(x.ReadingQuestionTrialId))
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
x.VisitTaskId,
|
||||||
|
x.ReadingQuestionTrialId,
|
||||||
|
x.Answer,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
judgeAnswers.ForEach(question =>
|
||||||
|
{
|
||||||
|
question.R1Answer = answerList.FirstOrDefault(x => x.VisitTaskId == r1Task.Id && x.ReadingQuestionTrialId == question.ReadingQuestionId)?.Answer ?? string.Empty;
|
||||||
|
question.R2Answer = answerList.FirstOrDefault(x => x.VisitTaskId == r2Task.Id && x.ReadingQuestionTrialId == question.ReadingQuestionId)?.Answer ?? string.Empty;
|
||||||
|
});
|
||||||
|
|
||||||
|
return new GetSingleVisitJudgeAnswerOutDto
|
||||||
|
{
|
||||||
|
R1VisitTaskId = r1Task.Id,
|
||||||
|
R2VisitTaskId = r2Task.Id,
|
||||||
|
QuestionList = judgeAnswers,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取裁判表单
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<GetJudgeFormOutDto> GetJudgeForm(GetJudgeFormInDto inDto)
|
||||||
|
{
|
||||||
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||||
|
var judgeRule = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskInfo.TrialReadingCriterionId).Select(x => x.JudgeRuleEnum).FirstNotNullAsync();
|
||||||
|
var questionList = await GetJudgeDisplayQuestions(taskInfo.TrialReadingCriterionId, taskInfo.VisitTaskNum, judgeRule);
|
||||||
|
var questionIds = questionList.Select(x => x.Id).ToList();
|
||||||
|
var answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && questionIds.Contains(x.ReadingQuestionTrialId)).ToListAsync();
|
||||||
|
|
||||||
|
return new GetJudgeFormOutDto
|
||||||
|
{
|
||||||
|
QuestionList = questionList.Select(x => new JudgeFormQuestionDto
|
||||||
|
{
|
||||||
|
ReadingQuestionId = x.Id,
|
||||||
|
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||||
|
Type = x.Type,
|
||||||
|
TypeValue = x.TypeValue,
|
||||||
|
ShowOrder = x.ShowOrder,
|
||||||
|
Answer = answers.FirstOrDefault(answer => answer.ReadingQuestionTrialId == x.Id)?.Answer ?? string.Empty,
|
||||||
|
QuestionGenre = x.QuestionGenre,
|
||||||
|
DictionaryCode = x.DictionaryCode,
|
||||||
|
Unit = x.Unit,
|
||||||
|
CustomUnit = x.CustomUnit,
|
||||||
|
ValueType = x.ValueType,
|
||||||
|
}).ToList(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编辑裁判表单
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IResponseOutput> SetJudgeForm(SetJudgeFormInDto inDto)
|
||||||
|
{
|
||||||
|
|
||||||
|
await SaveJudgeForm(inDto);
|
||||||
|
await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask()
|
||||||
|
{
|
||||||
|
JudgeResultRemark = inDto.JudgeResultRemark,
|
||||||
|
JudgeResultImagePath = string.Join(',', inDto.JudgeResultImagePathList),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return ResponseOutput.Result(await _readingTaskQuestionAnswerRepository.SaveChangesAsync());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task SaveJudgeForm(SetJudgeFormInDto inDto)
|
||||||
|
{
|
||||||
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||||
|
var judgeRule = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskInfo.TrialReadingCriterionId).Select(x => x.JudgeRuleEnum).FirstNotNullAsync();
|
||||||
|
var displayQuestionIds = (await GetJudgeDisplayQuestions(taskInfo.TrialReadingCriterionId, taskInfo.VisitTaskNum, judgeRule)).Select(x => x.Id).ToList();
|
||||||
|
var submittedQuestionIds = inDto.QuestionList.Select(x => x.ReadingQuestionId).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
await _readingTaskQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && submittedQuestionIds.Contains(x.ReadingQuestionTrialId));
|
||||||
|
if (inDto.QuestionList.Count > 0)
|
||||||
|
{
|
||||||
|
await _readingTaskQuestionAnswerRepository.AddRangeAsync(inDto.QuestionList.Select(x => new ReadingTaskQuestionAnswer
|
||||||
|
{
|
||||||
|
ReadingQuestionTrialId = x.ReadingQuestionId,
|
||||||
|
ReadingQuestionCriterionTrialId = taskInfo.TrialReadingCriterionId,
|
||||||
|
TrialId = taskInfo.TrialId,
|
||||||
|
SubjectId = taskInfo.SubjectId,
|
||||||
|
VisitTaskId = inDto.VisitTaskId,
|
||||||
|
Answer = x.Answer,
|
||||||
|
}).ToList());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 提交裁判表单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IResponseOutput> SubmitJudgeForm(SetJudgeFormInDto inDto)
|
||||||
|
{
|
||||||
|
|
||||||
|
await SaveJudgeForm(inDto);
|
||||||
|
await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask()
|
||||||
|
{
|
||||||
|
JudgeResultRemark = inDto.JudgeResultRemark,
|
||||||
|
ReadingTaskState = ReadingTaskState.HaveSigned,
|
||||||
|
SignTime=DateTime.Now,
|
||||||
|
JudgeResultImagePath = string.Join(',', inDto.JudgeResultImagePathList),
|
||||||
|
|
||||||
|
});
|
||||||
|
await _readingTaskQuestionAnswerRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
await SignatureAfter(inDto.VisitTaskId);
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task<List<ReadingQuestionTrial>> GetJudgeDisplayQuestions(Guid trialReadingCriterionId, decimal visitNum, JudgeRule judgeRule)
|
||||||
|
{
|
||||||
|
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.IsJudgeQuestion)
|
||||||
|
.Where(x=>x.ShowQuestion== ShowQuestion.Show)
|
||||||
|
.OrderBy(x => x.ShowOrder).ToListAsync();
|
||||||
|
var questionIds = questionList.Select(x => x.Id).ToList();
|
||||||
|
var visitJudgeRules = judgeRule == JudgeRule.Difference
|
||||||
|
? await _readingQuestionVisitJudgeRuleRepository.Where(x => questionIds.Contains(x.ReadingQuestionId) && (x.VisitNum == visitNum || x.VisitNum == -1)).ToListAsync()
|
||||||
|
: new List<ReadingQuestionVisitJudgeRule>();
|
||||||
|
|
||||||
|
return questionList.Where(x => !x.ExcludeShowVisitList.Contains(visitNum))
|
||||||
|
.Where(x => judgeRule == JudgeRule.Consistent
|
||||||
|
? x.JudgeType != JudgeTypeEnum.NotApplicable
|
||||||
|
: (visitJudgeRules.FirstOrDefault(rule => rule.ReadingQuestionId == x.Id && rule.VisitNum == visitNum)
|
||||||
|
?? visitJudgeRules.FirstOrDefault(rule => rule.ReadingQuestionId == x.Id && rule.VisitNum == -1))?.JudgeType != JudgeTypeEnum.NotApplicable)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取裁判阅片任务信息
|
/// 获取裁判阅片任务信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -476,8 +668,15 @@ namespace IRaCIS.Core.Application.Service
|
||||||
});
|
});
|
||||||
var result = await _visitTaskRepository.SaveChangesAsync();
|
var result = await _visitTaskRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
await SignatureAfter(inDto.VisitTaskId);
|
||||||
|
|
||||||
|
return ResponseOutput.Ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SignatureAfter(Guid visitTaskId)
|
||||||
|
{
|
||||||
// 需要判断是否添加肿瘤学任务
|
// 需要判断是否添加肿瘤学任务
|
||||||
var taskInfo = await _visitTaskRepository.Where(x => x.JudgeVisitTaskId == inDto.VisitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
var taskInfo = await _visitTaskRepository.Where(x => x.JudgeVisitTaskId == visitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
||||||
|
|
||||||
if (taskInfo.ReadingCategory == ReadingCategory.Visit)
|
if (taskInfo.ReadingCategory == ReadingCategory.Visit)
|
||||||
{
|
{
|
||||||
|
|
@ -514,11 +713,9 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
// 创建任务关联关系
|
// 创建任务关联关系
|
||||||
await this.CreateTaskRelated(inDto.VisitTaskId);
|
await this.CreateTaskRelated(visitTaskId);
|
||||||
|
|
||||||
await SafeMailHelper.Run(async () => await _trialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(inDto.VisitTaskId));
|
await SafeMailHelper.Run(async () => await _trialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(visitTaskId));
|
||||||
|
|
||||||
return ResponseOutput.Ok(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -624,6 +821,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
x.ArbitrationRule,
|
x.ArbitrationRule,
|
||||||
x.IsGlobalReading,
|
x.IsGlobalReading,
|
||||||
x.IsReadingPeriod,
|
x.IsReadingPeriod,
|
||||||
|
x.JudgeRuleEnum,
|
||||||
}).FirstNotNullAsync();
|
}).FirstNotNullAsync();
|
||||||
|
|
||||||
var noteEqual = false;
|
var noteEqual = false;
|
||||||
|
|
@ -667,6 +865,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
VisitTaskId = questionAnswer.VisitTaskId,
|
VisitTaskId = questionAnswer.VisitTaskId,
|
||||||
};
|
};
|
||||||
var globalVisitAnswerlist = await globalVisitQuestionQuery.ToListAsync();
|
var globalVisitAnswerlist = await globalVisitQuestionQuery.ToListAsync();
|
||||||
|
await ApplyVisitJudgeRules(globalVisitAnswerlist, criterionInfo.JudgeRuleEnum);
|
||||||
|
|
||||||
var taskNums = globalVisitAnswerlist.Select(x => x.VisitTaskNum).Distinct().OrderBy(x => x).ToList();
|
var taskNums = globalVisitAnswerlist.Select(x => x.VisitTaskNum).Distinct().OrderBy(x => x).ToList();
|
||||||
|
|
||||||
|
|
@ -697,11 +896,13 @@ namespace IRaCIS.Core.Application.Service
|
||||||
AnswerCombination = question.AnswerCombination,
|
AnswerCombination = question.AnswerCombination,
|
||||||
JudgeType = question.JudgeType,
|
JudgeType = question.JudgeType,
|
||||||
QuestionId = question.Id,
|
QuestionId = question.Id,
|
||||||
JudgeDifferenceValue = question.JudgeDifferenceValue,
|
JudgeDifferenceValue = question.JudgeDifferenceValue,
|
||||||
JudgeDifferenceType = question.JudgeDifferenceType,
|
JudgeDifferenceType = question.JudgeDifferenceType,
|
||||||
VisitTaskId = questionAnswet.VisitTaskId,
|
VisitTaskId = questionAnswet.VisitTaskId,
|
||||||
};
|
VisitTaskNum = questionAnswet.VisitTask.VisitTaskNum,
|
||||||
|
};
|
||||||
var questionAnswerlist = await query.ToListAsync();
|
var questionAnswerlist = await query.ToListAsync();
|
||||||
|
await ApplyVisitJudgeRules(questionAnswerlist, criterionInfo.JudgeRuleEnum);
|
||||||
|
|
||||||
// 将答案进行分组
|
// 将答案进行分组
|
||||||
List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new { x.JudgeDifferenceValue, x.JudgeDifferenceType, 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
|
||||||
|
|
@ -749,6 +950,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
await ApplyVisitJudgeRules(item.AfterQuestionList, item.VisitNum, criterionInfo.JudgeRuleEnum);
|
||||||
|
await ApplyVisitJudgeRules(twoItem.AfterQuestionList, twoItem.VisitNum, criterionInfo.JudgeRuleEnum);
|
||||||
var newlist = item.AfterQuestionList.Where(x => x.QuestionId != null && x.IsJudgeQuestion).ToList().Union(
|
var newlist = item.AfterQuestionList.Where(x => x.QuestionId != null && x.IsJudgeQuestion).ToList().Union(
|
||||||
twoItem.AfterQuestionList.Where(x => x.QuestionId != null && x.IsJudgeQuestion).ToList()
|
twoItem.AfterQuestionList.Where(x => x.QuestionId != null && x.IsJudgeQuestion).ToList()
|
||||||
).ToList();
|
).ToList();
|
||||||
|
|
@ -811,6 +1014,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
};
|
};
|
||||||
|
|
||||||
var visitTaskQuestions = await query.ToListAsync();
|
var visitTaskQuestions = await query.ToListAsync();
|
||||||
|
await ApplyVisitJudgeRules(visitTaskQuestions, lastTask.VisitNum, criterionInfo.JudgeRuleEnum);
|
||||||
|
await ApplyVisitJudgeRules(lastTask.AfterQuestionList, lastTask.VisitNum, criterionInfo.JudgeRuleEnum);
|
||||||
|
|
||||||
var newlist = visitTaskQuestions.Where(x => x.QuestionId != null).ToList().Union(
|
var newlist = visitTaskQuestions.Where(x => x.QuestionId != null).ToList().Union(
|
||||||
lastTask.AfterQuestionList.Where(x => x.QuestionId != null).ToList()
|
lastTask.AfterQuestionList.Where(x => x.QuestionId != null).ToList()
|
||||||
|
|
@ -929,6 +1134,102 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 应用访视裁判规则 以及剔除排除的问题
|
||||||
|
/// </summary>
|
||||||
|
private async Task ApplyVisitJudgeRules(List<TaskAnswerDto> answerList, JudgeRule judgeRule)
|
||||||
|
{
|
||||||
|
if (answerList.Count == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var questionIds = answerList.Select(x => x.QuestionId).Distinct().ToList();
|
||||||
|
var questions = await _readingQuestionTrialRepository.Where(x => questionIds.Contains(x.Id)).Select(x => new
|
||||||
|
{
|
||||||
|
x.Id,
|
||||||
|
x.ExcludeShowVisitList,
|
||||||
|
}).ToListAsync();
|
||||||
|
var excludedQuestionIds = answerList
|
||||||
|
.Where(x => questions.FirstOrDefault(question => question.Id == x.QuestionId)?.ExcludeShowVisitList.Contains(x.VisitTaskNum) == true)
|
||||||
|
.Select(x => x.QuestionId)
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
answerList.RemoveAll(x => excludedQuestionIds.Contains(x.QuestionId));
|
||||||
|
|
||||||
|
if (judgeRule != JudgeRule.Difference || answerList.Count == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
questionIds = answerList.Select(x => x.QuestionId).Distinct().ToList();
|
||||||
|
var visitNums = answerList.Select(x => x.VisitTaskNum).Distinct().ToList();
|
||||||
|
var visitRules = await _readingQuestionVisitJudgeRuleRepository
|
||||||
|
.Where(x => questionIds.Contains(x.ReadingQuestionId) && (visitNums.Contains(x.VisitNum) || x.VisitNum == -1))
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
answerList.ForEach(answer =>
|
||||||
|
{
|
||||||
|
var rule = visitRules.FirstOrDefault(x => x.ReadingQuestionId == answer.QuestionId && x.VisitNum == answer.VisitTaskNum)
|
||||||
|
?? visitRules.FirstOrDefault(x => x.ReadingQuestionId == answer.QuestionId && x.VisitNum == -1);
|
||||||
|
if (rule != null)
|
||||||
|
{
|
||||||
|
answer.AnswerGroup = JsonConvert.SerializeObject(rule.AnswerGroup);
|
||||||
|
answer.AnswerCombination = JsonConvert.SerializeObject(rule.AnswerCombination);
|
||||||
|
answer.JudgeType = rule.JudgeType;
|
||||||
|
answer.JudgeDifferenceValue = rule.JudgeDifferenceValue;
|
||||||
|
answer.JudgeDifferenceType = rule.JudgeDifferenceType;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 应用访视裁判规则 以及剔除排除的问题
|
||||||
|
/// </summary>
|
||||||
|
private async Task ApplyVisitJudgeRules(List<GlobalQuestionInfo> questionList, decimal visitNum, JudgeRule judgeRule)
|
||||||
|
{
|
||||||
|
if (questionList.Count == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var questionIds = questionList.Where(x => x.QuestionId != null).Select(x => x.QuestionId!.Value).Distinct().ToList();
|
||||||
|
var excludedQuestionIds = await _readingQuestionTrialRepository
|
||||||
|
.Where(x => questionIds.Contains(x.Id) && x.ExcludeShowVisitList.Contains(visitNum))
|
||||||
|
.Select(x => x.Id)
|
||||||
|
.ToListAsync();
|
||||||
|
questionList.RemoveAll(x => x.QuestionId != null && excludedQuestionIds.Contains(x.QuestionId.Value));
|
||||||
|
|
||||||
|
if (judgeRule != JudgeRule.Difference || questionList.Count == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
questionIds = questionList.Where(x => x.QuestionId != null).Select(x => x.QuestionId!.Value).Distinct().ToList();
|
||||||
|
var visitRules = await _readingQuestionVisitJudgeRuleRepository
|
||||||
|
.Where(x => questionIds.Contains(x.ReadingQuestionId) && (x.VisitNum == visitNum || x.VisitNum == -1))
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
questionList.ForEach(question =>
|
||||||
|
{
|
||||||
|
if (question.QuestionId == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rule = visitRules.FirstOrDefault(x => x.ReadingQuestionId == question.QuestionId && x.VisitNum == visitNum)
|
||||||
|
?? visitRules.FirstOrDefault(x => x.ReadingQuestionId == question.QuestionId && x.VisitNum == -1);
|
||||||
|
if (rule != null)
|
||||||
|
{
|
||||||
|
question.AnswerGroup = JsonConvert.SerializeObject(rule.AnswerGroup);
|
||||||
|
question.AnswerCombination = JsonConvert.SerializeObject(rule.AnswerCombination);
|
||||||
|
question.JudgeType = rule.JudgeType;
|
||||||
|
question.JudgeDifferenceValue = rule.JudgeDifferenceValue;
|
||||||
|
question.JudgeDifferenceType = rule.JudgeDifferenceType;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发送微信通知
|
/// 发送微信通知
|
||||||
|
|
|
||||||
|
|
@ -457,10 +457,13 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
[NotDefault]
|
[NotDefault]
|
||||||
public Guid TrialSiteSurveyId { get; set; }
|
public Guid TrialSiteSurveyId { get; set; }
|
||||||
|
|
||||||
|
public Guid? Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SiteSurveyLogDTO
|
public class SiteSurveyLogDTO
|
||||||
{
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
public Guid TrialSiteSurveyId { get; set; }
|
public Guid TrialSiteSurveyId { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -661,7 +661,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
//找到最新的调研表
|
//找到最新的调研表
|
||||||
|
|
||||||
var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.TrialSiteId == userInfo.TrialSiteId, true)
|
var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.TrialSiteId == userInfo.TrialSiteId, true)
|
||||||
.Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync();
|
.Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).Include(t => t.SiteSurveyLogList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync();
|
||||||
|
|
||||||
if (currentLatest == null)
|
if (currentLatest == null)
|
||||||
{
|
{
|
||||||
|
|
@ -688,7 +688,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新调研表日志 - 老的调研表
|
//更新调研表日志 - 老的调研表
|
||||||
currentLatest.SiteSurveyLogList.Add(new SiteSurveyLog() { Name = userInfo.ReplaceUserEmailOrPhone, OptType = SiteSurveyOptTyp.Over });
|
//currentLatest.SiteSurveyLogList.Add(new SiteSurveyLog() { Name = userInfo.ReplaceUserEmailOrPhone, OptType = SiteSurveyOptTyp.Over });
|
||||||
|
|
||||||
var copy = currentLatest.Clone();
|
var copy = currentLatest.Clone();
|
||||||
|
|
||||||
|
|
@ -707,6 +707,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
copy.Phone = String.Empty;
|
copy.Phone = String.Empty;
|
||||||
|
|
||||||
//更新调研表日志
|
//更新调研表日志
|
||||||
|
|
||||||
var info = await GetSiteSurveyInfo(currentLatest.Id, currentLatest.TrialId);
|
var info = await GetSiteSurveyInfo(currentLatest.Id, currentLatest.TrialId);
|
||||||
copy.SiteSurveyLogList.Add(new SiteSurveyLog() { Name = userInfo.ReplaceUserEmailOrPhone, OptType = SiteSurveyOptTyp.Update, OriginTrialSiteSurveyId = currentLatest.Id, Json = info.ToJsonStr() });
|
copy.SiteSurveyLogList.Add(new SiteSurveyLog() { Name = userInfo.ReplaceUserEmailOrPhone, OptType = SiteSurveyOptTyp.Update, OriginTrialSiteSurveyId = currentLatest.Id, Json = info.ToJsonStr() });
|
||||||
}
|
}
|
||||||
|
|
@ -1455,7 +1456,9 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<List<SiteSurveyLogDTO>> GetSiteSurveyLogList(SiteSurveyLogQuery inQuery)
|
public async Task<List<SiteSurveyLogDTO>> GetSiteSurveyLogList(SiteSurveyLogQuery inQuery)
|
||||||
{
|
{
|
||||||
return _siteSurveyLogRepository.Where(t => t.TrialSiteSurveyId == inQuery.TrialSiteSurveyId).ProjectTo<SiteSurveyLogDTO>(_mapper.ConfigurationProvider).ToList();
|
return _siteSurveyLogRepository.Where(t => t.TrialSiteSurveyId == inQuery.TrialSiteSurveyId)
|
||||||
|
.WhereIf(inQuery.Id != null, t => t.Id == inQuery.Id)
|
||||||
|
.ProjectTo<SiteSurveyLogDTO>(_mapper.ConfigurationProvider).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1467,7 +1470,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
public async Task<IResponseOutput> GetSiteSurveyEquipmentList(SiteSurveyEquipmentQuery inQuery)
|
public async Task<IResponseOutput> GetSiteSurveyEquipmentList(SiteSurveyEquipmentQuery inQuery)
|
||||||
{
|
{
|
||||||
var pageList = await _trialSiteEquipmentSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == inQuery.TrialId)
|
var pageList = await _trialSiteEquipmentSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == inQuery.TrialId)
|
||||||
.WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteSurvey.TrialSiteId==inQuery.TrialSiteId)
|
.WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteSurvey.TrialSiteId == inQuery.TrialSiteId)
|
||||||
.WhereIf(inQuery.TrialSiteCode.IsNotNullOrEmpty(), t => t.TrialSiteSurvey.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode))
|
.WhereIf(inQuery.TrialSiteCode.IsNotNullOrEmpty(), t => t.TrialSiteSurvey.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode))
|
||||||
.WhereIf(inQuery.TrialSiteName.IsNotNullOrEmpty(), t => t.TrialSiteSurvey.TrialSite.TrialSiteAliasName.Contains(inQuery.TrialSiteName) ||
|
.WhereIf(inQuery.TrialSiteName.IsNotNullOrEmpty(), t => t.TrialSiteSurvey.TrialSite.TrialSiteAliasName.Contains(inQuery.TrialSiteName) ||
|
||||||
t.TrialSiteSurvey.TrialSite.TrialSiteName.Contains(inQuery.TrialSiteName))
|
t.TrialSiteSurvey.TrialSite.TrialSiteName.Contains(inQuery.TrialSiteName))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue