修改
continuous-integration/drone/push Build is passing Details

IRC_NewDev
he 2024-06-28 09:35:54 +08:00
parent 9c95928add
commit 1a3ad4f602
2 changed files with 71 additions and 6 deletions

View File

@ -1107,8 +1107,19 @@ namespace IRaCIS.Core.Application.Contracts
}
public class GetNextCRCChallengeInDto
{
[NotDefault]
public Guid TrialId { get; set; }
public class ChallengeQuery : PageInput
/// <summary>
/// QCChallengeId
/// </summary>
public Guid QCChallengeId { get; set; }
}
public class ChallengeQuery : PageInput
{
[NotDefault]
public Guid TrialId { get; set; }

View File

@ -9,6 +9,7 @@ using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Application.Service.Reading.Dto;
using static Org.BouncyCastle.Math.EC.ECCurve;
using IRaCIS.Core.Infrastructure;
namespace IRaCIS.Core.Application.Image.QA
{
@ -87,14 +88,67 @@ namespace IRaCIS.Core.Application.Image.QA
}
/// <summary>
/// CRC 质疑列表
/// 获取下一个crc的未关闭的质疑
/// </summary>
/// <param name="challengeQuery"></param>
/// <param name="inDto"></param>
/// <returns></returns>
/// <exception cref="BusinessValidationFailedException"></exception>
[HttpPost]
public async Task<QCCRCChallengeViewModel> GetNextCRCChallenge(GetNextCRCChallengeInDto inDto)
{
var list =await GetCRCChallengeList(new ChallengeQuery()
{
TrialId = inDto.TrialId,
PageIndex = 1,
PageSize = 9999
});
var data = list.Item1.CurrentPageData.Where(x=>x.Id==inDto.QCChallengeId||x.IsClosed==false).ToList();
if (data.Count > 0)
{
var index = data.ToList().FindIndex(x => x.Id == inDto.QCChallengeId);
var result = new QCCRCChallengeViewModel() { };
if (index + 1 == data.Count()) // 最后一个
{
throw new BusinessValidationFailedException(_localizer["QCList_CRCFinishChallenge"]);
}
else if (index == -1 || data.Count == 1) // 第一个或者只有一个
{
if (data[0].Id == inDto.QCChallengeId)
{
throw new BusinessValidationFailedException(_localizer["QCList_CRCFinishChallenge"]);
}
result = data[0];
}
else
{
result = data.Skip(index + 1).Take(1).First();
}
return result;
}
else
{
throw new BusinessValidationFailedException(_localizer["QCList_CRCFinishChallenge"]);
}
}
/// <summary>
/// CRC 质疑列表
/// </summary>
/// <param name="challengeQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<(PageOutput<QCCRCChallengeViewModel>, TrialSubjectAndSVConfig)> GetCRCChallengeList(ChallengeQuery challengeQuery)
{
@ -117,7 +171,7 @@ namespace IRaCIS.Core.Application.Image.QA
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.SubjectVisit.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
.ProjectTo<QCCRCChallengeViewModel>(_mapper.ConfigurationProvider);
var pageList = await query2.ToPagedListAsync(challengeQuery.PageIndex, challengeQuery.PageSize, challengeQuery.SortField, challengeQuery.Asc, string.IsNullOrWhiteSpace(challengeQuery.SortField), new string[] { "IsUrgent desc", "IsClosed asc" });
var pageList = await query2.ToPagedListAsync(challengeQuery.PageIndex, challengeQuery.PageSize, challengeQuery.SortField, challengeQuery.Asc, string.IsNullOrWhiteSpace(challengeQuery.SortField), new string[] { "IsUrgent desc", "CreateTime asc" });
var config = await _repository.Where<Trial>(t => t.Id == challengeQuery.TrialId).ProjectTo<TrialSubjectAndSVConfig>(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException();
return (pageList, config);