Uat_Study
he 2023-06-30 13:48:21 +08:00
parent b4b4c82e59
commit 529dc52823
2 changed files with 71 additions and 1 deletions

View File

@ -497,5 +497,68 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.Ok(true);
}
/// <summary>
/// CRC 取消确认
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> CRCCancelConfirmClinical(CRCCancelConfirmClinicalInDto inDto)
{
var dataList = await this.GetCRCConfirmList(new GetCRCConfirmListInDto()
{
TrialId = inDto.TrialId
});
var presentData = dataList.Where(x => x.ReadModuleId == inDto.ReadModuleId).First();
if (dataList.Any(x => x.IsPMConfirm && x.LatestScanDate > presentData.LatestScanDate && x.ReadingSetType == presentData.ReadingSetType))
{
throw new BusinessValidationFailedException("当前数据并非最后一条确认信息,无法取消!");
}
if(presentData.IsPMConfirm)
{
throw new BusinessValidationFailedException("PM已确认,无法取消!");
}
await _readModuleRepository.UpdatePartialFromQueryAsync(x => presentData.ReadModuleId==x.Id, x => new ReadModule()
{
IsCRCConfirm = false
});
await _readModuleCriterionFromRepository.BatchDeleteNoTrackingAsync(x=>x.ReadModuleId== presentData.ReadModuleId);
await _readModuleCriterionFromRepository.SaveChangesAsync();
return ResponseOutput.Ok(true);
}
/// <summary>
/// PM确认临床数据
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
/// <exception cref="BusinessValidationFailedException"></exception>
[HttpPost]
public async Task<IResponseOutput> PMConfirmClinical(CRCConfirmClinicalInDto inDto)
{
var readModuleData = await _readModuleRepository.Where(x => x.Id == inDto.ReadModuleId).FirstNotNullAsync();
if (!readModuleData.IsCRCConfirm)
{
throw new BusinessValidationFailedException("CRC还未确认数据,PM无法确认");
}
await _readModuleRepository.UpdatePartialFromQueryAsync(x => inDto.ReadModuleId == x.Id, x => new ReadModule()
{
IsPMConfirm = false
});
await _readModuleRepository.SaveChangesAsync();
return ResponseOutput.Ok(true);
}
}
}

View File

@ -99,7 +99,14 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public Guid TrialId { get; set; }
}
public class CRCConfirmClinicalInDto
public class CRCCancelConfirmClinicalInDto
{
public Guid TrialId { get; set; }
public Guid ReadModuleId { get; set; }
}
public class CRCConfirmClinicalInDto
{
public Guid TrialId { get; set; }