添加接口

This commit is contained in:
he
2022-04-18 14:54:14 +08:00
parent 746366a1c2
commit ab3cfd7acd
9 changed files with 199 additions and 21 deletions
@@ -11,7 +11,7 @@ namespace IRaCIS.Core.Application.Image.QA
public interface IQCOperationService
{
Task<IResponseOutput> CheckBack(Guid subjectVisitId);
Task<IResponseOutput> SetNeedReupload(Guid trialId, Guid signId, Guid qcChallengeId);
Task<IResponseOutput> SetNeedReupload(Guid trialId, Guid qcChallengeId);
Task<IResponseOutput> QCPassedOrFailed(Guid trialId, Guid subjectVisitId, Guid signId, [FromRoute] AuditStateEnum auditState);
Task<IResponseOutput> SetCheckPass(Guid subjectVisitId);
@@ -19,7 +19,7 @@ namespace IRaCIS.Core.Application.Image.QA
Task<IResponseOutput<CheckChallengeDialog>> AddCheckChallengeReply(CheckChallengeDialogCommand checkDialogCommand);
Task<IResponseOutput> AddOrUpdateQCChallenge(QCChallengeCommand qaQuestionCommand, Guid trialId, [FromRoute] TrialQCProcess trialQCProcess, [FromRoute] CurrentQC currentQCType);
Task<QCChallenge> AddOrUpdateQCChallenge(QCChallengeCommand qaQuestionCommand, Guid trialId, [FromRoute] TrialQCProcess trialQCProcess, [FromRoute] CurrentQC currentQCType);
Task<IResponseOutput> AddOrUpdateQCQuestionAnswerList(QCQuestionAnswerCommand[] qcQuestionAnswerCommands, Guid trialId, Guid subjectVisitId, [FromRoute] TrialQCProcess trialQCProcess, [FromRoute] CurrentQC currentQCType);
Task<IResponseOutput> AddQCChallengeReply(QADialogCommand qaDialogCommand);
Task<IResponseOutput> CloseCheckChallenge(Guid subjectVisitId);
@@ -37,5 +37,7 @@ namespace IRaCIS.Core.Application.Image.QA
Task<IResponseOutput> UpdateSubjectAndSVInfo(UploadSubjectAndVisitCommand command);
Task<IResponseOutput> UploadVisitCheckExcel(IFormFile file, [FromServices] IMediator _mediator, Guid trialId, [FromServices] IWebHostEnvironment _hostEnvironment);
Task<IResponseOutput> VerifyCanQCPassedOrFailed(Guid subjectVisitId);
Task<IResponseOutput> ForwardSVDicomImage(Guid[] subjectVisitIdList);
}
}
@@ -21,6 +21,7 @@ using Magicodes.ExporterAndImporter.Excel;
using Newtonsoft.Json;
using Magicodes.ExporterAndImporter.Csv;
using IRaCIS.Core.Application.Service.Inspection.Interface;
using IRaCIS.Core.Infrastructure;
namespace IRaCIS.Core.Application.Image.QA
{
@@ -74,14 +75,15 @@ namespace IRaCIS.Core.Application.Image.QA
[HttpPost("{trialId:guid}/{trialQCProcess:int}/{currentQCType:int}")]
[TypeFilter(typeof(TrialResourceFilter))]
[Authorize(Policy = "ImageQCPolicy")]
public async Task<IResponseOutput> AddOrUpdateQCChallenge(QCChallengeCommand qaQuestionCommand, Guid trialId, [FromRoute] TrialQCProcess trialQCProcess, [FromRoute] CurrentQC currentQCType)
public async Task<QCChallenge> AddOrUpdateQCChallenge(QCChallengeCommand qaQuestionCommand, Guid trialId, [FromRoute] TrialQCProcess trialQCProcess, [FromRoute] CurrentQC currentQCType)
{
if (qaQuestionCommand.Id == null)
{
if (await _repository.AnyAsync<QCChallenge>(t => t.IsClosed == false && t.SubjectVisitId == qaQuestionCommand.SubjectVisitId && t.ReuploadEnum == QCChanllengeReuploadEnum.QCAgreeUpload))
{
return ResponseOutput.NotOk("当前访视有未关闭的 同意CRC上传的质疑,不允许再次添加质疑");
throw new BusinessValidationFailedException("当前访视有未关闭的 同意CRC上传的质疑,不允许再次添加质疑");
}
QCChallenge? qcChallenge = null;
@@ -90,7 +92,10 @@ namespace IRaCIS.Core.Application.Image.QA
{
var trialConfig = _repository.Where<Trial>(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification }).FirstOrDefault();
if (trialConfig == null) return Null404NotFound(trialConfig);
if (trialConfig == null)
{
throw new BusinessValidationFailedException("项目不存在");
}
#region 访
//var dbSubjectVisit = _subjectVisitRepository.FirstOrDefault(t => t.Id == qaQuestionCommand.SubjectVisitId);
@@ -148,7 +153,7 @@ namespace IRaCIS.Core.Application.Image.QA
//分开两个事务 处理访视质疑状态
await DealChallengeState(qcChallenge.SubjectVisitId);
return ResponseOutput.Result(success, qcChallenge.Id);
return qcChallenge;
#region
//var templateItems = _mapper.Map<List<QARecordTemplateItemDetail>>(visitQaCommand.QATrialTemplateItemList);
@@ -173,7 +178,10 @@ namespace IRaCIS.Core.Application.Image.QA
var qcChallenge = await _repository.FirstOrDefaultAsync<QCChallenge>(t => t.Id == qaQuestionCommand.Id);
if (qcChallenge == null) return Null404NotFound(qcChallenge);
if (qcChallenge == null)
{
throw new BusinessValidationFailedException("QC问题不存在");
};
_mapper.Map(qaQuestionCommand, qcChallenge);
@@ -182,7 +190,7 @@ namespace IRaCIS.Core.Application.Image.QA
await DealChallengeState(qcChallenge.SubjectVisitId);
return ResponseOutput.Result(success);
return qcChallenge;
}
@@ -1579,7 +1587,7 @@ namespace IRaCIS.Core.Application.Image.QA
/// <returns></returns>
[HttpPut("{trialId:guid}/{qcChallengeId:guid}/{signId:guid}")]
[TypeFilter(typeof(TrialResourceFilter))]
public async Task<IResponseOutput> SetNeedReupload(Guid trialId, Guid signId, Guid qcChallengeId)
public async Task<IResponseOutput> SetNeedReupload(Guid trialId, Guid qcChallengeId)
{
if (_userInfo.UserTypeEnumInt != (int)UserTypeEnum.IQC)
{
@@ -1654,9 +1662,9 @@ namespace IRaCIS.Core.Application.Image.QA
var success = await _repository.SaveChangesAsync();
var signSuccess = await _repository.UpdateFromQueryAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
//var signSuccess = await _repository.UpdateFromQueryAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
return ResponseOutput.Result(success && signSuccess);
return ResponseOutput.Result(success);
}
@@ -1817,7 +1825,8 @@ namespace IRaCIS.Core.Application.Image.QA
SiteId = data.SiteId,
TrialId = data.TrialId,
IsSign = false,
CreateTime=DateTime.Now.AddSeconds(1),
Identification= "Edit|Subject|Info|Subject",
CreateTime =DateTime.Now.AddSeconds(1),
JsonDetail = JsonConvert.SerializeObject(new
{
FirstGiveMedicineTime= command.SubjectFirstGiveMedicineTime.Value.ToString("yyyy-MM-dd")
@@ -1863,7 +1872,7 @@ namespace IRaCIS.Core.Application.Image.QA
[HttpPost("{trialId:guid}")]
public async Task<IResponseOutput> ForwardSVDicomImage(Guid[] subjectVisitIdList, [FromServices] DicomFileStoreHelper _dicomFileStoreHelper)
public async Task<IResponseOutput> ForwardSVDicomImage(Guid[] subjectVisitIdList)
{
foreach (var subjectVisitId in subjectVisitIdList)