Browse Source

修改数据迁移处理

denny 1 year ago
parent
commit
b567e71150
64 changed files with 7071 additions and 27 deletions
  1. BIN
      Tools/Flyinsono.DBCopy.Tool.rar
  2. 31 0
      Tools/Flyinsono.DBCopy.Tool/AutoMapperProfile.cs
  3. 76 16
      Tools/Flyinsono.DBCopy.Tool/ClientTestManager.cs
  4. 89 0
      Tools/Flyinsono.DBCopy.Tool/Config/TestConfig.json
  5. 0 0
      Tools/Flyinsono.DBCopy.Tool/DBCopy.Packages/4.2earlier/mongod_4.2.exe
  6. 113 0
      Tools/Flyinsono.DBCopy.Tool/Entities/Admins.cs
  7. 32 0
      Tools/Flyinsono.DBCopy.Tool/Entities/ChatMessages.cs
  8. 128 0
      Tools/Flyinsono.DBCopy.Tool/Entities/Config/TestUserConfig.cs
  9. 34 0
      Tools/Flyinsono.DBCopy.Tool/Entities/ConsultationEvaluates.cs
  10. 232 0
      Tools/Flyinsono.DBCopy.Tool/Entities/ConsultationRecords.cs
  11. 86 0
      Tools/Flyinsono.DBCopy.Tool/Entities/ConsultationRecordsBak.cs
  12. 65 0
      Tools/Flyinsono.DBCopy.Tool/Entities/Conversations.cs
  13. 51 0
      Tools/Flyinsono.DBCopy.Tool/Entities/CourseNoticeReminds.cs
  14. 21 0
      Tools/Flyinsono.DBCopy.Tool/Entities/CourseStudents.cs
  15. 253 0
      Tools/Flyinsono.DBCopy.Tool/Entities/Courses.cs
  16. 170 0
      Tools/Flyinsono.DBCopy.Tool/Entities/DiagnosisResult.cs
  17. 98 0
      Tools/Flyinsono.DBCopy.Tool/Entities/ExamPapers.cs
  18. 69 0
      Tools/Flyinsono.DBCopy.Tool/Entities/ExamScores.cs
  19. 272 0
      Tools/Flyinsono.DBCopy.Tool/Entities/ExaminationPaper.cs
  20. 38 0
      Tools/Flyinsono.DBCopy.Tool/Entities/FinishedTerminalRecords.cs
  21. 32 0
      Tools/Flyinsono.DBCopy.Tool/Entities/LectureContestBrowserRecords.cs
  22. 72 0
      Tools/Flyinsono.DBCopy.Tool/Entities/LectureContestEntries.cs
  23. 60 0
      Tools/Flyinsono.DBCopy.Tool/Entities/LectureContestEntryScoreRecords.cs
  24. 24 0
      Tools/Flyinsono.DBCopy.Tool/Entities/LectureContestMessages.cs
  25. 28 0
      Tools/Flyinsono.DBCopy.Tool/Entities/LectureContestResults.cs
  26. 50 0
      Tools/Flyinsono.DBCopy.Tool/Entities/LectureContests.cs
  27. 25 0
      Tools/Flyinsono.DBCopy.Tool/Entities/Locations.cs
  28. 52 0
      Tools/Flyinsono.DBCopy.Tool/Entities/Organizations.cs
  29. 44 0
      Tools/Flyinsono.DBCopy.Tool/Entities/OrganizationsBak.cs
  30. 50 0
      Tools/Flyinsono.DBCopy.Tool/Entities/Patient.cs
  31. 62 0
      Tools/Flyinsono.DBCopy.Tool/Entities/PatientInfos.cs
  32. 46 0
      Tools/Flyinsono.DBCopy.Tool/Entities/PosterConfigs.cs
  33. 59 0
      Tools/Flyinsono.DBCopy.Tool/Entities/PosterHistories.cs
  34. 1071 0
      Tools/Flyinsono.DBCopy.Tool/Entities/ReportInfoResults.cs
  35. 56 0
      Tools/Flyinsono.DBCopy.Tool/Entities/ReportInfoResultsBak.cs
  36. 41 0
      Tools/Flyinsono.DBCopy.Tool/Entities/StorageFileInfoes.cs
  37. 36 0
      Tools/Flyinsono.DBCopy.Tool/Entities/TerminalAIDataExcuteRecords.cs
  38. 179 0
      Tools/Flyinsono.DBCopy.Tool/Entities/TerminalAIDatas.cs
  39. 110 0
      Tools/Flyinsono.DBCopy.Tool/Entities/TerminalDatas.cs
  40. 43 0
      Tools/Flyinsono.DBCopy.Tool/Entities/TerminalRecordReportAISelectResults.cs
  41. 25 0
      Tools/Flyinsono.DBCopy.Tool/Entities/TerminalRecordReportStates.cs
  42. 125 0
      Tools/Flyinsono.DBCopy.Tool/Entities/TerminalRecords.cs
  43. 44 0
      Tools/Flyinsono.DBCopy.Tool/Entities/TerminalRecordsBak.cs
  44. 134 0
      Tools/Flyinsono.DBCopy.Tool/Entities/Terminals.cs
  45. 85 0
      Tools/Flyinsono.DBCopy.Tool/Entities/TerminalsBak.cs
  46. 42 0
      Tools/Flyinsono.DBCopy.Tool/Entities/UploadStorageFileInfo.cs
  47. 271 0
      Tools/Flyinsono.DBCopy.Tool/Entities/Users.cs
  48. 108 0
      Tools/Flyinsono.DBCopy.Tool/Entities/UsersBak.cs
  49. 14 10
      Tools/Flyinsono.DBCopy.Tool/Flyinsono.DBCopy.Tool.csproj
  50. 31 0
      Tools/Flyinsono.DBCopy.Tool/Flyinsono.DBCopy.Tool.sln
  51. 106 0
      Tools/Flyinsono.DBCopy.Tool/Service/FilterTestService.cs
  52. 132 0
      Tools/Flyinsono.DBCopy.Tool/Service/Repositories/ConversationsDBRepository.cs
  53. 130 0
      Tools/Flyinsono.DBCopy.Tool/Service/Repositories/CoursesDBRepository.cs
  54. 141 0
      Tools/Flyinsono.DBCopy.Tool/Service/Repositories/ExaminationPaperDBPepository.cs
  55. 185 0
      Tools/Flyinsono.DBCopy.Tool/Service/Repositories/LectureContestsDBRepository.cs
  56. 106 0
      Tools/Flyinsono.DBCopy.Tool/Service/Repositories/OrganizationsDBRepository.cs
  57. 117 0
      Tools/Flyinsono.DBCopy.Tool/Service/Repositories/PosterConfigsDBRepository.cs
  58. 498 0
      Tools/Flyinsono.DBCopy.Tool/Service/Repositories/RecordDatasDBRepository.cs
  59. 87 0
      Tools/Flyinsono.DBCopy.Tool/Service/Repositories/TerninalsDBRepository.cs
  60. 128 0
      Tools/Flyinsono.DBCopy.Tool/Service/Repositories/UploadStorageFileInfoDBRepository.cs
  61. 196 0
      Tools/Flyinsono.DBCopy.Tool/Service/Repositories/UsersDBRepository.cs
  62. 102 0
      Tools/Flyinsono.DBCopy.Tool/Utilities/CommonConfigManager.cs
  63. 265 0
      Tools/Flyinsono.DBCopy.Tool/Utilities/MongoDbClient.cs
  64. 1 1
      Tools/Flyinsono.DBCopy.Tool/ViewModels/MainWindowViewModel.cs

BIN
Tools/Flyinsono.DBCopy.Tool.rar


+ 31 - 0
Tools/Flyinsono.DBCopy.Tool/AutoMapperProfile.cs

@@ -0,0 +1,31 @@
+using AutoMapper;
+using Flyinsono.DBCopy.Tool.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WingInterfaceLibrary.DTO.Courses;
+
+namespace Flyinsono.DBCopy.Tool
+{
+    internal class AutoMapperProfile : Profile
+    {
+        public AutoMapperProfile()
+        {
+            CreateMap<Users, UsersBak>().ReverseMap();
+            CreateMap<UsersBak, Users>().ReverseMap();
+            CreateMap<Organizations, OrganizationsBak>().ReverseMap();
+            CreateMap<OrganizationsBak, Organizations>().ReverseMap();
+            CreateMap<Terminals, TerminalsBak>().ReverseMap();
+            CreateMap<TerminalsBak, Terminals>().ReverseMap();
+            CreateMap<TerminalRecordsBak, TerminalRecords>().ReverseMap();
+            CreateMap<TerminalRecords, TerminalRecordsBak>().ReverseMap();
+            CreateMap<ConsultationRecords, ConsultationRecordsBak>().ReverseMap();
+            CreateMap<ConsultationRecordsBak, ConsultationRecords>().ReverseMap();
+            CreateMap<ReportInfoResultsBak, ReportInfoResults>().ReverseMap();
+            CreateMap<ReportInfoResults, ReportInfoResultsBak>().ReverseMap();
+
+        }
+    }
+}

+ 76 - 16
Tools/Flyinsono.DBCopy.Tool/ClientTestManager.cs

@@ -11,6 +11,12 @@ using WingInterfaceLibrary.Interface;
 using WingInterfaceLibrary.Request.User;
 using MongoDB.Bson;
 using MongoDB.Driver;
+using Flyinsono.DBCopy.Tool.Utilities;
+using System.Reflection.Metadata;
+using MongoDB.Bson.IO;
+using Flyinsono.DBCopy.Tool.Entities;
+using System.Threading.Tasks;
+using Flyinsono.DBCopy.Tool.Service;
 
 namespace Flyinsono.DBCopy.Tool
 {
@@ -37,13 +43,57 @@ namespace Flyinsono.DBCopy.Tool
                 //var client = new JsonRpcClient();
                 //client.UseEngine(clientEngine);
                 //var proxy = client.CreateProxy<ILoginService>();
-                JsonRpcProxy jrp = new JsonRpcProxy(remoteUrl);
-                var request = new CommonLoginRequest();
-                request.LoginSource = LoginSource.PC;
-                request.AnyAccount = "fly11";
-                request.Password = "7a9da7f9ffc92a1d9e3b9d87137eb3c1";
-                var result = await jrp.Login.CommonLoginAsync(request);
-                Logger.WriteLineInfo($"result:{result.AccountName}- {result.LoginState} - {result.Token}");
+                //JsonRpcProxy jrp = new JsonRpcProxy(remoteUrl);
+                //var request = new CommonLoginRequest();
+                //request.LoginSource = LoginSource.PC;
+                //request.AnyAccount = "fly11";
+                //request.Password = "7a9da7f9ffc92a1d9e3b9d87137eb3c1";
+                //var result = await jrp.Login.CommonLoginAsync(request);
+                //Logger.WriteLineInfo($"result:{result.AccountName}- {result.LoginState} - {result.Token}");
+
+
+
+                var filterTestService = new FilterTestService();
+                if (CommonConfigManager.FilterGeneral.ExcuteUsers)
+                {
+                    filterTestService.DealWithUserData();
+                }
+                if (CommonConfigManager.FilterGeneral.ExcuteTerninals)
+                {
+                    filterTestService.DealWithTerminalData();
+                }
+                if (CommonConfigManager.FilterGeneral.ExcuteOrganizations)
+                {
+                    filterTestService.DealWithOrganizationData();
+                }
+                if (CommonConfigManager.FilterGeneral.ExcutePosterConfigs)
+                {
+                    filterTestService.DealWithPosterConfigsData();
+                }
+                if (CommonConfigManager.FilterGeneral.ExcuteConversations)
+                {
+                    filterTestService.DealWithConversationsData();
+                }
+                if (CommonConfigManager.FilterGeneral.ExcuteLectureContests)
+                {
+                    filterTestService.DealWithLectureContestsData();
+                }
+                if (CommonConfigManager.FilterGeneral.ExcuteExaminationPapers)
+                {
+                    filterTestService.DealWithExaminationPaperData();
+                }
+                if (CommonConfigManager.FilterGeneral.ExcuteCourses)
+                {
+                    filterTestService.DealWithCoursesData();
+                }
+                if (CommonConfigManager.FilterGeneral.ExcuteUploadStorageFileInfos)
+                {
+                    filterTestService.DealWithUploadStorageFileData();
+                }
+                if (CommonConfigManager.FilterGeneral.ExcuteRecordDatas)
+                {
+                    filterTestService.DealWithRecodeFileData();
+                }
             }
             catch (Exception ex)
             {
@@ -59,35 +109,45 @@ namespace Flyinsono.DBCopy.Tool
         public void ConnectDb(string dbPath)
         {
             Console.WriteLine($"Database path: {dbPath}");
-            string mongodPath = @"DBCopy.Packages\4.2earlier\mongod.exe";
+            string mongodPath = @"DBCopy.Packages\4.2earlier\mongod_4.2.exe";
             int port = 8333;
             StartLocalMongoDbServer(mongodPath, dbPath, port);
-            string connectionString = "mongodb://localhost:8333";
-            MongoClient client = ConnectToMongoDB(connectionString);
-            string databaseName = "vCloudDb";
-            string collectionName = "Admins";
-            ReadDataFromMongoDB(client, databaseName, collectionName);
         }
+           
 
-        private void StartLocalMongoDbServer(string mongodPath, string dbPath, int port)
+        private void StartLocalMongoDbServer(string mongodPath, string dbPath, int port, float cacheSize = 0.5f)
         {
             try
             {
-                Logger.WriteLineInfo($"Mongodb server starting");
+                bool res = false;
+                Process[] processes = Process.GetProcessesByName("mongod_4.2");
+                if (processes.Length != 0)
+                {
+                    res = true; 
+                    return;
+                }
 
+                Logger.WriteLineInfo($"Mongodb server starting");
 
+                var wiredTigerCacheSizeGB = CommonConfigManager.FilterGeneral.WiredTigerCacheSizeGB;
                 //journal: 用于故障恢复和持久化,打开journal会使用更多的内存
                 //bind_ip:控制请求源IP以及请求的Server端指定IP,127.0.0.1 != 本机IP
                 //noIndexBuildRetry:在一个索引创建失败后启动mongod,可以使用noIndexBuildRetry跳过索引创建来启动
                 //master:(存放在DB/local数据库下的oplog.$main集合中)
                 var arguments = $"--dbpath \"{dbPath}\" --port {port} --maxConns 2000 --noIndexBuildRetry --nojournal";
+                if (wiredTigerCacheSizeGB > 0)
+                {
+                    arguments += " --wiredTigerCacheSizeGB " + wiredTigerCacheSizeGB;
+                }
                 var startInfo = new ProcessStartInfo
                 {
                     FileName = mongodPath,
                     Arguments = arguments,
                     WindowStyle = ProcessWindowStyle.Hidden,
                     RedirectStandardInput = true,
-                    RedirectStandardOutput = true
+                    RedirectStandardOutput = true,
+                    UseShellExecute = false,
+                    CreateNoWindow = true
                 };
                 using (var process = Process.Start(startInfo))
                 {

+ 89 - 0
Tools/Flyinsono.DBCopy.Tool/Config/TestConfig.json

@@ -0,0 +1,89 @@
+{
+  "FilterUsers": [
+    {
+      "Name": "Denny",
+      "Phone": "13771773972",
+      "Email": "denny.zhao@vinno.com"
+    },
+    {
+      "Name": "Connie",
+      "Phone": "13861304784",
+      "Email": "connie.liu@vinno.com"
+    },
+    {
+      "Name": "Smith",
+      "Phone": "15151433753",
+      "Email": "smith.zhang@vinno.com"
+    },
+    {
+      "Name": "Nancy",
+      "Phone": "15214628172",
+      "Email": "nancy.zhou@vinno.com"
+    },
+    {
+      "Name": "Riley",
+      "Phone": "13359808526",
+      "Email": "riley.yao@vinno.com"
+    },
+    {
+      "Name": "Fly",
+      "Phone": "18501538764",
+      "Email": "fly.wang@vinno.com"
+    },
+    {
+      "Name": "Mike",
+      "Phone": "18106213687",
+      "Email": "mike.niu@vinno.com"
+    },
+    {
+      "Name": "Warr",
+      "Phone": "15962161351",
+      "Email": "warr.qian@vinno.com"
+    },
+    {
+      "Name": "Jeremy",
+      "Phone": "15506154416",
+      "Email": "jeremy.zhang@vinno.com"
+    },
+    {
+      "Name": "Finlay",
+      "Phone": "18556768556",
+      "Email": "finlay.gao@vinno.com"
+    },
+    {
+      "Name": "Loki",
+      "Phone": "18356420882",
+      "Email": "loki.wu@vinno.com"
+    },
+    {
+      "Name": "Jimmy",
+      "Phone": "13771819534",
+      "Email": "jimmy.jiang@vinno.com"
+    },
+    {
+      "Name": "Melon",
+      "Phone": "18651743369",
+      "Email": "melon.yin@vinno.com"
+    }
+  ],
+  "FilterTerminals": [ "6QFPLF", "Y669ER" ],
+  "FilterOrganizations": [ "test", "tst", "测试", "上级", "下级", "中级", "Connie", "Denny", "Loki", "Nancy", "Riley", "Smith", "DUSHU" ],
+  "FilterLectureContests": [ "test", "tst", "测试", "Connie", "Denny", "Loki", "Nancy", "Riley", "Smith" ],
+  "FilterExaminationPaper": [ "test", "tst", "测试", "Connie", "Denny", "Loki", "Nancy", "Riley", "Smith" ],
+  "FilterCourses": [ "test", "ceshi", "tst", "测试", "Connie", "Denny", "Loki", "Nancy", "Riley", "Smith", "demo", "hi", "hahha", "直播", "培训", "啊打发打发", "new" ],
+  "FilterPatients": [ "test", "ceshi", "tst", "测试", "Connie", "Denny", "Loki", "Nancy", "Riley", "Smith", "张帅" ],
+  "FilterGeneral": {
+    "ClearTime": "2023-04-19",
+    "ExcuteConversations": true,
+    "ExcuteCourses": true,
+    "ExcuteExaminationPapers": true,
+    "ExcuteLectureContests": true,
+    "ExcuteOrganizations": true,
+    "ExcutePosterConfigs": true,
+    "ExcuteRecordDatas": true,
+    "ExcuteTerninals": true,
+    "ExcuteUploadStorageFileInfos": true,
+    "ExcuteUsers": true,
+    "WiredTigerCacheSizeGB": 4
+  }
+}

+ 0 - 0
Tools/Flyinsono.DBCopy.Tool/DBCopy.Packages/4.2earlier/mongod.exe → Tools/Flyinsono.DBCopy.Tool/DBCopy.Packages/4.2earlier/mongod_4.2.exe


+ 113 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/Admins.cs

@@ -0,0 +1,113 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class Admins
+    {
+        public string _id { get; set; }
+        public DateTime CreateTime { get; set; }
+        public DateTime UpdateTime { get; set; }
+        public bool IsDeleted { get; set; }
+        public string Name { get; set; }
+        public string Password { get; set; }
+        public string LastName { get; set; }
+        public string FirstName { get; set; }
+        public string FullName { get; set; }
+        public string Phone { get; set; }
+        public string Email { get; set; }
+        public AdminType Type { get; set; }
+        public string License { get; set; }
+        public int Level { get; set; }
+        public string ParentId { get; set; }
+        public int AuthType { get; set; }
+        public MapInfo MapDataInfo { get; set; }
+        public IList<Features> Features { get; set; }
+    }
+
+    public enum AdminType
+    {
+        SystemAdmin,
+        ResoureAdmin
+    }
+
+    public class MapInfo
+    {
+        public BaseDataInfo AreaInfo { get; set; }
+
+        public BaseDataInfo CenterLocationInfo { get; set; }
+    }
+
+    public class BaseDataInfo
+    {
+        public string _id { get; set; }
+        public string Name { get; set; }
+        public string Description { get; set; }
+    }
+
+    public class Features: AdminInfo
+    {
+
+    }
+
+    public class AdminInfo
+    {
+        public string _id { get; set; }
+
+        public string Name { get; set; }
+    }
+
+    /// <summary>
+    /// 用户超声机
+    /// </summary>
+    internal class UserTerminalInfo : TerminalInfo
+    {
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public TerminalRemark Remark { get; set; }
+    }
+
+    public class TerminalInfo
+    {
+        public string Id { get; set; }
+        public string Name { get; set; }
+        public string Description { get; set; }
+        public string OrganizationId { get; set; }
+        public bool IsShared { get; set; } = false;
+    }
+
+    /// <summary>
+    /// 备注
+    /// </summary>
+    internal class TerminalRemark
+    {
+        /// <summary>
+        /// 国家
+        /// </summary>
+        public string Country { get; set; }
+
+        /// <summary>
+        /// 省份
+        /// </summary>
+        public string Province { get; set; }
+
+        /// <summary>
+        /// 代理商名称
+        /// </summary>
+        public string AgentName { get; set; }
+
+        /// <summary>
+        /// 医院名称
+        /// </summary>
+        public string HospitalName { get; set; }
+
+        /// <summary>
+        /// 其他备注
+        /// </summary>
+        public string OtherRemark { get; set; }
+    }
+}

+ 32 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/ChatMessages.cs

@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class ChatMessages
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        public ConversationInfo Conversation { get; set; }
+
+        public AdminInfo CreateUser { get; set; }
+
+        public string Content { get; set; }
+    }
+
+    public class ConversationInfo
+    {
+        public string Id { get; set; }
+
+        public string Name { get; set; }
+    }
+}

+ 128 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/Config/TestUserConfig.cs

@@ -0,0 +1,128 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities.Config
+{
+    internal class TestConfig
+    {
+        /// <summary>
+        /// 过滤指定的测试用户
+        /// </summary>
+        public IList<FilterUsersConfig> FilterUsers { get; set; } = new List<FilterUsersConfig>();
+
+        /// <summary>
+        /// 过滤指定的测试超声机
+        /// </summary>
+        public IList<string> FilterTerminals { get; set; } = new List<string>();
+
+        /// <summary>
+        /// 过滤指定的测试机构
+        /// </summary>
+        public IList<string> FilterOrganizations { get; set; } = new List<string>();
+
+        /// <summary>
+        /// 过滤指定的测试讲课比赛
+        /// </summary>
+        public IList<string> FilterLectureContests { get; set; } = new List<string>();
+
+        /// <summary>
+        /// 过滤指定的测试考试
+        /// </summary>
+        public IList<string> FilterExaminationPaper { get; set; } = new List<string>();
+
+        /// <summary>
+        /// 过滤指定的测试课程
+        /// </summary>
+        public IList<string> FilterCourses { get; set; } = new List<string>();
+
+        /// <summary>
+        /// 过滤指定的测试病人
+        /// </summary>
+        public IList<string> FilterPatients { get; set; } = new List<string>();
+
+        /// <summary>
+        /// 清理工具基础配置
+        /// </summary>
+        public FilterGeneralConfig FilterGeneral { get; set; } = new FilterGeneralConfig();
+    }
+
+    internal class FilterUsersConfig
+    {
+        /// <summary>
+        /// 姓名
+        /// </summary>
+        public string Name { get; set; } = string.Empty;
+
+        /// <summary>
+        /// 电话
+        /// </summary>
+        public string Phone { get; set; } = string.Empty;
+
+        /// <summary>
+        /// 电子邮件
+        /// </summary>
+        public string Email { get; set; } = string.Empty;
+    }
+
+    /// <summary>
+    /// 基础配置
+    /// </summary>
+    internal class FilterGeneralConfig
+    {
+        /// <summary>
+        /// 清理截止时间
+        /// </summary>
+        public DateTime ClearDeadline => Convert.ToDateTime(ClearTime);
+        /// <summary>
+        /// 清理时间
+        /// </summary>
+        public string ClearTime { get; set; }
+        /// <summary>
+        /// 开启清理Conversations
+        /// </summary>
+        public bool ExcuteConversations { get; set; }
+        /// <summary>
+        /// 开启清理Courses 
+        /// </summary>
+        public bool ExcuteCourses { get; set; }
+        /// <summary>
+        /// 开启清理ExaminationPapers
+        /// </summary>
+        public bool ExcuteExaminationPapers { get; set; }
+        /// <summary>
+        /// 开启清理LectureContests
+        /// </summary>
+        public bool ExcuteLectureContests { get; set; }
+        /// <summary>
+        /// 开启清理Organizations
+        /// </summary>
+        public bool ExcuteOrganizations { get; set; }
+        /// <summary>
+        /// 开启清理PosterConfigs 
+        /// </summary>
+        public bool ExcutePosterConfigs { get; set; }
+        /// <summary>
+        /// 开启清理分时诊断和实时会诊
+        /// </summary>
+        public bool ExcuteRecordDatas { get; set; }
+        /// <summary>
+        /// 开启清理Terninals
+        /// </summary>
+        public bool ExcuteTerninals { get; set; }
+        /// <summary>
+        /// 开启清理UploadStorageFileInfos 
+        /// </summary>
+        public bool ExcuteUploadStorageFileInfos { get; set; }
+        /// <summary>
+        /// 开启清理用户
+        /// </summary>
+        public bool ExcuteUsers { get; set; }
+        /// <summary>
+        /// mongodb最大运行缓存
+        /// </summary>
+        public int WiredTigerCacheSizeGB { get; set; }
+    } 
+}

+ 34 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/ConsultationEvaluates.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class ConsultationEvaluates
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        /// <summary>
+        /// 会诊记录Id
+        /// </summary>
+        public string ConsultationRecordId { get; set; }
+
+        /// <summary>
+        /// 评价等级
+        /// </summary>
+        public EvaluateGrade EvaluateGrade { get; set; }
+
+        /// <summary>
+        /// 评价反馈
+        /// </summary>
+        public string Feedback { get; set; }
+    }
+}

+ 232 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/ConsultationRecords.cs

@@ -0,0 +1,232 @@
+using MongoDB.Bson.Serialization.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class ConsultationRecords
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        public DoctorInfo DoctorInfo { get; set; }
+
+        public DoctorInfo ExpertInfo { get; set; }
+
+        public ConsultationPatientInfo PatientInfo { get; set; }
+
+        public OrganizationInfo PrimaryHosptial { get; set; }
+
+        public OrganizationInfo CentralHospital { get; set; }
+
+        public DateTime AppointmentTime { get; set; }
+
+        public string CheckPoint { get; set; }
+
+        public ConsultationState State { get; set; }
+
+        public string DeviceModel { get; set; }
+
+        public string ScanDoctor { get; set; }
+
+        public TerminalInfo TerminalInfo { get; set; }
+
+        public string ConsultationNumber { get; set; }
+
+        public string QueuingNumber { get; set; }
+
+        public QualityType QualityType { get; set; }
+
+        /// <summary>
+        /// 随访记录状态
+        /// </summary>
+        public FollowUpVisitStatus FollowUpVisitStatus { get; set; }
+
+        /// <summary>
+        /// 是否需要随访
+        /// </summary>
+        public bool IsNeedFollowUpVisit { get; set; }
+
+        /// <summary>
+        /// 会诊评价满意度
+        /// </summary>
+        public EvaluateGrade EvaluateGrade { get; set; }
+
+        /// <summary>
+        /// image tokens
+        /// </summary>
+        public IList<string> ImageTokens { get; set; }
+
+        /// <summary>
+        /// video tokens
+        /// </summary>
+        public IList<VideoTokenInfo> VideoTokens { get; set; }
+
+        /// <summary>
+        /// 会诊上传图像数据
+        /// </summary>
+        public IList<GraphicInfo> GraphicData { get; set; }
+
+        public IList<ReportConclusionInfo> ReportConclusionInfos { get; set; }
+
+        /// <summary>
+        /// 会诊前图像数据
+        /// </summary>
+        public IList<FileItem> PreFileItems { get; set; }
+    }
+
+    /// <summary>
+    /// FileItem 类
+    /// </summary>
+    public class FileItem
+    {
+        /// <summary>
+        /// 文件类型(0.图片;1.PDF)
+        /// </summary>
+        public int FileType { get; set; }
+
+        /// <summary>
+        /// 缩略图地址
+        /// </summary>
+        public string ThumbnailUrl { get; set; }
+
+        /// <summary>
+        /// 原文件地址
+        /// </summary>
+        public string OriginalFileUrl { get; set; }
+
+        /// <summary>
+        /// 文件名
+        /// </summary>
+        public string FileName { get; set; }
+
+        /// <summary>
+        /// 上传人
+        /// </summary>
+        public string Uploader { get; set; }
+    }
+
+    public class ReportConclusionInfo
+    {
+        public string ReportId { get; set; }
+        public string DiseaseName { get; set; }
+        public DiseaseConclusion DiseaseConclusion { get; set; }
+    }
+
+    public enum DiseaseConclusion
+    {
+        NoConclusion,
+        Positive,
+        Negative
+    }
+
+    public class GraphicInfo
+    {
+        /// <summary>
+        /// 0.图片, 1.视频
+        /// </summary>
+        public int GraphicType { get; set; }
+
+        /// <summary>
+        /// 图像token
+        /// </summary>
+        public string GraphicToken { get; set; }
+
+        /// <summary>
+        /// 图像预览token
+        /// </summary>
+        public string PreviewGraphicToken { get; set; }
+
+        /// <summary>
+        /// 用户Id
+        /// </summary>
+        public string UserId { get; set; }
+    }
+
+    public class VideoTokenInfo
+    {
+        /// <summary>
+        /// video token
+        /// </summary>
+        public string VideoToken { get; set; }
+
+        /// <summary>
+        /// preview video token
+        /// </summary>
+        public string PreviewImageToken { get; set; }
+    }
+
+    public enum EvaluateGrade
+    {
+        UnSet = 0,
+        Dissatisfaction,
+        General,
+        Satisfaction
+    }
+
+    public enum FollowUpVisitStatus
+    {
+        Unknown,
+        /// <summary>
+        /// 待随访
+        /// </summary>
+        PendingVisit,
+        /// <summary>
+        /// 已随访
+        /// </summary>
+        VisitCompleted,
+    }
+
+    public enum ConsultationState
+    {
+        Unhandled = 0,
+        Withdrawn,
+        Handled,
+        Started,
+        WaitForReportUpload,
+        ReportUploading,
+        ReportUploaded,
+        ReportUploadFailed,
+        Expired,
+        Qualified,
+        UnQualified
+    }
+    public class ConsultationPatientInfo
+    {
+        public string Name { get; set; }
+
+        public GenderType GenderType { get; set; }
+
+        public DateTime Birthday { get; set; }
+
+        public string Age { get; set; }
+
+        public string ID { get; set; }
+
+        public string ContactInfo { get; set; }
+
+        public string PastHistory { get; set; }
+
+        public string Diagnosis { get; set; }
+    }
+
+    public class DoctorInfo
+    {
+        public string ID { get; set; }
+        public string Name { get; set; }
+        public string FullName { get; set; }
+        public string FirstName { get; set; }
+
+        public string LastName { get; set; }
+        
+        public string NickName { get; set; }
+    }
+}

+ 86 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/ConsultationRecordsBak.cs

@@ -0,0 +1,86 @@
+using MongoDB.Bson.Serialization.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class ConsultationRecordsBak
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        public DoctorInfo DoctorInfo { get; set; }
+
+        public DoctorInfo ExpertInfo { get; set; }
+
+        public ConsultationPatientInfo PatientInfo { get; set; }
+
+        public OrganizationInfo PrimaryHosptial { get; set; }
+
+        public OrganizationInfo CentralHospital { get; set; }
+
+        public DateTime AppointmentTime { get; set; }
+
+        public string CheckPoint { get; set; }
+
+        public ConsultationState State { get; set; }
+
+        public string DeviceModel { get; set; }
+
+        public string ScanDoctor { get; set; }
+
+        public TerminalInfo TerminalInfo { get; set; }
+
+        public string ConsultationNumber { get; set; }
+
+        public string QueuingNumber { get; set; }
+
+        public QualityType QualityType { get; set; }
+
+        /// <summary>
+        /// 随访记录状态
+        /// </summary>
+        public FollowUpVisitStatus FollowUpVisitStatus { get; set; }
+
+        /// <summary>
+        /// 是否需要随访
+        /// </summary>
+        public bool IsNeedFollowUpVisit { get; set; }
+
+        /// <summary>
+        /// 会诊评价满意度
+        /// </summary>
+        public EvaluateGrade EvaluateGrade { get; set; }
+
+        /// <summary>
+        /// image tokens
+        /// </summary>
+        public IList<string> ImageTokens { get; set; }
+
+        /// <summary>
+        /// video tokens
+        /// </summary>
+        public IList<VideoTokenInfo> VideoTokens { get; set; }
+
+        /// <summary>
+        /// 会诊上传图像数据
+        /// </summary>
+        public IList<GraphicInfo> GraphicData { get; set; }
+
+        public IList<ReportConclusionInfo> ReportConclusionInfos { get; set; }
+
+        /// <summary>
+        /// 会诊前图像数据
+        /// </summary>
+        public IList<FileItem> PreFileItems { get; set; }
+    }
+
+}

+ 65 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/Conversations.cs

@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class Conversations
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        public string Name { get; set; }
+
+        /// <summary>
+        /// Indicate if it is a multi-people conversation
+        /// </summary>
+        public bool Multiple { get; set; }
+
+        public UserInfoWithImage CreateUser { get; set; }
+
+        /// <summary>
+        /// The master of this conversation
+        /// </summary>
+        public UserInfoWithImage Master { get; set; }
+
+        public IList<UserInfoWithImage> Members { get; set; }
+
+        public DateTime CloseTime { get; set; }
+
+        /// <summary>
+        /// the conversation is belong to course
+        /// </summary>
+        public bool IsCourse { get; set; }
+
+    }
+
+    internal class UserInfoWithImage
+    {
+        public string Id { get; set; }
+
+        public string Name { get; set; }
+
+        public byte[] SmallHeadImage { get; set; }
+
+        public string NickName { get; set; }
+
+        public SpeakingState SpeakingState { get; set; }
+
+        public string LastName { get; set; }
+        public string FirstName { get; set; }
+        public string FullName { get; set; }
+    }
+    public enum SpeakingState
+    {
+        Normal = 0,
+        NoSpeaking
+    }
+}

+ 51 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/CourseNoticeReminds.cs

@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class CourseNoticeReminds
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        /// <summary>
+        /// Gets or sets the CourseId of this notice
+        /// </summary>
+        public string CourseId { get; set; }
+
+        /// <summary>
+        /// Gets or sets the UserId of this notice
+        /// </summary>
+        public string UserId { get; set; }
+
+        /// <summary>
+        /// Gets or sets the NoticeType of this notice
+        /// </summary>
+        public CourseNoticeType NoticeType { get; set; }
+
+        /// <summary>
+        /// Gets or sets the sign of whether this notice has been completed.
+        /// </summary>
+        public bool Completed { get; set; }
+    }
+
+    /// <summary>
+    /// 课程通知类型
+    /// </summary>
+    public enum CourseNoticeType
+    {
+        /// <summary>即将开课</summary>
+        BeginSoon,
+        /// <summary>进入课程</summary>
+        EnterCourse
+    }
+    /// <summary>
+}

+ 21 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/CourseStudents.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class CourseStudents
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        public IList<string> Students { get; private set; }
+    }
+}

+ 253 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/Courses.cs

@@ -0,0 +1,253 @@
+using MongoDB.Bson.Serialization.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class Courses
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        /// <summary>
+        /// course name
+        /// </summary>
+        public string Name { get; set; }
+
+        /// <summary>
+        /// course information
+        /// </summary>
+        public string Information { get; set; }
+
+        /// <summary>
+        /// course price
+        /// </summary>
+        public float Price { get; set; }
+
+        /// <summary>
+        /// course state,has started or etc.
+        /// </summary>
+        public CourseState State { get; set; }
+
+        /// <summary>
+        /// course start time
+        /// </summary>
+        public DateTime StarTime { get; set; }
+
+        /// <summary>
+        /// the course's Estimated duration,unit minutes
+        /// </summary>
+        public int Duration { get; set; }
+
+        /// <summary>
+        /// course end signed up time
+        /// </summary>
+        public DateTime Deadline { get; set; }
+
+        /// <summary>
+        /// teacher apply course state,is Reject or passed
+        /// </summary>
+        public ApplyState ApplyState { get; set; }
+
+        /// <summary>
+        /// the poster's url of course/ token
+        /// </summary>
+        public string Poster { get; set; }
+
+        /// <summary>
+        /// the teacher id and introduction
+        /// </summary>
+        public TeacherInfo Teacher { get; set; }
+
+        /// <summary>
+        /// has applied studets
+        /// </summary>
+        public IList<StudentInfo> Students { get; set; }
+
+        /// <summary>
+        /// conversation id
+        /// </summary>
+        public string ConversationId { get; set; }
+
+        /// <summary>
+        /// channel data infos,which is applied from NE
+        /// </summary>
+        public IList<ChannelDataInfo> ChannelDatas { get; private set; }
+
+        /// <summary>
+        /// Create admin info
+        /// </summary>
+        public AdminInfo CreateAdmin { get; set; }
+
+        /// <summary>
+        /// admin owner list
+        /// </summary>
+        public ICollection<AdminInfo> Owners { get; private set; }
+
+        /// <summary>
+        /// teacher state
+        /// </summary>
+        public TeacherState TeacherState { get; set; }
+
+        /// <summary>
+        /// start course in advance true or false
+        /// </summary>
+        public bool StartCourseInAdvance { get; set; }
+
+        /// <summary>
+        /// 实际开始时间
+        /// </summary>
+        public DateTime? ActualStartTime { get; set; }
+        /// <summary>
+        /// 实际结束时间
+        /// </summary>
+        public DateTime? ActualEndTime { get; set; }
+
+        /// <summary>
+        /// 助教ID
+        /// </summary>
+        public List<string> AssistantIds { get; set; }
+
+        /// <summary>
+        /// 嘉宾ID
+        /// </summary>
+        public List<string> GuestIds { get; set; }
+
+        /// <summary>
+        /// 邀请码
+        /// </summary>
+        public string CredentialCode { get; set; }
+
+        /// <summary>
+        /// 课程公告
+        /// </summary>
+        public string CourseNotice { get; set; }
+
+        /// <summary>
+        /// 小班化培训 参与者Ids
+        /// </summary>
+        public List<string> MeetingMemberIds { get; set; }
+    }
+    public enum TeacherState
+    {
+        NotEnter = 0,
+        OnLine,
+        OffLine
+    }
+
+    internal class ChannelDataInfo
+    {
+        public string Id { get; set; }
+
+        public string Name { get; set; }
+
+        /// <summary>
+        /// channel id
+        /// </summary>
+        public string ChannelId { get; set; }
+
+        /// <summary>
+        /// channel download url
+        /// </summary>
+        public string DownLoadUrl { get; set; }
+
+        /// <summary>
+        /// channel upload url
+        /// </summary>
+        public string UpLoadUrl { get; set; }
+
+        /// <summary>
+        /// channel description
+        /// </summary>
+        public ChannelDescription Description { get; private set; }
+
+        /// <summary>
+        /// channel Http url
+        /// </summary>
+        public string HttpUrl { get; set; }
+
+        /// <summary>
+        /// channel Hls url
+        /// </summary>
+        public string HlsUrl { get; set; }
+    }
+
+    public enum ChannelDescription
+    {
+        DeskChannel,
+        TerminalChannel,
+        CameraChannel,
+        TerminalTestChannel,
+        NoneChannel
+    }
+
+    internal class StudentInfo
+    {
+        public string Id { get; set; }
+
+        public string Name { get; set; }
+        public bool IsNoSpeaking { get; set; }
+
+        public bool IsAssistant { get; set; }
+
+        public byte[] SmallHeadImage { get; set; }
+    }
+
+    internal class TeacherInfo
+    {
+        public string Id { get; set; }
+
+        public string Name { get; set; }
+
+        // <summary>
+        /// teacher nickname
+        /// </summary>
+        public string NickName { get; set; }
+
+        /// <summary>
+        /// teacher FullName
+        /// </summary>
+        public string FullName { get; set; }
+
+        public string LastName { get; set; }
+
+        /// <summary>
+        /// teacher introduction
+        /// </summary>
+        public string Introduction { get; set; }
+
+        /// <summary>
+        /// teacher small avatar
+        /// </summary>
+        public byte[] SmallAvatar { get; set; }
+    }
+
+    public enum ApplyState
+    {
+        NoApproval = 0,
+        Passed,
+        Reject,
+        Invalid
+    }
+
+    public enum CourseState
+    {
+        NotStarted = 0,
+        Started,
+        HasEnded,
+        HasCancelled,
+        Overdue,
+        Offline,
+        Approved,
+        RejectApproval,
+        NoApproval
+    }
+}

+ 170 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/DiagnosisResult.cs

@@ -0,0 +1,170 @@
+using SharpCompress.Common;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class DiagnosisResult
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        /// <summary>
+        /// Indicate report content
+        /// </summary>
+        public string TerminalName { get; set; }
+        public string ExamId { get; set; }
+        public string AccessionNumber { get; set; }
+        public string Template { get; set; }
+        public string Title { get; set; }
+        public PatientInfo PatientInfo { get; set; }
+        public string PatientCardId { get; set; }
+        public int Age { get; set; }
+        public DateTime ExamDate { get; set; }
+        public string Description { get; set; }
+        public string Summary { get; set; }
+        public string OperatorPhysician { get; set; }
+        public string PerformingPhysician { get; set; }
+        public string ReferringPhysician { get; set; }
+        public ICollection<ImageInfo> Images { get; set; }
+
+        public StorageServerInfo StorageServer { get; set; }
+
+        public string TerminalRecordId { get; set; }
+
+        public AdminInfo User { get; set; }
+
+        public ImageInfo DigitalSignature { get; set; }
+
+        public string AgeString { get; set; }
+        public DateTime ReportTime { get; set; }
+
+
+        public string Scanner { get; set; }
+        public string ReportElementsString { get; set; }
+        public string TemplateRealName { get; set; }
+        public List<string> PatientInspectionSite { get; set; }
+        public string EquipmentSN { get; set; }
+        public string HospitalName { get; set; }
+        public string ReportPhysician { get; set; }
+        public string ReportPhysicianElectronSign { get; set; }
+    }
+
+    internal class PatientInfo
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        /// <summary>
+        /// Patient Id
+        /// </summary>
+        public string PatientId { get; set; }
+
+        /// <summary>
+        /// Fisrt Name of Patient
+        /// </summary>
+        public string FirstName { get; set; }
+
+        /// <summary>
+        /// Last Name of Patient
+        /// </summary>
+        public string LastName { get; set; }
+
+        /// <summary>
+        /// Birthday of Patient
+        /// </summary>
+        public DateTime? Birthday { get; set; }
+
+        /// <summary>
+        /// True - Male, False - Female
+        /// </summary>
+        public bool? IsMale { get; set; }
+
+        /// <summary>
+        /// Height of patient
+        /// </summary>
+        public double? Height { get; set; }
+
+        /// <summary>
+        /// Weight of patient
+        /// </summary>
+        public double? Weight { get; set; }
+
+        public PatientOBInfo PatientObInfo { get; set; }
+
+        public PatientGYNInfo PatientGynInfo { get; set; }
+
+        public PatientURInfo PatientUrInfo { get; set; }
+
+        public AnimalDetail AnimalDetail { get; set; }
+
+        public string Age { get; set; }
+
+    }
+
+    internal class AnimalDetail
+    {
+        /// <summary>
+        /// Gets or sets the Species
+        /// </summary>
+        public string Species { get; set; }
+
+        /// <summary>
+        /// Gets or sets the owner.
+        /// </summary>
+        public string Owner { get; set; }
+
+
+        /// <summary>
+        /// Gets or sets the breed.
+        /// </summary>
+        public string Breed { get; set; }
+    }
+
+    internal class PatientURInfo
+    {
+        public double? PPSACoefficient { get; set; }
+
+        public double? PSA { get; set; }
+
+    }
+
+    internal class PatientOBInfo: PatientGYNInfo
+    {
+        public int? FetusNumber { get; set; }
+
+        public DateTime? BBT { get; set; }
+
+        public DateTime? EstimateDueDate { get; set; }
+
+        public int? GestationalAge { get; set; }
+
+        public int? GestationalAgeOrigin { get; set; }
+    }
+
+    internal class PatientGYNInfo
+    {
+        public int? AB { get; set; }
+
+        public string Ectopic { get; set; }
+
+        public int? Gravida { get; set; }
+
+        public DateTime? LMP { get; set; }
+
+        public int? Para { get; set; }
+    }
+}

+ 98 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/ExamPapers.cs

@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class ExamPapers
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+        /// <summary>
+        /// Title
+        /// </summary>
+        public string Title { get; set; }
+
+        /// <summary>
+        /// Description
+        /// </summary>
+        public string Description { get; set; }
+
+        /// <summary>
+        /// exam start time
+        /// </summary>
+        public DateTime StarTime { get; set; }
+
+        /// <summary>
+        /// exam end time
+        /// </summary>
+        public DateTime EndTime { get; set; }
+
+        /// <summary>
+        /// TotalScore
+        /// </summary>
+        public double TotalScore { get; set; }
+
+        /// <summary>
+        /// LimitCount
+        /// </summary>
+        public int LimitCount { get; set; }
+
+        /// <summary>
+        /// Subjects
+        /// </summary>
+        public IList<SubjectInfo> Subjects { get; set; }
+
+        /// <summary>
+        /// Result
+        /// </summary>
+        public string Result { get; set; }
+
+        /// <summary>
+        ///  Examiners user ids
+        /// </summary>
+        public IList<string> ExaminerIds { get; set; }
+
+        /// <summary>
+        ///  Examiners group ids
+        /// </summary>
+        public IList<string> ExaminerUserGroupIds { get; set; }
+
+        /// <summary>
+        /// ExaminationAvailability
+        /// </summary>
+        public ExaminationAvailability ExaminationAvailability { get; set; }
+
+        /// <summary>
+        /// Exam Creator UserId(or AdminId)
+        /// </summary>
+        public string CreatorId { get; set; }
+
+        /// <summary>
+        /// ExamType
+        /// </summary>
+        public ExamType ExamType { get; set; }
+
+        /// <summary>
+        /// Has pass score
+        /// </summary>
+        public bool HasPassScore { get; set; }
+
+        /// <summary>
+        /// Pass score
+        /// </summary>
+        public double PassScore { get; set; }
+
+        /// <summary>
+        /// Exam video info
+        /// </summary>
+        public IList<ExamVideoInfo> ExamVideoInfos { get; set; }
+    }
+}

+ 69 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/ExamScores.cs

@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class ExamScores
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        /// <summary>
+        /// UserId
+        /// </summary>
+        public string UserId { get; set; }
+
+        /// <summary>
+        /// ExamId
+        /// </summary>
+        public string ExamId { get; set; }
+
+        /// <summary>
+        /// Total Score
+        /// </summary>
+        public double TotalScore { get; set; }
+
+        /// <summary>
+        /// Correct Count
+        /// </summary>
+        public int CorrectCount { get; set; }
+
+        /// <summary>
+        /// Submit Count
+        /// </summary>
+        public int SubmitCount { get; set; }
+
+        /// <summary>
+        /// Max score Count
+        /// </summary>
+        public int MaxScore { get; set; }
+
+        /// <summary>
+        /// 自己答题的答案
+        /// </summary>
+        public IList<MyExamAnswer> MyExamAnswers { get; set; } = new List<MyExamAnswer>();
+    }
+
+    /// <summary>
+    /// 自己考试答案
+    /// </summary>
+    internal class MyExamAnswer
+    {
+        /// <summary>
+        /// 题号Id
+        /// </summary>
+        public string SubjectId { get; set; }
+        /// <summary>
+        /// 自己答题得答案 Index
+        /// </summary>
+        public IList<string> Answers { get; set; } = new List<string>();
+    }
+}

+ 272 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/ExaminationPaper.cs

@@ -0,0 +1,272 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xaml;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class ExaminationPaper
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        /// <summary>
+        /// Title
+        /// </summary>
+        public string Title { get; set; }
+
+        /// <summary>
+        /// Description
+        /// </summary>
+        public string Description { get; set; }
+
+        /// <summary>
+        /// exam start time
+        /// </summary>
+        public DateTime StarTime { get; set; }
+
+        /// <summary>
+        /// exam end time
+        /// </summary>
+        public DateTime EndTime { get; set; }
+
+        /// <summary>
+        /// TotalScore
+        /// </summary>
+        public double TotalScore { get; set; }
+
+        /// <summary>
+        /// LimitCount
+        /// </summary>
+        public int LimitCount { get; set; }
+
+        /// <summary>
+        /// Subjects
+        /// </summary>
+        public string TemplateId { get; set; }
+
+        /// <summary>
+        /// Result
+        /// </summary>
+        public string Result { get; set; }
+
+        /// <summary>
+        ///  Examiners user ids
+        /// </summary>
+        public IList<string> ExaminerIds { get; set; }
+
+        /// <summary>
+        ///  Examiners group ids
+        /// </summary>
+        public IList<string> ExaminerUserGroupIds { get; set; }
+
+        /// <summary>
+        /// ExaminationAvailability
+        /// </summary>
+        public ExaminationAvailability ExaminationAvailability { get; set; }
+
+        /// <summary>
+        ///  Examiners class ids
+        /// </summary>
+        public IList<string> ClassIds { get; set; } = new List<string>();
+
+        /// <summary>
+        /// Exam Creator UserId(or AdminId)
+        /// </summary>
+        public string CreatorId { get; set; }
+
+        /// <summary>
+        /// ExamType
+        /// </summary>
+        public ExamType ExamType { get; set; }
+
+        /// <summary>
+        /// Has pass score
+        /// </summary>
+        public bool HasPassScore { get; set; }
+
+        /// <summary>
+        /// Pass score
+        /// </summary>
+        public double PassScore { get; set; }
+
+        /// <summary>
+        /// Exam video info
+        /// </summary>
+        public IList<ExamVideoInfo> ExamVideoInfos { get; set; }
+
+
+        /// <summary>
+        /// 考试模板
+        /// </summary>
+        public ExamTemplate ExamTemplate { get; set; }
+
+        /// <summary>
+        ///是否考题回顾 显示隐藏正确答案
+        /// </summary>
+        public bool IsDisplayAnswer { get; set; }
+    }
+
+    internal class ExamTemplate
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+        /// <summary>
+        /// Subjects
+        /// </summary>
+        public List<SubjectInfo> Subjects { get; set; }
+
+        /// <summary>
+        /// is delete status
+        /// </summary>
+        public bool IsDeleted { get; set; }
+
+        /// <summary>
+        /// template name
+        /// </summary>
+        public string Name { get; set; }
+    }
+
+    internal class SubjectInfo
+    {
+        /// <summary>
+        /// Subject id
+        /// </summary>
+        public string Id { get; set; }
+
+        /// <summary>
+        /// Subject
+        /// </summary>
+        public string Subject { get; set; }
+
+        /// <summary>
+        /// Images
+        /// </summary>
+        public List<string> Images { get; set; }
+
+        /// <summary>
+        /// Videos
+        /// </summary>
+        public List<VideoInfo> Videos { get; set; }
+
+        /// <summary>
+        /// Score
+        /// </summary>
+        public double Score { get; set; }
+
+        /// <summary>
+        /// Index
+        /// </summary>
+        public int Index { get; set; }
+
+        /// <summary>
+        /// SubjectType
+        /// </summary>
+        public SubjectType SubjectType { get; set; }
+
+        /// <summary>
+        /// Subject Items
+        /// </summary>
+        public List<SubjectItem> Items { get; set; }
+    }
+
+    public enum SubjectType
+    {
+        SingleChoice,
+        MultipleChoice,
+        Judgement
+    }
+
+    internal class SubjectItem
+    {
+        /// <summary>
+        /// Content
+        /// </summary>
+        public string Content { get; set; }
+
+        /// <summary>
+        /// Index
+        /// </summary>
+        public int Index { get; set; }
+
+        /// <summary>
+        /// IsAnswer
+        /// </summary>
+        public bool IsAnswer { get; set; }
+    }
+
+    internal class VideoInfo
+    {
+        /// <summary>
+        /// VideoToken
+        /// </summary>
+        public string VideoToken { get; set; }
+        /// <summary>
+        /// VideoImageToken
+        /// </summary>
+        public string VideoImageToken { get; set; }
+
+    }
+
+    internal class ExamVideoInfo
+    {
+        /// <summary>
+        /// Gets or sets the id
+        /// </summary>
+        public string Id { get; set; }
+
+        /// <summary>
+        /// Gets or sets the video name
+        /// </summary>
+        public string VideoName { get; set; }
+
+        /// <summary>
+        /// Gets or sets the create time
+        /// </summary>
+        public DateTime CreateTime { get; set; }
+
+        /// <summary>
+        ///gets or set video display poster Token
+        /// </summary>
+        public string PosterToken { get; set; }
+        /// <summary>
+        /// video player time duration 
+        /// </summary>
+        public int Duration { get; set; }
+        /// <summary>
+        /// gets or set Video size ,(uint :M)
+        /// </summary>
+        public int Size { get; set; }
+
+        public string Description { get; set; }
+
+        /// <summary>
+        ///  gets or set palye Video 
+        /// </summary>
+        public string Url { get; set; }
+
+    }
+
+    public enum ExamType
+    {
+        GeneralExam = 0,//公开,所有人可见
+        AgentExam,//只对代理商用户可见
+        Standardized,//规培
+    }
+
+    public enum ExaminationAvailability
+    {
+        Public = 0,//公开,所有人可见
+        Limited//限定,指定可见     
+    }
+}

+ 38 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/FinishedTerminalRecords.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class FinishedTerminalRecords
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        public TerminalInfo Terminal { get; set; }
+
+        public OrganizationInfo Organization { get; set; }
+
+        public UserInfoWithType User { get; set; }
+
+        public PatientDocInfo PatientInfo { get; set; }
+
+        public string TerminalRecordId { get; set; }
+    }
+
+    internal class UserInfoWithType
+    {
+        public UserTypes UserType { get; set; }
+
+        public string Id { get; set; }
+
+        public string Name { get; set; }
+    }
+}

+ 32 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/LectureContestBrowserRecords.cs

@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class LectureContestBrowserRecords
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        /// <summary>
+        /// 比赛Id
+        /// </summary>
+        public string ContestId { get; set; }
+        /// <summary>
+        /// 作品Id
+        /// </summary>
+        public string EntryId { get; set; }
+        /// <summary>
+        /// 用户Id
+        /// </summary>
+        public string UserId { get; set; }
+    }
+}

+ 72 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/LectureContestEntries.cs

@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class LectureContestEntries
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        /// <summary>
+        /// 讲课比赛Id
+        /// </summary>
+        public string ContestId { get; set; }
+        public string Name { get; set; }
+        public string CoverToken { get; set; }
+        public string VideoToken { get; set; }
+        public string VideoUrl { get; set; }
+        public string CoverUrl { get; set; }
+
+        public string UserId { get; set; }
+        /// <summary>
+        /// 参赛人员名称 冗余
+        /// </summary>
+        public string UserName { get; set; }
+
+        public string HospitalId { get; set; }
+        /// <summary>
+        /// 所在医院名称 冗余
+        /// </summary>
+        public string HospitalName { get; set; }
+
+        /// <summary>
+        /// 大众评分
+        /// </summary>
+        public float PublicScore { get; set; }
+        /// <summary>
+        /// 专家评分
+        /// </summary>
+        public float ExpertScore { get; set; }
+        /// <summary>
+        /// 排序值
+        /// </summary>
+        public int Sort { get; set; }
+        /// <summary>
+        /// 亚专业Id
+        /// </summary>
+        public string SubProfessionId { get; set; }
+
+        /// <summary>
+        /// 省份名称
+        /// </summary>
+        public string ProvinceName { get; set; }
+        /// <summary>
+        /// 城市名称
+        /// </summary>
+        public string CityName { get; set; }
+
+        /// <summary>
+        /// 浏览记录 - 新增。建议累加
+        /// </summary>
+        public int BrowserRecord { get; set; }
+    }
+}

+ 60 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/LectureContestEntryScoreRecords.cs

@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class LectureContestEntryScoreRecords
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        /// <summary>
+        /// 比赛Id
+        /// </summary>
+        public string ContestId { get; set; }
+        /// <summary>
+        /// 作品Id
+        /// </summary>
+        public string EntryId { get; set; }
+        /// <summary>
+        /// 用户Id
+        /// </summary>
+        public string UserId { get; set; }
+        /// <summary>
+        /// 省份名称
+        /// </summary>
+        public string ProvinceName { get; set; }
+        /// <summary>
+        /// 城市名称
+        /// </summary>
+        public string CityName { get; set; }
+        /// <summary>
+        /// 评分
+        /// </summary>
+        public double Score { get; set; }
+        /// <summary>
+        /// 评分详情记录
+        /// </summary>
+        public IList<LectureContestEntryScoreRecordDetail> RecordDetails { get; set; }
+    }
+
+    internal class LectureContestEntryScoreRecordDetail
+    {
+        /// <summary>
+        /// 评分项Id
+        /// </summary>
+        public string ItemId { get; set; }
+        /// <summary>
+        /// 评分
+        /// </summary>
+        public double Score { get; set; }
+    }
+}

+ 24 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/LectureContestMessages.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class LectureContestMessages
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+        public string ContestId { get; set; }
+        public string EntryId { get; set; }
+        public string UserId { get; set; }
+        public string Content { get; set; }
+        public int AuditStatus { get; set; }
+    }
+}

+ 28 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/LectureContestResults.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class LectureContestResults
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        /// <summary>
+        /// 讲课比赛Id
+        /// </summary>
+        public string LectureContestId { get; set; }
+        /// <summary>
+        /// 结果内容
+        /// </summary>
+        public string Content { get; set; }
+    }
+}

+ 50 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/LectureContests.cs

@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class LectureContests
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+
+        public string Name { get; set; }
+        public DateTime StartTime { get; set; }
+        public DateTime EndTime { get; set; }
+        /// <summary>
+        /// 评分标准模板Id
+        /// </summary>
+        public string ScoringTemplateId { get; set; }
+        /// <summary>
+        /// 总分
+        /// </summary>
+        public double TotalScore { get; set; }
+        /// <summary>
+        /// 大众评分占比
+        /// </summary>
+        public double PublicScoreRatio { get; set; }
+        /// <summary>
+        /// 专家评分占比
+        /// </summary>
+        public double ExpertScoreRatio { get; set; }
+        /// <summary>
+        /// 亚专业设置
+        /// </summary>
+        public IList<LectureContestSubProfessionSetting> SubProfessionSettings { get; set; }
+    }
+
+    internal class LectureContestSubProfessionSetting
+    {
+        public string Id { get; set; }
+        public DateTime StartTime { get; set; }
+        public DateTime EndTime { get; set; }
+    }
+}

+ 25 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/Locations.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    class Locations
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+        public string AccountId { get; private set; }
+        public string IpAddress { get; private set; }
+        public int AccountType { get; private set; }
+        public string CountryCode { get; private set; }
+        public string ProvinceCode { get; private set; }
+        public string CityCode { get; private set; }
+    }
+}

+ 52 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/Organizations.cs

@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class Organizations
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+        public bool IsDeleted { get; set; }
+        public string Name { get; set; }
+
+        public string Description { get; set; }
+
+        public AdminInfo CreateAdmin { get; set; }
+
+        public CountryInfo Country { get; set; }
+
+        public CountryInfo Province { get; set; }
+
+        public CountryInfo City { get; set; }
+
+        public ICollection<CountryInfo> DiagnosisPackages { get; private set; }
+
+        public ICollection<TerminalInfo> Terminals { get; private set; }
+
+        public virtual ICollection<AdminInfo> Owners { get; private set; }
+
+        public int MaxWorkOrderNumber { get; set; }
+
+        public ICollection<OrganizationInfo> ParentOrganizations { get; set; }
+
+        public ICollection<OrganizationInfo> ChildOrganizations { get; set; }
+        public string DefaultTemplateId { get; set; }
+        public ICollection<string> ReportTemplateIds { get; set; }
+    }
+
+    internal class CountryInfo
+    {
+        public string Description { get; set; }
+        public string Id { get; set; }
+
+        public string Name { get; set; }
+    }
+}

+ 44 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/OrganizationsBak.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class OrganizationsBak
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+        public bool IsDeleted { get; set; }
+        public string Name { get; set; }
+
+        public string Description { get; set; }
+
+        public AdminInfo CreateAdmin { get; set; }
+
+        public CountryInfo Country { get; set; }
+
+        public CountryInfo Province { get; set; }
+
+        public CountryInfo City { get; set; }
+
+        public ICollection<CountryInfo> DiagnosisPackages { get; private set; }
+
+        public ICollection<TerminalInfo> Terminals { get; private set; }
+
+        public virtual ICollection<AdminInfo> Owners { get; private set; }
+
+        public int MaxWorkOrderNumber { get; set; }
+
+        public ICollection<OrganizationInfo> ParentOrganizations { get; set; }
+
+        public ICollection<OrganizationInfo> ChildOrganizations { get; set; }
+        public string DefaultTemplateId { get; set; }
+        public ICollection<string> ReportTemplateIds { get; set; }
+    }
+}

+ 50 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/Patient.cs

@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class Patients
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+
+        public string IdentityCardId { get; set; }
+
+        public string ImagePath { get; set; }
+
+        public string Nationality { get; set; }
+
+        public string Address { get; set; }
+
+        public byte[] Image { get; set; }
+
+        public DateTime? ExpireDate { get; set; }
+
+        /// <summary>
+        /// Fisrt Name of Patient
+        /// </summary>
+        public string FirstName { get; set; }
+
+        /// <summary>
+        /// Last Name of Patient
+        /// </summary>
+        public string LastName { get; set; }
+
+        /// <summary>
+        /// Birthday of Patient
+        /// </summary>
+        public DateTime? Birthday { get; set; }
+
+        public GenderType GenderType { get; set; }
+
+        public string Mobile { get; set; }
+
+        public string Age { get; set; }
+    }
+}

+ 62 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/PatientInfos.cs

@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class PatientInfos
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+
+        /// <summary>
+        /// Patient Id
+        /// </summary>
+        public string PatientId { get; set; }
+
+        /// <summary>
+        /// Fisrt Name of Patient
+        /// </summary>
+        public string FirstName { get; set; }
+
+        /// <summary>
+        /// Last Name of Patient
+        /// </summary>
+        public string LastName { get; set; }
+
+        /// <summary>
+        /// Birthday of Patient
+        /// </summary>
+        public DateTime? Birthday { get; set; }
+
+        /// <summary>
+        /// True - Male, False - Female
+        /// </summary>
+        public bool? IsMale { get; set; }
+
+        /// <summary>
+        /// Height of patient
+        /// </summary>
+        public double? Height { get; set; }
+
+        /// <summary>
+        /// Weight of patient
+        /// </summary>
+        public double? Weight { get; set; }
+
+        public PatientOBInfo PatientObInfo { get; set; }
+
+        public PatientGYNInfo PatientGynInfo { get; set; }
+
+        public PatientURInfo PatientUrInfo { get; set; }
+
+        public AnimalDetail AnimalDetail { get; set; }
+
+        public string Age { get; set; }
+    }
+}

+ 46 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/PosterConfigs.cs

@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class PosterConfigs
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+        public bool IsDeleted { get; set; }
+        public string Name { get; set; }
+        public string ServiceUrl { get; set; }
+        public PosterWebInterfaceType InterfaceType { get; set; }
+        public bool NeedParsePatientId { get; set; }
+        public int Timeout { get; set; }
+        public PosterImageFormat ImageFormat { get; set; }
+        public IList<string> Terminals { get; set; }
+        public IList<string> Organizations { get; set; }
+        public AdminInfo CreateAdmin { get; set; }
+        public string Template { get; set; }
+    }
+
+    public enum PosterImageFormat
+    {
+        Png,
+        Jpeg,
+        Bmp,
+        Gif
+    }
+
+    public enum PosterWebInterfaceType
+    {
+        ChengZe,
+        Garea,
+        YunZhen,
+        JinYiQiao,
+        WeiYi,
+        BJAid
+    }
+}

+ 59 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/PosterHistories.cs

@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class PosterHistories
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+        public bool IsDeleted { get; set; }
+        public PosterConfigInfo PosterConfig { get; set; }
+
+        public string DiagnoseResultId { get; set; }
+
+        public string PatientId { get; set; }
+
+        public string PatientFirstName { get; set; }
+
+        public string PatientLastName { get; set; }
+
+        public DateTime ReportCreateTime { get; set; }
+
+        public ReportPosterState State { get; set; }
+
+        public string TerminalRecordId { get; set; }
+
+        public string ReportToken { get; set; }
+
+        public EnumOrgans Organ { get; set; }
+    }
+
+    public enum ReportPosterState
+    {
+        UnDo,
+        Successful,
+        Failed
+    }
+
+    internal class PosterConfigInfo
+    {
+        public string ConfigId { get; set; }
+        public string Name { get; set; }
+        public string ServiceUrl { get; set; }
+        public DataPushWebInterfaceType InterfaceType { get; set; }
+    }
+
+    public enum DataPushWebInterfaceType
+    {
+        Data,
+        Video,
+        TerminalData,
+    }
+}

+ 1071 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/ReportInfoResults.cs

@@ -0,0 +1,1071 @@
+using MongoDB.Bson.Serialization.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class ReportInfoResults
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+
+        public string Template { get; set; }
+        public StorageServerInfo StorageServer { get; set; }
+        public IList<ReportInfoElement> ElementCollection { get; set; }
+
+        public IList<ReportInfoMeasrueElement> MeasureElementCollection { get; set; }
+
+        public AdminInfo User { get; set; }
+        public string RecordId { get; set; }
+        public string PatientPerfPhysician { get; set; }
+        public string PatientRefPhysician { get; set; }
+        public string PatientName { get; set; }
+
+        public IList<ImageInfo> PreviewImages { get; set; }
+
+        public IList<string> CustomLabels { get; set; }
+        public EnumOrgans Organ { get; set; }
+        /// <summary>
+        /// 质控状态
+        /// </summary>
+        public QualifiedState QualifiedState { get; set; }
+
+        /// <summary>
+        /// 质控类型
+        /// </summary>
+        public QualityType QualityType { get; set; }
+
+        /// <summary>
+        /// 报告pdf
+        /// </summary>
+        public string ReportPreviewPdf { get; set; }
+
+        /// <summary>
+        /// 报告质控内容
+        /// </summary>
+        public IList<QualityControlData> QualityControlDatas { get; set; }
+    }
+
+    /// <summary>
+    /// 质控数据
+    /// </summary>
+    [BsonKnownTypes]
+    internal class QualityControlData
+    {
+        /// <summary>
+        /// 质控人Id
+        /// </summary>
+        public string ControlPersonId { get; set; }
+
+        /// <summary>
+        /// 质控人
+        /// </summary>
+        public string ControlPersonName { get; set; }
+
+        /// <summary>
+        /// 质控意见
+        /// </summary>
+        public string Opinion { get; set; }
+
+        /// <summary>
+        /// 总评分
+        /// </summary>
+        public double Score { get; set; }
+
+        /// <summary>
+        /// 指控评分项
+        /// </summary>
+        public IList<QualityControlScoreItem> ScoreItems { get; set; }
+
+        /// <summary>
+        /// 质控时间
+        /// </summary>
+        public DateTime ControlTime { get; set; }
+    }
+
+    /// <summary>
+    /// 指控评分项
+    /// </summary>
+    internal class QualityControlScoreItem
+    {
+        /// <summary>
+        /// 评分项顺序
+        /// </summary>
+        public int Sort { get; set; }
+
+        /// <summary>
+        /// 评分
+        /// </summary>
+        public double Score { get; set; }
+    }
+
+    public enum QualityType
+    {
+        None = 0,
+        Qualified = 1,
+        InformationUnCompleted = 2,
+        ImageNotClear = 3,
+        PositiveSiteNotClear = 4
+    }
+
+    public enum QualifiedState
+    {
+        UnSet = 0,
+        Qualified,
+        UnQualified
+    }
+
+    internal class ImageInfo
+    {
+        public string Name { get; set; }
+        public ImageType Type { get; set; }
+
+        public string ExamDataId { get; set; }
+
+    }
+    public enum ImageType
+    {
+        Local = 1,
+        Ob,
+        WorkSheet,
+        Remote,
+        DigitalSignature,
+        AIDiagnosis
+    }
+
+    internal class ReportInfoMeasrueElement
+    {
+        public ElementTag ElementTag { get; set; }
+        public IList<ReportMeasureValueElement> ElementCollection { get; set; }
+
+    }
+
+    internal class ReportMeasureValueElement
+    {
+        public MeasureTag MeasureTag { get; set; }
+        public TextElementValue ElementValue { get; set; }
+    }
+
+    internal class TextElementValue: ElementValue
+    {
+        public TextElementValue()
+        {
+            ElementValueType = ElementValueTypes.String;
+        }
+        public TextElementValue(string value)
+        {
+            Value = value;
+            ElementValueType = ElementValueTypes.String;
+        }
+    }
+
+    internal class IntegerElementValue : ElementValue
+    {
+        public IntegerElementValue()
+        {
+
+        }
+        public IntegerElementValue(int value)
+        {
+            Value = value;
+            ElementValueType = ElementValueTypes.Integer;
+        }
+
+    }
+
+    internal class DateTimeElementValue : ElementValue
+    {
+        public DateTimeElementValue()
+        {
+
+        }
+        public DateTimeElementValue(DateTime? dateTime)
+        {
+            Value = dateTime;
+            ElementValueType = ElementValueTypes.Datetime;
+        }
+    }
+
+    internal class FloatElementValue : ElementValue
+    {
+        public FloatElementValue()
+        {
+        }
+        public FloatElementValue(float value)
+        {
+            ElementValueType = ElementValueTypes.Float;
+            Value = value;
+        }
+    }
+
+    class FileImageValue : ElementValue
+    {
+        public string ExamDataId { get; set; }
+
+        public FileImageValue()
+        {
+        }
+        public FileImageValue(string value, string examDataId)
+        {
+            Value = value;
+            ExamDataId = examDataId;
+            ElementValueType = ElementValueTypes.FileImage;
+        }
+    }
+
+    class BufferImageValue : ElementValue
+    {
+        public BufferImageValue()
+        {
+
+        }
+        public BufferImageValue(byte[] value)
+        {
+            Value = value;
+            ElementValueType = ElementValueTypes.BufferImage;
+        }
+    }
+
+    internal class ImageListElementValue : ElementValue
+    {
+        public ImageListElementValue()
+        {
+
+        }
+        public ImageListElementValue(List<FileImageValue> value)
+        {
+            Value = value;
+            ElementValueType = ElementValueTypes.ImageList;
+        }
+    }
+
+    internal class StringListElementValue : ElementValue
+    {
+        public StringListElementValue()
+        {
+
+        }
+        public StringListElementValue(List<TextElementValue> value)
+        {
+            Value = value;
+            ElementValueType = ElementValueTypes.StringList;
+        }
+    }
+
+    public enum ElementValueTypes
+    {
+        String,
+        Integer,
+        Float,
+        Datetime,
+        FileImage,
+        BufferImage,
+        ImageList,
+        StringList
+    }
+
+    public class MeasureTag
+    {
+        public const string ReportTemplatePrefix = "ReportTemplate.";
+
+        public string[] AvailableMethods
+        {
+            get => InternalAvailableMethods.ToArray();
+            set => InternalAvailableMethods = value == null ? null : new SortedSet<string>(value);
+        }
+
+        public string BaseType { get; set; }
+
+        public string CalculationId { get; set; }
+        private SortedSet<string> _internalAvailableMethods;
+        private SortedSet<string> InternalAvailableMethods
+        {
+            get => _internalAvailableMethods ?? new SortedSet<string>();
+            set => _internalAvailableMethods = value;
+        }
+
+        public bool IsCustomize => UserId?.StartsWith(ReportTemplatePrefix) ?? false;
+
+        public string MatchId { get; set; }
+
+        public string Method { get; set; }
+
+        public string Mode { get; set; }
+
+        public string Output { get; set; }
+
+        public string OutputV2 { get; set; }
+
+        public string Unit { get; set; }
+
+        public string UserId { get; set; }
+
+        public string UserIdWithoutPrefix => UserId?.Replace(ReportTemplatePrefix, "");
+
+        public string MeasureResultType { get; set; }
+
+    }
+
+    internal class ReportInfoElement
+    {
+        public ElementTag ElementTag { get; set; }
+        public ElementValue ElementValue { get; set; }
+        public ReportInfoElement()
+        {
+
+        }
+
+        public ReportInfoElement(ElementTag elementTag, ElementValue elementValue)
+        {
+            ElementTag = elementTag;
+            ElementValue = elementValue;
+        }
+    }
+    [BsonKnownTypes(typeof(TextElementValue), typeof(IntegerElementValue), typeof(DateTimeElementValue),
+    typeof(FloatElementValue), typeof(FileImageValue), typeof(BufferImageValue), typeof(ImageListElementValue),
+    typeof(StringListElementValue))]
+    internal class ElementValue
+    {
+        public object? Value { get; set; }
+        public ElementValueTypes ElementValueType { get; set; }
+    }
+
+    public enum ElementTagType
+    {
+        General,
+        DiagnosticEntry
+    }
+
+    public class ElementTag : IEquatable<ElementTag>
+    {
+        public static ElementTag PatientTable =
+         new ElementTag("9pbbaa61-a91d-4399-a3f4-df29117d2d59", "PatientTable", true);
+
+        /// <summary>
+        /// Specifies PatientId tag.
+        /// </summary>
+        public static ElementTag PatientId = new ElementTag("90bbaa61-a91d-4399-a3f4-df29117d2d59", "PatientId", true);
+
+        /// <summary>
+        /// Specifies PatientName tag.
+        /// </summary>
+        public static ElementTag PatientName =
+            new ElementTag("91bbaa61-a91d-4399-a3f4-df29117d2d59", "PatientName", true);
+
+        /// <summary>
+        /// Specifies PatientAge tag.
+        /// </summary>
+        public static ElementTag PatientAge =
+            new ElementTag("92bbaa61-a91d-4399-a3f4-df29117d2d59", "PatientAge", true);
+
+        /// <summary>
+        /// Specifies PatientGender tag.
+        /// </summary>
+        public static ElementTag PatientGender =
+            new ElementTag("93bbaa61-a91d-4399-a3f4-df29117d2d59", "PatientGender", true);
+
+        /// <summary>
+        /// Specifies PatientNation phone number.
+        /// </summary>
+        public static ElementTag PatientPhoneNumber =
+            new ElementTag("94bbaa61-a91d-4399-a3f4-df29117d2d59", "PatientPhoneNumber", true);
+
+        /// <summary>
+        /// Specifies PatientExamDate tag.
+        /// </summary>
+        public static ElementTag PatientExamDate =
+            new ElementTag("95bbaa61-a91d-4399-a3f4-df29117d2d59", "PatientExamDate", true);
+
+        /// <summary>
+        /// Specifies PatientInspectionItems tag.
+        /// </summary>
+        public static ElementTag PatientInspectionItems =
+            new ElementTag("96baa61-a91d-4399-a3f4-df29117d2d59", "PatientInspectionItems", true);
+
+        /// <summary>
+        /// Specifies PatientLMP tag.
+        /// </summary>
+        public static ElementTag PatientLMP = new ElementTag("97baa61-a91d-4399-a3f4-df29117d2d59", "PatientLMP", true);
+
+        /// <summary>
+        /// Specifies PatientGA tag.
+        /// </summary>
+        public static ElementTag PatientGA = new ElementTag("98bbaa61-a91d-4399-a3f4-df29117d2d59", "PatientGA", true);
+
+        /// <summary>
+        /// Specifies PatientEDD tag.
+        /// </summary>
+        public static ElementTag PatientEDD =
+            new ElementTag("99bbaa61-a91d-4399-a3f4-df29117d2d59", "PatientEDD", true);
+
+        /// <summary>
+        /// Specifies PatientPerfPhysician tag.
+        /// </summary>
+        public static ElementTag PatientPerfPhysician =
+            new ElementTag("9abbaa61-a91d-4399-a3f4-df29117d2d59", "PatientPerfPhysician", true);
+
+        /// <summary>
+        /// Specifies PatientInspectionSite tag.
+        /// </summary>
+        public static ElementTag PatientInspectionSite =
+            new ElementTag("9bbbaa61-a91d-4399-a3f4-df29117d2d59", "PatientInspectionSite", true);
+
+        /// <summary>
+        /// Specifies disease name tag.
+        /// </summary>
+        public static ElementTag DiseaseName =
+            new ElementTag("9bbbaa61-a91d-4399-a3f4-df29117d2d59", "DiseaseName", true);
+
+        /// <summary>
+        /// Specifies conclusion tag.
+        /// </summary>
+        public static ElementTag Conclusion =
+            new ElementTag("9bbbaa61-a91d-4399-a3f4-df29117d2d59", "Conclusion", true);
+
+        /// <summary>
+        /// Specifies PatientExaminationWay tag.
+        /// </summary>
+        public static ElementTag PatientExaminationWay =
+            new ElementTag("9cbbaa61-a91d-4399-a3f4-df29117d2d59", "PatientExaminationWay", true);
+
+        /// <summary>
+        /// Specifies ReportDescription tag.
+        /// </summary>
+        public static ElementTag ReportDescription =
+            new ElementTag("9dbbaa61-a91d-4399-a3f4-df29117d2d59", "ReportDescription", true, ElementTagType.DiagnosticEntry);
+
+        /// <summary>
+        /// Specifies ReportSummary tag.
+        /// </summary>
+        public static ElementTag ReportSummary =
+            new ElementTag("9ebbaa61-a91d-4399-a3f4-df29117d2d59", "ReportSummary", true, ElementTagType.DiagnosticEntry);
+
+        public static ElementTag DescriptionOfRemoteConsultationPatients =
+            new ElementTag("d62a4a9c-0ad7-4c56-8b45-c3eff679b45b", "DescriptionOfRemoteConsultationPatients", true);
+
+        /// <summary>
+        /// Specifies ReportImages tag.
+        /// </summary>
+        public static ElementTag ReportImages =
+            new ElementTag("9fbbaa61-a91d-4399-a3f4-df29117d2d59", "ReportImages", true);
+
+        /// <summary>
+        /// Specifies Signature tag.
+        /// </summary>
+        public static ElementTag DigitalSignature =
+            new ElementTag("53545af1-59b7-41a8-9bd5-bdba1aaf9891", "DigitalSignature", true);
+        /// <summary>
+        /// Specifies ReportOBGraph tag.
+        /// </summary>
+        public static ElementTag ReportOBGraph =
+            new ElementTag("9a0baa61-a91d-4399-a3f4-df29117d2d59", "ReportOBGraph", true);
+
+        /// <summary>
+        /// Specifies ReportWorkSheet tag.
+        /// </summary>
+        public static ElementTag ReportWorkSheet =
+            new ElementTag("9a1baa61-a91d-4399-a3f4-df29117d2d59", "ReportWorkSheet", true);
+
+        /// <summary>
+        /// Specifies ReportWorkSheet tag.
+        /// </summary>
+        public static ElementTag ReportNormalValueTips =
+            new ElementTag("9b1baa61-a91d-4399-a3f4-df29117d2d59", "ReportNormalValueTips", true);
+
+        /// <summary>
+        /// Specifies PatientCheckNumber tag.
+        /// </summary>
+        public static ElementTag PatientCheckNumber =
+            new ElementTag("9a2baa61-a91d-4399-a3f4-df29117d2d59", "PatientCheckNumber", true);
+
+        /// <summary>
+        /// Specifies PatientHeight tag.
+        /// </summary>
+        public static ElementTag PatientApplicationDepartment = new ElementTag("9a3baa61-a91d-4399-a3f4-df29117d2d59",
+            "PatientApplicationDepartment", true);
+
+        /// <summary>
+        /// Specifies RecordId tag.
+        /// </summary>
+        public static ElementTag RecordId = new ElementTag("9a4baa61-a91d-4399-a3f4-df29117d2d59", "RecordId", true);
+
+        /// <summary>
+        /// Specifies ExamId tag.
+        /// </summary>
+        public static ElementTag ExamId = new ElementTag("9a5baa61-a91d-4399-a3f4-df29117d2d59", "ExamId", true);
+
+        /// <summary>
+        /// Specifies update time.
+        /// </summary>
+        public static ElementTag UpdateTime =
+            new ElementTag("9a6baa61-a91d-4399-a3f4-df29117d2d59", "UpdateTime", true);
+
+        /// <summary>
+        /// Specifies update time.
+        /// </summary>
+        public static ElementTag CreateUserId =
+            new ElementTag("9a7baa61-a91d-4399-a3f4-df29117d2d59", "CreateUserId", true);
+
+        public static ElementTag CreateUserName =
+            new ElementTag("9b7baa61-a91d-4399-a3f4-df29117d2d59", "CreateUserName", true);
+
+        public static ElementTag CreateUserFirstName =
+            new ElementTag("9c7baa61-a91d-4399-a3f4-df29117d2d59", "CreateUserFirstName", true);
+
+        public static ElementTag CreateUserLastName =
+            new ElementTag("9d7baa61-a91d-4399-a3f4-df29117d2d59", "CreateUserLastName", true);
+
+        public static ElementTag CreateUserNickName =
+            new ElementTag("9e7baa61-a91d-4399-a3f4-df29117d2d59", "CreateUserNickName", true);
+
+        /// <summary>
+        /// Specifies create time.
+        /// </summary>
+        public static ElementTag CreateTime =
+            new ElementTag("9a8baa61-a91d-4399-a3f4-df29117d2d59", "CreateTime", true);
+
+        /// <summary>
+        /// Specifies report type.
+        /// </summary>
+        public static ElementTag ReportType =
+            new ElementTag("9a9baa61-a91d-4399-a3f4-df29117d2d59", "ReportType", true);
+
+        /// <summary>
+        /// Specifies report type.
+        /// </summary>
+        public static ElementTag PatientBirthday =
+            new ElementTag("9aabaa61-a91d-4399-a3f4-df29117d2d59", "PatientBirthday", true);
+
+        /// <summary>
+        /// Specifies PatientDeviceNumber tag.
+        /// </summary>
+        public static ElementTag PatientDeviceNumber =
+            new ElementTag("1abbaa61-a91d-4399-a3f4-df29117d2d59", "PatientDeviceNumber", true);
+
+        /// <summary>
+        /// Specifies PatientDeviceNumber tag.
+        /// </summary>
+        public static ElementTag PatientOutpatientNumber =
+            new ElementTag("2abbaa61-a91d-4399-a3f4-df29117d2d59", "PatientOutpatientNumber", true);
+
+        /// <summary>
+        /// Specifies PatientUltrasonicNumber tag.
+        /// </summary>
+        public static ElementTag PatientUltrasonicNumber =
+            new ElementTag("3abbaa61-a91d-4399-a3f4-df29117d2d59", "PatientUltrasonicNumber", true);
+
+        /// <summary>
+        /// Specifies ReportTime tag.
+        /// </summary>
+        public static ElementTag ReportTime =
+            new ElementTag("4abbaa61-a91d-4399-a3f4-df29117d2d59", "ReportTime", true);
+
+        /// <summary>
+        /// Specifies ConsultationNumber tag.
+        /// </summary>
+        public static ElementTag ConsultationNumber =
+            new ElementTag("1acgaa61-a91d-4397-a3f4-df29144d2d55", "ConsultationNumber", true);
+
+        /// <summary>
+        /// Specifies ReportPhysician tag.
+        /// </summary>
+        public static ElementTag ReportPhysician =
+            new ElementTag("5abbaa61-a91d-4399-a3f4-df29117d2d59", "ReportPhysician", true);
+
+        /// <summary>
+        /// Specifies InspectionPhysician tag.
+        /// </summary>
+        public static ElementTag InspectionPhysician =
+            new ElementTag("6abbaa61-a91d-4399-a3f4-df29117d2d59", "InspectionPhysician", true);
+
+        public static ElementTag ScanPhysician =
+            new ElementTag("26f81427-613d-456a-8a45-7af401d6943a", "ScanPhysician", true);
+
+        public static ElementTag OrganizationInformation =
+            new ElementTag("7382eee6-9b1b-498d-af26-e22ce26a0325", "OrganizationInformation", true);
+
+        /// <summary>
+        /// Specifies HospitalName tag.
+        /// </summary>
+        public static ElementTag HospitalName =
+            new ElementTag("7abbaa61-a91d-4399-a3f4-df29117d2d59", "HospitalName", true);
+
+        /// <summary>
+        /// Specifies HospitalDepartment tag.
+        /// </summary>
+        public static ElementTag HospitalDepartment =
+            new ElementTag("9E4D1A91-44D6-46AE-AF29-34FFCB6A34A9", "HospitalDepartment", true);
+
+        /// <summary>
+        /// Specifies HospitalAddress tag.
+        /// </summary>
+        public static ElementTag HospitalAddress =
+            new ElementTag("A8BF19D0-556C-4C32-B5CB-41EA30027505", "HospitalAddress", true);
+
+        /// <summary>
+        /// Specifies PerformingPhysician tag.
+        /// </summary>
+        public static ElementTag PerformingPhysician =
+            new ElementTag("48EE0F65-B86C-4591-BDAB-14D46EEB4C30", "PerformingPhysician", true);
+
+        /// <summary>
+        /// Specifies ReferringPhysician tag.
+        /// </summary>
+        public static ElementTag ReferringPhysician =
+            new ElementTag("BD4049E6-6847-46FA-A70E-991533BC67F7", "ReferringPhysician", true);
+
+        /// <summary>
+        /// Specifies ObInfo tag.
+        /// </summary>
+        public static ElementTag ObInfo = new ElementTag("877FAFEA-4E47-4E76-A93F-10950B9ABA1A", "ObInfo", true);
+
+        /// <summary>
+        /// Specifies ZScore tag.
+        /// </summary>
+        public static ElementTag ZScore = new ElementTag("CF8D47A2-B3F0-4BD7-B366-B1B44B63D82A", "ZScore", true);
+
+        /// <summary>
+        /// Specifies Fetal Biophysical Score tag.
+        /// </summary>
+        public static ElementTag FetalBiophysicalScore =
+            new ElementTag("157017B8-6FC5-4677-9818-605601D907AC", "FetalBiophysicalScore", true);
+
+        /// <summary>
+        /// Specifies Follicle2D tag.
+        /// </summary>
+        public static ElementTag Follicle =
+            new ElementTag("5347554A-084E-40AB-A7D4-941085B61A84", "Follicle", true);
+
+        /// <summary>
+        /// Specifies AutoFollicle tag.
+        /// </summary>
+        public static ElementTag AutoFollicle =
+            new ElementTag("B38D4CE8-5B1B-4432-8474-EDF70A3FF6CF", "AutoFollicle", true);
+
+        /// <summary>
+        /// Specifies AutoFollicleImages tag.
+        /// </summary>
+        public static ElementTag AutoFollicleImages = new ElementTag("019EA88D-58F0-4639-809D-A5A524DADFC1", "AutoFollicleImages", true);
+
+        /// <summary>
+        /// Specifies AutoFollicle3D tag.
+        /// </summary>
+        public static ElementTag AutoFollicle3D =
+            new ElementTag("66A8781E-9F2B-42B9-997E-A40BDA3C3728", "AutoFollicle3D", true);
+
+        /// <summary>
+        /// Specifies AutoFollicle3DImages tag.
+        /// </summary>
+        public static ElementTag AutoFollicle3DImages = new ElementTag("0E696819-AE15-4AC4-81A4-645A2F53F958", "AutoFollicle3DImages", true);
+
+        /// <summary>
+        /// Specifies AutoOvary tag.
+        /// </summary>
+        public static ElementTag AutoOvary = new ElementTag("5195679C-ED36-4C9E-8106-7B1CD9C181C9", "AutoOvary", true);
+
+        /// <summary>
+        /// Specifies AutoOvaryImages tag.
+        /// </summary>
+        public static ElementTag AutoOvaryImages = new ElementTag("DBECDD4C-5080-4EA5-A2A7-1A7A2FCAC2A9", "AutoOvaryImages", true);
+
+        /// <summary>
+        /// Specifies WMS tag.
+        /// </summary>
+        public static ElementTag Wms = new ElementTag("5B810BC6-6101-4F90-83CE-D31BDE97A07B", "WMS", true);
+
+        /// <summary>
+        /// Specifies StrainRate tag.
+        /// </summary>
+        public static ElementTag StrainRate =
+            new ElementTag("3B466E45-070E-41DF-A00D-D96D5797C85F", "StrainRate", true);
+
+        /// <summary>
+        /// Specifies ReproSummary tag.
+        /// </summary>
+        public static ElementTag ReproSummary = new ElementTag("DFB8A17B-310D-4B14-9F4F-A16E2F500084", "ReproSummary", true);
+
+        /// <summary>
+        /// Specifies GestationalAgeOriginDescription tag.
+        /// </summary>
+        public static ElementTag GestationalAgeOriginDescription =
+            new ElementTag("F46A48B1-96BB-475E-8EF7-5CBFF22AAECB", "GestationalAgeOriginDescription", true);
+
+        /// <summary>
+        /// Specifies GestationalAgeOriginValue tag.
+        /// </summary>
+        public static ElementTag GestationalAgeOriginValue =
+            new ElementTag("9569465B-FCCB-4E04-8B6B-D4624224722D", "GestationalAgeOriginValue", true);
+
+        /// <summary>
+        /// Specifies Owner tag.
+        /// </summary>
+        public static ElementTag Owner = new ElementTag("DB1202FB-51DF-4EB7-903A-2F6740CAD74B", "Owner", true);
+
+        /// <summary>
+        /// Specifies Species tag.
+        /// </summary>
+        public static ElementTag Species = new ElementTag("FC5F7564-B63F-4185-8E1C-FC4BC5046332", "Species", true);
+
+        /// <summary>
+        /// Specifies Breed tag.
+        /// </summary>
+        public static ElementTag Breed = new ElementTag("B7631C99-706A-48D8-A6DF-1C11F90106C9", "Breed", true);
+
+        /// <summary>
+        /// Specifies FetusA tag.
+        /// </summary>
+        public static ElementTag FetusA = new ElementTag("4D916526-9947-4EDE-8630-337632A35627", "FetusA", true);
+
+        /// <summary>
+        /// Specifies FetusB tag.
+        /// </summary>
+        public static ElementTag FetusB = new ElementTag("B5A2AAE5-4DDB-4945-9515-82DB367B04F2", "FetusB", true);
+
+        /// <summary>
+        /// Specifies FetusC tag.
+        /// </summary>
+        public static ElementTag FetusC = new ElementTag("35C22E6B-D15E-43CD-88F9-99AA79C3575D", "FetusC", true);
+
+        /// <summary>
+        /// Specifies FetusD tag.
+        /// </summary>
+        public static ElementTag FetusD = new ElementTag("24498307-BB99-458B-8EC0-AC8434DE491D", "FetusD", true);
+
+        /// <summary>
+        /// Specifies FetusE tag.
+        /// </summary>
+        public static ElementTag FetusE = new ElementTag("AEC6FDB6-1CD4-4C43-896A-2E914B837545", "FetusE", true);
+
+        /// <summary>
+        /// Specifies Patient Height.
+        /// </summary>
+        public static ElementTag PatientHeight =
+            new ElementTag("9556EA12-CFB3-4AD5-8717-1057D1D5A3EE", "PatientHeight", true);
+
+        /// <summary>
+        /// Specifies Patient Weight.
+        /// </summary>
+        public static ElementTag PatientWeight =
+            new ElementTag("0003B8C3-397C-4688-985D-55B757E3855D", "PatientWeight", true);
+
+        /// <summary>
+        /// Specifies BSA.
+        /// </summary>
+        public static ElementTag BSA = new ElementTag("5AAC30D9-FCE3-4FD0-998C-3A9E2D54F312", "BSA", true);
+
+        /// <summary>
+        /// Specifies AB.
+        /// </summary>
+        public static ElementTag AB = new ElementTag("EA33699C-E86D-497B-A9A9-B8AFAF4A11C7", "AB", true);
+
+        /// <summary>
+        /// Specifies Ectopic.
+        /// </summary>
+        public static ElementTag Ectopic = new ElementTag("5B2BF3CE-62B2-4BE8-8685-29DB9A62465B", "Ectopic", true);
+
+        /// <summary>
+        /// Specifies Gravida.
+        /// </summary>
+        public static ElementTag Gravida = new ElementTag("04FA2451-BDD0-45E4-931B-3D01E95123E0", "Gravida", true);
+
+        /// <summary>
+        /// Specifies Para.
+        /// </summary>
+        public static ElementTag Para = new ElementTag("96C987B0-D0C3-445B-BD45-CB10A276E6D7", "Para", true);
+
+        /// <summary>
+        /// Specifies PSA.
+        /// </summary>
+        public static ElementTag PSA = new ElementTag("3969C8BE-7715-4423-919E-51D6EBEBFA8E", "PSA", true);
+
+        /// <summary>
+        /// Specifies PPSACoefficient.
+        /// </summary>
+        public static ElementTag PPSACoefficient =
+            new ElementTag("C64CC111-3557-4B29-ACBF-678816235694", "PPSACoefficient", true);
+
+        /// <summary>
+        /// Specifies BMI.
+        /// </summary>
+        public static ElementTag BMI = new ElementTag("91D8F2DE-331F-49E5-95C0-1AEF9D566185", "BMI", true);
+
+        /// <summary>
+        /// Specifies HR.
+        /// </summary>
+        public static ElementTag HR = new ElementTag("33D46E3F-A089-4B0A-8D1D-F4C7556BD62D", "HR", true);
+
+        /// <summary>
+        /// Specifies SBP.
+        /// </summary>
+        public static ElementTag SBP = new ElementTag("EFB98909-D077-4650-9235-B4C9EA111BA3", "SBP", true);
+
+        /// <summary>
+        /// Specifies DBP.
+        /// </summary>
+        public static ElementTag DBP = new ElementTag("BFEE3EE4-E98E-4981-9A55-80761F3903CD", "DBP", true);
+
+        /// <summary>
+        /// Specifies FetusNumber.
+        /// </summary>
+        public static ElementTag FetusNumber =
+            new ElementTag("5E0FFEF1-1A67-44D2-BF3D-527F27FCC171", "FetusNumber", true);
+
+        /// <summary>
+        /// Specifies Operator
+        /// </summary>
+        public static ElementTag Operator = new ElementTag("0FC1FC7D-2D87-4C6C-A54B-3033B8DB922B", "Operator", true);
+
+        /// <summary>
+        /// Specifies SecondId
+        /// </summary>
+        public static ElementTag SecondId = new ElementTag("B57E11C6-1DA4-4119-810D-F823AB42D86D", "SecondId", true);
+
+        /// <summary>
+        /// Specifies Operator
+        /// </summary>
+        public static ElementTag AccessionNumber =
+            new ElementTag("21B58982-52C6-4F79-B9B2-57BD109F42A1", "AccessionNumber", true);
+
+        /// <summary>
+        /// Specifies PatientUniqueCode
+        /// </summary>
+        public static ElementTag PatientUniqueCode =
+            new ElementTag("43D40A8E-16FA-4528-B69D-C160F9B24AD5", "PatientUniqueCode", true);
+
+        public static ElementTag History =
+            new ElementTag("12340A8E-16FA-4528-B69D-C160F9B24AD5", "History", true);
+
+        public static ElementTag PatientPresentation =
+            new ElementTag("CD340A8E-16FA-4321-B69D-C140F9F24AD5", "PatientPresentation", true);
+
+        public static ElementTag PatientInspectionSiteSingle =
+            new ElementTag("CD340A5E-16FA-4321-B79D-C14012F24AD5", "PatientInspectionSiteSingle", true);
+
+        public static ElementTag AIIndexFlag =
+          new ElementTag("11340A5E-15FA-4321-B79D-C13212F24AD5", "AIIndexFlag", false);
+
+        public static ElementTag EditReporttime =
+         new ElementTag("2340A5E-16FA-4321-B79D-C14412F24AD5", "EditReporttime", false);
+
+        public static ElementTag ContactAddress = new ElementTag("A2340A5E-16FA-4321-B79D-C14412F24AD5", "ContactAddress", true);
+        public static ElementTag PatientSource = new ElementTag("B2340A5E-16FA-4321-B79D-C14412F24AD5", "PatientSource", true);
+        public static ElementTag ADNumber = new ElementTag("C2340A5E-16FA-4321-B79D-C14412F24AD5", "ADNumber", true);
+        public static ElementTag BedNumber = new ElementTag("D2340A5E-16FA-4321-B79D-C14412F24AD5", "BedNumber", true);
+        public static ElementTag ExamType = new ElementTag("E2340A5E-16FA-4321-B79D-C14412F24AD5", "ExamType", true);
+        public static ElementTag InspectionDepartment = new ElementTag("F2340A5E-16FA-4321-B79D-C14412F24AD5", "InspectionDepartment", true);
+
+        public static ElementTag LeftTumor = new ElementTag("F4340A5E-16FA-4521-B79D-C14412F24AD5", "LeftTumor", true);
+        public static ElementTag RightTumor = new ElementTag("F4340A5E-16FA-A321-B79D-C14412F24AD5", "RightTumor", true);
+
+
+        public static ElementTag ApplyForHospital = new ElementTag("d02481bc-c9fb-4514-a757-1b6cf1528186", "ApplyForHospital", true);
+
+        public static ElementTag ConsultationHospital = new ElementTag("53a84c3d-a374-4902-aba3-f226a4e8d01a", "ConsultationHospital", true);
+
+        public static List<ElementTag> FetusTags = new List<ElementTag>
+        {
+            FetusA,
+            FetusB,
+            FetusC,
+            FetusD,
+            FetusE,
+        };
+
+        /// <summary>
+        /// The default tags for RTTable.
+        /// </summary>
+        public static IEnumerable<ElementTag> DefaultTableTags = new List<ElementTag>(FetusTags)
+        {
+            ObInfo,
+            ZScore,
+            ReportWorkSheet,
+            FetalBiophysicalScore,
+            Follicle,
+            AutoFollicle,
+            AutoFollicle3D,
+            AutoOvary,
+            Wms,
+            StrainRate,
+            ReproSummary,
+            ReportNormalValueTips,
+        };
+
+        /// <summary>
+        /// The default tags.
+        /// </summary>
+        public static IEnumerable<ElementTag> DefaultTags = new List<ElementTag>(FetusTags)
+        {
+            HospitalName,
+            PatientId,
+            PatientName,
+            PatientAge,
+            PatientGender,
+            PatientPhoneNumber,
+            PatientGA,
+            PatientEDD,
+            PatientLMP,
+            PatientExamDate,
+            PatientInspectionItems,
+            PatientInspectionSite,
+            DiseaseName,
+            Conclusion,
+            PatientExaminationWay,
+            PatientCheckNumber,
+            PatientApplicationDepartment,
+            PatientPerfPhysician,
+            PatientDeviceNumber,
+            PatientOutpatientNumber,
+            PatientUltrasonicNumber,
+            ReportDescription,
+            ReportSummary,
+            ReportImages,
+            ReportOBGraph,
+            ReportWorkSheet,
+            PatientBirthday,
+            ReportTime,
+            ReportPhysician,
+            InspectionPhysician,
+            HospitalDepartment,
+            HospitalAddress,
+            ReferringPhysician,
+            PerformingPhysician,
+            ObInfo,
+            ZScore,
+            FetalBiophysicalScore,
+            Follicle,
+            AutoFollicle,
+            AutoFollicleImages,
+            AutoFollicle3D,
+            AutoFollicle3DImages,
+            AutoOvary,
+            AutoOvaryImages,
+            Wms,
+            StrainRate,
+            ReproSummary,
+            GestationalAgeOriginDescription,
+            GestationalAgeOriginValue,
+            Owner,
+            Species,
+            Breed,
+            PatientHeight,
+            PatientWeight,
+            BSA,
+            AB,
+            Ectopic,
+            Para,
+            PSA,
+            PPSACoefficient,
+            BMI,
+            HR,
+            SBP,
+            DBP,
+            FetusNumber,
+            Operator,
+            PatientUniqueCode,
+            History,
+            PatientPresentation,
+            PatientInspectionSiteSingle,
+            ConsultationNumber,
+            ContactAddress,
+            PatientSource,
+            ADNumber,
+            BedNumber,
+            ExamType,
+            InspectionDepartment,
+            LeftTumor,
+            RightTumor,
+            ScanPhysician,
+            DigitalSignature,
+            DescriptionOfRemoteConsultationPatients,
+            ApplyForHospital,
+            ConsultationHospital,
+            OrganizationInformation
+        };
+
+        /// <summary>
+        /// Gets or sets the input tag id.
+        /// </summary>
+        public string Id { get; private set; }
+
+        /// <summary>
+        /// Ges the input tag name.e.g. PatientName, ReportDescription
+        /// </summary>
+        public string Name { get; private set; }
+        public string DisplayName { get; set; }
+
+        /// <summary>
+        /// Gets the value to indicate whether the element tag is default or added by user.
+        /// </summary>
+        public bool IsDefault { get; private set; }
+
+        /// <summary>
+        /// Gets the element tag type.
+        /// </summary>
+        public ElementTagType ElementTagType { get; private set; }
+
+        /// <summary>
+        /// Initialize <see cref="ElementTag"/>
+        /// </summary>
+        /// <param name="id">The element tag id.</param>
+        /// <param name="name">The element tag name.</param>
+        /// <param name="isDefault">The value to indicate whether the tag is default or not.</param>
+        public ElementTag(string id, string name, bool isDefault, ElementTagType elementTagType = ElementTagType.General, string displayName = "")
+        {
+            Id = id;
+            Name = name;
+            IsDefault = isDefault;
+            ElementTagType = elementTagType;
+            DisplayName = displayName;
+        }
+
+        /// <summary>
+        /// Tests whether the specified <see cref="ElementTag"/> structure is identical to this tag.
+        /// </summary>
+        /// <param name="other">The <see cref="ElementTag" /> structure to compare to the current structure.</param>
+        /// <returns>If the specified <see cref="ElementTag"/> structure is identical to the current structure, returns true; otherwise, returns false.</returns>
+        public bool Equals(ElementTag other)
+        {
+            if (other == null)
+            {
+                return false;
+            }
+
+            return string.Equals(Id, other.Id) && string.Equals(Name, other.Name);
+        }
+
+        /// <summary>
+        /// Tests whether the specified object is a <see cref="ElementTag" /> structure and is equivalent to this tag.
+        /// </summary>
+        /// <param name="obj">The object to compare to this <see cref="ElementTag" /> structure.</param>
+        /// <returns>If the specified object is a <see cref="ElementTag"/> structure and is identical to the current structure, returns true; otherwise, returns false. </returns>
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            return obj is ElementTag && Equals((ElementTag)obj);
+        }
+
+        /// <summary>
+        /// Returns the hash code for this instance.
+        /// </summary>
+        /// <returns>A hash code for the current <see cref="ElementTag" />.</returns>
+        public override int GetHashCode()
+        {
+            unchecked
+            {
+                return ((Id != null ? Id.GetHashCode() : 0) * 397) ^ (Name != null ? Name.GetHashCode() : 0);
+            }
+        }
+
+        public override string ToString()
+        {
+            return Name;
+        }
+    }
+}

+ 56 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/ReportInfoResultsBak.cs

@@ -0,0 +1,56 @@
+using MongoDB.Bson.Serialization.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class ReportInfoResultsBak
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+
+        public string Template { get; set; }
+        public StorageServerInfo StorageServer { get; set; }
+        public IList<ReportInfoElement> ElementCollection { get; set; }
+
+        public IList<ReportInfoMeasrueElement> MeasureElementCollection { get; set; }
+
+        public AdminInfo User { get; set; }
+        public string RecordId { get; set; }
+        public string PatientPerfPhysician { get; set; }
+        public string PatientRefPhysician { get; set; }
+        public string PatientName { get; set; }
+
+        public IList<ImageInfo> PreviewImages { get; set; }
+
+        public IList<string> CustomLabels { get; set; }
+        public EnumOrgans Organ { get; set; }
+        /// <summary>
+        /// 质控状态
+        /// </summary>
+        public QualifiedState QualifiedState { get; set; }
+
+        /// <summary>
+        /// 质控类型
+        /// </summary>
+        public QualityType QualityType { get; set; }
+
+        /// <summary>
+        /// 报告pdf
+        /// </summary>
+        public string ReportPreviewPdf { get; set; }
+
+        /// <summary>
+        /// 报告质控内容
+        /// </summary>
+        public IList<QualityControlData> QualityControlDatas { get; set; }
+    }
+
+}

+ 41 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/StorageFileInfoes.cs

@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class StorageFileInfoes
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+        /// <summary>
+        /// Internal url for storage server
+        /// </summary>
+        public string InternalUrl { get; set; }
+
+        /// <summary>
+        /// Gets the Token of this StorageFile.
+        /// </summary>
+        public string Token { get; set; }
+
+        /// <summary>
+        /// Gets the Path of this StorageFile.
+        /// </summary>
+        public string FileName { get; set; }
+
+        /// <summary>
+        /// Gets the folder name of file.
+        /// </summary>
+        public string FolderName { get; set; }
+
+        /// <summary>
+        /// Gets the sub folder name of file.
+        /// </summary>
+        public string SubFolderName { get; set; }
+    }
+}

+ 36 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/TerminalAIDataExcuteRecords.cs

@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class TerminalAIDataExcuteRecords
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+
+        /// <summary>
+        /// TerminalData Id
+        /// </summary>
+        public string TerminalDataId { get; set; }
+        /// <summary>
+        /// TerminalRecord Id
+        /// </summary>
+        public string TerminalRecordId { get; set; }
+
+        /// <summary>
+        /// ImageToken
+        /// </summary>
+        public string ImageToken { get; set; }
+
+        /// <summary>
+        /// Finished State
+        /// </summary>
+        public bool IsFinished { get; set; }
+    }
+}

+ 179 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/TerminalAIDatas.cs

@@ -0,0 +1,179 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class TerminalAIDatas
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+
+        /// <summary>
+        /// TerminalData Id
+        /// </summary>
+        public string TerminalDataId { get; set; }
+        /// <summary>
+        /// AIDiagResults
+        /// </summary>
+        public IList<AIDiagResult> DiagResults { get; set; }
+
+        /// <summary>
+        /// AIDiagosistus
+        /// </summary>
+        public EnumAiDiagnosisStatus AIDiagnosisStatus { get; set; }
+
+    }
+
+    internal class AIDiagResult
+    {
+        /// <summary>
+        /// Index
+        /// </summary>
+        public int Index { get; set; }
+        /// <summary>
+        /// Image Diagnosis Result
+        /// </summary>
+        public AIDiagResultPerImgForDB ImageDiagResult { get; set; }
+    }
+
+    internal class AIDiagResultPerImgForDB
+    {
+        /// <summary>
+        /// Priority Score
+        /// </summary>
+        public float PriorityScore { get; set; }
+        /// <summary>
+        /// DiagResults of each Organ
+        /// </summary>
+        public IList<AIDiagResultPerOrganForDB> DiagResultsForEachOrgan { get; set; }
+    }
+
+    public enum EnumOrgans
+    {
+        Null = 0,            // 空
+        NotSpecified = 1,    // 未指定
+        Breast = 2,          // 乳腺
+        Abdomen = 3,           // 腹部
+        Liver = 4,        // 胆囊
+        Cholecyst = 5        // 胆囊
+    }
+
+    internal class AIDiagResultPerOrganForDB
+    {
+        /// <summary>
+        /// Organ
+        /// </summary>
+        public EnumOrgans Organ { get; set; }
+        /// <summary>
+        /// Detected Objects
+        /// </summary>
+        public IList<DetectedObjectForDB> DetectedObjects { get; set; }
+
+        /// <summary>
+        /// Gets or sets the organ bound box
+        /// </summary>
+        public VcloudRectangle OrganBoundBox { get; set; }
+
+        /// <summary>
+        /// Gets or sets the organ contour
+        /// </summary>
+        public IList<VcloudPoint> OrganContour { get; set; }
+    }
+
+    public class VcloudPoint
+    {
+        /// <summary>
+        /// Coordinate X 
+        /// </summary>
+        public int X { get; set; }
+        /// <summary>
+        /// Coordinate Y
+        /// </summary>
+        public int Y { get; set; }
+    }
+
+    internal class VcloudRectangle
+    {
+        /// <summary>
+        /// Left
+        /// </summary>
+        public double Left { get; set; }
+
+        /// <summary>
+        /// Top
+        /// </summary>
+        public double Top { get; set; }
+        /// <summary>
+        /// Right
+        /// </summary>
+        public double Right { get; set; }
+        /// <summary>
+        /// Bottom
+        /// </summary>
+        public double Bottom { get; set; }
+        /// <summary>
+        /// Width
+        /// </summary>
+        public double Width { get; set; }
+        /// <summary>
+        /// Height
+        /// </summary>
+        public double Height { get; set; }
+    }
+
+    internal class DetectedObjectForDB
+    {
+        /// <summary>
+        /// Label (0: no obvious lesion 1: benign 2: malignant)
+        /// </summary>
+        public int Label { get; set; }
+        /// <summary>
+        /// Confidence
+        /// </summary>
+        public float Confidence { get; set; }
+        /// <summary>
+        /// Bounding Box
+        /// </summary>
+        public VcloudRectangle BoundingBox { get; set; }
+
+        /// <summary>
+        /// Contour
+        /// </summary>
+        public List<VcloudPoint> Contour { get; set; }
+
+        /// <summary>
+        /// Descriptions
+        /// </summary>
+        public List<Description> Descriptions { get; set; }
+
+    }
+
+    internal class Description
+    {
+        /// <summary>
+        /// Description Type
+        /// </summary>
+        public EnumDescriptionType DescriptionType { get; set; }
+        /// <summary>
+        /// Description Value
+        /// </summary>
+        public string DescriptionValue { get; set; }
+    }
+
+    public enum EnumDescriptionType
+    {
+        Shape,            // 形状
+        Orientation,     //生长方向
+        EchoPattern,      //回声类型
+        LesionBoundary,   // 病灶边界
+        Margin,           // 边缘
+        Calcification,    // 钙化,目前暂不支持
+        LesionSize,       // 尺寸,目前暂不支持
+    }
+}

+ 110 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/TerminalDatas.cs

@@ -0,0 +1,110 @@
+using SharpCompress.Common;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class TerminalDatas
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+
+        public VidType DataType { get; set; }
+
+        public string Application { get; set; }
+
+        public string PreviewImageFileToken { get; set; }
+
+        public string PatientInfoId { get; set; }
+
+        public IList<TerminalDataFile> Files { get; set; }
+
+        public IList<TerminalDataComment> Comments { get; set; }
+
+        public string TerminalRecordId { get; set; }
+
+        /// <summary>
+        /// Gets the image location.
+        /// </summary>
+        public BreastImageLocation ImageLocation { get; set; }
+
+        public IList<QualityControlData> QualityControlDatas { get; set; }
+    }
+
+    internal class BreastImageLocation
+    {
+        public Position Position { get; set; }
+
+        public QuadrantEnum Quadrant { get; set; }
+
+        public string Group { get; set; }
+    }
+
+    public enum QuadrantEnum
+    {
+        OuterUpper,
+        InnerUpper,
+        OuterLower,
+        InnerLower
+    }
+
+    /// <summary>
+    /// left or right position
+    /// </summary>
+    public enum Position
+    {
+        None,
+        Left,
+        Right
+    }
+
+    internal class TerminalDataComment
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+        public AdminInfo User { get; set; }
+
+        public double Score { get; set; }
+
+        public string Description { get; set; }
+    }
+
+    internal class TerminalDataFile
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+        /// <summary>
+        /// Indicate report file name
+        /// </summary>
+        public string FileName { get; set; }
+
+        public ImageQuality ImageQuality { get; set; }
+    }
+
+    public enum ImageQuality
+    {
+        High,
+        Low
+    }
+
+    public enum VidType
+    {
+        VinnoVidSingle,
+        ThirdVidSingle,
+        VinnoVidMovie,
+        ThirdVidMovie,
+        Image
+    }
+}

+ 43 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/TerminalRecordReportAISelectResults.cs

@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class TerminalRecordReportAISelectResults
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+        // <summary>
+        /// TerminalRecord Id
+        /// </summary>
+        public string TerminalRecordId { get; set; }
+
+        /// AI SelectResult
+        /// </summary>
+        public IList<AISelectResult> AISelectResults { get; set; }
+    }
+
+    internal class AISelectResult
+    {
+        /// <summary>
+        /// TerminalData Id
+        /// </summary>
+        public string TerminalDataId { get; set; }
+
+        /// <summary>
+        /// ImageToken
+        /// </summary>
+        public string ImageToken { get; set; }
+
+        /// <summary>
+        /// AI Result Indexes
+        /// </summary>
+        public IList<int> SelectIndexes { get; set; }
+    }
+}

+ 25 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/TerminalRecordReportStates.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class TerminalRecordReportStates
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+        // <summary>
+        /// user Id
+        /// </summary>
+        public string UserId { get; set; }
+        // <summary>
+        /// TerminalRecord Id
+        /// </summary>
+        public string TerminalRecordId { get; set; }
+    }
+}

+ 125 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/TerminalRecords.cs

@@ -0,0 +1,125 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class TerminalRecords
+    {
+        public string Id { get; set; }
+
+        public DateTime CreateTime { get; set; }
+
+        public DateTime UpdateTime { get; set; }
+        public TerminalInfo Terminal { get; set; }
+
+        public OrganizationInfo Organization { get; set; }
+
+        public AdminInfo User { get; set; }
+
+        public StorageServerInfo StorageServer { get; set; }
+
+        public string Description { get; set; }
+
+        public IList<AdminInfo> AdminShared { get; set; }
+
+        public IList<AdminInfo> UserAssigned { get; set; }
+
+        public string ExamId { get; set; }
+
+        public string AccessionNumber { get; set; }
+
+        public PatientDocInfo PatientInfo { get; set; }
+
+        public bool IsDelete { get; set; }
+
+        public int QualifiedState { get; set; }
+
+
+
+        public int QualityType { get; set; }
+        public IList<AIDiagnosisInfo> AIDiagnosisInfos { get; set; }
+
+        public IList<ReportConclusionInfo> ReportConclusionInfos { get; set; }
+        public int Language { get; set; }
+        public string CreatorUserId { get; set; }
+
+        public string PrelDiagnosis { get; set; }
+        public string ExamDoctor { get; set; }
+        public TerminalRecordSource? TerminalRecordSource { get; set; }
+
+        //public ICollection<TerminalRecordShareLog> ShareLogs { get; set; }
+
+        public ICollection<string> SharerIds { get; set; }
+
+        /// <summary>
+        /// 自定义医生名称用于手动输入 默认是空
+        /// </summary>
+        public string CustomDoctor { get; set; }
+
+        /// <summary>
+        /// 自定义医院名称用于手动输入
+        /// </summary>
+        public string CustomOrganzation { get; set; }
+
+        /// <summary>
+        /// 设备上传标识
+        /// </summary>
+        public string EquipmentSN { get; set; }
+        /// <summary>
+        /// AI Diagnosis Status
+        /// </summary>
+        public EnumAiDiagnosisStatus AIDiagnosisStatus { get; set; }
+    }
+    public enum TerminalRecordSource
+    {
+        Default = 0,
+        Screenshot = 1,
+    }
+    public class AIDiagnosisInfo
+    {
+        public EnumOrgans Organ { get; set; }
+
+        public EnumAiDiagnosisStatus Status { get; set; }
+
+        public string ErrMessage { get; set; }
+    }
+
+    public enum EnumAiDiagnosisStatus
+    {
+        Null = 0,                 //未处理
+        NoObviousLesion = 1,      //未见异常
+        Benign = 2,               //良性病灶
+        Malignant = 3,           //恶性病灶
+        BenignAndMalignant = 4    //良恶性并存
+    }
+
+    internal class PatientDocInfo
+    {
+        public string IdentityCardId { get; private set; }
+
+        public string FirstName { get; private set; }
+
+        public string LastName { get; private set; }
+
+        public DateTime? Birthday { get; set; }
+
+        public GenderType GenderType { get; set; }
+        public string Mobile { get; set; }
+
+        public string Age { get; set; }
+
+    }
+
+    internal class StorageServerInfo
+    {
+        public string Id { get; set; }
+        public string Address { get; set; }
+
+        public int Port { get; set; }
+
+        public string Description { get; set; }
+    }
+}

+ 44 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/TerminalRecordsBak.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class TerminalRecordsBak
+    {
+        public string Id { get; set; }
+
+        public DateTime CreateTime { get; set; }
+
+        public DateTime UpdateTime { get; set; }
+        public TerminalInfo Terminal { get; set; }
+
+        public OrganizationInfo Organization { get; set; }
+
+        public AdminInfo User { get; set; }
+
+        public StorageServerInfo StorageServer { get; set; }
+
+        public string Description { get; set; }
+
+        public IList<AdminInfo> AdminShared { get; set; }
+
+        public IList<AdminInfo> UserAssigned { get; set; }
+
+        public string ExamId { get; set; }
+
+        public string AccessionNumber { get; set; }
+
+        public PatientDocInfo PatientInfo { get; set; }
+
+        public bool IsDelete { get; set; }
+
+        /// <summary>
+        /// AI Diagnosis Status
+        /// </summary>
+        public EnumAiDiagnosisStatus AIDiagnosisStatus { get; set; }
+    }
+
+}

+ 134 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/Terminals.cs

@@ -0,0 +1,134 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class Terminals
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+        //private readonly IList<AdminInfo> _users = new List<AdminInfo>();
+
+        public string Name { get; set; }
+
+        public string Password { get; set; }
+
+        public string Description { get; set; }
+
+        public string SerialNumber { get; set; }
+
+        public string Model { get; set; }
+        public bool SupportLive { get; set; }
+
+        public virtual AdminInfo CreateAdmin { get; set; }
+
+        public virtual OrganizationInfo Organization { get; set; }
+
+        public virtual IList<AdminInfo> Users { get; set; } = new List<AdminInfo>();
+
+        public virtual IList<AdminInfo> Owners { get; set; } = new List<AdminInfo>();
+
+        public string FileToken { get; set; }
+
+        public string CreatorUserId { get; set; }
+
+        public bool IsRecommendedPoster { get; set; }
+
+        public string UniquedId { get; set; }
+
+        public bool CanEditInfo { get; set; }
+
+        public string SoftwareVersion { get; set; }
+
+        public bool IsSonopost { get; set; }
+
+        /// <summary>
+        /// AiDiagnosis Enabled
+        /// </summary>
+        public bool IsAIDiagnosis { get; set; }
+
+        /// <summary>
+        /// IsCarotidDiagnosis Enabled
+        /// </summary>
+        public bool IsCarotidDiagnosis { get; set; }
+
+        public string CPU { get; set; }
+
+        public string OS { get; set; }
+
+        public LogRuleInfo LogRule { get; set; }
+
+        /// <summary>
+        /// 注册状态
+        /// </summary>
+        public TerminalRegistStatus RegistStatus { get; set; }
+
+        /// <summary>
+        /// 是否为虚拟设备(用户关联)
+        /// </summary>
+        public bool IsVirtualDevice { get; set; }
+
+        public string Capability { get; set; }
+
+        public SonopostVersonEnum SonopostVerson { get; set; }
+    }
+    public enum SonopostVersonEnum
+    {
+        Sonopost,
+        Sonopost2
+    }
+    /// <summary>
+    /// 终端注册状态
+    /// </summary>
+    public enum TerminalRegistStatus
+    {
+        /// <summary>
+        /// 未注册
+        /// </summary>
+        None,
+        /// <summary>
+        /// 注册成功
+        /// </summary>
+        Success,
+        /// <summary>
+        /// 注册失败
+        /// </summary>
+        Fail
+    }
+
+    public class LogRuleInfo
+    {
+        public int Rule { get; set; }
+        public bool UploadLogStatus { get; set; }
+        public IList<DeviceLogCategory> LogCategorys { get; set; }
+        public DateTime UpdateTime { get; set; }
+    }
+
+    public enum DeviceLogCategory
+    {
+        Error = 1,
+        Warn = 2,
+        Info = 3,
+        Verb = 4
+    }
+
+    public class OrganizationInfo
+    {
+        public string Id { get; set; }
+
+        public string Name { get; set; }
+
+        public bool IsShared { get; set; }
+
+        public string Description { get; set; }
+    }
+}

+ 85 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/TerminalsBak.cs

@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class TerminalsBak
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; set; } = DateTime.MinValue;
+
+        public DateTime UpdateTime { get; set; } = DateTime.MinValue;
+
+        public bool IsDeleted { get; set; }
+        //private readonly IList<AdminInfo> _users = new List<AdminInfo>();
+
+        public string Name { get; set; }
+
+        public string Password { get; set; }
+
+        public string Description { get; set; }
+
+        public string SerialNumber { get; set; }
+
+        public string Model { get; set; }
+        public bool SupportLive { get; set; }
+
+        public virtual AdminInfo CreateAdmin { get; set; }
+
+        public virtual OrganizationInfo Organization { get; set; }
+
+        public virtual IList<AdminInfo> Users { get; set; } = new List<AdminInfo>();
+
+        public virtual IList<AdminInfo> Owners { get; set; } = new List<AdminInfo>();
+
+        public string FileToken { get; set; }
+
+        public string CreatorUserId { get; set; }
+
+        public bool IsRecommendedPoster { get; set; }
+
+        public string UniquedId { get; set; }
+
+        public bool CanEditInfo { get; set; }
+
+        public string SoftwareVersion { get; set; }
+
+        public bool IsSonopost { get; set; }
+
+        /// <summary>
+        /// AiDiagnosis Enabled
+        /// </summary>
+        public bool IsAIDiagnosis { get; set; }
+
+        /// <summary>
+        /// IsCarotidDiagnosis Enabled
+        /// </summary>
+        public bool IsCarotidDiagnosis { get; set; }
+
+        public string CPU { get; set; }
+
+        public string OS { get; set; }
+
+        public LogRuleInfo LogRule { get; set; }
+
+        /// <summary>
+        /// 注册状态
+        /// </summary>
+        public TerminalRegistStatus RegistStatus { get; set; }
+
+        /// <summary>
+        /// 是否为虚拟设备(用户关联)
+        /// </summary>
+        public bool IsVirtualDevice { get; set; }
+
+        public string Capability { get; set; }
+
+        public SonopostVersonEnum SonopostVerson { get; set; }
+    }
+   
+}

+ 42 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/UploadStorageFileInfo.cs

@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class UploadStorageFileInfo
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+        public bool IsDeleted { get; set; }
+        /// <summary>
+        /// file md5 id 
+        /// </summary>
+        public string FileMd5 { get; set; }
+        /// <summary>
+        /// upload file  client account id
+        /// </summary>
+        public string AccountId { get; set; }
+        /// <summary>
+        /// file size
+        /// </summary>
+        public int FileSize { get; set; }
+        /// <summary>
+        /// upload file Position
+        /// </summary>
+        public int FilePosition { get; set; }
+        /// <summary>
+        /// file token 
+        /// </summary>
+        public string FileToken { get; set; }
+        /// <summary>
+        /// saved cahce file name  when uploading file  
+        /// </summary>
+        public string CacheFileName { get; set; }
+    }
+}

+ 271 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/Users.cs

@@ -0,0 +1,271 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class Users
+    {
+        public string _id { get; set; }
+        public DateTime CreateTime { get; set; }
+        public DateTime UpdateTime { get; set; }
+        public bool IsDeleted { get; set; }
+        public string Name { get; set; }
+        public string Password { get; set; }
+        public string LastName { get; set; }
+        public string FirstName { get; set; }
+        public string FullName { get; set; }
+        public string Phone { get; set; }
+        public string Email { get; set; }
+        public AdminInfo CreateAdmin { get; set; }
+
+        /// <summary>
+        /// Terminals assigned to user
+        /// </summary>
+        public IList<UserTerminalInfo> Terminals { get; set; }
+
+        /// <summary>
+        /// Applications assigned to user
+        /// </summary>
+        public IList<AdminInfo> Features { get; set; }
+
+        public IList<OrganizationInfo> Organizations { get; set; }
+
+        public IList<PushFailedMessage> PushFailedMessages { get; private set; }
+
+        public IList<PushFailedSystemMessage> PushFailedSystemMessages { get; private set; }
+
+        public IList<AdminInfo> Owners { get; private set; }
+
+        public byte[] SmallHeadImage { get; set; }
+
+        public string HeadImage { get; set; }
+
+        public bool IsActive { get; set; }
+
+        public string NickName { get; set; }
+
+        public GenderType GenderType { get; set; }
+
+        public string Region { get; set; }
+
+        public string HospitalId { get; set; }
+
+        public string Hospital { get; set; }
+
+        public string Department { get; set; }
+
+        public string CertificateId { get; set; }
+
+        public UserTypes UserType { get; set; }
+
+        public UserPermissions UserPermission { get; set; }
+
+        public int Rank { get; set; }
+
+        public string Introduction { get; set; }
+
+        public string Unionid { get; set; }
+
+        /// <summary>
+        /// Gets or sets the Openid of this user.
+        /// </summary>
+        public string Openid { get; set; }
+
+        public AdminInfo ChargeGroupInfo { get; set; }
+
+        /// <summary>
+        /// direct server name
+        /// </summary>
+        public string DirectServer { get; set; }
+        public string ElectronSignUrl { get; set; }
+
+        /// <summary>
+        /// 登录认证类型
+        /// </summary>
+        public LoginAuthType AuthType { get; set; }
+
+        /// <summary>
+        /// 排序后的专家列表
+        /// </summary>
+        /// <value></value>
+        public IList<ExpertSortInfo> SortedExperts { get; set; } = new List<ExpertSortInfo>();
+
+        /// <summary>
+        /// 排班信息
+        /// </summary>
+        /// <value></value>
+        public IList<ShiftInfo> Shifts { get; set; } = new List<ShiftInfo>();
+
+        /// <summary>
+        /// 开启上传记录通知
+        /// </summary>
+        public bool OpenUploadRecordNotify { get; set; }
+    }
+
+    /// <summary>
+    /// 专家排序信息
+    /// </summary>
+    internal class ExpertSortInfo
+    {
+        /// <summary>
+        /// 专家编码
+        /// </summary>
+        /// <value></value>
+        public string ExpertCode { get; set; }
+
+        /// <summary>
+        /// 医院Id
+        /// </summary>
+        /// <value></value>
+        public string HospitalId { get; set; }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <value></value>
+        public int Sort { get; set; }
+    }
+
+
+    /// <summary>
+    /// 排班信息
+    /// </summary>
+    internal class ShiftInfo
+    {
+        /// <summary>
+        /// 第几天
+        /// </summary>
+        public int Day { get; set; }
+
+        /// <summary>
+        /// 是否需要上班
+        /// </summary>
+        /// <value></value>
+        public bool NeedToWork { get; set; }
+    }
+
+    public enum LoginAuthType
+    {
+        Default,
+        WithMobileMsg
+    }
+    public enum UserPermissions
+    {
+        //Can see the full patient name like '张三', and full indentity card id.
+        High,
+        //Can see partial patient name like '张*', and '3305****'.
+        Low
+    }
+
+    /// <summary>
+    /// Account all user types
+    /// </summary>
+    public enum UserTypes
+    {
+        /// <summary>
+        /// common user
+        /// </summary>
+        Normal,
+        /// <summary>
+        /// expert user
+        /// </summary>
+        Expert,
+        /// <summary>
+        /// Review patient report user
+        /// </summary>
+        Reviewer,
+        /// <summary>
+        /// work sheet user
+        /// </summary>
+        WorkOrder,
+        /// <summary>
+        /// after sale sevice user
+        /// </summary>
+        Service,
+        /// <summary>
+        /// after sale agent user
+        /// </summary>
+        SalesAgent,
+        /// <summary>
+        /// vistor type
+        /// </summary>
+        Vistor
+    }
+
+    public enum GenderType
+    {
+        Unassigned,
+        Male,
+        Female
+    }
+
+    internal class PushFailedSystemMessage
+    {
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+        public string Content { get; set; }
+
+        public SystemMessageType Type { get; set; }
+
+        //session source
+        public SessionSource SessionSource { get; set; }
+    }
+
+    public enum SessionSource
+    {
+        PersonalComputer = 1,//From PC
+        MobileDevice,//From Mobile device
+        WebBrowser, //From Web Browser
+        UltrasoundMachine, //From ultrasound machine
+        Agent,//From agent
+        VideoManager,
+        UltrasoundTeaching,//From Ultrasonic Teaching
+        WindowSonopost,//From new box
+    }
+
+
+    public enum SystemMessageType
+    {
+        ApplyFriend,
+        ApplyJoinGroup,
+        NotifyBeFriends,
+        CreateGroup,
+        DismissGroup
+    }
+
+    internal class PushFailedMessage
+    {
+        public ChatMessage Message { get; set; }
+
+        public int SessionSource { get; set; }
+
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+    }
+
+    internal class ChatMessage
+    {
+        public virtual AdminInfo Conversation { get; set; }
+
+        public virtual AdminInfo CreateUser { get; set; }
+
+        public string Content { get; set; }
+
+        public bool IsDeleted { get; set; }
+
+        public string Id { get; private set; }
+
+        public DateTime CreateTime { get; private set; }
+
+        public DateTime UpdateTime { get; set; }
+    }
+}

+ 108 - 0
Tools/Flyinsono.DBCopy.Tool/Entities/UsersBak.cs

@@ -0,0 +1,108 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Entities
+{
+    internal class UsersBak
+    {
+        public string _id { get; set; }
+        public DateTime CreateTime { get; set; }
+        public DateTime UpdateTime { get; set; }
+        public bool IsDeleted { get; set; }
+        public string Name { get; set; }
+        public string Password { get; set; }
+        public string LastName { get; set; }
+        public string FirstName { get; set; }
+        public string FullName { get; set; }
+        public string Phone { get; set; }
+        public string Email { get; set; }
+        public AdminInfo CreateAdmin { get; set; }
+
+        /// <summary>
+        /// Terminals assigned to user
+        /// </summary>
+        public IList<UserTerminalInfo> Terminals { get; set; }
+
+        /// <summary>
+        /// Applications assigned to user
+        /// </summary>
+        public IList<AdminInfo> Features { get; set; }
+
+        public IList<OrganizationInfo> Organizations { get; set; }
+
+        public IList<PushFailedMessage> PushFailedMessages { get; private set; }
+
+        public IList<PushFailedSystemMessage> PushFailedSystemMessages { get; private set; }
+
+        public IList<AdminInfo> Owners { get; private set; }
+
+        public byte[] SmallHeadImage { get; set; }
+
+        public string HeadImage { get; set; }
+
+        public bool IsActive { get; set; }
+
+        public string NickName { get; set; }
+
+        public GenderType GenderType { get; set; }
+
+        public string Region { get; set; }
+
+        public string HospitalId { get; set; }
+
+        public string Hospital { get; set; }
+
+        public string Department { get; set; }
+
+        public string CertificateId { get; set; }
+
+        public UserTypes UserType { get; set; }
+
+        public UserPermissions UserPermission { get; set; }
+
+        public int Rank { get; set; }
+
+        public string Introduction { get; set; }
+
+        public string Unionid { get; set; }
+
+        /// <summary>
+        /// Gets or sets the Openid of this user.
+        /// </summary>
+        public string Openid { get; set; }
+
+        public AdminInfo ChargeGroupInfo { get; set; }
+
+        /// <summary>
+        /// direct server name
+        /// </summary>
+        public string DirectServer { get; set; }
+        public string ElectronSignUrl { get; set; }
+
+        /// <summary>
+        /// 登录认证类型
+        /// </summary>
+        public LoginAuthType AuthType { get; set; }
+
+        /// <summary>
+        /// 排序后的专家列表
+        /// </summary>
+        /// <value></value>
+        public IList<ExpertSortInfo> SortedExperts { get; set; } = new List<ExpertSortInfo>();
+
+        /// <summary>
+        /// 排班信息
+        /// </summary>
+        /// <value></value>
+        public IList<ShiftInfo> Shifts { get; set; } = new List<ShiftInfo>();
+
+        /// <summary>
+        /// 开启上传记录通知
+        /// </summary>
+        public bool OpenUploadRecordNotify { get; set; }
+    }
+
+}

+ 14 - 10
Tools/Flyinsono.DBCopy.Tool/Flyinsono.DBCopy.Tool.csproj

@@ -10,6 +10,7 @@
   </PropertyGroup>
 
 	<ItemGroup>
+		<PackageReference Include="AutoMapper" Version="12.0.1" />
 		<PackageReference Include="JsonRpcLite" Version="1.1.0.4" />
 		<PackageReference Include="MongoDB.Driver" Version="2.12.3" />
 		<PackageReference Include="WingInterfaceLibrary" Version="1.1.4.1" />
@@ -37,16 +38,19 @@
 	</ItemGroup>
 
 	<ItemGroup>
-	  <None Update="DBCopy.Packages\4.2earlier\mongod.exe">
-	    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-	  </None>
-	  <None Update="DBCopy.Packages\mongod.exe">
-	    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-	  </None>
-	  <None Update="Properties\Settings.settings">
-	    <Generator>SettingsSingleFileGenerator</Generator>
-	    <LastGenOutput>Settings.Designer.cs</LastGenOutput>
-	  </None>
+		<None Update="DBCopy.Packages\4.2earlier\mongod_4.2.exe">
+			<CopyToOutputDirectory>Always</CopyToOutputDirectory>
+		</None>
+		<None Update="DBCopy.Packages\mongod.exe">
+			<CopyToOutputDirectory>Always</CopyToOutputDirectory>
+		</None>
+		<None Update="Properties\Settings.settings">
+			<Generator>SettingsSingleFileGenerator</Generator>
+			<LastGenOutput>Settings.Designer.cs</LastGenOutput>
+		</None>
+		<None Update="Config\TestConfig.json">
+			<CopyToOutputDirectory>Always</CopyToOutputDirectory>
+		</None>
 	</ItemGroup>
 
 </Project>

+ 31 - 0
Tools/Flyinsono.DBCopy.Tool/Flyinsono.DBCopy.Tool.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.32002.261
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flyinsono.DBCopy.Tool", "Flyinsono.DBCopy.Tool.csproj", "{810D1707-4E6F-48EE-A7D4-CF3978AA0585}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|x64 = Debug|x64
+		Release|Any CPU = Release|Any CPU
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{810D1707-4E6F-48EE-A7D4-CF3978AA0585}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{810D1707-4E6F-48EE-A7D4-CF3978AA0585}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{810D1707-4E6F-48EE-A7D4-CF3978AA0585}.Debug|x64.ActiveCfg = Debug|x64
+		{810D1707-4E6F-48EE-A7D4-CF3978AA0585}.Debug|x64.Build.0 = Debug|x64
+		{810D1707-4E6F-48EE-A7D4-CF3978AA0585}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{810D1707-4E6F-48EE-A7D4-CF3978AA0585}.Release|Any CPU.Build.0 = Release|Any CPU
+		{810D1707-4E6F-48EE-A7D4-CF3978AA0585}.Release|x64.ActiveCfg = Release|x64
+		{810D1707-4E6F-48EE-A7D4-CF3978AA0585}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {59C7F0E4-170B-4076-AED2-65B0E93D49FE}
+	EndGlobalSection
+EndGlobal

+ 106 - 0
Tools/Flyinsono.DBCopy.Tool/Service/FilterTestService.cs

@@ -0,0 +1,106 @@
+using Flyinsono.DBCopy.Tool.Service.Repositories;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Service
+{
+    internal class FilterTestService
+    {
+        private UsersDBRepository _usersDBRepository = new UsersDBRepository();
+        private TerninalsDBRepository _terninalsDBRepository = new TerninalsDBRepository();
+        private OrganizationsDBRepository _organizationsDBRepository = new OrganizationsDBRepository();
+        private ConversationsDBRepository _conversationsDBRepository = new ConversationsDBRepository();
+        private CoursesDBRepository _coursesDBRepository = new CoursesDBRepository();
+        private ExaminationPaperDBPepository _examinationPaperDBPepository = new ExaminationPaperDBPepository();
+        private LectureContestsDBRepository _lectureContestsDBRepository = new LectureContestsDBRepository();
+        private PosterConfigsDBRepository _posterConfigsDBRepository = new PosterConfigsDBRepository();
+        private RecordDatasDBRepository _recordDatasDBRepository = new RecordDatasDBRepository();
+        private UploadStorageFileInfoDBRepository _uploadStorageFileInfoDBRepository = new UploadStorageFileInfoDBRepository();
+
+        public bool DealWithUserData()
+        {
+            var result = false;
+            var list = _usersDBRepository.GetTestUsersByCondition();
+            result = _usersDBRepository.SaveClearData(list);
+            _usersDBRepository.ClearLocationsData();
+            return result;
+        }
+
+        public bool DealWithTerminalData()
+        {
+            var list = _terninalsDBRepository.GetTestTerninalsByCondition();
+            var result = _terninalsDBRepository.SaveClearData(list);
+            return result;
+        }
+
+        public bool DealWithOrganizationData()
+        {
+            var list = _organizationsDBRepository.GetTestOrganizationsByCondition();
+            var result = _organizationsDBRepository.SaveClearData(list);
+            return result;
+        }
+
+        public bool DealWithPosterConfigsData()
+        {
+            var list = _posterConfigsDBRepository.GetTestPosterConfigsByCondition();
+            var historyList = _posterConfigsDBRepository.GetTestPosterHistoriesByCondition(list);
+            var result = _posterConfigsDBRepository.SaveClearData(list, historyList);
+            return result;
+        }
+
+        public bool DealWithConversationsData()
+        {
+            var list = _conversationsDBRepository.GetTestConversationsByCondition();
+            var chatMessageList = _conversationsDBRepository.GetTestChatMessagesByCondition(list);
+            var result = _conversationsDBRepository.SaveClearData(list, chatMessageList);
+            return result;
+        }
+
+        public bool DealWithLectureContestsData()
+        {
+            var list = _lectureContestsDBRepository.GetTestLectureContestsByCondition();
+            var result = _lectureContestsDBRepository.SaveClearData(list);
+            result = _lectureContestsDBRepository.GetTestLectureContestsRelationDataByCondition(list);
+            result = _lectureContestsDBRepository.GetTestLectureContestEntriesByCondition();
+            return result;
+        }
+
+        public bool DealWithExaminationPaperData()
+        {
+            var list = _examinationPaperDBPepository.GetTestExaminationPaperByCondition();
+            var result = _examinationPaperDBPepository.SaveClearData(list);
+            result = _examinationPaperDBPepository.ClearTestExamScoresByCondition(list);
+            return result;
+        }
+
+        public bool DealWithCoursesData()
+        {
+            var list = _coursesDBRepository.GetTestCoursesByCondition();
+            var result = _coursesDBRepository.SaveClearData(list);
+            return result;
+        }
+
+        public bool DealWithUploadStorageFileData()
+        {
+            var list = _uploadStorageFileInfoDBRepository.GetTestUploadStorageFileInfoByCondition();
+            var storageList = _uploadStorageFileInfoDBRepository.GetTestStorageFileInfoesByCondition();
+            var result = _uploadStorageFileInfoDBRepository.SaveClearData(list, storageList);
+            return result;
+        }
+
+        public bool DealWithRecodeFileData()
+        {
+            var terminalRecordsList = _recordDatasDBRepository.GetTestTerminalRecordsByCondition();
+            var res = _recordDatasDBRepository.ClearTestTerminalsRelationData(terminalRecordsList);
+            res = _recordDatasDBRepository.SaveClearData(terminalRecordsList);
+            var consultationRecordList = _recordDatasDBRepository.GetTestConsultationRecordsByCondition();
+            res = _recordDatasDBRepository.ClearTestConsultationRecordsRelationData(consultationRecordList);
+            res = _recordDatasDBRepository.ClearPatientsData();
+            res = _recordDatasDBRepository.ClearPatientInfosData();
+            return res;
+        }
+    }
+}

+ 132 - 0
Tools/Flyinsono.DBCopy.Tool/Service/Repositories/ConversationsDBRepository.cs

@@ -0,0 +1,132 @@
+using Flyinsono.DBCopy.Tool.Entities;
+using Flyinsono.DBCopy.Tool.Utilities;
+using MongoDB.Driver;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Service.Repositories
+{
+    internal class ConversationsDBRepository
+    {
+        /// <summary>
+        /// 过滤测试Conversations
+        /// </summary>
+        /// <returns></returns>
+        public IList<Conversations> GetTestConversationsByCondition()
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear Conversations Data");
+            IList<Conversations> conversations = new List<Conversations>();
+            var builder = Builders<Conversations>.Filter;
+            var filter = builder.Where(x => x.IsDeleted == false && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline.AddMonths(-18));
+            var conversationsList = MongoDbClientSingle.Instance.Conversations.Find(filter)?.ToList();
+            if (conversationsList?.Count > 0)
+            {
+                foreach (var item in conversationsList)
+                {
+                    conversations.Add(item);
+                }
+            }
+            var deleteList = MongoDbClientSingle.Instance.Conversations.Find(c => c.IsDeleted == true)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    conversations.Add(item);
+                }
+            }
+
+            var userIdList = MongoDbClientSingle.Instance.UsersBak.Find(c => !string.IsNullOrEmpty(c._id))?.Project(c => c._id)?.ToList();
+            if (userIdList?.Count > 0)
+            {
+                var otherFilter = builder.Where(x => (x.CreateUser != null && userIdList.Contains(x.CreateUser.Id)) || (x.Master != null && userIdList.Contains(x.Master.Id)) || 
+                (x.Members != null && x.Members.Any(c => userIdList.Contains(c.Id))));
+                var otherList = MongoDbClientSingle.Instance.Conversations.Find(otherFilter)?.ToList();
+                if (otherList?.Count > 0)
+                {
+                    foreach (var item in otherList)
+                    {
+                        conversations.Add(item);
+                    }
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear Conversations Data, Count: " + conversations.Count);
+            return conversations;
+        }
+
+        /// <summary>
+        /// 过滤测试ChatMessages
+        /// </summary>
+        /// <returns></returns>
+        public IList<ChatMessages> GetTestChatMessagesByCondition(IList<Conversations> conversations)
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear ChatMessages Data");
+            IList<ChatMessages> chatMessages = new List<ChatMessages>();
+            var builder = Builders<ChatMessages>.Filter;
+            var filter = builder.Where(x => x.IsDeleted == false && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline.AddMonths(-18));
+            var chatMessagesList = MongoDbClientSingle.Instance.ChatMessages.Find(filter)?.ToList();
+            if (chatMessagesList?.Count > 0)
+            {
+                foreach (var item in chatMessagesList)
+                {
+                    chatMessages.Add(item);
+                }
+            }
+            var deleteList = MongoDbClientSingle.Instance.ChatMessages.Find(c => c.IsDeleted == true)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    chatMessages.Add(item);
+                }
+            }
+            var ids = conversations.Select(c => c.Id).Distinct().ToList();
+            if (ids?.Count > 0)
+            {
+                var otherList = MongoDbClientSingle.Instance.ChatMessages.Find(c => ids.Contains(c.Conversation.Id))?.ToList();
+                if (otherList?.Count > 0)
+                {
+                    foreach (var item in otherList)
+                    {
+                        chatMessages.Add(item);
+                    }
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear ChatMessages Data, Count: "+ chatMessages.Count);
+            return chatMessages;
+        }
+
+        /// <summary>
+        /// 保存清理数据
+        /// </summary>
+        /// <param name="terminalList"></param>
+        /// <returns></returns>
+        public bool SaveClearData(IList<Conversations> conversations, IList<ChatMessages> chatMessages)
+        {
+            if (conversations?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear Conversations Data");
+                var configIds = conversations.Select(c => c.Id).ToList();
+                //删除正式表
+                var builder = Builders<Conversations>.Filter;
+                var filter = builder.In(x => x.Id, configIds);
+                var result = MongoDbClientSingle.Instance.Conversations.DeleteMany(filter);
+                Logger.WriteLineInfo($"Clear Conversations Data Completed, Count: "+ conversations.Count);
+            }
+
+            if (chatMessages?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear ChatMessages Data");
+                var chatIds = chatMessages.Select(c => c.Id).ToList();
+                //删除正式表
+                var builder = Builders<ChatMessages>.Filter;
+                var filter = builder.In(x => x.Id, chatIds);
+                var result = MongoDbClientSingle.Instance.ChatMessages.DeleteMany(filter);
+                Logger.WriteLineInfo($"Clear ChatMessages Data Completed, Count: " + chatMessages.Count);
+            }
+            return true;
+        }
+    }
+}

+ 130 - 0
Tools/Flyinsono.DBCopy.Tool/Service/Repositories/CoursesDBRepository.cs

@@ -0,0 +1,130 @@
+using Flyinsono.DBCopy.Tool.Entities;
+using Flyinsono.DBCopy.Tool.Utilities;
+using MongoDB.Driver;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Service.Repositories
+{
+    internal class CoursesDBRepository
+    {
+        /// <summary>
+        /// 过滤测试 课程
+        /// </summary>
+        /// <returns></returns>
+        public IList<string> GetTestCoursesByCondition()
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear Courses Data");
+            IList<string> courses = new List<string>();
+            var filterCourses = CommonConfigManager.FilterCourses;
+            var builder = Builders<Courses>.Filter;
+            var filter = builder.Where(x => x.IsDeleted == false && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            FilterDefinition<Courses> orFilter = null;
+            foreach (var item in filterCourses)
+            {
+                var curNameFilter = builder.Where(c => c.Name.ToLower().Contains(item));
+                if (orFilter == null)
+                {
+                    orFilter = curNameFilter;
+                }
+                else
+                {
+                    orFilter = orFilter | curNameFilter;
+                }
+            }
+            filter = filter & orFilter;
+            var coursesList = MongoDbClientSingle.Instance.Courses.Find(filter)?.Project(c => c.Id)?.ToList();
+            if (coursesList?.Count > 0)
+            {
+                foreach (var item in coursesList)
+                {
+                    courses.Add(item);
+                }
+            }
+            var deleteList = MongoDbClientSingle.Instance.Courses.Find(c => c.IsDeleted == true)?.Project(c => c.Id)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    courses.Add(item);
+                }
+            }
+
+            Regex numberRegex = new Regex("^[0-9]+\\.{0,1}[0-9]{0,}$");
+            var dList = MongoDbClientSingle.Instance.Courses.Find(c => c.IsDeleted == false && c.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline && numberRegex.IsMatch(c.Name))?.Project(c => c.Id)?.ToList();
+            if (dList?.Count > 0)
+            {
+                foreach (var item in dList)
+                {
+                    courses.Add(item);
+                }
+            }
+
+            Regex nRegex = new Regex("^[0-9]+\\-{0,1}[0-9]{0,}$");
+            var nList = MongoDbClientSingle.Instance.Courses.Find(c => c.IsDeleted == false && c.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline && nRegex.IsMatch(c.Name))?.Project(c => c.Id)?.ToList();
+            if (nList?.Count > 0)
+            {
+                foreach (var item in nList)
+                {
+                    courses.Add(item);
+                }
+            }
+
+            var userIdList = MongoDbClientSingle.Instance.UsersBak.Find(c => !string.IsNullOrEmpty(c._id))?.Project(c => c._id)?.ToList();
+            if (userIdList?.Count > 0)
+            {
+                var otherFilter = builder.Where(x => (x.Teacher != null && userIdList.Contains(x.Teacher.Id)) || x.ApplyState == ApplyState.Invalid || (
+                x.ApplyState == ApplyState.NoApproval && x.StarTime < DateTime.UtcNow.AddMinutes(-120)));
+                var otherList = MongoDbClientSingle.Instance.Courses.Find(otherFilter)?.Project(c => c.Id)?.ToList();
+                if (otherList?.Count > 0)
+                {
+                    foreach (var item in otherList)
+                    {
+                        courses.Add(item);
+                    }
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear Courses Data Completed, Count: " + courses.Count);
+            return courses;
+        }
+
+        /// <summary>
+        /// 保存清理数据
+        /// </summary>
+        /// <param name="terminalList"></param>
+        /// <returns></returns>
+        public bool SaveClearData(IList<string> courses)
+        {
+            if (courses?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear Courses Data");
+                //删除正式表
+                var builder = Builders<Courses>.Filter;
+                var filter = builder.In(x => x.Id, courses);
+                var result = MongoDbClientSingle.Instance.Courses.DeleteMany(filter);
+
+                var noticeRemindIds = MongoDbClientSingle.Instance.CourseNoticeReminds.Find(c => c.IsDeleted == false && courses.Contains(c.CourseId))?.Project(c => c.Id)?.ToList();
+                if (noticeRemindIds?.Count > 0)
+                {
+                    var deleteList = MongoDbClientSingle.Instance.CourseNoticeReminds.Find(c => c.IsDeleted == true)?.Project(c => c.Id)?.ToList();
+                    if (deleteList?.Count > 0)
+                    {
+                        foreach (var item in deleteList)
+                        {
+                            noticeRemindIds.Add(item);
+                        }
+                    }
+
+                    var courseNoticeRemindsFilter = Builders<CourseNoticeReminds>.Filter.In(x => x.Id, noticeRemindIds);
+                    result = MongoDbClientSingle.Instance.CourseNoticeReminds.DeleteMany(courseNoticeRemindsFilter);
+                }
+                Logger.WriteLineInfo($"Clear Courses Data Completed, Count: " + courses.Count);
+            }
+            return true;
+        }
+    }
+}

+ 141 - 0
Tools/Flyinsono.DBCopy.Tool/Service/Repositories/ExaminationPaperDBPepository.cs

@@ -0,0 +1,141 @@
+using Flyinsono.DBCopy.Tool.Entities;
+using Flyinsono.DBCopy.Tool.Utilities;
+using MongoDB.Driver;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Service.Repositories
+{
+    internal class ExaminationPaperDBPepository
+    {
+        /// <summary>
+        /// 过滤测试ExaminationPaper
+        /// </summary>
+        /// <returns></returns>
+        public IList<string> GetTestExaminationPaperByCondition()
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear ExaminationPaper Data");
+            IList<string> examinationPaper = new List<string>();
+            var filterExaminationPaper = CommonConfigManager.FilterExaminationPaper;
+            var builder = Builders<ExaminationPaper>.Filter;
+            var filter = builder.Where(x => x.IsDeleted == false && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            FilterDefinition<ExaminationPaper> orFilter = null;
+            if (filterExaminationPaper?.Count > 0)
+            {
+                foreach (var item in filterExaminationPaper)
+                {
+                    var tempFilter = builder.Where(c => c.Title.ToLower().Contains(item));
+                    if (orFilter == null)
+                    {
+                        orFilter = tempFilter;
+                    }
+                    else
+                    {
+                        orFilter = orFilter | tempFilter;
+                    }
+                }
+            }
+            filter = filter & orFilter;
+            var examinationPaperList = MongoDbClientSingle.Instance.ExaminationPaper.Find(filter)?.Project(c => c.Id)?.ToList();
+            if (examinationPaperList?.Count > 0)
+            {
+                foreach (var item in examinationPaperList)
+                {
+                    examinationPaper.Add(item);
+                }
+            }
+            var deleteList = MongoDbClientSingle.Instance.ExaminationPaper.Find(c => c.IsDeleted == true)?.Project(c => c.Id)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    examinationPaper.Add(item);
+                }
+            }
+
+            Regex numberRegex = new Regex("^[0-9]+\\.{0,1}[0-9]{0,}$");
+            var dList = MongoDbClientSingle.Instance.ExaminationPaper.Find(c => c.IsDeleted == false && c.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline && numberRegex.IsMatch(c.Title))?.Project(c => c.Id)?.ToList();
+            if (dList?.Count > 0)
+            {
+                foreach (var item in dList)
+                {
+                    examinationPaper.Add(item);
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear ExaminationPaper Data, Count: " + examinationPaper.Count);
+            return examinationPaper;
+        }
+
+        /// <summary>
+        /// 过滤测试ExamScores
+        /// </summary>
+        /// <returns></returns>
+        public bool ClearTestExamScoresByCondition(IList<string> examinationPaper)
+        {
+            Logger.WriteLineInfo($"Starting Clear ExamPapers Data");
+            IList<string> examScores = new List<string>();
+            var builder = Builders<ExamScores>.Filter;
+            if (examinationPaper?.Count > 0)
+            {
+                var filter = builder.Where(x => x.IsDeleted == false && examinationPaper.Contains(x.ExamId));
+                var examScoresList = MongoDbClientSingle.Instance.ExamScores.Find(filter)?.Project(c => c.Id)?.ToList();
+                if (examScoresList?.Count > 0)
+                {
+                    foreach (var item in examScoresList)
+                    {
+                        examScores.Add(item);
+                    }
+                }
+            }
+            var deleteList = MongoDbClientSingle.Instance.ExamScores.Find(c => c.IsDeleted == true)?.Project(c => c.Id)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    examScores.Add(item);
+                }
+            }
+
+            if (examScores?.Count > 0)
+            {
+                //删除正式表
+                var examScoresDelFilter = builder.In(x => x.Id, examScores);
+                var result = MongoDbClientSingle.Instance.ExamScores.DeleteMany(examScoresDelFilter);
+            }
+
+            var idList = MongoDbClientSingle.Instance.ExamPapers.Find(c => !string.IsNullOrEmpty(c.Id))?.Project(c => c.Id)?.ToList();
+            if (idList?.Count > 0)
+            {
+                //删除正式表
+                var examPapersDelFilter = Builders<ExamPapers>.Filter.In(x => x.Id, idList);
+                var result = MongoDbClientSingle.Instance.ExamPapers.DeleteMany(examPapersDelFilter);
+            }
+            Logger.WriteLineInfo($"Clear ExamPapers Data Completed, Count: " + idList.Count);
+            return true;
+        }
+
+        /// <summary>
+        /// 保存清理数据
+        /// </summary>
+        /// <param name="terminalList"></param>
+        /// <returns></returns>
+        public bool SaveClearData(IList<string> examinationPaper)
+        {
+            if (examinationPaper?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear ExaminationPaper Data");
+                //删除正式表
+                var builder = Builders<ExaminationPaper>.Filter;
+                var filter = builder.In(x => x.Id, examinationPaper);
+                var result = MongoDbClientSingle.Instance.ExaminationPaper.DeleteMany(filter);
+                Logger.WriteLineInfo($"Clear ExaminationPaper Data Compeleted, Count: " + examinationPaper.Count);
+            }
+
+            return true;
+        }
+    }
+}

+ 185 - 0
Tools/Flyinsono.DBCopy.Tool/Service/Repositories/LectureContestsDBRepository.cs

@@ -0,0 +1,185 @@
+using Flyinsono.DBCopy.Tool.Entities;
+using Flyinsono.DBCopy.Tool.Utilities;
+using MongoDB.Driver;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Service.Repositories
+{
+    internal class LectureContestsDBRepository
+    {
+        /// <summary>
+        /// 过滤测试LectureContests
+        /// </summary>
+        /// <returns></returns>
+        public IList<string> GetTestLectureContestsByCondition()
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear LectureContests Data");
+            IList<string> lectureContests = new List<string>();
+            var filterLectureContests = CommonConfigManager.FilterLectureContests;
+            var builder = Builders<LectureContests>.Filter;
+            var filter = builder.Where(x => x.IsDeleted == false && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            FilterDefinition<LectureContests> orFilter = null;
+            if (filterLectureContests?.Count > 0)
+            {
+                foreach (var item in filterLectureContests)
+                {
+                    var curNameFilter = builder.Where(c => c.Name.ToLower().Contains(item.ToLower()));
+                    if (orFilter == null)
+                    {
+                        orFilter = curNameFilter;
+                    }
+                    else
+                    {
+                        orFilter = orFilter | curNameFilter;
+                    }
+                }
+            }
+            filter = filter & orFilter;
+            var lectureContestsList = MongoDbClientSingle.Instance.LectureContests.Find(filter)?.Project(c => c.Id)?.ToList();
+            if (lectureContestsList?.Count > 0)
+            {
+                foreach (var item in lectureContestsList)
+                {
+                    lectureContests.Add(item);
+                }
+            }
+            var deleteList = MongoDbClientSingle.Instance.LectureContests.Find(c => c.IsDeleted == true)?.Project(c => c.Id)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    lectureContests.Add(item);
+                }
+            }
+
+            Regex numberRegex = new Regex("^[0-9]+\\.{0,1}[0-9]{0,}$");
+            var dList = MongoDbClientSingle.Instance.LectureContests.Find(c => c.IsDeleted == false && c.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline && numberRegex.IsMatch(c.Name))?.Project(c => c.Id)?.ToList();
+            if (dList?.Count > 0)
+            {
+                foreach (var item in dList)
+                {
+                    lectureContests.Add(item);
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear LectureContests Data, Count: " + lectureContests.Count);
+            return lectureContests;
+        }
+
+        /// <summary>
+        /// 过滤测试LectureContests Relation Data
+        /// </summary>
+        /// <returns></returns>
+        public bool GetTestLectureContestsRelationDataByCondition(IList<string> lectureContests)
+        {
+            var resultBuilder = Builders<LectureContestResults>.Filter;
+            var filter = resultBuilder.Where(x => x.IsDeleted == true || (x.IsDeleted == false && lectureContests.Count > 0 && lectureContests.Contains(x.LectureContestId)));
+            var lectureContestResultsList = MongoDbClientSingle.Instance.LectureContestResults.Find(filter)?.Project(c => c.Id)?.ToList();
+            if (lectureContestResultsList?.Count > 0)
+            {
+                //删除ids
+                var resultBuilderDelFilter = resultBuilder.In(x => x.Id, lectureContestResultsList);
+                var result = MongoDbClientSingle.Instance.LectureContestResults.DeleteMany(resultBuilderDelFilter);
+            }
+            var lectureContestMessagesBuilder = Builders<LectureContestMessages>.Filter;
+            var lectureContestMessagesFilter = lectureContestMessagesBuilder.Where(x => x.IsDeleted == true || (x.IsDeleted == false && lectureContests.Count > 0 && lectureContests.Contains(x.ContestId)));
+            var lectureContestMessagesList = MongoDbClientSingle.Instance.LectureContestMessages.Find(lectureContestMessagesFilter)?.Project(c => c.Id)?.ToList();
+            if (lectureContestMessagesList?.Count > 0)
+            {
+                //删除ids
+                var lectureContestMessagesDelFilter = lectureContestMessagesBuilder.In(x => x.Id, lectureContestMessagesList);
+                var result = MongoDbClientSingle.Instance.LectureContestMessages.DeleteMany(lectureContestMessagesDelFilter);
+            }
+
+            var lectureContestEntryScoreRecordsBuilder = Builders<LectureContestEntryScoreRecords>.Filter;
+            var lectureContestEntryScoreRecordsFilter = lectureContestEntryScoreRecordsBuilder.Where(x => x.IsDeleted == true || (x.IsDeleted == false && lectureContests.Count > 0 && lectureContests.Contains(x.ContestId)));
+            var lectureContestEntryScoreRecordsList = MongoDbClientSingle.Instance.LectureContestEntryScoreRecords.Find(lectureContestEntryScoreRecordsFilter)?.Project(c => c.Id)?.ToList();
+            if (lectureContestEntryScoreRecordsList?.Count > 0)
+            {
+                //删除ids
+                var lectureContestEntryScoreRecordsDelFilter = lectureContestEntryScoreRecordsBuilder.In(x => x.Id, lectureContestEntryScoreRecordsList);
+                var result = MongoDbClientSingle.Instance.LectureContestEntryScoreRecords.DeleteMany(lectureContestEntryScoreRecordsDelFilter);
+            }
+
+            var lectureContestEntriesBuilder = Builders<LectureContestEntries>.Filter;
+            var lectureContestEntriesFilter = lectureContestEntriesBuilder.Where(x => x.IsDeleted == true || (x.IsDeleted == false && lectureContests.Count > 0 && lectureContests.Contains(x.ContestId)));
+            var lectureContestEntriesList = MongoDbClientSingle.Instance.LectureContestEntries.Find(lectureContestEntriesFilter)?.Project(c => c.Id)?.ToList();
+            if (lectureContestEntriesList?.Count > 0)
+            {
+                //删除ids
+                var lectureContestEntriesDelFilter = lectureContestEntriesBuilder.In(x => x.Id, lectureContestEntriesList);
+                var result = MongoDbClientSingle.Instance.LectureContestEntries.DeleteMany(lectureContestEntriesDelFilter);
+            }
+
+            var lectureContestBrowserRecordsBuilder = Builders<LectureContestBrowserRecords>.Filter;
+            var lectureContestBrowserRecordsFilter = lectureContestBrowserRecordsBuilder.Where(x => x.IsDeleted == true || (x.IsDeleted == false && lectureContests.Count > 0 && lectureContests.Contains(x.ContestId)));
+            var lectureContestBrowserRecordsList = MongoDbClientSingle.Instance.LectureContestBrowserRecords.Find(lectureContestBrowserRecordsFilter)?.Project(c => c.Id)?.ToList();
+            if (lectureContestBrowserRecordsList?.Count > 0)
+            {
+                //删除ids
+                var lectureContestBrowserRecordsDelFilter = lectureContestBrowserRecordsBuilder.In(x => x.Id, lectureContestBrowserRecordsList);
+                var result = MongoDbClientSingle.Instance.LectureContestBrowserRecords.DeleteMany(lectureContestBrowserRecordsDelFilter);
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// 过滤测试LectureContestEntries
+        /// </summary>
+        /// <returns></returns>
+        public bool GetTestLectureContestEntriesByCondition()
+        {
+            Logger.WriteLineInfo($"Starting Clear LectureContestBrowserRecords Data");
+            var lectureContestEntriesBuilder = Builders<LectureContestEntries>.Filter;
+            var lectureContestEntriesFilter = lectureContestEntriesBuilder.Where(x => x.IsDeleted == false); 
+            var lectureContestEntriesList = MongoDbClientSingle.Instance.LectureContestEntries.Find(lectureContestEntriesFilter)?.Project(c => c.Id)?.ToList();
+            if (lectureContestEntriesList?.Count > 0)
+            {
+                foreach (var item in lectureContestEntriesList)
+                {
+                    var lectureContestBrowserRecordsBuilder = Builders<LectureContestBrowserRecords>.Filter;
+                    var lectureContestBrowserRecordsFilter = lectureContestBrowserRecordsBuilder.Where(x => x.EntryId == item);
+                    var lectureContestBrowserRecordsList = MongoDbClientSingle.Instance.LectureContestBrowserRecords.Find(lectureContestBrowserRecordsFilter)?.Project(c => c.Id)?.ToList();
+                    if (lectureContestBrowserRecordsList?.Count > 0)
+                    {
+                        //先更新,在删除
+                        var update = Builders<LectureContestEntries>.Update.Set(x => x.BrowserRecord, lectureContestBrowserRecordsList.Count)
+                                                                            .Set(x => x.UpdateTime, DateTime.UtcNow);
+                        MongoDbClientSingle.Instance.LectureContestEntries.UpdateOne(n => n.Id == item, update);
+
+                        //删除ids
+                        var lectureContestBrowserRecordsDelFilter = lectureContestBrowserRecordsBuilder.In(x => x.Id, lectureContestBrowserRecordsList);
+                        var result = MongoDbClientSingle.Instance.LectureContestBrowserRecords.DeleteMany(lectureContestBrowserRecordsDelFilter);
+                    }
+
+                }
+            }
+            Logger.WriteLineInfo($"Clear LectureContestBrowserRecords Data Completed, Count: " + lectureContestEntriesList.Count);
+            return true;
+        }
+
+        /// <summary>
+        /// 保存清理数据
+        /// </summary>
+        /// <param name="terminalList"></param>
+        /// <returns></returns>
+        public bool SaveClearData(IList<string> lectureContests)
+        {
+            if (lectureContests?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear LectureContests Data");
+                //删除正式表
+                var builder = Builders<LectureContests>.Filter;
+                var filter = builder.In(x => x.Id, lectureContests);
+                var result = MongoDbClientSingle.Instance.LectureContests.DeleteMany(filter);
+                Logger.WriteLineInfo($"Clear LectureContests Data Completed, Count: " + lectureContests.Count);
+            }
+
+            return true;
+        }
+    }
+}

+ 106 - 0
Tools/Flyinsono.DBCopy.Tool/Service/Repositories/OrganizationsDBRepository.cs

@@ -0,0 +1,106 @@
+using Flyinsono.DBCopy.Tool.Entities;
+using Flyinsono.DBCopy.Tool.Utilities;
+using MongoDB.Driver;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using WingServerCommon.Mapper;
+
+namespace Flyinsono.DBCopy.Tool.Service.Repositories
+{
+    internal class OrganizationsDBRepository
+    {
+        /// <summary>
+        /// 过滤测试机构
+        /// </summary>
+        /// <returns></returns>
+        public IList<Organizations> GetTestOrganizationsByCondition()
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear Organizations Data");
+            var organizations = new List<Organizations>();
+            var filterOrganizations = CommonConfigManager.FilterOrganizations;
+            var builder = Builders<Organizations>.Filter;
+            var filter = builder.Where(x => x.IsDeleted == false && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            FilterDefinition<Organizations> orFilter = null;
+            if (filterOrganizations?.Count > 0)
+            {
+                foreach (var item in filterOrganizations)
+                {
+                    var curNameFilter = builder.Where(c => c.Name.ToLower().Contains(item.ToLower()));
+                    if (orFilter == null)
+                    {
+                        orFilter = curNameFilter;
+                    }
+                    else
+                    {
+                        orFilter = orFilter | curNameFilter;
+                    }
+                }
+            }
+            filter = filter & orFilter;
+            var organizationList = MongoDbClientSingle.Instance.Organizations.Find(filter)?.ToList();
+            if (organizationList?.Count > 0)
+            {
+                foreach (var item in organizationList)
+                {
+                    organizations.Add(item);
+                }
+            }
+            var deleteList = MongoDbClientSingle.Instance.Organizations.Find(c => c.IsDeleted == true)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    if (!organizations.Exists(c => c.Id == item.Id))
+                    {
+                        organizations.Add(item);
+                    }
+                }
+            }
+            Regex numberRegex = new Regex("^[0-9]+\\.{0,1}[0-9]{0,}$");
+            var dList = MongoDbClientSingle.Instance.Organizations.Find(c => c.IsDeleted == false && c.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline && numberRegex.IsMatch(c.Name))?.ToList();
+            if (dList?.Count > 0)
+            {
+                foreach (var item in dList)
+                {
+                    if (!organizations.Exists(c => c.Id == item.Id))
+                    {
+                        organizations.Add(item);
+                    }
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear Organizations Data, Count: " + organizations.Count);
+            return organizations;
+        }
+
+        /// <summary>
+        /// 保存清理数据
+        /// </summary>
+        /// <param name="{"></param>
+        /// <returns></returns>
+        public bool SaveClearData(IList<Organizations> organizationList)
+        {
+            if (organizationList?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear Organizations Data");
+                //先删除类似的备份数据在新增
+                var deleteIds = organizationList.Select(c => c.Id).Distinct().ToList();
+                var bakBuilder = Builders<OrganizationsBak>.Filter;
+                var bakFilter = bakBuilder.In(x => x.Id, deleteIds);
+                var res = MongoDbClientSingle.Instance.OrganizationsBak.DeleteMany(bakFilter);
+                var waitInsertUsers = organizationList.Where(c => c.IsDeleted == false).MappingTo<List<OrganizationsBak>>();
+                MongoDbClientSingle.Instance.OrganizationsBak.InsertMany(waitInsertUsers);
+                //删除正式表
+                var builder = Builders<Organizations>.Filter;
+                var filter = builder.In(x => x.Id, deleteIds);
+                var result = MongoDbClientSingle.Instance.Organizations.DeleteMany(filter);
+
+                Logger.WriteLineInfo($"Clear Organizations Data Completed, Count: " + organizationList.Count);
+            }
+            return true;
+        }
+    }
+}

+ 117 - 0
Tools/Flyinsono.DBCopy.Tool/Service/Repositories/PosterConfigsDBRepository.cs

@@ -0,0 +1,117 @@
+using Flyinsono.DBCopy.Tool.Entities;
+using Flyinsono.DBCopy.Tool.Utilities;
+using MongoDB.Driver;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Service.Repositories
+{
+    internal class PosterConfigsDBRepository
+    {
+        /// <summary>
+        /// 过滤测试PosterConfigs
+        /// </summary>
+        /// <returns></returns>
+        public IList<PosterConfigs> GetTestPosterConfigsByCondition()
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear PosterConfigs Data");
+            IList<PosterConfigs> posterConfigs = new List<PosterConfigs>();
+            var builder = Builders<PosterConfigs>.Filter;
+            var filter = builder.Where(x => x.IsDeleted == false && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline.AddMonths(-18));
+            var posterConfigsList = MongoDbClientSingle.Instance.PosterConfigs.Find(filter)?.ToList();
+            if (posterConfigsList?.Count > 0)
+            {
+                foreach (var item in posterConfigsList)
+                {
+                    posterConfigs.Add(item);
+                }
+            }
+            var deleteList = MongoDbClientSingle.Instance.PosterConfigs.Find(c => c.IsDeleted == true)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    posterConfigs.Add(item);
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear PosterConfigs Data, Count: " + posterConfigs.Count);
+            return posterConfigs;
+        }
+
+        /// <summary>
+        /// 过滤测试PosterHistories
+        /// </summary>
+        /// <returns></returns>
+        public IList<PosterHistories> GetTestPosterHistoriesByCondition(IList<PosterConfigs> posterConfigs)
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear PosterHistories Data");
+            IList<PosterHistories> posterHistories = new List<PosterHistories>();
+            var builder = Builders<PosterHistories>.Filter;
+            var filter = builder.Where(x => x.IsDeleted == false && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline.AddMonths(-18));
+            var posterHistoriesList = MongoDbClientSingle.Instance.PosterHistories.Find(filter)?.ToList();
+            if (posterHistoriesList?.Count > 0)
+            {
+                foreach (var item in posterHistoriesList)
+                {
+                    posterHistories.Add(item);
+                }
+            }
+            var deleteList = MongoDbClientSingle.Instance.PosterHistories.Find(c => c.IsDeleted == true)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    posterHistories.Add(item);
+                }
+            }
+            var ids = posterConfigs.Select(c => c.Id).Distinct().ToList();
+            if (ids?.Count > 0)
+            {
+                var otherList = MongoDbClientSingle.Instance.PosterHistories.Find(c => ids.Contains(c.PosterConfig.ConfigId))?.ToList();
+                if (otherList?.Count > 0)
+                {
+                    foreach (var item in otherList)
+                    {
+                        posterHistories.Add(item);
+                    }
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear PosterHistories Data, Count: " + posterHistories.Count);
+            return posterHistories;
+        }
+
+        /// <summary>
+        /// 保存清理数据
+        /// </summary>
+        /// <param name="terminalList"></param>
+        /// <returns></returns>
+        public bool SaveClearData(IList<PosterConfigs> posterConfigs, IList<PosterHistories> posterHistories)
+        {
+            if (posterConfigs?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear PosterConfigs Data");
+                var configIds = posterConfigs.Select(c => c.Id).ToList();
+                //删除正式表
+                var builder = Builders<PosterConfigs>.Filter;
+                var filter = builder.In(x => x.Id, configIds);
+                var result = MongoDbClientSingle.Instance.PosterConfigs.DeleteMany(filter);
+                Logger.WriteLineInfo($"Clear PosterConfigs Data Completed, Count: " + posterConfigs.Count);
+            }
+
+            if (posterHistories?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear PosterHistories Data");
+                var historiesIds = posterHistories.Select(c => c.Id).ToList();
+                //删除正式表
+                var builder = Builders<PosterHistories>.Filter;
+                var filter = builder.In(x => x.Id, historiesIds);
+                var result = MongoDbClientSingle.Instance.PosterHistories.DeleteMany(filter);
+                Logger.WriteLineInfo($"Clear PosterHistories Data Completed, Count: " + posterHistories.Count);
+            }
+            return true;
+        }
+    }
+}

+ 498 - 0
Tools/Flyinsono.DBCopy.Tool/Service/Repositories/RecordDatasDBRepository.cs

@@ -0,0 +1,498 @@
+using Flyinsono.DBCopy.Tool.Entities;
+using Flyinsono.DBCopy.Tool.Utilities;
+using MongoDB.Driver;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using WingServerCommon.Mapper;
+
+namespace Flyinsono.DBCopy.Tool.Service.Repositories
+{
+    internal class RecordDatasDBRepository
+    {
+        /// <summary>
+        /// 过滤测试TerminalRecords
+        /// </summary>
+        /// <returns></returns>
+        public IList<TerminalRecords> GetTestTerminalRecordsByCondition()
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear TerminalRecords Data");
+            var terminalRecords = new List<TerminalRecords>();
+            //获取删除的user,org,ter三个id
+            var userIdList = MongoDbClientSingle.Instance.UsersBak.Find(c => !string.IsNullOrEmpty(c._id))?.Project(c => c._id)?.ToList();
+            var organizationIdList = MongoDbClientSingle.Instance.OrganizationsBak.Find(c => !string.IsNullOrEmpty(c.Id))?.Project(c => c.Id)?.ToList();
+            var terminalIdList = MongoDbClientSingle.Instance.TerminalsBak.Find(c => !string.IsNullOrEmpty(c.Id))?.Project(c => c.Id)?.ToList();
+            var builder = Builders<TerminalRecords>.Filter ;
+            var creatorUserIdFilter = builder.Where(c => !string.IsNullOrEmpty(c.CreatorUserId) && userIdList.Contains(c.CreatorUserId));
+            var terminalIdFilter = builder.Where(c => c.Terminal != null && terminalIdList.Contains(c.Terminal.Id));
+            var organizationIdFilter = builder.Where(c => c.Organization != null && organizationIdList.Contains(c.Organization.Id));
+            var filter = builder.Where(c => c.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            filter = filter & (creatorUserIdFilter | terminalIdFilter | organizationIdFilter);
+            var deleteList = MongoDbClientSingle.Instance.TerminalRecords.Find(filter)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    terminalRecords.Add(item);
+                }
+            }
+            var otherList = MongoDbClientSingle.Instance.TerminalRecords.Find(c => c.IsDelete == true)?.ToList();
+            if (otherList?.Count > 0)
+            {
+                foreach (var item in otherList)
+                {
+                    if (!terminalRecords.Exists(c => c.Id == item.Id))
+                    {
+                        terminalRecords.Add(item);
+                    }
+                }
+            }
+
+            var patientFilterAnd = builder.Where(c => c.PatientInfo != null && c.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            Regex numberRegex = new Regex("^[0-9]+\\.{0,1}[0-9]{0,}$");
+            FilterDefinition<TerminalRecords> orFilter = builder.Where(c => numberRegex.IsMatch(c.PatientInfo.FirstName) || numberRegex.IsMatch(c.PatientInfo.LastName)); 
+            var filterPatients = CommonConfigManager.FilterPatients;
+            foreach (var item in filterPatients)
+            {
+                var curNameFilter = builder.Where(c => c.PatientInfo.FirstName.ToLower().Contains(item) || c.PatientInfo.LastName.ToLower().Contains(item));
+                if (orFilter == null)
+                {
+                    orFilter = curNameFilter;
+                }
+                else
+                {
+                    orFilter = orFilter | curNameFilter;
+                }
+            }
+            patientFilterAnd = patientFilterAnd & orFilter;
+            var patientList = MongoDbClientSingle.Instance.TerminalRecords.Find(patientFilterAnd)?.ToList();
+            if (patientList?.Count > 0)
+            {
+                foreach (var item in patientList)
+                {
+                    if (!terminalRecords.Exists(c => c.Id == item.Id))
+                    {
+                        terminalRecords.Add(item);
+                    }
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear TerminalRecords Data, Count: " + terminalRecords.Count);
+            return terminalRecords;
+        }
+
+        /// <summary>
+        /// 清理数据
+        /// </summary>
+        /// <param name="terminalRecords"></param>
+        /// <returns></returns>
+        public bool ClearTestTerminalsRelationData(IList<TerminalRecords> terminalRecords)
+        {
+            if (terminalRecords?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear TerminalRecords Relation Data");
+                var allIds = terminalRecords.Select(c => c.Id).Distinct().ToList();
+                //var specialList = new List<string>() {
+                //    "AEE9BF94D61543348B9162444AE93208",
+                //    "9A7FB3B9AEC4453291A0EE06F19353EC",
+                //    "2CA0E54F2B2640F3B0FC5614FBE48F59",
+                //    "A21684F374334EDD8720BC1D52983C89",
+                //    "E8C8F957001049F7926493D80B5E899C"
+                //};
+                //var spRes = MongoDbClientSingle.Instance.ReportInfoResults.DeleteMany(c => specialList.Contains(c.RecordId));                
+                if (allIds?.Count > 0)
+                {
+                    int perLength = 500;
+                    var count = allIds.Count / perLength + (allIds.Count % perLength > 0 ? 1 : 0);
+                    var startIndex = 0;
+                    var length = 0;
+                    for (var i = 0; i < count; i++)
+                    {
+                        if ((count - 1) == i)
+                        {
+                            length = allIds.Count - i * perLength;
+                        }
+                        else
+                        {
+                            length = perLength;
+                        }
+                        startIndex = i * perLength;
+                        var terminalRecordIds = allIds.GetRange(startIndex, length);
+                        //Logger.WriteLineInfo($"ClearTestTerminalsRelationData i.{i}-{terminalRecordIds[0]}");
+                        //Debug.WriteLine($"ClearTestTerminalsRelationData i.{i}-{JsonConvert.SerializeObject(terminalRecordIds)}");
+                        //删除TerminalRecordReportStates
+                        var terminalRecordReportStatesBuilder = Builders<TerminalRecordReportStates>.Filter;
+                        var terminalRecordReportStatesDelFilter = terminalRecordReportStatesBuilder.In(x => x.TerminalRecordId, terminalRecordIds);
+                        var result = MongoDbClientSingle.Instance.TerminalRecordReportStates.DeleteMany(terminalRecordReportStatesDelFilter);
+                        //删除TerminalRecordReportAISelectResults
+                        var terminalRecordReportAISelectResultsBuilder = Builders<TerminalRecordReportAISelectResults>.Filter;
+                        var terminalRecordReportAISelectResultsDelFilter = terminalRecordReportAISelectResultsBuilder.In(x => x.TerminalRecordId, terminalRecordIds);
+                        result = MongoDbClientSingle.Instance.TerminalRecordReportAISelectResults.DeleteMany(terminalRecordReportAISelectResultsDelFilter);
+                        //删除TerminalAIDataExcuteRecords
+                        var terminalAIDataExcuteRecordsBuilder = Builders<TerminalAIDataExcuteRecords>.Filter;
+                        var terminalAIDataExcuteRecordsDelFilter = terminalAIDataExcuteRecordsBuilder.In(x => x.TerminalRecordId, terminalRecordIds);
+                        result = MongoDbClientSingle.Instance.TerminalAIDataExcuteRecords.DeleteMany(terminalAIDataExcuteRecordsDelFilter);
+                        //删除FinishedTerminalRecords
+                        var finishedTerminalRecordsBuilder = Builders<FinishedTerminalRecords>.Filter;
+                        var finishedTerminalRecordsDelFilter = finishedTerminalRecordsBuilder.In(x => x.TerminalRecordId, terminalRecordIds);
+                        result = MongoDbClientSingle.Instance.FinishedTerminalRecords.DeleteMany(finishedTerminalRecordsDelFilter);
+                        //删除ReportInfoResults
+                        var reportInfoResultsBuilder = Builders<ReportInfoResults>.Filter;
+                        var reportInfoResultsDelFilter = reportInfoResultsBuilder.In(x => x.RecordId, terminalRecordIds);
+                        result = MongoDbClientSingle.Instance.ReportInfoResults.DeleteMany(reportInfoResultsDelFilter);
+                        //先备份,
+                        //var reportInfoResultsList = MongoDbClientSingle.Instance.ReportInfoResults.Find(c => terminalRecordIds.Contains(c.RecordId))?.ToList();
+                        //if (reportInfoResultsList?.Count > 0)
+                        //{
+                        //    var ids = reportInfoResultsList.Select(c => c.Id).ToList();
+                        //    var bakBuilder = Builders<ReportInfoResultsBak>.Filter;
+                        //    var bakFilter = bakBuilder.In(x => x.Id, ids);
+                        //    var res = MongoDbClientSingle.Instance.ReportInfoResultsBak.DeleteMany(bakFilter);
+                        //    var waitInsertUsers = reportInfoResultsList.MappingTo<List<ReportInfoResultsBak>>();
+                        //    MongoDbClientSingle.Instance.ReportInfoResultsBak.InsertMany(waitInsertUsers);
+                        //    //真删除ReportInfoResults
+                        //    var reportInfoResultsBuilder = Builders<ReportInfoResults>.Filter;
+                        //    var reportInfoResultsDelFilter = reportInfoResultsBuilder.In(x => x.Id, ids);
+                        //    result = MongoDbClientSingle.Instance.ReportInfoResults.DeleteMany(reportInfoResultsDelFilter);
+                        //}
+                        //删除TerminalDatas
+                        var builder = Builders<TerminalDatas>.Filter;
+                        var terminalDataIdList = MongoDbClientSingle.Instance.TerminalDatas.Find(c => terminalRecordIds.Contains(c.TerminalRecordId))?.Project(c => c.Id)?.ToList();
+                       
+                        if (terminalDataIdList?.Count > 0)
+                        {
+                            //最后删除掉
+                            if (terminalDataIdList?.Count > 0)
+                            {
+                                int perLength1 = 2000;
+                                var count1 = terminalDataIdList.Count / perLength1 + (terminalDataIdList.Count % perLength1 > 0 ? 1 : 0);
+                                var startIndex1 = 0;
+                                var length1 = 0;
+                                for (var j = 0; j < count1; j++)
+                                {
+                                    if ((count1 - 1) == j)
+                                    {
+                                        length1 = terminalDataIdList.Count - j * perLength1;
+                                    }
+                                    else
+                                    {
+                                        length1 = perLength1;
+                                    }
+                                    startIndex1 = j * perLength1;
+                                    var tempTerminalDataIdList = terminalDataIdList.GetRange(startIndex1, length1);
+
+                                    //删除TerminalAIDataExcuteRecords
+                                    var otherTerminalAIDataExcuteRecordsDelFilter = terminalAIDataExcuteRecordsBuilder.In(x => x.TerminalDataId, tempTerminalDataIdList);
+                                    result = MongoDbClientSingle.Instance.TerminalAIDataExcuteRecords.DeleteMany(otherTerminalAIDataExcuteRecordsDelFilter);
+
+                                    //删除TerminalAIDatas
+                                    var terminalAIDatasBuilder = Builders<TerminalAIDatas>.Filter;
+                                    var terminalAIDatasDelFilter = terminalAIDatasBuilder.In(x => x.TerminalDataId, tempTerminalDataIdList);
+                                    result = MongoDbClientSingle.Instance.TerminalAIDatas.DeleteMany(terminalAIDatasDelFilter);
+
+                                    var terminalDataDelFilter = builder.In(x => x.Id, tempTerminalDataIdList);
+                                    result = MongoDbClientSingle.Instance.TerminalDatas.DeleteMany(terminalDataDelFilter);
+                                }
+                            }
+                        }
+                        Logger.WriteLineInfo($"Clear TerminalRecords Relation Data Range {startIndex} - {(startIndex + length)}");
+                    }
+                    //var filter = Builders<TerminalDatas>.Filter.Where(x => (x.Files == null || x.Files.Count == 0) && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+                    //var otherTerminalDataIdList = MongoDbClientSingle.Instance.TerminalDatas.Find(filter)?.Project(c => c.Id)?.ToList();
+                    //if (otherTerminalDataIdList?.Count > 0)
+                    //{
+                    //    //删除TerminalAIDataExcuteRecords
+                    //    var otherTerminalAIDataExcuteRecordsDelFilter = Builders<TerminalAIDataExcuteRecords>.Filter.In(x => x.TerminalDataId, otherTerminalDataIdList);
+                    //    var res = MongoDbClientSingle.Instance.TerminalAIDataExcuteRecords.DeleteMany(otherTerminalAIDataExcuteRecordsDelFilter);
+
+                    //    //删除TerminalAIDatas
+                    //    var terminalAIDatasBuilder = Builders<TerminalAIDatas>.Filter;
+                    //    var terminalAIDatasDelFilter = terminalAIDatasBuilder.In(x => x.TerminalDataId, otherTerminalDataIdList);
+                    //    res = MongoDbClientSingle.Instance.TerminalAIDatas.DeleteMany(terminalAIDatasDelFilter);
+
+                    //    //最后删除掉
+                    //    var terminalDataDelFilter = Builders<TerminalDatas>.Filter.In(x => x.Id, otherTerminalDataIdList);
+                    //    res = MongoDbClientSingle.Instance.TerminalDatas.DeleteMany(terminalDataDelFilter);
+                    //}
+                }
+
+                Logger.WriteLineInfo($"Clear TerminalRecords Relation Data Completed, Count: " + terminalRecords.Count);
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// 过滤测试ConsultationRecords
+        /// </summary>
+        /// <returns></returns>
+        public IList<ConsultationRecords> GetTestConsultationRecordsByCondition()
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear ConsultationRecords Data");
+            var consultationRecords = new List<ConsultationRecords>();
+            //获取删除的user,org,ter三个id
+            var userIdList = MongoDbClientSingle.Instance.UsersBak.Find(c => !string.IsNullOrEmpty(c._id))?.Project(c => c._id)?.ToList();
+            var organizationIdList = MongoDbClientSingle.Instance.OrganizationsBak.Find(c => !string.IsNullOrEmpty(c.Id))?.Project(c => c.Id)?.ToList();
+            var terminalIdList = MongoDbClientSingle.Instance.TerminalsBak.Find(c => !string.IsNullOrEmpty(c.Id))?.Project(c => c.Id)?.ToList();
+            var builder = Builders<ConsultationRecords>.Filter;
+            var creatorUserIdFilter = builder.Where(c => (c.ExpertInfo != null && userIdList.Contains(c.ExpertInfo.ID)) || (c.DoctorInfo != null && userIdList.Contains(c.DoctorInfo.ID)));
+            var terminalIdFilter = builder.Where(c => c.TerminalInfo != null && terminalIdList.Contains(c.TerminalInfo.Id));
+            var organizationIdFilter = builder.Where(c => (c.PrimaryHosptial != null && organizationIdList.Contains(c.PrimaryHosptial.Id)) || (c.CentralHospital != null && organizationIdList.Contains(c.CentralHospital.Id)));
+            var filter = builder.Where(c => c.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            filter = filter & (creatorUserIdFilter | terminalIdFilter | organizationIdFilter);
+            var deleteList = MongoDbClientSingle.Instance.ConsultationRecords.Find(filter)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    consultationRecords.Add(item);
+                }
+            }
+
+            var otherList = MongoDbClientSingle.Instance.ConsultationRecords.Find(c => c.IsDeleted == true)?.ToList();
+            if (otherList?.Count > 0)
+            {
+                foreach (var item in otherList)
+                {
+                    if (!consultationRecords.Exists(c => c.Id == item.Id))
+                    {
+                        consultationRecords.Add(item);
+                    }
+                }
+            }
+
+            var patientFilterAnd = builder.Where(c => c.PatientInfo != null && c.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            Regex numberRegex = new Regex("^[0-9]+\\.{0,1}[0-9]{0,}$");
+            FilterDefinition<ConsultationRecords> orFilter = builder.Where(c => numberRegex.IsMatch(c.PatientInfo.Name));
+            var filterPatients = CommonConfigManager.FilterPatients;
+            foreach (var item in filterPatients)
+            {
+                var curNameFilter = builder.Where(c => c.PatientInfo.Name.ToLower().Contains(item));
+                if (orFilter == null)
+                {
+                    orFilter = curNameFilter;
+                }
+                else
+                {
+                    orFilter = orFilter | curNameFilter;
+                }
+            }
+            patientFilterAnd = patientFilterAnd & orFilter;
+            var patientList = MongoDbClientSingle.Instance.ConsultationRecords.Find(patientFilterAnd)?.ToList();
+            if (patientList?.Count > 0)
+            {
+                foreach (var item in patientList)
+                {
+                    if (!consultationRecords.Exists(c => c.Id == item.Id))
+                    {
+                        consultationRecords.Add(item);
+                    }
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear ConsultationRecords Data, Count: " + consultationRecords.Count);
+            return consultationRecords;
+        }
+
+        /// <summary>
+        /// 清理数据
+        /// </summary>
+        /// <param name="terminalRecords"></param>
+        /// <returns></returns>
+        public bool ClearTestConsultationRecordsRelationData(IList<ConsultationRecords> consultationRecords)
+        {
+            if (consultationRecords?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear ConsultationRecords Data");
+                var allIds = consultationRecords.Select(c => c.Id).Distinct().ToList();
+
+                if (allIds?.Count > 0)
+                {
+                    int perLength = 1000;
+                    var count = allIds.Count / perLength + (allIds.Count % perLength > 0 ? 1 : 0);
+                    var startIndex = 0;
+                    var length = 0;
+                    for (var i = 0; i < count; i++)
+                    {
+                        if ((count - 1) == i)
+                        {
+                            length = allIds.Count - i * perLength;
+                        }
+                        else
+                        {
+                            length = perLength;
+                        }
+                        startIndex = i * perLength;
+                        var deleteIds = allIds.GetRange(startIndex, length);
+
+                        //删除ConsultationEvaluates
+                        var consultationEvaluatesBuilder = Builders<ConsultationEvaluates>.Filter;
+                        var consultationEvaluatesDelFilter = consultationEvaluatesBuilder.In(x => x.ConsultationRecordId, deleteIds);
+                        var result = MongoDbClientSingle.Instance.ConsultationEvaluates.DeleteMany(consultationEvaluatesDelFilter);
+                        //删除ReportInfoResults
+                        var reportInfoResultsBuilder = Builders<ReportInfoResults>.Filter;
+                        var reportInfoResultsDelFilter = reportInfoResultsBuilder.In(x => x.RecordId, deleteIds);
+                        result = MongoDbClientSingle.Instance.ReportInfoResults.DeleteMany(reportInfoResultsDelFilter);
+                        //先备份,后删除
+                        //var reportInfoResultsList = MongoDbClientSingle.Instance.ReportInfoResults.Find(c => deleteIds.Contains(c.RecordId))?.ToList();
+                        //if (reportInfoResultsList?.Count > 0)
+                        //{
+                        //    var ids = reportInfoResultsList.Select(c => c.Id).ToList();
+                        //    var bakBuilder2 = Builders<ReportInfoResultsBak>.Filter;
+                        //    var bakFilter2 = bakBuilder2.In(x => x.Id, ids);
+                        //    var res2 = MongoDbClientSingle.Instance.ReportInfoResultsBak.DeleteMany(bakFilter2);
+                        //    var waitInsertUsers = reportInfoResultsList.MappingTo<List<ReportInfoResultsBak>>();
+                        //    MongoDbClientSingle.Instance.ReportInfoResultsBak.InsertMany(waitInsertUsers);
+                        //    //真删除ReportInfoResults
+                        //    var reportInfoResultsBuilder = Builders<ReportInfoResults>.Filter;
+                        //    var reportInfoResultsDelFilter = reportInfoResultsBuilder.In(x => x.Id, ids);
+                        //    result = MongoDbClientSingle.Instance.ReportInfoResults.DeleteMany(reportInfoResultsDelFilter);
+                        //}
+                        //var reportInfoResultsBuilder = Builders<ReportInfoResults>.Filter;
+                        //var reportInfoResultsDelFilter = reportInfoResultsBuilder.In(x => x.RecordId, deleteIds);
+                        //result = MongoDbClientSingle.Instance.ReportInfoResults.DeleteMany(reportInfoResultsDelFilter);
+                        //先删除类似的备份数据在新增
+                        var bakBuilder = Builders<ConsultationRecordsBak>.Filter;
+                        var bakFilter = bakBuilder.In(x => x.Id, deleteIds);
+                        var res = MongoDbClientSingle.Instance.ConsultationRecordsBak.DeleteMany(bakFilter);
+                        var tempList = consultationRecords.Where(c => deleteIds.Contains(c.Id));
+                        var waitInsertConsultationRecords = tempList.MappingTo<List<ConsultationRecordsBak>>();
+                        MongoDbClientSingle.Instance.ConsultationRecordsBak.InsertMany(waitInsertConsultationRecords);
+                        //删除正式表
+                        var builder = Builders<ConsultationRecords>.Filter;
+                        var filter = builder.In(x => x.Id, deleteIds);
+                        result = MongoDbClientSingle.Instance.ConsultationRecords.DeleteMany(filter);
+                        Logger.WriteLineInfo($"Clear ConsultationRecords Data Range {startIndex} - {(startIndex + length)}");
+                    }
+                }
+
+                Logger.WriteLineInfo($"Clear ConsultationRecords Data Completed, Count: " + consultationRecords?.Count);
+            }
+
+            return true;
+        }
+
+        /// <summary>
+        /// 过滤测试病人
+        /// </summary>
+        /// <returns></returns>
+        public bool ClearPatientsData()
+        {
+            var builder = Builders<Patients>.Filter;
+            var filter = builder.Where(x => !string.IsNullOrEmpty(x.Id) && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            var allIds = MongoDbClientSingle.Instance.Patients.Find(filter)?.Project(c => c.Id)?.ToList();
+
+            if (allIds?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear Patients Data");
+                var count = allIds.Count / 5000 + (allIds.Count % 5000 > 0 ? 1 : 0);
+                var startIndex = 0;
+                var length = 0;
+                for (var i = 0; i < count; i++)
+                {
+                    if ((count - 1) == i)
+                    {
+                        length = allIds.Count - i * 5000;
+                    }
+                    else
+                    {
+                        length = 5000;
+                    }
+                    startIndex = i * 5000;
+                    var tempList = allIds.GetRange(startIndex, length);
+                    var deleteFilter = builder.In(x => x.Id, tempList);
+                    var result = MongoDbClientSingle.Instance.Patients.DeleteMany(deleteFilter);
+                    Logger.WriteLineInfo($"Clear Patients Data Range {startIndex} - {(startIndex + length)}");
+                }
+                Logger.WriteLineInfo($"Clear Patients Data Completed, Count: " + allIds?.Count);
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// 过滤测试病人
+        /// </summary>
+        /// <returns></returns>
+        public bool ClearPatientInfosData()
+        {
+            var builder = Builders<PatientInfos>.Filter;
+            var filter = builder.Where(x => !string.IsNullOrEmpty(x.Id) && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            var allIds = MongoDbClientSingle.Instance.PatientInfos.Find(filter)?.Project(c => c.Id)?.ToList();
+
+            if (allIds?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear PatientInfos Data");
+                var count = allIds.Count / 5000 + (allIds.Count % 5000 > 0 ? 1 : 0);
+                var startIndex = 0;
+                var length = 0;
+                for (var i = 0; i < count; i++)
+                {
+                    if ((count - 1) == i)
+                    {
+                        length = allIds.Count - i * 5000;
+                    }
+                    else
+                    {
+                        length = 5000;
+                    }
+                    startIndex = i * 5000;
+                    var tempList = allIds.GetRange(startIndex, length);
+                    var deleteFilter = builder.In(x => x.Id, tempList);
+                    var result = MongoDbClientSingle.Instance.PatientInfos.DeleteMany(deleteFilter);
+                    Logger.WriteLineInfo($"Clear PatientInfos Data Range {startIndex} - {(startIndex + length)}");
+                }
+                Logger.WriteLineInfo($"Clear PatientInfos Data Completed, Count: " + allIds?.Count);
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// 保存清理数据
+        /// </summary>
+        /// <param name="userList"></param>
+        /// <returns></returns>
+        public bool SaveClearData(IList<TerminalRecords> terminalRecordsList)
+        {
+            if (terminalRecordsList?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear TerminalRecords Data");
+                var allIds = terminalRecordsList.Select(c => c.Id).Distinct().ToList();
+                if (allIds?.Count > 0)
+                {
+                    var count = allIds.Count / 2000 + (allIds.Count % 2000 > 0 ? 1 : 0);
+                    var startIndex = 0;
+                    var length = 0;
+                    for (var i = 0; i < count; i++)
+                    {
+                        if ((count - 1) == i)
+                        {
+                            length = allIds.Count - i * 2000;
+                        }
+                        else
+                        {
+                            length = 2000;
+                        }
+                        startIndex = i * 2000;
+                        var deleteIds = allIds.GetRange(startIndex, length);
+                        //先删除类似的备份数据在新增
+                        var bakBuilder = Builders<TerminalRecordsBak>.Filter;
+                        var bakFilter = bakBuilder.In(x => x.Id, deleteIds);
+                        var res = MongoDbClientSingle.Instance.TerminalRecordsBak.DeleteMany(bakFilter);
+                        var tempList = terminalRecordsList.Where(c => deleteIds.Contains(c.Id));
+                        var waitInsertTerminalRecords = tempList.MappingTo<List<TerminalRecordsBak>>();
+                        MongoDbClientSingle.Instance.TerminalRecordsBak.InsertMany(waitInsertTerminalRecords);
+                        //删除正式表
+                        var builder = Builders<TerminalRecords>.Filter;
+                        var filter = builder.In(x => x.Id, deleteIds);
+                        var result = MongoDbClientSingle.Instance.TerminalRecords.DeleteMany(filter);
+                        Logger.WriteLineInfo($"Clear TerminalRecords Data Range {startIndex} - {(startIndex + length)}");
+                    }
+                }
+                Logger.WriteLineInfo($"Clear TerminalRecords Data Completed, Count: " + terminalRecordsList?.Count);
+            }
+            return true;
+        }
+    }
+}

+ 87 - 0
Tools/Flyinsono.DBCopy.Tool/Service/Repositories/TerninalsDBRepository.cs

@@ -0,0 +1,87 @@
+using Flyinsono.DBCopy.Tool.Entities.Config;
+using Flyinsono.DBCopy.Tool.Entities;
+using Flyinsono.DBCopy.Tool.Utilities;
+using MongoDB.Driver;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using WingServerCommon.Mapper;
+
+namespace Flyinsono.DBCopy.Tool.Service.Repositories
+{
+    internal class TerninalsDBRepository
+    {
+        /// <summary>
+        /// 过滤测试设备
+        /// </summary>
+        /// <returns></returns>
+        public IList<Terminals> GetTestTerninalsByCondition()
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear Terminals Data");
+            var terminals = new List<Terminals>();
+            var filterTerminals = CommonConfigManager.FilterTerminals;
+            var builder = Builders<Terminals>.Filter;
+            var filter = builder.Where(x => x.IsDeleted == false && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            FilterDefinition<Terminals> orFilter = builder.Where(c => (c.CreateAdmin != null && c.Organization == null) || c.SerialNumber.ToLower() == "unknown" || c.Model == null || c.Model.Length <= 0);
+            if (filterTerminals?.Count > 0)
+            {
+                foreach (var item in filterTerminals)
+                {
+                    var tempFilter = builder.Where(c => c.UniquedId == item);
+                    orFilter = orFilter | tempFilter;
+                }
+            }
+            filter = filter & orFilter;
+            var terminalList = MongoDbClientSingle.Instance.Terminals.Find(filter)?.ToList();
+            if (terminalList?.Count > 0)
+            {
+                foreach (var item in terminalList)
+                {
+                    terminals.Add(item);
+                }
+            }
+            var deleteList = MongoDbClientSingle.Instance.Terminals.Find(c => c.IsDeleted == true)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    if (!terminals.Exists(c => c.Id == item.Id))
+                    {
+                        terminals.Add(item);
+                    }
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear Terminals Data, Count: " + terminals.Count);
+            return terminals;
+        }
+
+        /// <summary>
+        /// 保存清理数据
+        /// </summary>
+        /// <param name="terminalList"></param>
+        /// <returns></returns>
+        public bool SaveClearData(IList<Terminals> terminalList)
+        {
+            if (terminalList?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear Terminals Data");
+                //先删除类似的备份数据在新增
+                var deleteIds = terminalList.Select(c => c.Id).Distinct().ToList();
+                var bakBuilder = Builders<TerminalsBak>.Filter;
+                var bakFilter = bakBuilder.In(x => x.Id, deleteIds);
+                var res = MongoDbClientSingle.Instance.TerminalsBak.DeleteMany(bakFilter);
+                var waitInsertUsers = terminalList.Where(c => c.IsDeleted == false).MappingTo<List<TerminalsBak>>();
+                MongoDbClientSingle.Instance.TerminalsBak.InsertMany(waitInsertUsers);
+                //删除正式表
+                var builder = Builders<Terminals>.Filter;
+                var filter = builder.In(x => x.Id, deleteIds);
+                var result = MongoDbClientSingle.Instance.Terminals.DeleteMany(filter);
+                Logger.WriteLineInfo($"Clear Terminals Data Completed, Count: "+ terminalList.Count);
+            }
+            return true;
+        }
+    }
+}

+ 128 - 0
Tools/Flyinsono.DBCopy.Tool/Service/Repositories/UploadStorageFileInfoDBRepository.cs

@@ -0,0 +1,128 @@
+using Flyinsono.DBCopy.Tool.Entities;
+using Flyinsono.DBCopy.Tool.Utilities;
+using MongoDB.Driver;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Service.Repositories
+{
+    internal class UploadStorageFileInfoDBRepository
+    {
+        /// <summary>
+        /// 过滤测试UploadStorageFileInfo
+        /// </summary>
+        /// <returns></returns>
+        public List<string> GetTestUploadStorageFileInfoByCondition()
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear UploadStorageFile Data");
+            List<string> uploadStorageFileInfo = new List<string>();
+            var builder = Builders<UploadStorageFileInfo>.Filter;
+            var filter = builder.Where(x => x.IsDeleted == false && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline.AddMonths(-18));
+            var conversationsList = MongoDbClientSingle.Instance.UploadStorageFileInfo.Find(filter)?.Project(c => c.Id)?.ToList();
+            if (conversationsList?.Count > 0)
+            {
+                foreach (var item in conversationsList)
+                {
+                    uploadStorageFileInfo.Add(item);
+                }
+            }
+            var deleteList = MongoDbClientSingle.Instance.UploadStorageFileInfo.Find(c => c.IsDeleted == true)?.Project(c => c.Id)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    uploadStorageFileInfo.Add(item);
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear UploadStorageFile Data, Count: " + uploadStorageFileInfo.Count);
+            return uploadStorageFileInfo;
+        }
+
+        /// <summary>
+        /// 过滤测试PosterHistories
+        /// </summary>
+        /// <returns></returns>
+        public List<string> GetTestStorageFileInfoesByCondition()
+        {
+            Logger.WriteLineInfo($"Starting Query Wait Clear StorageFileInfoes Data");
+            List<string> storageFileInfoes = new List<string>();
+            var builder = Builders<StorageFileInfoes>.Filter;
+            var filter = builder.Where(x => x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline.AddMonths(-18));
+            var chatMessagesList = MongoDbClientSingle.Instance.StorageFileInfoes.Find(filter)?.Project(c => c.Id)?.ToList();
+            if (chatMessagesList?.Count > 0)
+            {
+                foreach (var item in chatMessagesList)
+                {
+                    storageFileInfoes.Add(item);
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear StorageFileInfoes Data, Count: " + storageFileInfoes.Count);
+            return storageFileInfoes;
+        }
+
+        /// <summary>
+        /// 保存清理数据
+        /// </summary>
+        /// <param name="terminalList"></param>
+        /// <returns></returns>
+        public bool SaveClearData(List<string> uploadStorageFileInfo, List<string> storageFileInfoes)
+        {
+            if (uploadStorageFileInfo?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear UploadStorageFileInfo Data");
+                var count = uploadStorageFileInfo.Count / 5000 + (uploadStorageFileInfo.Count % 5000 > 0 ? 1 : 0);
+                var startIndex = 0;
+                var length = 0; 
+                var builder = Builders<UploadStorageFileInfo>.Filter;
+                for (var i = 0; i < count; i++)
+                {
+                    if ((count - 1) == i)
+                    {
+                        length = uploadStorageFileInfo.Count - i * 5000;
+                    }
+                    else
+                    {
+                        length = 5000;
+                    }
+                    startIndex = i * 5000;
+                    var tempList = uploadStorageFileInfo.GetRange(startIndex, length);
+                    var deleteFilter = builder.In(x => x.Id, tempList);
+                    var result = MongoDbClientSingle.Instance.UploadStorageFileInfo.DeleteMany(deleteFilter);
+
+                    Logger.WriteLineInfo($"Clear UploadStorageFileInfo Data Range {startIndex} - { (startIndex + length)}");
+                }
+                Logger.WriteLineInfo($"Clear UploadStorageFileInfo Data Complete");
+            }
+
+            if (storageFileInfoes?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear StorageFileInfoes Data");
+                var count = storageFileInfoes.Count / 5000 + (storageFileInfoes.Count % 5000 > 0 ? 1 : 0);
+                var startIndex = 0;
+                var length = 0;
+                var builder = Builders<StorageFileInfoes>.Filter;
+                for (var i = 0; i < count; i++)
+                {
+                    if ((count - 1) == i)
+                    {
+                        length = storageFileInfoes.Count - i * 5000;
+                    }
+                    else
+                    {
+                        length = 5000;
+                    }
+                    startIndex = i * 5000;
+                    var tempList = storageFileInfoes.GetRange(startIndex, length);
+                    var deleteFilter = builder.In(x => x.Id, tempList);
+                    var result = MongoDbClientSingle.Instance.StorageFileInfoes.DeleteMany(deleteFilter);
+                    Logger.WriteLineInfo($"Clear StorageFileInfoes Data Range {startIndex} - {(startIndex + length)}");
+                }
+                Logger.WriteLineInfo($"Clear StorageFileInfoes Data Complete");
+            }
+            return true;
+        }
+    }
+}

+ 196 - 0
Tools/Flyinsono.DBCopy.Tool/Service/Repositories/UsersDBRepository.cs

@@ -0,0 +1,196 @@
+using Flyinsono.DBCopy.Tool.Entities;
+using Flyinsono.DBCopy.Tool.Entities.Config;
+using Flyinsono.DBCopy.Tool.Utilities;
+using MongoDB.Driver;
+using System.Collections.Generic;
+using System.Linq;
+using Newtonsoft.Json;
+using System;
+using System.IO;
+using MongoDB.Bson;
+using MongoDB.Driver.Core.Servers;
+using System.Windows.Input;
+using System.Text.RegularExpressions;
+using WingInterfaceLibrary.Request.User;
+using WingServerCommon.Mapper;
+using System.Threading.Tasks;
+
+namespace Flyinsono.DBCopy.Tool.Service.Repositories
+{
+    internal class UsersDBRepository
+    {
+        /// <summary>
+        /// 过滤测试用户
+        /// </summary>
+        /// <returns></returns>
+        public IList<Users> GetTestUsersByCondition()
+        {
+            Task.Factory.StartNew(() =>
+            {
+                Logger.WriteLineInfo($"Starting Query Wait Clear User Data");
+            });
+            var users = new List<Users>();
+            var filterUsers = CommonConfigManager.FilterUsers;
+            var nameList = filterUsers.Select(c => c.Name.ToLower()).Distinct().ToList();
+            var phoneList = filterUsers.Select(c => c.Phone.ToLower()).Distinct().ToList();
+            var emailList = filterUsers.Select(c => c.Email.ToLower()).Distinct().ToList();
+            var builder = Builders<Users>.Filter;
+            var filter = builder.Where(x => x.IsDeleted == false && x.UserType != UserTypes.Vistor && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            FilterDefinition<Users> orFilter = null;
+            foreach (var item in nameList)
+            {
+                var curNameFilter = builder.Where(c => c.Name.ToLower().Contains(item));
+                if (orFilter == null)
+                {
+                    orFilter = curNameFilter;
+                }
+                else
+                {
+                    orFilter = orFilter | curNameFilter;
+                }
+            }
+            foreach (var item in phoneList)
+            {
+                var curPhoneFilter = builder.Where(c => c.Phone.ToLower().Contains(item));
+                if (orFilter == null)
+                {
+                    orFilter = curPhoneFilter;
+                }
+                else
+                {
+                    orFilter = orFilter | curPhoneFilter;
+                }
+            }
+            foreach (var item in emailList)
+            {
+                var curEmailFilter = builder.Where(c => c.Email.ToLower().Contains(item));
+                if (orFilter == null)
+                {
+                    orFilter = curEmailFilter;
+                }
+                else
+                {
+                    orFilter = orFilter | curEmailFilter;
+                }
+            }
+            filter = filter & orFilter;
+            var userList = MongoDbClientSingle.Instance.Users.Find(filter)?.ToList();
+            if (userList?.Count > 0)
+            {
+                foreach (var item in userList)
+                {
+                    users.Add(item);
+                }
+            }
+            var deleteList = MongoDbClientSingle.Instance.Users.Find(c => c.IsDeleted == true)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    if (!users.Exists(c => c._id == item._id))
+                    {
+                        users.Add(item);
+                    }
+                }
+            }
+            var vistorList = MongoDbClientSingle.Instance.Users.Find(c => c.IsDeleted == false && c.UserType == UserTypes.Vistor && c.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline)?.ToList();
+            if (vistorList?.Count > 0)
+            {
+                foreach (var item in vistorList)
+                {
+                    if (!users.Exists(c => c._id == item._id))
+                    {
+                        users.Add(item);
+                    }
+                }
+            }
+            Regex emailRegex = new Regex("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
+            Regex phoneRegex = new Regex(@"^1\d{10}$");
+            var dList = MongoDbClientSingle.Instance.Users.Find(c => c.IsDeleted == false && c.UserType != UserTypes.Vistor && c.CreateAdmin == null && c.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline && ((!string.IsNullOrEmpty(c.Email) && !emailRegex.IsMatch(c.Email)) || (!string.IsNullOrEmpty(c.Phone) && !phoneRegex.IsMatch(c.Phone))))?.ToList();
+            if (dList?.Count > 0)
+            {
+                foreach (var item in dList)
+                {
+                    if (!users.Exists(c => c._id == item._id))
+                    {
+                        users.Add(item);
+                    }
+                }
+            }
+            Logger.WriteLineInfo($"End Query Wait Clear User Data, Count: " + users.Count);
+            return users;
+        }
+
+        /// <summary>
+        /// 过滤测试用户
+        /// </summary>
+        /// <returns></returns>
+        public void ClearLocationsData()
+        {
+            var builder = Builders<Locations>.Filter;
+            var filter = builder.Where(x => x.IsDeleted == false && x.CreateTime < CommonConfigManager.FilterGeneral.ClearDeadline);
+            var allIds = MongoDbClientSingle.Instance.Locations.Find(filter)?.Project(c => c.Id)?.ToList();
+            var deleteList = MongoDbClientSingle.Instance.Locations.Find(c => c.IsDeleted == true)?.Project(c => c.Id)?.ToList();
+            if (deleteList?.Count > 0)
+            {
+                foreach (var item in deleteList)
+                {
+                    allIds.Add(item);
+                }
+            }
+
+            if (allIds?.Count > 0)
+            {
+                var count = allIds.Count / 5000 + (allIds.Count % 5000 > 0 ? 1 : 0);
+                var startIndex = 0;
+                var length = 0;
+                for (var i = 0; i < count; i++)
+                {
+                    if ((count - 1) == i)
+                    {
+                        length = allIds.Count - i * 5000;
+                    }
+                    else
+                    {
+                        length = 5000;
+                    }
+                    startIndex = i * 5000;
+                    var tempList = allIds.GetRange(startIndex, length);
+                    var deleteFilter = builder.In(x => x.Id, tempList);
+                    var result = MongoDbClientSingle.Instance.Locations.DeleteMany(deleteFilter);
+                }
+            }
+        }
+
+        /// <summary>
+        /// 保存清理数据
+        /// </summary>
+        /// <param name="userList"></param>
+        /// <returns></returns>
+        public bool SaveClearData(IList<Users> userList)
+        {
+            if (userList?.Count > 0)
+            {
+                Logger.WriteLineInfo($"Starting Clear User Data");
+                var deleteIds = userList.Select(c => c._id).Distinct().ToList();
+                //清理DiagnosisResult
+                var diagnosisResultBuilder = Builders<DiagnosisResult>.Filter;
+                var diagnosisResultDelFilter = diagnosisResultBuilder.In(x => x.User._id, deleteIds);
+                var result = MongoDbClientSingle.Instance.DiagnosisResult.DeleteMany(diagnosisResultDelFilter);
+
+                //先删除类似的备份数据在新增
+                var bakBuilder = Builders<UsersBak>.Filter;
+                var bakFilter = bakBuilder.In(x => x._id, deleteIds);
+                var res = MongoDbClientSingle.Instance.UsersBak.DeleteMany(bakFilter);
+                var waitInsertUsers = userList.Where(c => c.IsDeleted == false).MappingTo<List<UsersBak>>();
+                MongoDbClientSingle.Instance.UsersBak.InsertMany(waitInsertUsers);
+                //删除正式表
+                var builder = Builders<Users>.Filter;
+                var filter = builder.In(x => x._id, deleteIds);
+                result = MongoDbClientSingle.Instance.Users.DeleteMany(filter);
+                Logger.WriteLineInfo($"Clear User Data Completed, Clear Count: " + userList.Count);
+            }
+            return true;
+        }
+    }
+}

+ 102 - 0
Tools/Flyinsono.DBCopy.Tool/Utilities/CommonConfigManager.cs

@@ -0,0 +1,102 @@
+using Flyinsono.DBCopy.Tool.Entities.Config;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WingServerCommon.Config;
+using WingServerCommon.Config.Parameters;
+
+namespace Flyinsono.DBCopy.Tool.Utilities
+{
+    internal class CommonConfigManager
+    {
+        /// <summary>
+        /// 初始化读取数据
+        /// </summary>
+        static CommonConfigManager()
+        {
+            var jsonContent = File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Config", "TestConfig.json"));
+            var testConfig = JsonConvert.DeserializeObject<TestConfig>(jsonContent);
+            if (testConfig != null)
+            {
+                if (testConfig.FilterUsers?.Count > 0)
+                {
+                    FilterUsers = testConfig.FilterUsers;
+                }
+                if (testConfig.FilterTerminals?.Count > 0)
+                {
+                    FilterTerminals = testConfig.FilterTerminals;
+                }
+                if (testConfig.FilterOrganizations?.Count > 0)
+                {
+                    FilterOrganizations = testConfig.FilterOrganizations;
+                }
+                if (testConfig.FilterLectureContests?.Count > 0)
+                {
+                    FilterLectureContests = testConfig.FilterLectureContests;
+                }
+                if (testConfig.FilterExaminationPaper?.Count > 0)
+                {
+                    FilterExaminationPaper = testConfig.FilterExaminationPaper;
+                }
+                if (testConfig.FilterCourses?.Count > 0)
+                {
+                    FilterCourses = testConfig.FilterCourses;
+                }
+                if (testConfig.FilterPatients?.Count > 0)
+                {
+                    FilterPatients = testConfig.FilterPatients;
+                }
+                if (testConfig.FilterGeneral != null)
+                {
+                    FilterGeneral = testConfig.FilterGeneral;
+                }                
+            }
+        }
+
+        /// <summary>
+        /// 过滤用户
+        /// </summary>
+        public static IList<FilterUsersConfig> FilterUsers { get; set; }
+
+        /// <summary>
+        /// 过滤超声机
+        /// </summary>
+        public static IList<string> FilterTerminals { get; set; }
+
+        /// <summary>
+        /// 过滤机构
+        /// </summary>
+        public static IList<string> FilterOrganizations { get; set; }
+
+        /// <summary>
+        /// 过滤指定的测试讲课比赛
+        /// </summary>
+        public static IList<string> FilterLectureContests { get; set; }
+
+        /// <summary>
+        /// 过滤指定的测试考试
+        /// </summary>
+        public static IList<string> FilterExaminationPaper { get; set; }
+
+        /// <summary>
+        /// 过滤指定的测试课程
+        /// </summary>
+        public static IList<string> FilterCourses { get; set; }
+
+        /// <summary>
+        /// 过滤指定的测试病人
+        /// </summary>
+        public static IList<string> FilterPatients { get; set; }
+
+        /// <summary>
+        /// 清理工具基础配置
+        /// </summary>
+        public static FilterGeneralConfig FilterGeneral { get; set; }
+
+    }
+}

+ 265 - 0
Tools/Flyinsono.DBCopy.Tool/Utilities/MongoDbClient.cs

@@ -0,0 +1,265 @@
+using Flyinsono.DBCopy.Tool.Entities;
+using Microsoft.VisualBasic;
+using MongoDB.Bson;
+using MongoDB.Driver.Core.Misc;
+using MongoDB.Driver;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.Metrics;
+using System.Diagnostics;
+using System.IO.Packaging;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Input;
+using Flyinsono.DBCopy.Tool.Properties;
+using System.Xml.Linq;
+using System.Net;
+
+namespace Flyinsono.DBCopy.Tool.Utilities
+{
+    internal class MongoDbClient
+    {
+        private const int ConnnectTimeOut = 3000;
+        private const int WaitQueueTimeout = 3000;
+        private const int ServerSelectionTimeout = 20000;
+        private const int SocketTimeout = 20000;
+        private readonly string _databaseName = "vCloudDb";
+        private readonly string _host = "localhost";
+        private readonly int _port = 8333;
+        private IMongoDatabase _database;
+        private MongoClient _mongoClient;
+        public MongoDbClient()
+        {
+            BuilderClient();
+            RegisterEntities();
+        }
+
+        /// <summary>
+        /// 构造MongoClient
+        /// </summary>
+        private void BuilderClient()
+        {
+            var mongoSetting = new MongoClientSettings
+            {
+                ConnectTimeout = TimeSpan.FromSeconds(ConnnectTimeOut),
+                Server = new MongoServerAddress(_host, _port),
+                MaxConnectionPoolSize = 2000,
+                WaitQueueSize = 200,
+                WaitQueueTimeout = TimeSpan.FromSeconds(WaitQueueTimeout),
+                ServerSelectionTimeout = TimeSpan.FromSeconds(ServerSelectionTimeout),
+                SocketTimeout = TimeSpan.FromSeconds(SocketTimeout),
+
+            };
+            _mongoClient = new MongoClient(mongoSetting);
+            _database = _mongoClient.GetDatabase(_databaseName);
+        }
+
+        /// <summary>
+        /// 关闭Mongo服务
+        /// </summary>
+        public void CloseMongodbServer()
+        {
+            Stopwatch stopwatch = new Stopwatch();
+            stopwatch.Start();
+            try
+            {
+                var adminDatabase = _mongoClient.GetDatabase("admin");
+                adminDatabase.RunCommandAsync(new JsonCommand<BsonDocument>("{shutdown : 1, force : true}"));
+            }
+            catch (Exception e)
+            {
+                Logger.WriteLineError($"Close Mongodb Server exception: {e}");
+            }
+            finally
+            {
+                stopwatch.Stop();
+                Logger.WriteLineInfo($"Close Mongodb Server used: {stopwatch.ElapsedMilliseconds}Milliseconds");
+            }
+        }
+
+        private IMongoDatabase GetUsedDatabase()
+        {
+            int tryCount = 0;
+            while (_database.Client.Cluster.Description.State == MongoDB.Driver.Core.Clusters.ClusterState.Disconnected && tryCount < 3)
+            {
+                _database.Client.Cluster.Initialize();
+                tryCount++;
+                Logger.WriteLineInfo($"Rebuilder MongodbClient finish");
+                Thread.Sleep(1000);
+            }
+            return _database;
+        }
+
+        public bool DatabaseExist()
+        {
+            Stopwatch stopwatch = new Stopwatch();
+            stopwatch.Start();
+            try
+            {
+                var database = _mongoClient.GetDatabase("vCloudDb");
+                return database.ListCollectionNames().Any();
+            }
+            catch (Exception ex)
+            {
+                Logger.WriteLineError($"Exist Mongodb Server exception: {ex}");
+                throw new Exception("Database connection timeout,Please restart server!");
+            }
+            finally
+            {
+                stopwatch.Stop();
+                Logger.WriteLineInfo($"Exist Mongodb Server used: {stopwatch.ElapsedMilliseconds}Milliseconds");
+            }
+        }
+
+        public bool MongodServerIsRunning()
+        {
+            try
+            {
+                var collections = GetUsedDatabase().RunCommand(new JsonCommand<BsonDocument>("{ listCollections: 1 }"));
+                if (collections.ElementCount > 0)
+                {
+                    return true;
+                }
+                return false;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 获取数据集对象
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="collectionName"></param>
+        /// <returns></returns>
+        public IMongoCollection<T> GetCollection<T>(string collectionName)
+        {
+            IMongoCollection<T> collection = _database.GetCollection<T>(collectionName);
+            return collection;
+        }
+
+        //private MongoCollectionProxy<T> GetCollectionProxy<T>(string collectionName)
+        //{
+        //    //return _database.GetCollectionProxy<T>(collectionName);
+
+        //    _database.GetCollection<T>(collectionName);
+        //}
+
+        public void RunScript(string command)
+        {
+            _database.RunCommand(new JsonCommand<BsonDocument>(command));
+        }
+
+        public IMongoCollection<Admins> Admins { get; private set; }
+        public IMongoCollection<ChatMessages> ChatMessages { get; private set; }
+        public IMongoCollection<ConsultationEvaluates> ConsultationEvaluates { get; private set; }
+        public IMongoCollection<ConsultationRecords> ConsultationRecords { get; private set; }
+        public IMongoCollection<Conversations> Conversations { get; private set; }
+        public IMongoCollection<CourseNoticeReminds> CourseNoticeReminds { get; private set; }
+        public IMongoCollection<Courses> Courses { get; private set; }
+        public IMongoCollection<CourseStudents> CourseStudents { get; private set; }
+        public IMongoCollection<DiagnosisResult> DiagnosisResult { get; private set; }
+        public IMongoCollection<ExaminationPaper> ExaminationPaper { get; private set; }
+        public IMongoCollection<ExamScores> ExamScores { get; private set; }
+        public IMongoCollection<FinishedTerminalRecords> FinishedTerminalRecords { get; private set; }
+        public IMongoCollection<LectureContestBrowserRecords> LectureContestBrowserRecords { get; private set; }
+        public IMongoCollection<LectureContestEntryScoreRecords> LectureContestEntryScoreRecords { get; private set; }
+        public IMongoCollection<LectureContestMessages> LectureContestMessages { get; private set; }
+        public IMongoCollection<LectureContestResults> LectureContestResults { get; private set; }
+        public IMongoCollection<LectureContests> LectureContests { get; private set; }
+        public IMongoCollection<Locations> Locations { get; private set; }
+        public IMongoCollection<Organizations> Organizations { get; private set; }
+        public IMongoCollection<PosterConfigs> PosterConfigs { get; private set; }
+        public IMongoCollection<PosterHistories> PosterHistories { get; private set; }
+        public IMongoCollection<ReportInfoResults> ReportInfoResults { get; private set; }
+        public IMongoCollection<StorageFileInfoes> StorageFileInfoes { get; private set; }
+        public IMongoCollection<TerminalAIDataExcuteRecords> TerminalAIDataExcuteRecords { get; private set; }
+        public IMongoCollection<TerminalAIDatas> TerminalAIDatas { get; private set; }
+        public IMongoCollection<TerminalDatas> TerminalDatas { get; private set; }
+        public IMongoCollection<TerminalRecordReportAISelectResults> TerminalRecordReportAISelectResults { get; private set; }
+        public IMongoCollection<TerminalRecords> TerminalRecords { get; private set; }
+        public IMongoCollection<Terminals> Terminals { get; private set; }
+        public IMongoCollection<UploadStorageFileInfo> UploadStorageFileInfo { get; private set; }
+        public IMongoCollection<Users> Users { get; private set; }
+        public IMongoCollection<UsersBak> UsersBak { get; private set; }
+        public IMongoCollection<OrganizationsBak> OrganizationsBak { get; private set; }
+        public IMongoCollection<TerminalsBak> TerminalsBak { get; private set; }
+        public IMongoCollection<TerminalRecordsBak> TerminalRecordsBak { get; private set; }
+        public IMongoCollection<ConsultationRecordsBak> ConsultationRecordsBak { get; private set; }
+        public IMongoCollection<LectureContestEntries> LectureContestEntries { get; private set; }
+        public IMongoCollection<ExamPapers> ExamPapers { get; private set; }
+        public IMongoCollection<PatientInfos> PatientInfos { get; private set; }
+        public IMongoCollection<Patients> Patients { get; private set; }
+        public IMongoCollection<TerminalRecordReportStates> TerminalRecordReportStates { get; private set; }
+        public IMongoCollection<ReportInfoResultsBak> ReportInfoResultsBak { get; private set; }
+        private void RegisterEntities()
+        {
+            Admins = GetCollection<Admins>("Admins");
+            ChatMessages = GetCollection<ChatMessages>("ChatMessages");
+            ConsultationEvaluates = GetCollection<ConsultationEvaluates>("ConsultationEvaluates");
+            ConsultationRecords = GetCollection<ConsultationRecords>("ConsultationRecords");
+            ConsultationRecordsBak = GetCollection<ConsultationRecordsBak>("ConsultationRecordsBak");
+            Conversations = GetCollection<Conversations>("Conversations");
+            CourseNoticeReminds = GetCollection<CourseNoticeReminds>("CourseNoticeReminds");
+            Courses = GetCollection<Courses>("Courses");
+            CourseStudents = GetCollection<CourseStudents>("CourseStudents");
+            DiagnosisResult = GetCollection<DiagnosisResult>("DiagnosisResult");
+            ExaminationPaper = GetCollection<ExaminationPaper>("ExaminationPaper");
+            ExamScores = GetCollection<ExamScores>("ExamScores");
+            FinishedTerminalRecords = GetCollection<FinishedTerminalRecords>("FinishedTerminalRecords");
+            LectureContestBrowserRecords = GetCollection<LectureContestBrowserRecords>("LectureContestBrowserRecords");
+            LectureContestEntryScoreRecords = GetCollection<LectureContestEntryScoreRecords>("LectureContestEntryScoreRecords");
+            LectureContestMessages = GetCollection<LectureContestMessages>("LectureContestMessages");
+            LectureContestResults = GetCollection<LectureContestResults>("LectureContestResults");
+            LectureContests = GetCollection<LectureContests>("LectureContests");
+            Locations = GetCollection<Locations>("Locations");
+            Organizations = GetCollection<Organizations>("Organizations");
+            OrganizationsBak = GetCollection<OrganizationsBak>("OrganizationsBak");
+            PosterConfigs = GetCollection<PosterConfigs>("PosterConfigs");
+            PosterHistories = GetCollection<PosterHistories>("PosterHistories");
+            ReportInfoResults = GetCollection<ReportInfoResults>("ReportInfoResults");
+            StorageFileInfoes = GetCollection<StorageFileInfoes>("StorageFileInfoes");
+            TerminalAIDataExcuteRecords = GetCollection<TerminalAIDataExcuteRecords>("TerminalAIDataExcuteRecords");
+            TerminalAIDatas = GetCollection<TerminalAIDatas>("TerminalAIDatas");
+            TerminalDatas = GetCollection<TerminalDatas>("TerminalDatas");
+            TerminalRecordReportAISelectResults = GetCollection<TerminalRecordReportAISelectResults>("TerminalRecordReportAISelectResults");
+            TerminalRecords = GetCollection<TerminalRecords>("TerminalRecords");
+            TerminalRecordsBak = GetCollection<TerminalRecordsBak>("TerminalRecordsBak");
+            Terminals = GetCollection<Terminals>("Terminals");
+            TerminalsBak = GetCollection<TerminalsBak>("TerminalsBak");
+            UploadStorageFileInfo = GetCollection<UploadStorageFileInfo>("UploadStorageFileInfo");
+            Users = GetCollection<Users>("Users");
+            UsersBak = GetCollection<UsersBak>("UsersBak");
+            LectureContestEntries = GetCollection<LectureContestEntries>("LectureContestEntries");
+            ExamPapers = GetCollection<ExamPapers>("ExamPapers");
+            TerminalRecordReportStates = GetCollection<TerminalRecordReportStates>("TerminalRecordReportStates");
+            PatientInfos = GetCollection<PatientInfos>("PatientInfos");
+            Patients = GetCollection<Patients>("Patients");
+            ReportInfoResultsBak = GetCollection<ReportInfoResultsBak>("ReportInfoResultsBak");
+        }
+
+
+    }
+
+    internal class MongoDbClientSingle : Singleton<MongoDbClient>
+    {
+        private MongoDbClientSingle() { }
+    }
+
+    /// <summary>
+    /// 统一单例构造类
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    public abstract class Singleton<T> where T : class, new()
+    {
+        /// <summary>
+        /// 统一单例实例
+        /// </summary>
+        public static T Instance { get; } = new T();
+    }
+}

+ 1 - 1
Tools/Flyinsono.DBCopy.Tool/ViewModels/MainWindowViewModel.cs

@@ -167,7 +167,7 @@ namespace Flyinsono.DBCopy.Tool
         private void OnConnectDb(object obj) // 新增OnConnectDb方法
         {
             var service = AppManager.Instance.GetManager<IClientTestManager>();
-            service.ConnectDb(DbPath);
+            service.ConnectDb("E:\\Arthur\\20230420175958.zip\\20230420175958");
            
         }
     }