修改上传监控
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
4048be622f
commit
d600862fb0
|
@ -407,6 +407,12 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
//IR 上传的时候跟任务绑定
|
//IR 上传的时候跟任务绑定
|
||||||
public Guid? VisitTaskId { get; set; }
|
public Guid? VisitTaskId { get; set; }
|
||||||
|
|
||||||
|
public string RecordPath { get; set; }
|
||||||
|
|
||||||
|
public int FailedFileCount { get; set; }
|
||||||
|
|
||||||
|
public long FileSize { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public List<OSSFileDTO> UploadedFileList { get; set; } = new List<OSSFileDTO>();
|
public List<OSSFileDTO> UploadedFileList { get; set; } = new List<OSSFileDTO>();
|
||||||
|
|
||||||
|
@ -420,6 +426,14 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
public string FileType { get; set; }
|
public string FileType { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 非dicom 上传预上传接口
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="preArchiveStudyCommand"></param>
|
||||||
|
/// <param name="_studyService"></param>
|
||||||
|
/// <param name="_studyMonitorRepository"></param>
|
||||||
|
/// <returns></returns>
|
||||||
[HttpPost, Route("Study/PreArchiveStudy")]
|
[HttpPost, Route("Study/PreArchiveStudy")]
|
||||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||||
public async Task<IResponseOutput> PreArchiveStudy(PreArchiveStudyCommand preArchiveStudyCommand,
|
public async Task<IResponseOutput> PreArchiveStudy(PreArchiveStudyCommand preArchiveStudyCommand,
|
||||||
|
@ -437,6 +451,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
|
|
||||||
IsSuccess = false,
|
IsSuccess = false,
|
||||||
UploadStartTime = DateTime.Now,
|
UploadStartTime = DateTime.Now,
|
||||||
|
FileCount=preArchiveStudyCommand.FileCount,
|
||||||
IsDicom = preArchiveStudyCommand.IsDicom,
|
IsDicom = preArchiveStudyCommand.IsDicom,
|
||||||
IP = _userInfo.IP
|
IP = _userInfo.IP
|
||||||
};
|
};
|
||||||
|
@ -500,7 +515,9 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
|
|
||||||
noneDicomStudy.FileCount = noneDicomStudy.FileCount + (incommand.VisitTaskId != null ? 0 : incommand.UploadedFileList.Count);
|
noneDicomStudy.FileCount = noneDicomStudy.FileCount + (incommand.VisitTaskId != null ? 0 : incommand.UploadedFileList.Count);
|
||||||
|
|
||||||
studyMonitor.FileCount = incommand.UploadedFileList.Count;
|
studyMonitor.RecordPath = incommand.RecordPath;
|
||||||
|
studyMonitor.FailedFileCount = incommand.FailedFileCount;
|
||||||
|
studyMonitor.IsSuccess = incommand.FailedFileCount == 0;
|
||||||
studyMonitor.FileSize = incommand.UploadedFileList.Sum(t => t.FileFize);
|
studyMonitor.FileSize = incommand.UploadedFileList.Sum(t => t.FileFize);
|
||||||
studyMonitor.IsDicom = false;
|
studyMonitor.IsDicom = false;
|
||||||
studyMonitor.IsDicomReUpload = false;
|
studyMonitor.IsDicomReUpload = false;
|
||||||
|
@ -508,7 +525,6 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
studyMonitor.StudyCode = noneDicomStudy.StudyCode;
|
studyMonitor.StudyCode = noneDicomStudy.StudyCode;
|
||||||
studyMonitor.ArchiveFinishedTime = DateTime.Now;
|
studyMonitor.ArchiveFinishedTime = DateTime.Now;
|
||||||
studyMonitor.IP = _userInfo.IP;
|
studyMonitor.IP = _userInfo.IP;
|
||||||
studyMonitor.IsSuccess = true;
|
|
||||||
|
|
||||||
await _noneDicomStudyRepository.SaveChangesAsync();
|
await _noneDicomStudyRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
|
@ -281,6 +281,15 @@
|
||||||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.ArchiveStudyNew(System.Guid,System.Guid,System.String,System.Nullable{System.Guid},System.Guid,Microsoft.Extensions.Logging.ILogger{IRaCIS.Core.API.Controllers.UploadDownLoadController},IRaCIS.Core.Application.Contracts.IStudyService,Microsoft.AspNetCore.SignalR.IHubContext{IRaCIS.Core.API.UploadHub,IRaCIS.Core.API.IUploadClient},IRaCIS.Core.Application.Contracts.Dicom.IDicomArchiveService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.StudyMonitor})">
|
<member name="M:IRaCIS.Core.API.Controllers.StudyController.ArchiveStudyNew(System.Guid,System.Guid,System.String,System.Nullable{System.Guid},System.Guid,Microsoft.Extensions.Logging.ILogger{IRaCIS.Core.API.Controllers.UploadDownLoadController},IRaCIS.Core.Application.Contracts.IStudyService,Microsoft.AspNetCore.SignalR.IHubContext{IRaCIS.Core.API.UploadHub,IRaCIS.Core.API.IUploadClient},IRaCIS.Core.Application.Contracts.Dicom.IDicomArchiveService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.StudyMonitor})">
|
||||||
<summary>Dicom 归档</summary>
|
<summary>Dicom 归档</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.API.Controllers.StudyController.PreArchiveStudy(IRaCIS.Core.Application.Contracts.PreArchiveStudyCommand,IRaCIS.Core.Application.Contracts.IStudyService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.StudyMonitor})">
|
||||||
|
<summary>
|
||||||
|
非dicom 上传预上传接口
|
||||||
|
</summary>
|
||||||
|
<param name="preArchiveStudyCommand"></param>
|
||||||
|
<param name="_studyService"></param>
|
||||||
|
<param name="_studyMonitorRepository"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadNoneDicomFile(IRaCIS.Core.API.Controllers.StudyController.UploadNoneDicomFileCommand,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.StudyMonitor},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile})">
|
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadNoneDicomFile(IRaCIS.Core.API.Controllers.StudyController.UploadNoneDicomFileCommand,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.StudyMonitor},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile})">
|
||||||
<summary>
|
<summary>
|
||||||
上传非Dicom 文件 支持压缩包 多文件上传
|
上传非Dicom 文件 支持压缩包 多文件上传
|
||||||
|
|
|
@ -207,9 +207,6 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
[NotDefault]
|
[NotDefault]
|
||||||
public Guid SubjectVisitId { get; set; }
|
public Guid SubjectVisitId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public long FileSize { get; set; }
|
|
||||||
|
|
||||||
public bool IsDicomReUpload { get; set; }
|
public bool IsDicomReUpload { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
IP = _userInfo.IP,
|
IP = _userInfo.IP,
|
||||||
|
|
||||||
IsDicomReUpload = preArchiveStudyCommand.IsDicomReUpload,
|
IsDicomReUpload = preArchiveStudyCommand.IsDicomReUpload,
|
||||||
FileSize = preArchiveStudyCommand.FileSize,
|
|
||||||
FileCount = preArchiveStudyCommand.FileCount,
|
FileCount = preArchiveStudyCommand.FileCount,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -165,6 +164,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
studyMonitor.FailedFileCount = incommand.FailedFileCount;
|
studyMonitor.FailedFileCount = incommand.FailedFileCount;
|
||||||
studyMonitor.IsSuccess = incommand.FailedFileCount == 0;
|
studyMonitor.IsSuccess = incommand.FailedFileCount == 0;
|
||||||
studyMonitor.RecordPath = incommand.RecordPath;
|
studyMonitor.RecordPath = incommand.RecordPath;
|
||||||
|
studyMonitor.FileSize = incommand.Study.SeriesList.SelectMany(t=>t.InstanceList).Sum(t => t.FileSize);
|
||||||
|
|
||||||
var studyId = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString());
|
var studyId = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString());
|
||||||
var findStudy = await _dicomstudyRepository.FirstOrDefaultAsync(t => t.Id == studyId);
|
var findStudy = await _dicomstudyRepository.FirstOrDefaultAsync(t => t.Id == studyId);
|
||||||
|
|
|
@ -281,6 +281,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
public bool IsDicom { get; set; }
|
public bool IsDicom { get; set; }
|
||||||
|
|
||||||
|
public int FileCount { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,27 +110,25 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
public Guid TestId { get; set; }
|
public Guid TestId { get; set; }
|
||||||
|
|
||||||
public string TestName { get; set; }
|
public string TestName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public IResponseOutput TestJson()
|
public async Task<IResponseOutput> TestJson()
|
||||||
{
|
{
|
||||||
var trial=new Trial();
|
|
||||||
|
|
||||||
trial.ExperimentName = null;
|
await _trialBodyPartRepository.FirstOrDefaultAsync();
|
||||||
|
|
||||||
_trialRepository.AddAsync(trial,true);
|
|
||||||
|
|
||||||
|
await _trialBodyPartRepository.Where(t=>t.Trial.Id==Guid.Empty).FirstOrDefaultAsync();
|
||||||
|
|
||||||
return ResponseOutput.Ok(new TestModel(), IRCEmailPasswordHelper.GenerateRandomPassword(10));
|
return ResponseOutput.Ok(new TestModel(), IRCEmailPasswordHelper.GenerateRandomPassword(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string TestHoliday(DateTime startdate,DateTime endDate)
|
public string TestHoliday(DateTime startdate, DateTime endDate)
|
||||||
{
|
{
|
||||||
var timeSpan= HolidayHelper.GetChinaWorkTimeSpan(startdate, endDate);
|
var timeSpan = HolidayHelper.GetChinaWorkTimeSpan(startdate, endDate);
|
||||||
|
|
||||||
_userRepository.Where(t => t.Id == _userInfo.Id).Select(t => t.FullName).FirstOrDefault();
|
_userRepository.Where(t => t.Id == _userInfo.Id).Select(t => t.FullName).FirstOrDefault();
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations.Operations;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Convention
|
|
||||||
{
|
|
||||||
public class MigrationRemoveForeignKeysSqlGenerator : MigrationsSqlGenerator
|
|
||||||
{
|
|
||||||
public MigrationRemoveForeignKeysSqlGenerator(MigrationsSqlGeneratorDependencies dependencies, IMigrationsAnnotationProvider migrationsAnnotations) : base(dependencies)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Generate(Microsoft.EntityFrameworkCore.Migrations.Operations.CreateTableOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true)
|
|
||||||
{
|
|
||||||
operation.ForeignKeys.Clear();
|
|
||||||
base.Generate(operation, model, builder, terminate);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Generate(AddForeignKeyOperation operation, IModel? model, MigrationCommandListBuilder builder,
|
|
||||||
bool terminate = true)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
namespace IRaCIS.Core.Test
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 这种方式不行
|
||||||
|
/// </summary>
|
||||||
|
public class NoForeignKeyConvention : IModelFinalizingConvention
|
||||||
|
{
|
||||||
|
public void ProcessModelFinalizing(IConventionModelBuilder modelBuilder, IConventionContext<IConventionModelBuilder> context)
|
||||||
|
{
|
||||||
|
foreach (var entityType in modelBuilder.Metadata.GetEntityTypes())
|
||||||
|
{
|
||||||
|
foreach (var foreignKey in entityType.GetForeignKeys())
|
||||||
|
{
|
||||||
|
// 设置删除行为为 NoAction,避免生成外键约束
|
||||||
|
foreignKey.Builder.OnDelete(DeleteBehavior.NoAction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations.Operations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations.Internal;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage;
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Test
|
||||||
|
{
|
||||||
|
public class NoForeignKeyMigrationsSqlGenerator : MigrationsSqlGenerator
|
||||||
|
{
|
||||||
|
public NoForeignKeyMigrationsSqlGenerator(
|
||||||
|
MigrationsSqlGeneratorDependencies dependencies) : base(dependencies)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Generate(MigrationOperation operation, IModel model, MigrationCommandListBuilder builder)
|
||||||
|
{
|
||||||
|
if (operation is AddForeignKeyOperation || operation is DropForeignKeyOperation)
|
||||||
|
{
|
||||||
|
// 跳过外键的生成
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Generate(operation, model, builder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using IRaCIS.Core.Test.CodeFirstTest.MSSQL;
|
using IRaCIS.Core.Test.CodeFirstTest.MSSQL;
|
||||||
using IRaCIS.Core.Test.CodeFirstTest.MSSQL.Convention;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
@ -42,8 +41,9 @@ public partial class IRCContext : DbContext
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
//移除外键约束
|
|
||||||
optionsBuilder.ReplaceService<IMigrationsSqlGenerator, MigrationRemoveForeignKeysSqlGenerator>();
|
// 替换默认的 MigrationsSqlGenerator
|
||||||
|
optionsBuilder.ReplaceService<IMigrationsSqlGenerator, NoForeignKeyMigrationsSqlGenerator>();
|
||||||
optionsBuilder.UseSqlServer("Server=106.14.89.110,1433;Database=IRC_Code;User ID=sa;Password=mssql_KnTs2a;TrustServerCertificate=true");
|
optionsBuilder.UseSqlServer("Server=106.14.89.110,1433;Database=IRC_Code;User ID=sa;Password=mssql_KnTs2a;TrustServerCertificate=true");
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,12 +59,14 @@ public partial class IRCContext : DbContext
|
||||||
modelBuilder.ApplyConfiguration(configurationInstance);
|
modelBuilder.ApplyConfiguration(configurationInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OnModelCreatingPartial(modelBuilder);
|
OnModelCreatingPartial(modelBuilder);
|
||||||
}
|
}
|
||||||
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
|
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//针对字符串使用默认的长度配置
|
//针对字符串使用默认的长度配置
|
||||||
configurationBuilder.Conventions.Add(_ => new MaxStringLengthConvention());
|
configurationBuilder.Conventions.Add(_ => new MaxStringLengthConvention());
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(IRCContext))]
|
[DbContext(typeof(IRCContext))]
|
||||||
[Migration("20240912012757_RemoveForeignKey")]
|
[Migration("20240912054434_RemoveForeignKey")]
|
||||||
partial class RemoveForeignKey
|
partial class RemoveForeignKey
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
|
@ -151,16 +151,21 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL
|
||||||
#region 测试生成迁移移除外键约束
|
#region 测试生成迁移移除外键约束
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 测试迁移不生成外键约束,ef知道外键关系,但是数据库不保存外键
|
||||||
public class Project : BaseFullAuditEntity
|
public class Project : BaseFullAuditEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ProjectUser: BaseFullAuditEntity
|
public class ProjectUser : BaseFullAuditEntity
|
||||||
{
|
{
|
||||||
//外键
|
//外键
|
||||||
public Guid ProjectId { get; set; }
|
public Guid ProjectId { get; set; }
|
||||||
|
|
||||||
public Project Project { get; set; }
|
public Project Project { get; set; }
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue