修改一版
parent
e0913805d4
commit
7bd240eb5b
|
@ -54,6 +54,12 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
/// 任务类型
|
||||
/// </summary>
|
||||
public ReadingCategory ReadingCategory { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int? ParentShowOrder { get; set; }
|
||||
}
|
||||
|
||||
///<summary>ReadingMedicineSystemQuestionQuery 列表查询参数模型</summary>
|
||||
|
@ -95,6 +101,11 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
|
||||
public class TrialDataFromSystem : ReadingMedicineTrialQuestion
|
||||
{
|
||||
public Guid SystemQuestionId { get; set; }
|
||||
}
|
||||
public class AddTrialDataFromSystemInDto
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
@ -123,6 +134,21 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
public ReadingCategory ReadingCategory { get; set; }
|
||||
}
|
||||
|
||||
public class GetReadingMedicineSystemOtherQuestionInDto
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
|
||||
|
||||
public int? ShowOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务类型
|
||||
/// </summary>
|
||||
public ReadingCategory? ReadingCategory { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目的其他问题
|
||||
/// </summary>
|
||||
|
|
|
@ -52,6 +52,35 @@ namespace IRaCIS.Core.Application.Service
|
|||
return await query.ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统的其他医学审核问题
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<GetReadingMedicineTrialOtherQuestionOutDto>> GetReadingMedicineSystemOtherQuestion(GetReadingMedicineSystemOtherQuestionInDto inDto)
|
||||
{
|
||||
var types = new List<string>()
|
||||
{
|
||||
"select","radio"
|
||||
};
|
||||
|
||||
var questionList = await _readingMedicineSystemQuestionRepository
|
||||
.Where(x => types.Contains(x.Type))
|
||||
.WhereIf(inDto.Id != null, x => x.Id != inDto.Id && x.ParentId != inDto.Id)
|
||||
.WhereIf(inDto.ShowOrder != null, x => x.ShowOrder < inDto.ShowOrder)
|
||||
.WhereIf(inDto.ReadingCategory != null, x => x.ReadingCategory == inDto.ReadingCategory)
|
||||
.Select(x => new GetReadingMedicineTrialOtherQuestionOutDto()
|
||||
{
|
||||
Id = x.Id,
|
||||
QuestionName = x.QuestionName,
|
||||
TypeValue = x.TypeValue,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
}).ToListAsync();
|
||||
|
||||
return questionList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增或修改系统医学审核问题
|
||||
/// </summary>
|
||||
|
@ -218,7 +247,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
var maxOrder = await _readingMedicineTrialQuestionRepository.Where(x => x.TrialId == inDto.TrialId).OrderByDescending(x => x.ShowOrder).Select(x => x.ShowOrder).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
var needList= systemList.Select(x => new ReadingMedicineTrialQuestion()
|
||||
var needList= systemList.Select(x => new TrialDataFromSystem()
|
||||
{
|
||||
Id = NewId.NextGuid(),
|
||||
ShowOrder = x.ShowOrder,
|
||||
|
@ -226,6 +255,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
IsRequired = x.IsRequired,
|
||||
QuestionName = x.QuestionName,
|
||||
Type = x.Type,
|
||||
ParentId=x.ParentId,
|
||||
SystemQuestionId=x.Id,
|
||||
ReadingCategory=x.ReadingCategory,
|
||||
TypeValue = x.TypeValue,
|
||||
TrialId=inDto.TrialId,
|
||||
|
@ -235,7 +266,21 @@ namespace IRaCIS.Core.Application.Service
|
|||
x.ShowOrder = maxOrder++;
|
||||
});
|
||||
|
||||
await _readingMedicineTrialQuestionRepository.AddRangeAsync(needList);
|
||||
foreach (var item in needList.Where(x => x.ParentId != null))
|
||||
{
|
||||
var parent = needList.Where(x => x.SystemQuestionId == item.ParentId).FirstOrDefault();
|
||||
if (parent == null)
|
||||
{
|
||||
item.ParentId = null;
|
||||
item.ParentTriggerValue = String.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.ParentId = parent.Id;
|
||||
}
|
||||
}
|
||||
|
||||
await _readingMedicineTrialQuestionRepository.AddRangeAsync(needList);
|
||||
var result = await _readingMedicineTrialQuestionRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Result(result);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
#region 医学审核
|
||||
CreateMap<ReadingMedicineSystemQuestionAddOrEdit, ReadingMedicineSystemQuestion>();
|
||||
CreateMap<ReadingMedicineSystemQuestion, ReadingMedicineSystemQuestionView>();
|
||||
CreateMap<ReadingMedicineSystemQuestion, ReadingMedicineSystemQuestionView>()
|
||||
.ForMember(x => x.ParentShowOrder, y => y.MapFrom(n => n.ParentQuestion.ShowOrder));
|
||||
|
||||
|
||||
CreateMap<TrialDataFromSystem, ReadingMedicineTrialQuestion>();
|
||||
|
||||
CreateMap<ReadingMedicineTrialQuestionAddOrEdit, ReadingMedicineTrialQuestion>();
|
||||
CreateMap<ReadingMedicineTrialQuestion, ReadingMedicineTrialQuestionView>()
|
||||
|
|
|
@ -81,5 +81,8 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
public ReadingCategory ReadingCategory { get; set; }
|
||||
|
||||
[ForeignKey("ParentId")]
|
||||
public ReadingMedicineTrialQuestion ParentQuestion { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue