修改一版
parent
a9b161783b
commit
070ef85418
|
@ -57,6 +57,9 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public string ChildInvalidValue { get; set; } = String.Empty;
|
||||
public int ShowOrder { get; set; }
|
||||
|
||||
|
||||
public string ParentTriggerValue { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public class TrialQCQuestionConfigureBatchAdd
|
||||
{
|
||||
|
||||
public Guid Id { get; set; }
|
||||
public string QuestionName { get; set; } = string.Empty;
|
||||
public bool IsRequired { get; set; }
|
||||
public bool IsEnable { get; set; }
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace IRaCIS.Core.Application.Contracts
|
||||
|
@ -19,6 +20,68 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public QCQuestionConfigureService(IRepository<QCQuestion> qcQuestionRepository)
|
||||
{
|
||||
_qcQuestionRepository = qcQuestionRepository;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 父问题 下拉框选项 需要排除自己 、把自己设置为父亲 (互为父亲) 、是自己孙辈的(明明是自己子孙,却设置为自己父亲)
|
||||
/// </summary>
|
||||
/// <param name="trialQCQuestionFilterSelect"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<TrialQCQuestionSelect>> GetQCQuestionSelectList(TrialQCQuestionFilterSelect trialQCQuestionFilterSelect)
|
||||
{
|
||||
|
||||
//设置父亲的时候,不允许设置为自己的孙子 这种会形成环
|
||||
|
||||
var initList = await _qcQuestionRepository
|
||||
.WhereIf(trialQCQuestionFilterSelect.TypeArray.Count() > 0, t => trialQCQuestionFilterSelect.TypeArray.Contains(t.Type))
|
||||
//.WhereIf(trialQCQuestionFilterSelect.Id != null, t => t.Id != trialQCQuestionFilterSelect.Id /*&& t.ParentId != trialQCQuestionFilterSelect.Id*/)
|
||||
.OrderBy(t => t.ShowOrder).Select(x=>new TrialQCQuestionSelect() {
|
||||
ShowOrder=x.ShowOrder,
|
||||
Id=x.Id,
|
||||
ParentId=x.ParentId,
|
||||
QuestionName=x.QuestionName,
|
||||
TypeValue=x.TypeValue,
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
//父亲的序号肯定要比自己小
|
||||
if (trialQCQuestionFilterSelect.Id != null)
|
||||
{
|
||||
var selectItem = initList.FirstOrDefault(t => t.Id == trialQCQuestionFilterSelect.Id);
|
||||
|
||||
initList = initList.WhereIf(selectItem != null, t => t.Id != selectItem!.Id && t.ShowOrder < selectItem.ShowOrder).ToList();
|
||||
}
|
||||
|
||||
|
||||
var exceptList = GetChildId(trialQCQuestionFilterSelect.Id ?? Guid.Empty, initList);
|
||||
|
||||
|
||||
return initList.Where(t => !exceptList.Contains(t.Id)).ToList();
|
||||
}
|
||||
|
||||
private List<Guid> GetChildId(Guid parentId, List<TrialQCQuestionSelect> list)
|
||||
{
|
||||
|
||||
var ids = new List<Guid>();
|
||||
|
||||
var childIds = list.Where(t => t.ParentId == parentId).Select(t => t.Id).ToList();
|
||||
|
||||
foreach (var childId in childIds)
|
||||
{
|
||||
ids.AddRange(childId);
|
||||
|
||||
var childs = GetChildId(childId, list);
|
||||
|
||||
ids.AddRange(childs);
|
||||
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,6 +109,10 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
[HttpDelete("{qCQuestionConfigureId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteQCQuestionConfigure(Guid qCQuestionConfigureId)
|
||||
{
|
||||
if (await _qcQuestionRepository.AnyAsync(x => x.ParentId == qCQuestionConfigureId))
|
||||
{
|
||||
throw new BusinessValidationFailedException("当前任务存在子问题,删除失败");
|
||||
}
|
||||
var success = await _qcQuestionRepository.BatchDeleteNoTrackingAsync(t => t.Id == qCQuestionConfigureId);
|
||||
return ResponseOutput.Result(success);
|
||||
}
|
||||
|
|
|
@ -19,10 +19,15 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public class TrialQCQuestionConfigureService : BaseService, ITrialQCQuestionConfigureService
|
||||
{
|
||||
private readonly IRepository<TrialQCQuestion> _trialQcQuestionRepository;
|
||||
private readonly IRepository<QCQuestion> _qCQuestionRepository;
|
||||
|
||||
public TrialQCQuestionConfigureService(IRepository<TrialQCQuestion> trialQcQuestionRepository)
|
||||
public TrialQCQuestionConfigureService(
|
||||
IRepository<TrialQCQuestion> trialQcQuestionRepository,
|
||||
IRepository<QCQuestion> qCQuestionRepository
|
||||
)
|
||||
{
|
||||
_trialQcQuestionRepository = trialQcQuestionRepository;
|
||||
this._qCQuestionRepository = qCQuestionRepository;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -190,7 +190,6 @@ namespace IRaCIS.Application.Services
|
|||
x.EvaluationResult = oncologyData.EvaluationResult;
|
||||
x.EvaluationReason = oncologyData.EvaluationReason;
|
||||
}
|
||||
|
||||
x.QuestionList = globalTaskReadingInfo.TaskList.Where(y => x.VisitTaskId == y.VisitTaskId).SelectMany(y => y.AfterQuestionList).Where(x => x.QuestionId != null)
|
||||
.Select(y => new OncologyQuestion
|
||||
{
|
||||
|
@ -198,10 +197,6 @@ namespace IRaCIS.Application.Services
|
|||
QuestionName = y.QuestionName,
|
||||
Answer = y.Answer
|
||||
}).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
x.IsHaveChange = globalTaskReadingInfo.TaskList.Where(y => x.VisitTaskId == y.VisitTaskId).SelectMany(y => y.AfterQuestionList).Any(y => y.IsHaveChange);
|
||||
x.VisitRemark = globalTaskReadingInfo.TaskList.Where(y => x.VisitTaskId == y.VisitTaskId).SelectMany(y => y.AfterQuestionList).Where(y => y.QuestionId == null).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
|
||||
|
||||
|
|
|
@ -99,8 +99,11 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
public bool? IsConfirm { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 系统的问题ID
|
||||
/// </summary>
|
||||
public Guid? SystemQuestionId { get; set; }
|
||||
|
||||
public List<TrialQCQuestionAnswer> TrialQCQuestionAnswerList { get; set; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue