Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing Details

IRC_NewDev
he 2024-09-10 15:05:17 +08:00
commit bb5844a8e8
20 changed files with 589 additions and 92 deletions

View File

@ -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": {

View File

@ -1002,11 +1002,12 @@
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.DownloadAndUploadService.VerifyIRStudyAllowUpload(IRaCIS.Core.Application.Contracts.TaskStudyAchivePreConfirmCommand)">
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.DownloadAndUploadService.VerifyIRStudyAllowUpload(IRaCIS.Core.Application.Contracts.TaskStudyAchivePreConfirmCommand,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomStudy})">
<summary>
在调用预归档前验证 这些检查是否可以全新上传还是已存在补充 目前前端允许 IsAllowUpload==true 全新、IsAllowReUpload==true 补充的study ,全部丢到后端,后端判断存在,就删除之前的检查,全新插入
</summary>
<param name="inCommand"></param>
<param name="_dicomStudyRepository"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.DownloadAndUploadService.GetIRUploadTaskNoneDicomStudyList(IRaCIS.Core.Application.Contracts.IRUploadStudyQuery)">
@ -6871,6 +6872,11 @@
答案分组
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetTrialCriterionJudgeQuestionListOutDto.Unit">
<summary>
单位
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetTrialCriterionJudgeQuestionListOutDto.AnswerCombination">
<summary>
答案组合

View File

@ -256,18 +256,28 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
/// 在调用预归档前验证 这些检查是否可以全新上传还是已存在补充 目前前端允许 IsAllowUpload==true 全新、IsAllowReUpload==true 补充的study ,全部丢到后端,后端判断存在,就删除之前的检查,全新插入
/// </summary>
/// <param name="inCommand"></param>
/// <param name="_dicomStudyRepository"></param>
/// <returns></returns>
public async Task<List<TaskStudyArchiveConfirmResult>> VerifyIRStudyAllowUpload(TaskStudyAchivePreConfirmCommand inCommand)
public async Task<List<TaskStudyArchiveConfirmResult>> VerifyIRStudyAllowUpload(TaskStudyAchivePreConfirmCommand inCommand, [FromServices] IRepository<DicomStudy> _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<TaskStudyArchiveConfirmResult>();
foreach (var studyUid in inCommand.StudyInstanceUidList)
@ -275,6 +285,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
var findStudy = notAllowedUidList.Where(t => t.StudyInstanceUid == studyUid).FirstOrDefault();
if (findStudy != null)
{
//同一个subject 同一份影响
if (findStudy.SubejectCode == inCommand.SubjectCode && findStudy.SubjectId == inCommand.SubjectId)
{
@ -574,7 +585,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
}
else
{
await _noneDicomStudyFileReposiotry.BatchDeleteNoTrackingAsync(t => t.VisitTaskId == visitTaskId && t.NoneDicomStudyId == noneDicomStudyId);
await _noneDicomStudyFileReposiotry.BatchDeleteNoTrackingAsync(t => t.VisitTaskId == visitTaskId && t.OriginNoneDicomStudyId == noneDicomStudyId);
}
return ResponseOutput.Ok();
@ -590,9 +601,13 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
[HttpPost]
public async Task<List<TaskNoneDicomStudyDTO>> 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()
{

View File

@ -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<NoneDicomStudyView> 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<TaskDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip, visiTaskId = visiTaskId });
.ProjectTo<TaskDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip, visiTaskId = visitTaskId });
}

View File

@ -599,8 +599,9 @@ namespace IRaCIS.Core.Application.Service
Guid? visiTaskId = null;
CreateMap<NoneDicomStudy, TaskDicomStudyView>()
.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));
}

View File

@ -6,14 +6,10 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
{
public class SubjectVisitConfigration : IEntityTypeConfiguration<SubjectVisit>
{
{
public void Configure(EntityTypeBuilder<SubjectVisit> builder)
{
builder.HasOne(s => s.Subject).WithMany(sv => sv.SubjectVisitList);
}
}

View File

@ -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<TrialDocNeedConfirmedUserType>
{
public void Configure(EntityTypeBuilder<TrialDocNeedConfirmedUserType> 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<TrialDocConfirmedUser>
{
public void Configure(EntityTypeBuilder<TrialDocConfirmedUser> 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 });
}
}
}

View File

@ -5,16 +5,6 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
{
public class TrialSiteConfigration : IEntityTypeConfiguration<TrialSite>
{
public void Configure(EntityTypeBuilder<TrialSite> builder)
{
}
}
public class SubjectCriteriaEvaluationConfigration : IEntityTypeConfiguration<SubjectCriteriaEvaluation>
{

View File

@ -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<TrialSiteSurvey>
{
public void Configure(EntityTypeBuilder<TrialSiteSurvey> builder)
{
}
}
}

View File

@ -0,0 +1,14 @@
#参考学习文档
https://www.cnblogs.com/cqpanda/p/16815263.html
# 如果不想指定项目名称,需要进入项目目录 一般pwershell进入的是项目根目录需要命令指定项目
cd .\IRaCIS.Core.Test
# 该目录下如果有多个上下文,需要手动指定
# dotnet ef migrations add 签名名字 -p 项目名 -c 上下文名 -o 迁移文件生成目录
dotnet ef migrations add Initial -p IRaCIS.Core.Test -c IRCContext -o CodeFirstTest/MSSQL/Migrations
dotnet ef database update -p IRaCIS.Core.Test -c IRCContext

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using IRaCIS.Core.Test.CodeFirstTest.MSSQL;
using Microsoft.EntityFrameworkCore;
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL;
public partial class IRCContext : DbContext
{
public IRCContext()
{
}
public IRCContext(DbContextOptions<IRCContext> options)
: base(options)
{
}
public virtual DbSet<TrialImageDownload> TrialImageDownload { get; set; }
public virtual DbSet<TestNew> TestNew { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseSqlServer("Server=106.14.89.110,1433;Database=IRC_Code;User ID=sa;Password=mssql_KnTs2a;TrustServerCertificate=true");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

View File

@ -0,0 +1,100 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TestName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("TestNew");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DownloadEndTime")
.HasColumnType("datetime2");
b.Property<DateTime>("DownloadStartTime")
.HasColumnType("datetime2");
b.Property<int>("ImageCount")
.HasColumnType("int");
b.Property<long>("ImageSize")
.HasColumnType("bigint");
b.Property<int>("ImageType")
.HasColumnType("int");
b.Property<bool>("IsSuccess")
.HasColumnType("bit");
b.Property<Guid>("SubjectVisitId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("TrialImageDownload");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,38 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
{
/// <inheritdoc />
public partial class testAdd : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TestNew",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TestName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TestNew", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TestNew");
}
}
}

View File

@ -0,0 +1,119 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TestName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<Guid>("TrialImageDownloadId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("TrialImageDownloadId");
b.ToTable("TestNew");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DownloadEndTime")
.HasColumnType("datetime2");
b.Property<DateTime>("DownloadStartTime")
.HasColumnType("datetime2");
b.Property<int>("ImageCount")
.HasColumnType("int");
b.Property<long>("ImageSize")
.HasColumnType("bigint");
b.Property<int>("ImageType")
.HasColumnType("int");
b.Property<bool>("IsSuccess")
.HasColumnType("bit");
b.Property<Guid>("SubjectVisitId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("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
}
}
}

View File

@ -0,0 +1,51 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
{
/// <inheritdoc />
public partial class navigateTest : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
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);
}
/// <inheritdoc />
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");
}
}
}

View File

@ -0,0 +1,116 @@
// <auto-generated />
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<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TestName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<Guid>("TrialImageDownloadId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("TrialImageDownloadId");
b.ToTable("TestNew");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DownloadEndTime")
.HasColumnType("datetime2");
b.Property<DateTime>("DownloadStartTime")
.HasColumnType("datetime2");
b.Property<int>("ImageCount")
.HasColumnType("int");
b.Property<long>("ImageSize")
.HasColumnType("bigint");
b.Property<int>("ImageType")
.HasColumnType("int");
b.Property<bool>("IsSuccess")
.HasColumnType("bit");
b.Property<Guid>("SubjectVisitId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("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
}
}
}

View File

@ -0,0 +1,62 @@
using IRaCIS.Core.Domain.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL
{
[Table("TrialImageDownload")]
public class TrialImageDownload : BaseFullAuditEntity
{
public Guid SubjectVisitId { get; set; }
public bool IsSuccess { get; set; }
public DateTime DownloadStartTime { get; set; }
public DateTime? DownloadEndTime { get; set; }
public ImageType ImageType { get; set; }
public int ImageCount { get; set; }
public long ImageSize { get; set; }
#region 测试导航属性
public List<TestNew> TestNewList { get; set; }
#endregion
}
public enum ImageType
{
Dicom = 1,
NoneDIcom = 2
};
public class TestNew : BaseFullAuditEntity
{
public Guid TrialImageDownloadId { get; set; }
[StringLength(100)]
public string TestName { get; set; }
}
public class Subject: BaseFullAuditEntity
{
public string Name { get; set; }
}
public class SubejectVisit: BaseFullAuditEntity
{
public Guid SubjectId { get; set; }
}
}

View File

@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static System.Net.Mime.MediaTypeNames;
partial class Program
{
@ -55,7 +56,15 @@ partial class Program
// 要生成的表名数组
var tableNames = new List<string>(args);
var tableNames = new List<string>(args);
var argsStr = args.ToString()??string.Empty;
if (argsStr.Contains(".") || argsStr.Contains("-")|| argsStr.Contains("application")|| argsStr.Contains("IR"))
{
tableNames = new List<string>();
}
try
{