diff --git a/IRaCIS.Core.API/appsettings.Uat_IRC.json b/IRaCIS.Core.API/appsettings.Uat_IRC.json index 18d24b8ce..00bcdcae1 100644 --- a/IRaCIS.Core.API/appsettings.Uat_IRC.json +++ b/IRaCIS.Core.API/appsettings.Uat_IRC.json @@ -15,15 +15,16 @@ "ObjectStoreUse": "AliyunOSS", "AliyunOSS": { - "regionId": "cn-shanghai", - "internalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com", - "endpoint": "https://oss-cn-shanghai.aliyuncs.com", - "accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ", - "accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio", - "bucketName": "zy-irc-uat-store", - "roleArn": "acs:ram::1899121822495495:role/oss-upload", - "viewEndpoint": "https://zy-irc-uat-store.oss-cn-shanghai.aliyuncs.com", - "region": "oss-cn-shanghai" + "RegionId": "cn-shanghai", + "InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com", + "EndPoint": "https://oss-cn-shanghai.aliyuncs.com", + "AccessKeyId": "LTAI5tJV76pYX5yPg1N9QVE8", + "AccessKeySecret": "roRNLa9YG1of4pYruJGCNKBXEWTAWa", + "BucketName": "zy-irc-test-store", + "RoleArn": "acs:ram::1899121822495495:role/webdirect", + "ViewEndpoint": "https://zy-irc-test-store.oss-cn-shanghai.aliyuncs.com", + "Region": "oss-cn-shanghai", + "DurationSeconds": 7200 }, "MinIO": { diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 46c1ecdf5..3e79fff0b 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1002,11 +1002,12 @@ - + 在调用预归档前验证 这些检查是否可以全新上传还是已存在补充 目前前端允许 IsAllowUpload==true 全新、IsAllowReUpload==true 补充的study ,全部丢到后端,后端判断存在,就删除之前的检查,全新插入 + @@ -6871,6 +6872,11 @@ 答案分组 + + + 单位 + + 答案组合 diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index b59a3e043..69534ade5 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -256,18 +256,28 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc /// 在调用预归档前验证 这些检查是否可以全新上传还是已存在补充 目前前端允许 IsAllowUpload==true 全新、IsAllowReUpload==true 补充的study ,全部丢到后端,后端判断存在,就删除之前的检查,全新插入 /// /// + /// /// - public async Task> VerifyIRStudyAllowUpload(TaskStudyAchivePreConfirmCommand inCommand) + public async Task> VerifyIRStudyAllowUpload(TaskStudyAchivePreConfirmCommand inCommand, [FromServices] IRepository _dicomStudyRepository) { - var notAllowedUidList = _taskStudyRepository.Where(t => t.TrialId == inCommand.TrialId && inCommand.StudyInstanceUidList.Contains(t.StudyInstanceUid)).Select(t => new + var notAllowedUidList1 = _taskStudyRepository.Where(t => t.TrialId == inCommand.TrialId && inCommand.StudyInstanceUidList.Contains(t.StudyInstanceUid)).Select(t => new { t.StudyInstanceUid, t.SubjectId, SubejectCode = t.VisitTask.IsAnalysisCreate ? t.VisitTask.BlindSubjectCode : t.Subject.Code }).ToList(); + var notAllowedUidList2 = _dicomStudyRepository.Where(t => t.TrialId == inCommand.TrialId && inCommand.StudyInstanceUidList.Contains(t.StudyInstanceUid)).Select(t => new + { + t.StudyInstanceUid, + t.SubjectId, + SubejectCode = t.Subject.Code + }).ToList(); + + var notAllowedUidList = notAllowedUidList1.Union(notAllowedUidList2); + var result = new List(); foreach (var studyUid in inCommand.StudyInstanceUidList) @@ -275,6 +285,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var findStudy = notAllowedUidList.Where(t => t.StudyInstanceUid == studyUid).FirstOrDefault(); if (findStudy != null) { + //同一个subject 同一份影响 if (findStudy.SubejectCode == inCommand.SubjectCode && findStudy.SubjectId == inCommand.SubjectId) { @@ -574,7 +585,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc } else { - await _noneDicomStudyFileReposiotry.BatchDeleteNoTrackingAsync(t => t.VisitTaskId == visitTaskId && t.NoneDicomStudyId == noneDicomStudyId); + await _noneDicomStudyFileReposiotry.BatchDeleteNoTrackingAsync(t => t.VisitTaskId == visitTaskId && t.OriginNoneDicomStudyId == noneDicomStudyId); } return ResponseOutput.Ok(); @@ -590,9 +601,13 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc [HttpPost] public async Task> GetIRUploadTaskNoneDicomStudyList(IRUploadStudyQuery inQuery) { + var info = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId) + .Select(t => new { t.IsImageFilter, t.CriterionModalitys }).FirstNotNullAsync(); + var query = from u in _visitTaskRepository.Where(t => t.SubjectId == inQuery.SubjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect) - join ns in _noneDicomStudyReposiotry.Where(t => t.SubjectId == inQuery.SubjectId) on u.SourceSubjectVisitId equals ns.SubjectVisitId + join ns in _noneDicomStudyReposiotry.Where(t => t.SubjectId == inQuery.SubjectId).WhereIf(info.IsImageFilter,t=> ("|" + info.CriterionModalitys + "|").Contains("|" + t.Modality + "|")) + on u.SourceSubjectVisitId equals ns.SubjectVisitId select new TaskNoneDicomStudyDTO() { diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/NoneDicomStudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/NoneDicomStudyService.cs index 0e7c0e217..45d2f4a3a 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/NoneDicomStudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/NoneDicomStudyService.cs @@ -32,11 +32,11 @@ namespace IRaCIS.Core.Application.Contracts [FromQuery, NotDefault] Guid subjectVisitId, [FromQuery] Guid? nonedicomStudyId, [FromQuery] bool isFilterZip, - [FromQuery] Guid? visiTaskId) + [FromQuery] Guid? visitTaskId) { IQueryable noneDicomStudyQueryable = default; - if (visiTaskId == null) + if (visitTaskId == null) { noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.SubjectVisitId == subjectVisitId).WhereIf(nonedicomStudyId != null, t => t.Id == nonedicomStudyId) @@ -44,9 +44,9 @@ namespace IRaCIS.Core.Application.Contracts } else { - noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.TaskNoneDicomFileList.Any(t => t.VisitTaskId == visiTaskId)) + noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.TaskNoneDicomFileList.Any(t => t.VisitTaskId == visitTaskId)) .WhereIf(nonedicomStudyId != null, t => t.Id == nonedicomStudyId) - .ProjectTo(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip, visiTaskId = visiTaskId }); + .ProjectTo(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip, visiTaskId = visitTaskId }); } diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index e929e8702..0806e360d 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -599,8 +599,9 @@ namespace IRaCIS.Core.Application.Service Guid? visiTaskId = null; CreateMap() - .ForMember(d => d.NoneDicomStudyFileList, u => u.MapFrom(s => isFilterZip ? s.TaskNoneDicomFileList.WhereIf(visiTaskId!=null,t=>t.VisitTaskId==visiTaskId) - .Where(t => !t.FileType.Contains(StaticData.FileType.Zip)) : s.TaskNoneDicomFileList.WhereIf(visiTaskId != null, t => t.VisitTaskId == visiTaskId))) + .ForMember(d => d.NoneDicomStudyFileList, u => u.MapFrom(s => isFilterZip ? + s.TaskNoneDicomFileList.Where(t=> visiTaskId != null?t.VisitTaskId==visiTaskId:true).Where(t => !t.FileType.Contains(StaticData.FileType.Zip)) + : s.TaskNoneDicomFileList.Where(t => visiTaskId != null ? t.VisitTaskId == visiTaskId : true))) .ForMember(d => d.CodeView, u => u.MapFrom(s => s.StudyCode)); } diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectVisitConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectVisitConfigration.cs index 2025d4ce4..d916b4ee1 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectVisitConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectVisitConfigration.cs @@ -6,14 +6,10 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace IRaCIS.Core.Infra.EFCore.EntityConfigration { public class SubjectVisitConfigration : IEntityTypeConfiguration - { - - + { public void Configure(EntityTypeBuilder builder) { - - builder.HasOne(s => s.Subject).WithMany(sv => sv.SubjectVisitList); } } diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialDocumentConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialDocumentConfigration.cs deleted file mode 100644 index ff8d813cf..000000000 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialDocumentConfigration.cs +++ /dev/null @@ -1,38 +0,0 @@ -using IRaCIS.Core.Domain.Models; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - - -namespace IRaCIS.Core.Infra.EFCore.EntityConfigration -{ - public class TrialDocUserTypeConfirmConfigration : IEntityTypeConfiguration - { - - - public void Configure(EntityTypeBuilder builder) - { - ////项目文档 需要确认的用户类型 找到项目下对应用户类型的用户 用UserTypeId 关联 - //builder - // .HasMany(dd => dd.TrialUserList) - // .WithOne(d => d.TrialDocNeedConfirmedUserType) - // .HasForeignKey(s => new {/* s.TrialId,*/ s.User.UserTypeId }) - // .HasPrincipalKey(c => new { /*c.TrialDocument.TrialId,*/ c.NeedConfirmUserTypeId }); - } - } - - public class TrialDocConfirmUserConfigration : IEntityTypeConfiguration - { - - - public void Configure(EntityTypeBuilder builder) - { - - - //builder - // .HasOne(dd => dd.TrialUser) - // .WithMany(d => d.TrialDocUserConfirmedList) - // .HasForeignKey(s => new { s.TrialDocument.TrialId, s.ConfirmUserId }) - // .HasPrincipalKey(c => new { c.TrialId, c.UserId }); - } - } -} diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs index c3a433a58..a9173db0a 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs @@ -5,16 +5,6 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace IRaCIS.Core.Infra.EFCore.EntityConfigration { - public class TrialSiteConfigration : IEntityTypeConfiguration - { - - - public void Configure(EntityTypeBuilder builder) - { - - - } - } public class SubjectCriteriaEvaluationConfigration : IEntityTypeConfiguration { diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteSurveyConfigration .cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteSurveyConfigration .cs deleted file mode 100644 index 2637b26c4..000000000 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteSurveyConfigration .cs +++ /dev/null @@ -1,18 +0,0 @@ -using IRaCIS.Core.Domain.Models; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - - -namespace IRaCIS.Core.Infra.EFCore.EntityConfigration -{ - public class TrialSiteSurveyConfigration : IEntityTypeConfiguration - { - - - public void Configure(EntityTypeBuilder builder) - { - - - } - } -} diff --git a/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 b/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 new file mode 100644 index 000000000..33b575bf1 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 @@ -0,0 +1,14 @@ + +#οѧϰĵ +https://www.cnblogs.com/cqpanda/p/16815263.html + +# ָĿƣҪĿĿ¼ һpwershellĿĿ¼ҪָĿ + cd .\IRaCIS.Core.Test + + # Ŀ¼жģҪֶָ + + # dotnet ef migrations add ǩ -p Ŀ -c -o ǨļĿ¼ + + dotnet ef migrations add Initial -p IRaCIS.Core.Test -c IRCContext -o CodeFirstTest/MSSQL/Migrations + + dotnet ef database update -p IRaCIS.Core.Test -c IRCContext \ No newline at end of file diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs new file mode 100644 index 000000000..96b046415 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using IRaCIS.Core.Test.CodeFirstTest.MSSQL; +using Microsoft.EntityFrameworkCore; + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL; + +public partial class IRCContext : DbContext +{ + public IRCContext() + { + } + + public IRCContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet TrialImageDownload { get; set; } + + public virtual DbSet TestNew { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + => optionsBuilder.UseSqlServer("Server=106.14.89.110,1433;Database=IRC_Code;User ID=sa;Password=mssql_KnTs2a;TrustServerCertificate=true"); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + + + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.Designer.cs new file mode 100644 index 000000000..b4dbb3787 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.Designer.cs @@ -0,0 +1,100 @@ +// +using System; +using IRaCIS.Core.Test.CodeFirstTest.MSSQL; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations +{ + [DbContext(typeof(IRCContext))] + [Migration("20240910053652_testAdd")] + partial class testAdd + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TestName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("TestNew"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DownloadEndTime") + .HasColumnType("datetime2"); + + b.Property("DownloadStartTime") + .HasColumnType("datetime2"); + + b.Property("ImageCount") + .HasColumnType("int"); + + b.Property("ImageSize") + .HasColumnType("bigint"); + + b.Property("ImageType") + .HasColumnType("int"); + + b.Property("IsSuccess") + .HasColumnType("bit"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("TrialImageDownload"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.cs new file mode 100644 index 000000000..e42fa119c --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.cs @@ -0,0 +1,38 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations +{ + /// + public partial class testAdd : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "TestNew", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TestName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + CreateUserId = table.Column(type: "uniqueidentifier", nullable: false), + CreateTime = table.Column(type: "datetime2", nullable: false), + UpdateUserId = table.Column(type: "uniqueidentifier", nullable: false), + UpdateTime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TestNew", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "TestNew"); + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.Designer.cs new file mode 100644 index 000000000..760de65c8 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.Designer.cs @@ -0,0 +1,119 @@ +// +using System; +using IRaCIS.Core.Test.CodeFirstTest.MSSQL; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations +{ + [DbContext(typeof(IRCContext))] + [Migration("20240910055957_navigateTest")] + partial class navigateTest + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TestName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TrialImageDownloadId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TrialImageDownloadId"); + + b.ToTable("TestNew"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DownloadEndTime") + .HasColumnType("datetime2"); + + b.Property("DownloadStartTime") + .HasColumnType("datetime2"); + + b.Property("ImageCount") + .HasColumnType("int"); + + b.Property("ImageSize") + .HasColumnType("bigint"); + + b.Property("ImageType") + .HasColumnType("int"); + + b.Property("IsSuccess") + .HasColumnType("bit"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("TrialImageDownload"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", null) + .WithMany("TestNewList") + .HasForeignKey("TrialImageDownloadId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => + { + b.Navigation("TestNewList"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.cs new file mode 100644 index 000000000..0f56141b3 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.cs @@ -0,0 +1,51 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations +{ + /// + public partial class navigateTest : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TrialImageDownloadId", + table: "TestNew", + type: "uniqueidentifier", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); + + migrationBuilder.CreateIndex( + name: "IX_TestNew_TrialImageDownloadId", + table: "TestNew", + column: "TrialImageDownloadId"); + + migrationBuilder.AddForeignKey( + name: "FK_TestNew_TrialImageDownload_TrialImageDownloadId", + table: "TestNew", + column: "TrialImageDownloadId", + principalTable: "TrialImageDownload", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_TestNew_TrialImageDownload_TrialImageDownloadId", + table: "TestNew"); + + migrationBuilder.DropIndex( + name: "IX_TestNew_TrialImageDownloadId", + table: "TestNew"); + + migrationBuilder.DropColumn( + name: "TrialImageDownloadId", + table: "TestNew"); + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs new file mode 100644 index 000000000..f87ae145d --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs @@ -0,0 +1,116 @@ +// +using System; +using IRaCIS.Core.Test.CodeFirstTest.MSSQL; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations +{ + [DbContext(typeof(IRCContext))] + partial class IRCContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TestName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TrialImageDownloadId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TrialImageDownloadId"); + + b.ToTable("TestNew"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DownloadEndTime") + .HasColumnType("datetime2"); + + b.Property("DownloadStartTime") + .HasColumnType("datetime2"); + + b.Property("ImageCount") + .HasColumnType("int"); + + b.Property("ImageSize") + .HasColumnType("bigint"); + + b.Property("ImageType") + .HasColumnType("int"); + + b.Property("IsSuccess") + .HasColumnType("bit"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("TrialImageDownload"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", null) + .WithMany("TestNewList") + .HasForeignKey("TrialImageDownloadId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => + { + b.Navigation("TestNewList"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs new file mode 100644 index 000000000..efc2707c7 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs @@ -0,0 +1,62 @@ +using IRaCIS.Core.Domain.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL +{ + + [Table("TrialImageDownload")] + public class TrialImageDownload : BaseFullAuditEntity + { + public Guid SubjectVisitId { get; set; } + + public bool IsSuccess { get; set; } + + public DateTime DownloadStartTime { get; set; } + public DateTime? DownloadEndTime { get; set; } + + public ImageType ImageType { get; set; } + + public int ImageCount { get; set; } + + public long ImageSize { get; set; } + + #region 测试导航属性 + + public List TestNewList { get; set; } + + #endregion + } + + public enum ImageType + { + Dicom = 1, + NoneDIcom = 2 + }; + + public class TestNew : BaseFullAuditEntity + { + public Guid TrialImageDownloadId { get; set; } + + [StringLength(100)] + public string TestName { get; set; } + } + + + public class Subject: BaseFullAuditEntity + { + public string Name { get; set; } + } + + public class SubejectVisit: BaseFullAuditEntity + { + + public Guid SubjectId { get; set; } + + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/PGContext.cs b/IRaCIS.Core.Test/CodeFirstTest/PGSQL/PGContext.cs similarity index 100% rename from IRaCIS.Core.Test/CodeFirstTest/PGContext.cs rename to IRaCIS.Core.Test/CodeFirstTest/PGSQL/PGContext.cs diff --git a/IRaCIS.Core.Test/CodeFirstTest/Subject.cs b/IRaCIS.Core.Test/CodeFirstTest/PGSQL/Subject.cs similarity index 100% rename from IRaCIS.Core.Test/CodeFirstTest/Subject.cs rename to IRaCIS.Core.Test/CodeFirstTest/PGSQL/Subject.cs diff --git a/IRaCIS.Core.Test/Program.cs b/IRaCIS.Core.Test/Program.cs index 90e84d66e..b2b5d4a75 100644 --- a/IRaCIS.Core.Test/Program.cs +++ b/IRaCIS.Core.Test/Program.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using static System.Net.Mime.MediaTypeNames; partial class Program { @@ -55,7 +56,15 @@ partial class Program // 要生成的表名数组 - var tableNames = new List(args); + var tableNames = new List(args); + + var argsStr = args.ToString()??string.Empty; + + if (argsStr.Contains(".") || argsStr.Contains("-")|| argsStr.Contains("application")|| argsStr.Contains("IR")) + { + tableNames = new List(); + } + try {