diff --git a/IRaCIS.Core.API.sln b/IRaCIS.Core.API.sln index ca6b0f7..e0e9ae8 100644 --- a/IRaCIS.Core.API.sln +++ b/IRaCIS.Core.API.sln @@ -17,16 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IRaCIS.Core.Infra.EFCore", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IRaCIS.Core.Infrastructure", "IRaCIS.Core.Infrastructure\IRaCIS.Core.Infrastructure.csproj", "{07EED0F8-08E6-46F3-ACBE-17BC1391BD4C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EI_Image_Viewer_Installer", "Start\EI_Image_Viewer_Installer.csproj", "{D96F4B52-359C-43C9-8110-BAD1437F9280}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Install", "Install\Install.csproj", "{F5820DF0-DE23-4F4A-8D49-7E22F67B784D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnInstall", "UnInstall\UnInstall.csproj", "{60B9AC72-5744-4517-93A5-A1ECD573A529}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EI_Image_Viewer_Activation", "EI_Image_Viewer_Activation\EI_Image_Viewer_Activation.csproj", "{1D8AC441-D578-4B38-BCEE-686BD5D59E5A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EI_TestProject", "EI_TestProject\EI_TestProject.csproj", "{47F99CA7-E55B-4A0E-A511-7EDF34C57A20}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -115,66 +105,6 @@ Global {07EED0F8-08E6-46F3-ACBE-17BC1391BD4C}.Release|x64.Build.0 = Release|x64 {07EED0F8-08E6-46F3-ACBE-17BC1391BD4C}.Release|x86.ActiveCfg = Release|Any CPU {07EED0F8-08E6-46F3-ACBE-17BC1391BD4C}.Release|x86.Build.0 = Release|Any CPU - {D96F4B52-359C-43C9-8110-BAD1437F9280}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D96F4B52-359C-43C9-8110-BAD1437F9280}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D96F4B52-359C-43C9-8110-BAD1437F9280}.Debug|x64.ActiveCfg = Debug|x64 - {D96F4B52-359C-43C9-8110-BAD1437F9280}.Debug|x64.Build.0 = Debug|x64 - {D96F4B52-359C-43C9-8110-BAD1437F9280}.Debug|x86.ActiveCfg = Debug|Any CPU - {D96F4B52-359C-43C9-8110-BAD1437F9280}.Debug|x86.Build.0 = Debug|Any CPU - {D96F4B52-359C-43C9-8110-BAD1437F9280}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D96F4B52-359C-43C9-8110-BAD1437F9280}.Release|Any CPU.Build.0 = Release|Any CPU - {D96F4B52-359C-43C9-8110-BAD1437F9280}.Release|x64.ActiveCfg = Release|x64 - {D96F4B52-359C-43C9-8110-BAD1437F9280}.Release|x64.Build.0 = Release|x64 - {D96F4B52-359C-43C9-8110-BAD1437F9280}.Release|x86.ActiveCfg = Release|Any CPU - {D96F4B52-359C-43C9-8110-BAD1437F9280}.Release|x86.Build.0 = Release|Any CPU - {F5820DF0-DE23-4F4A-8D49-7E22F67B784D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F5820DF0-DE23-4F4A-8D49-7E22F67B784D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F5820DF0-DE23-4F4A-8D49-7E22F67B784D}.Debug|x64.ActiveCfg = Debug|x64 - {F5820DF0-DE23-4F4A-8D49-7E22F67B784D}.Debug|x64.Build.0 = Debug|x64 - {F5820DF0-DE23-4F4A-8D49-7E22F67B784D}.Debug|x86.ActiveCfg = Debug|Any CPU - {F5820DF0-DE23-4F4A-8D49-7E22F67B784D}.Debug|x86.Build.0 = Debug|Any CPU - {F5820DF0-DE23-4F4A-8D49-7E22F67B784D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F5820DF0-DE23-4F4A-8D49-7E22F67B784D}.Release|Any CPU.Build.0 = Release|Any CPU - {F5820DF0-DE23-4F4A-8D49-7E22F67B784D}.Release|x64.ActiveCfg = Release|x64 - {F5820DF0-DE23-4F4A-8D49-7E22F67B784D}.Release|x64.Build.0 = Release|x64 - {F5820DF0-DE23-4F4A-8D49-7E22F67B784D}.Release|x86.ActiveCfg = Release|Any CPU - {F5820DF0-DE23-4F4A-8D49-7E22F67B784D}.Release|x86.Build.0 = Release|Any CPU - {60B9AC72-5744-4517-93A5-A1ECD573A529}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {60B9AC72-5744-4517-93A5-A1ECD573A529}.Debug|Any CPU.Build.0 = Debug|Any CPU - {60B9AC72-5744-4517-93A5-A1ECD573A529}.Debug|x64.ActiveCfg = Debug|x64 - {60B9AC72-5744-4517-93A5-A1ECD573A529}.Debug|x64.Build.0 = Debug|x64 - {60B9AC72-5744-4517-93A5-A1ECD573A529}.Debug|x86.ActiveCfg = Debug|Any CPU - {60B9AC72-5744-4517-93A5-A1ECD573A529}.Debug|x86.Build.0 = Debug|Any CPU - {60B9AC72-5744-4517-93A5-A1ECD573A529}.Release|Any CPU.ActiveCfg = Release|Any CPU - {60B9AC72-5744-4517-93A5-A1ECD573A529}.Release|Any CPU.Build.0 = Release|Any CPU - {60B9AC72-5744-4517-93A5-A1ECD573A529}.Release|x64.ActiveCfg = Release|x64 - {60B9AC72-5744-4517-93A5-A1ECD573A529}.Release|x64.Build.0 = Release|x64 - {60B9AC72-5744-4517-93A5-A1ECD573A529}.Release|x86.ActiveCfg = Release|Any CPU - {60B9AC72-5744-4517-93A5-A1ECD573A529}.Release|x86.Build.0 = Release|Any CPU - {1D8AC441-D578-4B38-BCEE-686BD5D59E5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1D8AC441-D578-4B38-BCEE-686BD5D59E5A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1D8AC441-D578-4B38-BCEE-686BD5D59E5A}.Debug|x64.ActiveCfg = Debug|x64 - {1D8AC441-D578-4B38-BCEE-686BD5D59E5A}.Debug|x64.Build.0 = Debug|x64 - {1D8AC441-D578-4B38-BCEE-686BD5D59E5A}.Debug|x86.ActiveCfg = Debug|Any CPU - {1D8AC441-D578-4B38-BCEE-686BD5D59E5A}.Debug|x86.Build.0 = Debug|Any CPU - {1D8AC441-D578-4B38-BCEE-686BD5D59E5A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1D8AC441-D578-4B38-BCEE-686BD5D59E5A}.Release|Any CPU.Build.0 = Release|Any CPU - {1D8AC441-D578-4B38-BCEE-686BD5D59E5A}.Release|x64.ActiveCfg = Release|x64 - {1D8AC441-D578-4B38-BCEE-686BD5D59E5A}.Release|x64.Build.0 = Release|x64 - {1D8AC441-D578-4B38-BCEE-686BD5D59E5A}.Release|x86.ActiveCfg = Release|Any CPU - {1D8AC441-D578-4B38-BCEE-686BD5D59E5A}.Release|x86.Build.0 = Release|Any CPU - {47F99CA7-E55B-4A0E-A511-7EDF34C57A20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {47F99CA7-E55B-4A0E-A511-7EDF34C57A20}.Debug|Any CPU.Build.0 = Debug|Any CPU - {47F99CA7-E55B-4A0E-A511-7EDF34C57A20}.Debug|x64.ActiveCfg = Debug|Any CPU - {47F99CA7-E55B-4A0E-A511-7EDF34C57A20}.Debug|x64.Build.0 = Debug|Any CPU - {47F99CA7-E55B-4A0E-A511-7EDF34C57A20}.Debug|x86.ActiveCfg = Debug|Any CPU - {47F99CA7-E55B-4A0E-A511-7EDF34C57A20}.Debug|x86.Build.0 = Debug|Any CPU - {47F99CA7-E55B-4A0E-A511-7EDF34C57A20}.Release|Any CPU.ActiveCfg = Release|Any CPU - {47F99CA7-E55B-4A0E-A511-7EDF34C57A20}.Release|Any CPU.Build.0 = Release|Any CPU - {47F99CA7-E55B-4A0E-A511-7EDF34C57A20}.Release|x64.ActiveCfg = Release|Any CPU - {47F99CA7-E55B-4A0E-A511-7EDF34C57A20}.Release|x64.Build.0 = Release|Any CPU - {47F99CA7-E55B-4A0E-A511-7EDF34C57A20}.Release|x86.ActiveCfg = Release|Any CPU - {47F99CA7-E55B-4A0E-A511-7EDF34C57A20}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 3a3b264..c1090ca 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -42,9 +42,11 @@ using System.Collections.Generic; using System.Data; using System.Globalization; using System.IO; +using System.IO.Compression; using System.Linq; using System.Text; using System.Threading.Tasks; +using static IRaCIS.Core.Domain.Share.StaticData; using Path = System.IO.Path; namespace IRaCIS.Core.API.Controllers @@ -266,7 +268,7 @@ namespace IRaCIS.Core.API.Controllers [DisableFormValueModelBinding] [DisableRequestSizeLimit] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - public async Task ArchiveStudyNew(/*[FromForm] ArchiveStudyCommand archiveStudyCommand,*/ Guid trialId, Guid subjectVisitId, string studyInstanceUid, Guid? abandonStudyId,Guid studyMonitorId, + public async Task ArchiveStudyNew(/*[FromForm] ArchiveStudyCommand archiveStudyCommand,*/ Guid trialId, Guid subjectVisitId, string studyInstanceUid, Guid? abandonStudyId, Guid studyMonitorId, [FromServices] ILogger _logger, [FromServices] IEasyCachingProvider _provider, [FromServices] IStudyService _studyService, @@ -394,7 +396,7 @@ namespace IRaCIS.Core.API.Controllers studyMonitor.IsSuccess = true; } - + } catch (Exception e) { @@ -411,7 +413,7 @@ namespace IRaCIS.Core.API.Controllers studyMonitor.StudyCode = archiveResult.ArchivedDicomStudies.FirstOrDefault()?.StudyCode; studyMonitor.ArchiveFinishedTime = DateTime.Now; - await _studyMonitorRepository.SaveChangesAsync(); + await _studyMonitorRepository.SaveChangesAsync(); } @@ -423,8 +425,61 @@ namespace IRaCIS.Core.API.Controllers } + [HttpPost, Route("Study/CreateImageZip")] + public async Task CreateImageZipAsync(Guid visitTaskId, [FromServices] IHubContext _uploadHub) + { + await _repository.BatchUpdateAsync(t => t.Id == visitTaskId, u => new VisitTask() { PackState = PackState.Packing }); + + var info = _repository.Where(t => t.Id == visitTaskId).Select(t => new { t.TrialId, t.Subject.SiteId, t.SubjectId, t.SourceSubjectVisitId }).FirstOrDefault(); + var folderPath = FileStoreHelper.GetSubjectVisitDicomFolderPhysicalPath(_hostEnvironment, info.TrialId, info.SiteId, info.SubjectId, info.SourceSubjectVisitId.Value); + + // 获取文件夹中的文件列表 + var files = Directory.GetFiles(folderPath); + + // 创建一个唯一的ZIP文件名 + var zipFileName = $"archive_{DateTime.Now:yyyyMMddHHmmss}.zip"; + + var tempStoreFolder = Path.Combine(FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment), StaticData.Folder.TempFileFolder); + + if (!Directory.Exists(tempStoreFolder)) + { + Directory.CreateDirectory(tempStoreFolder); + } + + var zipFilePath = Path.Combine(tempStoreFolder, zipFileName); + + var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TempFileFolder}/{zipFileName}"; + + + await Task.Run(async () => + { + ZipFile.CreateFromDirectory(folderPath, zipFilePath); + await _repository.BatchUpdateAsync(t => t.Id == visitTaskId, u => new VisitTask() { PackState = PackState.Packed, PackRelativePath = relativePath }); + + }); + + + // 发送最终进度信息到客户端 + //await _uploadHub.Clients.User(_userInfo.Id.ToString()).CompressProgressAsync(visitTaskId, $"打包完成"); + + return ResponseOutput.Ok(relativePath); + + } + + [AllowAnonymous] + [HttpGet("Study/DownloadImageZip")] + public IActionResult DownloadImageZip(string relativePath) + { + + var fileStorePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, relativePath); + + new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(fileStorePath), out var contentType); + + return File(System.IO.File.OpenRead(fileStorePath), contentType ?? "application/octet-stream", Path.GetFileName(fileStorePath)); + + } /// @@ -671,7 +726,7 @@ namespace IRaCIS.Core.API.Controllers [RequestSizeLimit(1_073_741_824)] [HttpPost("NoneDicomStudy/UploadNoneDicomFile/{trialId:guid}/{subjectVisitId:guid}/{noneDicomStudyId:guid}/{studyMonitorId:guid}")] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - public async Task UploadNoneDicomFile(IFormCollection formCollection, Guid subjectVisitId, Guid noneDicomStudyId, Guid studyMonitorId, + public async Task UploadNoneDicomFile(IFormCollection formCollection, Guid subjectVisitId, Guid noneDicomStudyId, Guid studyMonitorId, [FromServices] IRepository _noneDicomStudyRepository, [FromServices] IRepository _studyMonitorRepository) { @@ -709,7 +764,7 @@ namespace IRaCIS.Core.API.Controllers studyMonitor.IsDicomReUpload = false; studyMonitor.StudyId = noneDicomStudyId; studyMonitor.StudyCode = noneDicomStudy.StudyCode; - studyMonitor.ArchiveFinishedTime = DateTime.Now; + studyMonitor.ArchiveFinishedTime = DateTime.Now; studyMonitor.IP = _userInfo.IP; await _repository.SaveChangesAsync(); @@ -727,7 +782,7 @@ namespace IRaCIS.Core.API.Controllers /// [HttpPost("QCOperation/UploadVisitCheckExcel/{trialId:guid}")] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - //[Authorize(Policy = IRaCISPolicy.PM_APM)] + //[Authorize(Policy = IRaCISPolicy.PM_APM)] public async Task UploadVisitCheckExcel(Guid trialId) { @@ -894,7 +949,7 @@ namespace IRaCIS.Core.API.Controllers var dt = DateTime.Now; - etcCheckList = etcCheckList.Where(t => !(t.Modality == string.Empty || t.SiteCode == string.Empty || t.SubjectCode == string.Empty || t.VisitName == string.Empty || t.StudyDate == string.Empty ||! DateTime.TryParse(t.StudyDate, out dt))).ToList(); + etcCheckList = etcCheckList.Where(t => !(t.Modality == string.Empty || t.SiteCode == string.Empty || t.SubjectCode == string.Empty || t.VisitName == string.Empty || t.StudyDate == string.Empty || !DateTime.TryParse(t.StudyDate, out dt))).ToList(); if (etcCheckList.Count == 0) { diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj index 502d6a5..52062b3 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj +++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj @@ -13,7 +13,7 @@ 1.0.1.001 favicon.ico AnyCPU;x64 - EI_Image_Viewer + diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index 999ba0b..93e1867 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -1,7 +1,7 @@ - EI_Image_Viewer + IRaCIS.Core.API diff --git a/IRaCIS.Core.API/Properties/launchSettings.json b/IRaCIS.Core.API/Properties/launchSettings.json index a5c135e..022add7 100644 --- a/IRaCIS.Core.API/Properties/launchSettings.json +++ b/IRaCIS.Core.API/Properties/launchSettings.json @@ -16,43 +16,13 @@ "ASPNETCORE_ENVIRONMENT": "Development" } }, - "IRaCIS.Development": { + "IRaCIS.Test510K": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Test_510K" }, "applicationUrl": "http://localhost:6100" - }, - "Docker": { - "commandName": "Docker", - "launchBrowser": true, - "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", - "publishAllPorts": true - }, - "IRaCIS.Staging": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Staging" - }, - "applicationUrl": "http://localhost:6200" - }, - "IRaCIS.Production": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Production" - }, - "applicationUrl": "http://localhost:6300" - }, - "IRaCIS.CertificateApply": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "CertificateApply" - }, - "applicationUrl": "http://localhost:6400" } } } \ No newline at end of file diff --git a/IRaCIS.Core.API/SignalRHub/UploadHub.cs b/IRaCIS.Core.API/SignalRHub/UploadHub.cs index 7fae50d..88eab1d 100644 --- a/IRaCIS.Core.API/SignalRHub/UploadHub.cs +++ b/IRaCIS.Core.API/SignalRHub/UploadHub.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Logging; +using System; using System.Threading.Tasks; namespace IRaCIS.Core.API @@ -11,6 +12,9 @@ namespace IRaCIS.Core.API public interface IUploadClient { Task ReceivProgressAsync(string studyInstanceUid, int haveReceivedCount); + + + Task CompressProgressAsync(Guid visitTaskId, string msg); } @@ -28,6 +32,7 @@ namespace IRaCIS.Core.API { public ILogger _logger { get; set; } + //public IUserInfo _userInfo { get; set; } public UploadHub(/*IUserInfo userInfo,*/ ILogger logger) { @@ -38,7 +43,6 @@ namespace IRaCIS.Core.API public override Task OnConnectedAsync() { - //base.Context.User.id _logger.LogError("连接: " + Context.ConnectionId); @@ -47,12 +51,7 @@ namespace IRaCIS.Core.API return base.OnConnectedAsync(); } - //public async Task SendProgress(string studyInstanceUid, int haveReceivedCount) - //{ - // await Clients.All.ReceivProgressAsync(studyInstanceUid, haveReceivedCount); - //} - } } diff --git a/IRaCIS.Core.API/appsettings.Test-EIImageViewer.json b/IRaCIS.Core.API/appsettings.Test_510K.json similarity index 65% rename from IRaCIS.Core.API/appsettings.Test-EIImageViewer.json rename to IRaCIS.Core.API/appsettings.Test_510K.json index 025f135..9d47095 100644 --- a/IRaCIS.Core.API/appsettings.Test-EIImageViewer.json +++ b/IRaCIS.Core.API/appsettings.Test_510K.json @@ -7,9 +7,7 @@ } }, "ConnectionStrings": { - "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.EIImageViewer;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true", - "Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Hangfire_IRaCIS;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" - + "RemoteNew": "Server=192.168.3.69,1434;Database=Test_510K;User ID=sa;Password=xc@123456;TrustServerCertificate=true" }, "BasicSystemConfig": { diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index 1e323a4..98558e3 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -182,7 +182,9 @@ namespace IRaCIS.Core.Application.ViewModel public Guid? SourceSubjectVisitId { get; set; } public Guid? SouceReadModuleId { get; set; } + public PackState PackState { get; set; } + public string PackRelativePath { get; set; } } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/ImageShareModel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/ImageShareModel.cs index f5ce052..fb11af7 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/ImageShareModel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/ImageShareModel.cs @@ -1,22 +1,22 @@ using System; +using System.ComponentModel.DataAnnotations; namespace IRaCIS.Core.Application.Contracts.Dicom.DTO { public class ImageShareCommand { - public Guid TrialId { get; set; } - public Guid SiteId { get; set; } - public Guid SubjectId { get; set; } - public Guid? StudyId { get; set; } + [NotDefault] + public Guid VisitTaskId { get; set; } - public DateTime? ExpireTime { get; set; } + public string RouteUrl { get; set; } - public string Password { get; set; } = string.Empty; } public class ResourceInfo { - public Guid StudyId { get; set; } + public Guid VisitTaskId { get; set; } + + public string RouteUrl { get; set; } public string Token { get; set; } = string.Empty; } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/ImageShareService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/ImageShareService.cs index 2dfb177..e0ace6e 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/ImageShareService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/ImageShareService.cs @@ -29,54 +29,23 @@ namespace IRaCIS.Core.Application.Services [HttpPost] public async Task CreateImageShare(ImageShareCommand imageShareCommand) { - if (imageShareCommand.StudyId == null) - { + + var imageShare = _mapper.Map(imageShareCommand); - #region 上传不按照检查批次上传,基线没传,数据可能出错 + var addEntity = await _imageShareRepository.AddAsync(imageShare); - //var subjectVisit1 = _subjectVisitRepository.FirstOrDefault(t => - // t.TrialId == imageShareCommand.TrialId && t.SubjectId == imageShareCommand.SubjectId && - // t.VisitNum == 1); - - //if (subjectVisit1 == null) - //{ - // return ResponseOutput.NotOk("当前无影像数据,无法分享!"); - //} - - //imageShareCommand.StudyId = - // _studyRepository.GetAll().First(t => t.SubjectVisitId == subjectVisit1.Id&&t.Status != (int)StudyStatus.Abandon).Id; - - #endregion - - var studyIds = await _studyRepository.AsQueryable() - .Where(t => t.TrialId == imageShareCommand.TrialId && t.SubjectId == imageShareCommand.SubjectId && - t.SiteId == imageShareCommand.SiteId) - .Select(u => u.Id).ToListAsync(); - - if (!studyIds.Any()) - { - return ResponseOutput.NotOk("当前检查没有影像可以分享。 "); - } - - imageShareCommand.StudyId = studyIds.First(); - - } //验证码 4位 int verificationPassWord = new Random().Next(1000, 10000); - imageShareCommand.Password = verificationPassWord.ToString(); + addEntity.Password = verificationPassWord.ToString(); //配置文件读取过期时间 var days = AppSettings.ImageShareExpireDays; - imageShareCommand.ExpireTime = DateTime.Now.AddDays(days); - - var imageShare = _mapper.Map(imageShareCommand); - - await _imageShareRepository.AddAsync(imageShare); + addEntity.ExpireTime = DateTime.Now.AddDays(days); var success = await _imageShareRepository.SaveChangesAsync(); @@ -108,7 +77,8 @@ namespace IRaCIS.Core.Application.Services var resource = new ResourceInfo() { - StudyId = imageShare.StudyId, + VisitTaskId = imageShare.VisitTaskId, + RouteUrl=imageShare.RouteUrl, Token = _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo() { Id = Guid.Empty, diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index e9e705b..c848bbc 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -173,7 +173,11 @@ namespace IRaCIS.Core.Domain.Models //随访任务号 取检查批次的号 计划外是 检查批次+0.1 裁判任务在检查批次任务上+0.002 全局任务在截止检查批次号上+0.03 肿瘤待定 public decimal VisitTaskNum { get; set; } - + + + public PackState PackState { get; set; } + + public string PackRelativePath { get; set; } /// /// 首次阅片时间 @@ -372,3 +376,25 @@ namespace IRaCIS.Core.Domain.Models } } + +/// +/// 影像下载打包状态 +/// +public enum PackState +{ + + /// + /// 待打包 + /// + WaitPack = 0, + + /// + /// 打包中 + /// + Packing = 1, + + /// + /// 打包完成 + /// + Packed = 2 +} \ No newline at end of file diff --git a/IRaCIS.Core.Domain/Image/ImageShare.cs b/IRaCIS.Core.Domain/Image/ImageShare.cs index b688db3..ced4671 100644 --- a/IRaCIS.Core.Domain/Image/ImageShare.cs +++ b/IRaCIS.Core.Domain/Image/ImageShare.cs @@ -4,10 +4,9 @@ namespace IRaCIS.Core.Domain.Models { public class ImageShare: Entity { - public Guid TrialId { get; set; } - public Guid SiteId { get; set; } - public Guid SubjectId { get; set; } - public Guid StudyId { get; set; } + public Guid VisitTaskId { get; set; } + + public string RouteUrl { get; set; } public DateTime ExpireTime { get; set; } diff --git a/IRaCIS.Core.Domain/_Config/_StaticData.cs b/IRaCIS.Core.Domain/_Config/_StaticData.cs index 94b3ef3..cf35d79 100644 --- a/IRaCIS.Core.Domain/_Config/_StaticData.cs +++ b/IRaCIS.Core.Domain/_Config/_StaticData.cs @@ -21,6 +21,8 @@ public static class StaticData { public static readonly string IRaCISDataFolder = "EIImageViewerData"; + public static readonly string TempFileFolder = "TempFile"; + public static readonly string TrialDataFolder = "TrialData"; public static readonly string SystemDataFolder = "SystemData";