Uat_Study
parent
01ed29d3e3
commit
ab6c7362ec
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
|
||||
|
@ -65,6 +67,11 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
public Guid Id { get; set; }
|
||||
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型值
|
||||
/// </summary>
|
||||
public string TypeValue { get; set; }
|
||||
}
|
||||
|
||||
public class AddTrialDataFromSystemInDto
|
||||
|
@ -74,6 +81,23 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
public List<Guid> SystemQuestionIds { get; set; }
|
||||
}
|
||||
|
||||
public class ConfirmReadingMedicineQuestionInDto
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
}
|
||||
|
||||
public class TrialQuestion
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public int ShowOrder { get; set; }
|
||||
|
||||
|
||||
public int? ParentShowOrder { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目的其他问题
|
||||
/// </summary>
|
||||
|
|
|
@ -5,6 +5,7 @@ using IRaCIS.Core.Application.Interfaces;
|
|||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using MassTransit;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
@ -16,14 +17,17 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
|
||||
private readonly IRepository<ReadingMedicineTrialQuestion> _readingMedicineTrialQuestionRepository;
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
private readonly IRepository<ReadingMedicineSystemQuestion> _readingMedicineSystemQuestionRepository;
|
||||
|
||||
public ReadingMedicineQuestionService(
|
||||
IRepository<ReadingMedicineTrialQuestion> readingMedicineTrialQuestionRepository,
|
||||
IRepository<Trial> trialRepository,
|
||||
IRepository<ReadingMedicineSystemQuestion> readingMedicineSystemQuestionRepository
|
||||
)
|
||||
{
|
||||
this._readingMedicineTrialQuestionRepository = readingMedicineTrialQuestionRepository;
|
||||
this._trialRepository = trialRepository;
|
||||
this._readingMedicineSystemQuestionRepository = readingMedicineSystemQuestionRepository;
|
||||
}
|
||||
|
||||
|
@ -84,7 +88,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<ReadingMedicineTrialQuestionView>> GetReadingMedicineTrialQuestionList(ReadingMedicineTrialQuestionQuery inDto)
|
||||
public async Task<(List<ReadingMedicineTrialQuestionView>,object)> GetReadingMedicineTrialQuestionList(ReadingMedicineTrialQuestionQuery inDto)
|
||||
{
|
||||
var query = _readingMedicineTrialQuestionRepository.AsQueryable()
|
||||
.Where(x=>x.TrialId==inDto.TrialId)
|
||||
|
@ -93,7 +97,12 @@ namespace IRaCIS.Core.Application.Service
|
|||
.WhereIf(!inDto.QuestionName.IsNullOrEmpty(), x => x.QuestionName.Contains(inDto.QuestionName))
|
||||
.WhereIf(!inDto.Type.IsNullOrEmpty(), x => x.Type.Contains(inDto.Type))
|
||||
.ProjectTo<ReadingMedicineTrialQuestionView>(_mapper.ConfigurationProvider).OrderBy(x=>x.ShowOrder);
|
||||
return await query.ToListAsync();
|
||||
|
||||
|
||||
var isConfirmMedicineQuestion = await _trialRepository.Where(x => x.Id == inDto.TrialId).Select(x => x.IsConfirmMedicineQuestion).FirstOrDefaultAsync();
|
||||
return ((await query.ToListAsync()), new {
|
||||
IsConfirmMedicineQuestion= isConfirmMedicineQuestion
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -131,6 +140,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
Id = x.Id,
|
||||
QuestionName = x.QuestionName,
|
||||
TypeValue=x.TypeValue,
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
return questionList;
|
||||
|
@ -180,16 +191,53 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 确认医学审核问题
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//public async Task<IResponseOutput> ConfirmReadingMedicineQuestion()
|
||||
//{
|
||||
|
||||
//}
|
||||
/// <summary>
|
||||
/// 确认医学审核问题
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> ConfirmReadingMedicineQuestion(ConfirmReadingMedicineQuestionInDto inDto)
|
||||
{
|
||||
var readingMedicineQuestionList = await _readingMedicineTrialQuestionRepository.Where(x => x.TrialId == inDto.TrialId)
|
||||
.Select(x => new TrialQuestion() {
|
||||
Id = x.Id,
|
||||
ParentShowOrder = (int?)x.ParentQuestion.ShowOrder,
|
||||
|
||||
}).ToListAsync();
|
||||
if (readingMedicineQuestionList.Count == 0)
|
||||
{
|
||||
throw new BusinessValidationFailedException("当前未添加医学审核问题。请先添加医学审核问题,再进行确认。");
|
||||
}
|
||||
|
||||
if (readingMedicineQuestionList.Count() != readingMedicineQuestionList.Select(t => t.ShowOrder).Distinct().Count())
|
||||
{
|
||||
throw new BusinessValidationFailedException("影像医学审核问题显示序号不能重复。");
|
||||
}
|
||||
|
||||
|
||||
if (readingMedicineQuestionList.Where(t => t.ParentShowOrder != null).Any(t => t.ParentShowOrder > t.ShowOrder))
|
||||
{
|
||||
throw new BusinessValidationFailedException("父问题的显示序号要比子问题的显示序号小,请确认。");
|
||||
}
|
||||
|
||||
|
||||
await _readingMedicineTrialQuestionRepository.BatchUpdateNoTrackingAsync(x => x.TrialId == inDto.TrialId, x => new ReadingMedicineTrialQuestion()
|
||||
{
|
||||
IsConfirm = true
|
||||
});
|
||||
|
||||
await _trialRepository.UpdatePartialFromQueryAsync(inDto.TrialId, x => new Trial()
|
||||
{
|
||||
IsConfirmMedicineQuestion = true
|
||||
});
|
||||
|
||||
var result = await _trialRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Result(result);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,8 +85,11 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// 是否确认
|
||||
/// </summary>
|
||||
public bool? IsConfirm { get; set; }
|
||||
|
||||
}
|
||||
|
||||
[ForeignKey("ParentId")]
|
||||
public ReadingMedicineTrialQuestion ParentQuestion { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -361,6 +361,12 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
public DateTime? SyncClinicalDataTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是确认医学审核问题
|
||||
/// </summary>
|
||||
|
||||
public bool IsConfirmMedicineQuestion { get; set; } = false;
|
||||
|
||||
|
||||
//public Guid? ReviewTypeId { get; set; } = Guid.Empty;
|
||||
|
||||
|
|
Loading…
Reference in New Issue