diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 83d4a902a..6e9c7ba48 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -33,6 +33,7 @@ namespace IRaCIS.Core.Application.Image.QA private readonly IRepository _dicomSeriesrepository; private readonly IRepository _subjectRepository; private readonly IRepository _qCChallengeDialogrepository; + private readonly IRepository _checkChallengeDialogrepository; private readonly IRepository _trialRepository; private readonly IMediator _mediator; @@ -45,7 +46,8 @@ namespace IRaCIS.Core.Application.Image.QA IRepository dicomStudyRepository, IRepository dicomSeriesrepository, IRepository subjectRepository, - IRepository qCChallengeDialogrepository + IRepository qCChallengeDialogrepository, + IRepository checkChallengeDialogrepository ) { _dicomFileStoreHelper = dicomFileStoreHelper; @@ -55,6 +57,7 @@ namespace IRaCIS.Core.Application.Image.QA this._dicomSeriesrepository = dicomSeriesrepository; this._subjectRepository = subjectRepository; this._qCChallengeDialogrepository = qCChallengeDialogrepository; + this._checkChallengeDialogrepository = checkChallengeDialogrepository; _mediator = mediator; _trialRepository = trialRepository; } @@ -312,7 +315,13 @@ namespace IRaCIS.Core.Application.Image.QA } sv.CloseTheReason = input.CloseCheckChallenge; sv.CheckChallengeState = CheckChanllengeTypeEnum.Closed; + await _checkChallengeDialogrepository.AddAsync(new CheckChallengeDialog() + { + SubjectVisitId = input.subjectVisitId, + TalkContent = "原因:" + input.CloseCheckChallenge, + UserTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt, + }); await _repository.SaveChangesAsync(); return ResponseOutput.Ok(sv); @@ -377,11 +386,10 @@ namespace IRaCIS.Core.Application.Image.QA var QCChallengeId = await _qcChallengeRepository.Where(x => x.SubjectVisitId == subjectVisitId).Select(x => x.Id).FirstOrDefaultAsync(); - await _qCChallengeDialogrepository.AddAsync(new QCChallengeDialog() + await _checkChallengeDialogrepository.AddAsync(new CheckChallengeDialog() { SubjectVisitId = subjectVisitId, UserTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt, - QCChallengeId = QCChallengeId, TalkContent = "CRC 请求回退" }); diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 337463039..e55d47370 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -255,12 +255,18 @@ namespace IRaCIS.Core.Infra.EFCore.Common foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectVisit))) { var entity = item.Entity as SubjectVisit; - switch (GetRequestUrl()) + string reason = string.Empty; + + switch (GetRequestUrl().ToLower()) { - case "QCOperation/obtainOrCancelQCTask": + case "qcoperation/obtainorcancelqctask": type = type +"/"+ entity.IsTake.ToString(); break; - case "QCOperation/QCPassedOrFailed": + // 设置通过一致性核查 + case "qcoperation/setcheckpass": + reason = entity.ManualPassReason; + break; + case "qcoperation/qcpassedorfailed": try { type = type + "/" + (40 % (int)entity.AuditState).ToString(); @@ -282,6 +288,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common SubjectVisitId = x.Id, SubjectVisitName=x.VisitName, BlindName=x.BlindName, + Reason= reason, }); } @@ -348,21 +355,66 @@ namespace IRaCIS.Core.Infra.EFCore.Common //质疑 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallenge))) { + var entity = item.Entity as QCChallenge; type = _userInfo.UserTypeShortName +"/"+ type; + var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync(); + subjectvisit = subjectvisit ?? new SubjectVisit(); + var content = string.Empty; + if (type == "Add") + { + content = entity.Content; + } await InsertInspection(item, type, x => new DataInspection() { GeneralId = x.Id, + TrialId=x.TrialId, + SubjectVisitId=x.SubjectVisitId, + SiteId= subjectvisit.SiteId, + SubjectId= subjectvisit.SubjectId, + SubjectVisitName= subjectvisit.VisitName, + BlindName= subjectvisit.BlindName, + },new { + ChallengeCode= "Q" + entity.ChallengeCode.ToString("D5"), + AuditState= subjectvisit.AuditState, + TalkContent= content, + IsOverTime= entity.IsClosed ? entity.ClosedTime > entity.DeadlineTime : DateTime.Now > entity.DeadlineTime, }); } - //质疑 + // 质疑信息 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallengeDialog))) { + var reason = string.Empty; + var entity = item.Entity as QCChallengeDialog; + switch (GetRequestUrl().ToLower()) + { + case "qcoperation/closeqcchallenge": + reason = entity.TalkContent.Substring(entity.TalkContent.LastIndexOf(':') + 1); + break; + } type = _userInfo.UserTypeShortName + "/" + type; + var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync(); + var qCChallenge = await _dbContext.QCChallenge.Where(x => x.Id == entity.QCChallengeId).FirstOrDefaultAsync(); + subjectvisit = subjectvisit ?? new SubjectVisit(); await InsertInspection(item, type, x => new DataInspection() { - GeneralId = x.Id, + GeneralId = qCChallenge.Id, + TrialId = subjectvisit.TrialId, + SubjectVisitId = x.SubjectVisitId, + SiteId = subjectvisit.SiteId, + SubjectId = subjectvisit.SubjectId, + SubjectVisitName = subjectvisit.VisitName, + BlindName = subjectvisit.BlindName, + Reason= reason, + }, new { + AuditState= subjectvisit.AuditState, + ChallengeCode = "Q" + qCChallenge.ChallengeCode.ToString("D5"), + ReuploadEnum= qCChallenge.ReuploadEnum, + Content= qCChallenge.Content, + DeadlineTime= qCChallenge.DeadlineTime, + IsOverTime = qCChallenge.IsClosed ? qCChallenge.ClosedTime > qCChallenge.DeadlineTime : DateTime.Now > qCChallenge.DeadlineTime, + IsClosed= qCChallenge.IsClosed }); } @@ -370,9 +422,31 @@ namespace IRaCIS.Core.Infra.EFCore.Common foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(CheckChallengeDialog))) { type = _userInfo.UserTypeShortName + "/" + type; + var entity = item.Entity as CheckChallengeDialog; + var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync(); + subjectvisit = subjectvisit ?? new SubjectVisit(); + var reason = string.Empty; + + switch (GetRequestUrl().ToLower()) + { + case "qcoperation/closecheckchallenge": + reason = entity.TalkContent.Substring(entity.TalkContent.LastIndexOf(':') + 1); + break; + } await InsertInspection(item, type, x => new DataInspection() { - GeneralId = x.Id, + GeneralId = entity.SubjectVisitId, + TrialId = subjectvisit.TrialId, + SubjectVisitId = x.SubjectVisitId, + SiteId = subjectvisit.SiteId, + SubjectId = subjectvisit.SubjectId, + SubjectVisitName = subjectvisit.VisitName, + BlindName = subjectvisit.BlindName, + Reason= reason, + },new { + CheckState= subjectvisit.CheckState, + RequestBackState = subjectvisit.RequestBackState, + CheckChallengeState= subjectvisit.CheckChallengeState, }); }