医生审核问题一件添加
parent
12b668642c
commit
e5d08cdb3e
|
@ -91,7 +91,16 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
{
|
||||
public Guid SystemQuestionId { get; set; }
|
||||
}
|
||||
public class AddTrialDataFromSystemInDto
|
||||
|
||||
public class AddDefaultQuestionsInDto
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public Guid TrialReadingCriterionId { get; set; }
|
||||
}
|
||||
|
||||
public class AddTrialDataFromSystemInDto
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ using IRaCIS.Core.Infrastructure;
|
|||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using System.Linq.Dynamic.Core;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
@ -491,13 +493,86 @@ namespace IRaCIS.Core.Application.Service
|
|||
return ResponseOutput.Result(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 一键添加默认医学审核问题
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> AddDefaultQuestions(AddDefaultQuestionsInDto inDto)
|
||||
{
|
||||
if (await _readingMedicineTrialQuestionRepository.AnyAsync(x => x.TrialReadingCriterionId == inDto.TrialReadingCriterionId))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["Medicine_ExistsMedicineQuestion"]);
|
||||
}
|
||||
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
List<ReadingCategory> needAddCategory = new List<ReadingCategory>() { ReadingCategory.Visit };
|
||||
if(criterionInfo.IsReadingPeriod)
|
||||
{
|
||||
needAddCategory.Add(ReadingCategory.Global);
|
||||
}
|
||||
if (criterionInfo.IsArbitrationReading)
|
||||
{
|
||||
needAddCategory.Add(ReadingCategory.Judge);
|
||||
}
|
||||
if (criterionInfo.IsOncologyReading)
|
||||
{
|
||||
needAddCategory.Add(ReadingCategory.Oncology);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从系统里面选择问题添加到项目里面
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
var maxOrder = await _readingMedicineTrialQuestionRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == inDto.TrialReadingCriterionId).OrderByDescending(x => x.ShowOrder).Select(x => x.ShowOrder).FirstOrDefaultAsync();
|
||||
List<TrialDataFromSystem> needList = await _readingMedicineSystemQuestionRepository
|
||||
.WhereIf(_userInfo.IsEn_Us, x => x.LanguageType == LanguageType.English)
|
||||
.WhereIf(!_userInfo.IsEn_Us, x => x.LanguageType == LanguageType.Chinese)
|
||||
.Where(x => x.CriterionTypeEnum == criterionInfo.CriterionType && needAddCategory.Contains(x.ReadingCategory))
|
||||
.Select(x => new TrialDataFromSystem()
|
||||
{
|
||||
Id = NewId.NextGuid(),
|
||||
ShowOrder = x.ShowOrder,
|
||||
IsEnable = x.IsEnable,
|
||||
LanguageType = x.LanguageType,
|
||||
IsRequired = x.IsRequired,
|
||||
QuestionName = x.QuestionName,
|
||||
TrialReadingCriterionId = inDto.TrialReadingCriterionId,
|
||||
Type = x.Type,
|
||||
ParentId = x.ParentId,
|
||||
SystemQuestionId = x.Id,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
TypeValue = x.TypeValue,
|
||||
TrialId = inDto.TrialId,
|
||||
}).ToListAsync();
|
||||
|
||||
needList.ForEach(x => {
|
||||
maxOrder++;
|
||||
x.ShowOrder = maxOrder;
|
||||
});
|
||||
|
||||
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(_mapper.Map<List<ReadingMedicineTrialQuestion>>(needList));
|
||||
var result = await _readingMedicineTrialQuestionRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Result(result);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从系统里面选择问题添加到项目里面
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> AddTrialDataFromSystem(AddTrialDataFromSystemInDto inDto)
|
||||
{
|
||||
// 直接写??
|
||||
|
|
Loading…
Reference in New Issue