diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCQuestionConfigureViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCQuestionConfigureViewModel.cs
index ca65bffb8..3ce7d3012 100644
--- a/IRaCIS.Core.Application/Service/QC/DTO/QCQuestionConfigureViewModel.cs
+++ b/IRaCIS.Core.Application/Service/QC/DTO/QCQuestionConfigureViewModel.cs
@@ -7,6 +7,37 @@ using System;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.Contracts
{
+
+ ///
+ ///
+ ///
+ public class QCQuestionViewInDto
+ {
+ public Guid? TrialId { get; set; }
+ }
+
+ public class QCQuestionView
+ {
+ public Guid Id { get; set; }
+ public string QuestionName { get; set; } = String.Empty;
+ public bool IsRequired { get; set; }
+ public bool IsEnable { get; set; }
+ public string Type { get; set; } = String.Empty;
+ public string ParentTriggerValue { get; set; }
+ public Guid? ParentId { get; set; }
+ public string TypeValue { get; set; } = String.Empty;
+ public int ShowOrder { get; set; }
+
+ public int? ParentShowOrder { get; set; }
+ public Guid CreateUserId { get; set; }
+ public DateTime CreateTime { get; set; }
+ public DateTime UpdateTime { get; set; }
+ public Guid UpdateUserId { get; set; }
+
+
+ public List ChildList=new List();
+ }
+
/// QCQuestionConfigureView 列表视图模型
public class QCQuestionConfigureView
{
diff --git a/IRaCIS.Core.Application/Service/QC/QCQuestionService.cs b/IRaCIS.Core.Application/Service/QC/QCQuestionService.cs
index 5ad2c4e84..52fc93a3e 100644
--- a/IRaCIS.Core.Application/Service/QC/QCQuestionService.cs
+++ b/IRaCIS.Core.Application/Service/QC/QCQuestionService.cs
@@ -16,13 +16,15 @@ namespace IRaCIS.Core.Application.Contracts
public class QCQuestionConfigureService : BaseService, IQCQuestionService
{
private readonly IRepository _qcQuestionRepository;
+ private readonly IRepository _trialQCQuestionRepository;
- public QCQuestionConfigureService(IRepository qcQuestionRepository)
+ public QCQuestionConfigureService(IRepository qcQuestionRepository,
+ IRepository trialQCQuestionRepository
+
+ )
{
_qcQuestionRepository = qcQuestionRepository;
-
-
-
+ this._trialQCQuestionRepository = trialQCQuestionRepository;
}
@@ -39,14 +41,14 @@ namespace IRaCIS.Core.Application.Contracts
var initList = await _qcQuestionRepository
.WhereIf(trialQCQuestionFilterSelect.TypeArray.Count() > 0, t => trialQCQuestionFilterSelect.TypeArray.Contains(t.Type))
-
- .OrderBy(t => t.ShowOrder).Select(x=>new TrialQCQuestionSelect() {
- ShowOrder=x.ShowOrder,
- Id=x.Id,
- ParentId=x.ParentId,
- QuestionName=x.QuestionName,
- TypeValue=x.TypeValue,
-
+ .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();
//父亲的序号肯定要比自己小
@@ -92,7 +94,7 @@ namespace IRaCIS.Core.Application.Contracts
var QCQuestionQueryable = _qcQuestionRepository
.WhereIf(!string.IsNullOrWhiteSpace(queryQCQuestionConfigure.QuestionName), t => t.QuestionName.Contains(queryQCQuestionConfigure.QuestionName))
.WhereIf(!string.IsNullOrWhiteSpace(queryQCQuestionConfigure.Type), t => t.Type.Contains(queryQCQuestionConfigure.Type))
- .WhereIf(queryQCQuestionConfigure.IsEnable!=null, t => t.IsEnable==queryQCQuestionConfigure.IsEnable)
+ .WhereIf(queryQCQuestionConfigure.IsEnable != null, t => t.IsEnable == queryQCQuestionConfigure.IsEnable)
.ProjectTo(_mapper.ConfigurationProvider);
return await QCQuestionQueryable.ToListAsync();
@@ -118,5 +120,53 @@ namespace IRaCIS.Core.Application.Contracts
}
+ ///
+ /// 获取问题预览
+ ///
+ ///
+ ///
+ /// 传TrialId为获取项目的
+ /// 不传为获取系统的
+ ///
+ ///
+ public async Task> GetQuestionView(QCQuestionViewInDto inDto)
+ {
+ var question = new List();
+ if (inDto.TrialId== null)
+ {
+ question = await _trialQCQuestionRepository.Where(x => x.TrialId == inDto.TrialId).OrderBy(x => x.ShowOrder).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
+ }
+ else
+ {
+ question=await _qcQuestionRepository.AsQueryable().OrderBy(x => x.ShowOrder).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
+ }
+
+
+ var result = question.Where(x => x.ParentId == null).ToList();
+ result.ForEach(x => {
+ GetQuestionChild(x, question);
+ });
+
+ return result;
+ }
+
+
+
+ public void GetQuestionChild(QCQuestionView parent, List dataList)
+ {
+ parent.ChildList = dataList.Where(x => x.ParentId == parent.Id).ToList();
+
+ if (parent.ChildList.Count != 0)
+ {
+ parent.ChildList.ForEach(x =>
+ {
+ GetQuestionChild(x, dataList);
+ });
+ }
+
+
+ }
+
+
}
}
diff --git a/IRaCIS.Core.Application/Service/QC/TrialQCQuestionService.cs b/IRaCIS.Core.Application/Service/QC/TrialQCQuestionService.cs
index 5ce65b301..43e847dcf 100644
--- a/IRaCIS.Core.Application/Service/QC/TrialQCQuestionService.cs
+++ b/IRaCIS.Core.Application/Service/QC/TrialQCQuestionService.cs
@@ -79,7 +79,7 @@ namespace IRaCIS.Core.Application.Contracts
var initList = await _trialQcQuestionRepository.Where(t => t.TrialId == trialQCQuestionFilterSelect.TrialId)
.WhereIf(trialQCQuestionFilterSelect.TypeArray.Count() > 0, t => trialQCQuestionFilterSelect.TypeArray.Contains(t.Type))
- //.WhereIf(trialQCQuestionFilterSelect.Id != null, t => t.Id != trialQCQuestionFilterSelect.Id /*&& t.ParentId != trialQCQuestionFilterSelect.Id*/)
+ .WhereIf(trialQCQuestionFilterSelect.Id != null, t => t.Id != trialQCQuestionFilterSelect.Id && t.ParentId != trialQCQuestionFilterSelect.Id)
.OrderBy(t => t.ShowOrder).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
//父亲的序号肯定要比自己小
diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs
index 498c7edff..a47059d52 100644
--- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs
@@ -61,6 +61,9 @@ namespace IRaCIS.Core.Application.Service
CreateMap();
+ CreateMap();
+ CreateMap();
+
CreateMap()
.ForMember(d => d.ParentShowOrder, u => u.MapFrom(s => s.ParentQuestion.ShowOrder)); ;