From 6a6411dfb82bca3be157a3e870dc210652c1eeae Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 10 Sep 2024 10:16:25 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Reading/Dto/ReadingImageTaskViewModel.cs | 6 ++++++ .../Reading/ReadingImageTask/ReadingJudgeTaskService.cs | 1 + 2 files changed, 7 insertions(+) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index bba7f9d64..13ff07419 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -1911,6 +1911,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public List AnswerGroup { get; set; } + + /// + /// 单位 + /// + public ValueUnit? Unit { get; set; } + /// /// 答案组合 /// diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs index cb5c0597f..742ff0a80 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs @@ -47,6 +47,7 @@ namespace IRaCIS.Application.Services DictionaryCode=x.DictionaryCode, JudgeType = x.JudgeType, Type=x.Type, + Unit= x.Unit, ReadingQuestionTrialId = x.Id, JudgeDifferenceValue= x.JudgeDifferenceValue, JudgeDifferenceType=x.JudgeDifferenceType, From 08edc735e9fa90c47981735340a7b446dc73eae7 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 10 Sep 2024 13:29:37 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E5=A4=84?= =?UTF-8?q?=E7=90=86=E4=B8=8A=E4=BC=A0=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/appsettings.Uat_IRC.json | 19 ++++----- .../IRaCIS.Core.Application.xml | 3 +- .../ImageAndDoc/DownloadAndUploadService.cs | 15 ++++++- .../CodeFirstTest/CodeFirst使用说明 | 10 +++++ .../CodeFirstTest/MSSQL/IRCContext.cs | 33 ++++++++++++++++ .../CodeFirstTest/MSSQL/TrialImageDownload.cs | 39 +++++++++++++++++++ .../CodeFirstTest/{ => PGSQL}/PGContext.cs | 0 .../CodeFirstTest/{ => PGSQL}/Subject.cs | 0 IRaCIS.Core.Test/Program.cs | 9 ++++- 9 files changed, 115 insertions(+), 13 deletions(-) create mode 100644 IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs rename IRaCIS.Core.Test/CodeFirstTest/{ => PGSQL}/PGContext.cs (100%) rename IRaCIS.Core.Test/CodeFirstTest/{ => PGSQL}/Subject.cs (100%) 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..70f8f2414 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 ,全部丢到后端,后端判断存在,就删除之前的检查,全新插入 + diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index b59a3e043..0b0374d56 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) { diff --git a/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 b/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 new file mode 100644 index 000000000..93f496abe --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 @@ -0,0 +1,10 @@ + +#οѧϰĵ +https://www.cnblogs.com/cqpanda/p/16815263.html + +# ָĿƣҪĿĿ¼ һpwershellĿĿ¼ҪָĿ + cd .\IRaCIS.Core.Test + + # Ŀ¼жģҪֶָ + + dotnet ef migrations add Initial -p IRaCIS.Core.Test -c IRCContext -o CodeFirstTest/MSSQL/Migrations \ 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..c9d1ec42a --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs @@ -0,0 +1,33 @@ +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; } + + 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/TrialImageDownload.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs new file mode 100644 index 000000000..68da4fa79 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs @@ -0,0 +1,39 @@ +using IRaCIS.Core.Domain.Models; +using System; +using System.Collections.Generic; +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; } + } + + public enum ImageType + { + Dicom = 1, + NoneDIcom = 2 + }; + + public class TestNew: BaseFullAuditEntity + { + public string TestName { 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..ea6505eac 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,13 @@ partial class Program // 要生成的表名数组 - var tableNames = new List(args); + var tableNames = new List(args); + + if (args.Contains(".") || args.Contains("-")|| args.Contains("application")|| args.Contains("IR")) + { + tableNames = new List(); + } + try { From 36acbc1df8aa1a1cb845d9ea0d4d4a388b9fcd13 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 10 Sep 2024 13:50:35 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=90=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 5 + .../ImageAndDoc/NoneDicomStudyService.cs | 8 +- .../Service/QC/_MapConfig.cs | 5 +- .../CodeFirstTest/MSSQL/IRCContext.cs | 2 + .../20240910053652_testAdd.Designer.cs | 100 ++++++++++++++++++ .../Migrations/20240910053652_testAdd.cs | 38 +++++++ .../Migrations/IRCContextModelSnapshot.cs | 97 +++++++++++++++++ .../CodeFirstTest/MSSQL/TrialImageDownload.cs | 2 + IRaCIS.Core.Test/Program.cs | 4 +- 9 files changed, 254 insertions(+), 7 deletions(-) create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.Designer.cs create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.cs create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 70f8f2414..3e79fff0b 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -6872,6 +6872,11 @@ 答案分组 + + + 单位 + + 答案组合 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.Test/CodeFirstTest/MSSQL/IRCContext.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs index c9d1ec42a..96b046415 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs @@ -18,6 +18,8 @@ public partial class IRCContext : DbContext 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"); 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/IRCContextModelSnapshot.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs new file mode 100644 index 000000000..7e8a390aa --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs @@ -0,0 +1,97 @@ +// +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("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/TrialImageDownload.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs index 68da4fa79..5b27a47e1 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs @@ -1,6 +1,7 @@ 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; @@ -34,6 +35,7 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL public class TestNew: BaseFullAuditEntity { + [StringLength(100)] public string TestName { get; set; } } } diff --git a/IRaCIS.Core.Test/Program.cs b/IRaCIS.Core.Test/Program.cs index ea6505eac..b2b5d4a75 100644 --- a/IRaCIS.Core.Test/Program.cs +++ b/IRaCIS.Core.Test/Program.cs @@ -58,7 +58,9 @@ partial class Program // 要生成的表名数组 var tableNames = new List(args); - if (args.Contains(".") || args.Contains("-")|| args.Contains("application")|| args.Contains("IR")) + var argsStr = args.ToString()??string.Empty; + + if (argsStr.Contains(".") || argsStr.Contains("-")|| argsStr.Contains("application")|| argsStr.Contains("IR")) { tableNames = new List(); } From f6bcff7e133da03c9862d2da03aceb5aa9826c00 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 10 Sep 2024 14:25:25 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E5=90=8E=E5=A4=84=E7=90=86=E9=9D=9Edicom?= =?UTF-8?q?=E6=A3=80=E6=9F=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImageAndDoc/DownloadAndUploadService.cs | 2 +- .../SubjectVisitConfigration.cs | 6 +- .../TrialDocumentConfigration.cs | 38 ------ .../TrialSiteConfigration.cs | 10 -- .../TrialSiteSurveyConfigration .cs | 18 --- .../CodeFirstTest/CodeFirst使用说明 | 6 +- .../20240910055957_navigateTest.Designer.cs | 119 ++++++++++++++++++ .../Migrations/20240910055957_navigateTest.cs | 51 ++++++++ .../Migrations/IRCContextModelSnapshot.cs | 19 +++ .../CodeFirstTest/MSSQL/TrialImageDownload.cs | 10 +- 10 files changed, 205 insertions(+), 74 deletions(-) delete mode 100644 IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialDocumentConfigration.cs delete mode 100644 IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteSurveyConfigration .cs create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.Designer.cs create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.cs diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 0b0374d56..113b27916 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -585,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(); 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使用说明 index 93f496abe..33b575bf1 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 +++ b/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 @@ -7,4 +7,8 @@ https://www.cnblogs.com/cqpanda/p/16815263.html # Ŀ¼жģҪֶָ - dotnet ef migrations add Initial -p IRaCIS.Core.Test -c IRCContext -o CodeFirstTest/MSSQL/Migrations \ No newline at end of file + # 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/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 index 7e8a390aa..f87ae145d 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs @@ -38,6 +38,9 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations .HasMaxLength(100) .HasColumnType("nvarchar(100)"); + b.Property("TrialImageDownloadId") + .HasColumnType("uniqueidentifier"); + b.Property("UpdateTime") .HasColumnType("datetime2"); @@ -46,6 +49,8 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.HasKey("Id"); + b.HasIndex("TrialImageDownloadId"); + b.ToTable("TestNew"); }); @@ -91,6 +96,20 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations 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 index 5b27a47e1..277169b33 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs @@ -25,6 +25,12 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL public int ImageCount { get; set; } public long ImageSize { get; set; } + + #region 测试导航属性 + + public List TestNewList { get; set; } + + #endregion } public enum ImageType @@ -33,8 +39,10 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL NoneDIcom = 2 }; - public class TestNew: BaseFullAuditEntity + public class TestNew : BaseFullAuditEntity { + public Guid TrialImageDownloadId { get; set; } + [StringLength(100)] public string TestName { get; set; } } From 624d89563c55e989b711e296896b5b885795fcec Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 10 Sep 2024 14:40:48 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E5=BD=B1=E5=83=8F=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ImageAndDoc/DownloadAndUploadService.cs | 6 +++++- .../CodeFirstTest/MSSQL/TrialImageDownload.cs | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 113b27916..69534ade5 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -601,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.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs index 277169b33..efc2707c7 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs @@ -46,4 +46,17 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL [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; } + + } } From bc5956ed6696789fe94e26c11c8ef975f8e7be2d Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 10 Sep 2024 15:05:17 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs index 1a0b415f2..ce00af4bc 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs @@ -657,7 +657,7 @@ namespace IRaCIS.Core.Application.Services #region 非Dicom 检查查询 - var noDicomList = await _noneDicomStudyRepository.Where(x => x.TrialId == indto.TrialId && x.SubjectVisitId == indto.SujectVisitId && x.NoneDicomFileList.Any(t => !t.FileType.Contains(StaticData.FileType.Zip))) + var noDicomList = await _noneDicomStudyRepository.Where(x => x.TrialId == indto.TrialId && x.SubjectVisitId == indto.SujectVisitId ) .WhereIf(taskInfo.IsImageFilter == true, t => taskInfo.CriterionModalitys.Contains(t.Modality) ).ToListAsync(); From 5b52a3e67f97b49cbe5a0eaa98a18c94039d328b Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 10 Sep 2024 15:12:08 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs index ce00af4bc..18333ad99 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs @@ -697,7 +697,7 @@ namespace IRaCIS.Core.Application.Services SubjectVisitId=nodicom.SubjectVisitId, SubjectId=nodicom.SubjectId, SeriesNumber=1, - NoneDicomFileFirstFile=await _noneDicomStudyFileRepository.Where(x=>x.NoneDicomStudyId==item.StudyId && !x.FileType.Contains(StaticData.FileType.Zip)).Select(x=>x.Path).FirstOrDefaultAsync(), + NoneDicomFileFirstFile=await _noneDicomStudyFileRepository.Where(x=>x.NoneDicomStudyId==item.StudyId).Select(x=>x.Path).FirstOrDefaultAsync(), } }; From 31e2aa24b8ea4d7ed42768e3fa8028d7dc8eec36 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 10 Sep 2024 15:13:00 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9uat=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/appsettings.Uat_IRC.json | 15 +++++++++++++-- .../CodeFirstTest/MSSQL/IRCContext.cs | 4 ++++ .../CodeFirstTest/MSSQL/TrialImageDownload.cs | 18 +++++++++++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.API/appsettings.Uat_IRC.json b/IRaCIS.Core.API/appsettings.Uat_IRC.json index 00bcdcae1..1493f5f84 100644 --- a/IRaCIS.Core.API/appsettings.Uat_IRC.json +++ b/IRaCIS.Core.API/appsettings.Uat_IRC.json @@ -20,9 +20,9 @@ "EndPoint": "https://oss-cn-shanghai.aliyuncs.com", "AccessKeyId": "LTAI5tJV76pYX5yPg1N9QVE8", "AccessKeySecret": "roRNLa9YG1of4pYruJGCNKBXEWTAWa", - "BucketName": "zy-irc-test-store", + "BucketName": "zy-irc-uat-store", "RoleArn": "acs:ram::1899121822495495:role/webdirect", - "ViewEndpoint": "https://zy-irc-test-store.oss-cn-shanghai.aliyuncs.com", + "ViewEndpoint": "https://zy-irc-uat-store.oss-cn-shanghai.aliyuncs.com", "Region": "oss-cn-shanghai", "DurationSeconds": 7200 }, @@ -39,6 +39,17 @@ "secretKey": "DzMaU2L4OXl90uytwOmDXF2encN0Jf4Nxu2XkYqQ", "bucketName": "irc-uat" + }, + "AWS": { + "Region": "us-east-1", + "EndPoint": "s3.us-east-1.amazonaws.com", + "UseSSL": true, + "RoleArn": "arn:aws:iam::471112624751:role/sts_s3_upload", + "AccessKeyId": "AKIAW3MEAFJXWRCGSX5Z", + "SecretAccessKey": "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", + "BucketName": "ei-med-s3-lili-uat-store", + "ViewEndpoint": "https://ei-med-s3-lili-uat-store.s3.amazonaws.com/", + "DurationSeconds": 7200 } }, diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs index 96b046415..4f6220861 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs @@ -20,6 +20,10 @@ public partial class IRCContext : DbContext public virtual DbSet TestNew { get; set; } + public virtual DbSet Subject { get; set; } + + public virtual DbSet SubejectVisit { 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"); diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs index efc2707c7..06119c778 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs @@ -51,11 +51,27 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL public class Subject: BaseFullAuditEntity { public string Name { get; set; } + + + public Guid? LatestSubjectVisitId { get; set; } + + public Guid? FinalSubjectVisitId { get; set; } + + #region 同时配置一对多,一对一 导航属性 + + public SubejectVisit FinalSubjectVisit { get; set; } + + public SubejectVisit LatestSubjectVisit { get; set; } + + public List SubejectVisitList { get; set; } + #endregion + } public class SubejectVisit: BaseFullAuditEntity { - + public Subject Subject { get; set; } + public Guid SubjectId { get; set; } } From b59b46f938455aed9914b007ce5d17a2158394ed Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 10 Sep 2024 15:25:28 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E8=BF=98=E6=98=AF=E8=BF=87=E6=BB=A4zip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs index 18333ad99..1a0b415f2 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs @@ -657,7 +657,7 @@ namespace IRaCIS.Core.Application.Services #region 非Dicom 检查查询 - var noDicomList = await _noneDicomStudyRepository.Where(x => x.TrialId == indto.TrialId && x.SubjectVisitId == indto.SujectVisitId ) + var noDicomList = await _noneDicomStudyRepository.Where(x => x.TrialId == indto.TrialId && x.SubjectVisitId == indto.SujectVisitId && x.NoneDicomFileList.Any(t => !t.FileType.Contains(StaticData.FileType.Zip))) .WhereIf(taskInfo.IsImageFilter == true, t => taskInfo.CriterionModalitys.Contains(t.Modality) ).ToListAsync(); @@ -697,7 +697,7 @@ namespace IRaCIS.Core.Application.Services SubjectVisitId=nodicom.SubjectVisitId, SubjectId=nodicom.SubjectId, SeriesNumber=1, - NoneDicomFileFirstFile=await _noneDicomStudyFileRepository.Where(x=>x.NoneDicomStudyId==item.StudyId).Select(x=>x.Path).FirstOrDefaultAsync(), + NoneDicomFileFirstFile=await _noneDicomStudyFileRepository.Where(x=>x.NoneDicomStudyId==item.StudyId && !x.FileType.Contains(StaticData.FileType.Zip)).Select(x=>x.Path).FirstOrDefaultAsync(), } }; From 204cb19d9614c1147f0a7bfb50f529a8a4803a0a Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 10 Sep 2024 16:16:03 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Reading/ReadingCriterion/ReadingCriterionService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs index 2dd1fa9cc..3e10d2952 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs @@ -678,6 +678,7 @@ namespace IRaCIS.Core.Application.Service.RC case CriterionType.OCT: criterion.IsImageFilter = true; criterion.IsReadingPeriod = false; + criterion.IsGlobalReading = false; criterion.IsReadingTaskViewInOrder = ReadingOrder.SubjectRandom; criterion.ImageDownloadEnum = ReadingImageDownload.Subejct; criterion.ImageUploadEnum = ReadingImageUpload.IRReadingSubejctEnable; From 21cb07446935289f73d088bfb0309f02733f5427 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 10 Sep 2024 16:58:41 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Domain/Visit/SubjectVisit.cs | 2 - .../DictionaryConfigration.cs | 4 +- .../EntityConfigration/SubjectConfigration.cs | 6 +- .../SubjectVisitConfigration.cs | 16 -- .../CodeFirstTest/CodeFirst使用说明 | 9 +- .../DictionaryConfigration.cs | 24 ++ .../EntityConfigration/SubjectConfigration.cs | 33 +++ .../CodeFirstTest/MSSQL/IRCContext.cs | 14 +- ...910073024_oneToManyAndOneToOne.Designer.cs | 213 ++++++++++++++ .../20240910073024_oneToManyAndOneToOne.cs | 96 +++++++ ...75136_seftOneToManyAndOneToOne.Designer.cs | 269 ++++++++++++++++++ ...20240910075136_seftOneToManyAndOneToOne.cs | 60 ++++ .../Migrations/IRCContextModelSnapshot.cs | 154 +++++++++- .../CodeFirstTest/MSSQL/TrialImageDownload.cs | 62 +++- 14 files changed, 929 insertions(+), 33 deletions(-) delete mode 100644 IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectVisitConfigration.cs create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/DictionaryConfigration.cs create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/SubjectConfigration.cs create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.Designer.cs create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.cs create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.Designer.cs create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.cs diff --git a/IRaCIS.Core.Domain/Visit/SubjectVisit.cs b/IRaCIS.Core.Domain/Visit/SubjectVisit.cs index 44e477ee1..2e7a566fa 100644 --- a/IRaCIS.Core.Domain/Visit/SubjectVisit.cs +++ b/IRaCIS.Core.Domain/Visit/SubjectVisit.cs @@ -16,8 +16,6 @@ namespace IRaCIS.Core.Domain.Models [JsonIgnore] public TrialSite TrialSite { get; set; } - [JsonIgnore] - public VisitStage VisitStage { get; set; } [JsonIgnore] [ForeignKey("OutPlanPreviousVisitId")] public SubjectVisit OutPlanPreviousVisit { get; set; } diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/DictionaryConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/DictionaryConfigration.cs index 1326060fc..9d77cb761 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/DictionaryConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/DictionaryConfigration.cs @@ -16,8 +16,8 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration public void Configure(EntityTypeBuilder builder) { - - builder.HasMany(t => t.ChildList).WithOne(t => t.Parent); + //自身同时存在一对多 和一对一的关系,配置一对多的就可以,一对一 不用配置,有点奇怪 + builder.HasMany(t => t.ChildList).WithOne(t => t.Parent).HasForeignKey(d => d.ParentId); } } diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs index 239c349da..87893ad17 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs @@ -13,9 +13,9 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration { //不能同时配置一对多 和一对一 但是有时表要存储多的最新的 比如受试者 最新的访视 在这里要显示配置 - builder.HasOne(s => s.LatestSubjectVisit); - builder.HasOne(s => s.FinalSubjectVisit); - builder.HasMany(s => s.SubjectVisitList).WithOne(sv => sv.Subject); + builder.HasOne(s => s.LatestSubjectVisit).WithMany().HasForeignKey(t => t.LatestSubjectVisitId); + builder.HasOne(s => s.FinalSubjectVisit).WithMany().HasForeignKey(t => t.FinalSubjectVisitId); + builder.HasMany(s => s.SubjectVisitList).WithOne(sv => sv.Subject).HasForeignKey(t => t.SubjectId); } } } diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectVisitConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectVisitConfigration.cs deleted file mode 100644 index d916b4ee1..000000000 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectVisitConfigration.cs +++ /dev/null @@ -1,16 +0,0 @@ -using IRaCIS.Core.Domain.Models; -using Microsoft.EntityFrameworkCore; -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.Test/CodeFirstTest/CodeFirst使用说明 b/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 index 33b575bf1..5a329af9d 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 +++ b/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 @@ -2,13 +2,14 @@ #οѧϰĵ https://www.cnblogs.com/cqpanda/p/16815263.html -# ָĿƣҪĿĿ¼ һpwershellĿĿ¼ҪָĿ - cd .\IRaCIS.Core.Test - - # Ŀ¼жģҪֶָ # dotnet ef migrations add ǩ -p Ŀ -c -o ǨļĿ¼ + 1Ǩļ dotnet ef migrations add Initial -p IRaCIS.Core.Test -c IRCContext -o CodeFirstTest/MSSQL/Migrations + 2ղɵǨļ + dotnet ef migrations remove -p IRaCIS.Core.Test -c IRCContext + + 3Ǩļµݿ dotnet ef database update -p IRaCIS.Core.Test -c IRCContext \ No newline at end of file diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/DictionaryConfigration.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/DictionaryConfigration.cs new file mode 100644 index 000000000..07ea337df --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/DictionaryConfigration.cs @@ -0,0 +1,24 @@ +using IRaCIS.Core.Domain.Models; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL +{ + public class DictionaryConfigration : IEntityTypeConfiguration + { + + + public void Configure(EntityTypeBuilder builder) + { + + + builder.HasMany(t => t.ChildList).WithOne(t => t.Parent).HasForeignKey(d => d.ParentId); + + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/SubjectConfigration.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/SubjectConfigration.cs new file mode 100644 index 000000000..888935f60 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/SubjectConfigration.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL +{ + public class SubjectConfigration : IEntityTypeConfiguration + { + + + public void Configure(EntityTypeBuilder builder) + { + + //不能同时配置一对多 和一对一 但是有时表要存储多的最新的 比如受试者 最新的访视 在这里要显示配置 + builder.HasOne(s => s.LatestSubjectVisit); + builder.HasOne(s => s.FinalSubjectVisit); + builder.HasMany(s => s.SubejectVisitList).WithOne(sv => sv.Subject); + } + } + + public class TestOneConfigration : IEntityTypeConfiguration + { + + + public void Configure(EntityTypeBuilder builder) + { + + builder.HasOne(s => s.LatestTestMany).WithMany().HasForeignKey(t=>t.LatestTestManyId); + builder.HasOne(s => s.FinalTestMany).WithMany().HasForeignKey(t => t.FinalTestManyId); + builder.HasMany(s => s.TestManyList).WithOne(sv => sv.TestOne).HasForeignKey(t => t.TestOneId); + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs index 4f6220861..01eb69f95 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.Linq; +using System.Reflection; using IRaCIS.Core.Test.CodeFirstTest.MSSQL; using Microsoft.EntityFrameworkCore; @@ -24,13 +26,23 @@ public partial class IRCContext : DbContext public virtual DbSet SubejectVisit { get; set; } + public virtual DbSet Dictionary { get; set; } + public virtual DbSet TestOne { get; set; } + public virtual DbSet TestMany { 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) { + //遍历实体模型手动配置 + var typesToRegister = Assembly.GetExecutingAssembly().GetTypes().Where(q => q.GetInterface(typeof(IEntityTypeConfiguration<>).FullName) != null); + foreach (var type in typesToRegister) + { + dynamic configurationInstance = Activator.CreateInstance(type); + modelBuilder.ApplyConfiguration(configurationInstance); + } - OnModelCreatingPartial(modelBuilder); } diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.Designer.cs new file mode 100644 index 000000000..20cdc133f --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.Designer.cs @@ -0,0 +1,213 @@ +// +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("20240910073024_oneToManyAndOneToOne")] + partial class oneToManyAndOneToOne + { + /// + 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.SubejectVisit", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SubjectId"); + + b.ToTable("SubejectVisit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FinalSubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("LatestSubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("FinalSubjectVisitId"); + + b.HasIndex("LatestSubjectVisitId"); + + b.ToTable("Subject"); + }); + + 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.SubejectVisit", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", "Subject") + .WithMany("SubejectVisitList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subject"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "FinalSubjectVisit") + .WithMany() + .HasForeignKey("FinalSubjectVisitId"); + + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "LatestSubjectVisit") + .WithMany() + .HasForeignKey("LatestSubjectVisitId"); + + b.Navigation("FinalSubjectVisit"); + + b.Navigation("LatestSubjectVisit"); + }); + + 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.Subject", b => + { + b.Navigation("SubejectVisitList"); + }); + + 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/20240910073024_oneToManyAndOneToOne.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.cs new file mode 100644 index 000000000..3627f081b --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.cs @@ -0,0 +1,96 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations +{ + /// + public partial class oneToManyAndOneToOne : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "SubejectVisit", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + SubjectId = table.Column(type: "uniqueidentifier", 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_SubejectVisit", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Subject", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(max)", nullable: false), + LatestSubjectVisitId = table.Column(type: "uniqueidentifier", nullable: true), + FinalSubjectVisitId = table.Column(type: "uniqueidentifier", nullable: true), + 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_Subject", x => x.Id); + table.ForeignKey( + name: "FK_Subject_SubejectVisit_FinalSubjectVisitId", + column: x => x.FinalSubjectVisitId, + principalTable: "SubejectVisit", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Subject_SubejectVisit_LatestSubjectVisitId", + column: x => x.LatestSubjectVisitId, + principalTable: "SubejectVisit", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_SubejectVisit_SubjectId", + table: "SubejectVisit", + column: "SubjectId"); + + migrationBuilder.CreateIndex( + name: "IX_Subject_FinalSubjectVisitId", + table: "Subject", + column: "FinalSubjectVisitId"); + + migrationBuilder.CreateIndex( + name: "IX_Subject_LatestSubjectVisitId", + table: "Subject", + column: "LatestSubjectVisitId"); + + migrationBuilder.AddForeignKey( + name: "FK_SubejectVisit_Subject_SubjectId", + table: "SubejectVisit", + column: "SubjectId", + principalTable: "Subject", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_SubejectVisit_Subject_SubjectId", + table: "SubejectVisit"); + + migrationBuilder.DropTable( + name: "Subject"); + + migrationBuilder.DropTable( + name: "SubejectVisit"); + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.Designer.cs new file mode 100644 index 000000000..69d7b8786 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.Designer.cs @@ -0,0 +1,269 @@ +// +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("20240910075136_seftOneToManyAndOneToOne")] + partial class seftOneToManyAndOneToOne + { + /// + 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.Dictionary", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ConfigTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ConfigTypeId"); + + b.HasIndex("ParentId"); + + b.ToTable("Dictionary"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SubjectId"); + + b.ToTable("SubejectVisit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FinalSubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("LatestSubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("FinalSubjectVisitId"); + + b.HasIndex("LatestSubjectVisitId"); + + b.ToTable("Subject"); + }); + + 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.Dictionary", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "ConfigType") + .WithMany() + .HasForeignKey("ConfigTypeId"); + + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "Parent") + .WithMany("ChildList") + .HasForeignKey("ParentId"); + + b.Navigation("ConfigType"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", "Subject") + .WithMany("SubejectVisitList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subject"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "FinalSubjectVisit") + .WithMany() + .HasForeignKey("FinalSubjectVisitId"); + + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "LatestSubjectVisit") + .WithMany() + .HasForeignKey("LatestSubjectVisitId"); + + b.Navigation("FinalSubjectVisit"); + + b.Navigation("LatestSubjectVisit"); + }); + + 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.Dictionary", b => + { + b.Navigation("ChildList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => + { + b.Navigation("SubejectVisitList"); + }); + + 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/20240910075136_seftOneToManyAndOneToOne.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.cs new file mode 100644 index 000000000..32920762b --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.cs @@ -0,0 +1,60 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations +{ + /// + public partial class seftOneToManyAndOneToOne : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Dictionary", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ParentId = table.Column(type: "uniqueidentifier", nullable: true), + ConfigTypeId = table.Column(type: "uniqueidentifier", nullable: true), + Code = table.Column(type: "nvarchar(max)", 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_Dictionary", x => x.Id); + table.ForeignKey( + name: "FK_Dictionary_Dictionary_ConfigTypeId", + column: x => x.ConfigTypeId, + principalTable: "Dictionary", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Dictionary_Dictionary_ParentId", + column: x => x.ParentId, + principalTable: "Dictionary", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_Dictionary_ConfigTypeId", + table: "Dictionary", + column: "ConfigTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_Dictionary_ParentId", + table: "Dictionary", + column: "ParentId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Dictionary"); + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs index f87ae145d..ffb12bafa 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs @@ -22,6 +22,105 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ConfigTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ConfigTypeId"); + + b.HasIndex("ParentId"); + + b.ToTable("Dictionary", (string)null); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SubjectId"); + + b.ToTable("SubejectVisit", (string)null); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FinalSubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("LatestSubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("FinalSubjectVisitId"); + + b.HasIndex("LatestSubjectVisitId"); + + b.ToTable("Subject", (string)null); + }); + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => { b.Property("Id") @@ -51,7 +150,7 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.HasIndex("TrialImageDownloadId"); - b.ToTable("TestNew"); + b.ToTable("TestNew", (string)null); }); modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => @@ -94,7 +193,48 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.HasKey("Id"); - b.ToTable("TrialImageDownload"); + b.ToTable("TrialImageDownload", (string)null); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "ConfigType") + .WithMany() + .HasForeignKey("ConfigTypeId"); + + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "Parent") + .WithMany("ChildList") + .HasForeignKey("ParentId"); + + b.Navigation("ConfigType"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", "Subject") + .WithMany("SubejectVisitList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subject"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "FinalSubjectVisit") + .WithMany() + .HasForeignKey("FinalSubjectVisitId"); + + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "LatestSubjectVisit") + .WithMany() + .HasForeignKey("LatestSubjectVisitId"); + + b.Navigation("FinalSubjectVisit"); + + b.Navigation("LatestSubjectVisit"); }); modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => @@ -106,6 +246,16 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations .IsRequired(); }); + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b => + { + b.Navigation("ChildList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => + { + b.Navigation("SubejectVisitList"); + }); + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => { b.Navigation("TestNewList"); diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs index 06119c778..56a90d864 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs @@ -1,4 +1,5 @@ using IRaCIS.Core.Domain.Models; +using IRaCIS.Core.Domain.Share; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -48,7 +49,7 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL } - public class Subject: BaseFullAuditEntity + public class Subject : BaseFullAuditEntity { public string Name { get; set; } @@ -59,8 +60,10 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL #region 同时配置一对多,一对一 导航属性 + [ForeignKey("FinalSubjectVisitId")] public SubejectVisit FinalSubjectVisit { get; set; } + [ForeignKey("LatestSubjectVisitId")] public SubejectVisit LatestSubjectVisit { get; set; } public List SubejectVisitList { get; set; } @@ -68,11 +71,64 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL } - public class SubejectVisit: BaseFullAuditEntity + public class SubejectVisit : BaseFullAuditEntity { public Subject Subject { get; set; } - + public Guid SubjectId { get; set; } } + + + public class Dictionary : BaseFullAuditEntity + { + #region 导航属性 + [ForeignKey("ConfigTypeId")] + public Dictionary ConfigType { get; set; } + + [ForeignKey("ParentId")] + public Dictionary Parent { get; set; } + + public List ChildList { get; set; } = new List(); + + #endregion + + + public Guid? ParentId { get; set; } + + + public Guid? ConfigTypeId { get; set; } + + public string Code { get; set; } + } + + + public class TestOne : BaseFullAuditEntity + { + public string Code { get; set; } + + [ForeignKey(nameof(TestOne.FinalTestMany))] + public Guid? LatestTestManyId { get; set; } + + [ForeignKey(nameof(TestOne.LatestTestMany))] + public Guid? FinalTestManyId { get; set; } + + #region 同时配置一对多,一对一 导航属性 + + + public TestMany FinalTestMany { get; set; } + + public TestMany LatestTestMany { get; set; } + + public List TestManyList { get; set; } + + #endregion + } + + public class TestMany : BaseFullAuditEntity + { + public TestOne TestOne { get; set; } + + public Guid TestOneId { get; set; } + } } From 2aa63a6132e2b61e4ca03c427c1730339a357e25 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 10 Sep 2024 17:11:43 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BD=B1=E5=83=8F?= =?UTF-8?q?=E5=90=8E=E5=A4=84=E7=90=86nonedicom=20=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Visit/DTO/VisitPointViewModel.cs | 3 +++ .../Service/Visit/SubjectVisitService.cs | 25 +++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Visit/DTO/VisitPointViewModel.cs b/IRaCIS.Core.Application/Service/Visit/DTO/VisitPointViewModel.cs index 31e34b7b0..af0413301 100644 --- a/IRaCIS.Core.Application/Service/Visit/DTO/VisitPointViewModel.cs +++ b/IRaCIS.Core.Application/Service/Visit/DTO/VisitPointViewModel.cs @@ -186,8 +186,11 @@ namespace IRaCIS.Core.Application.Contracts public class GetReadingVisitStudyListIndto { + [NotDefault] public Guid TrialId { get; set; } + [NotDefault] public Guid SujectVisitId { get; set; } + [NotDefault] public Guid VisitTaskId { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs index 1a0b415f2..d393bdbf7 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs @@ -37,7 +37,7 @@ namespace IRaCIS.Core.Application.Services IRepository _trialReadingCriterionRepository ) : BaseService, ISubjectVisitService { - + [HttpPost] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] @@ -541,7 +541,7 @@ namespace IRaCIS.Core.Application.Services SeriesId = x.SeriesId, StudyId = x.StudyId, InstanceId = x.InstanceId, - NumberOfFrames=x.NumberOfFrames, + NumberOfFrames = x.NumberOfFrames, }).ToListAsync(); @@ -594,20 +594,20 @@ namespace IRaCIS.Core.Application.Services HtmlPath = k.HtmlPath, Path = k.Path, InstanceNumber = k.InstanceNumber, - StudyId= k.StudyId, - SeriesId= k.SeriesId, + StudyId = k.StudyId, + SeriesId = k.SeriesId, }).ToListAsync(); item.InstanceInfoList.ForEach(x => { - var keyFramesList = rowInfoList.Where(y => y.InstanceId == x.Id&&y.NumberOfFrames!=0).Select(y => y.NumberOfFrames).Distinct().ToList(); + var keyFramesList = rowInfoList.Where(y => y.InstanceId == x.Id && y.NumberOfFrames != 0).Select(y => y.NumberOfFrames).Distinct().ToList(); if (keyFramesList.Count() > 0) { x.KeyFramesList = keyFramesList; } - + var item = rowInfoList.FirstOrDefault(y => y.InstanceId == x.Id); if (item != null) { @@ -632,7 +632,7 @@ namespace IRaCIS.Core.Application.Services - studyList.Insert(0,thisVisitTaskStudy); + studyList.Insert(0, thisVisitTaskStudy); } @@ -658,7 +658,7 @@ namespace IRaCIS.Core.Application.Services #region 非Dicom 检查查询 var noDicomList = await _noneDicomStudyRepository.Where(x => x.TrialId == indto.TrialId && x.SubjectVisitId == indto.SujectVisitId && x.NoneDicomFileList.Any(t => !t.FileType.Contains(StaticData.FileType.Zip))) - .WhereIf(taskInfo.IsImageFilter == true, t => taskInfo.CriterionModalitys.Contains(t.Modality) ).ToListAsync(); + .WhereIf(taskInfo.IsImageFilter == true, t => taskInfo.CriterionModalitys.Contains(t.Modality)).ToListAsync(); List noDicomStudyList = noDicomList.Select(x => new VisitStudyDTO() @@ -672,11 +672,14 @@ namespace IRaCIS.Core.Application.Services }).ToList(); + var isExistTaskNoneDicomFile = _noneDicomStudyFileRepository.Any(t => t.OriginNoneDicomStudyId == indto.VisitTaskId); + foreach (var item in noDicomStudyList) { var nodicom = noDicomList.Where(x => x.Id == item.StudyId).First(); - var instanceCount = await _noneDicomStudyFileRepository.Where(x => x.NoneDicomStudyId == item.StudyId).CountAsync(); + var instanceCount = await _noneDicomStudyFileRepository.WhereIf(isExistTaskNoneDicomFile,x=>x.OriginNoneDicomStudyId== item.StudyId) + .WhereIf(isExistTaskNoneDicomFile==false, x=>x.NoneDicomStudyId == item.StudyId).CountAsync(); if (instanceCount == 0) { @@ -697,7 +700,9 @@ namespace IRaCIS.Core.Application.Services SubjectVisitId=nodicom.SubjectVisitId, SubjectId=nodicom.SubjectId, SeriesNumber=1, - NoneDicomFileFirstFile=await _noneDicomStudyFileRepository.Where(x=>x.NoneDicomStudyId==item.StudyId && !x.FileType.Contains(StaticData.FileType.Zip)).Select(x=>x.Path).FirstOrDefaultAsync(), + NoneDicomFileFirstFile=await _noneDicomStudyFileRepository.WhereIf(isExistTaskNoneDicomFile,x=>x.OriginNoneDicomStudyId== item.StudyId) + .WhereIf(isExistTaskNoneDicomFile==false, x=>x.NoneDicomStudyId == item.StudyId) + .Where(x=> !x.FileType.Contains(StaticData.FileType.Zip)).Select(x=>x.Path).FirstOrDefaultAsync(), } }; From e012384dfa0d833b0629f410d109c5c42c71255a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 10 Sep 2024 17:27:25 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs index d393bdbf7..ee4383ff0 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs @@ -672,7 +672,7 @@ namespace IRaCIS.Core.Application.Services }).ToList(); - var isExistTaskNoneDicomFile = _noneDicomStudyFileRepository.Any(t => t.OriginNoneDicomStudyId == indto.VisitTaskId); + var isExistTaskNoneDicomFile = _noneDicomStudyFileRepository.Any(t => t.VisitTaskId == indto.VisitTaskId); foreach (var item in noDicomStudyList) { From 6b7542b11f90a126b96d7b525602462bc09e3b8d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 10 Sep 2024 17:44:36 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=98=85=E7=89=87?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=9D=9Edicom=20=E6=A3=80=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=90=8E=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReadingNoDicomTaskService.cs | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingNoDicomTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingNoDicomTaskService.cs index 4f3a7c39d..0276b80f9 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingNoDicomTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingNoDicomTaskService.cs @@ -6,6 +6,7 @@ using Panda.DynamicWebApi.Attributes; using IRaCIS.Core.Application.Contracts; using MassTransit; using IRaCIS.Core.Application.Filter; +using IRaCIS.Core.Domain.Models; namespace IRaCIS.Application.Services { @@ -66,7 +67,7 @@ namespace IRaCIS.Application.Services /// /// [HttpPost] - public async Task> > GetReadingImageFile(GetReadingImgInDto inDto) + public async Task>> GetReadingImageFile(GetReadingImgInDto inDto) { var task = await GetNextTask(new GetNextTaskInDto() { @@ -84,10 +85,26 @@ namespace IRaCIS.Application.Services // 阅片期取前面所有的图像 visitIds.AddRange(await _subjectVisitRepository.Where(x => x.VisitNum <= task.VisitNum && x.SubjectId == task.SubjectId).Select(x => x.Id).ToListAsync()); } - List result = await _noneDicomStudyRepository.Where(t => visitIds.Contains(t.SubjectVisitId) && t.NoneDicomFileList.Any(t=>!t.FileType.Contains(StaticData.FileType.Zip))) - .ProjectTo(_mapper.ConfigurationProvider, new { isFilterZip = true }).ToListAsync(); - var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisistTaskId).FirstNotNullAsync(); + var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisistTaskId).Select(t => new { t.BlindSubjectCode, t.TrialReadingCriterionId, t.TrialReadingCriterion.IsImageFilter, t.TrialReadingCriterion.CriterionModalitys }).FirstNotNullAsync(); + + + IQueryable noneDicomStudyQueryable = default; + if (inDto.VisistTaskId == null) + { + noneDicomStudyQueryable = _noneDicomStudyRepository + .Where(t => visitIds.Contains(t.SubjectVisitId) && t.NoneDicomFileList.Any(t => !t.FileType.Contains(StaticData.FileType.Zip))) + .WhereIf(taskinfo.IsImageFilter == true, t => taskinfo.CriterionModalitys.Contains(t.Modality)) + .ProjectTo(_mapper.ConfigurationProvider, new { isFilterZip = true }); + } + else + { + noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.TaskNoneDicomFileList.Any(t => t.VisitTaskId == inDto.VisistTaskId)) + .Where(t => visitIds.Contains(t.SubjectVisitId)) + .ProjectTo(_mapper.ConfigurationProvider, new { isFilterZip = true, visiTaskId = inDto.VisistTaskId }); + } + List result = await noneDicomStudyQueryable.ToListAsync(); + var trialInfo = await _trialRepository.Where(x => x.Id == inDto.TrialId).Select(x => new { @@ -121,7 +138,7 @@ namespace IRaCIS.Application.Services var taskInfo = await _visitTaskRepository.Where(x => x.Id == task.VisitTaskId).FirstNotNullAsync(); - return ResponseOutput.Ok (result, new + return ResponseOutput.Ok(result, new { VisitTaskId = task.VisitTaskId, SubjectId = task.SubjectId, From 60330fbd93b933759d21d8aebae45b85b9e4387c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 10 Sep 2024 17:54:20 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=8D=E9=A6=88bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Management/_MapConfig.cs | 3 ++- IRaCIS.Core.Domain/Management/UserFeedBack.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs index d9ec78199..afc1653ac 100644 --- a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs @@ -136,7 +136,8 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.FeedBackUserName, c => c.MapFrom(t => t.CreateUser.UserName)) .ForMember(d => d.FeedBackFullName, c => c.MapFrom(t => t.CreateUser.FullName)) .ForMember(d => d.UserTypeEnum, c => c.MapFrom(t => t.CreateUser.UserTypeEnum)); - CreateMap().ReverseMap(); + + CreateMap().ReverseMap(); } } diff --git a/IRaCIS.Core.Domain/Management/UserFeedBack.cs b/IRaCIS.Core.Domain/Management/UserFeedBack.cs index f83a4e91b..d02c8c12e 100644 --- a/IRaCIS.Core.Domain/Management/UserFeedBack.cs +++ b/IRaCIS.Core.Domain/Management/UserFeedBack.cs @@ -33,7 +33,7 @@ namespace IRaCIS.Core.Domain.Models public VisitTask VisitTask { get; set; } [NotMapped] - public List ScreenshotList => JsonConvert.DeserializeObject>(ScreenshotListStr); + public List FeedBackScreenshotList => JsonConvert.DeserializeObject>(ScreenshotListStr); #endregion From f7dd5117a01da78b989cc731db1d731d48a19ec1 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 10 Sep 2024 18:08:23 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E5=AD=A6?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs | 2 ++ .../Service/ImageAndDoc/DownloadAndUploadService.cs | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs index 088c77ef3..8a3f8d0a1 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs @@ -527,6 +527,8 @@ namespace IRaCIS.Core.Application.Contracts [NotDefault] public string SubjectCode { get; set; } + + public Guid? VisitTaskId { get; set; } } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 69534ade5..edd727cbc 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -738,9 +738,16 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc [HttpPost] public async Task> GetSubjectImageDownloadSelectList(IRReadingDownloadQuery inQuery) { + var doctorUserId = _userInfo.Id; + + //医学审核查看下载按钮,这个时候需要知道医生 + if (inQuery.VisitTaskId != null && inQuery.VisitTaskId!=Guid.Empty) + { + doctorUserId = await _visitTaskRepository.Where(t => t.Id == inQuery.VisitTaskId).Select(t => (Guid)t.DoctorUserId).FirstNotNullAsync(); + } var query = _visitTaskRepository.Where(t => t.SubjectId == inQuery.SubjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId - && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect) + && t.SourceSubjectVisitId != null && t.DoctorUserId == doctorUserId && t.TaskState == TaskState.Effect) .ProjectTo(_mapper.ConfigurationProvider); From 405454f71f0e88bb11562a3845eac508e97abf23 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 10 Sep 2024 18:46:00 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E8=87=B4?= =?UTF-8?q?=E6=80=A7=E5=88=86=E6=9E=90=20=E4=B8=8B=E8=BD=BD=E5=BD=B1?= =?UTF-8?q?=E5=83=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImageAndDoc/DTO/UnionStudyViewDodel.cs | 2 +- .../ImageAndDoc/DownloadAndUploadService.cs | 8 ++++- .../EntityConfigration/DoctorConfigration.cs | 33 ------------------- .../ReadModuleConfigration.cs | 2 +- 4 files changed, 9 insertions(+), 36 deletions(-) delete mode 100644 IRaCIS.Core.Infra.EFCore/EntityConfigration/DoctorConfigration.cs diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs index 8a3f8d0a1..7d82d7ec2 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs @@ -556,6 +556,6 @@ namespace IRaCIS.Core.Application.Contracts { public Guid SubjectVisitId { get; set; } - public Guid VisitTaskId { get; set; } + public Guid TaskId { get; set; } } } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index edd727cbc..e9ad732f9 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -823,10 +823,16 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var isQueryDicom = inQuery.DicomStudyIdList.Count > 0; var isQueryNoneDicom = inQuery.NoneDicomStudyIdList.Count > 0; + var taskIdList = inQuery.SubjectVisitTaskList.Select(t => t.TaskId).ToList(); + var subjectVisitIdList = inQuery.SubjectVisitTaskList.Select(t => t.SubjectVisitId).ToList(); + //var a = _visitTaskRepository.Where(t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.DoctorUserId == _userInfo.Id); + var query = from sv in _subjectRepository.Where(t => t.Id == inQuery.SubjectId).SelectMany(t => t.SubjectVisitList.Where(t => subjectVisitIdList.Contains(t.Id))) - join visitTask in _visitTaskRepository.Where(t => t.TaskState == TaskState.Effect && t.DoctorUserId == _userInfo.Id && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) + //一致性分析,导致查询出来两条数据 + join visitTask in _visitTaskRepository.Where(t=> taskIdList.Contains(t.Id)) /*.Where(t => t.TaskState == TaskState.Effect && t.DoctorUserId == _userInfo.Id && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)*/ + on sv.Id equals visitTask.SourceSubjectVisitId select new { diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/DoctorConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/DoctorConfigration.cs deleted file mode 100644 index a9011126a..000000000 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/DoctorConfigration.cs +++ /dev/null @@ -1,33 +0,0 @@ -using IRaCIS.Core.Domain.Models; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using System.Reflection.Emit; - - -namespace IRaCIS.Core.Infra.EFCore.EntityConfigration -{ - public class DoctorConfigration : IEntityTypeConfiguration - { - - - public void Configure(EntityTypeBuilder builder) - { - builder - .HasOne(dd => dd.Doctor) - .WithMany(p => p.DoctorDicRelationList) - .HasForeignKey(dd => dd.DoctorId); - - builder - .HasOne(dd => dd.Dictionary) - .WithMany(d => d.DoctorDicRelationList) - .HasForeignKey(dd => dd.DictionaryId); - } - - - } - - - - -} diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/ReadModuleConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/ReadModuleConfigration.cs index 5d7c8d501..6159328a5 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/ReadModuleConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/ReadModuleConfigration.cs @@ -12,7 +12,7 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration public void Configure(EntityTypeBuilder builder) { - builder.HasOne(t => t.SubjectVisit).WithMany(t => t.ReadModuleList); + builder.HasOne(t => t.SubjectVisit).WithMany(t => t.ReadModuleList).HasForeignKey(t=>t.SubjectVisitId); } } }