增加 MassTransit 移除 MediatR
This commit is contained in:
@@ -10,7 +10,6 @@ using IRaCIS.Core.Infrastructure;
|
||||
using DocumentFormat.OpenXml.Presentation;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Application.MediatR.Handlers;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using System.Threading;
|
||||
|
||||
@@ -5,10 +5,8 @@
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.MediatR.Handlers;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
@@ -18,12 +16,10 @@ namespace IRaCIS.Core.Application.Service
|
||||
[ApiExplorerSettings(GroupName = "Image")]
|
||||
public class SystemAnonymizationService : BaseService, ISystemAnonymizationService
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly IRepository<SystemAnonymization> systemAnonymizationRepository;
|
||||
|
||||
public SystemAnonymizationService(IMediator mediator, IRepository<SystemAnonymization> systemAnonymizationRepository)
|
||||
public SystemAnonymizationService( IRepository<SystemAnonymization> systemAnonymizationRepository)
|
||||
{
|
||||
_mediator = mediator;
|
||||
this.systemAnonymizationRepository = systemAnonymizationRepository;
|
||||
}
|
||||
|
||||
@@ -47,7 +43,6 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
var entity = await _repository.InsertOrUpdateAsync<SystemAnonymization, SystemAnonymizationAddOrEdit>(addOrEditSystemAnonymization, true);
|
||||
|
||||
await _mediator.Send(new AnonymizeCacheRequest());
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -489,7 +488,14 @@ namespace IRaCIS.Core.Application.Contracts.DTO
|
||||
}
|
||||
}
|
||||
|
||||
public class ParamInfoDto
|
||||
{
|
||||
public string Modality { get; set; }
|
||||
|
||||
public string StudyDate { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class QCChanllengeDialogDTO : CheckChanllengeDialogDTO
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using IRaCIS.Core.Application.Contracts.DTO;
|
||||
using IRaCIS.Core.Application.Service.Inspection.DTO;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -40,6 +39,6 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
Task<IResponseOutput> VerifyCanQCPassedOrFailed(Guid subjectVisitId);
|
||||
|
||||
|
||||
Task<IResponseOutput> ForwardSVDicomImage(Guid[] subjectVisitIdList);
|
||||
//Task<IResponseOutput> ForwardSVDicomImage(Guid[] subjectVisitIdList);
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,9 @@
|
||||
using IRaCIS.Core.Application.Contracts.DTO;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using WinSCP;
|
||||
using Newtonsoft.Json;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using IRaCIS.Core.Application.Service.Inspection.DTO;
|
||||
@@ -2109,109 +2107,113 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
}
|
||||
|
||||
|
||||
#region 转发影像 暂时不用 废弃
|
||||
//[HttpPost("{trialId:guid}")]
|
||||
////[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
||||
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
//public async Task<IResponseOutput> ForwardSVDicomImage(Guid[] subjectVisitIdList)
|
||||
//{
|
||||
|
||||
[HttpPost("{trialId:guid}")]
|
||||
//[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
public async Task<IResponseOutput> ForwardSVDicomImage(Guid[] subjectVisitIdList)
|
||||
{
|
||||
|
||||
bool isSuccess = false;
|
||||
// bool isSuccess = false;
|
||||
|
||||
|
||||
foreach (var subjectVisitId in subjectVisitIdList)
|
||||
{
|
||||
// foreach (var subjectVisitId in subjectVisitIdList)
|
||||
// {
|
||||
|
||||
|
||||
var info = (await _subjectVisitRepository.Where(t => t.Id == subjectVisitId).ProjectTo<DicomTrialSiteSubjectInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
// var info = (await _subjectVisitRepository.Where(t => t.Id == subjectVisitId).ProjectTo<DicomTrialSiteSubjectInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
|
||||
var targetPath = "/IMPORT-IMAGES/" + info.TrialCode + "_" + info.SubjectCode + "_" + info.VisitName;
|
||||
// var targetPath = "/IMPORT-IMAGES/" + info.TrialCode + "_" + info.SubjectCode + "_" + info.VisitName;
|
||||
|
||||
var path = FileStoreHelper.GetSubjectVisitDicomFolderPhysicalPath(_hostEnvironment, info.TrialId, info.TrialSiteId, info.SubjectId, info.SubjectVisitId);
|
||||
// var path = FileStoreHelper.GetSubjectVisitDicomFolderPhysicalPath(_hostEnvironment, info.TrialId, info.TrialSiteId, info.SubjectId, info.SubjectVisitId);
|
||||
|
||||
try
|
||||
{
|
||||
// 主机及端口信息后面可以改到 配置文件
|
||||
SessionOptions sessionOptions = new SessionOptions
|
||||
{
|
||||
Protocol = Protocol.Sftp,
|
||||
PortNumber = 8022,
|
||||
HostName = "CS-690-sftp.mint-imaging.com",
|
||||
UserName = "zdong",
|
||||
Password = "Everest@2021",
|
||||
SshHostKeyFingerprint = @"ecdsa-sha2-nistp384 384 59gkjJ5lMwv3jsB8Wz2B35tBAIor5pSd8PcJYtoamPo="
|
||||
};
|
||||
// try
|
||||
// {
|
||||
// // 主机及端口信息后面可以改到 配置文件
|
||||
// SessionOptions sessionOptions = new SessionOptions
|
||||
// {
|
||||
// Protocol = Protocol.Sftp,
|
||||
// PortNumber = 8022,
|
||||
// HostName = "CS-690-sftp.mint-imaging.com",
|
||||
// UserName = "zdong",
|
||||
// Password = "Everest@2021",
|
||||
// SshHostKeyFingerprint = @"ecdsa-sha2-nistp384 384 59gkjJ5lMwv3jsB8Wz2B35tBAIor5pSd8PcJYtoamPo="
|
||||
// };
|
||||
|
||||
using (Session session = new Session())
|
||||
{
|
||||
var studyFolders = (new DirectoryInfo(path)).GetDirectories();
|
||||
// using (Session session = new Session())
|
||||
// {
|
||||
// var studyFolders = (new DirectoryInfo(path)).GetDirectories();
|
||||
|
||||
session.Open(sessionOptions);
|
||||
// session.Open(sessionOptions);
|
||||
|
||||
if (!session.FileExists(targetPath))
|
||||
{
|
||||
session.CreateDirectory(targetPath);
|
||||
}
|
||||
// if (!session.FileExists(targetPath))
|
||||
// {
|
||||
// session.CreateDirectory(targetPath);
|
||||
// }
|
||||
|
||||
|
||||
foreach (var studyFolder in studyFolders)
|
||||
{
|
||||
var targetFolder = Path.Combine(targetPath, studyFolder.Name);
|
||||
// foreach (var studyFolder in studyFolders)
|
||||
// {
|
||||
// var targetFolder = Path.Combine(targetPath, studyFolder.Name);
|
||||
|
||||
if (!session.FileExists(targetFolder))
|
||||
{
|
||||
session.CreateDirectory(targetFolder);
|
||||
}
|
||||
// if (!session.FileExists(targetFolder))
|
||||
// {
|
||||
// session.CreateDirectory(targetFolder);
|
||||
// }
|
||||
|
||||
foreach (var file in studyFolder.GetFiles())
|
||||
{
|
||||
if (file.Extension.Contains("dcm", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string remoteFilePath =
|
||||
RemotePath.TranslateLocalPathToRemote(file.FullName, studyFolder.FullName, targetFolder);
|
||||
// foreach (var file in studyFolder.GetFiles())
|
||||
// {
|
||||
// if (file.Extension.Contains("dcm", StringComparison.OrdinalIgnoreCase))
|
||||
// {
|
||||
// string remoteFilePath =
|
||||
// RemotePath.TranslateLocalPathToRemote(file.FullName, studyFolder.FullName, targetFolder);
|
||||
|
||||
var result = session.PutFiles(file.FullName, remoteFilePath, false);
|
||||
// var result = session.PutFiles(file.FullName, remoteFilePath, false);
|
||||
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectVisitId,
|
||||
u => new SubjectVisit() { ForwardState = ForwardStateEnum.ForwardFailed });
|
||||
// if (!result.IsSuccess)
|
||||
// {
|
||||
// await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectVisitId,
|
||||
// u => new SubjectVisit() { ForwardState = ForwardStateEnum.ForwardFailed });
|
||||
|
||||
//---转发影像失败。
|
||||
return ResponseOutput.NotOk(_localizer["QCOperation_ForwardingFailed"] + result.Failures.ToString() + result.ToJson());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// //---转发影像失败。
|
||||
// return ResponseOutput.NotOk(_localizer["QCOperation_ForwardingFailed"] + result.Failures.ToString() + result.ToJson());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
await _subjectVisitRepository.UpdatePartialFromQueryAsync(t => t.Id == subjectVisitId,
|
||||
u => new SubjectVisit() { ForwardState = ForwardStateEnum.Forwarded, ForwardUserId = _userInfo.Id, ForwardTime = DateTime.Now });
|
||||
// }
|
||||
// await _subjectVisitRepository.UpdatePartialFromQueryAsync(t => t.Id == subjectVisitId,
|
||||
// u => new SubjectVisit() { ForwardState = ForwardStateEnum.Forwarded, ForwardUserId = _userInfo.Id, ForwardTime = DateTime.Now });
|
||||
|
||||
isSuccess = true;
|
||||
// isSuccess = true;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
|
||||
await _subjectVisitRepository.UpdatePartialFromQueryAsync(t => t.Id == subjectVisitId,
|
||||
u => new SubjectVisit() { ForwardState = ForwardStateEnum.ForwardFailed });
|
||||
// await _subjectVisitRepository.UpdatePartialFromQueryAsync(t => t.Id == subjectVisitId,
|
||||
// u => new SubjectVisit() { ForwardState = ForwardStateEnum.ForwardFailed });
|
||||
|
||||
// --转发影像失败
|
||||
return ResponseOutput.NotOk(_localizer["QCOperation_ForwardingFailed"] + e.Message);
|
||||
}
|
||||
// // --转发影像失败
|
||||
// return ResponseOutput.NotOk(_localizer["QCOperation_ForwardingFailed"] + e.Message);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
|
||||
await _subjectVisitRepository.SaveChangesAsync();
|
||||
// await _subjectVisitRepository.SaveChangesAsync();
|
||||
|
||||
// //---转发影像失败。
|
||||
// return isSuccess ? ResponseOutput.Ok() : ResponseOutput.NotOk(_localizer["QCOperation_ForwardingFailed"]);
|
||||
//}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
//---转发影像失败。
|
||||
return isSuccess ? ResponseOutput.Ok() : ResponseOutput.NotOk(_localizer["QCOperation_ForwardingFailed"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using AutoMapper.EquivalencyExpression;
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Contracts.DTO;
|
||||
using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
||||
using IRaCIS.Core.Application.MassTransit.Command;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using static IRaCIS.Core.Application.Contracts.SubjectProgressDto;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using MiniExcelLibs.Attributes;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace IRaCIS.Application.Contracts
|
||||
@@ -103,5 +104,53 @@ namespace IRaCIS.Application.Contracts
|
||||
public int InconsistentCount { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class VisitPlanInfluenceSubjectVisitDTO
|
||||
{
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public Guid StudyId { get; set; }
|
||||
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
|
||||
[ExcelColumnName("中心编号")]
|
||||
public string TrialSiteCode { get; set; } = string.Empty;
|
||||
|
||||
[ExcelColumnName("受试者")]
|
||||
public string SubjectCode { get; set; } = string.Empty;
|
||||
|
||||
[ExcelColumnName("访视名称")]
|
||||
public string VisitName { get; set; } = string.Empty;
|
||||
|
||||
[ExcelColumn(Name = "检查时间", Format = "yyyy-MM-dd HH:mm:ss")]
|
||||
public DateTime StudyTime { get; set; }
|
||||
|
||||
[ExcelColumnName("检查技术")]
|
||||
public string Modality { get; set; } = string.Empty;
|
||||
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public bool IsDicomStudy { get; set; }
|
||||
|
||||
|
||||
[ExcelColumnName("影像类型")]
|
||||
public string ImageType => IsDicomStudy ? "Dicom" : "非Dicom";
|
||||
|
||||
[ExcelColumnName("历史窗口")]
|
||||
public string HistoryWindow { get; set; } = string.Empty;
|
||||
|
||||
|
||||
[ExcelColumnName("之前超窗调整后没超窗")]
|
||||
|
||||
public bool IsOverWindowNowNotOverWindow { get; set; }
|
||||
|
||||
[ExcelColumnName("目前窗口")]
|
||||
public string NowWindow { get; set; } = string.Empty;
|
||||
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using IRaCIS.Core.Application.Auth;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Contracts.Dicom.DTO;
|
||||
using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
|
||||
Reference in New Issue
Block a user