using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace IRaCIS.Core.Infra.EFCore.Migrations
{
    /// <inheritdoc />
    public partial class CodeFirst_Init : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "ImageShare",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ExpireTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Password = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ImageShare", x => x.Id);
                },
                comment: "影像 - 影像分享记录表");

            migrationBuilder.CreateTable(
                name: "TestLength",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TestLength", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TrialRevenuesPriceVerification",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReviewerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    YearMonth = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Training = table.Column<bool>(type: "bit", nullable: false),
                    Downtime = table.Column<bool>(type: "bit", nullable: false),
                    Global = table.Column<bool>(type: "bit", nullable: false),
                    Timepoint = table.Column<bool>(type: "bit", nullable: false),
                    TimepointIn24H = table.Column<bool>(type: "bit", nullable: false),
                    TimepointIn48H = table.Column<bool>(type: "bit", nullable: false),
                    Adjudication = table.Column<bool>(type: "bit", nullable: false),
                    AdjudicationIn24H = table.Column<bool>(type: "bit", nullable: false),
                    AdjudicationIn48H = table.Column<bool>(type: "bit", nullable: false),
                    RefresherTraining = table.Column<bool>(type: "bit", nullable: false),
                    WorkLoadDate = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialRevenuesPriceVerification", x => x.Id);
                },
                comment: "医生计费 - 项目收入价格验证");

            migrationBuilder.CreateTable(
                name: "TumorAssessment_IRECIST1Point1",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TargetLesion = table.Column<int>(type: "int", nullable: false, comment: "靶病灶"),
                    NonTargetLesions = table.Column<int>(type: "int", nullable: false, comment: "非靶病灶"),
                    NewLesion = table.Column<int>(type: "int", nullable: false, comment: "新病灶"),
                    OverallEfficacy = table.Column<int>(type: "int", nullable: false, comment: "整体疗效")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TumorAssessment_IRECIST1Point1", x => x.Id);
                },
                comment: "IRECIST1Point1肿瘤评估(系统标准)");

            migrationBuilder.CreateTable(
                name: "TumorAssessment_RECIST1Point1",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TargetLesion = table.Column<int>(type: "int", nullable: false, comment: "靶病灶"),
                    NonTargetLesions = table.Column<int>(type: "int", nullable: false, comment: "非靶病灶"),
                    NewLesion = table.Column<int>(type: "int", nullable: false, comment: "新病灶"),
                    OverallEfficacy = table.Column<int>(type: "int", nullable: false, comment: "整体疗效")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TumorAssessment_RECIST1Point1", x => x.Id);
                },
                comment: "RECIST1Point1肿瘤评估(系统标准)");

            migrationBuilder.CreateTable(
                name: "TumorAssessment_RECIST1Point1BM",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TargetLesion = table.Column<int>(type: "int", nullable: false, comment: "靶病灶"),
                    NonTargetLesions = table.Column<int>(type: "int", nullable: false, comment: "非靶病灶"),
                    NewLesion = table.Column<int>(type: "int", nullable: false, comment: "新病灶"),
                    OverallEfficacy = table.Column<int>(type: "int", nullable: false, comment: "整体疗效")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TumorAssessment_RECIST1Point1BM", x => x.Id);
                },
                comment: "RECIST1Point1BM肿瘤评估(系统标准)");

            migrationBuilder.CreateTable(
                name: "UserType",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserTypeEnum = table.Column<int>(type: "int", nullable: false),
                    UserTypeName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Order = table.Column<int>(type: "int", nullable: false),
                    UserTypeShortName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    PermissionStr = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserType", x => x.Id);
                },
                comment: "后台 - 系统用户类型 （需要同步）");

            migrationBuilder.CreateTable(
                name: "Attachment",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "编码"),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ExpiryDate = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "过期时间"),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsOfficial = table.Column<bool>(type: "bit", nullable: false, comment: "是否正式简历"),
                    Language = table.Column<int>(type: "int", nullable: false, comment: "1 中文 2为英文"),
                    Path = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    Type = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "文件类型名"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Attachment", x => x.Id);
                },
                comment: "医生 - 简历|证书 文档表");

            migrationBuilder.CreateTable(
                name: "CheckChallengeDialog",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsCRCNeedReply = table.Column<bool>(type: "bit", nullable: true, comment: "CRC是否需要回复 前端使用"),
                    ParamInfo = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "核查的检查信息Json"),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TalkContent = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    UserTypeEnum = table.Column<int>(type: "int", nullable: false, comment: "核查过程中的操作用户类型"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CheckChallengeDialog", x => x.Id);
                },
                comment: "一致性核查 -  对话记录表");

            migrationBuilder.CreateTable(
                name: "ClinicalAnswerRowInfo",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ClinicalFormId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "表单Id"),
                    QuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "问题Id"),
                    RowIndex = table.Column<int>(type: "int", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "受试者Id"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ClinicalAnswerRowInfo", x => x.Id);
                },
                comment: "受试者 - 临床表单表格问题行记录");

            migrationBuilder.CreateTable(
                name: "ClinicalDataSystemSet",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ClinicalDataLevel = table.Column<int>(type: "int", nullable: false),
                    ClinicalDataSetEnName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ClinicalDataSetEnum = table.Column<int>(type: "int", nullable: false, comment: "枚举(字典里面取的)"),
                    ClinicalDataSetName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ClinicalUploadType = table.Column<int>(type: "int", nullable: false, comment: "上传方式"),
                    CriterionEnumListStr = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsApply = table.Column<bool>(type: "bit", nullable: false, comment: "是否应用"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    Path = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    UploadRole = table.Column<int>(type: "int", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ClinicalDataSystemSet", x => x.Id);
                },
                comment: "系统 - 临床数据配置");

            migrationBuilder.CreateTable(
                name: "ClinicalDataTrialSet",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ClinicalDataLevel = table.Column<int>(type: "int", nullable: false, comment: "临床级别"),
                    ClinicalDataSetEnName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ClinicalDataSetName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ClinicalUploadType = table.Column<int>(type: "int", nullable: false, comment: "上传方式"),
                    CriterionEnumListStr = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsApply = table.Column<bool>(type: "bit", nullable: false, comment: "是否应用"),
                    IsConfirm = table.Column<bool>(type: "bit", nullable: false),
                    Path = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    SystemClinicalDataSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UploadRole = table.Column<int>(type: "int", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ClinicalDataTrialSet", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ClinicalDataTrialSet_ClinicalDataSystemSet_SystemClinicalDataSetId",
                        column: x => x.SystemClinicalDataSetId,
                        principalTable: "ClinicalDataSystemSet",
                        principalColumn: "Id");
                },
                comment: "项目 - 临床数据适应标准配置");

            migrationBuilder.CreateTable(
                name: "ClinicalForm",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CheckDate = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "检查日期"),
                    ClinicalDataTrialSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PicturePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "截图地址"),
                    ReadingId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "受试者Id"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    VisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ClinicalForm", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ClinicalForm_ClinicalDataTrialSet_ClinicalDataTrialSetId",
                        column: x => x.ClinicalDataTrialSetId,
                        principalTable: "ClinicalDataTrialSet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者 - 临床表单");

            migrationBuilder.CreateTable(
                name: "ClinicalQuestionAnswer",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Answer = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    ClinicalDataTrialSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ClinicalFormId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "表单Id"),
                    QuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "问题Id"),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "受试者Id"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ClinicalQuestionAnswer", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ClinicalQuestionAnswer_ClinicalForm_ClinicalFormId",
                        column: x => x.ClinicalFormId,
                        principalTable: "ClinicalForm",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者 - 临床表单问题答案");

            migrationBuilder.CreateTable(
                name: "ClinicalTableAnswer",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Answer = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "答案"),
                    ClinicalFormId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "表单Id"),
                    QuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "问题Id"),
                    RowId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "答案行的Id"),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "受试者Id"),
                    TableQuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ClinicalTableAnswer", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ClinicalTableAnswer_ClinicalAnswerRowInfo_RowId",
                        column: x => x.RowId,
                        principalTable: "ClinicalAnswerRowInfo",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者 - 临床表单表格问题答案");

            migrationBuilder.CreateTable(
                name: "CommonDocument",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    BusinessScenarioEnum = table.Column<int>(type: "int", nullable: false, comment: "业务场景"),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CriterionTypeEnum = table.Column<int>(type: "int", nullable: true, comment: "系统标准枚举"),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FileTypeEnum = table.Column<int>(type: "int", nullable: false, comment: "类型-上传|导出|邮件附件"),
                    Name = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    NameCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Path = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_CommonDocument", x => x.Id);
                },
                comment: "数据上传 | 数据导出 | 邮件附件 文件记录表 （需要同步）");

            migrationBuilder.CreateTable(
                name: "CriterionNidusSystem",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsSystemCriterion = table.Column<bool>(type: "bit", nullable: false),
                    LesionType = table.Column<int>(type: "int", nullable: false, comment: "病灶类型"),
                    OrganType = table.Column<int>(type: "int", nullable: false, comment: "器官类型"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CriterionNidusSystem", x => x.Id);
                },
                comment: "系统标准 - 病灶器官表 （需要同步）");

            migrationBuilder.CreateTable(
                name: "CriterionNidusTrial",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    LesionType = table.Column<int>(type: "int", nullable: false),
                    OrganType = table.Column<int>(type: "int", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CriterionNidusTrial", x => x.Id);
                },
                comment: "项目标准 - 病灶器官表");

            migrationBuilder.CreateTable(
                name: "CROCompany",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CROCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CROName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CRONameCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsTrialLevel = table.Column<bool>(type: "bit", nullable: false, comment: "是否是项目级别"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    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_CROCompany", x => x.Id);
                },
                comment: "机构 - CRO");

            migrationBuilder.CreateTable(
                name: "DataInspection",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    BatchId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "批次Id"),
                    ChildrenTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "子类"),
                    CreateUserName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "创建人姓名"),
                    CreateUserRealName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DoctorUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "阅片医生"),
                    EntityName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "被稽查实体名"),
                    GeneralId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "要稽查对象Id"),
                    Identification = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "标识"),
                    IP = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsFrontAdd = table.Column<bool>(type: "bit", nullable: true, comment: "是否是前端添加"),
                    IsSign = table.Column<bool>(type: "bit", nullable: true),
                    JsonDetail = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LastJsonDetail = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "上一条json"),
                    ModuleTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ObjectRelationParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "被稽查对象外键1"),
                    ObjectRelationParentId2 = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ObjectRelationParentId3 = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ObjectTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OptTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "父ID"),
                    Reason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    RoleName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "角色名称"),
                    SignId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TrialSiteId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    VisitStageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "访视计划ID"),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DataInspection", x => x.Id);
                },
                comment: "稽查 - 记录表");

            migrationBuilder.CreateTable(
                name: "DicomInstance",
                columns: table => new
                {
                    SeqId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Anonymize = table.Column<bool>(type: "bit", nullable: false),
                    CPIStatus = table.Column<bool>(type: "bit", nullable: false),
                    FileSize = table.Column<long>(type: "bigint", nullable: true),
                    FrameOfReferenceUID = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    HtmlPath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    ImageColumns = table.Column<int>(type: "int", nullable: false),
                    ImageRows = table.Column<int>(type: "int", nullable: false),
                    ImagerPixelSpacing = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    InstanceNumber = table.Column<int>(type: "int", nullable: false),
                    InstanceTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    NumberOfFrames = table.Column<int>(type: "int", nullable: false),
                    Path = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    PixelSpacing = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SeriesId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SeriesInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SliceLocation = table.Column<int>(type: "int", nullable: false),
                    SliceThickness = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SopInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    WindowCenter = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    WindowWidth = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Id = table.Column<Guid>(type: "uniqueidentifier", 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_DicomInstance", x => x.SeqId);
                },
                comment: "归档 -  Instance表");

            migrationBuilder.CreateTable(
                name: "DicomSeries",
                columns: table => new
                {
                    SeqId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AcquisitionNumber = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AcquisitionTime = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BodyPartExamined = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BodyPartForEdit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImageOrientationPatient = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImagePositionPatient = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImageResizePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    ImagerPixelSpacing = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    InstanceCount = table.Column<int>(type: "int", nullable: false),
                    IsReading = table.Column<bool>(type: "bit", nullable: false),
                    Modality = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ProtocolName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SequenceName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SeriesInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SeriesNumber = table.Column<int>(type: "int", nullable: false),
                    SeriesTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SliceThickness = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TriggerTime = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_DicomSeries", x => x.SeqId);
                    table.UniqueConstraint("AK_DicomSeries_Id", x => x.Id);
                },
                comment: "归档 - 序列表");

            migrationBuilder.CreateTable(
                name: "DicomStudy",
                columns: table => new
                {
                    SeqId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "序列Id 避免内存移动"),
                    AccessionNumber = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AcquisitionNumber = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AcquisitionTime = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BodyPartExamined = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BodyPartForEdit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Code = table.Column<int>(type: "int", nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    InstanceCount = table.Column<int>(type: "int", nullable: false),
                    InstitutionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsDoubleReview = table.Column<bool>(type: "bit", nullable: false),
                    IsFromPACS = table.Column<bool>(type: "bit", nullable: false),
                    Modalities = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ModalityForEdit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientAge = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientBirthDate = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientId = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientSex = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SeriesCount = table.Column<int>(type: "int", nullable: false),
                    StudyCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    StudyId = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "DicomTag.StudyID"),
                    StudyInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    StudyTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TriggerTime = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    UploadedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "上传时间"),
                    Uploader = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_DicomStudy", x => x.SeqId);
                    table.UniqueConstraint("AK_DicomStudy_Id", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Dictionary",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ChildGroup = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ConfigTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    DataTypeEnum = table.Column<int>(type: "int", nullable: false, comment: "字典类型- 枚举|bool|下拉框"),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsConfig = table.Column<bool>(type: "bit", nullable: false, comment: "是否字典类型配置"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ShowOrder = table.Column<int>(type: "int", nullable: false),
                    Value = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ValueCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_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");
                },
                comment: "后台 - 字典表（需要同步）");

            migrationBuilder.CreateTable(
                name: "UserTypeGroup",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DictionaryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserTypeGroup", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserTypeGroup_Dictionary_DictionaryId",
                        column: x => x.DictionaryId,
                        principalTable: "Dictionary",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_UserTypeGroup_UserType_UserTypeId",
                        column: x => x.UserTypeId,
                        principalTable: "UserType",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 用户类型组（需要同步）");

            migrationBuilder.CreateTable(
                name: "Doctor",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AcceptingNewTrial = table.Column<bool>(type: "bit", nullable: false),
                    ActivelyReading = table.Column<bool>(type: "bit", nullable: false),
                    AdminComment = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AuditTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    AuditUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    BlindName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BlindNameCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BlindPublications = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ChineseName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Code = table.Column<int>(type: "int", nullable: false),
                    CooperateStatus = table.Column<int>(type: "int", nullable: false),
                    DepartmentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    DepartmentOther = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DepartmentOtherCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EMail = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FirstName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    GCP = table.Column<int>(type: "int", nullable: false),
                    GCPId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    HospitalId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    HospitalOther = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    HospitalOtherCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Introduction = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    IsVirtual = table.Column<bool>(type: "bit", nullable: false),
                    LastLoginTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Nation = table.Column<int>(type: "int", nullable: false),
                    OrganizationId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OtherClinicalExperience = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    OtherClinicalExperienceCN = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Password = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Phone = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PhotoPath = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Physician = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PhysicianCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PhysicianId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    PositionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    PositionOther = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PositionOtherCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    RankId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    RankOther = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    RankOtherCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ReadingTypeOther = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ReadingTypeOtherCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ResumePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    ResumeStatus = table.Column<int>(type: "int", nullable: false),
                    ReviewerCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ReviewStatus = table.Column<int>(type: "int", nullable: false),
                    Sex = table.Column<int>(type: "int", nullable: false),
                    SpecialityId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SpecialityOther = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SpecialityOtherCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SubspecialityOther = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SubspecialityOtherCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    WeChat = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_Doctor", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Doctor_Dictionary_DepartmentId",
                        column: x => x.DepartmentId,
                        principalTable: "Dictionary",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Doctor_Dictionary_PositionId",
                        column: x => x.PositionId,
                        principalTable: "Dictionary",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Doctor_Dictionary_RankId",
                        column: x => x.RankId,
                        principalTable: "Dictionary",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Doctor_Dictionary_SpecialityId",
                        column: x => x.SpecialityId,
                        principalTable: "Dictionary",
                        principalColumn: "Id");
                },
                comment: "医生 - 基础信息表");

            migrationBuilder.CreateTable(
                name: "DoctorDictionary",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DictionaryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    KeyName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DoctorDictionary", x => x.Id);
                    table.ForeignKey(
                        name: "FK_DoctorDictionary_Dictionary_DictionaryId",
                        column: x => x.DictionaryId,
                        principalTable: "Dictionary",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_DoctorDictionary_Doctor_DoctorId",
                        column: x => x.DoctorId,
                        principalTable: "Doctor",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生 - 医生字典关联表");

            migrationBuilder.CreateTable(
                name: "User",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AutoCutNextTask = table.Column<bool>(type: "bit", nullable: false, comment: "自动切换下一个任务"),
                    Code = table.Column<int>(type: "int", nullable: false),
                    DepartmentName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "医生生成账号后，会有值"),
                    EMail = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EmailToken = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    FirstName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsFirstAdd = table.Column<bool>(type: "bit", nullable: false, comment: "首次登录需要修改密码"),
                    IsTestUser = table.Column<bool>(type: "bit", nullable: false),
                    IsZhiZhun = table.Column<bool>(type: "bit", nullable: false, comment: "内部用户  外部用户"),
                    LastChangePassWordTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "上一次修改密码的时间"),
                    LastLoginIP = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    LastLoginTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    OrganizationName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Password = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PasswordChanged = table.Column<bool>(type: "bit", nullable: false),
                    Phone = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PositionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Sex = table.Column<int>(type: "int", nullable: true),
                    Status = table.Column<int>(type: "int", nullable: false),
                    SuperAdmin = table.Column<bool>(type: "bit", nullable: false),
                    UserCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    UserName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    UserTypeEnum = table.Column<int>(type: "int", nullable: false),
                    UserTypeId = table.Column<Guid>(type: "uniqueidentifier", 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_User", x => x.Id);
                    table.ForeignKey(
                        name: "FK_User_Doctor_DoctorId",
                        column: x => x.DoctorId,
                        principalTable: "Doctor",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_User_UserType_UserTypeId",
                        column: x => x.UserTypeId,
                        principalTable: "UserType",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_User_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 系统账户");

            migrationBuilder.CreateTable(
                name: "DoctorCriterionFile",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CriterionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CriterionType = table.Column<int>(type: "int", nullable: false, comment: "标准类型"),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FilePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    FileType = table.Column<int>(type: "int", nullable: false),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    Remark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DoctorCriterionFile", x => x.Id);
                    table.ForeignKey(
                        name: "FK_DoctorCriterionFile_Doctor_DoctorId",
                        column: x => x.DoctorId,
                        principalTable: "Doctor",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_DoctorCriterionFile_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生 - 项目标准签名文档");

            migrationBuilder.CreateTable(
                name: "DoctorPayInformation",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Additional = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    BankCardNumber = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BankName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorNameInBank = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IDCard = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    RankId = table.Column<Guid>(type: "uniqueidentifier", 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_DoctorPayInformation", x => x.Id);
                    table.ForeignKey(
                        name: "FK_DoctorPayInformation_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生计费 - 支付信息表");

            migrationBuilder.CreateTable(
                name: "Education",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    BeginDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    City = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CityCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Country = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CountryCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Degree = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DegreeCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    EndDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Major = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    MajorCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Organization = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    OrganizationCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Province = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ProvinceCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ShowOrder = table.Column<int>(type: "int", 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_Education", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Education_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生 - 教育信息");

            migrationBuilder.CreateTable(
                name: "EmailNoticeConfig",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AttachCNPath = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AttachName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AttachNameCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AttachPath = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BusinessLevelEnum = table.Column<int>(type: "int", nullable: false, comment: "业务级别"),
                    BusinessModuleEnum = table.Column<int>(type: "int", nullable: false, comment: "业务模块"),
                    BusinessScenarioEnum = table.Column<int>(type: "int", nullable: false, comment: "业务场景"),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CriterionTypeEnum = table.Column<int>(type: "int", nullable: true, comment: "标准枚举"),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EmailCron = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "发送周期"),
                    EmailHtmlContent = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    EmailHtmlContentCN = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    EmailTopic = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EmailTopicCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EmailUrgentEnum = table.Column<int>(type: "int", nullable: false, comment: "加急枚举"),
                    IsAutoSend = table.Column<bool>(type: "bit", nullable: false, comment: "是否自动发送"),
                    IsDistinguishCriteria = table.Column<bool>(type: "bit", nullable: false, comment: "是否区分标准"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    IsReturnRequired = table.Column<bool>(type: "bit", nullable: false, comment: "是否需要回执"),
                    SystemLevel = table.Column<int>(type: "int", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_EmailNoticeConfig", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EmailNoticeConfig_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 邮件配置表表（需要同步）");

            migrationBuilder.CreateTable(
                name: "ExchangeRate",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    YearMonth = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Rate = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, 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_ExchangeRate", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ExchangeRate_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生计费 - 汇率");

            migrationBuilder.CreateTable(
                name: "ExploreRecommend",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DownloadUrl = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    ExploreType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Path = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    Title = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Version = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_ExploreRecommend", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ExploreRecommend_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 浏览器推荐 （需要同步）");

            migrationBuilder.CreateTable(
                name: "FrontAuditConfig",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ChildDataEnLabel = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ChildDataLabel = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "前端渲染数组  数组名 和数组值"),
                    ChildDataValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "子数据Value"),
                    ChildrenTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "翻译的字段名   这里有可能是一个数组名  那么具体的翻译字段名就不是这个了"),
                    CodeEn = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ConfigType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "前端使用 C  M"),
                    DataType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "前端展示类型   Router， Array，Table"),
                    DateType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "日期格式"),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DescriptionCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DictionaryCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "翻译的字典名（单个字段翻译的时候）"),
                    DictionaryKey = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "字典名称-待废弃核查"),
                    DictionaryType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "枚举字典Type"),
                    EnumType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "后端翻译的类型  对应前端界面  Dictionary Date"),
                    ForeignKeyEnText = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ForeignKeyTableName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "外键表"),
                    ForeignKeyText = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "外键Text"),
                    ForeignKeyValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "外键Value"),
                    Identification = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "标识"),
                    InterfaceName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "接口名"),
                    IsConfig = table.Column<bool>(type: "bit", nullable: false, comment: "未知是否有用-废弃核查"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    IsFinish = table.Column<bool>(type: "bit", nullable: false, comment: "是否完成"),
                    IsHaveReason = table.Column<bool>(type: "bit", nullable: false, comment: "是否有原因"),
                    IsHaveSign = table.Column<bool>(type: "bit", nullable: false, comment: "是否有签名"),
                    IsJoinPlan = table.Column<bool>(type: "bit", nullable: true, comment: "是否加入计划"),
                    IsShowByTrialConfig = table.Column<bool>(type: "bit", nullable: false, comment: "待废弃核查"),
                    IsShowParent = table.Column<int>(type: "int", nullable: false),
                    IsSpecialType = table.Column<bool>(type: "bit", nullable: true, comment: "是否为特殊类型"),
                    ModuleTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ObjectTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OptTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Sort = table.Column<int>(type: "int", nullable: false),
                    TableConfigJsonStr = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TrialConfigRelyFieldName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "待废弃核查"),
                    UrlConfigJsonStr = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Value = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ValueCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_FrontAuditConfig", x => x.Id);
                    table.ForeignKey(
                        name: "FK_FrontAuditConfig_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "稽查 - 配置表 （需要同步）");

            migrationBuilder.CreateTable(
                name: "InspectionFile",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    RelativePath = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_InspectionFile", x => x.Id);
                    table.ForeignKey(
                        name: "FK_InspectionFile_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "一致性核查文件");

            migrationBuilder.CreateTable(
                name: "Menu",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "上级菜单"),
                    MenuType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "类型（M目录 C菜单 F按钮 L链接）"),
                    MenuIcon = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    MenuName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Path = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "路由地址"),
                    Component = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "组件路径"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false, comment: "启用 禁用"),
                    IsCache = table.Column<bool>(type: "bit", nullable: false),
                    IsDisplay = table.Column<bool>(type: "bit", nullable: false),
                    IsInTabDisplay = table.Column<bool>(type: "bit", nullable: false),
                    IsExternalLink = table.Column<bool>(type: "bit", nullable: false),
                    PermissionStr = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "权限点"),
                    ApiPath = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "Api 接口地址"),
                    Note = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Meta = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Redirect = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    LanguageMark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_Menu", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Menu_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 系统菜单 （需要同步）");

            migrationBuilder.CreateTable(
                name: "OrganInfo",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Classification = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "分类"),
                    ClassificationEN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "分类 英文"),
                    Part = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "部位"),
                    PartEN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "部位 英文"),
                    TULOC = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "TULOC 器官"),
                    TULOCEN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "TULOC 器官 英文"),
                    TULAT = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "位置"),
                    TULATEN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "位置 英文"),
                    Remark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "备注"),
                    IsLymphNodes = table.Column<int>(type: "int", nullable: false, comment: "是否是淋巴结"),
                    OrganType = table.Column<int>(type: "int", nullable: false, comment: "器官类型"),
                    SystemCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "标准Id"),
                    IsCanEditPosition = table.Column<bool>(type: "bit", nullable: false, comment: "是否可编辑位置"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "序号"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganInfo", x => x.Id);
                    table.ForeignKey(
                        name: "FK_OrganInfo_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 系统标准器官  (需要同步)");

            migrationBuilder.CreateTable(
                name: "Payment",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    YearMonth = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsLock = table.Column<bool>(type: "bit", nullable: false),
                    YearMonthDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    PaymentUSD = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    PaymentCNY = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false),
                    ExchangeRate = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    AdjustmentCNY = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false),
                    AdjustmentUSD = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    CalculateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CalculateUser = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Note = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_Payment", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Payment_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生计费 - 每月支付记录表");

            migrationBuilder.CreateTable(
                name: "PaymentAdjustment",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReviewerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    YearMonthDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    YearMonth = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AdjustmentUSD = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    AdjustmentCNY = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ExchangeRate = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    IsLock = table.Column<bool>(type: "bit", nullable: false),
                    Note = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_PaymentAdjustment", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PaymentAdjustment_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生计费 - 每月支付记录表");

            migrationBuilder.CreateTable(
                name: "PaymentDetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PaymentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    YearMonth = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PaymentType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Count = table.Column<int>(type: "int", nullable: false),
                    BasePrice = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    PersonalAdditional = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    TrialAdditional = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    ExchangeRate = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    PaymentUSD = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    PaymentCNY = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false),
                    ShowTypeOrder = table.Column<int>(type: "int", nullable: false),
                    ShowCodeOrder = table.Column<int>(type: "int", 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_PaymentDetail", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PaymentDetail_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生计费 - 每月支付详情表");

            migrationBuilder.CreateTable(
                name: "Postgraduate",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    BeginDate = table.Column<DateTime>(type: "date", nullable: true),
                    EndDate = table.Column<DateTime>(type: "date", nullable: true),
                    Training = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Major = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Hospital = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    School = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Country = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Province = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    City = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrainingCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    MajorCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    HospitalCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SchoolCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CountryCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ProvinceCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CityCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_Postgraduate", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Postgraduate_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生 - 继续教育经历");

            migrationBuilder.CreateTable(
                name: "PublishLog",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Version = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Version_US = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PublishTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UpdateContent = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    State = table.Column<int>(type: "int", nullable: false, comment: "0 开发中 ，已发布"),
                    IsCurrentVersion = table.Column<bool>(type: "bit", 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_PublishLog", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PublishLog_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 系统发布日志 （需要同步）");

            migrationBuilder.CreateTable(
                name: "QCQuestion",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    QuestionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    LanguageType = table.Column<int>(type: "int", nullable: false, comment: "语言类型"),
                    IsRequired = table.Column<bool>(type: "bit", nullable: false),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    Type = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "下拉框、文本、单选、多选"),
                    TypeValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ParentTriggerValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ShowOrder = table.Column<int>(type: "int", 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_QCQuestion", x => x.Id);
                    table.ForeignKey(
                        name: "FK_QCQuestion_QCQuestion_ParentId",
                        column: x => x.ParentId,
                        principalTable: "QCQuestion",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_QCQuestion_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - QC质控问题（需要同步）");

            migrationBuilder.CreateTable(
                name: "RankPrice",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    RankName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Timepoint = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    TimepointIn24H = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    TimepointIn48H = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    Adjudication = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    AdjudicationIn24H = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    AdjudicationIn48H = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    Global = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    Training = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    Downtime = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    RefresherTraining = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    ShowOrder = table.Column<int>(type: "int", 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_RankPrice", x => x.Id);
                    table.ForeignKey(
                        name: "FK_RankPrice_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生计费 - 不同时间点价格设置");

            migrationBuilder.CreateTable(
                name: "ReadingCriterionPage",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目ID"),
                    PageName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "分页名称"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false, comment: "是否启用"),
                    IsPublicPage = table.Column<bool>(type: "bit", nullable: false, comment: "是否公共分页"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    ReadingQuestionCriterionTrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingCriterionPage", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingCriterionPage_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "阅片标准分页");

            migrationBuilder.CreateTable(
                name: "ReadingCustomTag",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SeriesId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    InstanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    MeasureData = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    NumberOfFrames = table.Column<int>(type: "int", nullable: true),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingCustomTag", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingCustomTag_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片 - 自定义标记");

            migrationBuilder.CreateTable(
                name: "ReadingJudgeInfo",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TaskIdOne = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "第一个任务ID"),
                    TaskIdTwo = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "第二个任务ID"),
                    JudgeTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "裁判任务ID"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingJudgeInfo", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingJudgeInfo_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "阅片裁判信息");

            migrationBuilder.CreateTable(
                name: "ReadingMedicineSystemQuestion",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Type = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "类型"),
                    ParentTriggerValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "父问题触发"),
                    QuestionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题名称"),
                    LanguageType = table.Column<int>(type: "int", nullable: false, comment: "语言类型"),
                    IsRequired = table.Column<bool>(type: "bit", nullable: false, comment: "是否是必须"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "父问题ID"),
                    TypeValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "类型值"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false, comment: "是否启用"),
                    ReadingCategory = table.Column<int>(type: "int", nullable: false, comment: "任务类型"),
                    CriterionTypeEnum = table.Column<int>(type: "int", nullable: true),
                    IsGeneral = table.Column<bool>(type: "bit", 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_ReadingMedicineSystemQuestion", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingMedicineSystemQuestion_ReadingMedicineSystemQuestion_ParentId",
                        column: x => x.ParentId,
                        principalTable: "ReadingMedicineSystemQuestion",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingMedicineSystemQuestion_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "阅片医学审核系统问题");

            migrationBuilder.CreateTable(
                name: "ReadingMedicineTrialQuestion",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Type = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "类型"),
                    ParentTriggerValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "父问题触发值"),
                    QuestionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题名称"),
                    LanguageType = table.Column<int>(type: "int", nullable: false, comment: "语言类型"),
                    TypeValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "类型值"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目ID"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false, comment: "是否启用"),
                    IsRequired = table.Column<bool>(type: "bit", nullable: false, comment: "是否必须"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "父问题"),
                    IsConfirm = table.Column<bool>(type: "bit", nullable: false, comment: "是否确认"),
                    ReadingCategory = table.Column<int>(type: "int", nullable: false, comment: "任务类型"),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目标准"),
                    SystemQuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    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_ReadingMedicineTrialQuestion", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingMedicineTrialQuestion_ReadingMedicineTrialQuestion_ParentId",
                        column: x => x.ParentId,
                        principalTable: "ReadingMedicineTrialQuestion",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingMedicineTrialQuestion_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "阅片医学审核项目问题");

            migrationBuilder.CreateTable(
                name: "ReadingQuestionCriterionSystem",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CriterionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "标准"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false, comment: "是否启用"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    IsCompleteConfig = table.Column<bool>(type: "bit", nullable: false, comment: "是否完成配置"),
                    ConfirmTime = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "确认时间"),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "描述"),
                    CriterionType = table.Column<int>(type: "int", nullable: false, comment: "标准类型"),
                    IsOncologyReading = table.Column<bool>(type: "bit", nullable: false, comment: "肿瘤学阅片"),
                    IseCRFShowInDicomReading = table.Column<bool>(type: "bit", nullable: false, comment: "eCRF报告是否显示在图像页面"),
                    IsMustGlobalReading = table.Column<bool>(type: "bit", nullable: false, comment: "是否必须全局阅片"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingQuestionCriterionSystem", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingQuestionCriterionSystem_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "系统阅片标准");

            migrationBuilder.CreateTable(
                name: "ReadingSystemCriterionDictionary",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DictionaryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsSystemCriterion = table.Column<bool>(type: "bit", nullable: false),
                    ParentCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsBaseLineUse = table.Column<bool>(type: "bit", nullable: false),
                    IsFollowVisitUse = table.Column<bool>(type: "bit", nullable: false),
                    CrterionDictionaryGroup = table.Column<int>(type: "int", nullable: false, comment: "标准字典分组"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingSystemCriterionDictionary", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingSystemCriterionDictionary_Dictionary_DictionaryId",
                        column: x => x.DictionaryId,
                        principalTable: "Dictionary",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingSystemCriterionDictionary_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "系统标准 - 全局配置 （需要同步）");

            migrationBuilder.CreateTable(
                name: "ReadingTableQuestionSystem",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingQuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "系统表的问题Id    ReadingQuestionSystem的Id"),
                    Type = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ParentTriggerValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "父问题触发值"),
                    QuestionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题名称"),
                    IsRequired = table.Column<int>(type: "int", nullable: false),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "排序号"),
                    TypeValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "值"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false, comment: "是否启用"),
                    Remark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    RelevanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "显示父问题"),
                    RelevanceValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "显示父问题的值"),
                    ShowQuestion = table.Column<int>(type: "int", nullable: false, comment: "是否显示"),
                    MaxRowCount = table.Column<int>(type: "int", nullable: true, comment: "最大问题数"),
                    DataTableName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "数据表名称"),
                    DataTableColumn = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "数据列"),
                    DependParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "关联父问题"),
                    IsDepend = table.Column<int>(type: "int", nullable: false, comment: "是否关联"),
                    TableQuestionType = table.Column<int>(type: "int", nullable: true, comment: "表格问题类型"),
                    SystemCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "系统标准Id"),
                    QuestionMark = table.Column<int>(type: "int", nullable: true, comment: "问题标识"),
                    DictionaryCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "字典code"),
                    ValueType = table.Column<int>(type: "int", nullable: true, comment: "数值类型"),
                    Unit = table.Column<int>(type: "int", nullable: true, comment: "单位"),
                    QuestionEnName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题英文名称"),
                    DataSource = table.Column<int>(type: "int", nullable: false, comment: "数据来源"),
                    LimitEdit = table.Column<int>(type: "int", nullable: false, comment: "限制编辑"),
                    MaxAnswerLength = table.Column<int>(type: "int", nullable: true, comment: "最大答案长度"),
                    FileType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: true, comment: "文件类型"),
                    QuestionClassify = table.Column<int>(type: "int", nullable: true, comment: "问题分类"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingTableQuestionSystem", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingTableQuestionSystem_ReadingTableQuestionSystem_DependParentId",
                        column: x => x.DependParentId,
                        principalTable: "ReadingTableQuestionSystem",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingTableQuestionSystem_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "系统表格问题");

            migrationBuilder.CreateTable(
                name: "ResearchPublication",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Research = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Grants = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Publications = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    AwardsHonors = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ResearchCN = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    GrantsCN = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    PublicationsCN = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    AwardsHonorsCN = table.Column<string>(type: "nvarchar(max)", 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_ResearchPublication", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ResearchPublication_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生 - 科研学术记录");

            migrationBuilder.CreateTable(
                name: "ShortcutKey",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Keyboardkey = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "对应的键盘按键"),
                    ShortcutKeyEnum = table.Column<int>(type: "int", nullable: false, comment: "按键枚举"),
                    ImageToolType = table.Column<int>(type: "int", nullable: false, comment: "影像工具类型"),
                    UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AltKey = table.Column<bool>(type: "bit", nullable: false),
                    CtrlKey = table.Column<bool>(type: "bit", nullable: false),
                    ShiftKey = table.Column<bool>(type: "bit", nullable: false),
                    MetaKey = table.Column<bool>(type: "bit", nullable: false),
                    Text = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShortcutKey", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ShortcutKey_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "用户配置 - 快捷键");

            migrationBuilder.CreateTable(
                name: "Sponsor",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SponsorName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SponsorNameCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SponsorCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsTrialLevel = table.Column<bool>(type: "bit", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    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_Sponsor", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Sponsor_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "机构 - Sponsor");

            migrationBuilder.CreateTable(
                name: "SystemAnonymization",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Group = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Element = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TagDescription = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TagDescriptionCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ReplaceValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ValueRepresentation = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsAdd = table.Column<bool>(type: "bit", nullable: false),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    IsFixed = table.Column<bool>(type: "bit", 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_SystemAnonymization", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SystemAnonymization_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "系统 - 匿名化配置（需要同步）");

            migrationBuilder.CreateTable(
                name: "SystemBasicData",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Value = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ShowOrder = table.Column<int>(type: "int", nullable: false),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ValueCN = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    BasicDataTypeEnum = table.Column<int>(type: "int", 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_SystemBasicData", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SystemBasicData_SystemBasicData_ParentId",
                        column: x => x.ParentId,
                        principalTable: "SystemBasicData",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_SystemBasicData_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "系统 - 签名模板场景配置  (需要同步)");

            migrationBuilder.CreateTable(
                name: "SystemClinicalQuestion",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SystemClinicalId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目临床数据Id"),
                    QuestionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题名称"),
                    QuestionEnName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题英文名称"),
                    ClinicalQuestionType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "临床问题类型(分组，单选。)"),
                    ClinicalQuestionMarkEnum = table.Column<int>(type: "int", nullable: true, comment: "问题标识"),
                    MaxAnswerLength = table.Column<int>(type: "int", nullable: true, comment: "最大长度"),
                    MaxQuestionCount = table.Column<int>(type: "int", nullable: true, comment: "最大行数"),
                    ClinicalOptionTypeEnum = table.Column<int>(type: "int", nullable: false, comment: "临床数据选项类型(无，自定义)"),
                    GroupId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "分组Id"),
                    TypeValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "自定义选项"),
                    DictionaryCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "字典Code"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    IsRequired = table.Column<int>(type: "int", nullable: false, comment: "是否必填"),
                    RelevanceValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "关联Value"),
                    RelevanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "关联ID"),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "父问题Id"),
                    ParentTriggerValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "父问题触发值"),
                    ClinicalQuestionShowEnum = table.Column<int>(type: "int", nullable: false, comment: "显示类型"),
                    IsCheckDate = table.Column<bool>(type: "bit", nullable: false, comment: "是否是检查日期"),
                    DigitPlaces = table.Column<int>(type: "int", nullable: true, comment: "小数点位数"),
                    Unit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "单位"),
                    CustomCalculateMark = table.Column<int>(type: "int", nullable: true, comment: "自定义计算标记"),
                    CalculateQuestions = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "自定义计算问题"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SystemClinicalQuestion", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SystemClinicalQuestion_SystemClinicalQuestion_GroupId",
                        column: x => x.GroupId,
                        principalTable: "SystemClinicalQuestion",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_SystemClinicalQuestion_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "系统临床数据问题");

            migrationBuilder.CreateTable(
                name: "SystemClinicalTableQuestion",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SystemClinicalId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "系统临床数据Id"),
                    QuestionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题名称"),
                    QuestionEnName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题英文名称"),
                    ClinicalTableQuestionType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "临床问题类型(分组，单选。)"),
                    ClinicalTableQuestionMarkEnum = table.Column<int>(type: "int", nullable: true, comment: "问题标识"),
                    MaxAnswerLength = table.Column<int>(type: "int", nullable: true, comment: "最大长度"),
                    ClinicalOptionTypeEnum = table.Column<int>(type: "int", nullable: false, comment: "临床数据选项类型(无，自定义)"),
                    TypeValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "自定义选项"),
                    DictionaryCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "字典Code"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    IsRequired = table.Column<int>(type: "int", nullable: false, comment: "是否必填"),
                    QuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "外层问题Id"),
                    DigitPlaces = table.Column<int>(type: "int", nullable: true, comment: "小数点位数"),
                    Unit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "单位"),
                    RelevanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "关联ID"),
                    RelevanceValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "关联Value"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SystemClinicalTableQuestion", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SystemClinicalTableQuestion_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "系统临床表格问题");

            migrationBuilder.CreateTable(
                name: "SystemCriterionDictionaryCode",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SystemCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SystemCriterionDictionaryCode", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SystemCriterionDictionaryCode_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "系统标准 - 字典配置 （需要同步）");

            migrationBuilder.CreateTable(
                name: "SystemDocument",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    FileTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SignViewMinimumMinutes = table.Column<int>(type: "int", nullable: false),
                    Path = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_SystemDocument", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SystemDocument_Dictionary_FileTypeId",
                        column: x => x.FileTypeId,
                        principalTable: "Dictionary",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SystemDocument_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 系统签署文档");

            migrationBuilder.CreateTable(
                name: "SystemNotice",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    NoticeContent = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    NoticeTypeEnum = table.Column<int>(type: "int", nullable: false),
                    NoticeLevelEnum = table.Column<int>(type: "int", nullable: false),
                    ApplicableProjectEnum = table.Column<int>(type: "int", nullable: false),
                    NoticeModeEnum = table.Column<int>(type: "int", nullable: false),
                    NoticeStateEnum = table.Column<int>(type: "int", nullable: false),
                    StartDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    EndDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Path = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PublishedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    PublishedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_SystemNotice", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SystemNotice_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SystemNotice_User_PublishedUserId",
                        column: x => x.PublishedUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                },
                comment: "后台 - 系统通知");

            migrationBuilder.CreateTable(
                name: "TaskMedicalReviewRule",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    Note = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PlanVisitCount = table.Column<int>(type: "int", nullable: false),
                    PlanJudgeCount = table.Column<int>(type: "int", nullable: false),
                    PlanGlobalCount = table.Column<int>(type: "int", nullable: false),
                    PlanTumorCount = table.Column<int>(type: "int", 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_TaskMedicalReviewRule", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TaskMedicalReviewRule_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskMedicalReviewRule_User_DoctorUserId",
                        column: x => x.DoctorUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片 - 一致性分析规则");

            migrationBuilder.CreateTable(
                name: "TrialClinicalQuestion",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialClinicalId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目临床数据Id"),
                    QuestionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题名称"),
                    QuestionEnName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题英文名称"),
                    ClinicalQuestionType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "临床问题类型(分组，单选。)"),
                    ClinicalQuestionMarkEnum = table.Column<int>(type: "int", nullable: true, comment: "问题标识"),
                    MaxAnswerLength = table.Column<int>(type: "int", nullable: true, comment: "最大长度"),
                    MaxQuestionCount = table.Column<int>(type: "int", nullable: true, comment: "最大行数"),
                    ClinicalOptionTypeEnum = table.Column<int>(type: "int", nullable: false, comment: "临床数据选项类型(无，自定义)"),
                    GroupId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "分组Id"),
                    TypeValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "自定义选项"),
                    DictionaryCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "字典Code"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    IsRequired = table.Column<int>(type: "int", nullable: false, comment: "是否必填"),
                    RelevanceValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "关联Value"),
                    RelevanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "关联ID"),
                    SystemClinicalQuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "系统临床问题Id"),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "父问题Id"),
                    ParentTriggerValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "父问题触发值"),
                    ClinicalQuestionShowEnum = table.Column<int>(type: "int", nullable: false, comment: "显示类型"),
                    IsCheckDate = table.Column<bool>(type: "bit", nullable: false, comment: "是否是检查日期"),
                    CustomCalculateMark = table.Column<int>(type: "int", nullable: true, comment: "自定义计算标记"),
                    CalculateQuestions = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "自定义计算问题"),
                    DigitPlaces = table.Column<int>(type: "int", nullable: true, comment: "小数点位数"),
                    Unit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "单位"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialClinicalQuestion", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialClinicalQuestion_ClinicalDataTrialSet_TrialClinicalId",
                        column: x => x.TrialClinicalId,
                        principalTable: "ClinicalDataTrialSet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialClinicalQuestion_TrialClinicalQuestion_GroupId",
                        column: x => x.GroupId,
                        principalTable: "TrialClinicalQuestion",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_TrialClinicalQuestion_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目临床数据问题");

            migrationBuilder.CreateTable(
                name: "TrialClinicalTableQuestion",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialClinicalId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目临床数据Id"),
                    QuestionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题名称"),
                    QuestionEnName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题英文名称"),
                    ClinicalTableQuestionType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "临床问题类型(分组，单选。)"),
                    ClinicalTableQuestionMarkEnum = table.Column<int>(type: "int", nullable: true, comment: "问题标识"),
                    MaxAnswerLength = table.Column<int>(type: "int", nullable: true, comment: "最大长度"),
                    ClinicalOptionTypeEnum = table.Column<int>(type: "int", nullable: false, comment: "临床数据选项类型(无，自定义)"),
                    TypeValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "自定义选项"),
                    DictionaryCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "字典Code"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    IsRequired = table.Column<int>(type: "int", nullable: false, comment: "是否必填"),
                    QuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "外层问题Id"),
                    SystemTableQuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "系统表格问题Id"),
                    ClinicalCalculateMarkEnum = table.Column<int>(type: "int", nullable: true, comment: "自定义计算标记"),
                    CalculateQuestions = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "自定义计算问题"),
                    DigitPlaces = table.Column<int>(type: "int", nullable: true, comment: "小数点位数"),
                    Unit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "单位"),
                    RelevanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "关联ID"),
                    RelevanceValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "关联Value"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialClinicalTableQuestion", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialClinicalTableQuestion_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目临床表格问题");

            migrationBuilder.CreateTable(
                name: "TrialDicomAE",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CalledAE = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IP = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Port = table.Column<int>(type: "int", nullable: false),
                    Modality = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    LatestTestTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsTestOK = table.Column<bool>(type: "bit", nullable: true),
                    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_TrialDicomAE", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialDicomAE_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目DicomAE");

            migrationBuilder.CreateTable(
                name: "TrialExperience",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PhaseId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    EvaluationContent = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    VisitReadingCount = table.Column<int>(type: "int", nullable: false),
                    StartTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    EndTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_TrialExperience", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialExperience_Dictionary_PhaseId",
                        column: x => x.PhaseId,
                        principalTable: "Dictionary",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_TrialExperience_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生 - 项目临床经历");

            migrationBuilder.CreateTable(
                name: "TrialRevenuesPrice",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Timepoint = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    TimepointIn24H = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    TimepointIn48H = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    Adjudication = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    AdjudicationIn24H = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    AdjudicationIn48H = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    Global = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    Training = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    Downtime = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    RefresherTraining = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, 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_TrialRevenuesPrice", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialRevenuesPrice_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生计费 - 项目工作量收入单价");

            migrationBuilder.CreateTable(
                name: "TrialSign",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SignCodeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SignCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SignText = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    IsCompleted = table.Column<bool>(type: "bit", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialSign", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialSign_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目操作签名表");

            migrationBuilder.CreateTable(
                name: "TrialVirtualSiteCodeUpdate",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    VirturalSiteCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialVirtualSiteCodeUpdate", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialVirtualSiteCodeUpdate_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 虚拟中心编号更新记录");

            migrationBuilder.CreateTable(
                name: "UserLog",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IP = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    LoginFaildName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    OptType = table.Column<int>(type: "int", nullable: false),
                    LoginPassword = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    LoginUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OptUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IPRegion = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserLog", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserLog_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_UserLog_User_LoginUserId",
                        column: x => x.LoginUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_UserLog_User_OptUserId",
                        column: x => x.OptUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                },
                comment: "后台 - 用户账户操作日志");

            migrationBuilder.CreateTable(
                name: "UserPassWordLog",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "用户Id"),
                    PassWord = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "密码"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserPassWordLog", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserPassWordLog_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 用户修改密码");

            migrationBuilder.CreateTable(
                name: "UserWLTemplate",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TemplateName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    WW = table.Column<int>(type: "int", nullable: false),
                    WL = table.Column<int>(type: "int", nullable: false),
                    ShowOrder = table.Column<int>(type: "int", nullable: false),
                    IsPitchOn = table.Column<bool>(type: "bit", nullable: false, comment: "是否为默认"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserWLTemplate", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserWLTemplate_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "用户配置 - WL模板");

            migrationBuilder.CreateTable(
                name: "Vacation",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    EndDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Status = table.Column<int>(type: "int", 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_Vacation", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Vacation_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生 - 假期安排");

            migrationBuilder.CreateTable(
                name: "VerificationCode",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "验证码"),
                    CodeType = table.Column<int>(type: "int", nullable: false, comment: "什么类型的验证码   邮箱|手机"),
                    HasSend = table.Column<bool>(type: "bit", nullable: false),
                    EmailOrPhone = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "发送的邮箱或者手机"),
                    ExpirationTime = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "过期时间"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_VerificationCode", x => x.Id);
                    table.ForeignKey(
                        name: "FK_VerificationCode_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 验证码记录");

            migrationBuilder.CreateTable(
                name: "VisitPlanInfluenceStat",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    InconsistentCount = table.Column<int>(type: "int", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_VisitPlanInfluenceStat", x => x.Id);
                    table.ForeignKey(
                        name: "FK_VisitPlanInfluenceStat_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目配置 - 访视计划调整不一致数量记录表");

            migrationBuilder.CreateTable(
                name: "VolumeReward",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Price = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    Min = table.Column<int>(type: "int", nullable: false),
                    Max = table.Column<int>(type: "int", 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_VolumeReward", x => x.Id);
                    table.ForeignKey(
                        name: "FK_VolumeReward_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生计费 - 奖励");

            migrationBuilder.CreateTable(
                name: "EmailNoticeUserType",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    EmailNoticeConfigId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserType = table.Column<int>(type: "int", nullable: false),
                    EmailUserType = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailNoticeUserType", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EmailNoticeUserType_EmailNoticeConfig_EmailNoticeConfigId",
                        column: x => x.EmailNoticeConfigId,
                        principalTable: "EmailNoticeConfig",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 邮件配置用户类型表（需要同步）");

            migrationBuilder.CreateTable(
                name: "UserTypeMenu",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    MenuId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserTypeMenu", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserTypeMenu_Menu_MenuId",
                        column: x => x.MenuId,
                        principalTable: "Menu",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_UserTypeMenu_UserType_UserTypeId",
                        column: x => x.UserTypeId,
                        principalTable: "UserType",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 系统用户类型菜单中间关系表 （需要同步）");

            migrationBuilder.CreateTable(
                name: "OrganTrialInfo",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OrganInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "器官Id"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目Id"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    TrialCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "标准Id"),
                    Part = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "部位"),
                    PartEN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "部位 英文"),
                    TULOC = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "TULOC 器官"),
                    TULOCEN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "TULOC 器官 英文"),
                    TULAT = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "位置"),
                    TULATEN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "位置 英文"),
                    IsLymphNodes = table.Column<int>(type: "int", nullable: false, comment: "是否是淋巴结"),
                    IsCanEditPosition = table.Column<bool>(type: "bit", nullable: false, comment: "是否可编辑位置"),
                    Classification = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "分类"),
                    ClassificationEN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "分类 英文"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "序号"),
                    OrganType = table.Column<int>(type: "int", nullable: true, comment: "器官类型"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganTrialInfo", x => x.Id);
                    table.ForeignKey(
                        name: "FK_OrganTrialInfo_OrganInfo_OrganInfoId",
                        column: x => x.OrganInfoId,
                        principalTable: "OrganInfo",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_OrganTrialInfo_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目标准 - 器官");

            migrationBuilder.CreateTable(
                name: "Internationalization",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ShowOrder = table.Column<int>(type: "int", nullable: false),
                    State = table.Column<int>(type: "int", nullable: false, comment: "0 1  2 预翻译 已确认  废除"),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Value = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ValueCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    InternationalizationType = table.Column<int>(type: "int", nullable: false),
                    FrontType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Module = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PublishLogId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "关联版本历史记录表Id"),
                    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_Internationalization", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Internationalization_PublishLog_PublishLogId",
                        column: x => x.PublishLogId,
                        principalTable: "PublishLog",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Internationalization_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 国际化配置表 （需要同步）");

            migrationBuilder.CreateTable(
                name: "ReadingQuestionSystem",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingQuestionCriterionSystemId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "系统标准Id"),
                    Type = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "类型"),
                    ParentTriggerValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "父问题触发"),
                    QuestionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题名称"),
                    IsRequired = table.Column<int>(type: "int", nullable: false, comment: "是否是必须"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "父问题ID"),
                    TypeValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "类型值"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false, comment: "是否启用"),
                    IsJudgeQuestion = table.Column<bool>(type: "bit", nullable: false, comment: "是否是裁判问题"),
                    Remark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "备注"),
                    RelevanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "关联ID"),
                    RelevanceValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "关联Value"),
                    GroupName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "分组"),
                    ImageCount = table.Column<int>(type: "int", nullable: false, comment: "图片数量"),
                    ShowQuestion = table.Column<int>(type: "int", nullable: false, comment: "是否显示"),
                    MaxQuestionCount = table.Column<int>(type: "int", nullable: true, comment: "最大问题数"),
                    LesionType = table.Column<int>(type: "int", nullable: true, comment: "病灶类型"),
                    QuestionType = table.Column<int>(type: "int", nullable: true, comment: "问题类型"),
                    IsShowInDicom = table.Column<bool>(type: "bit", nullable: false, comment: "是否显示在Dicom阅片中"),
                    OrderMark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "序号标记"),
                    DictionaryCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "字典code"),
                    QuestionGenre = table.Column<int>(type: "int", nullable: true, comment: "问题类型"),
                    GlobalReadingShowType = table.Column<int>(type: "int", nullable: false, comment: "全局阅片显示类型"),
                    ConvertShowType = table.Column<int>(type: "int", nullable: false, comment: "转化显示类型"),
                    DefaultValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "默认值"),
                    ValueType = table.Column<int>(type: "int", nullable: true, comment: "数值类型"),
                    Unit = table.Column<int>(type: "int", nullable: true, comment: "单位"),
                    QuestionEnName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题英文名称"),
                    GroupEnName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题英文分组"),
                    LimitEdit = table.Column<int>(type: "int", nullable: false, comment: "限制编辑"),
                    LimitShow = table.Column<int>(type: "int", nullable: false, comment: "限制显示"),
                    DataSource = table.Column<int>(type: "int", nullable: false, comment: "数据来源"),
                    MaxAnswerLength = table.Column<int>(type: "int", nullable: true, comment: "最大答案长度"),
                    GroupId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "分组ID"),
                    FileType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "文件类型"),
                    GroupClassify = table.Column<int>(type: "int", nullable: true, comment: "分组分类"),
                    QuestionClassify = table.Column<int>(type: "int", nullable: true, comment: "问题分类"),
                    HighlightAnswer = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "高亮问题的答案"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingQuestionSystem", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingQuestionSystem_ReadingQuestionCriterionSystem_ReadingQuestionCriterionSystemId",
                        column: x => x.ReadingQuestionCriterionSystemId,
                        principalTable: "ReadingQuestionCriterionSystem",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingQuestionSystem_ReadingQuestionSystem_GroupId",
                        column: x => x.GroupId,
                        principalTable: "ReadingQuestionSystem",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingQuestionSystem_ReadingQuestionSystem_ParentId",
                        column: x => x.ParentId,
                        principalTable: "ReadingQuestionSystem",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingQuestionSystem_ReadingQuestionSystem_RelevanceId",
                        column: x => x.RelevanceId,
                        principalTable: "ReadingQuestionSystem",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingQuestionSystem_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "系统阅片问题");

            migrationBuilder.CreateTable(
                name: "Trial",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IndicationTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PhaseId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TrialCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Code = table.Column<int>(type: "int", nullable: false),
                    Indication = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialEnrollStatus = table.Column<int>(type: "int", nullable: false, comment: "入组那一块的状态"),
                    TrialStatusStr = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "启动状态"),
                    CROId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SponsorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ReviewModeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ProjectCycle = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ExpectedPatients = table.Column<int>(type: "int", nullable: false),
                    TimePointsPerPatient = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    GRRReviewers = table.Column<int>(type: "int", nullable: false),
                    TotalReviewers = table.Column<int>(type: "int", nullable: false),
                    ReviewProtocol = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    MessageFromClient = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Note = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ReviewProtocolName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    MessageFromClientName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Expedited = table.Column<int>(type: "int", nullable: false),
                    DeclarationTypes = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AttendedReviewerTypes = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialExtraConfigJsonStr = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    VisitPlanConfirmed = table.Column<bool>(type: "bit", nullable: false),
                    SubjectCodeRule = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "受试者编号具体规则"),
                    IsNoticeSubjectCodeRule = table.Column<bool>(type: "bit", nullable: false, comment: "是否 提醒受试者编号规则"),
                    IsHaveFirstGiveMedicineDate = table.Column<bool>(type: "bit", nullable: false, comment: "是否 有基准时间（首次给药时间）"),
                    IsHaveSubjectAge = table.Column<bool>(type: "bit", nullable: false, comment: "是否有  受试者年龄"),
                    IsEnrollementQualificationConfirm = table.Column<bool>(type: "bit", nullable: false, comment: "是否有 入组性确认"),
                    OutEnrollmentVisitName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "出组后计划外访视名称"),
                    IsVerifyVisitImageDate = table.Column<bool>(type: "bit", nullable: false, comment: "是否 验证拍片日期"),
                    ClinicalInformationTransmissionEnum = table.Column<int>(type: "int", nullable: false, comment: "临床信息传输 1：系统录入  2：系统录入+PDF  0：无"),
                    IsCRAAuditClinicalInformation = table.Column<bool>(type: "bit", nullable: false, comment: "是否审核 临床信息"),
                    QCProcessEnum = table.Column<int>(type: "int", nullable: false, comment: "QC流程  0 不审，1 单审，2双审"),
                    IsImageConsistencyVerification = table.Column<bool>(type: "bit", nullable: false, comment: "影像一致性核查"),
                    IsImageExport = table.Column<bool>(type: "bit", nullable: false, comment: "影像导出"),
                    IsSubjectSecondCodeView = table.Column<bool>(type: "bit", nullable: false),
                    ReadingMode = table.Column<int>(type: "int", nullable: false, comment: "阅片方式"),
                    ChangeDefalutDays = table.Column<int>(type: "int", nullable: false),
                    IsImageReplicationAcrossTrial = table.Column<bool>(type: "bit", nullable: false, comment: "跨项目复制"),
                    BodyPartTypes = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Modalitys = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PreliminaryAuditReuploadText = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ReviewAuditReuploadText = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsPDProgressView = table.Column<bool>(type: "bit", nullable: false, comment: "PD 进展是否显示   配置访视 是否显示 PD进展 (从而可以设置状态)"),
                    ResearchProgramNo = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "研究方案号"),
                    ExperimentName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "实验名称"),
                    MainResearchUnit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "主研单位"),
                    HeadPI = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "负责人PI"),
                    IsUrgent = table.Column<bool>(type: "bit", nullable: false),
                    TrialType = table.Column<int>(type: "int", nullable: false, comment: "项目类型 1 正式项目、0 非正式项目  2是培训项目"),
                    PlanSiteCount = table.Column<int>(type: "int", nullable: false),
                    PlanVisitCount = table.Column<int>(type: "int", nullable: false),
                    TrialFinishedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsSubjectSexView = table.Column<bool>(type: "bit", nullable: false),
                    IsSubjectExpeditedView = table.Column<bool>(type: "bit", nullable: false, comment: "配置Suject  Edit页面 是否显示 加急"),
                    IsTrialStart = table.Column<bool>(type: "bit", nullable: false),
                    QCQuestionConfirmedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    QCQuestionConfirmedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    TrialFinishTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "项目完成时间"),
                    DigitPlaces = table.Column<int>(type: "int", nullable: true),
                    IsTrialProcessConfirmed = table.Column<bool>(type: "bit", nullable: false),
                    IsTrialBasicLogicConfirmed = table.Column<bool>(type: "bit", nullable: false),
                    IsTrialUrgentConfirmed = table.Column<bool>(type: "bit", nullable: false),
                    IsQCQuestionConfirmed = table.Column<bool>(type: "bit", nullable: false),
                    SyncClinicalDataTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "同步临床数据时间"),
                    BlindBaseLineName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BlindFollowUpPrefix = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IndicationEnum = table.Column<int>(type: "int", nullable: false),
                    VitrualSiteCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EmailFromEmail = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "发件箱账号"),
                    EmailFromName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "发件人"),
                    EmailAuthorizationCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "密码/授权码"),
                    EmailSMTPServerAddress = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "SMTP服务器"),
                    EmailSMTPServerPort = table.Column<int>(type: "int", nullable: false, comment: "SMTP端口"),
                    IsConfigureEmail = table.Column<bool>(type: "bit", nullable: false, comment: "是否配置过邮箱"),
                    IsPACSConnect = table.Column<bool>(type: "bit", nullable: false),
                    IsTrialPACSConfirmed = table.Column<bool>(type: "bit", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_Trial", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Trial_CROCompany_CROId",
                        column: x => x.CROId,
                        principalTable: "CROCompany",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Trial_Dictionary_IndicationTypeId",
                        column: x => x.IndicationTypeId,
                        principalTable: "Dictionary",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Trial_Dictionary_PhaseId",
                        column: x => x.PhaseId,
                        principalTable: "Dictionary",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Trial_Dictionary_ReviewModeId",
                        column: x => x.ReviewModeId,
                        principalTable: "Dictionary",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Trial_Sponsor_SponsorId",
                        column: x => x.SponsorId,
                        principalTable: "Sponsor",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Trial_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Trial_User_QCQuestionConfirmedUserId",
                        column: x => x.QCQuestionConfirmedUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                },
                comment: "项目 - 项目基本信息与配置");

            migrationBuilder.CreateTable(
                name: "SystemDocConfirmedUser",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SystemDocumentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ConfirmTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ConfirmUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SignFirstViewTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SignText = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SystemDocConfirmedUser", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SystemDocConfirmedUser_SystemDocument_SystemDocumentId",
                        column: x => x.SystemDocumentId,
                        principalTable: "SystemDocument",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SystemDocConfirmedUser_User_ConfirmUserId",
                        column: x => x.ConfirmUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SystemDocConfirmedUser_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 系统文档签署记录");

            migrationBuilder.CreateTable(
                name: "SystemDocNeedConfirmedUserType",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SystemDocumentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    NeedConfirmUserTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SystemDocNeedConfirmedUserType", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SystemDocNeedConfirmedUserType_SystemDocument_SystemDocumentId",
                        column: x => x.SystemDocumentId,
                        principalTable: "SystemDocument",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SystemDocNeedConfirmedUserType_UserType_NeedConfirmUserTypeId",
                        column: x => x.NeedConfirmUserTypeId,
                        principalTable: "UserType",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 系统文档需要签署用户类型");

            migrationBuilder.CreateTable(
                name: "SystemNoticeUserRead",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SystemNoticeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SystemNoticeUserRead", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SystemNoticeUserRead_SystemNotice_SystemNoticeId",
                        column: x => x.SystemNoticeId,
                        principalTable: "SystemNotice",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SystemNoticeUserRead_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 系统通知用户读取记录");

            migrationBuilder.CreateTable(
                name: "SystemNoticeUserType",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SystemNoticeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SystemNoticeUserType", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SystemNoticeUserType_SystemNotice_SystemNoticeId",
                        column: x => x.SystemNoticeId,
                        principalTable: "SystemNotice",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SystemNoticeUserType_UserType_UserTypeId",
                        column: x => x.UserTypeId,
                        principalTable: "UserType",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SystemNoticeUserType_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "后台 - 系统通知用户类型配置");

            migrationBuilder.CreateTable(
                name: "TrialExperienceCriteria",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialExperienceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    EvaluationCriteriaId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialExperienceCriteria", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialExperienceCriteria_Dictionary_EvaluationCriteriaId",
                        column: x => x.EvaluationCriteriaId,
                        principalTable: "Dictionary",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialExperienceCriteria_Doctor_DoctorId",
                        column: x => x.DoctorId,
                        principalTable: "Doctor",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialExperienceCriteria_TrialExperience_TrialExperienceId",
                        column: x => x.TrialExperienceId,
                        principalTable: "TrialExperience",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生 - 项目临床经历评估标准");

            migrationBuilder.CreateTable(
                name: "DoctorWorkload",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Adjudication = table.Column<int>(type: "int", nullable: false),
                    AdjudicationIn24H = table.Column<int>(type: "int", nullable: false),
                    AdjudicationIn48H = table.Column<int>(type: "int", nullable: false),
                    CreateUserType = table.Column<int>(type: "int", nullable: false),
                    DataFrom = table.Column<int>(type: "int", nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Downtime = table.Column<int>(type: "int", nullable: false),
                    Global = table.Column<int>(type: "int", nullable: false),
                    IsLock = table.Column<bool>(type: "bit", nullable: false),
                    RefresherTraining = table.Column<int>(type: "int", nullable: false),
                    Timepoint = table.Column<int>(type: "int", nullable: false),
                    TimepointIn24H = table.Column<int>(type: "int", nullable: false),
                    TimepointIn48H = table.Column<int>(type: "int", nullable: false),
                    Training = table.Column<int>(type: "int", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    WorkTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    YearMonth = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_DoctorWorkload", x => x.Id);
                    table.ForeignKey(
                        name: "FK_DoctorWorkload_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_DoctorWorkload_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生计费 - 工作量记录表");

            migrationBuilder.CreateTable(
                name: "Enroll",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AttachmentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    EnrollStatus = table.Column<int>(type: "int", nullable: false),
                    AdjustmentMultiple = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true),
                    EnrollTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    OutEnrollTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Memo = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ReviewerReadingType = table.Column<int>(type: "int", nullable: false),
                    Training = table.Column<int>(type: "int", nullable: true),
                    RefresherTraining = table.Column<int>(type: "int", nullable: true),
                    Timepoint = table.Column<int>(type: "int", nullable: true),
                    Timepoint48H = table.Column<int>(type: "int", nullable: true),
                    Timepoint24H = table.Column<int>(type: "int", nullable: true),
                    Adjudication = table.Column<int>(type: "int", nullable: true),
                    Adjudication48H = table.Column<int>(type: "int", nullable: true),
                    Adjudication24H = table.Column<int>(type: "int", nullable: true),
                    Global = table.Column<int>(type: "int", nullable: true),
                    Downtime = table.Column<int>(type: "int", nullable: true),
                    DoctorUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "生成账号  加入到项目中后 赋值"),
                    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_Enroll", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Enroll_Doctor_DoctorId",
                        column: x => x.DoctorId,
                        principalTable: "Doctor",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Enroll_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Enroll_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Enroll_User_DoctorUserId",
                        column: x => x.DoctorUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                },
                comment: "医生 - 入组项目中间记录表");

            migrationBuilder.CreateTable(
                name: "ReadingQuestionCriterionTrial",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingQuestionCriterionSystemId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "系统标准ID"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目Id"),
                    CriterionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "标准"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false, comment: "是否启用"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    IsCompleteConfig = table.Column<bool>(type: "bit", nullable: false, comment: "是否完成配置"),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "描述"),
                    IsConfirm = table.Column<bool>(type: "bit", nullable: false, comment: "是否确认"),
                    FormType = table.Column<int>(type: "int", nullable: false, comment: "表单类型"),
                    DigitPlaces = table.Column<int>(type: "int", nullable: true, comment: "修约小数点"),
                    EvaluationResult = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "评估结果"),
                    GlobalUpdateType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "全局阅片评估更新类型"),
                    EvaluationReason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "评估原因"),
                    IsShowDetail = table.Column<bool>(type: "bit", nullable: false, comment: "是否显示详情"),
                    SynchronizeTime = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "同步时间"),
                    SynchronizeOriginalTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "同步器官时间"),
                    CriterionType = table.Column<int>(type: "int", nullable: false, comment: "标准类型"),
                    IsUrgent = table.Column<bool>(type: "bit", nullable: false, comment: "是否加急"),
                    IseCRFShowInDicomReading = table.Column<bool>(type: "bit", nullable: false, comment: "eCRF报告是否显示在图像页面"),
                    CriterionModalitys = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImagePlatform = table.Column<int>(type: "int", nullable: false, comment: "阅片平台"),
                    ReadingTool = table.Column<int>(type: "int", nullable: true, comment: "阅片工具"),
                    ReadingTaskViewEnum = table.Column<int>(type: "int", nullable: false, comment: "任务组织级别"),
                    IsReadingShowSubjectInfo = table.Column<bool>(type: "bit", nullable: false, comment: "阅片是否显示受试者信息"),
                    IsReadingShowPreviousResults = table.Column<bool>(type: "bit", nullable: false, comment: "IR阅片页面是否可以查看既往任务结果"),
                    IsConfirmMedicineQuestion = table.Column<bool>(type: "bit", nullable: false, comment: "是确认医学审核问题"),
                    ArbitrationRule = table.Column<int>(type: "int", nullable: false, comment: "仲裁对象"),
                    ReadingType = table.Column<int>(type: "int", nullable: false, comment: "阅片模式"),
                    IsReadingPeriod = table.Column<bool>(type: "bit", nullable: false, comment: "存在阅片期"),
                    IsGlobalReading = table.Column<bool>(type: "bit", nullable: false, comment: "是否生成全局阅片任务"),
                    IsSigned = table.Column<bool>(type: "bit", nullable: false, comment: "是否签名"),
                    IsArbitrationReading = table.Column<bool>(type: "bit", nullable: false, comment: "仲裁阅片"),
                    IsOncologyReading = table.Column<bool>(type: "bit", nullable: false, comment: "肿瘤学阅片  原字段 IsClinicalReading"),
                    IsSystemSetOncology = table.Column<bool>(type: "bit", nullable: false, comment: "是否系统设置了 肿瘤学"),
                    IsReadingTaskViewInOrder = table.Column<int>(type: "int", nullable: false, comment: "任务展示访视 读片任务显示是否顺序"),
                    TaskAllocateObjEnum = table.Column<int>(type: "int", nullable: false, comment: "任务分配对象"),
                    IsFollowVisitAutoAssign = table.Column<bool>(type: "bit", nullable: false, comment: "后续访视任务自动分配"),
                    IsFollowGlobalVisitAutoAssign = table.Column<bool>(type: "bit", nullable: false, comment: "后续全局自动分配"),
                    IsFollowJudgeTaskAutoAssign = table.Column<bool>(type: "bit", nullable: false),
                    FollowJudgeTaskAutoAssignDefaultState = table.Column<int>(type: "int", nullable: false),
                    FollowVisitAutoAssignDefaultState = table.Column<int>(type: "int", nullable: false, comment: "后续访视自动分配默认状态"),
                    FollowGlobalVisitAutoAssignDefaultState = table.Column<int>(type: "int", nullable: false, comment: "后续全局自动分配默认状态"),
                    ReadingInfoSignTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "阅片信息签名时间"),
                    IsMustGlobalReading = table.Column<bool>(type: "bit", nullable: false, comment: "是否必须全局阅片"),
                    IsAdditionalAssessment = table.Column<bool>(type: "bit", nullable: false, comment: "是否附加评估"),
                    IsAutoCreate = table.Column<bool>(type: "bit", nullable: false, comment: "自动  手动生成任务"),
                    ImageDownloadEnum = table.Column<int>(type: "int", nullable: false, comment: "阅片过程下载影像"),
                    ImageUploadEnum = table.Column<int>(type: "int", nullable: false, comment: "阅片过程上传影像"),
                    IsImageFilter = table.Column<bool>(type: "bit", nullable: false, comment: "是否影像筛选"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingQuestionCriterionTrial", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingQuestionCriterionTrial_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingQuestionCriterionTrial_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片标准");

            migrationBuilder.CreateTable(
                name: "TrialBodyPart",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Name = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    NameCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsHandAdd = table.Column<bool>(type: "bit", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialBodyPart", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialBodyPart_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialBodyPart_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目部位配置");

            migrationBuilder.CreateTable(
                name: "TrialDictionary",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    KeyName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DictionaryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialDictionary", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialDictionary_Dictionary_DictionaryId",
                        column: x => x.DictionaryId,
                        principalTable: "Dictionary",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialDictionary_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目字典关系表");

            migrationBuilder.CreateTable(
                name: "TrialDocument",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    FileTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "需要确认的项目用户 通过TrialId 关联 用中间表过滤"),
                    Name = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Path = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SignViewMinimumMinutes = table.Column<int>(type: "int", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_TrialDocument", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialDocument_Dictionary_FileTypeId",
                        column: x => x.FileTypeId,
                        principalTable: "Dictionary",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialDocument_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialDocument_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目文档");

            migrationBuilder.CreateTable(
                name: "TrialExternalUser",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Phone = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Email = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FirstName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    LastName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    OrganizationName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsSystemUser = table.Column<bool>(type: "bit", nullable: false),
                    SystemUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsJoin = table.Column<bool>(type: "bit", nullable: false),
                    ExpireTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ConfirmTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    RejectReason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    InviteState = table.Column<int>(type: "int", nullable: false, comment: "邀请状态"),
                    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_TrialExternalUser", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialExternalUser_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialExternalUser_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目外部人员");

            migrationBuilder.CreateTable(
                name: "TrialImageDownload",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsSuccess = table.Column<bool>(type: "bit", nullable: false),
                    DownloadStartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DownloadEndTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    VisitName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImageType = table.Column<int>(type: "int", nullable: false),
                    NoneDicomStudyCount = table.Column<int>(type: "int", nullable: false),
                    DicomStudyCount = table.Column<int>(type: "int", nullable: false),
                    ImageCount = table.Column<int>(type: "int", nullable: false),
                    ImageSize = table.Column<long>(type: "bigint", nullable: false),
                    IP = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_TrialImageDownload", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialImageDownload_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialImageDownload_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 影像下载监控");

            migrationBuilder.CreateTable(
                name: "TrialPaymentPrice",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialAdditional = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    SowName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SowPath = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AdjustmentMultiple = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    IsNewTrial = table.Column<bool>(type: "bit", nullable: true, comment: "是否有 为新项目"),
                    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_TrialPaymentPrice", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialPaymentPrice_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialPaymentPrice_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生计费 - 项目支付配置");

            migrationBuilder.CreateTable(
                name: "TrialQCQuestion",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    QuestionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    LanguageType = table.Column<int>(type: "int", nullable: false, comment: "语言类型"),
                    IsRequired = table.Column<bool>(type: "bit", nullable: false),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    Type = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "下拉框、文本、单选、多选"),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TypeValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ParentTriggerValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ShowOrder = table.Column<int>(type: "int", nullable: false),
                    IsConfirm = table.Column<bool>(type: "bit", nullable: true),
                    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_TrialQCQuestion", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialQCQuestion_TrialQCQuestion_ParentId",
                        column: x => x.ParentId,
                        principalTable: "TrialQCQuestion",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_TrialQCQuestion_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialQCQuestion_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 质控问题");

            migrationBuilder.CreateTable(
                name: "TrialStateChange",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OriginState = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    NowState = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Reason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialStateChange", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialStateChange_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialStateChange_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目状态变更记录表");

            migrationBuilder.CreateTable(
                name: "TrialStatus",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialStatus = table.Column<int>(type: "int", nullable: false),
                    Memo = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    OptUserType = table.Column<int>(type: "int", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialStatus", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialStatus_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialStatus_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 入组流程记录");

            migrationBuilder.CreateTable(
                name: "TrialUser",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    JoinTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_TrialUser", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialUser_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialUser_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialUser_User_UserId",
                        column: x => x.UserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "运维人员与项目关联关系表 - 实体");

            migrationBuilder.CreateTable(
                name: "VisitStage",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    BlindName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    VisitNum = table.Column<decimal>(type: "decimal(18,1)", precision: 18, scale: 1, nullable: false),
                    VisitName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    VisitDay = table.Column<int>(type: "int", nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsConfirmed = table.Column<bool>(type: "bit", nullable: false),
                    NeedGlobal = table.Column<bool>(type: "bit", nullable: false),
                    IsBaseLine = table.Column<bool>(type: "bit", nullable: false),
                    VisitWindowLeft = table.Column<int>(type: "int", nullable: false),
                    VisitWindowRight = table.Column<int>(type: "int", nullable: false),
                    IsHaveFirstConfirmed = table.Column<bool>(type: "bit", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_VisitStage", x => x.Id);
                    table.ForeignKey(
                        name: "FK_VisitStage_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_VisitStage_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目配置 - 访视记录");

            migrationBuilder.CreateTable(
                name: "EnrollReadingCategory",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    EnrollId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingCategory = table.Column<int>(type: "int", nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EnrollReadingCategory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EnrollReadingCategory_Enroll_EnrollId",
                        column: x => x.EnrollId,
                        principalTable: "Enroll",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_EnrollReadingCategory_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生 - 项目阅片标准阅片类型配置表");

            migrationBuilder.CreateTable(
                name: "EnrollReadingCriterion",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    EnrollId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsJoinAnalysis = table.Column<bool>(type: "bit", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EnrollReadingCriterion", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EnrollReadingCriterion_Enroll_EnrollId",
                        column: x => x.EnrollId,
                        principalTable: "Enroll",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_EnrollReadingCriterion_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生 - 项目阅片标准参与一致性分析配置表");

            migrationBuilder.CreateTable(
                name: "TaskAllocationRule",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PlanSubjectCount = table.Column<int>(type: "int", nullable: false),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    Note = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DoctorUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    EnrollId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsJudgeDoctor = table.Column<bool>(type: "bit", nullable: false, comment: "是否是裁判医生  裁判医生单独加入"),
                    PlanReadingRatio = table.Column<int>(type: "int", 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_TaskAllocationRule", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TaskAllocationRule_Enroll_EnrollId",
                        column: x => x.EnrollId,
                        principalTable: "Enroll",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskAllocationRule_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskAllocationRule_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskAllocationRule_User_DoctorUserId",
                        column: x => x.DoctorUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片 - 分配规则");

            migrationBuilder.CreateTable(
                name: "ReadingQuestionTrial",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsAdditional = table.Column<bool>(type: "bit", nullable: false),
                    ReadingQuestionCriterionTrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目标准Id"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目Id"),
                    Type = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "类型"),
                    ParentTriggerValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "父问题触发"),
                    QuestionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题名称"),
                    IsRequired = table.Column<int>(type: "int", nullable: false, comment: "是否是必须"),
                    ShowOrder = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "父问题ID"),
                    TypeValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "类型值"),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    IsJudgeQuestion = table.Column<bool>(type: "bit", nullable: false, comment: "是否是裁判问题"),
                    LesionType = table.Column<int>(type: "int", nullable: true, comment: "病灶类型"),
                    QuestionType = table.Column<int>(type: "int", nullable: true, comment: "问题类型"),
                    GlobalReadingShowType = table.Column<int>(type: "int", nullable: false, comment: "全局阅片显示类型"),
                    ConvertShowType = table.Column<int>(type: "int", nullable: false, comment: "转化显示类型"),
                    Remark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "备注"),
                    GroupName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "分组"),
                    ReadingQuestionSystemId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "系统问题ID"),
                    SystemParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "系统标准的ParentId"),
                    AnswerGroup = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "答案分组"),
                    AnswerCombination = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "答案组合"),
                    JudgeType = table.Column<int>(type: "int", nullable: false, comment: "裁判类型"),
                    JudgeDifferenceValue = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "裁判百分比或绝对值的相差值"),
                    JudgeDifferenceType = table.Column<int>(type: "int", nullable: false, comment: "裁判百分比或绝对值的相差值匹配规则"),
                    ReadingCriterionPageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "标准分页Id"),
                    RelevanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "关联ID"),
                    RelevanceValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "关联Value"),
                    ImageCount = table.Column<int>(type: "int", nullable: false, comment: "图片数量"),
                    ShowQuestion = table.Column<int>(type: "int", nullable: false, comment: "是否显示"),
                    DefaultValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "默认值"),
                    MaxQuestionCount = table.Column<int>(type: "int", nullable: true, comment: "最大问题数"),
                    MaxAnswerLength = table.Column<int>(type: "int", nullable: true, comment: "最大答案长度"),
                    FileType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "文件类型"),
                    IsShowInDicom = table.Column<bool>(type: "bit", nullable: false, comment: "是否显示在Dicom阅片中"),
                    OrderMark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "序号标记"),
                    DictionaryCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "字典code"),
                    QuestionGenre = table.Column<int>(type: "int", nullable: true, comment: "问题类型"),
                    ValueType = table.Column<int>(type: "int", nullable: true, comment: "数值类型"),
                    Unit = table.Column<int>(type: "int", nullable: true, comment: "单位"),
                    CustomUnit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "自定义单位"),
                    CustomCalculateMark = table.Column<int>(type: "int", nullable: true, comment: "自定义计算标记"),
                    LimitEdit = table.Column<int>(type: "int", nullable: false, comment: "限制编辑"),
                    LimitShow = table.Column<int>(type: "int", nullable: false, comment: "限制显示"),
                    CalculateQuestions = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "自定义计算标记"),
                    DataSource = table.Column<int>(type: "int", nullable: false, comment: "数据来源"),
                    QuestionEnName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题英文名称"),
                    GroupEnName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题英文分组"),
                    ClassifyAlgorithms = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "分类算法"),
                    ClassifyQuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "分类问题Id"),
                    IsCopyLesions = table.Column<bool>(type: "bit", nullable: false, comment: "是否复制病灶"),
                    GroupId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "分组ID"),
                    GroupClassify = table.Column<int>(type: "int", nullable: true, comment: "分组分类"),
                    QuestionClassify = table.Column<int>(type: "int", nullable: true, comment: "问题分类"),
                    HighlightAnswer = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "高亮问题的答案"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingQuestionTrial", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingQuestionTrial_ReadingCriterionPage_ReadingCriterionPageId",
                        column: x => x.ReadingCriterionPageId,
                        principalTable: "ReadingCriterionPage",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingQuestionTrial_ReadingQuestionCriterionTrial_ReadingQuestionCriterionTrialId",
                        column: x => x.ReadingQuestionCriterionTrialId,
                        principalTable: "ReadingQuestionCriterionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingQuestionTrial_ReadingQuestionTrial_GroupId",
                        column: x => x.GroupId,
                        principalTable: "ReadingQuestionTrial",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingQuestionTrial_ReadingQuestionTrial_ParentId",
                        column: x => x.ParentId,
                        principalTable: "ReadingQuestionTrial",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingQuestionTrial_ReadingQuestionTrial_RelevanceId",
                        column: x => x.RelevanceId,
                        principalTable: "ReadingQuestionTrial",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingQuestionTrial_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片问题");

            migrationBuilder.CreateTable(
                name: "ReadingTrialCriterionDictionary",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DictionaryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ParentCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsBaseLineUse = table.Column<bool>(type: "bit", nullable: false),
                    IsFollowVisitUse = table.Column<bool>(type: "bit", nullable: false),
                    CrterionDictionaryGroup = table.Column<int>(type: "int", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingTrialCriterionDictionary", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingTrialCriterionDictionary_Dictionary_DictionaryId",
                        column: x => x.DictionaryId,
                        principalTable: "Dictionary",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingTrialCriterionDictionary_ReadingQuestionCriterionTrial_CriterionId",
                        column: x => x.CriterionId,
                        principalTable: "ReadingQuestionCriterionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingTrialCriterionDictionary_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片标准 - 全局配置");

            migrationBuilder.CreateTable(
                name: "TaskConsistentRule",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PlanSubjectCount = table.Column<int>(type: "int", nullable: false),
                    PlanVisitCount = table.Column<int>(type: "int", nullable: false),
                    IntervalWeeks = table.Column<int>(type: "int", nullable: false),
                    IsHaveReadingPeriod = table.Column<bool>(type: "bit", nullable: false),
                    IsGenerateGlobalTask = table.Column<bool>(type: "bit", nullable: false),
                    BlindSubjectNumberOfPlaces = table.Column<int>(type: "int", nullable: false),
                    BlindTrialSiteCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsSelfAnalysis = table.Column<bool>(type: "bit", nullable: false),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    Note = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", 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_TaskConsistentRule", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TaskConsistentRule_ReadingQuestionCriterionTrial_TrialReadingCriterionId",
                        column: x => x.TrialReadingCriterionId,
                        principalTable: "ReadingQuestionCriterionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskConsistentRule_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskConsistentRule_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片 - 一致性分析生成任务配置");

            migrationBuilder.CreateTable(
                name: "TrialClinicalDataSetCriterion",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialClinicalDataSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", 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_TrialClinicalDataSetCriterion", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialClinicalDataSetCriterion_ClinicalDataTrialSet_TrialClinicalDataSetId",
                        column: x => x.TrialClinicalDataSetId,
                        principalTable: "ClinicalDataTrialSet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialClinicalDataSetCriterion_ReadingQuestionCriterionTrial_TrialReadingCriterionId",
                        column: x => x.TrialReadingCriterionId,
                        principalTable: "ReadingQuestionCriterionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialClinicalDataSetCriterion_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目标准 - 临床数据配置");

            migrationBuilder.CreateTable(
                name: "TrialCriterionAdditionalAssessmentType",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CriterionType = table.Column<int>(type: "int", nullable: false),
                    AdditionalAssessmentType = table.Column<int>(type: "int", nullable: false),
                    IsSelected = table.Column<bool>(type: "bit", nullable: true),
                    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_TrialCriterionAdditionalAssessmentType", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialCriterionAdditionalAssessmentType_ReadingQuestionCriterionTrial_TrialReadingCriterionId",
                        column: x => x.TrialReadingCriterionId,
                        principalTable: "ReadingQuestionCriterionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialCriterionAdditionalAssessmentType_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目标准附加评估配置");

            migrationBuilder.CreateTable(
                name: "TrialCriterionDictionaryCode",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialCriterionDictionaryCode", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialCriterionDictionaryCode_ReadingQuestionCriterionTrial_TrialCriterionId",
                        column: x => x.TrialCriterionId,
                        principalTable: "ReadingQuestionCriterionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialCriterionDictionaryCode_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "TrialEmailNoticeConfig",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AttachCNPath = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AttachName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AttachNameCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AttachPath = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AuthorizationCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BusinessLevelEnum = table.Column<int>(type: "int", nullable: false),
                    BusinessModuleEnum = table.Column<int>(type: "int", nullable: false),
                    BusinessScenarioEnum = table.Column<int>(type: "int", nullable: false),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CriterionTypeEnum = table.Column<int>(type: "int", nullable: true),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EmailCron = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EmailHtmlContent = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EmailHtmlContentCN = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EmailTopic = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EmailTopicCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EmailTypeEnum = table.Column<int>(type: "int", nullable: false),
                    EmailUrgentEnum = table.Column<int>(type: "int", nullable: false),
                    FromEmail = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FromName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsAutoSend = table.Column<bool>(type: "bit", nullable: false),
                    IsDistinguishCriteria = table.Column<bool>(type: "bit", nullable: false),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    IsReturnRequired = table.Column<bool>(type: "bit", nullable: false),
                    SMTPServerAddress = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SMTPServerPort = table.Column<int>(type: "int", nullable: false),
                    SysEmailNoticeConfigId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_TrialEmailNoticeConfig", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialEmailNoticeConfig_EmailNoticeConfig_SysEmailNoticeConfigId",
                        column: x => x.SysEmailNoticeConfigId,
                        principalTable: "EmailNoticeConfig",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_TrialEmailNoticeConfig_ReadingQuestionCriterionTrial_TrialReadingCriterionId",
                        column: x => x.TrialReadingCriterionId,
                        principalTable: "ReadingQuestionCriterionTrial",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_TrialEmailNoticeConfig_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialEmailNoticeConfig_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目发送邮件配置");

            migrationBuilder.CreateTable(
                name: "TrialDocConfirmedUser",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialDocumentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ConfirmTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ConfirmUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SignFirstViewTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SignText = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialDocConfirmedUser", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialDocConfirmedUser_TrialDocument_TrialDocumentId",
                        column: x => x.TrialDocumentId,
                        principalTable: "TrialDocument",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialDocConfirmedUser_User_ConfirmUserId",
                        column: x => x.ConfirmUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialDocConfirmedUser_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目文档签署记录");

            migrationBuilder.CreateTable(
                name: "TrialDocNeedConfirmedUserType",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialDocumentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    NeedConfirmUserTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialDocNeedConfirmedUserType", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialDocNeedConfirmedUserType_TrialDocument_TrialDocumentId",
                        column: x => x.TrialDocumentId,
                        principalTable: "TrialDocument",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialDocNeedConfirmedUserType_UserType_NeedConfirmUserTypeId",
                        column: x => x.NeedConfirmUserTypeId,
                        principalTable: "UserType",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目文档需要签署的用户类型");

            migrationBuilder.CreateTable(
                name: "TrialQCQuestionAnswer",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Answer = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    QCProcessEnum = table.Column<int>(type: "int", nullable: false),
                    CurrentQCEnum = table.Column<int>(type: "int", nullable: false, comment: "1代表第一个人QC数据  2 代表第二个人QC数据"),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialQCQuestionConfigureId = table.Column<Guid>(type: "uniqueidentifier", 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_TrialQCQuestionAnswer", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialQCQuestionAnswer_TrialQCQuestion_TrialQCQuestionConfigureId",
                        column: x => x.TrialQCQuestionConfigureId,
                        principalTable: "TrialQCQuestion",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialQCQuestionAnswer_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 质控问题表单答案");

            migrationBuilder.CreateTable(
                name: "EnrollDetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    EnrollStatus = table.Column<int>(type: "int", nullable: false),
                    EnrollId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Memo = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    OptUserType = table.Column<int>(type: "int", nullable: false),
                    TrialDetailId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EnrollDetail", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EnrollDetail_Doctor_DoctorId",
                        column: x => x.DoctorId,
                        principalTable: "Doctor",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_EnrollDetail_TrialStatus_TrialDetailId",
                        column: x => x.TrialDetailId,
                        principalTable: "TrialStatus",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_EnrollDetail_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "医生 - 入组项目流程记录表");

            migrationBuilder.CreateTable(
                name: "ReadingPeriodSet",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingPeriodName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "阅片期名称"),
                    ReadingScope = table.Column<int>(type: "int", nullable: false, comment: "阅片范围"),
                    ExpirationDate = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "截止日期"),
                    ExpirationVisitNum = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "截止访视"),
                    VisitStageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "访视计划ID"),
                    IsTakeEffect = table.Column<int>(type: "int", nullable: false, comment: "是否生效"),
                    EffectOfTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "生效时间"),
                    IsGlobal = table.Column<bool>(type: "bit", nullable: false, comment: "是否为全局阅片"),
                    ReadingSetType = table.Column<int>(type: "int", nullable: false, comment: "阅片配置的类型"),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_ReadingPeriodSet", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingPeriodSet_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingPeriodSet_VisitStage_VisitStageId",
                        column: x => x.VisitStageId,
                        principalTable: "VisitStage",
                        principalColumn: "Id");
                },
                comment: "阅片期设置  只会设计到所有人 或者某个Site  针对全局");

            migrationBuilder.CreateTable(
                name: "ReadingTableQuestionTrial",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingQuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目问题的Id ReadingQuestionTrial的id"),
                    Type = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ParentTriggerValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    QuestionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsRequired = table.Column<int>(type: "int", nullable: false),
                    ShowOrder = table.Column<int>(type: "int", nullable: false),
                    TypeValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsEnable = table.Column<bool>(type: "bit", nullable: false),
                    Remark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    RelevanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    RelevanceValue = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ShowQuestion = table.Column<int>(type: "int", nullable: false),
                    MaxRowCount = table.Column<int>(type: "int", nullable: true),
                    DataTableName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DataTableColumn = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TableQuestionType = table.Column<int>(type: "int", nullable: true),
                    DependParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDepend = table.Column<int>(type: "int", nullable: false),
                    TrialCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    QuestionMark = table.Column<int>(type: "int", nullable: true, comment: "问题标识"),
                    DictionaryCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "字典code"),
                    ValueType = table.Column<int>(type: "int", nullable: true, comment: "数值类型"),
                    Unit = table.Column<int>(type: "int", nullable: true, comment: "单位"),
                    CustomUnit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "自定义单位"),
                    CustomCalculateMark = table.Column<int>(type: "int", nullable: true, comment: "自定义计算标记"),
                    LimitEdit = table.Column<int>(type: "int", nullable: false, comment: "限制编辑"),
                    CalculateQuestions = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "自定义计算标记"),
                    QuestionEnName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "问题英文名称"),
                    DataSource = table.Column<int>(type: "int", nullable: false, comment: "数据来源"),
                    MaxAnswerLength = table.Column<int>(type: "int", nullable: true, comment: "最大答案长度"),
                    FileType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "文件类型"),
                    QuestionClassify = table.Column<int>(type: "int", nullable: true, comment: "问题分类"),
                    IsCopy = table.Column<bool>(type: "bit", nullable: false, comment: "复制病灶的时候 是否复制这个问题"),
                    SystemTableQuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "系统表格问题Id"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingTableQuestionTrial", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingTableQuestionTrial_ReadingQuestionTrial_ReadingQuestionId",
                        column: x => x.ReadingQuestionId,
                        principalTable: "ReadingQuestionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingTableQuestionTrial_ReadingTableQuestionTrial_DependParentId",
                        column: x => x.DependParentId,
                        principalTable: "ReadingTableQuestionTrial",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingTableQuestionTrial_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片问题");

            migrationBuilder.CreateTable(
                name: "TrialEmailBlackUser",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialEmailNoticeConfigId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialEmailBlackUser", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialEmailBlackUser_TrialEmailNoticeConfig_TrialEmailNoticeConfigId",
                        column: x => x.TrialEmailNoticeConfigId,
                        principalTable: "TrialEmailNoticeConfig",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialEmailBlackUser_User_UserId",
                        column: x => x.UserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目邮件用户黑名单");

            migrationBuilder.CreateTable(
                name: "TrialEmailNoticeUser",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserType = table.Column<int>(type: "int", nullable: false),
                    TrialEmailNoticeConfigId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    EmailUserType = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TrialEmailNoticeUser", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialEmailNoticeUser_TrialEmailNoticeConfig_TrialEmailNoticeConfigId",
                        column: x => x.TrialEmailNoticeConfigId,
                        principalTable: "TrialEmailNoticeConfig",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目邮件收发配置用户类型");

            migrationBuilder.CreateTable(
                name: "Hospital",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    HospitalName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    UniversityAffiliated = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Country = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Province = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    City = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    HospitalNameCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    UniversityAffiliatedCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CountryCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ProvinceCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CityCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SiteId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "中心Id"),
                    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_Hospital", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Hospital_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "机构 - 医院");

            migrationBuilder.CreateTable(
                name: "Site",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SiteName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SiteNameCN = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AliasName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SiteCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Code = table.Column<int>(type: "int", nullable: false),
                    City = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Country = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    HospitalId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    State = table.Column<int>(type: "int", nullable: false),
                    Province = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    UniqueCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Address = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DirectorName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DirectorPhone = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ContactName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ContactPhone = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_Site", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Site_Hospital_HospitalId",
                        column: x => x.HospitalId,
                        principalTable: "Hospital",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Site_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "机构 - Site");

            migrationBuilder.CreateTable(
                name: "TrialSite",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SiteId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TrialSiteCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialSiteName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialSiteAliasName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EnabledTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_TrialSite", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialSite_Site_SiteId",
                        column: x => x.SiteId,
                        principalTable: "Site",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_TrialSite_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialSite_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目中心表");

            migrationBuilder.CreateTable(
                name: "ReadingPeriodSite",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingPeriodSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "阅片期配置ID"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialSiteId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingPeriodSite", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingPeriodSite_ReadingPeriodSet_ReadingPeriodSetId",
                        column: x => x.ReadingPeriodSetId,
                        principalTable: "ReadingPeriodSet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingPeriodSite_TrialSite_TrialSiteId",
                        column: x => x.TrialSiteId,
                        principalTable: "TrialSite",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingPeriodSite_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "阅片期和中心关联");

            migrationBuilder.CreateTable(
                name: "SCPImageUpload",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CallingAE = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CalledAE = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CallingAEIP = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    StartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    EndTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    FileCount = table.Column<int>(type: "int", nullable: false),
                    FileSize = table.Column<long>(type: "bigint", nullable: false),
                    StudyCount = table.Column<int>(type: "int", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialSiteId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SCPImageUpload", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SCPImageUpload_TrialSite_TrialSiteId",
                        column: x => x.TrialSiteId,
                        principalTable: "TrialSite",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SCPImageUpload_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SCPImageUpload_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目中心 - 影像推送记录");

            migrationBuilder.CreateTable(
                name: "TrialSiteDicomAE",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialSiteId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CallingAE = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IP = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Port = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_TrialSiteDicomAE", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialSiteDicomAE_TrialSite_TrialSiteId",
                        column: x => x.TrialSiteId,
                        principalTable: "TrialSite",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialSiteDicomAE_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目中心DicomAE表");

            migrationBuilder.CreateTable(
                name: "TrialSiteSurvey",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialSiteId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    State = table.Column<int>(type: "int", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Phone = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Email = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AverageEngravingCycle = table.Column<int>(type: "int", nullable: false),
                    IsConfirmImagingTechnologist = table.Column<bool>(type: "bit", nullable: false),
                    NotConfirmReson = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EfficacyEvaluatorType = table.Column<int>(type: "int", nullable: false),
                    IsFollowStudyParameters = table.Column<bool>(type: "bit", nullable: false),
                    NotFollowReson = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    LatestBackReason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PreliminaryUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ReviewerUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    PreliminaryTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ReviewerTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_TrialSiteSurvey", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialSiteSurvey_TrialSite_TrialSiteId",
                        column: x => x.TrialSiteId,
                        principalTable: "TrialSite",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialSiteSurvey_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialSiteSurvey_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialSiteSurvey_User_PreliminaryUserId",
                        column: x => x.PreliminaryUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_TrialSiteSurvey_User_ReviewerUserId",
                        column: x => x.ReviewerUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                },
                comment: "项目 - 项目中心调研表");

            migrationBuilder.CreateTable(
                name: "TrialSiteUser",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialSiteId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_TrialSiteUser", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialSiteUser_TrialSite_TrialSiteId",
                        column: x => x.TrialSiteId,
                        principalTable: "TrialSite",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialSiteUser_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialSiteUser_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialSiteUser_User_UserId",
                        column: x => x.UserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目中心用户关系表");

            migrationBuilder.CreateTable(
                name: "TrialSiteEquipmentSurvey",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialSiteSurveyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    EquipmentTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Parameters = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ManufacturerName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ScannerType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Note = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_TrialSiteEquipmentSurvey", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialSiteEquipmentSurvey_Dictionary_EquipmentTypeId",
                        column: x => x.EquipmentTypeId,
                        principalTable: "Dictionary",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialSiteEquipmentSurvey_TrialSiteSurvey_TrialSiteSurveyId",
                        column: x => x.TrialSiteSurveyId,
                        principalTable: "TrialSiteSurvey",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialSiteEquipmentSurvey_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目中心调研设备表");

            migrationBuilder.CreateTable(
                name: "TrialSiteUserSurvey",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialSiteSurveyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TrialRoleCode = table.Column<int>(type: "int", nullable: true),
                    Phone = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Email = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FirstName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    LastName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    OrganizationName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SystemUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsGenerateAccount = table.Column<bool>(type: "bit", nullable: false),
                    IsGenerateSuccess = table.Column<bool>(type: "bit", nullable: false),
                    InviteState = table.Column<int>(type: "int", nullable: false),
                    IsJoin = table.Column<bool>(type: "bit", nullable: false),
                    IsHistoryUser = table.Column<bool>(type: "bit", nullable: false),
                    IsHistoryUserDeleted = table.Column<bool>(type: "bit", nullable: true),
                    IsHistoryUserOriginDeleted = table.Column<bool>(type: "bit", nullable: true),
                    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_TrialSiteUserSurvey", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TrialSiteUserSurvey_TrialSiteSurvey_TrialSiteSurveyId",
                        column: x => x.TrialSiteSurveyId,
                        principalTable: "TrialSiteSurvey",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TrialSiteUserSurvey_UserType_UserTypeId",
                        column: x => x.UserTypeId,
                        principalTable: "UserType",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_TrialSiteUserSurvey_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 项目中心调研用户表");

            migrationBuilder.CreateTable(
                name: "NoneDicomStudy",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FileCount = table.Column<int>(type: "int", nullable: false),
                    Code = table.Column<int>(type: "int", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    BodyPart = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Modality = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImageDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    VideoName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    VideoObjectName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    UploadVideoTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    VideoUrl = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_NoneDicomStudy", x => x.Id);
                    table.ForeignKey(
                        name: "FK_NoneDicomStudy_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "影像 - 非dicom检查");

            migrationBuilder.CreateTable(
                name: "NoneDicomStudyFile",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    NoneDicomStudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Path = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FileType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FileSize = table.Column<long>(type: "bigint", nullable: true),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OriginNoneDicomStudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "为了不影响原始检查，跟任务绑定的  NoneDicomStudyId 为guid空  这个字段记录跟原始检查绑"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NoneDicomStudyFile", x => x.Id);
                    table.ForeignKey(
                        name: "FK_NoneDicomStudyFile_NoneDicomStudy_NoneDicomStudyId",
                        column: x => x.NoneDicomStudyId,
                        principalTable: "NoneDicomStudy",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_NoneDicomStudyFile_NoneDicomStudy_OriginNoneDicomStudyId",
                        column: x => x.OriginNoneDicomStudyId,
                        principalTable: "NoneDicomStudy",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_NoneDicomStudyFile_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "影像 - 非dicom检查关联文件表");

            migrationBuilder.CreateTable(
                name: "PreviousHistory",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StartTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    EndTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsPD = table.Column<int>(type: "int", nullable: true),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsSubjectLevel = table.Column<bool>(type: "bit", nullable: false),
                    Path = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Position = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ClinicalDataTrialSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PreviousHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PreviousHistory_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者访视 - 既往放疗史");

            migrationBuilder.CreateTable(
                name: "PreviousOther",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StartTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    EndTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsPD = table.Column<bool>(type: "bit", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsSubjectLevel = table.Column<bool>(type: "bit", nullable: false),
                    Path = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TreatmentType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ClinicalDataTrialSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "临床数据类型Id"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PreviousOther", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PreviousOther_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者访视 - 既往其他治疗史");

            migrationBuilder.CreateTable(
                name: "PreviousPDF",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Path = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsVisist = table.Column<bool>(type: "bit", nullable: true),
                    ClinicalLevel = table.Column<int>(type: "int", nullable: true, comment: "临床级别"),
                    DataType = table.Column<int>(type: "int", nullable: true, comment: "数据类型"),
                    UploadType = table.Column<int>(type: "int", nullable: true, comment: "上传方式"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PreviousPDF", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PreviousPDF_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者访视 - 临床数据配置");

            migrationBuilder.CreateTable(
                name: "PreviousSurgery",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OperationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsSubjectLevel = table.Column<bool>(type: "bit", nullable: false),
                    Path = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    OperationName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ClinicalDataTrialSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "临床数据类型Id"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PreviousSurgery", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PreviousSurgery_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者访视 - 既往手术史");

            migrationBuilder.CreateTable(
                name: "QCChallenge",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DeadlineTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Note = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    ReuploadEnum = table.Column<int>(type: "int", nullable: false),
                    ReUploadedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ReUploader = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ReUploadUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    QCProcessEnum = table.Column<int>(type: "int", nullable: false),
                    CurrentQCEnum = table.Column<int>(type: "int", nullable: false),
                    LatestMsgTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LatestReplyUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ChallengeCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Code = table.Column<int>(type: "int", nullable: false),
                    IsClosed = table.Column<bool>(type: "bit", nullable: false),
                    ClosedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ClosedUser = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CloseResonEnum = table.Column<int>(type: "int", nullable: false),
                    Content = table.Column<string>(type: "nvarchar(1200)", maxLength: 1200, nullable: false),
                    ActionContent = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    UserTypeEnum = table.Column<int>(type: "int", nullable: false),
                    ChallengeType = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QCChallenge", x => x.Id);
                    table.ForeignKey(
                        name: "FK_QCChallenge_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_QCChallenge_User_LatestReplyUserId",
                        column: x => x.LatestReplyUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                },
                comment: "受试者访视 - QC质疑");

            migrationBuilder.CreateTable(
                name: "QCChallengeDialog",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TalkContent = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    QCChallengeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserTypeEnum = table.Column<int>(type: "int", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QCChallengeDialog", x => x.Id);
                    table.ForeignKey(
                        name: "FK_QCChallengeDialog_QCChallenge_QCChallengeId",
                        column: x => x.QCChallengeId,
                        principalTable: "QCChallenge",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_QCChallengeDialog_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者访视 - QC质疑对话");

            migrationBuilder.CreateTable(
                name: "ReadingClinicalData",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "访视Id  或者模块Id"),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ClinicalDataTrialSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "临床数据类型Id"),
                    IsVisit = table.Column<bool>(type: "bit", nullable: false, comment: "是否为访视"),
                    IsSign = table.Column<bool>(type: "bit", nullable: false, comment: "是否签名"),
                    IsBlind = table.Column<bool>(type: "bit", nullable: true, comment: "是否盲化"),
                    IsComplete = table.Column<bool>(type: "bit", nullable: true, comment: "是否完整"),
                    FileCount = table.Column<int>(type: "int", nullable: false),
                    ReadingClinicalDataState = table.Column<int>(type: "int", nullable: false, comment: "临床数据状态"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingClinicalData", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingClinicalData_ClinicalDataTrialSet_ClinicalDataTrialSetId",
                        column: x => x.ClinicalDataTrialSetId,
                        principalTable: "ClinicalDataTrialSet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingClinicalData_DicomStudy_StudyId",
                        column: x => x.StudyId,
                        principalTable: "DicomStudy",
                        principalColumn: "SeqId");
                    table.ForeignKey(
                        name: "FK_ReadingClinicalData_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingClinicalData_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目的临床数据");

            migrationBuilder.CreateTable(
                name: "ReadingClinicalDataPDF",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingClinicalDataId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "阅片临床数据ID"),
                    Path = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Size = table.Column<int>(type: "int", nullable: false),
                    Type = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingClinicalDataPDF", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingClinicalDataPDF_ReadingClinicalData_ReadingClinicalDataId",
                        column: x => x.ReadingClinicalDataId,
                        principalTable: "ReadingClinicalData",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingClinicalDataPDF_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目的临床数据");

            migrationBuilder.CreateTable(
                name: "ReadingConsistentClinicalData",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目ID"),
                    ReadingId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "访视Id  或者模块Id"),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "受试者ID"),
                    ClinicalDataTrialSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "临床数据类型Id"),
                    IsVisit = table.Column<bool>(type: "bit", nullable: false, comment: "是否为访视"),
                    IsSign = table.Column<bool>(type: "bit", nullable: false, comment: "是否签名"),
                    IsBlind = table.Column<bool>(type: "bit", nullable: true, comment: "是否盲化"),
                    IsComplete = table.Column<bool>(type: "bit", nullable: true, comment: "是否完整"),
                    FileCount = table.Column<int>(type: "int", nullable: false),
                    ReadingClinicalDataState = table.Column<int>(type: "int", nullable: false, comment: "临床数据状态"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingConsistentClinicalData", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingConsistentClinicalData_ClinicalDataTrialSet_ClinicalDataTrialSetId",
                        column: x => x.ClinicalDataTrialSetId,
                        principalTable: "ClinicalDataTrialSet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingConsistentClinicalData_DicomStudy_StudyId",
                        column: x => x.StudyId,
                        principalTable: "DicomStudy",
                        principalColumn: "SeqId");
                    table.ForeignKey(
                        name: "FK_ReadingConsistentClinicalData_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingConsistentClinicalData_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "一致性分析临床数据");

            migrationBuilder.CreateTable(
                name: "ReadingConsistentClinicalDataPDF",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingConsistentClinicalDataId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "阅片临床数据ID"),
                    Path = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Size = table.Column<int>(type: "int", nullable: false),
                    Type = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "文件类型"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingConsistentClinicalDataPDF", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingConsistentClinicalDataPDF_ReadingConsistentClinicalData_ReadingConsistentClinicalDataId",
                        column: x => x.ReadingConsistentClinicalDataId,
                        principalTable: "ReadingConsistentClinicalData",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingConsistentClinicalDataPDF_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "一致性分析临床数据");

            migrationBuilder.CreateTable(
                name: "ReadingGlobalTaskInfo",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    GlobalTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "全局任务Id"),
                    TaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "原任务ID"),
                    QuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "问题ID"),
                    Answer = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "问题答案"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    GlobalAnswerType = table.Column<int>(type: "int", nullable: false, comment: "全局答案类型"),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingGlobalTaskInfo", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingGlobalTaskInfo_ReadingQuestionTrial_QuestionId",
                        column: x => x.QuestionId,
                        principalTable: "ReadingQuestionTrial",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingGlobalTaskInfo_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "阅片全局任务信息");

            migrationBuilder.CreateTable(
                name: "ReadingMedicalReviewDialog",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TaskMedicalReviewId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "医学审核Id"),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "任务Id"),
                    Content = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "对话内容"),
                    UserTypeShortName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "用户角色"),
                    MedicalDialogCloseEnum = table.Column<int>(type: "int", nullable: true, comment: "医学审核对话关闭原因"),
                    UserTypeEnumInt = table.Column<int>(type: "int", nullable: false, comment: "用户角色枚举"),
                    DoctorUserIdeaEnum = table.Column<int>(type: "int", nullable: false, comment: "阅片人是否认同"),
                    IsHaveQuestion = table.Column<bool>(type: "bit", nullable: false, comment: "是否有问题"),
                    Questioning = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "质询问题"),
                    AuditAdviceEnum = table.Column<int>(type: "int", nullable: false, comment: "审核建议"),
                    DisagreeReason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "不同意重阅原因"),
                    IsApplyHeavyReading = table.Column<bool>(type: "bit", nullable: true, comment: "是否申请重阅"),
                    ImagePath = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "图片路径"),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "文件名称"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingMedicalReviewDialog", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingMedicalReviewDialog_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "阅片医学审核对话");

            migrationBuilder.CreateTable(
                name: "ReadingMedicineQuestionAnswer",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingMedicineQuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "医学审核问题Id"),
                    TaskMedicalReviewId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "医学审核Id"),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Answer = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_ReadingMedicineQuestionAnswer", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingMedicineQuestionAnswer_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "阅片医学问题答案");

            migrationBuilder.CreateTable(
                name: "ReadingOncologyTaskInfo",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OncologyTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "肿瘤学  阅片任务ID"),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "产生肿瘤学阅片任务的  访视类型的阅片任务Id"),
                    EvaluationResult = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "结果"),
                    EvaluationReason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "原因"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目Id"),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "受试者Id"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingOncologyTaskInfo", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingOncologyTaskInfo_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "阅片肿瘤学  针对访视任务 添加了一个结果");

            migrationBuilder.CreateTable(
                name: "ReadingPeriodPlan",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingPeriodSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "阅片期配置ID"),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "访视"),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_ReadingPeriodPlan", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingPeriodPlan_ReadingPeriodSet_ReadingPeriodSetId",
                        column: x => x.ReadingPeriodSetId,
                        principalTable: "ReadingPeriodSet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingPeriodPlan_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "阅片计划");

            migrationBuilder.CreateTable(
                name: "ReadingTableAnswerRowInfo",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    QuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    InstanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SeriesId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OtherInstanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OtherSeriesId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OtherStudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OtherMarkTool = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    OtherPicturePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    OtherNumberOfFrames = table.Column<int>(type: "int", nullable: true),
                    IsCanEditPosition = table.Column<bool>(type: "bit", nullable: false),
                    IsDicomReading = table.Column<bool>(type: "bit", nullable: false, comment: "是Dicom阅片"),
                    RowIndex = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    MeasureData = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    IsCurrentTaskAdd = table.Column<bool>(type: "bit", nullable: false, comment: "是否是当前任务添加"),
                    SplitRowId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    MergeRowId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    BlindName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    OrderMark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PicturePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "截图地址"),
                    FristAddTaskNum = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "第一次添加的任务ID"),
                    FristAddTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "首次添加任务ID"),
                    PTSeriesId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "融合的PTSeriesId"),
                    CTSeriesId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "融合的CTSeriesId"),
                    SplitOrMergeType = table.Column<int>(type: "int", nullable: true),
                    NumberOfFrames = table.Column<int>(type: "int", nullable: true),
                    OrganInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "器官Id"),
                    WW = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "窗宽WW"),
                    WL = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "窗位WL"),
                    FromMark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "来自于哪个标记"),
                    ReportMark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "报告页面显示来自于哪个标记"),
                    OtherMeasureData = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    RowMark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "病灶编号"),
                    MarkTool = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "标记工具"),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_ReadingTableAnswerRowInfo", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingTableAnswerRowInfo_DicomInstance_InstanceId",
                        column: x => x.InstanceId,
                        principalTable: "DicomInstance",
                        principalColumn: "SeqId");
                    table.ForeignKey(
                        name: "FK_ReadingTableAnswerRowInfo_OrganInfo_OrganInfoId",
                        column: x => x.OrganInfoId,
                        principalTable: "OrganInfo",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingTableAnswerRowInfo_ReadingQuestionTrial_QuestionId",
                        column: x => x.QuestionId,
                        principalTable: "ReadingQuestionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingTableAnswerRowInfo_ReadingTableAnswerRowInfo_MergeRowId",
                        column: x => x.MergeRowId,
                        principalTable: "ReadingTableAnswerRowInfo",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingTableAnswerRowInfo_ReadingTableAnswerRowInfo_SplitRowId",
                        column: x => x.SplitRowId,
                        principalTable: "ReadingTableAnswerRowInfo",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadingTableAnswerRowInfo_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "表格问题答案行数据");

            migrationBuilder.CreateTable(
                name: "ReadingTableQuestionAnswer",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    QuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TableQuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "表格问题Id"),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    RowIndex = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
                    Answer = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    RowId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_ReadingTableQuestionAnswer", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingTableQuestionAnswer_ReadingQuestionTrial_QuestionId",
                        column: x => x.QuestionId,
                        principalTable: "ReadingQuestionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingTableQuestionAnswer_ReadingTableAnswerRowInfo_RowId",
                        column: x => x.RowId,
                        principalTable: "ReadingTableAnswerRowInfo",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingTableQuestionAnswer_ReadingTableQuestionTrial_TableQuestionId",
                        column: x => x.TableQuestionId,
                        principalTable: "ReadingTableQuestionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingTableQuestionAnswer_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片 - 表格问题行记录子项答案");

            migrationBuilder.CreateTable(
                name: "ReadingTaskQuestionAnswer",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingQuestionTrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目问题Id"),
                    ReadingQuestionCriterionTrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "项目问题标准Id"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Answer = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "答案"),
                    GlobalChangeAnswer = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "全局阅片修改的答案"),
                    IsGlobalChange = table.Column<bool>(type: "bit", nullable: false, comment: "全局阅片是否修改"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingTaskQuestionAnswer", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingTaskQuestionAnswer_ReadingQuestionTrial_ReadingQuestionTrialId",
                        column: x => x.ReadingQuestionTrialId,
                        principalTable: "ReadingQuestionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingTaskQuestionAnswer_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "阅片任务答案");

            migrationBuilder.CreateTable(
                name: "ReadingTaskQuestionMark",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    QuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    InstanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SeriesId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    MarkTool = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    PicturePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    NumberOfFrames = table.Column<int>(type: "int", nullable: true),
                    MeasureData = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    FirstAddTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    QuestionType = table.Column<int>(type: "int", nullable: true),
                    OrderMarkName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    OtherInstanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OtherSeriesId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OtherStudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OtherMarkTool = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    OtherPicturePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    OtherNumberOfFrames = table.Column<int>(type: "int", nullable: true),
                    OtherMeasureData = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingTaskQuestionMark", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingTaskQuestionMark_ReadingQuestionTrial_QuestionId",
                        column: x => x.QuestionId,
                        principalTable: "ReadingQuestionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadingTaskQuestionMark_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片 - 任务问题标记");

            migrationBuilder.CreateTable(
                name: "ReadingTaskRelation",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "任务ID"),
                    RelevanceTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "关联的任务ID"),
                    RelevanceType = table.Column<int>(type: "int", nullable: false, comment: "类型具体解释 看枚举"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadingTaskRelation", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadingTaskRelation_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "任务关系表");

            migrationBuilder.CreateTable(
                name: "ReadModule",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ModuleType = table.Column<int>(type: "int", nullable: false, comment: "模块类型"),
                    ModuleName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "模块名称"),
                    IsUrgent = table.Column<bool>(type: "bit", nullable: true, comment: "是否加急"),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadingPeriodSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "阅片计划ID"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsCRCConfirm = table.Column<bool>(type: "bit", nullable: false),
                    IsPMConfirm = table.Column<bool>(type: "bit", nullable: false),
                    IsNotNeedPMConfirm = table.Column<bool>(type: "bit", nullable: false),
                    IsCRCApplicationRevoke = table.Column<bool>(type: "bit", nullable: false, comment: "CRC是否正在申请撤回"),
                    IsClinicalDataComplete = table.Column<bool>(type: "bit", nullable: true, comment: "临床数据是否完整"),
                    IsClinicalDataBlind = table.Column<bool>(type: "bit", nullable: true, comment: "临床数据是否盲化"),
                    ReadingSetType = table.Column<int>(type: "int", nullable: false, comment: "阅片配置的类型"),
                    ReadingStatus = table.Column<int>(type: "int", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_ReadModule", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadModule_ReadingPeriodSet_ReadingPeriodSetId",
                        column: x => x.ReadingPeriodSetId,
                        principalTable: "ReadingPeriodSet",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ReadModule_ReadingQuestionCriterionTrial_TrialReadingCriterionId",
                        column: x => x.TrialReadingCriterionId,
                        principalTable: "ReadingQuestionCriterionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadModule_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadModule_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "读片模块");

            migrationBuilder.CreateTable(
                name: "ReadModuleCriterionFrom",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReadModuleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ClinicalFormId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "表单Id"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ReadModuleCriterionFrom", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ReadModuleCriterionFrom_ClinicalForm_ClinicalFormId",
                        column: x => x.ClinicalFormId,
                        principalTable: "ClinicalForm",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadModuleCriterionFrom_ReadModule_ReadModuleId",
                        column: x => x.ReadModuleId,
                        principalTable: "ReadModule",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ReadModuleCriterionFrom_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者 - 阅片模块临床表单");

            migrationBuilder.CreateTable(
                name: "SCPInstance",
                columns: table => new
                {
                    SeqId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SeriesId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SeriesInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SopInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    InstanceNumber = table.Column<int>(type: "int", nullable: false),
                    InstanceTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    CPIStatus = table.Column<bool>(type: "bit", nullable: false),
                    ImageRows = table.Column<int>(type: "int", nullable: false),
                    ImageColumns = table.Column<int>(type: "int", nullable: false),
                    SliceLocation = table.Column<int>(type: "int", nullable: false),
                    SliceThickness = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    NumberOfFrames = table.Column<int>(type: "int", nullable: false),
                    PixelSpacing = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImagerPixelSpacing = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FrameOfReferenceUID = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    WindowCenter = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    WindowWidth = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Anonymize = table.Column<bool>(type: "bit", nullable: false),
                    Path = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    FileSize = table.Column<long>(type: "bigint", nullable: true),
                    Id = table.Column<Guid>(type: "uniqueidentifier", 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_SCPInstance", x => x.SeqId);
                    table.ForeignKey(
                        name: "FK_SCPInstance_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目中心 - 推送Instance");

            migrationBuilder.CreateTable(
                name: "SCPPatient",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PatientIdStr = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientAge = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientSex = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientBirthDate = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    EarliestStudyTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LatestStudyTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LatestPushTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialSiteId = table.Column<Guid>(type: "uniqueidentifier", 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_SCPPatient", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SCPPatient_TrialSite_TrialSiteId",
                        column: x => x.TrialSiteId,
                        principalTable: "TrialSite",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SCPPatient_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SCPPatient_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目中心 - 推送检查患者");

            migrationBuilder.CreateTable(
                name: "SCPSeries",
                columns: table => new
                {
                    SeqId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SeriesInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SeriesNumber = table.Column<int>(type: "int", nullable: false),
                    SeriesTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Modality = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    InstanceCount = table.Column<int>(type: "int", nullable: false),
                    SliceThickness = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImagePositionPatient = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImageOrientationPatient = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BodyPartExamined = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SequenceName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ProtocolName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImagerPixelSpacing = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AcquisitionTime = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AcquisitionNumber = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TriggerTime = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BodyPartForEdit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImageResizePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_SCPSeries", x => x.SeqId);
                    table.UniqueConstraint("AK_SCPSeries_Id", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SCPSeries_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目中心 - 推送序列");

            migrationBuilder.CreateTable(
                name: "SCPStudy",
                columns: table => new
                {
                    SeqId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PatientId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    StudyTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Modalities = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SeriesCount = table.Column<int>(type: "int", nullable: false),
                    InstanceCount = table.Column<int>(type: "int", nullable: false),
                    InstitutionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientIdStr = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientAge = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientSex = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    StudyId = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AccessionNumber = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientBirthDate = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AcquisitionTime = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AcquisitionNumber = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TriggerTime = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BodyPartExamined = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BodyPartForEdit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ModalityForEdit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CallingAE = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    CalledAE = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsUploadFinished = table.Column<bool>(type: "bit", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialSiteId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_SCPStudy", x => x.SeqId);
                    table.UniqueConstraint("AK_SCPStudy_Id", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SCPStudy_SCPPatient_PatientId",
                        column: x => x.PatientId,
                        principalTable: "SCPPatient",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SCPStudy_TrialSite_TrialSiteId",
                        column: x => x.TrialSiteId,
                        principalTable: "TrialSite",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SCPStudy_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SCPStudy_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目中心 - 推送检查");

            migrationBuilder.CreateTable(
                name: "StudyMonitor",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ArchiveFinishedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    FailedFileCount = table.Column<int>(type: "int", nullable: false),
                    FileCount = table.Column<int>(type: "int", nullable: false),
                    FileSize = table.Column<long>(type: "bigint", nullable: false),
                    IP = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsDicom = table.Column<bool>(type: "bit", nullable: false),
                    IsDicomReUpload = table.Column<bool>(type: "bit", nullable: false),
                    IsSuccess = table.Column<bool>(type: "bit", nullable: false),
                    Note = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    RecordPath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    StudyCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "Dicom/非Dicom"),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UploadFinishedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UploadStartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StudyMonitor", x => x.Id);
                    table.ForeignKey(
                        name: "FK_StudyMonitor_DicomStudy_StudyId",
                        column: x => x.StudyId,
                        principalTable: "DicomStudy",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_StudyMonitor_NoneDicomStudy_StudyId",
                        column: x => x.StudyId,
                        principalTable: "NoneDicomStudy",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_StudyMonitor_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_StudyMonitor_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 影像上传监控");

            migrationBuilder.CreateTable(
                name: "Subject",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialSiteId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Code = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FirstName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    LastName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Age = table.Column<int>(type: "int", nullable: true),
                    Sex = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    LatestSubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    FinalSubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    MedicalNo = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "1 访视中，2 出组  3 访视结束"),
                    Reason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsEnrollment = table.Column<bool>(type: "bit", nullable: false),
                    OutEnrollmentTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    VisitOverTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ShortName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Height = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Weight = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BirthDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SignDate = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "知情同意书签署日期"),
                    FirstGiveMedicineTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsUrgent = table.Column<bool>(type: "bit", nullable: false),
                    IsReReadingOrBackInfluenceAnalysis = table.Column<bool>(type: "bit", nullable: false, comment: "重阅或者退回影响一致性分析"),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_Subject", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Subject_TrialSite_TrialSiteId",
                        column: x => x.TrialSiteId,
                        principalTable: "TrialSite",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Subject_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Subject_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目 - 受试者");

            migrationBuilder.CreateTable(
                name: "SubjectAdditionalEvaluationResult",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialReadingQuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Answer = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TranslateDictionaryCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "附加评估答案翻译字典"),
                    IsFinalResult = table.Column<bool>(type: "bit", nullable: false, comment: "是否是最终结果"),
                    FinalAnswer = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "最终结果"),
                    FinalTranslateDictionaryCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "最终结果翻字典"),
                    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_SubjectAdditionalEvaluationResult", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SubjectAdditionalEvaluationResult_ReadingQuestionTrial_TrialReadingQuestionId",
                        column: x => x.TrialReadingQuestionId,
                        principalTable: "ReadingQuestionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectAdditionalEvaluationResult_Subject_SubjectId",
                        column: x => x.SubjectId,
                        principalTable: "Subject",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectAdditionalEvaluationResult_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者 - 附加评估标准结果");

            migrationBuilder.CreateTable(
                name: "SubjectCanceDoctor",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Note = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SubjectCanceDoctor", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SubjectCanceDoctor_Subject_SubjectId",
                        column: x => x.SubjectId,
                        principalTable: "Subject",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectCanceDoctor_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者 - 阅片标准取消分配医生记录");

            migrationBuilder.CreateTable(
                name: "SubjectCriteriaEvaluation",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsJoinEvaluation = table.Column<bool>(type: "bit", nullable: false, comment: "是否参与评估"),
                    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_SubjectCriteriaEvaluation", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SubjectCriteriaEvaluation_ReadingQuestionCriterionTrial_TrialReadingCriterionId",
                        column: x => x.TrialReadingCriterionId,
                        principalTable: "ReadingQuestionCriterionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectCriteriaEvaluation_Subject_SubjectId",
                        column: x => x.SubjectId,
                        principalTable: "Subject",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectCriteriaEvaluation_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者 - 参与附加评估标准配置");

            migrationBuilder.CreateTable(
                name: "SubjectUser",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AssignTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DoctorUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ArmEnum = table.Column<int>(type: "int", nullable: false),
                    IsConfirmed = table.Column<bool>(type: "bit", nullable: false),
                    ReplacedSubjectUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "该属性有值 说明该医生被替换了 分配的时候 要过滤掉"),
                    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_SubjectUser", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SubjectUser_SubjectUser_ReplacedSubjectUserId",
                        column: x => x.ReplacedSubjectUserId,
                        principalTable: "SubjectUser",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_SubjectUser_Subject_SubjectId",
                        column: x => x.SubjectId,
                        principalTable: "Subject",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectUser_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectUser_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectUser_User_DoctorUserId",
                        column: x => x.DoctorUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "SubjectVisit",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialSiteId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    VisitStageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "访视计划Id，计划外没有"),
                    VisitDay = table.Column<int>(type: "int", nullable: false),
                    VisitName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    VisitWindowLeft = table.Column<int>(type: "int", nullable: false),
                    VisitWindowRight = table.Column<int>(type: "int", nullable: false),
                    VisitNum = table.Column<decimal>(type: "decimal(18,1)", precision: 18, scale: 1, nullable: false),
                    BlindName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SVUPDES = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SVSTDTC = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SVENDTC = table.Column<DateTime>(type: "datetime2", nullable: true),
                    InPlan = table.Column<bool>(type: "bit", nullable: false),
                    IsBaseLine = table.Column<bool>(type: "bit", nullable: false),
                    VisitExecuted = table.Column<int>(type: "int", nullable: false, comment: "0 未执行  1 执行了  2 不可用"),
                    EarliestScanDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LatestScanDate = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "最晚拍片日期"),
                    Auditor = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CheckState = table.Column<int>(type: "int", nullable: false, comment: "核查状态"),
                    SubmitState = table.Column<int>(type: "int", nullable: false, comment: "提交状态"),
                    AuditState = table.Column<int>(type: "int", nullable: false, comment: "审核状态"),
                    ForwardState = table.Column<int>(type: "int", nullable: false),
                    PreliminaryAuditUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "单审通过人"),
                    ReviewAuditUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "双审通过人"),
                    CheckUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "一致性核查人Id"),
                    ReviewAuditTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    PreliminaryAuditTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ForwardUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ForwardTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    CurrentActionUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "当前质控领取人"),
                    CurrentActionUserExpireTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SubmitTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    CheckTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ManualPassReason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "通过原因"),
                    IsUrgent = table.Column<bool>(type: "bit", nullable: false),
                    IsTake = table.Column<bool>(type: "bit", nullable: false),
                    IsFinalVisit = table.Column<bool>(type: "bit", nullable: false),
                    ChallengeState = table.Column<int>(type: "int", nullable: false),
                    CheckResult = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    IsCheckBack = table.Column<bool>(type: "bit", nullable: true, comment: "是否一致性核查回退"),
                    CheckBackTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    CheckChallengeState = table.Column<int>(type: "int", nullable: false),
                    PDState = table.Column<int>(type: "int", nullable: false),
                    CheckPassedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    OutPlanPreviousVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "计划外上一访视"),
                    RequestBackState = table.Column<int>(type: "int", nullable: false),
                    IsQCConfirmedReupload = table.Column<bool>(type: "bit", nullable: false),
                    IsLostVisit = table.Column<bool>(type: "bit", nullable: false),
                    IsConfirmedClinicalData = table.Column<bool>(type: "bit", nullable: true, comment: "是否确认了、签名了 临床数据完整性"),
                    IsEnrollmentConfirm = table.Column<bool>(type: "bit", nullable: false),
                    IsVisitTaskGenerated = table.Column<bool>(type: "bit", nullable: false),
                    IsPMBackOrReReading = table.Column<bool>(type: "bit", nullable: false),
                    CloseTheReason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "关闭一致性质疑原因"),
                    SubmitUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ReadingStatus = table.Column<int>(type: "int", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_SubjectVisit", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SubjectVisit_SubjectVisit_OutPlanPreviousVisitId",
                        column: x => x.OutPlanPreviousVisitId,
                        principalTable: "SubjectVisit",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_SubjectVisit_Subject_SubjectId",
                        column: x => x.SubjectId,
                        principalTable: "Subject",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectVisit_TrialSite_TrialSiteId",
                        column: x => x.TrialSiteId,
                        principalTable: "TrialSite",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectVisit_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectVisit_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectVisit_User_CurrentActionUserId",
                        column: x => x.CurrentActionUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_SubjectVisit_User_ForwardUserId",
                        column: x => x.ForwardUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_SubjectVisit_User_PreliminaryAuditUserId",
                        column: x => x.PreliminaryAuditUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_SubjectVisit_User_ReviewAuditUserId",
                        column: x => x.ReviewAuditUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_SubjectVisit_User_SubmitUserId",
                        column: x => x.SubmitUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                },
                comment: "受试者访视");

            migrationBuilder.CreateTable(
                name: "SubjectCriteriaEvaluationVisitFilter",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ImageFilterState = table.Column<int>(type: "int", nullable: false, comment: "影像筛选状态"),
                    ImageDeterminationResultState = table.Column<int>(type: "int", nullable: false, comment: "影像判断结果"),
                    IsGeneratedTask = table.Column<bool>(type: "bit", nullable: false, comment: "是否已生成任务"),
                    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_SubjectCriteriaEvaluationVisitFilter", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SubjectCriteriaEvaluationVisitFilter_ReadingQuestionCriterionTrial_TrialReadingCriterionId",
                        column: x => x.TrialReadingCriterionId,
                        principalTable: "ReadingQuestionCriterionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectCriteriaEvaluationVisitFilter_SubjectVisit_SubjectVisitId",
                        column: x => x.SubjectVisitId,
                        principalTable: "SubjectVisit",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectCriteriaEvaluationVisitFilter_Subject_SubjectId",
                        column: x => x.SubjectId,
                        principalTable: "Subject",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectCriteriaEvaluationVisitFilter_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者 - 附加评估标准影像筛选");

            migrationBuilder.CreateTable(
                name: "SubjectCriteriaEvaluationVisitStudyFilter",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SeriesId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsConfirmed = table.Column<bool>(type: "bit", nullable: false),
                    IsReading = table.Column<bool>(type: "bit", 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_SubjectCriteriaEvaluationVisitStudyFilter", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SubjectCriteriaEvaluationVisitStudyFilter_DicomSeries_SeriesId",
                        column: x => x.SeriesId,
                        principalTable: "DicomSeries",
                        principalColumn: "SeqId",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectCriteriaEvaluationVisitStudyFilter_DicomStudy_StudyId",
                        column: x => x.StudyId,
                        principalTable: "DicomStudy",
                        principalColumn: "SeqId",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectCriteriaEvaluationVisitStudyFilter_ReadingQuestionCriterionTrial_TrialReadingCriterionId",
                        column: x => x.TrialReadingCriterionId,
                        principalTable: "ReadingQuestionCriterionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectCriteriaEvaluationVisitStudyFilter_SubjectVisit_SubjectVisitId",
                        column: x => x.SubjectVisitId,
                        principalTable: "SubjectVisit",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_SubjectCriteriaEvaluationVisitStudyFilter_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "受试者 - 附加评估标准影像筛选检查");

            migrationBuilder.CreateTable(
                name: "VisitPlanInfluenceStudy",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsDicomStudy = table.Column<bool>(type: "bit", nullable: false),
                    Modality = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsOverWindowNowNotOverWindow = table.Column<bool>(type: "bit", nullable: false),
                    StudyTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    HistoryWindow = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    NowWindow = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    VisitPlanInfluenceStatId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_VisitPlanInfluenceStudy", x => x.Id);
                    table.ForeignKey(
                        name: "FK_VisitPlanInfluenceStudy_SubjectVisit_SubjectVisitId",
                        column: x => x.SubjectVisitId,
                        principalTable: "SubjectVisit",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_VisitPlanInfluenceStudy_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_VisitPlanInfluenceStudy_VisitPlanInfluenceStat_VisitPlanInfluenceStatId",
                        column: x => x.VisitPlanInfluenceStatId,
                        principalTable: "VisitPlanInfluenceStat",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目配置 - 访视计划调整影像检查");

            migrationBuilder.CreateTable(
                name: "VisitTask",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TaskName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TaskBlindName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SourceSubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "任务来源访视Id  方便回更访视读片状态"),
                    SouceReadModuleId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ReadingCategory = table.Column<int>(type: "int", nullable: false, comment: "任务类型"),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AllocateTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "分配时间"),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Code = table.Column<int>(type: "int", nullable: false),
                    TaskCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    IsUrgent = table.Column<bool>(type: "bit", nullable: false),
                    TaskUrgentType = table.Column<int>(type: "int", nullable: true, comment: "加急类型"),
                    TaskUrgentRemake = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "任务加急类型"),
                    IsCanEditUrgentState = table.Column<bool>(type: "bit", nullable: false, comment: "是否和编辑加急状态"),
                    ArmEnum = table.Column<int>(type: "int", nullable: false, comment: "0 代表 单重阅片 产生的任务    否则就是双重  任务 1 任务  2"),
                    TaskAllocationState = table.Column<int>(type: "int", nullable: false, comment: "分配状态"),
                    TaskState = table.Column<int>(type: "int", nullable: false),
                    ReReadingApplyState = table.Column<int>(type: "int", nullable: false, comment: "重阅状态"),
                    DoctorUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TrialReadingCriterionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    JudgeVisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "裁判任务的Id"),
                    ReadingTaskState = table.Column<int>(type: "int", nullable: false, comment: "任务阅片状态"),
                    SignTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "签名时间"),
                    SuggesteFinishedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsReReadingCreate = table.Column<bool>(type: "bit", nullable: false, comment: "是否是重阅产生的，方便过滤数据"),
                    IsPMSetBack = table.Column<bool>(type: "bit", nullable: false, comment: "PM  对该任务进行了回退  影响的任务不设置"),
                    JudgeResultTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "裁判结果的任务ID"),
                    VisitTaskNum = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "随访任务号   取访视的号  计划外是 访视+0.1   裁判任务在访视任务上+0.002   全局任务在截止访视号上+0.03   肿瘤待定"),
                    FirstReadingTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "首次阅片时间"),
                    IsGlobalHaveUpdate = table.Column<bool>(type: "bit", nullable: true, comment: "全局是否有更新"),
                    IsReadClinicalData = table.Column<bool>(type: "bit", nullable: false, comment: "IR是否阅读临床数据"),
                    RelatedVisitTaskIds = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false, comment: "关联的访视任务ID (当前任务是访视任务的话会有自己)"),
                    ReportRelatedTaskIds = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false, comment: "报告任务关系 包含冻结"),
                    PastResultTaskIds = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false, comment: "既往任务Id  不包括自己"),
                    JudgeResultRemark = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "裁判结果的备注"),
                    JudgeResultImagePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "裁判结果的图片路径"),
                    IsAnalysisDiffToOriginalData = table.Column<bool>(type: "bit", nullable: true, comment: "阅片结果是否和原数据有差异"),
                    IsGroupDiffArm1 = table.Column<bool>(type: "bit", nullable: true, comment: "组件一致性和原Arm1是否有差异"),
                    IsGroupDiffArm2 = table.Column<bool>(type: "bit", nullable: true, comment: "组件一致性和原Arm2是否有差异"),
                    IsAnalysisCreate = table.Column<bool>(type: "bit", nullable: false, comment: "是否是一致性分析产生"),
                    BeforeConvertedTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "转换之前的任务Id(转化的任务才有该值)"),
                    IsChangeTumorEvaluate = table.Column<bool>(type: "bit", nullable: false, comment: "是否修改了整体肿瘤评估"),
                    IsHistoryConvertedTask = table.Column<bool>(type: "bit", nullable: false, comment: "重阅重置任务的 标注是转化之前的 还是转化之后的"),
                    IsSelfAnalysis = table.Column<bool>(type: "bit", nullable: true, comment: "是否是自身一致性"),
                    BlindSubjectCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BlindTrialSiteCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ConsistentAnalysisOriginalTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "针对产生的一致性任务而言，这个字段存储的是原始任务"),
                    IsNeedClinicalDataSign = table.Column<bool>(type: "bit", nullable: false, comment: "临床数据"),
                    IsClinicalDataSign = table.Column<bool>(type: "bit", nullable: false, comment: "临床数据是否签名"),
                    IsFrontTaskNeedSignButNotSign = table.Column<bool>(type: "bit", nullable: false, comment: "前序任务需要签名 但是未签名"),
                    ImageStudyState = table.Column<int>(type: "int", 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_VisitTask", x => x.Id);
                    table.ForeignKey(
                        name: "FK_VisitTask_ReadModule_SouceReadModuleId",
                        column: x => x.SouceReadModuleId,
                        principalTable: "ReadModule",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_VisitTask_ReadingQuestionCriterionTrial_TrialReadingCriterionId",
                        column: x => x.TrialReadingCriterionId,
                        principalTable: "ReadingQuestionCriterionTrial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_VisitTask_SubjectVisit_SourceSubjectVisitId",
                        column: x => x.SourceSubjectVisitId,
                        principalTable: "SubjectVisit",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_VisitTask_Subject_SubjectId",
                        column: x => x.SubjectId,
                        principalTable: "Subject",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_VisitTask_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_VisitTask_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_VisitTask_User_DoctorUserId",
                        column: x => x.DoctorUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_VisitTask_VisitTask_JudgeResultTaskId",
                        column: x => x.JudgeResultTaskId,
                        principalTable: "VisitTask",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_VisitTask_VisitTask_JudgeVisitTaskId",
                        column: x => x.JudgeVisitTaskId,
                        principalTable: "VisitTask",
                        principalColumn: "Id");
                },
                comment: "项目阅片 - 阅片任务表");

            migrationBuilder.CreateTable(
                name: "TaskInfluence",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OriginalTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    InfluenceTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OptType = table.Column<int>(type: "int", nullable: false, comment: "对影响任务进行的操作"),
                    CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TaskInfluence", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TaskInfluence_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskInfluence_VisitTask_InfluenceTaskId",
                        column: x => x.InfluenceTaskId,
                        principalTable: "VisitTask",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskInfluence_VisitTask_OriginalTaskId",
                        column: x => x.OriginalTaskId,
                        principalTable: "VisitTask",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片 - 退回重阅影响");

            migrationBuilder.CreateTable(
                name: "TaskMedicalReview",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    LatestReplyUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    AllocateTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "分配时间"),
                    AuditState = table.Column<int>(type: "int", nullable: false, comment: "审核状态"),
                    AuditSignTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "审核通过时间"),
                    DoctorUserIdeaEnum = table.Column<int>(type: "int", nullable: false, comment: "阅片人是否认同"),
                    MedicalManagerUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsHaveQuestion = table.Column<bool>(type: "bit", nullable: false, comment: "是否有问题"),
                    Questioning = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "质询问题"),
                    ImagePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "图片路径"),
                    AuditAdviceEnum = table.Column<int>(type: "int", nullable: false, comment: "审核建议"),
                    IsClosedDialog = table.Column<bool>(type: "bit", nullable: false, comment: "是否关闭对话"),
                    SaveQuestionTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "保存问题的时间"),
                    DisagreeReason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "不同意重阅原因"),
                    IsApplyHeavyReading = table.Column<bool>(type: "bit", nullable: false, comment: "是否申请重阅"),
                    SaveConclusionTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "保存结论时间"),
                    FileName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "文件名称"),
                    IsSendMessage = table.Column<bool>(type: "bit", nullable: false, comment: "是否发送消息"),
                    MedicalDialogCloseEnum = table.Column<int>(type: "int", nullable: false, comment: "医学审核对话关闭原因"),
                    DialogCloseReason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "对话关闭原因"),
                    IsInvalid = table.Column<bool>(type: "bit", nullable: false, comment: "无效的 为True无效"),
                    IsAutoGenerate = table.Column<bool>(type: "bit", nullable: false),
                    PDRelationTaskIdListStr = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, 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_TaskMedicalReview", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TaskMedicalReview_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskMedicalReview_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskMedicalReview_User_LatestReplyUserId",
                        column: x => x.LatestReplyUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_TaskMedicalReview_User_MedicalManagerUserId",
                        column: x => x.MedicalManagerUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_TaskMedicalReview_VisitTask_VisitTaskId",
                        column: x => x.VisitTaskId,
                        principalTable: "VisitTask",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片 - 医学审核");

            migrationBuilder.CreateTable(
                name: "TaskStudy",
                columns: table => new
                {
                    SeqId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Code = table.Column<int>(type: "int", nullable: false),
                    StudyCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    StudyInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    StudyTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Modalities = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SeriesCount = table.Column<int>(type: "int", nullable: false),
                    InstanceCount = table.Column<int>(type: "int", nullable: false),
                    InstitutionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientId = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientAge = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientSex = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    StudyId = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AccessionNumber = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    PatientBirthDate = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AcquisitionTime = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AcquisitionNumber = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TriggerTime = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BodyPartExamined = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BodyPartForEdit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ModalityForEdit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_TaskStudy", x => x.SeqId);
                    table.UniqueConstraint("AK_TaskStudy_Id", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TaskStudy_Subject_SubjectId",
                        column: x => x.SubjectId,
                        principalTable: "Subject",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskStudy_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskStudy_VisitTask_VisitTaskId",
                        column: x => x.VisitTaskId,
                        principalTable: "VisitTask",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片 - 任务后上传检查");

            migrationBuilder.CreateTable(
                name: "UserFeedBack",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    QuestionType = table.Column<int>(type: "int", nullable: false),
                    QuestionDescription = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    State = table.Column<int>(type: "int", nullable: false),
                    TrialSiteId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ScreenshotListStr = table.Column<string>(type: "nvarchar(400)", maxLength: 400, 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_UserFeedBack", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserFeedBack_SubjectVisit_SubjectVisitId",
                        column: x => x.SubjectVisitId,
                        principalTable: "SubjectVisit",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_UserFeedBack_Subject_SubjectId",
                        column: x => x.SubjectId,
                        principalTable: "Subject",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_UserFeedBack_TrialSite_TrialSiteId",
                        column: x => x.TrialSiteId,
                        principalTable: "TrialSite",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_UserFeedBack_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_UserFeedBack_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_UserFeedBack_VisitTask_VisitTaskId",
                        column: x => x.VisitTaskId,
                        principalTable: "VisitTask",
                        principalColumn: "Id");
                },
                comment: "后台 - 用户反馈");

            migrationBuilder.CreateTable(
                name: "VisitTaskReReading",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OriginalReReadingTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "重阅原始任务Id  重阅会产生新的任务"),
                    RootReReadingTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "产生重阅的根任务Id"),
                    NewReReadingTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "重阅申请 产生的新任务Id"),
                    RequestReReadingUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    RequestReReadingTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    RequestReReadingType = table.Column<int>(type: "int", nullable: false, comment: "申请回退类型"),
                    RequestReReadingReason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    RequestReReadingRejectReason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    RequestReReadingResultEnum = table.Column<int>(type: "int", nullable: false),
                    RequestReReadingConfirmUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsCopyOrigenalForms = table.Column<bool>(type: "bit", nullable: false),
                    IsCopyFollowForms = table.Column<bool>(type: "bit", nullable: false, comment: "仅仅包括全局和访视"),
                    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_VisitTaskReReading", x => x.Id);
                    table.ForeignKey(
                        name: "FK_VisitTaskReReading_Trial_TrialId",
                        column: x => x.TrialId,
                        principalTable: "Trial",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_VisitTaskReReading_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_VisitTaskReReading_User_RequestReReadingConfirmUserId",
                        column: x => x.RequestReReadingConfirmUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_VisitTaskReReading_User_RequestReReadingUserId",
                        column: x => x.RequestReReadingUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_VisitTaskReReading_VisitTask_NewReReadingTaskId",
                        column: x => x.NewReReadingTaskId,
                        principalTable: "VisitTask",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_VisitTaskReReading_VisitTask_OriginalReReadingTaskId",
                        column: x => x.OriginalReReadingTaskId,
                        principalTable: "VisitTask",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_VisitTaskReReading_VisitTask_RootReReadingTaskId",
                        column: x => x.RootReReadingTaskId,
                        principalTable: "VisitTask",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "重阅申请流程记录表");

            migrationBuilder.CreateTable(
                name: "TaskSeries",
                columns: table => new
                {
                    SeqId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SeriesInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SeriesNumber = table.Column<int>(type: "int", nullable: false),
                    SeriesTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Modality = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    InstanceCount = table.Column<int>(type: "int", nullable: false),
                    SliceThickness = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImagePositionPatient = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImageOrientationPatient = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BodyPartExamined = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SequenceName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ProtocolName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImagerPixelSpacing = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AcquisitionTime = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    AcquisitionNumber = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TriggerTime = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    BodyPartForEdit = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImageResizePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    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_TaskSeries", x => x.SeqId);
                    table.UniqueConstraint("AK_TaskSeries_Id", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TaskSeries_TaskStudy_StudyId",
                        column: x => x.StudyId,
                        principalTable: "TaskStudy",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskSeries_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片 - 任务后上传序列");

            migrationBuilder.CreateTable(
                name: "TaskInstance",
                columns: table => new
                {
                    SeqId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SeriesId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StudyInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SeriesInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    SopInstanceUid = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    InstanceNumber = table.Column<int>(type: "int", nullable: false),
                    InstanceTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    CPIStatus = table.Column<bool>(type: "bit", nullable: false),
                    ImageRows = table.Column<int>(type: "int", nullable: false),
                    ImageColumns = table.Column<int>(type: "int", nullable: false),
                    SliceLocation = table.Column<int>(type: "int", nullable: false),
                    SliceThickness = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    NumberOfFrames = table.Column<int>(type: "int", nullable: false),
                    PixelSpacing = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    ImagerPixelSpacing = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    FrameOfReferenceUID = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    WindowCenter = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    WindowWidth = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    TrialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    SubjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Anonymize = table.Column<bool>(type: "bit", nullable: false),
                    Path = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
                    HtmlPath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    FileSize = table.Column<long>(type: "bigint", nullable: true),
                    Id = table.Column<Guid>(type: "uniqueidentifier", 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_TaskInstance", x => x.SeqId);
                    table.ForeignKey(
                        name: "FK_TaskInstance_TaskSeries_SeriesId",
                        column: x => x.SeriesId,
                        principalTable: "TaskSeries",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskInstance_TaskStudy_StudyId",
                        column: x => x.StudyId,
                        principalTable: "TaskStudy",
                        principalColumn: "SeqId",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_TaskInstance_User_CreateUserId",
                        column: x => x.CreateUserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "项目阅片 - 任务后处理Instance");

            migrationBuilder.CreateIndex(
                name: "IX_Attachment_CreateUserId",
                table: "Attachment",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Attachment_DoctorId",
                table: "Attachment",
                column: "DoctorId");

            migrationBuilder.CreateIndex(
                name: "IX_CheckChallengeDialog_CreateUserId",
                table: "CheckChallengeDialog",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_CheckChallengeDialog_SubjectVisitId",
                table: "CheckChallengeDialog",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_ClinicalAnswerRowInfo_CreateUserId",
                table: "ClinicalAnswerRowInfo",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ClinicalDataSystemSet_CreateUserId",
                table: "ClinicalDataSystemSet",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ClinicalDataTrialSet_CreateUserId",
                table: "ClinicalDataTrialSet",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ClinicalDataTrialSet_SystemClinicalDataSetId",
                table: "ClinicalDataTrialSet",
                column: "SystemClinicalDataSetId");

            migrationBuilder.CreateIndex(
                name: "IX_ClinicalDataTrialSet_TrialId",
                table: "ClinicalDataTrialSet",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_ClinicalForm_ClinicalDataTrialSetId",
                table: "ClinicalForm",
                column: "ClinicalDataTrialSetId");

            migrationBuilder.CreateIndex(
                name: "IX_ClinicalForm_CreateUserId",
                table: "ClinicalForm",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ClinicalForm_SubjectId",
                table: "ClinicalForm",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_ClinicalQuestionAnswer_ClinicalFormId",
                table: "ClinicalQuestionAnswer",
                column: "ClinicalFormId");

            migrationBuilder.CreateIndex(
                name: "IX_ClinicalQuestionAnswer_CreateUserId",
                table: "ClinicalQuestionAnswer",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ClinicalTableAnswer_CreateUserId",
                table: "ClinicalTableAnswer",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ClinicalTableAnswer_RowId",
                table: "ClinicalTableAnswer",
                column: "RowId");

            migrationBuilder.CreateIndex(
                name: "IX_CommonDocument_CreateUserId",
                table: "CommonDocument",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_CriterionNidusSystem_CreateUserId",
                table: "CriterionNidusSystem",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_CriterionNidusSystem_CriterionId",
                table: "CriterionNidusSystem",
                column: "CriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_CriterionNidusTrial_CreateUserId",
                table: "CriterionNidusTrial",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_CROCompany_CreateUserId",
                table: "CROCompany",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_DataInspection_CreateUserId",
                table: "DataInspection",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_DataInspection_TrialReadingCriterionId",
                table: "DataInspection",
                column: "TrialReadingCriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_DataInspection_VisitTaskId",
                table: "DataInspection",
                column: "VisitTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_DicomInstance_CreateUserId",
                table: "DicomInstance",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_DicomInstance_SeriesId",
                table: "DicomInstance",
                column: "SeriesId");

            migrationBuilder.CreateIndex(
                name: "IX_DicomInstance_StudyId",
                table: "DicomInstance",
                column: "StudyId");

            migrationBuilder.CreateIndex(
                name: "IX_DicomSeries_CreateUserId",
                table: "DicomSeries",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_DicomSeries_StudyId",
                table: "DicomSeries",
                column: "StudyId");

            migrationBuilder.CreateIndex(
                name: "IX_DicomStudy_CreateUserId",
                table: "DicomStudy",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_DicomStudy_SubjectId",
                table: "DicomStudy",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_DicomStudy_SubjectVisitId",
                table: "DicomStudy",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_DicomStudy_TrialId",
                table: "DicomStudy",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_Dictionary_ConfigTypeId",
                table: "Dictionary",
                column: "ConfigTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_Dictionary_CreateUserId",
                table: "Dictionary",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Dictionary_ParentId",
                table: "Dictionary",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_Doctor_CreateUserId",
                table: "Doctor",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Doctor_DepartmentId",
                table: "Doctor",
                column: "DepartmentId");

            migrationBuilder.CreateIndex(
                name: "IX_Doctor_HospitalId",
                table: "Doctor",
                column: "HospitalId");

            migrationBuilder.CreateIndex(
                name: "IX_Doctor_PositionId",
                table: "Doctor",
                column: "PositionId");

            migrationBuilder.CreateIndex(
                name: "IX_Doctor_RankId",
                table: "Doctor",
                column: "RankId");

            migrationBuilder.CreateIndex(
                name: "IX_Doctor_SpecialityId",
                table: "Doctor",
                column: "SpecialityId");

            migrationBuilder.CreateIndex(
                name: "IX_DoctorCriterionFile_CreateUserId",
                table: "DoctorCriterionFile",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_DoctorCriterionFile_DoctorId",
                table: "DoctorCriterionFile",
                column: "DoctorId");

            migrationBuilder.CreateIndex(
                name: "IX_DoctorDictionary_DictionaryId",
                table: "DoctorDictionary",
                column: "DictionaryId");

            migrationBuilder.CreateIndex(
                name: "IX_DoctorDictionary_DoctorId",
                table: "DoctorDictionary",
                column: "DoctorId");

            migrationBuilder.CreateIndex(
                name: "IX_DoctorPayInformation_CreateUserId",
                table: "DoctorPayInformation",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_DoctorWorkload_CreateUserId",
                table: "DoctorWorkload",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_DoctorWorkload_TrialId",
                table: "DoctorWorkload",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_Education_CreateUserId",
                table: "Education",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailNoticeConfig_CreateUserId",
                table: "EmailNoticeConfig",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailNoticeUserType_EmailNoticeConfigId",
                table: "EmailNoticeUserType",
                column: "EmailNoticeConfigId");

            migrationBuilder.CreateIndex(
                name: "IX_Enroll_CreateUserId",
                table: "Enroll",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Enroll_DoctorId",
                table: "Enroll",
                column: "DoctorId");

            migrationBuilder.CreateIndex(
                name: "IX_Enroll_DoctorUserId",
                table: "Enroll",
                column: "DoctorUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Enroll_TrialId",
                table: "Enroll",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_EnrollDetail_CreateUserId",
                table: "EnrollDetail",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_EnrollDetail_DoctorId",
                table: "EnrollDetail",
                column: "DoctorId");

            migrationBuilder.CreateIndex(
                name: "IX_EnrollDetail_TrialDetailId",
                table: "EnrollDetail",
                column: "TrialDetailId");

            migrationBuilder.CreateIndex(
                name: "IX_EnrollReadingCategory_CreateUserId",
                table: "EnrollReadingCategory",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_EnrollReadingCategory_EnrollId",
                table: "EnrollReadingCategory",
                column: "EnrollId");

            migrationBuilder.CreateIndex(
                name: "IX_EnrollReadingCriterion_CreateUserId",
                table: "EnrollReadingCriterion",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_EnrollReadingCriterion_EnrollId",
                table: "EnrollReadingCriterion",
                column: "EnrollId");

            migrationBuilder.CreateIndex(
                name: "IX_ExchangeRate_CreateUserId",
                table: "ExchangeRate",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ExploreRecommend_CreateUserId",
                table: "ExploreRecommend",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_FrontAuditConfig_CreateUserId",
                table: "FrontAuditConfig",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Hospital_CreateUserId",
                table: "Hospital",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Hospital_SiteId",
                table: "Hospital",
                column: "SiteId");

            migrationBuilder.CreateIndex(
                name: "IX_InspectionFile_CreateUserId",
                table: "InspectionFile",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Internationalization_CreateUserId",
                table: "Internationalization",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Internationalization_PublishLogId",
                table: "Internationalization",
                column: "PublishLogId");

            migrationBuilder.CreateIndex(
                name: "IX_Menu_CreateUserId",
                table: "Menu",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_NoneDicomStudy_CreateUserId",
                table: "NoneDicomStudy",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_NoneDicomStudy_SubjectId",
                table: "NoneDicomStudy",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_NoneDicomStudy_SubjectVisitId",
                table: "NoneDicomStudy",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_NoneDicomStudyFile_CreateUserId",
                table: "NoneDicomStudyFile",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_NoneDicomStudyFile_NoneDicomStudyId",
                table: "NoneDicomStudyFile",
                column: "NoneDicomStudyId");

            migrationBuilder.CreateIndex(
                name: "IX_NoneDicomStudyFile_OriginNoneDicomStudyId",
                table: "NoneDicomStudyFile",
                column: "OriginNoneDicomStudyId");

            migrationBuilder.CreateIndex(
                name: "IX_NoneDicomStudyFile_VisitTaskId",
                table: "NoneDicomStudyFile",
                column: "VisitTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_OrganInfo_CreateUserId",
                table: "OrganInfo",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_OrganTrialInfo_CreateUserId",
                table: "OrganTrialInfo",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_OrganTrialInfo_OrganInfoId",
                table: "OrganTrialInfo",
                column: "OrganInfoId");

            migrationBuilder.CreateIndex(
                name: "IX_Payment_CreateUserId",
                table: "Payment",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_PaymentAdjustment_CreateUserId",
                table: "PaymentAdjustment",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_PaymentDetail_CreateUserId",
                table: "PaymentDetail",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Postgraduate_CreateUserId",
                table: "Postgraduate",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_PreviousHistory_CreateUserId",
                table: "PreviousHistory",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_PreviousHistory_SubjectVisitId",
                table: "PreviousHistory",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_PreviousOther_CreateUserId",
                table: "PreviousOther",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_PreviousOther_SubjectVisitId",
                table: "PreviousOther",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_PreviousPDF_CreateUserId",
                table: "PreviousPDF",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_PreviousPDF_SubjectVisitId",
                table: "PreviousPDF",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_PreviousSurgery_CreateUserId",
                table: "PreviousSurgery",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_PreviousSurgery_SubjectVisitId",
                table: "PreviousSurgery",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_PublishLog_CreateUserId",
                table: "PublishLog",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_QCChallenge_CreateUserId",
                table: "QCChallenge",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_QCChallenge_LatestReplyUserId",
                table: "QCChallenge",
                column: "LatestReplyUserId");

            migrationBuilder.CreateIndex(
                name: "IX_QCChallenge_SubjectVisitId",
                table: "QCChallenge",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_QCChallengeDialog_CreateUserId",
                table: "QCChallengeDialog",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_QCChallengeDialog_QCChallengeId",
                table: "QCChallengeDialog",
                column: "QCChallengeId");

            migrationBuilder.CreateIndex(
                name: "IX_QCChallengeDialog_SubjectVisitId",
                table: "QCChallengeDialog",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_QCQuestion_CreateUserId",
                table: "QCQuestion",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_QCQuestion_ParentId",
                table: "QCQuestion",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_RankPrice_CreateUserId",
                table: "RankPrice",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingClinicalData_ClinicalDataTrialSetId",
                table: "ReadingClinicalData",
                column: "ClinicalDataTrialSetId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingClinicalData_CreateUserId",
                table: "ReadingClinicalData",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingClinicalData_ReadingId",
                table: "ReadingClinicalData",
                column: "ReadingId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingClinicalData_StudyId",
                table: "ReadingClinicalData",
                column: "StudyId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingClinicalData_SubjectId",
                table: "ReadingClinicalData",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingClinicalData_TrialId",
                table: "ReadingClinicalData",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingClinicalDataPDF_CreateUserId",
                table: "ReadingClinicalDataPDF",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingClinicalDataPDF_ReadingClinicalDataId",
                table: "ReadingClinicalDataPDF",
                column: "ReadingClinicalDataId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingConsistentClinicalData_ClinicalDataTrialSetId",
                table: "ReadingConsistentClinicalData",
                column: "ClinicalDataTrialSetId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingConsistentClinicalData_CreateUserId",
                table: "ReadingConsistentClinicalData",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingConsistentClinicalData_ReadingId",
                table: "ReadingConsistentClinicalData",
                column: "ReadingId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingConsistentClinicalData_StudyId",
                table: "ReadingConsistentClinicalData",
                column: "StudyId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingConsistentClinicalData_SubjectId",
                table: "ReadingConsistentClinicalData",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingConsistentClinicalData_TrialId",
                table: "ReadingConsistentClinicalData",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingConsistentClinicalDataPDF_CreateUserId",
                table: "ReadingConsistentClinicalDataPDF",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingConsistentClinicalDataPDF_ReadingConsistentClinicalDataId",
                table: "ReadingConsistentClinicalDataPDF",
                column: "ReadingConsistentClinicalDataId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingCriterionPage_CreateUserId",
                table: "ReadingCriterionPage",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingCustomTag_CreateUserId",
                table: "ReadingCustomTag",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingGlobalTaskInfo_CreateUserId",
                table: "ReadingGlobalTaskInfo",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingGlobalTaskInfo_GlobalTaskId",
                table: "ReadingGlobalTaskInfo",
                column: "GlobalTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingGlobalTaskInfo_QuestionId",
                table: "ReadingGlobalTaskInfo",
                column: "QuestionId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingGlobalTaskInfo_TaskId",
                table: "ReadingGlobalTaskInfo",
                column: "TaskId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingJudgeInfo_CreateUserId",
                table: "ReadingJudgeInfo",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingMedicalReviewDialog_CreateUserId",
                table: "ReadingMedicalReviewDialog",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingMedicalReviewDialog_TaskMedicalReviewId",
                table: "ReadingMedicalReviewDialog",
                column: "TaskMedicalReviewId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingMedicineQuestionAnswer_CreateUserId",
                table: "ReadingMedicineQuestionAnswer",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingMedicineQuestionAnswer_TaskMedicalReviewId",
                table: "ReadingMedicineQuestionAnswer",
                column: "TaskMedicalReviewId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingMedicineSystemQuestion_CreateUserId",
                table: "ReadingMedicineSystemQuestion",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingMedicineSystemQuestion_ParentId",
                table: "ReadingMedicineSystemQuestion",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingMedicineTrialQuestion_CreateUserId",
                table: "ReadingMedicineTrialQuestion",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingMedicineTrialQuestion_ParentId",
                table: "ReadingMedicineTrialQuestion",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingOncologyTaskInfo_CreateUserId",
                table: "ReadingOncologyTaskInfo",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingOncologyTaskInfo_OncologyTaskId",
                table: "ReadingOncologyTaskInfo",
                column: "OncologyTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingOncologyTaskInfo_VisitTaskId",
                table: "ReadingOncologyTaskInfo",
                column: "VisitTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingPeriodPlan_CreateUserId",
                table: "ReadingPeriodPlan",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingPeriodPlan_ReadingPeriodSetId",
                table: "ReadingPeriodPlan",
                column: "ReadingPeriodSetId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingPeriodPlan_SubjectVisitId",
                table: "ReadingPeriodPlan",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingPeriodSet_CreateUserId",
                table: "ReadingPeriodSet",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingPeriodSet_VisitStageId",
                table: "ReadingPeriodSet",
                column: "VisitStageId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingPeriodSite_CreateUserId",
                table: "ReadingPeriodSite",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingPeriodSite_ReadingPeriodSetId",
                table: "ReadingPeriodSite",
                column: "ReadingPeriodSetId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingPeriodSite_TrialSiteId",
                table: "ReadingPeriodSite",
                column: "TrialSiteId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionCriterionSystem_CreateUserId",
                table: "ReadingQuestionCriterionSystem",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionCriterionTrial_CreateUserId",
                table: "ReadingQuestionCriterionTrial",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionCriterionTrial_TrialId",
                table: "ReadingQuestionCriterionTrial",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionSystem_CreateUserId",
                table: "ReadingQuestionSystem",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionSystem_GroupId",
                table: "ReadingQuestionSystem",
                column: "GroupId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionSystem_ParentId",
                table: "ReadingQuestionSystem",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionSystem_ReadingQuestionCriterionSystemId",
                table: "ReadingQuestionSystem",
                column: "ReadingQuestionCriterionSystemId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionSystem_RelevanceId",
                table: "ReadingQuestionSystem",
                column: "RelevanceId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionTrial_CreateUserId",
                table: "ReadingQuestionTrial",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionTrial_GroupId",
                table: "ReadingQuestionTrial",
                column: "GroupId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionTrial_ParentId",
                table: "ReadingQuestionTrial",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionTrial_ReadingCriterionPageId",
                table: "ReadingQuestionTrial",
                column: "ReadingCriterionPageId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionTrial_ReadingQuestionCriterionTrialId",
                table: "ReadingQuestionTrial",
                column: "ReadingQuestionCriterionTrialId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingQuestionTrial_RelevanceId",
                table: "ReadingQuestionTrial",
                column: "RelevanceId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingSystemCriterionDictionary_CreateUserId",
                table: "ReadingSystemCriterionDictionary",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingSystemCriterionDictionary_DictionaryId",
                table: "ReadingSystemCriterionDictionary",
                column: "DictionaryId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableAnswerRowInfo_CreateUserId",
                table: "ReadingTableAnswerRowInfo",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableAnswerRowInfo_InstanceId",
                table: "ReadingTableAnswerRowInfo",
                column: "InstanceId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableAnswerRowInfo_MergeRowId",
                table: "ReadingTableAnswerRowInfo",
                column: "MergeRowId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableAnswerRowInfo_OrganInfoId",
                table: "ReadingTableAnswerRowInfo",
                column: "OrganInfoId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableAnswerRowInfo_QuestionId",
                table: "ReadingTableAnswerRowInfo",
                column: "QuestionId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableAnswerRowInfo_SplitRowId",
                table: "ReadingTableAnswerRowInfo",
                column: "SplitRowId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableAnswerRowInfo_VisitTaskId",
                table: "ReadingTableAnswerRowInfo",
                column: "VisitTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableQuestionAnswer_CreateUserId",
                table: "ReadingTableQuestionAnswer",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableQuestionAnswer_QuestionId",
                table: "ReadingTableQuestionAnswer",
                column: "QuestionId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableQuestionAnswer_RowId",
                table: "ReadingTableQuestionAnswer",
                column: "RowId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableQuestionAnswer_TableQuestionId",
                table: "ReadingTableQuestionAnswer",
                column: "TableQuestionId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableQuestionAnswer_VisitTaskId",
                table: "ReadingTableQuestionAnswer",
                column: "VisitTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableQuestionSystem_CreateUserId",
                table: "ReadingTableQuestionSystem",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableQuestionSystem_DependParentId",
                table: "ReadingTableQuestionSystem",
                column: "DependParentId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableQuestionTrial_CreateUserId",
                table: "ReadingTableQuestionTrial",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableQuestionTrial_DependParentId",
                table: "ReadingTableQuestionTrial",
                column: "DependParentId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTableQuestionTrial_ReadingQuestionId",
                table: "ReadingTableQuestionTrial",
                column: "ReadingQuestionId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTaskQuestionAnswer_CreateUserId",
                table: "ReadingTaskQuestionAnswer",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTaskQuestionAnswer_ReadingQuestionTrialId",
                table: "ReadingTaskQuestionAnswer",
                column: "ReadingQuestionTrialId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTaskQuestionAnswer_SubjectId",
                table: "ReadingTaskQuestionAnswer",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTaskQuestionAnswer_VisitTaskId",
                table: "ReadingTaskQuestionAnswer",
                column: "VisitTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTaskQuestionMark_CreateUserId",
                table: "ReadingTaskQuestionMark",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTaskQuestionMark_QuestionId",
                table: "ReadingTaskQuestionMark",
                column: "QuestionId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTaskQuestionMark_VisitTaskId",
                table: "ReadingTaskQuestionMark",
                column: "VisitTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTaskRelation_CreateUserId",
                table: "ReadingTaskRelation",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTaskRelation_TaskId",
                table: "ReadingTaskRelation",
                column: "TaskId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTrialCriterionDictionary_CreateUserId",
                table: "ReadingTrialCriterionDictionary",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTrialCriterionDictionary_CriterionId",
                table: "ReadingTrialCriterionDictionary",
                column: "CriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadingTrialCriterionDictionary_DictionaryId",
                table: "ReadingTrialCriterionDictionary",
                column: "DictionaryId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadModule_CreateUserId",
                table: "ReadModule",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadModule_ReadingPeriodSetId",
                table: "ReadModule",
                column: "ReadingPeriodSetId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadModule_SubjectId",
                table: "ReadModule",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadModule_SubjectVisitId",
                table: "ReadModule",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadModule_TrialId",
                table: "ReadModule",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadModule_TrialReadingCriterionId",
                table: "ReadModule",
                column: "TrialReadingCriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadModuleCriterionFrom_ClinicalFormId",
                table: "ReadModuleCriterionFrom",
                column: "ClinicalFormId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadModuleCriterionFrom_CreateUserId",
                table: "ReadModuleCriterionFrom",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_ReadModuleCriterionFrom_ReadModuleId",
                table: "ReadModuleCriterionFrom",
                column: "ReadModuleId");

            migrationBuilder.CreateIndex(
                name: "IX_ResearchPublication_CreateUserId",
                table: "ResearchPublication",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPImageUpload_CreateUserId",
                table: "SCPImageUpload",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPImageUpload_TrialId",
                table: "SCPImageUpload",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPImageUpload_TrialSiteId",
                table: "SCPImageUpload",
                column: "TrialSiteId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPInstance_CreateUserId",
                table: "SCPInstance",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPInstance_SeriesId",
                table: "SCPInstance",
                column: "SeriesId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPInstance_StudyId",
                table: "SCPInstance",
                column: "StudyId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPPatient_CreateUserId",
                table: "SCPPatient",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPPatient_SubjectId",
                table: "SCPPatient",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPPatient_TrialId",
                table: "SCPPatient",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPPatient_TrialSiteId",
                table: "SCPPatient",
                column: "TrialSiteId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPSeries_CreateUserId",
                table: "SCPSeries",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPSeries_StudyId",
                table: "SCPSeries",
                column: "StudyId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPStudy_CreateUserId",
                table: "SCPStudy",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPStudy_PatientId",
                table: "SCPStudy",
                column: "PatientId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPStudy_SubjectVisitId",
                table: "SCPStudy",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPStudy_TrialId",
                table: "SCPStudy",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_SCPStudy_TrialSiteId",
                table: "SCPStudy",
                column: "TrialSiteId");

            migrationBuilder.CreateIndex(
                name: "IX_ShortcutKey_CreateUserId",
                table: "ShortcutKey",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Site_CreateUserId",
                table: "Site",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Site_HospitalId",
                table: "Site",
                column: "HospitalId");

            migrationBuilder.CreateIndex(
                name: "IX_Sponsor_CreateUserId",
                table: "Sponsor",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_StudyMonitor_CreateUserId",
                table: "StudyMonitor",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_StudyMonitor_StudyId",
                table: "StudyMonitor",
                column: "StudyId");

            migrationBuilder.CreateIndex(
                name: "IX_StudyMonitor_SubjectId",
                table: "StudyMonitor",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_StudyMonitor_SubjectVisitId",
                table: "StudyMonitor",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_StudyMonitor_TrialId",
                table: "StudyMonitor",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_Subject_CreateUserId",
                table: "Subject",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Subject_FinalSubjectVisitId",
                table: "Subject",
                column: "FinalSubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_Subject_LatestSubjectVisitId",
                table: "Subject",
                column: "LatestSubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_Subject_TrialId",
                table: "Subject",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_Subject_TrialSiteId",
                table: "Subject",
                column: "TrialSiteId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectAdditionalEvaluationResult_CreateUserId",
                table: "SubjectAdditionalEvaluationResult",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectAdditionalEvaluationResult_SubjectId",
                table: "SubjectAdditionalEvaluationResult",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectAdditionalEvaluationResult_TrialReadingQuestionId",
                table: "SubjectAdditionalEvaluationResult",
                column: "TrialReadingQuestionId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCanceDoctor_CreateUserId",
                table: "SubjectCanceDoctor",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCanceDoctor_SubjectId",
                table: "SubjectCanceDoctor",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCriteriaEvaluation_CreateUserId",
                table: "SubjectCriteriaEvaluation",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCriteriaEvaluation_SubjectId",
                table: "SubjectCriteriaEvaluation",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCriteriaEvaluation_TrialReadingCriterionId",
                table: "SubjectCriteriaEvaluation",
                column: "TrialReadingCriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCriteriaEvaluationVisitFilter_CreateUserId",
                table: "SubjectCriteriaEvaluationVisitFilter",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCriteriaEvaluationVisitFilter_SubjectId",
                table: "SubjectCriteriaEvaluationVisitFilter",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCriteriaEvaluationVisitFilter_SubjectVisitId",
                table: "SubjectCriteriaEvaluationVisitFilter",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCriteriaEvaluationVisitFilter_TrialReadingCriterionId",
                table: "SubjectCriteriaEvaluationVisitFilter",
                column: "TrialReadingCriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCriteriaEvaluationVisitStudyFilter_CreateUserId",
                table: "SubjectCriteriaEvaluationVisitStudyFilter",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCriteriaEvaluationVisitStudyFilter_SeriesId",
                table: "SubjectCriteriaEvaluationVisitStudyFilter",
                column: "SeriesId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCriteriaEvaluationVisitStudyFilter_StudyId",
                table: "SubjectCriteriaEvaluationVisitStudyFilter",
                column: "StudyId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCriteriaEvaluationVisitStudyFilter_SubjectVisitId",
                table: "SubjectCriteriaEvaluationVisitStudyFilter",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectCriteriaEvaluationVisitStudyFilter_TrialReadingCriterionId",
                table: "SubjectCriteriaEvaluationVisitStudyFilter",
                column: "TrialReadingCriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectUser_CreateUserId",
                table: "SubjectUser",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectUser_DoctorUserId",
                table: "SubjectUser",
                column: "DoctorUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectUser_ReplacedSubjectUserId",
                table: "SubjectUser",
                column: "ReplacedSubjectUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectUser_SubjectId",
                table: "SubjectUser",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectUser_TrialId",
                table: "SubjectUser",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectVisit_CreateUserId",
                table: "SubjectVisit",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectVisit_CurrentActionUserId",
                table: "SubjectVisit",
                column: "CurrentActionUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectVisit_ForwardUserId",
                table: "SubjectVisit",
                column: "ForwardUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectVisit_OutPlanPreviousVisitId",
                table: "SubjectVisit",
                column: "OutPlanPreviousVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectVisit_PreliminaryAuditUserId",
                table: "SubjectVisit",
                column: "PreliminaryAuditUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectVisit_ReviewAuditUserId",
                table: "SubjectVisit",
                column: "ReviewAuditUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectVisit_SubjectId",
                table: "SubjectVisit",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectVisit_SubmitUserId",
                table: "SubjectVisit",
                column: "SubmitUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectVisit_TrialId",
                table: "SubjectVisit",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_SubjectVisit_TrialSiteId",
                table: "SubjectVisit",
                column: "TrialSiteId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemAnonymization_CreateUserId",
                table: "SystemAnonymization",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemBasicData_CreateUserId",
                table: "SystemBasicData",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemBasicData_ParentId",
                table: "SystemBasicData",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemClinicalQuestion_CreateUserId",
                table: "SystemClinicalQuestion",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemClinicalQuestion_GroupId",
                table: "SystemClinicalQuestion",
                column: "GroupId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemClinicalTableQuestion_CreateUserId",
                table: "SystemClinicalTableQuestion",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemCriterionDictionaryCode_CreateUserId",
                table: "SystemCriterionDictionaryCode",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemDocConfirmedUser_ConfirmUserId",
                table: "SystemDocConfirmedUser",
                column: "ConfirmUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemDocConfirmedUser_CreateUserId",
                table: "SystemDocConfirmedUser",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemDocConfirmedUser_SystemDocumentId",
                table: "SystemDocConfirmedUser",
                column: "SystemDocumentId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemDocNeedConfirmedUserType_NeedConfirmUserTypeId",
                table: "SystemDocNeedConfirmedUserType",
                column: "NeedConfirmUserTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemDocNeedConfirmedUserType_SystemDocumentId",
                table: "SystemDocNeedConfirmedUserType",
                column: "SystemDocumentId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemDocument_CreateUserId",
                table: "SystemDocument",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemDocument_FileTypeId",
                table: "SystemDocument",
                column: "FileTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemNotice_CreateUserId",
                table: "SystemNotice",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemNotice_PublishedUserId",
                table: "SystemNotice",
                column: "PublishedUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemNoticeUserRead_CreateUserId",
                table: "SystemNoticeUserRead",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemNoticeUserRead_SystemNoticeId",
                table: "SystemNoticeUserRead",
                column: "SystemNoticeId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemNoticeUserType_CreateUserId",
                table: "SystemNoticeUserType",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemNoticeUserType_SystemNoticeId",
                table: "SystemNoticeUserType",
                column: "SystemNoticeId");

            migrationBuilder.CreateIndex(
                name: "IX_SystemNoticeUserType_UserTypeId",
                table: "SystemNoticeUserType",
                column: "UserTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskAllocationRule_CreateUserId",
                table: "TaskAllocationRule",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskAllocationRule_DoctorUserId",
                table: "TaskAllocationRule",
                column: "DoctorUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskAllocationRule_EnrollId",
                table: "TaskAllocationRule",
                column: "EnrollId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskAllocationRule_TrialId",
                table: "TaskAllocationRule",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskConsistentRule_CreateUserId",
                table: "TaskConsistentRule",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskConsistentRule_TrialId",
                table: "TaskConsistentRule",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskConsistentRule_TrialReadingCriterionId",
                table: "TaskConsistentRule",
                column: "TrialReadingCriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskInfluence_CreateUserId",
                table: "TaskInfluence",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskInfluence_InfluenceTaskId",
                table: "TaskInfluence",
                column: "InfluenceTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskInfluence_OriginalTaskId",
                table: "TaskInfluence",
                column: "OriginalTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskInstance_CreateUserId",
                table: "TaskInstance",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskInstance_SeriesId",
                table: "TaskInstance",
                column: "SeriesId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskInstance_StudyId",
                table: "TaskInstance",
                column: "StudyId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskMedicalReview_CreateUserId",
                table: "TaskMedicalReview",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskMedicalReview_LatestReplyUserId",
                table: "TaskMedicalReview",
                column: "LatestReplyUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskMedicalReview_MedicalManagerUserId",
                table: "TaskMedicalReview",
                column: "MedicalManagerUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskMedicalReview_TrialId",
                table: "TaskMedicalReview",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskMedicalReview_VisitTaskId",
                table: "TaskMedicalReview",
                column: "VisitTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskMedicalReviewRule_CreateUserId",
                table: "TaskMedicalReviewRule",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskMedicalReviewRule_DoctorUserId",
                table: "TaskMedicalReviewRule",
                column: "DoctorUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskSeries_CreateUserId",
                table: "TaskSeries",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskSeries_StudyId",
                table: "TaskSeries",
                column: "StudyId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskStudy_CreateUserId",
                table: "TaskStudy",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskStudy_SubjectId",
                table: "TaskStudy",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskStudy_VisitTaskId",
                table: "TaskStudy",
                column: "VisitTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_Trial_CreateUserId",
                table: "Trial",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Trial_CROId",
                table: "Trial",
                column: "CROId");

            migrationBuilder.CreateIndex(
                name: "IX_Trial_IndicationTypeId",
                table: "Trial",
                column: "IndicationTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_Trial_PhaseId",
                table: "Trial",
                column: "PhaseId");

            migrationBuilder.CreateIndex(
                name: "IX_Trial_QCQuestionConfirmedUserId",
                table: "Trial",
                column: "QCQuestionConfirmedUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Trial_ReviewModeId",
                table: "Trial",
                column: "ReviewModeId");

            migrationBuilder.CreateIndex(
                name: "IX_Trial_SponsorId",
                table: "Trial",
                column: "SponsorId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialBodyPart_CreateUserId",
                table: "TrialBodyPart",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialBodyPart_TrialId",
                table: "TrialBodyPart",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialClinicalDataSetCriterion_CreateUserId",
                table: "TrialClinicalDataSetCriterion",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialClinicalDataSetCriterion_TrialClinicalDataSetId",
                table: "TrialClinicalDataSetCriterion",
                column: "TrialClinicalDataSetId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialClinicalDataSetCriterion_TrialReadingCriterionId",
                table: "TrialClinicalDataSetCriterion",
                column: "TrialReadingCriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialClinicalQuestion_CreateUserId",
                table: "TrialClinicalQuestion",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialClinicalQuestion_GroupId",
                table: "TrialClinicalQuestion",
                column: "GroupId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialClinicalQuestion_TrialClinicalId",
                table: "TrialClinicalQuestion",
                column: "TrialClinicalId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialClinicalTableQuestion_CreateUserId",
                table: "TrialClinicalTableQuestion",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialCriterionAdditionalAssessmentType_CreateUserId",
                table: "TrialCriterionAdditionalAssessmentType",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialCriterionAdditionalAssessmentType_TrialReadingCriterionId",
                table: "TrialCriterionAdditionalAssessmentType",
                column: "TrialReadingCriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialCriterionDictionaryCode_CreateUserId",
                table: "TrialCriterionDictionaryCode",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialCriterionDictionaryCode_TrialCriterionId",
                table: "TrialCriterionDictionaryCode",
                column: "TrialCriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialDicomAE_CreateUserId",
                table: "TrialDicomAE",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialDictionary_DictionaryId",
                table: "TrialDictionary",
                column: "DictionaryId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialDictionary_TrialId",
                table: "TrialDictionary",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialDocConfirmedUser_ConfirmUserId",
                table: "TrialDocConfirmedUser",
                column: "ConfirmUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialDocConfirmedUser_CreateUserId",
                table: "TrialDocConfirmedUser",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialDocConfirmedUser_TrialDocumentId",
                table: "TrialDocConfirmedUser",
                column: "TrialDocumentId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialDocNeedConfirmedUserType_NeedConfirmUserTypeId",
                table: "TrialDocNeedConfirmedUserType",
                column: "NeedConfirmUserTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialDocNeedConfirmedUserType_TrialDocumentId",
                table: "TrialDocNeedConfirmedUserType",
                column: "TrialDocumentId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialDocument_CreateUserId",
                table: "TrialDocument",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialDocument_FileTypeId",
                table: "TrialDocument",
                column: "FileTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialDocument_TrialId",
                table: "TrialDocument",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialEmailBlackUser_TrialEmailNoticeConfigId",
                table: "TrialEmailBlackUser",
                column: "TrialEmailNoticeConfigId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialEmailBlackUser_UserId",
                table: "TrialEmailBlackUser",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialEmailNoticeConfig_CreateUserId",
                table: "TrialEmailNoticeConfig",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialEmailNoticeConfig_SysEmailNoticeConfigId",
                table: "TrialEmailNoticeConfig",
                column: "SysEmailNoticeConfigId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialEmailNoticeConfig_TrialId",
                table: "TrialEmailNoticeConfig",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialEmailNoticeConfig_TrialReadingCriterionId",
                table: "TrialEmailNoticeConfig",
                column: "TrialReadingCriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialEmailNoticeUser_TrialEmailNoticeConfigId",
                table: "TrialEmailNoticeUser",
                column: "TrialEmailNoticeConfigId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialExperience_CreateUserId",
                table: "TrialExperience",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialExperience_PhaseId",
                table: "TrialExperience",
                column: "PhaseId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialExperienceCriteria_DoctorId",
                table: "TrialExperienceCriteria",
                column: "DoctorId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialExperienceCriteria_EvaluationCriteriaId",
                table: "TrialExperienceCriteria",
                column: "EvaluationCriteriaId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialExperienceCriteria_TrialExperienceId",
                table: "TrialExperienceCriteria",
                column: "TrialExperienceId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialExternalUser_CreateUserId",
                table: "TrialExternalUser",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialExternalUser_TrialId",
                table: "TrialExternalUser",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialImageDownload_CreateUserId",
                table: "TrialImageDownload",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialImageDownload_TrialId",
                table: "TrialImageDownload",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialPaymentPrice_CreateUserId",
                table: "TrialPaymentPrice",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialPaymentPrice_TrialId",
                table: "TrialPaymentPrice",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialQCQuestion_CreateUserId",
                table: "TrialQCQuestion",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialQCQuestion_ParentId",
                table: "TrialQCQuestion",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialQCQuestion_TrialId",
                table: "TrialQCQuestion",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialQCQuestionAnswer_CreateUserId",
                table: "TrialQCQuestionAnswer",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialQCQuestionAnswer_TrialQCQuestionConfigureId",
                table: "TrialQCQuestionAnswer",
                column: "TrialQCQuestionConfigureId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialRevenuesPrice_CreateUserId",
                table: "TrialRevenuesPrice",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSign_CreateUserId",
                table: "TrialSign",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSite_CreateUserId",
                table: "TrialSite",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSite_SiteId",
                table: "TrialSite",
                column: "SiteId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSite_TrialId",
                table: "TrialSite",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteDicomAE_CreateUserId",
                table: "TrialSiteDicomAE",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteDicomAE_TrialSiteId",
                table: "TrialSiteDicomAE",
                column: "TrialSiteId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteEquipmentSurvey_CreateUserId",
                table: "TrialSiteEquipmentSurvey",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteEquipmentSurvey_EquipmentTypeId",
                table: "TrialSiteEquipmentSurvey",
                column: "EquipmentTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteEquipmentSurvey_TrialSiteSurveyId",
                table: "TrialSiteEquipmentSurvey",
                column: "TrialSiteSurveyId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteSurvey_CreateUserId",
                table: "TrialSiteSurvey",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteSurvey_PreliminaryUserId",
                table: "TrialSiteSurvey",
                column: "PreliminaryUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteSurvey_ReviewerUserId",
                table: "TrialSiteSurvey",
                column: "ReviewerUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteSurvey_TrialId",
                table: "TrialSiteSurvey",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteSurvey_TrialSiteId",
                table: "TrialSiteSurvey",
                column: "TrialSiteId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteUser_CreateUserId",
                table: "TrialSiteUser",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteUser_TrialId",
                table: "TrialSiteUser",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteUser_TrialSiteId",
                table: "TrialSiteUser",
                column: "TrialSiteId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteUser_UserId",
                table: "TrialSiteUser",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteUserSurvey_CreateUserId",
                table: "TrialSiteUserSurvey",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteUserSurvey_TrialSiteSurveyId",
                table: "TrialSiteUserSurvey",
                column: "TrialSiteSurveyId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialSiteUserSurvey_UserTypeId",
                table: "TrialSiteUserSurvey",
                column: "UserTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialStateChange_CreateUserId",
                table: "TrialStateChange",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialStateChange_TrialId",
                table: "TrialStateChange",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialStatus_CreateUserId",
                table: "TrialStatus",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialStatus_TrialId",
                table: "TrialStatus",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialUser_CreateUserId",
                table: "TrialUser",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialUser_TrialId",
                table: "TrialUser",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialUser_UserId",
                table: "TrialUser",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_TrialVirtualSiteCodeUpdate_CreateUserId",
                table: "TrialVirtualSiteCodeUpdate",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_User_CreateUserId",
                table: "User",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_User_DoctorId",
                table: "User",
                column: "DoctorId",
                unique: true,
                filter: "[DoctorId] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_User_UserTypeId",
                table: "User",
                column: "UserTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_UserFeedBack_CreateUserId",
                table: "UserFeedBack",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_UserFeedBack_SubjectId",
                table: "UserFeedBack",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_UserFeedBack_SubjectVisitId",
                table: "UserFeedBack",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_UserFeedBack_TrialId",
                table: "UserFeedBack",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_UserFeedBack_TrialSiteId",
                table: "UserFeedBack",
                column: "TrialSiteId");

            migrationBuilder.CreateIndex(
                name: "IX_UserFeedBack_VisitTaskId",
                table: "UserFeedBack",
                column: "VisitTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_UserLog_CreateUserId",
                table: "UserLog",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_UserLog_LoginUserId",
                table: "UserLog",
                column: "LoginUserId");

            migrationBuilder.CreateIndex(
                name: "IX_UserLog_OptUserId",
                table: "UserLog",
                column: "OptUserId");

            migrationBuilder.CreateIndex(
                name: "IX_UserPassWordLog_CreateUserId",
                table: "UserPassWordLog",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_UserTypeGroup_DictionaryId",
                table: "UserTypeGroup",
                column: "DictionaryId");

            migrationBuilder.CreateIndex(
                name: "IX_UserTypeGroup_UserTypeId",
                table: "UserTypeGroup",
                column: "UserTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_UserTypeMenu_MenuId",
                table: "UserTypeMenu",
                column: "MenuId");

            migrationBuilder.CreateIndex(
                name: "IX_UserTypeMenu_UserTypeId",
                table: "UserTypeMenu",
                column: "UserTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_UserWLTemplate_CreateUserId",
                table: "UserWLTemplate",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_Vacation_CreateUserId",
                table: "Vacation",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_VerificationCode_CreateUserId",
                table: "VerificationCode",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitPlanInfluenceStat_CreateUserId",
                table: "VisitPlanInfluenceStat",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitPlanInfluenceStudy_CreateUserId",
                table: "VisitPlanInfluenceStudy",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitPlanInfluenceStudy_SubjectVisitId",
                table: "VisitPlanInfluenceStudy",
                column: "SubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitPlanInfluenceStudy_VisitPlanInfluenceStatId",
                table: "VisitPlanInfluenceStudy",
                column: "VisitPlanInfluenceStatId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitStage_CreateUserId",
                table: "VisitStage",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitStage_TrialId",
                table: "VisitStage",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTask_CreateUserId",
                table: "VisitTask",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTask_DoctorUserId",
                table: "VisitTask",
                column: "DoctorUserId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTask_JudgeResultTaskId",
                table: "VisitTask",
                column: "JudgeResultTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTask_JudgeVisitTaskId",
                table: "VisitTask",
                column: "JudgeVisitTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTask_SouceReadModuleId",
                table: "VisitTask",
                column: "SouceReadModuleId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTask_SourceSubjectVisitId",
                table: "VisitTask",
                column: "SourceSubjectVisitId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTask_SubjectId",
                table: "VisitTask",
                column: "SubjectId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTask_TrialId",
                table: "VisitTask",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTask_TrialReadingCriterionId",
                table: "VisitTask",
                column: "TrialReadingCriterionId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTaskReReading_CreateUserId",
                table: "VisitTaskReReading",
                column: "CreateUserId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTaskReReading_NewReReadingTaskId",
                table: "VisitTaskReReading",
                column: "NewReReadingTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTaskReReading_OriginalReReadingTaskId",
                table: "VisitTaskReReading",
                column: "OriginalReReadingTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTaskReReading_RequestReReadingConfirmUserId",
                table: "VisitTaskReReading",
                column: "RequestReReadingConfirmUserId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTaskReReading_RequestReReadingUserId",
                table: "VisitTaskReReading",
                column: "RequestReReadingUserId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTaskReReading_RootReReadingTaskId",
                table: "VisitTaskReReading",
                column: "RootReReadingTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_VisitTaskReReading_TrialId",
                table: "VisitTaskReReading",
                column: "TrialId");

            migrationBuilder.CreateIndex(
                name: "IX_VolumeReward_CreateUserId",
                table: "VolumeReward",
                column: "CreateUserId");

            migrationBuilder.AddForeignKey(
                name: "FK_Attachment_Doctor_DoctorId",
                table: "Attachment",
                column: "DoctorId",
                principalTable: "Doctor",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Attachment_User_CreateUserId",
                table: "Attachment",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_CheckChallengeDialog_SubjectVisit_SubjectVisitId",
                table: "CheckChallengeDialog",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_CheckChallengeDialog_User_CreateUserId",
                table: "CheckChallengeDialog",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ClinicalAnswerRowInfo_User_CreateUserId",
                table: "ClinicalAnswerRowInfo",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ClinicalDataSystemSet_User_CreateUserId",
                table: "ClinicalDataSystemSet",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ClinicalDataTrialSet_Trial_TrialId",
                table: "ClinicalDataTrialSet",
                column: "TrialId",
                principalTable: "Trial",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ClinicalDataTrialSet_User_CreateUserId",
                table: "ClinicalDataTrialSet",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ClinicalForm_Subject_SubjectId",
                table: "ClinicalForm",
                column: "SubjectId",
                principalTable: "Subject",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ClinicalForm_User_CreateUserId",
                table: "ClinicalForm",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ClinicalQuestionAnswer_User_CreateUserId",
                table: "ClinicalQuestionAnswer",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ClinicalTableAnswer_User_CreateUserId",
                table: "ClinicalTableAnswer",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_CommonDocument_User_CreateUserId",
                table: "CommonDocument",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_CriterionNidusSystem_ReadingQuestionCriterionTrial_CriterionId",
                table: "CriterionNidusSystem",
                column: "CriterionId",
                principalTable: "ReadingQuestionCriterionTrial",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_CriterionNidusSystem_User_CreateUserId",
                table: "CriterionNidusSystem",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_CriterionNidusTrial_User_CreateUserId",
                table: "CriterionNidusTrial",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_CROCompany_User_CreateUserId",
                table: "CROCompany",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_DataInspection_ReadingQuestionCriterionTrial_TrialReadingCriterionId",
                table: "DataInspection",
                column: "TrialReadingCriterionId",
                principalTable: "ReadingQuestionCriterionTrial",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_DataInspection_User_CreateUserId",
                table: "DataInspection",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_DataInspection_VisitTask_VisitTaskId",
                table: "DataInspection",
                column: "VisitTaskId",
                principalTable: "VisitTask",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_DicomInstance_DicomSeries_SeriesId",
                table: "DicomInstance",
                column: "SeriesId",
                principalTable: "DicomSeries",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_DicomInstance_DicomStudy_StudyId",
                table: "DicomInstance",
                column: "StudyId",
                principalTable: "DicomStudy",
                principalColumn: "SeqId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_DicomInstance_User_CreateUserId",
                table: "DicomInstance",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_DicomSeries_DicomStudy_StudyId",
                table: "DicomSeries",
                column: "StudyId",
                principalTable: "DicomStudy",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_DicomSeries_User_CreateUserId",
                table: "DicomSeries",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_DicomStudy_SubjectVisit_SubjectVisitId",
                table: "DicomStudy",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_DicomStudy_Subject_SubjectId",
                table: "DicomStudy",
                column: "SubjectId",
                principalTable: "Subject",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_DicomStudy_Trial_TrialId",
                table: "DicomStudy",
                column: "TrialId",
                principalTable: "Trial",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_DicomStudy_User_CreateUserId",
                table: "DicomStudy",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Dictionary_User_CreateUserId",
                table: "Dictionary",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Doctor_Hospital_HospitalId",
                table: "Doctor",
                column: "HospitalId",
                principalTable: "Hospital",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Doctor_User_CreateUserId",
                table: "Doctor",
                column: "CreateUserId",
                principalTable: "User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Hospital_Site_SiteId",
                table: "Hospital",
                column: "SiteId",
                principalTable: "Site",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_NoneDicomStudy_SubjectVisit_SubjectVisitId",
                table: "NoneDicomStudy",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_NoneDicomStudy_Subject_SubjectId",
                table: "NoneDicomStudy",
                column: "SubjectId",
                principalTable: "Subject",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_NoneDicomStudyFile_VisitTask_VisitTaskId",
                table: "NoneDicomStudyFile",
                column: "VisitTaskId",
                principalTable: "VisitTask",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_PreviousHistory_SubjectVisit_SubjectVisitId",
                table: "PreviousHistory",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_PreviousOther_SubjectVisit_SubjectVisitId",
                table: "PreviousOther",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_PreviousPDF_SubjectVisit_SubjectVisitId",
                table: "PreviousPDF",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_PreviousSurgery_SubjectVisit_SubjectVisitId",
                table: "PreviousSurgery",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_QCChallenge_SubjectVisit_SubjectVisitId",
                table: "QCChallenge",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_QCChallengeDialog_SubjectVisit_SubjectVisitId",
                table: "QCChallengeDialog",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingClinicalData_ReadModule_ReadingId",
                table: "ReadingClinicalData",
                column: "ReadingId",
                principalTable: "ReadModule",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingClinicalData_SubjectVisit_ReadingId",
                table: "ReadingClinicalData",
                column: "ReadingId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingClinicalData_Subject_SubjectId",
                table: "ReadingClinicalData",
                column: "SubjectId",
                principalTable: "Subject",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingConsistentClinicalData_ReadModule_ReadingId",
                table: "ReadingConsistentClinicalData",
                column: "ReadingId",
                principalTable: "ReadModule",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingConsistentClinicalData_SubjectVisit_ReadingId",
                table: "ReadingConsistentClinicalData",
                column: "ReadingId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingConsistentClinicalData_Subject_SubjectId",
                table: "ReadingConsistentClinicalData",
                column: "SubjectId",
                principalTable: "Subject",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingGlobalTaskInfo_VisitTask_GlobalTaskId",
                table: "ReadingGlobalTaskInfo",
                column: "GlobalTaskId",
                principalTable: "VisitTask",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingGlobalTaskInfo_VisitTask_TaskId",
                table: "ReadingGlobalTaskInfo",
                column: "TaskId",
                principalTable: "VisitTask",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingMedicalReviewDialog_TaskMedicalReview_TaskMedicalReviewId",
                table: "ReadingMedicalReviewDialog",
                column: "TaskMedicalReviewId",
                principalTable: "TaskMedicalReview",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingMedicineQuestionAnswer_TaskMedicalReview_TaskMedicalReviewId",
                table: "ReadingMedicineQuestionAnswer",
                column: "TaskMedicalReviewId",
                principalTable: "TaskMedicalReview",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingOncologyTaskInfo_VisitTask_OncologyTaskId",
                table: "ReadingOncologyTaskInfo",
                column: "OncologyTaskId",
                principalTable: "VisitTask",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingOncologyTaskInfo_VisitTask_VisitTaskId",
                table: "ReadingOncologyTaskInfo",
                column: "VisitTaskId",
                principalTable: "VisitTask",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingPeriodPlan_SubjectVisit_SubjectVisitId",
                table: "ReadingPeriodPlan",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingTableAnswerRowInfo_VisitTask_VisitTaskId",
                table: "ReadingTableAnswerRowInfo",
                column: "VisitTaskId",
                principalTable: "VisitTask",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingTableQuestionAnswer_VisitTask_VisitTaskId",
                table: "ReadingTableQuestionAnswer",
                column: "VisitTaskId",
                principalTable: "VisitTask",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingTaskQuestionAnswer_Subject_SubjectId",
                table: "ReadingTaskQuestionAnswer",
                column: "SubjectId",
                principalTable: "Subject",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingTaskQuestionAnswer_VisitTask_VisitTaskId",
                table: "ReadingTaskQuestionAnswer",
                column: "VisitTaskId",
                principalTable: "VisitTask",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingTaskQuestionMark_VisitTask_VisitTaskId",
                table: "ReadingTaskQuestionMark",
                column: "VisitTaskId",
                principalTable: "VisitTask",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingTaskRelation_VisitTask_TaskId",
                table: "ReadingTaskRelation",
                column: "TaskId",
                principalTable: "VisitTask",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadModule_SubjectVisit_SubjectVisitId",
                table: "ReadModule",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ReadModule_Subject_SubjectId",
                table: "ReadModule",
                column: "SubjectId",
                principalTable: "Subject",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SCPInstance_SCPSeries_SeriesId",
                table: "SCPInstance",
                column: "SeriesId",
                principalTable: "SCPSeries",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SCPInstance_SCPStudy_StudyId",
                table: "SCPInstance",
                column: "StudyId",
                principalTable: "SCPStudy",
                principalColumn: "SeqId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SCPPatient_Subject_SubjectId",
                table: "SCPPatient",
                column: "SubjectId",
                principalTable: "Subject",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_SCPSeries_SCPStudy_StudyId",
                table: "SCPSeries",
                column: "StudyId",
                principalTable: "SCPStudy",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SCPStudy_SubjectVisit_SubjectVisitId",
                table: "SCPStudy",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_StudyMonitor_SubjectVisit_SubjectVisitId",
                table: "StudyMonitor",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_StudyMonitor_Subject_SubjectId",
                table: "StudyMonitor",
                column: "SubjectId",
                principalTable: "Subject",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_StudyMonitor_TaskStudy_StudyId",
                table: "StudyMonitor",
                column: "StudyId",
                principalTable: "TaskStudy",
                principalColumn: "SeqId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Subject_SubjectVisit_FinalSubjectVisitId",
                table: "Subject",
                column: "FinalSubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Subject_SubjectVisit_LatestSubjectVisitId",
                table: "Subject",
                column: "LatestSubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_User_Doctor_DoctorId",
                table: "User");

            migrationBuilder.DropForeignKey(
                name: "FK_CROCompany_User_CreateUserId",
                table: "CROCompany");

            migrationBuilder.DropForeignKey(
                name: "FK_Dictionary_User_CreateUserId",
                table: "Dictionary");

            migrationBuilder.DropForeignKey(
                name: "FK_Hospital_User_CreateUserId",
                table: "Hospital");

            migrationBuilder.DropForeignKey(
                name: "FK_Site_User_CreateUserId",
                table: "Site");

            migrationBuilder.DropForeignKey(
                name: "FK_Sponsor_User_CreateUserId",
                table: "Sponsor");

            migrationBuilder.DropForeignKey(
                name: "FK_Subject_User_CreateUserId",
                table: "Subject");

            migrationBuilder.DropForeignKey(
                name: "FK_SubjectVisit_User_CreateUserId",
                table: "SubjectVisit");

            migrationBuilder.DropForeignKey(
                name: "FK_SubjectVisit_User_CurrentActionUserId",
                table: "SubjectVisit");

            migrationBuilder.DropForeignKey(
                name: "FK_SubjectVisit_User_ForwardUserId",
                table: "SubjectVisit");

            migrationBuilder.DropForeignKey(
                name: "FK_SubjectVisit_User_PreliminaryAuditUserId",
                table: "SubjectVisit");

            migrationBuilder.DropForeignKey(
                name: "FK_SubjectVisit_User_ReviewAuditUserId",
                table: "SubjectVisit");

            migrationBuilder.DropForeignKey(
                name: "FK_SubjectVisit_User_SubmitUserId",
                table: "SubjectVisit");

            migrationBuilder.DropForeignKey(
                name: "FK_Trial_User_CreateUserId",
                table: "Trial");

            migrationBuilder.DropForeignKey(
                name: "FK_Trial_User_QCQuestionConfirmedUserId",
                table: "Trial");

            migrationBuilder.DropForeignKey(
                name: "FK_TrialSite_User_CreateUserId",
                table: "TrialSite");

            migrationBuilder.DropForeignKey(
                name: "FK_Subject_SubjectVisit_FinalSubjectVisitId",
                table: "Subject");

            migrationBuilder.DropForeignKey(
                name: "FK_Subject_SubjectVisit_LatestSubjectVisitId",
                table: "Subject");

            migrationBuilder.DropForeignKey(
                name: "FK_Site_Hospital_HospitalId",
                table: "Site");

            migrationBuilder.DropTable(
                name: "Attachment");

            migrationBuilder.DropTable(
                name: "CheckChallengeDialog");

            migrationBuilder.DropTable(
                name: "ClinicalQuestionAnswer");

            migrationBuilder.DropTable(
                name: "ClinicalTableAnswer");

            migrationBuilder.DropTable(
                name: "CommonDocument");

            migrationBuilder.DropTable(
                name: "CriterionNidusSystem");

            migrationBuilder.DropTable(
                name: "CriterionNidusTrial");

            migrationBuilder.DropTable(
                name: "DataInspection");

            migrationBuilder.DropTable(
                name: "DoctorCriterionFile");

            migrationBuilder.DropTable(
                name: "DoctorDictionary");

            migrationBuilder.DropTable(
                name: "DoctorPayInformation");

            migrationBuilder.DropTable(
                name: "DoctorWorkload");

            migrationBuilder.DropTable(
                name: "Education");

            migrationBuilder.DropTable(
                name: "EmailNoticeUserType");

            migrationBuilder.DropTable(
                name: "EnrollDetail");

            migrationBuilder.DropTable(
                name: "EnrollReadingCategory");

            migrationBuilder.DropTable(
                name: "EnrollReadingCriterion");

            migrationBuilder.DropTable(
                name: "ExchangeRate");

            migrationBuilder.DropTable(
                name: "ExploreRecommend");

            migrationBuilder.DropTable(
                name: "FrontAuditConfig");

            migrationBuilder.DropTable(
                name: "ImageShare");

            migrationBuilder.DropTable(
                name: "InspectionFile");

            migrationBuilder.DropTable(
                name: "Internationalization");

            migrationBuilder.DropTable(
                name: "NoneDicomStudyFile");

            migrationBuilder.DropTable(
                name: "OrganTrialInfo");

            migrationBuilder.DropTable(
                name: "Payment");

            migrationBuilder.DropTable(
                name: "PaymentAdjustment");

            migrationBuilder.DropTable(
                name: "PaymentDetail");

            migrationBuilder.DropTable(
                name: "Postgraduate");

            migrationBuilder.DropTable(
                name: "PreviousHistory");

            migrationBuilder.DropTable(
                name: "PreviousOther");

            migrationBuilder.DropTable(
                name: "PreviousPDF");

            migrationBuilder.DropTable(
                name: "PreviousSurgery");

            migrationBuilder.DropTable(
                name: "QCChallengeDialog");

            migrationBuilder.DropTable(
                name: "QCQuestion");

            migrationBuilder.DropTable(
                name: "RankPrice");

            migrationBuilder.DropTable(
                name: "ReadingClinicalDataPDF");

            migrationBuilder.DropTable(
                name: "ReadingConsistentClinicalDataPDF");

            migrationBuilder.DropTable(
                name: "ReadingCustomTag");

            migrationBuilder.DropTable(
                name: "ReadingGlobalTaskInfo");

            migrationBuilder.DropTable(
                name: "ReadingJudgeInfo");

            migrationBuilder.DropTable(
                name: "ReadingMedicalReviewDialog");

            migrationBuilder.DropTable(
                name: "ReadingMedicineQuestionAnswer");

            migrationBuilder.DropTable(
                name: "ReadingMedicineSystemQuestion");

            migrationBuilder.DropTable(
                name: "ReadingMedicineTrialQuestion");

            migrationBuilder.DropTable(
                name: "ReadingOncologyTaskInfo");

            migrationBuilder.DropTable(
                name: "ReadingPeriodPlan");

            migrationBuilder.DropTable(
                name: "ReadingPeriodSite");

            migrationBuilder.DropTable(
                name: "ReadingQuestionSystem");

            migrationBuilder.DropTable(
                name: "ReadingSystemCriterionDictionary");

            migrationBuilder.DropTable(
                name: "ReadingTableQuestionAnswer");

            migrationBuilder.DropTable(
                name: "ReadingTableQuestionSystem");

            migrationBuilder.DropTable(
                name: "ReadingTaskQuestionAnswer");

            migrationBuilder.DropTable(
                name: "ReadingTaskQuestionMark");

            migrationBuilder.DropTable(
                name: "ReadingTaskRelation");

            migrationBuilder.DropTable(
                name: "ReadingTrialCriterionDictionary");

            migrationBuilder.DropTable(
                name: "ReadModuleCriterionFrom");

            migrationBuilder.DropTable(
                name: "ResearchPublication");

            migrationBuilder.DropTable(
                name: "SCPImageUpload");

            migrationBuilder.DropTable(
                name: "SCPInstance");

            migrationBuilder.DropTable(
                name: "ShortcutKey");

            migrationBuilder.DropTable(
                name: "StudyMonitor");

            migrationBuilder.DropTable(
                name: "SubjectAdditionalEvaluationResult");

            migrationBuilder.DropTable(
                name: "SubjectCanceDoctor");

            migrationBuilder.DropTable(
                name: "SubjectCriteriaEvaluation");

            migrationBuilder.DropTable(
                name: "SubjectCriteriaEvaluationVisitFilter");

            migrationBuilder.DropTable(
                name: "SubjectCriteriaEvaluationVisitStudyFilter");

            migrationBuilder.DropTable(
                name: "SubjectUser");

            migrationBuilder.DropTable(
                name: "SystemAnonymization");

            migrationBuilder.DropTable(
                name: "SystemBasicData");

            migrationBuilder.DropTable(
                name: "SystemClinicalQuestion");

            migrationBuilder.DropTable(
                name: "SystemClinicalTableQuestion");

            migrationBuilder.DropTable(
                name: "SystemCriterionDictionaryCode");

            migrationBuilder.DropTable(
                name: "SystemDocConfirmedUser");

            migrationBuilder.DropTable(
                name: "SystemDocNeedConfirmedUserType");

            migrationBuilder.DropTable(
                name: "SystemNoticeUserRead");

            migrationBuilder.DropTable(
                name: "SystemNoticeUserType");

            migrationBuilder.DropTable(
                name: "TaskAllocationRule");

            migrationBuilder.DropTable(
                name: "TaskConsistentRule");

            migrationBuilder.DropTable(
                name: "TaskInfluence");

            migrationBuilder.DropTable(
                name: "TaskInstance");

            migrationBuilder.DropTable(
                name: "TaskMedicalReviewRule");

            migrationBuilder.DropTable(
                name: "TestLength");

            migrationBuilder.DropTable(
                name: "TrialBodyPart");

            migrationBuilder.DropTable(
                name: "TrialClinicalDataSetCriterion");

            migrationBuilder.DropTable(
                name: "TrialClinicalQuestion");

            migrationBuilder.DropTable(
                name: "TrialClinicalTableQuestion");

            migrationBuilder.DropTable(
                name: "TrialCriterionAdditionalAssessmentType");

            migrationBuilder.DropTable(
                name: "TrialCriterionDictionaryCode");

            migrationBuilder.DropTable(
                name: "TrialDicomAE");

            migrationBuilder.DropTable(
                name: "TrialDictionary");

            migrationBuilder.DropTable(
                name: "TrialDocConfirmedUser");

            migrationBuilder.DropTable(
                name: "TrialDocNeedConfirmedUserType");

            migrationBuilder.DropTable(
                name: "TrialEmailBlackUser");

            migrationBuilder.DropTable(
                name: "TrialEmailNoticeUser");

            migrationBuilder.DropTable(
                name: "TrialExperienceCriteria");

            migrationBuilder.DropTable(
                name: "TrialExternalUser");

            migrationBuilder.DropTable(
                name: "TrialImageDownload");

            migrationBuilder.DropTable(
                name: "TrialPaymentPrice");

            migrationBuilder.DropTable(
                name: "TrialQCQuestionAnswer");

            migrationBuilder.DropTable(
                name: "TrialRevenuesPrice");

            migrationBuilder.DropTable(
                name: "TrialRevenuesPriceVerification");

            migrationBuilder.DropTable(
                name: "TrialSign");

            migrationBuilder.DropTable(
                name: "TrialSiteDicomAE");

            migrationBuilder.DropTable(
                name: "TrialSiteEquipmentSurvey");

            migrationBuilder.DropTable(
                name: "TrialSiteUser");

            migrationBuilder.DropTable(
                name: "TrialSiteUserSurvey");

            migrationBuilder.DropTable(
                name: "TrialStateChange");

            migrationBuilder.DropTable(
                name: "TrialUser");

            migrationBuilder.DropTable(
                name: "TrialVirtualSiteCodeUpdate");

            migrationBuilder.DropTable(
                name: "TumorAssessment_IRECIST1Point1");

            migrationBuilder.DropTable(
                name: "TumorAssessment_RECIST1Point1");

            migrationBuilder.DropTable(
                name: "TumorAssessment_RECIST1Point1BM");

            migrationBuilder.DropTable(
                name: "UserFeedBack");

            migrationBuilder.DropTable(
                name: "UserLog");

            migrationBuilder.DropTable(
                name: "UserPassWordLog");

            migrationBuilder.DropTable(
                name: "UserTypeGroup");

            migrationBuilder.DropTable(
                name: "UserTypeMenu");

            migrationBuilder.DropTable(
                name: "UserWLTemplate");

            migrationBuilder.DropTable(
                name: "Vacation");

            migrationBuilder.DropTable(
                name: "VerificationCode");

            migrationBuilder.DropTable(
                name: "VisitPlanInfluenceStudy");

            migrationBuilder.DropTable(
                name: "VisitTaskReReading");

            migrationBuilder.DropTable(
                name: "VolumeReward");

            migrationBuilder.DropTable(
                name: "ClinicalAnswerRowInfo");

            migrationBuilder.DropTable(
                name: "TrialStatus");

            migrationBuilder.DropTable(
                name: "PublishLog");

            migrationBuilder.DropTable(
                name: "QCChallenge");

            migrationBuilder.DropTable(
                name: "ReadingClinicalData");

            migrationBuilder.DropTable(
                name: "ReadingConsistentClinicalData");

            migrationBuilder.DropTable(
                name: "TaskMedicalReview");

            migrationBuilder.DropTable(
                name: "ReadingQuestionCriterionSystem");

            migrationBuilder.DropTable(
                name: "ReadingTableAnswerRowInfo");

            migrationBuilder.DropTable(
                name: "ReadingTableQuestionTrial");

            migrationBuilder.DropTable(
                name: "ClinicalForm");

            migrationBuilder.DropTable(
                name: "SCPSeries");

            migrationBuilder.DropTable(
                name: "NoneDicomStudy");

            migrationBuilder.DropTable(
                name: "SystemDocument");

            migrationBuilder.DropTable(
                name: "SystemNotice");

            migrationBuilder.DropTable(
                name: "Enroll");

            migrationBuilder.DropTable(
                name: "TaskSeries");

            migrationBuilder.DropTable(
                name: "TrialDocument");

            migrationBuilder.DropTable(
                name: "TrialEmailNoticeConfig");

            migrationBuilder.DropTable(
                name: "TrialExperience");

            migrationBuilder.DropTable(
                name: "TrialQCQuestion");

            migrationBuilder.DropTable(
                name: "TrialSiteSurvey");

            migrationBuilder.DropTable(
                name: "Menu");

            migrationBuilder.DropTable(
                name: "VisitPlanInfluenceStat");

            migrationBuilder.DropTable(
                name: "DicomInstance");

            migrationBuilder.DropTable(
                name: "OrganInfo");

            migrationBuilder.DropTable(
                name: "ReadingQuestionTrial");

            migrationBuilder.DropTable(
                name: "ClinicalDataTrialSet");

            migrationBuilder.DropTable(
                name: "SCPStudy");

            migrationBuilder.DropTable(
                name: "TaskStudy");

            migrationBuilder.DropTable(
                name: "EmailNoticeConfig");

            migrationBuilder.DropTable(
                name: "DicomSeries");

            migrationBuilder.DropTable(
                name: "ReadingCriterionPage");

            migrationBuilder.DropTable(
                name: "ClinicalDataSystemSet");

            migrationBuilder.DropTable(
                name: "SCPPatient");

            migrationBuilder.DropTable(
                name: "VisitTask");

            migrationBuilder.DropTable(
                name: "DicomStudy");

            migrationBuilder.DropTable(
                name: "ReadModule");

            migrationBuilder.DropTable(
                name: "ReadingPeriodSet");

            migrationBuilder.DropTable(
                name: "ReadingQuestionCriterionTrial");

            migrationBuilder.DropTable(
                name: "VisitStage");

            migrationBuilder.DropTable(
                name: "Doctor");

            migrationBuilder.DropTable(
                name: "User");

            migrationBuilder.DropTable(
                name: "UserType");

            migrationBuilder.DropTable(
                name: "SubjectVisit");

            migrationBuilder.DropTable(
                name: "Subject");

            migrationBuilder.DropTable(
                name: "TrialSite");

            migrationBuilder.DropTable(
                name: "Trial");

            migrationBuilder.DropTable(
                name: "CROCompany");

            migrationBuilder.DropTable(
                name: "Dictionary");

            migrationBuilder.DropTable(
                name: "Sponsor");

            migrationBuilder.DropTable(
                name: "Hospital");

            migrationBuilder.DropTable(
                name: "Site");
        }
    }
}
