diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 6d7e35357..cc66071dc 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -235,7 +235,7 @@ namespace IRaCIS.Core.API.Controllers IRepository _subjectVisitRepository, IStringLocalizer _localizer) : UploadBaseController { - + [HttpPost, Route("Study/PreArchiveStudy")] @@ -272,7 +272,7 @@ namespace IRaCIS.Core.API.Controllers [DisableFormValueModelBinding] [DisableRequestSizeLimit] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - public async Task ArchiveStudyNew( Guid trialId, Guid subjectVisitId, string studyInstanceUid, Guid? abandonStudyId, Guid studyMonitorId, + public async Task ArchiveStudyNew(Guid trialId, Guid subjectVisitId, string studyInstanceUid, Guid? abandonStudyId, Guid studyMonitorId, [FromServices] ILogger _logger, [FromServices] IStudyService _studyService, [FromServices] IHubContext _uploadHub, @@ -424,7 +424,7 @@ namespace IRaCIS.Core.API.Controllers public Guid SubjectVisitId { get; set; } - [NotDefault] + [NotDefault] public Guid StudyMonitorId { get; set; } @@ -481,9 +481,9 @@ namespace IRaCIS.Core.API.Controllers { //如果是跟任务绑,那么NoneDicomStudyId 设置为空,不影响之前的检查,同时设置 OriginNoneDicomStudyId 保证关系 - if(incommand.VisitTaskId!=null && incommand.VisitTaskId !=Guid.Empty) + if (incommand.VisitTaskId != null && incommand.VisitTaskId != Guid.Empty) { - await _noneDicomStudyFileRepository.AddAsync(new NoneDicomStudyFile() { FileName = item.FileName, Path = item.FilePath, OriginNoneDicomStudyId=noneDicomStudyId.Value, VisitTaskId=incommand.VisitTaskId, FileType = item.FileType, FileSize = item.FileFize }); + await _noneDicomStudyFileRepository.AddAsync(new NoneDicomStudyFile() { FileName = item.FileName, Path = item.FilePath, OriginNoneDicomStudyId = noneDicomStudyId.Value, VisitTaskId = incommand.VisitTaskId, FileType = item.FileType, FileSize = item.FileFize }); } else @@ -498,7 +498,7 @@ namespace IRaCIS.Core.API.Controllers var noneDicomStudy = await _noneDicomStudyRepository.FirstOrDefaultAsync((t => t.Id == noneDicomStudyId)); - noneDicomStudy.FileCount = noneDicomStudy.FileCount + incommand.UploadedFileList.Count; + noneDicomStudy.FileCount = noneDicomStudy.FileCount + (incommand.VisitTaskId != null ? 0 : incommand.UploadedFileList.Count); studyMonitor.FileCount = incommand.UploadedFileList.Count; studyMonitor.FileSize = incommand.UploadedFileList.Sum(t => t.FileFize); @@ -976,7 +976,7 @@ namespace IRaCIS.Core.API.Controllers } //处理好 用户类型 和用户类型枚举 var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList(); - var siteList = _trialSiteRepository.Where(t => t.TrialId == trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t => new { t.TrialSiteCode, TrialSiteId= t.Id }).ToList(); + var siteList = _trialSiteRepository.Where(t => t.TrialId == trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t => new { t.TrialSiteCode, TrialSiteId = t.Id }).ToList(); foreach (var item in excelList) { diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj index 090939cbe..2de032f41 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj +++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj @@ -1,156 +1,107 @@  - - net8.0 - false - 354572d4-9e15-4099-807c-63a2d29ff9f2 - default - Linux - 1.0.1.001 - 上海展影医疗科技有限公司 - IRC影像系统 (EICS) - 上海展影医疗科技有限公司版权所有 - + + net8.0 + false + 354572d4-9e15-4099-807c-63a2d29ff9f2 + default + Linux + 1.0.1.001 + 上海展影医疗科技有限公司 + IRC影像系统 (EICS) + 上海展影医疗科技有限公司版权所有 + - - .\IRaCIS.Core.API.xml - 1701;1702;1591;1570; - ..\bin\ - + + .\IRaCIS.Core.API.xml + 1701;1702;1591;1570; + ..\bin\ + - - bin\Release\IRaCIS.Core.API.xml - bin\Release\ - 1701;1702;1591 - + + bin\Release\IRaCIS.Core.API.xml + bin\Release\ + 1701;1702;1591 + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - Always - - - Always - - - Always - - - - - Client - - + + + + + + Always + + + Always + + + Always + + + + + Client + + - - - - - - - - - - - - - - - - - - - + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + - - - - + + + + - - - + + + - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - + + + - - - - - + + + + + diff --git a/IRaCIS.Core.API/Progranm.cs b/IRaCIS.Core.API/Progranm.cs index 33c2d6fc8..62e075ff6 100644 --- a/IRaCIS.Core.API/Progranm.cs +++ b/IRaCIS.Core.API/Progranm.cs @@ -33,6 +33,7 @@ using Newtonsoft.Json; using Microsoft.AspNetCore.Diagnostics; using IRaCIS.Core.Application.MassTransit.Command; using IRaCIS.Core.Application.MassTransit.Consumer; +using DocumentFormat.OpenXml.InkML; AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true); @@ -124,6 +125,8 @@ builder.Services.AddOptions().Configure(_configuratio builder.Services.AddOptions().Configure(_configuration.GetSection("EncrypteResponseConfig")); builder.Services.AddOptions().Configure(_configuration.GetSection("SystemPacsConfig")); +builder.Services.Configure(_configuration.GetSection("IRaCISBasicConfig")); + //动态WebApi + UnifiedApiResultFilter 省掉控制器代码 builder.Services.AddDynamicWebApiSetup(); diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser.html deleted file mode 100644 index 9a6dc6f9d..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - Title - - -
-
-
- 尊敬的 {0} ,您好: -
-
- {company abbreviation}为您添加了账户,账户信息如下: -
- -
-
- 用户名: {1} -
-
- 角色: {2} -
-
- 首次登陆前,请通过该链接修改您的账户信息: - - 初始化账号信息 - -
-
- - -
-
祝您顺利!
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser_US.html deleted file mode 100644 index 04453f355..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser_US.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - Title - - -
-
-
- Dear {0} , -
-
- {company abbreviation} has created an account for you. The account information is as follows: -
- -
-
- User ID: {1} -
-
- Role: {2} -
-
- Before logging in for the first time, please modify the account information through this link: - - Initialize account information - -
-
- - -
-
Best regards,
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser.html deleted file mode 100644 index 3354b1a34..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - Title - - -
-
-
- 尊敬的 {0} ,您好: -
-
- {company abbreviation}将您的账户密码已重置,账户信息如下: -
- -
-
- 用户名: {1} -
-
- 角色: {2} -
-
- 密码: {3} -
-
- - -
-
祝您顺利!
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser_US.html deleted file mode 100644 index 7d515cabb..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser_US.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - Title - - -
-
-
- Dear {0} , -
-
- {company abbreviation} has reset your account password, and the account information is as follows: -
- -
-
- User ID: {1} -
-
- Role: {2} -
-
- Password: {3} -
-
- - -
-
Best regards,
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress.html deleted file mode 100644 index 1becb5c55..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - Title - - -
-
-
- 您好: -
-
- 感谢您使用展影云平台。 -
-
- {0}。 -
- -
-
祝您顺利!
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress_US.html deleted file mode 100644 index e5d5f6b58..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress_US.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - Title - - -
-
-
- Dear: -
-
- Thank you for using {company abbreviation} Cloud System. -
-
- {0}。 -
- -
-
Best regards,
-
{company}
-
-
-
- - \ No newline at end of file diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin.html deleted file mode 100644 index c56b85bc7..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Title - - -
-
-
- 尊敬的 {0} ,您好: -
-
- {company abbreviation}作为 [{1} (试验方案号:{2 })] 项目的供应商,诚邀您参加该项目阅片相关工作。 -
-
- 该项目采用电子化工作流,系统及您的账号信息如下: -
- -
-
- 项目编号: {3} -
-
- 试验方案号: {2} -
-
- 试验名称: {1} -
-
- 用户名: {4} -
-
- 角色: {5} -
-
- 系统登录地址: - - 点击跳转 - -
-
- -
-
祝您顺利!
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin_US.html deleted file mode 100644 index 1558db0a4..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin_US.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Title - - -
-
-
- Dear {0}, -
-
- {company abbreviation} invites you to participate in the IRC work of a trial ({1} , {2}). -
-
- Your account information is as follows: -
- -
-
- Trial ID: {3} -
-
- Protocol ID: {2} -
-
- Study Name: {1} -
-
- User ID: {4} -
-
- Role: {5} -
-
- Login URL: - - Click to login - -
-
- - -
-
Best regards,
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin.html deleted file mode 100644 index 1ac10ce08..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Title - - -
-
-
- 尊敬的 {0} ,您好: -
-
- {company abbreviation}作为 [{1} (试验方案号:{2 })] 项目的IRC供应商,诚邀您参加该项目IRC阅片相关工作,欢迎您提供指导和建议,非常感谢! -
-
- 该项目采用电子化工作流,系统及您的账号信息如下: -
- -
-
- 项目编号: {3} -
-
- 试验方案号: {2} -
-
- 试验名称: {1} -
-
- 用户名: {4} -
-
- 角色: {5} -
-
- 首次登陆前,请通过该链接修改您的账户信息: - - 初始化账号信息 - -
-
- - -
-
祝您顺利!
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin_US.html deleted file mode 100644 index 56f832794..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin_US.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Title - - -
-
-
- Dear {0}, -
-
- {company abbreviation} invites you to participate in the IRC work of a trial ({1}, {2}). -
-
- Your account information is as follows: -
- -
-
- Trial ID: {3} -
-
- Protocol ID: {2} -
-
- Study Name: {1} -
-
- User ID: {4} -
-
- Role: {5} -
-
- Before logging in for the first time, please modify the account information through this link: - - Initialize account information - -
-
- - -
-
Best regards,
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject.html deleted file mode 100644 index 70cf1bdec..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - Title - - -
-
-
- 尊敬的 {0} ,您好: -
-
- 您填写的中心调研表被驳回,详细信息如下: -
- -
-
- 项目编号: {1} -
-
- 试验方案号: {2} -
-
- 试验名称: {3} -
-
- 中心编号: {4} -
-
- 中心名称: {5} -
-
- 驳回原因: {6} -
- -
- - 登陆并查看 - - -
-
祝您顺利!
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject_US.html deleted file mode 100644 index 4a7064460..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject_US.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - Title - - -
-
-
- Dear {0} , -
-
- The site survey form you filled in has been rejected. The details are as follows: -
- -
-
- Trial ID: {1} -
-
- Protocol ID: {2} -
-
- Study Name: {3} -
-
- Site ID: {4} -
-
- Site name: {5} -
-
- Reason for rejection: {6} -
- -
- - Login and view - - -
-
Best regards,
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin.html deleted file mode 100644 index f3d816b3c..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Title - - -
-
-
- 尊敬的 {0} ,您好: -
-
- {company abbreviation}作为 [{1} (试验方案号:{2 })] 项目的供应商,诚邀您参加该项目相关工作,欢迎您提供指导和建议,非常感谢! -
-
- 该项目采用电子化工作流,系统及您的账号信息如下: -
- -
-
- 项目编号: {3} -
-
- 试验方案号: {2} -
-
- 试验名称: {1} -
-
- 用户名: {4} -
-
- 角色: {5} -
-
- 系统登录地址: - - 点击跳转 - -
-
- - -
-
祝您顺利!
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin_US.html deleted file mode 100644 index f965bf8b5..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin_US.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Title - - -
-
-
- Dear {0}, -
-
- {company abbreviation} invites you to participate in the IRC work of a trial ({1}, {2}). -
-
- Your account information is as follows: -
- -
-
- Trial ID: {3} -
-
- Protocol ID: {2} -
-
- Study Name: {1} -
-
- User ID: {4} -
-
- Role: {5} -
-
- Login URL: - - Click to login - -
-
- - -
-
Best regards,
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin.html deleted file mode 100644 index 3fa857aa3..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Title - - -
-
-
- 尊敬的 {0} ,您好: -
-
- {company abbreviation}作为 [{1} (试验方案号:{2 })] 项目的IRC供应商,诚邀您参加该项目IRC相关工作,欢迎您提供指导和建议,非常感谢! -
-
- 该项目采用电子化工作流,系统及您的账号信息如下: -
- -
-
- 项目编号: {3} -
-
- 试验方案号: {2} -
-
- 试验名称: {1} -
-
- 用户名: {4} -
-
- 角色: {5} -
-
- 首次登陆前,请通过该链接修改您的账户信息: - - 初始化账号信息 - -
-
- - -
-
祝您顺利!
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin_US.html deleted file mode 100644 index 8a047db59..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin_US.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Title - - -
-
-
- Dear {0}, -
-
- {company abbreviation} invites you to participate in the IRC work of a trial ({1}, {2}). -
-
- Your account information is as follows: -
- -
-
- Trial ID: {3} -
-
- Protocol ID: {2} -
-
- Study Name: {1} -
-
- User ID: {4} -
-
- Role: {5} -
-
- Before logging in for the first time, please modify the account information through this link: - - Initialize the account information - -
-
- - -
-
Best regards,
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon.html deleted file mode 100644 index db42758d2..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Title - - -
-
-
- {0}您好, -
-
- 感谢您使用展影云平台。 -
-
- {1},验证码是: {2}。 -
-
- 请在3分钟内输入该验证码,进行后续操作 -
-
-
祝您顺利!
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon_US.html deleted file mode 100644 index 2d4abdab8..000000000 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon_US.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - Title - - -
-
-
- Dear {0}, -
-
- {1} -
-
- The verification code is {2}. -
-
- This code will expire in 3 minutes. -
- -
-
Best regards,
-
{company}
-
-
-
- - diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj index d4e5708b8..1c751043f 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj @@ -59,7 +59,7 @@ - + diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 3eafb5142..2bf6dcab9 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -74,6 +74,7 @@ 接口请求参考文档:https://www.koudingke.cn/docs/zh-Hans/net-lib-docs/latest/RestSharp/Usage/Usage + oosFolderPath 不要 "/ "开头 应该: TempFolder/ChildFolder @@ -90,6 +91,7 @@ + @@ -994,12 +996,54 @@ - + 获取该受试者任务上传列表(展示已上传情况) - - + + + + + 在调用预归档前验证 这些检查是否可以全新上传还是已存在补充 目前前端允许 IsAllowUpload==true 全新、IsAllowReUpload==true 补充的study ,全部丢到后端,后端判断存在,就删除之前的检查,全新插入 + + + + + + + IR 上传任务 nonedicom 列表 后处理的数据UploadedFileCount不能排序 --new + + + + + + + IQC 获取CRC 上传到某一个访视的的检查信息 (原始影像信息 包含dicom 非dicom) + + + + + + + IR 阅片页面 和IR 任务列表页面下载 勾选下载列表(后端要考虑到一致性分析 subjectCode的问题) + + + + + + + IR 阅片页面获取下载检查的信息 会根据标准进行过滤检查,(后端要考虑到一致性分析 subjectCode的问题) + 检查在访视下面,所以需要传递下载的访视Id,另外下载访视下面那些检查,就把访视下的对应的检查Id 丢到数组里就好 + + + + + + + + dicom 影响后处理预览接口 + + @@ -1032,49 +1076,27 @@ - + - IR 影像上传任务列表 + IR 影像上传任务列表 --old 20240903 界面调整,现在先废弃 - + - IR 上传任务 dicom 列表 后处理的数据不能排序 + IR 上传任务 dicom 列表 后处理的数据不能排序 --old 20240903 界面调整,现在先废弃 - + - IR 上传任务 nonedicom 列表 后处理的数据不能排序 + IR 上传任务 nonedicom 列表 后处理的数据不能排序 --old 20240903 界面调整,现在先废弃 - - - IQC 获取CRC 上传到某一个访视的的检查信息 (原始影像信息 包含dicom 非dicom) - - - - - - - IR 阅片页面 和IR 任务列表页面下载 勾选下载列表(后端要考虑到一致性分析 subjectCode的问题) - - - - - - - IR 阅片页面获取下载检查的信息 会根据标准进行过滤检查,(后端要考虑到一致性分析 subjectCode的问题) - - - - - 指定资源Id,渲染Dicom检查的Jpeg预览图像 Dicom检查的Id @@ -1382,6 +1404,7 @@ 格式化日期和时间 + @@ -1399,6 +1422,7 @@ 标识 标识 + Json对象 @@ -2081,6 +2105,41 @@ + + + 计算NTAV的EEM + + + + + + + 获取(EEM-Lumen)求和 + + + + + + + 计算NTAV的(EEM-Lumen)求和/回撤中的图像数 + + + + + + + 冠状动脉粥样硬化体积百分比(PAV) + + + + + + + 总动脉粥样硬化体积(NTAV) + + + + 将上一次的访视病灶添加到这一次 @@ -3144,6 +3203,95 @@ + + + 获取阅片的计算数据 + + + + + + + 获取Sod的值 + + + + + 获取iSod的值 + + + + + 上一次访视Id + + + + + 首次转变的任务ID + + + + + 触发任务list + + + + + 删除病灶获取起始病灶序号(RECIST1Point1 固定是1) + + + + + + 获取阅片报告 + + + + + + + 测试计算 + + + + + + + + 计算任务 + + + + + + + 获取报告验证的信息(这里每个标准可能不一样 返回用object) + + + + + + + 自动计算 + + + + + + + + 验证访视提交 + + + + + + + 将上一次的访视病灶添加到这一次 + + + + 获取阅片的计算数据 @@ -10311,6 +10459,11 @@ 传了Id + + + 是否是一致性分析产生 + + 加急类型 @@ -10339,6 +10492,16 @@ VisitTaskView 列表视图模型 + + + 是否手动生成 + + + + + 是否是一致性分析产生 + + 是否是一致性分析产生 @@ -10444,6 +10607,11 @@ FrontAuditConfigAddOrEdit 列表查询参数模型 + + + 字段的英文值 + + 是否向前站位 @@ -13512,12 +13680,6 @@ - - - 设置项目阅片标准 - - - 设置项目阅片信息 diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/ImageShareService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/ImageShareService.cs index 47c2c9f21..2422493ce 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/ImageShareService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/ImageShareService.cs @@ -61,7 +61,7 @@ namespace IRaCIS.Core.Application.Services //配置文件读取过期时间 - var days = AppSettings.ImageShareExpireDays; + var days = AppSettings.IRaCISBasicConfig.ImageShareExpireDays; imageShareCommand.ExpireTime = DateTime.Now.AddDays(days); diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index e1c3e5653..e48d7d026 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -439,6 +439,7 @@ namespace IRaCIS.Core.Application.Service /// 格式化日期和时间 /// /// + /// /// /// private async Task SetDataInspectionDateType(List identificationList, string identification, string jsonStr) @@ -629,6 +630,7 @@ namespace IRaCIS.Core.Application.Service /// /// 标识 /// 标识 + /// /// Json对象 /// private async Task SetEnum(Guid trialId, List identificationList, string identification, string jsonStr) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs index 49136f718..dbb1d0538 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs @@ -306,8 +306,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public decimal FristAddTaskNum { get; set; } - public string? OtherMeasureData { get; set; } = string.Empty; - public string MeasureData { get; set; } + public string OtherMeasureData { get; set; } = string.Empty; + public string MeasureData { get; set; } = string.Empty; public List TableQuestionList { get; set; } = new List(); } diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index 688df02f5..bba7f9d64 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -37,7 +37,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// /// 文件类型 /// - public string? FileType { get; set; } + public string FileType { get; set; }=string.Empty; public Guid QuestionId { get; set; } public Guid TableQuestionId { get; set; } @@ -1096,7 +1096,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public string MeasureData { get; set; } - public string? OtherMeasureData { get; set; } + public string OtherMeasureData { get; set; } public int ShowOrder { get; set; } @@ -1119,9 +1119,9 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public Guid? OtherStudyId { get; set; } - public string? OtherMarkTool { get; set; } + public string OtherMarkTool { get; set; } - public string? OtherPicturePath { get; set; } + public string OtherPicturePath { get; set; } public int? OtherNumberOfFrames { get; set; } @@ -1187,7 +1187,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public QuestionType? QuestionType { get; set; } - public string? OrderMarkName { get; set; } = string.Empty; + public string OrderMarkName { get; set; } = string.Empty; /// @@ -1205,12 +1205,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public Guid? OtherStudyId { get; set; } - public string? OtherMarkTool { get; set; } + public string OtherMarkTool { get; set; } - public string? OtherPicturePath { get; set; } + public string OtherPicturePath { get; set; } public int? OtherNumberOfFrames { get; set; } - public string? OtherMeasureData { get; set; } = string.Empty; + public string OtherMeasureData { get; set; } = string.Empty; } public class GetReadingQuestionAndAnswerInDto { @@ -1626,7 +1626,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// /// 文件类型 /// - public string? FileType { get; set; } + public string FileType { get; set; } = string.Empty; /// /// 字典code @@ -2165,14 +2165,14 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// /// 标记工具 /// - public string? MarkTool { get; set; } + public string MarkTool { get; set; } = string.Empty; public decimal RowIndex { get; set; } /// /// 截图地址 /// - public string? PicturePath { get; set; } + public string PicturePath { get; set; } = string.Empty; /// /// 任务Id @@ -2184,9 +2184,9 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public Guid TrialId { get; set; } - public string? MeasureData { get; set; } + public string MeasureData { get; set; } = string.Empty; - public string? OtherMeasureData { get; set; } + public string OtherMeasureData { get; set; } = string.Empty; public Guid? SeriesId { get; set; } @@ -2212,7 +2212,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public decimal? WL { get; set; } - public string? BlindName { get; set; } + public string BlindName { get; set; } = string.Empty; public bool IsDicomReading { get; set; } = true; @@ -2232,9 +2232,9 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public Guid? OtherStudyId { get; set; } - public string? OtherMarkTool { get; set; } + public string OtherMarkTool { get; set; } = string.Empty; - public string? OtherPicturePath { get; set; } + public string OtherPicturePath { get; set; } = string.Empty; public int? OtherNumberOfFrames { get; set; } diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index 566e9679c..3cf43f6df 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -383,7 +383,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// /// 文件类型 /// - public string? FileType { get; set; } + public string FileType { get; set; }=string.Empty; /// /// 自定义单位 @@ -507,7 +507,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// /// 文件类型 /// - public string? FileType { get; set; } + public string FileType { get; set; } = string.Empty; public Guid? Id { get; set; } public Guid ReadingQuestionId { get; set; } public string Type { get; set; } = string.Empty; @@ -1080,7 +1080,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// /// 文件类型 /// - public string? FileType { get; set; } + public string FileType { get; set; } = string.Empty; /// /// 数据来源 @@ -1159,7 +1159,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// /// 文件类型 /// - public string? FileType { get; set; } + public string FileType { get; set; } = string.Empty; /// /// Id @@ -1680,7 +1680,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// /// 文件类型 /// - public string? FileType { get; set; } + public string FileType { get; set; }=string.Empty; /// /// 数据来源 @@ -2076,7 +2076,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// /// 文件类型 /// - public string? FileType { get; set; } + public string FileType { get; set; } = string.Empty; /// /// 自定义单位 diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index f6d75b024..7f2b67c54 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -118,6 +118,13 @@ namespace IRaCIS.Application.Services public IResponseOutput TestJson() { + var trial=new Trial(); + + trial.ExperimentName = null; + + _trialRepository.AddAsync(trial,true); + + return ResponseOutput.Ok(new TestModel(), IRCEmailPasswordHelper.GenerateRandomPassword(10)); } diff --git a/IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs b/IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs index 5906e71fc..c5c795538 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs @@ -46,7 +46,7 @@ namespace IRaCIS.Core.Domain.Models public bool IsEnable { get; set; } - public string Note { get; set; } + public string Note { get; set; }=string.Empty; public Guid TrialReadingCriterionId { get; set; } diff --git a/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs b/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs index 21511a827..39c33a358 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs @@ -15,9 +15,9 @@ namespace IRaCIS.Core.Domain.Models { public class OSSImageInfo { - public string FileName { get; set; } + public string FileName { get; set; } = string.Empty; - public string ImagePath { get; set; } + public string ImagePath { get; set; } = string.Empty; } /// ///TaskMedicalReview diff --git a/IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs b/IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs index 160684ab6..9c87902d3 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs @@ -26,9 +26,9 @@ namespace IRaCIS.Core.Domain.Models public bool IsEnable { get; set; } - public string Note { get; set; } + public string Note { get; set; } = string.Empty; - public Guid TrialId { get; set; } + public Guid TrialId { get; set; } public int PlanVisitCount { get; set; } diff --git a/IRaCIS.Core.Domain/Allocation/TrialVirtualSiteCodeUpdate.cs b/IRaCIS.Core.Domain/Allocation/TrialVirtualSiteCodeUpdate.cs index 68c915486..45c629891 100644 --- a/IRaCIS.Core.Domain/Allocation/TrialVirtualSiteCodeUpdate.cs +++ b/IRaCIS.Core.Domain/Allocation/TrialVirtualSiteCodeUpdate.cs @@ -23,7 +23,7 @@ namespace IRaCIS.Core.Domain.Models public Guid TrialId { get; set; } - public string VirturalSiteCode { get; set; } + public string VirturalSiteCode { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Domain/BaseModel/DomainEvent.cs b/IRaCIS.Core.Domain/BaseModel/DomainEvent.cs index f645ebf3e..c0f4fbb4a 100644 --- a/IRaCIS.Core.Domain/BaseModel/DomainEvent.cs +++ b/IRaCIS.Core.Domain/BaseModel/DomainEvent.cs @@ -17,8 +17,8 @@ namespace IRaCIS.Core.Domain.BaseModel public class FailedDomainEvent { public Guid Id { get; set; } - public string EventType { get; set; } - public string EventData { get; set; } + public string EventType { get; set; } = string.Empty; + public string EventData { get; set; } = string.Empty; public DateTime FailedAt { get; set; } } } diff --git a/IRaCIS.Core.Domain/BaseModel/Entity.cs b/IRaCIS.Core.Domain/BaseModel/Entity.cs index 91638466d..26c0b0fc9 100644 --- a/IRaCIS.Core.Domain/BaseModel/Entity.cs +++ b/IRaCIS.Core.Domain/BaseModel/Entity.cs @@ -104,7 +104,7 @@ namespace IRaCIS.Core.Domain.Models public abstract class BaseAddAuditEntityWithUserName : Entity, IAuditAddWithUserName { - public string CreateUser { get; set; } + public string CreateUser { get; set; } = string.Empty; public Guid CreateUserId { get; set; } public DateTime CreateTime { get; set; } diff --git a/IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs b/IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs index 4786c8e6d..b301d3d87 100644 --- a/IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs +++ b/IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs @@ -19,7 +19,7 @@ namespace IRaCIS.Core.Domain.Models public interface IAuditAddWithUserName : IAuditAdd { - public string CreateUser { get; set; } + public string CreateUser { get; set; } } diff --git a/IRaCIS.Core.Domain/Common/Dictionary.cs b/IRaCIS.Core.Domain/Common/Dictionary.cs index 0608dffe4..a028e81cd 100644 --- a/IRaCIS.Core.Domain/Common/Dictionary.cs +++ b/IRaCIS.Core.Domain/Common/Dictionary.cs @@ -27,7 +27,7 @@ namespace IRaCIS.Core.Domain.Models #endregion - public string ChildGroup { get; set; } + public string ChildGroup { get; set; } = string.Empty; public int ChildCodeEnum { get; set; } @@ -46,7 +46,7 @@ namespace IRaCIS.Core.Domain.Models public int ShowOrder { get; set; } - public string Code { get; set; } + public string Code { get; set; } = string.Empty; public Guid? ParentId { get; set; } diff --git a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs index 272ad5060..1efc058dc 100644 --- a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs +++ b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs @@ -89,7 +89,7 @@ namespace IRaCIS.Core.Domain.Models //前端渲染数组 数组名 和数组值 - public string ChildDataLabel { get; set; } + public string ChildDataLabel { get; set; } = String.Empty; /// @@ -97,7 +97,7 @@ namespace IRaCIS.Core.Domain.Models /// public string ChildDataEnLabel { get; set; } = string.Empty; - public string ChildDataValue { get; set; } + public string ChildDataValue { get; set; } = String.Empty; @@ -112,10 +112,10 @@ namespace IRaCIS.Core.Domain.Models /// 前端展示类型 Router, Array,Table /// - public string DataType { get; set; } + public string DataType { get; set; } = String.Empty; // 后端翻译的类型 对应前端界面 "",Dictionary,Date - public string EnumType { get; set; } + public string EnumType { get; set; } = String.Empty; @@ -163,11 +163,11 @@ namespace IRaCIS.Core.Domain.Models /// 是否为特殊类型 /// public bool IsSpecialType { get; set; } - public string DictionaryKey { get; set; } + public string DictionaryKey { get; set; } = string.Empty; public bool IsShowByTrialConfig { get; set; } - public string TrialConfigRelyFieldName { get; set; } + public string TrialConfigRelyFieldName { get; set; } = string.Empty; #endregion @@ -180,7 +180,7 @@ namespace IRaCIS.Core.Domain.Models { public bool IsRoute { get; set; } - public string RoutePath { get; set; } + public string RoutePath { get; set; } = string.Empty; public bool IsHaveParameters { get; set; } diff --git a/IRaCIS.Core.Domain/Common/PublishLog.cs b/IRaCIS.Core.Domain/Common/PublishLog.cs index 8d7bf63e0..55c7019b5 100644 --- a/IRaCIS.Core.Domain/Common/PublishLog.cs +++ b/IRaCIS.Core.Domain/Common/PublishLog.cs @@ -17,14 +17,14 @@ namespace IRaCIS.Core.Domain.Models { - public string Version { get; set; } + public string Version { get; set; } = string.Empty; + + public DateTime? PublishTime { get; set; } - public DateTime? PublishTime { get; set; } - - public string UpdateContent { get; set; } - - //0 开发中 ,已发布 - public int State { get; set; } + public string UpdateContent { get; set; } = string.Empty; + + //0 开发中 ,已发布 + public int State { get; set; } public bool IsCurrentVersion { get; set; } diff --git a/IRaCIS.Core.Domain/Common/SystemBasicData.cs b/IRaCIS.Core.Domain/Common/SystemBasicData.cs index e663a5f5c..799565951 100644 --- a/IRaCIS.Core.Domain/Common/SystemBasicData.cs +++ b/IRaCIS.Core.Domain/Common/SystemBasicData.cs @@ -33,9 +33,9 @@ namespace IRaCIS.Core.Domain.Models public int ShowOrder { get; set; } - public string Code { get; set; } + public string Code { get; set; } = string.Empty; - public Guid? ParentId { get; set; } + public Guid? ParentId { get; set; } public string ValueCN { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Domain/Common/VerificationCode.cs b/IRaCIS.Core.Domain/Common/VerificationCode.cs index 8a7638fad..9a7f41926 100644 --- a/IRaCIS.Core.Domain/Common/VerificationCode.cs +++ b/IRaCIS.Core.Domain/Common/VerificationCode.cs @@ -11,7 +11,7 @@ namespace IRaCIS.Core.Domain.Models public Guid UserId { get; set; } = Guid.Empty; //验证码 - public string Code { get; set; } + public string Code { get; set; } = string.Empty; //什么类型的验证码 邮箱|手机 @@ -20,7 +20,7 @@ namespace IRaCIS.Core.Domain.Models public bool HasSend { get; set; } //发送的邮箱或者手机 - public string EmailOrPhone { get; set; } + public string EmailOrPhone { get; set; }=string.Empty; //过期时间 public DateTime ExpirationTime { get; set; } diff --git a/IRaCIS.Core.Domain/Dcotor/Attachment.cs b/IRaCIS.Core.Domain/Dcotor/Attachment.cs index a78eee9c8..85aaf8f47 100644 --- a/IRaCIS.Core.Domain/Dcotor/Attachment.cs +++ b/IRaCIS.Core.Domain/Dcotor/Attachment.cs @@ -21,7 +21,7 @@ namespace IRaCIS.Core.Domain.Models public Doctor Doctor { get; set; } public Guid DoctorId { get; set; } - public string Type { get; set; } + public string Type { get; set; } = string.Empty; public bool IsOfficial { get; set; } = false; public string Path { get; set; } = string.Empty; public string Code { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Domain/Dcotor/Doctor.cs b/IRaCIS.Core.Domain/Dcotor/Doctor.cs index bfa112dfa..0d698ebb9 100644 --- a/IRaCIS.Core.Domain/Dcotor/Doctor.cs +++ b/IRaCIS.Core.Domain/Dcotor/Doctor.cs @@ -48,7 +48,7 @@ namespace IRaCIS.Core.Domain.Models #endregion - public string ReviewerCode { get; set; } + public string ReviewerCode { get; set; } = string.Empty; public int Code { get; set; } @@ -58,7 +58,7 @@ namespace IRaCIS.Core.Domain.Models [StringLength(100)] - public string Password { get; set; } + public string Password { get; set; } = string.Empty; [StringLength(50)] diff --git a/IRaCIS.Core.Domain/Dcotor/DoctorCriterionFile.cs b/IRaCIS.Core.Domain/Dcotor/DoctorCriterionFile.cs index b7c019ea1..5a5edecf4 100644 --- a/IRaCIS.Core.Domain/Dcotor/DoctorCriterionFile.cs +++ b/IRaCIS.Core.Domain/Dcotor/DoctorCriterionFile.cs @@ -23,17 +23,17 @@ namespace IRaCIS.Core.Domain.Models /// /// 文件名称 /// - public string FileName { get; set; } - - /// + public string FileName { get; set; } = string.Empty; + + /// /// 文件路径 /// - public string FilePath { get; set; } - - /// + public string FilePath { get; set; } = string.Empty; + + /// /// 标准类型 /// - public CriterionType CriterionType { get; set; } + public CriterionType CriterionType { get; set; } /// /// 医生Id @@ -43,12 +43,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 备注 /// - public string Remark { get; set; } - - /// + public string Remark { get; set; } = string.Empty; + + /// /// 文件类型 /// - public CriterionFileType FileType { get; set; } + public CriterionFileType FileType { get; set; } @@ -59,8 +59,8 @@ namespace IRaCIS.Core.Domain.Models - public string CriterionName { get; set; } - public Guid? TrialReadingCriterionId { get; set; } + public string CriterionName { get; set; } = string.Empty; + public Guid? TrialReadingCriterionId { get; set; } public Guid? TrialId { get; set; } diff --git a/IRaCIS.Core.Domain/Dcotor/DoctorWorkload.cs b/IRaCIS.Core.Domain/Dcotor/DoctorWorkload.cs index fce8c78d6..2701ef933 100644 --- a/IRaCIS.Core.Domain/Dcotor/DoctorWorkload.cs +++ b/IRaCIS.Core.Domain/Dcotor/DoctorWorkload.cs @@ -41,7 +41,7 @@ namespace IRaCIS.Core.Domain.Models public int CreateUserType { get; set; } [Required] - public string YearMonth { get; set; } + public string YearMonth { get; set; } = string.Empty; public bool IsLock { get; set; } = false; diff --git a/IRaCIS.Core.Domain/Dcotor/TrialExperience.cs b/IRaCIS.Core.Domain/Dcotor/TrialExperience.cs index b9c88d696..831c52e13 100644 --- a/IRaCIS.Core.Domain/Dcotor/TrialExperience.cs +++ b/IRaCIS.Core.Domain/Dcotor/TrialExperience.cs @@ -22,7 +22,7 @@ namespace IRaCIS.Core.Domain.Models public Dictionary Phase { get; set; } [StringLength(512)] - public string EvaluationContent { get; set; } + public string EvaluationContent { get; set; } = string.Empty; public int VisitReadingCount { get; set; } diff --git a/IRaCIS.Core.Domain/Document/TrialEmailNoticeConfig.cs b/IRaCIS.Core.Domain/Document/TrialEmailNoticeConfig.cs index 1bd2ce787..6160fb984 100644 --- a/IRaCIS.Core.Domain/Document/TrialEmailNoticeConfig.cs +++ b/IRaCIS.Core.Domain/Document/TrialEmailNoticeConfig.cs @@ -84,8 +84,8 @@ namespace IRaCIS.Core.Domain.Models public string Description { get; set; } = string.Empty; - public string AttachName { get; set; } - public string AttachNameCN { get; set; } + public string AttachName { get; set; } = string.Empty; + public string AttachNameCN { get; set; } = string.Empty; public string EmailHtmlContent { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Domain/Financial/CalculateTask.cs b/IRaCIS.Core.Domain/Financial/CalculateTask.cs index d46027c7c..7d60de36e 100644 --- a/IRaCIS.Core.Domain/Financial/CalculateTask.cs +++ b/IRaCIS.Core.Domain/Financial/CalculateTask.cs @@ -10,7 +10,7 @@ namespace IRaCIS.Core.Domain.Models public Guid ReviewerId { get; set; } [Required] - public string YearMonth { get; set; } + public string YearMonth { get; set; } = string.Empty; public bool IsLock { get; set; } } } diff --git a/IRaCIS.Core.Domain/Financial/ExchangeRate.cs b/IRaCIS.Core.Domain/Financial/ExchangeRate.cs index 41fe845b6..c3cf0e6f2 100644 --- a/IRaCIS.Core.Domain/Financial/ExchangeRate.cs +++ b/IRaCIS.Core.Domain/Financial/ExchangeRate.cs @@ -6,7 +6,7 @@ namespace IRaCIS.Core.Domain.Models [Table("ExchangeRate")] public class ExchangeRate : BaseFullAuditEntity { - public string YearMonth { get; set; } + public string YearMonth { get; set; } = string.Empty; [Column(TypeName = "decimal(18,2)")] public decimal Rate { get; set; } diff --git a/IRaCIS.Core.Domain/Financial/PaymentAdjustment.cs b/IRaCIS.Core.Domain/Financial/PaymentAdjustment.cs index 732db0aa6..51fc64c24 100644 --- a/IRaCIS.Core.Domain/Financial/PaymentAdjustment.cs +++ b/IRaCIS.Core.Domain/Financial/PaymentAdjustment.cs @@ -9,7 +9,7 @@ namespace IRaCIS.Core.Domain.Models public Guid ReviewerId { get; set; } public DateTime YearMonthDate { get; set; } - public string YearMonth { get; set; } + public string YearMonth { get; set; } = string.Empty; [Column(TypeName = "decimal(18,2)")] public decimal AdjustmentUSD { get; set; } diff --git a/IRaCIS.Core.Domain/Financial/PaymentDetail.cs b/IRaCIS.Core.Domain/Financial/PaymentDetail.cs index 81c217ba4..04513282a 100644 --- a/IRaCIS.Core.Domain/Financial/PaymentDetail.cs +++ b/IRaCIS.Core.Domain/Financial/PaymentDetail.cs @@ -9,14 +9,14 @@ namespace IRaCIS.Core.Domain.Models { public Guid PaymentId { get; set; } public Guid DoctorId { get; set; } - public string YearMonth { get; set; } + public string YearMonth { get; set; } = string.Empty; public Guid TrialId { get; set; } [StringLength(50)] - public string TrialCode { get; set; } + public string TrialCode { get; set; } = string.Empty; [StringLength(50)] - public string PaymentType { get; set; } + public string PaymentType { get; set; } = string.Empty; public int Count { get; set; } [Column(TypeName = "decimal(18,2)")] diff --git a/IRaCIS.Core.Domain/Financial/RankPrice.cs b/IRaCIS.Core.Domain/Financial/RankPrice.cs index 7fce8616e..99686efcb 100644 --- a/IRaCIS.Core.Domain/Financial/RankPrice.cs +++ b/IRaCIS.Core.Domain/Financial/RankPrice.cs @@ -8,7 +8,7 @@ namespace IRaCIS.Core.Domain.Models public partial class RankPrice : BaseFullAuditEntity { [StringLength(200)] - public string RankName { get; set; } + public string RankName { get; set; } = string.Empty; [Column(TypeName = "decimal(18,2)")] public decimal Timepoint { get; set; } diff --git a/IRaCIS.Core.Domain/Financial/ReviewerPayInformation.cs b/IRaCIS.Core.Domain/Financial/ReviewerPayInformation.cs index 6b5d05c46..9dc577be4 100644 --- a/IRaCIS.Core.Domain/Financial/ReviewerPayInformation.cs +++ b/IRaCIS.Core.Domain/Financial/ReviewerPayInformation.cs @@ -9,16 +9,16 @@ namespace IRaCIS.Core.Domain.Models { public Guid DoctorId { get; set; } [StringLength(200)] - public string DoctorNameInBank { get; set; } + public string DoctorNameInBank { get; set; } = string.Empty; [StringLength(100)] - public string IDCard { get; set; } + public string IDCard { get; set; } = string.Empty; [StringLength(100)] - public string BankCardNumber { get; set; } + public string BankCardNumber { get; set; } = string.Empty; [StringLength(200)] - public string BankName { get; set; } + public string BankName { get; set; } = string.Empty; public Guid RankId { get; set; } [Column(TypeName = "decimal(18,2)")] diff --git a/IRaCIS.Core.Domain/Financial/TrialRevenuesPriceVerification.cs b/IRaCIS.Core.Domain/Financial/TrialRevenuesPriceVerification.cs index 822c312d6..039ba04de 100644 --- a/IRaCIS.Core.Domain/Financial/TrialRevenuesPriceVerification.cs +++ b/IRaCIS.Core.Domain/Financial/TrialRevenuesPriceVerification.cs @@ -8,7 +8,7 @@ namespace IRaCIS.Core.Domain.Models public Guid ReviewerId { get; set; } - public string YearMonth { get; set; } + public string YearMonth { get; set; } = string.Empty; public bool Training { get; set; } = false; diff --git a/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj b/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj index 15c6078d5..8f65510a5 100644 --- a/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj +++ b/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj @@ -1,5 +1,7 @@  - + + enable + net8.0 diff --git a/IRaCIS.Core.Domain/Image/DicomInstance.cs b/IRaCIS.Core.Domain/Image/DicomInstance.cs index cc9a83c3a..8893ae3b8 100644 --- a/IRaCIS.Core.Domain/Image/DicomInstance.cs +++ b/IRaCIS.Core.Domain/Image/DicomInstance.cs @@ -22,9 +22,9 @@ namespace IRaCIS.Core.Domain.Models public Guid SeqId { get; set; } public Guid StudyId { get; set; } public Guid SeriesId { get; set; } - public string StudyInstanceUid { get; set; } - public string SeriesInstanceUid { get; set; } - public string SopInstanceUid { get; set; } + public string StudyInstanceUid { get; set; } = String.Empty; + public string SeriesInstanceUid { get; set; } = String.Empty; + public string SopInstanceUid { get; set; } = String.Empty; public int InstanceNumber { get; set; } public DateTime? InstanceTime { get; set; } public bool CPIStatus { get; set; } @@ -33,14 +33,14 @@ namespace IRaCIS.Core.Domain.Models public int SliceLocation { get; set; } - public string SliceThickness { get; set; } + public string SliceThickness { get; set; } = String.Empty; public int NumberOfFrames { get; set; } - public string PixelSpacing { get; set; } + public string PixelSpacing { get; set; } = String.Empty; - public string ImagerPixelSpacing { get; set; } - public string FrameOfReferenceUID { get; set; } - public string WindowCenter { get; set; } - public string WindowWidth { get; set; } + public string ImagerPixelSpacing { get; set; } = String.Empty; + public string FrameOfReferenceUID { get; set; } = String.Empty; + public string WindowCenter { get; set; } = String.Empty; + public string WindowWidth { get; set; } = String.Empty; public Guid TrialId { get; set; } @@ -48,9 +48,9 @@ namespace IRaCIS.Core.Domain.Models public Guid SubjectId { get; set; } public Guid SubjectVisitId { get; set; } public bool Anonymize { get; set; } - public string Path { get; set; } + public string Path { get; set; } = String.Empty; - public string HtmlPath { get; set; }=string.Empty; + public string HtmlPath { get; set; } = string.Empty; public long? FileSize { get; set; } diff --git a/IRaCIS.Core.Domain/Image/DicomSeries.cs b/IRaCIS.Core.Domain/Image/DicomSeries.cs index 775cbe66f..a6f3b5ae0 100644 --- a/IRaCIS.Core.Domain/Image/DicomSeries.cs +++ b/IRaCIS.Core.Domain/Image/DicomSeries.cs @@ -24,21 +24,21 @@ namespace IRaCIS.Core.Domain.Models public Guid SeqId { get; set; } public Guid StudyId { get; set; } - public string StudyInstanceUid { get; set; } - public string SeriesInstanceUid { get; set; } + public string StudyInstanceUid { get; set; }=string.Empty; + public string SeriesInstanceUid { get; set; } = string.Empty; public int SeriesNumber { get; set; } public DateTime? SeriesTime { get; set; } - public string Modality { get; set; } - public string Description { get; set; } + public string Modality { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; public int InstanceCount { get; set; } - public string SliceThickness { get; set; } + public string SliceThickness { get; set; } = string.Empty; - public string ImagePositionPatient { get; set; } - public string ImageOrientationPatient { get; set; } - public string BodyPartExamined { get; set; } - public string SequenceName { get; set; } - public string ProtocolName { get; set; } - public string ImagerPixelSpacing { get; set; } + public string ImagePositionPatient { get; set; } = string.Empty; + public string ImageOrientationPatient { get; set; } = string.Empty; + public string BodyPartExamined { get; set; } = string.Empty; + public string SequenceName { get; set; } = string.Empty; + public string ProtocolName { get; set; } = string.Empty; + public string ImagerPixelSpacing { get; set; } = string.Empty; public string AcquisitionTime { get; set; } = string.Empty; public string AcquisitionNumber { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Domain/Image/DicomStudyMonitor.cs b/IRaCIS.Core.Domain/Image/DicomStudyMonitor.cs index 29d084dbe..e3d7716da 100644 --- a/IRaCIS.Core.Domain/Image/DicomStudyMonitor.cs +++ b/IRaCIS.Core.Domain/Image/DicomStudyMonitor.cs @@ -63,7 +63,7 @@ namespace IRaCIS.Core.Domain.Models public long FileSize { get; set; } - public string IP { get; set; } + public string IP { get; set; }=string.Empty; public bool IsDicomReUpload { get; set; } diff --git a/IRaCIS.Core.Domain/Image/ImageShare.cs b/IRaCIS.Core.Domain/Image/ImageShare.cs index cbd10e7af..0244d9781 100644 --- a/IRaCIS.Core.Domain/Image/ImageShare.cs +++ b/IRaCIS.Core.Domain/Image/ImageShare.cs @@ -13,7 +13,7 @@ namespace IRaCIS.Core.Domain.Models public DateTime ExpireTime { get; set; } - public string Password { get; set; } + public string Password { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/IRaCIS.Core.Domain/Image/NoneDicomStudy.cs b/IRaCIS.Core.Domain/Image/NoneDicomStudy.cs index 900b2f720..cc952b815 100644 --- a/IRaCIS.Core.Domain/Image/NoneDicomStudy.cs +++ b/IRaCIS.Core.Domain/Image/NoneDicomStudy.cs @@ -52,12 +52,12 @@ namespace IRaCIS.Core.Domain.Models - public string BodyPart { get; set; } + public string BodyPart { get; set; } = string.Empty; - - public string Modality { get; set; } - - public DateTime ImageDate { get; set; } + + public string Modality { get; set; } = string.Empty; + + public DateTime ImageDate { get; set; } public string Description { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Domain/Image/NoneDicomStudyFile.cs b/IRaCIS.Core.Domain/Image/NoneDicomStudyFile.cs index 10575a795..48e9be4de 100644 --- a/IRaCIS.Core.Domain/Image/NoneDicomStudyFile.cs +++ b/IRaCIS.Core.Domain/Image/NoneDicomStudyFile.cs @@ -30,12 +30,12 @@ namespace IRaCIS.Core.Domain.Models public Guid NoneDicomStudyId { get; set; } - public string Path { get; set; } + public string Path { get; set; } = string.Empty; - public string FileName { get; set; } + public string FileName { get; set; } = string.Empty; - public string FileType { get; set; } + public string FileType { get; set; } = string.Empty; public long? FileSize { get; set; } diff --git a/IRaCIS.Core.Domain/Image/SCPInstance.cs b/IRaCIS.Core.Domain/Image/SCPInstance.cs index 4bc2ed272..a7a092f9c 100644 --- a/IRaCIS.Core.Domain/Image/SCPInstance.cs +++ b/IRaCIS.Core.Domain/Image/SCPInstance.cs @@ -22,9 +22,9 @@ namespace IRaCIS.Core.Domain.Models public Guid SeqId { get; set; } public Guid StudyId { get; set; } public Guid SeriesId { get; set; } - public string StudyInstanceUid { get; set; } - public string SeriesInstanceUid { get; set; } - public string SopInstanceUid { get; set; } + public string StudyInstanceUid { get; set; } = string.Empty; + public string SeriesInstanceUid { get; set; } = string.Empty; + public string SopInstanceUid { get; set; } = string.Empty; public int InstanceNumber { get; set; } public DateTime? InstanceTime { get; set; } public bool CPIStatus { get; set; } @@ -33,15 +33,15 @@ namespace IRaCIS.Core.Domain.Models public int SliceLocation { get; set; } - public string SliceThickness { get; set; } + public string SliceThickness { get; set; } = string.Empty; public int NumberOfFrames { get; set; } - public string PixelSpacing { get; set; } + public string PixelSpacing { get; set; } = string.Empty; + + public string ImagerPixelSpacing { get; set; } = string.Empty; + public string FrameOfReferenceUID { get; set; } = string.Empty; + public string WindowCenter { get; set; } = string.Empty; + public string WindowWidth { get; set; } = string.Empty; - public string ImagerPixelSpacing { get; set; } - public string FrameOfReferenceUID { get; set; } - public string WindowCenter { get; set; } - public string WindowWidth { get; set; } - public bool Anonymize { get; set; } public string Path { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Domain/Image/SCPSeries.cs b/IRaCIS.Core.Domain/Image/SCPSeries.cs index 5e4d6abb8..11a3b726a 100644 --- a/IRaCIS.Core.Domain/Image/SCPSeries.cs +++ b/IRaCIS.Core.Domain/Image/SCPSeries.cs @@ -20,21 +20,21 @@ namespace IRaCIS.Core.Domain.Models public Guid SeqId { get; set; } public Guid StudyId { get; set; } - public string StudyInstanceUid { get; set; } - public string SeriesInstanceUid { get; set; } + public string StudyInstanceUid { get; set; } = string.Empty; + public string SeriesInstanceUid { get; set; } = string.Empty; public int SeriesNumber { get; set; } public DateTime? SeriesTime { get; set; } - public string Modality { get; set; } - public string Description { get; set; } + public string Modality { get; set; }=string.Empty; + public string Description { get; set; } = string.Empty; public int InstanceCount { get; set; } - public string SliceThickness { get; set; } + public string SliceThickness { get; set; } = string.Empty; - public string ImagePositionPatient { get; set; } - public string ImageOrientationPatient { get; set; } - public string BodyPartExamined { get; set; } - public string SequenceName { get; set; } - public string ProtocolName { get; set; } - public string ImagerPixelSpacing { get; set; } + public string ImagePositionPatient { get; set; } = string.Empty; + public string ImageOrientationPatient { get; set; } = string.Empty; + public string BodyPartExamined { get; set; } = string.Empty; + public string SequenceName { get; set; } = string.Empty; + public string ProtocolName { get; set; } = string.Empty; + public string ImagerPixelSpacing { get; set; } = string.Empty; public string AcquisitionTime { get; set; } = string.Empty; public string AcquisitionNumber { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Domain/Image/SystemAnonymization.cs b/IRaCIS.Core.Domain/Image/SystemAnonymization.cs index 31275b027..8ae645fe1 100644 --- a/IRaCIS.Core.Domain/Image/SystemAnonymization.cs +++ b/IRaCIS.Core.Domain/Image/SystemAnonymization.cs @@ -25,10 +25,10 @@ namespace IRaCIS.Core.Domain.Models public string TagDescription { get; set; } = String.Empty; - public string TagDescriptionCN { get; set; } + public string TagDescriptionCN { get; set; } = string.Empty; - - public string ReplaceValue { get; set; } = String.Empty; + + public string ReplaceValue { get; set; } = String.Empty; public string ValueRepresentation { get; set; } = String.Empty; diff --git a/IRaCIS.Core.Domain/Image/TaskInstance.cs b/IRaCIS.Core.Domain/Image/TaskInstance.cs index 976ada1c5..ba6acebd1 100644 --- a/IRaCIS.Core.Domain/Image/TaskInstance.cs +++ b/IRaCIS.Core.Domain/Image/TaskInstance.cs @@ -21,9 +21,9 @@ namespace IRaCIS.Core.Domain.Models public Guid SeqId { get; set; } public Guid StudyId { get; set; } public Guid SeriesId { get; set; } - public string StudyInstanceUid { get; set; } - public string SeriesInstanceUid { get; set; } - public string SopInstanceUid { get; set; } + public string StudyInstanceUid { get; set; } = string.Empty; + public string SeriesInstanceUid { get; set; } = string.Empty; + public string SopInstanceUid { get; set; } = string.Empty; public int InstanceNumber { get; set; } public DateTime? InstanceTime { get; set; } public bool CPIStatus { get; set; } @@ -32,23 +32,23 @@ namespace IRaCIS.Core.Domain.Models public int SliceLocation { get; set; } - public string SliceThickness { get; set; } + public string SliceThickness { get; set; } = string.Empty; public int NumberOfFrames { get; set; } - public string PixelSpacing { get; set; } + public string PixelSpacing { get; set; } = string.Empty; - public string ImagerPixelSpacing { get; set; } - public string FrameOfReferenceUID { get; set; } - public string WindowCenter { get; set; } - public string WindowWidth { get; set; } + public string ImagerPixelSpacing { get; set; } = string.Empty; + public string FrameOfReferenceUID { get; set; } = string.Empty; + public string WindowCenter { get; set; } = string.Empty; + public string WindowWidth { get; set; } = string.Empty; public Guid TrialId { get; set; } public Guid SubjectId { get; set; } public Guid VisitTaskId { get; set; } public bool Anonymize { get; set; } - public string Path { get; set; } + public string Path { get; set; } = string.Empty; + - public string HtmlPath { get; set; }=string.Empty; public long? FileSize { get; set; } diff --git a/IRaCIS.Core.Domain/Image/TaskSeries.cs b/IRaCIS.Core.Domain/Image/TaskSeries.cs index b6d1ba154..5f74e1290 100644 --- a/IRaCIS.Core.Domain/Image/TaskSeries.cs +++ b/IRaCIS.Core.Domain/Image/TaskSeries.cs @@ -20,21 +20,21 @@ namespace IRaCIS.Core.Domain.Models public Guid SeqId { get; set; } public Guid StudyId { get; set; } - public string StudyInstanceUid { get; set; } - public string SeriesInstanceUid { get; set; } + public string StudyInstanceUid { get; set; } = String.Empty; + public string SeriesInstanceUid { get; set; } = String.Empty; public int SeriesNumber { get; set; } public DateTime? SeriesTime { get; set; } - public string Modality { get; set; } - public string Description { get; set; } + public string Modality { get; set; } = String.Empty; + public string Description { get; set; } = String.Empty; public int InstanceCount { get; set; } - public string SliceThickness { get; set; } + public string SliceThickness { get; set; } = String.Empty; - public string ImagePositionPatient { get; set; } - public string ImageOrientationPatient { get; set; } - public string BodyPartExamined { get; set; } - public string SequenceName { get; set; } - public string ProtocolName { get; set; } - public string ImagerPixelSpacing { get; set; } + public string ImagePositionPatient { get; set; } = String.Empty; + public string ImageOrientationPatient { get; set; } = String.Empty; + public string BodyPartExamined { get; set; } = String.Empty; + public string SequenceName { get; set; } = String.Empty; + public string ProtocolName { get; set; } = String.Empty; + public string ImagerPixelSpacing { get; set; } = String.Empty; public string AcquisitionTime { get; set; } = string.Empty; public string AcquisitionNumber { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Domain/Image/TrialDicomAE.cs b/IRaCIS.Core.Domain/Image/TrialDicomAE.cs index 58fdbf36e..db3588e36 100644 --- a/IRaCIS.Core.Domain/Image/TrialDicomAE.cs +++ b/IRaCIS.Core.Domain/Image/TrialDicomAE.cs @@ -9,36 +9,36 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace IRaCIS.Core.Domain.Models { - /// - ///DicomAE - /// - [Table("TrialDicomAE")] - public class TrialDicomAE : BaseFullAuditEntity - { + /// + ///DicomAE + /// + [Table("TrialDicomAE")] + public class TrialDicomAE : BaseFullAuditEntity + { #region 导航属性 #endregion public Guid TrialId { get; set; } - - - public string CalledAE { get; set; } = string.Empty; - - public string IP { get; set; } - - - public int Port { get; set; } - - - public string Modality { get; set; } = string.Empty; - public string Description { get; set; }=string.Empty; + public string CalledAE { get; set; } = string.Empty; + + public string IP { get; set; } = string.Empty; - public DateTime? LatestTestTime { get; set; } + public int Port { get; set; } - public bool? IsTestOK { get; set; } - - } -} + public string Modality { get; set; } = string.Empty; + + + public string Description { get; set; } = string.Empty; + + + public DateTime? LatestTestTime { get; set; } + + public bool? IsTestOK { get; set; } + + } + +} diff --git a/IRaCIS.Core.Domain/Institution/CRO.cs b/IRaCIS.Core.Domain/Institution/CRO.cs index 35b8bc753..a592a7680 100644 --- a/IRaCIS.Core.Domain/Institution/CRO.cs +++ b/IRaCIS.Core.Domain/Institution/CRO.cs @@ -11,7 +11,7 @@ namespace IRaCIS.Core.Domain.Models #endregion public string CROName { get; set; } = string.Empty; public string CRONameCN { get; set; } = string.Empty; - public string CROCode { get; set; } + public string CROCode { get; set; } = string.Empty; public bool IsTrialLevel { get; set; } diff --git a/IRaCIS.Core.Domain/Institution/Site.cs b/IRaCIS.Core.Domain/Institution/Site.cs index 1287a1c86..a1b43bd4d 100644 --- a/IRaCIS.Core.Domain/Institution/Site.cs +++ b/IRaCIS.Core.Domain/Institution/Site.cs @@ -18,7 +18,7 @@ namespace IRaCIS.Core.Domain.Models public string SiteName { get; set; } = string.Empty; public string SiteNameCN{ get; set; } = string.Empty; public string AliasName { get; set; } = string.Empty; - public string SiteCode { get; set; } + public string SiteCode { get; set; } = string.Empty; public int Code { get; set; } @@ -31,7 +31,7 @@ namespace IRaCIS.Core.Domain.Models public string UniqueCode { get; set; } = string.Empty; - public string Address { get; set; } + public string Address { get; set; } = string.Empty; public string DirectorName { get; set; } = string.Empty; public string DirectorPhone { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Domain/Management/Menu.cs b/IRaCIS.Core.Domain/Management/Menu.cs index 04ef92b3a..0613290df 100644 --- a/IRaCIS.Core.Domain/Management/Menu.cs +++ b/IRaCIS.Core.Domain/Management/Menu.cs @@ -20,7 +20,7 @@ namespace IRaCIS.Core.Domain.Models // 类型(M目录 C菜单 F按钮 L链接) public string MenuType { get; set; } = string.Empty; - public string MenuIcon { get; set; } + public string MenuIcon { get; set; } = string.Empty; public string MenuName { get; set; } = string.Empty; @@ -44,10 +44,10 @@ namespace IRaCIS.Core.Domain.Models public bool IsExternalLink { get; set; } //权限点 - public string PermissionStr { get; set; } + public string PermissionStr { get; set; } = string.Empty; //Api 接口地址 - public string ApiPath { get; set; } + public string ApiPath { get; set; } = string.Empty; public string Note { get; set; } = string.Empty; @@ -56,7 +56,7 @@ namespace IRaCIS.Core.Domain.Models public string Redirect { get; set; } = string.Empty; - public string LanguageMark { get; set; } + public string LanguageMark { get; set; } = string.Empty; } diff --git a/IRaCIS.Core.Domain/Management/Notice/SystemNotice.cs b/IRaCIS.Core.Domain/Management/Notice/SystemNotice.cs index c73658228..33fc437d5 100644 --- a/IRaCIS.Core.Domain/Management/Notice/SystemNotice.cs +++ b/IRaCIS.Core.Domain/Management/Notice/SystemNotice.cs @@ -30,7 +30,7 @@ namespace IRaCIS.Core.Domain.Models - public string NoticeContent { get; set; } + public string NoticeContent { get; set; } = string.Empty; public SystemNotice_NoticeTypeEnum NoticeTypeEnum { get; set; } @@ -46,9 +46,9 @@ namespace IRaCIS.Core.Domain.Models public DateTime? EndDate { get; set; } - public string FileName { get; set; } + public string FileName { get; set; } = string.Empty; - public string Path { get; set; } + public string Path { get; set; } = string.Empty; public Guid? PublishedUserId { get; set; } diff --git a/IRaCIS.Core.Domain/Management/UserFeedBack.cs b/IRaCIS.Core.Domain/Management/UserFeedBack.cs index 9dd0d1d66..f83a4e91b 100644 --- a/IRaCIS.Core.Domain/Management/UserFeedBack.cs +++ b/IRaCIS.Core.Domain/Management/UserFeedBack.cs @@ -47,10 +47,10 @@ namespace IRaCIS.Core.Domain.Models public int QuestionType { get; set; } - public string QuestionDescription { get; set; } + public string QuestionDescription { get; set; } = string.Empty; + - public int State { get; set; } @@ -61,9 +61,9 @@ namespace IRaCIS.Core.Domain.Models public Guid? TrialId { get; set; } - public string ScreenshotListStr { get; set; } + public string ScreenshotListStr { get; set; } = string.Empty; + - diff --git a/IRaCIS.Core.Domain/Management/UserLog.cs b/IRaCIS.Core.Domain/Management/UserLog.cs index 980656bca..0483ca1ce 100644 --- a/IRaCIS.Core.Domain/Management/UserLog.cs +++ b/IRaCIS.Core.Domain/Management/UserLog.cs @@ -40,7 +40,7 @@ namespace IRaCIS.Core.Domain.Models - public string IPRegion { get; set; } + public string IPRegion { get; set; } = string.Empty; } diff --git a/IRaCIS.Core.Domain/Management/UserPassWordLog.cs b/IRaCIS.Core.Domain/Management/UserPassWordLog.cs index e702b0be4..c76bd52b9 100644 --- a/IRaCIS.Core.Domain/Management/UserPassWordLog.cs +++ b/IRaCIS.Core.Domain/Management/UserPassWordLog.cs @@ -27,11 +27,11 @@ namespace IRaCIS.Core.Domain.Models /// /// 密码 /// - public string PassWord { get; set; } - + public string PassWord { get; set; } = string.Empty; - - } + + + } } diff --git a/IRaCIS.Core.Domain/Management/UserType.cs b/IRaCIS.Core.Domain/Management/UserType.cs index a1490e0e8..02cc5c28a 100644 --- a/IRaCIS.Core.Domain/Management/UserType.cs +++ b/IRaCIS.Core.Domain/Management/UserType.cs @@ -22,9 +22,9 @@ namespace IRaCIS.Core.Domain.Models #endregion public UserTypeEnum UserTypeEnum { get; set; } - public string UserTypeName { get; set; } + public string UserTypeName { get; set; } = string.Empty; - public string Description { get; set; } + public string Description { get; set; } = string.Empty; public int Order { get; set; } @@ -33,11 +33,11 @@ namespace IRaCIS.Core.Domain.Models public bool IsEnable { get; set; } = true; - public string PermissionStr { get; set; } + public string PermissionStr { get; set; } = string.Empty; + - } } \ No newline at end of file diff --git a/IRaCIS.Core.Domain/QC/CheckChallengeDialog.cs b/IRaCIS.Core.Domain/QC/CheckChallengeDialog.cs index df3e08de2..3dd8bc9a0 100644 --- a/IRaCIS.Core.Domain/QC/CheckChallengeDialog.cs +++ b/IRaCIS.Core.Domain/QC/CheckChallengeDialog.cs @@ -26,6 +26,6 @@ namespace IRaCIS.Core.Domain.Models public bool? IsCRCNeedReply { get; set; } - public string ParamInfo { get; set; } + public string ParamInfo { get; set; } = string.Empty; } } diff --git a/IRaCIS.Core.Domain/QC/ClinicalData/PreviousPDF.cs b/IRaCIS.Core.Domain/QC/ClinicalData/PreviousPDF.cs index 7e42a1cc4..d1535e36f 100644 --- a/IRaCIS.Core.Domain/QC/ClinicalData/PreviousPDF.cs +++ b/IRaCIS.Core.Domain/QC/ClinicalData/PreviousPDF.cs @@ -24,12 +24,12 @@ namespace IRaCIS.Core.Domain.Models public Guid SubjectVisitId { get; set; } - public string Path { get; set; } - - public string FileName { get; set; } - + public string Path { get; set; } = string.Empty; - public bool? IsVisist { get; set; } + public string FileName { get; set; } = string.Empty; + + + public bool? IsVisist { get; set; } /// /// 临床级别 diff --git a/IRaCIS.Core.Domain/QC/ConsistencyCheckFile.cs b/IRaCIS.Core.Domain/QC/ConsistencyCheckFile.cs index 104f759c3..89f04ad74 100644 --- a/IRaCIS.Core.Domain/QC/ConsistencyCheckFile.cs +++ b/IRaCIS.Core.Domain/QC/ConsistencyCheckFile.cs @@ -16,12 +16,12 @@ namespace IRaCIS.Core.Domain.Models public User User { get; set; } #endregion - public string FileName { get; set; } + public string FileName { get; set; } = string.Empty; - public string RelativePath { get; set; } + public string RelativePath { get; set; } = string.Empty; - public Guid TrialId { get; set; } + public Guid TrialId { get; set; } diff --git a/IRaCIS.Core.Domain/QC/QCChallenge.cs b/IRaCIS.Core.Domain/QC/QCChallenge.cs index 6732c2bc2..86513fc7e 100644 --- a/IRaCIS.Core.Domain/QC/QCChallenge.cs +++ b/IRaCIS.Core.Domain/QC/QCChallenge.cs @@ -53,7 +53,7 @@ namespace IRaCIS.Core.Domain.Models public Guid? LatestReplyUserId { get; set; } - public string ChallengeCode { get; set; } + public string ChallengeCode { get; set; } = string.Empty; public int Code { get; set; } diff --git a/IRaCIS.Core.Domain/QC/QCQuestion.cs b/IRaCIS.Core.Domain/QC/QCQuestion.cs index febd0c98b..aca577f2b 100644 --- a/IRaCIS.Core.Domain/QC/QCQuestion.cs +++ b/IRaCIS.Core.Domain/QC/QCQuestion.cs @@ -37,7 +37,7 @@ namespace IRaCIS.Core.Domain.Models public string TypeValue { get; set; } = string.Empty; - public string ParentTriggerValue { get; set; } + public string ParentTriggerValue { get; set; } = string.Empty; public Guid? ParentId { get; set; } diff --git a/IRaCIS.Core.Domain/QC/TrialQCQuestion.cs b/IRaCIS.Core.Domain/QC/TrialQCQuestion.cs index fcca55688..8fdac80c2 100644 --- a/IRaCIS.Core.Domain/QC/TrialQCQuestion.cs +++ b/IRaCIS.Core.Domain/QC/TrialQCQuestion.cs @@ -49,13 +49,13 @@ namespace IRaCIS.Core.Domain.Models public Guid? ParentId { get; set; } - public string TypeValue { get; set; } - + public string TypeValue { get; set; } = string.Empty; - public string ParentTriggerValue { get; set; } - - public int ShowOrder { get; set; } + public string ParentTriggerValue { get; set; } = string.Empty; + + + public int ShowOrder { get; set; } public bool? IsConfirm { get; set; } diff --git a/IRaCIS.Core.Domain/QC/TrialQCQuestionAnswer.cs b/IRaCIS.Core.Domain/QC/TrialQCQuestionAnswer.cs index 2b18610b2..998576725 100644 --- a/IRaCIS.Core.Domain/QC/TrialQCQuestionAnswer.cs +++ b/IRaCIS.Core.Domain/QC/TrialQCQuestionAnswer.cs @@ -23,7 +23,7 @@ namespace IRaCIS.Core.Domain.Models public Guid TrialId { get; set; } - public string Answer { get; set; } + public string Answer { get; set; } = string.Empty; public TrialQCProcess QCProcessEnum { get; set; } diff --git a/IRaCIS.Core.Domain/Reading/AdditionalEvaluate/SubjectAdditionalEvaluationResult.cs b/IRaCIS.Core.Domain/Reading/AdditionalEvaluate/SubjectAdditionalEvaluationResult.cs index ec93af7de..93a4f7fa3 100644 --- a/IRaCIS.Core.Domain/Reading/AdditionalEvaluate/SubjectAdditionalEvaluationResult.cs +++ b/IRaCIS.Core.Domain/Reading/AdditionalEvaluate/SubjectAdditionalEvaluationResult.cs @@ -32,13 +32,13 @@ namespace IRaCIS.Core.Domain.Models public Guid? VisitTaskId { get; set; } - public string Answer { get; set; } - - /// + public string Answer { get; set; } = string.Empty; + + /// /// 附加评估答案翻译字典 /// - public string TranslateDictionaryCode { get; set; }=string.Empty; + public string TranslateDictionaryCode { get; set; }=string.Empty; /// /// 是否是最终结果 @@ -50,14 +50,14 @@ namespace IRaCIS.Core.Domain.Models /// 最终结果 /// - public string FinalAnswer { get; set; } - - /// + public string FinalAnswer { get; set; } = string.Empty; + + /// /// 最终结果翻字典 /// - public string FinalTranslateDictionaryCode { get; set; } - - } + public string FinalTranslateDictionaryCode { get; set; } = string.Empty; + + } } diff --git a/IRaCIS.Core.Domain/Reading/ClinicalData/ClinicalDataSystemSet.cs b/IRaCIS.Core.Domain/Reading/ClinicalData/ClinicalDataSystemSet.cs index 9b1c1d414..7e04dfa4f 100644 --- a/IRaCIS.Core.Domain/Reading/ClinicalData/ClinicalDataSystemSet.cs +++ b/IRaCIS.Core.Domain/Reading/ClinicalData/ClinicalDataSystemSet.cs @@ -1,19 +1,18 @@ -using System; using IRaCIS.Core.Domain.Share; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; +using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; namespace IRaCIS.Core.Domain.Models { - /// - /// 临床资料系统配置 - /// - [Table("ClinicalDataSystemSet")] - public class ClinicalDataSystemSet : BaseAddAuditEntity + /// + /// 临床资料系统配置 + /// + [Table("ClinicalDataSystemSet")] + public class ClinicalDataSystemSet : BaseAddAuditEntity { #region 导航属性 @@ -24,10 +23,10 @@ namespace IRaCIS.Core.Domain.Models /// public int ClinicalDataSetEnum { get; set; } - /// - /// 名称 - /// - public string ClinicalDataSetName { get; set; } + /// + /// 名称 + /// + public string ClinicalDataSetName { get; set; } = string.Empty; /// /// 是否应用 @@ -39,53 +38,53 @@ namespace IRaCIS.Core.Domain.Models /// public string ClinicalDataSetEnName { get; set; } = string.Empty; - /// - /// 临床级别 - /// - public ClinicalLevel ClinicalDataLevel { get; set; } + /// + /// 临床级别 + /// + public ClinicalLevel ClinicalDataLevel { get; set; } - /// - /// 上传方式 - /// - public ClinicalUploadType ClinicalUploadType { get; set; } + /// + /// 上传方式 + /// + public ClinicalUploadType ClinicalUploadType { get; set; } - /// - /// 是否启用 - /// - public bool IsEnable { get; set; } + /// + /// 是否启用 + /// + public bool IsEnable { get; set; } - /// - /// 上传角色 - /// - public UploadRole UploadRole { get; set; } + /// + /// 上传角色 + /// + public UploadRole UploadRole { get; set; } - /// - /// 模板文件名称 - /// - public string FileName { get; set; } + /// + /// 模板文件名称 + /// + public string FileName { get; set; } = string.Empty; - /// - /// 文件路径 - /// - public string Path { get; set; } + /// + /// 文件路径 + /// + public string Path { get; set; } = string.Empty; - public string CriterionEnumListStr { get; set; }=String.Empty; + public string CriterionEnumListStr { get; set; } = String.Empty; [NotMapped] - public List CriterionEnumList => CriterionEnumListStr.Split('|', StringSplitOptions.RemoveEmptyEntries).Where(t => !string.IsNullOrEmpty(t) && int.TryParse(t.Trim(),out var s)).Select(t => int.Parse(t.Trim()) ).ToList(); + public List CriterionEnumList => CriterionEnumListStr.Split('|', StringSplitOptions.RemoveEmptyEntries).Where(t => !string.IsNullOrEmpty(t) && int.TryParse(t.Trim(), out var s)).Select(t => int.Parse(t.Trim())).ToList(); - //public List SystemClinicalDataCriterionList { get; set; } = new List(); + //public List SystemClinicalDataCriterionList { get; set; } = new List(); + + } - } - diff --git a/IRaCIS.Core.Domain/Reading/ClinicalData/ClinicalDataTrialSet.cs b/IRaCIS.Core.Domain/Reading/ClinicalData/ClinicalDataTrialSet.cs index 64f743b74..478db8018 100644 --- a/IRaCIS.Core.Domain/Reading/ClinicalData/ClinicalDataTrialSet.cs +++ b/IRaCIS.Core.Domain/Reading/ClinicalData/ClinicalDataTrialSet.cs @@ -39,7 +39,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 名称 /// - public string ClinicalDataSetName { get; set; } + public string ClinicalDataSetName { get; set; }=string.Empty; /// /// 英文名称 @@ -87,16 +87,16 @@ namespace IRaCIS.Core.Domain.Models /// /// 模板文件名称 /// - public string FileName { get; set; } + public string FileName { get; set; } = string.Empty; /// /// 文件路径 /// - public string Path { get; set; } + public string Path { get; set; } = string.Empty; - public string CriterionEnumListStr { get; set; } = String.Empty; + public string CriterionEnumListStr { get; set; } = String.Empty; public List CriterionEnumList => CriterionEnumListStr.Split('|', StringSplitOptions.RemoveEmptyEntries).Where(t => !string.IsNullOrEmpty(t) && int.TryParse(t.Trim(), out var s)).Select(t => int.Parse(t.Trim())).ToList(); diff --git a/IRaCIS.Core.Domain/Reading/ClinicalData/ReadingClinicalDataPDF.cs b/IRaCIS.Core.Domain/Reading/ClinicalData/ReadingClinicalDataPDF.cs index fe2149803..615e5f8bd 100644 --- a/IRaCIS.Core.Domain/Reading/ClinicalData/ReadingClinicalDataPDF.cs +++ b/IRaCIS.Core.Domain/Reading/ClinicalData/ReadingClinicalDataPDF.cs @@ -24,15 +24,15 @@ namespace IRaCIS.Core.Domain.Models /// public Guid ReadingClinicalDataId { get; set; } - public string Path { get; set; } + public string Path { get; set; } = string.Empty; - public string FileName { get; set; } + public string FileName { get; set; } = string.Empty; - public int Size { get; set; } = 0; + public int Size { get; set; } = 0; - public string Type { get; set; } + public string Type { get; set; } = string.Empty; } diff --git a/IRaCIS.Core.Domain/Reading/ClinicalData/ReadingConsistentClinicalDataPDF.cs b/IRaCIS.Core.Domain/Reading/ClinicalData/ReadingConsistentClinicalDataPDF.cs index c37778d50..5dbb5d41c 100644 --- a/IRaCIS.Core.Domain/Reading/ClinicalData/ReadingConsistentClinicalDataPDF.cs +++ b/IRaCIS.Core.Domain/Reading/ClinicalData/ReadingConsistentClinicalDataPDF.cs @@ -24,17 +24,17 @@ namespace IRaCIS.Core.Domain.Models /// public Guid ReadingConsistentClinicalDataId { get; set; } - public string Path { get; set; } + public string Path { get; set; } = string.Empty; - public string FileName { get; set; } + public string FileName { get; set; } = string.Empty; public int Size { get; set; } = 0; /// /// 文件类型 /// - public string Type { get; set; } + public string Type { get; set; } = string.Empty; } diff --git a/IRaCIS.Core.Domain/Reading/ClinicalQuestion/SystemClinicalQuestion.cs b/IRaCIS.Core.Domain/Reading/ClinicalQuestion/SystemClinicalQuestion.cs index 7a8ddccb0..55ba1071f 100644 --- a/IRaCIS.Core.Domain/Reading/ClinicalQuestion/SystemClinicalQuestion.cs +++ b/IRaCIS.Core.Domain/Reading/ClinicalQuestion/SystemClinicalQuestion.cs @@ -64,7 +64,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 临床问题类型(分组,单选。) /// - public string ClinicalQuestionType { get; set; } + public string ClinicalQuestionType { get; set; } = string.Empty; /// /// 问题标识 diff --git a/IRaCIS.Core.Domain/Reading/ClinicalQuestion/SystemClinicalTableQuestion.cs b/IRaCIS.Core.Domain/Reading/ClinicalQuestion/SystemClinicalTableQuestion.cs index 96a1a0a24..7711509c5 100644 --- a/IRaCIS.Core.Domain/Reading/ClinicalQuestion/SystemClinicalTableQuestion.cs +++ b/IRaCIS.Core.Domain/Reading/ClinicalQuestion/SystemClinicalTableQuestion.cs @@ -55,12 +55,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 临床问题类型(分组,单选。) /// - public string ClinicalTableQuestionType { get; set; } - - /// + public string ClinicalTableQuestionType { get; set; } = string.Empty; + + /// /// 问题标识 /// - public ClinicalTableQuestionMark? ClinicalTableQuestionMarkEnum { get; set; } + public ClinicalTableQuestionMark? ClinicalTableQuestionMarkEnum { get; set; } /// /// 最大长度 @@ -75,12 +75,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 自定义选项 /// - public string TypeValue { get; set; } + public string TypeValue { get; set; } = string.Empty; - /// - /// 字典Code - /// - public string DictionaryCode { get; set; } = string.Empty; + /// + /// 字典Code + /// + public string DictionaryCode { get; set; } = string.Empty; /// /// 排序 diff --git a/IRaCIS.Core.Domain/Reading/ClinicalQuestion/TrialClinicalQuestion.cs b/IRaCIS.Core.Domain/Reading/ClinicalQuestion/TrialClinicalQuestion.cs index d01d044da..60a9faa97 100644 --- a/IRaCIS.Core.Domain/Reading/ClinicalQuestion/TrialClinicalQuestion.cs +++ b/IRaCIS.Core.Domain/Reading/ClinicalQuestion/TrialClinicalQuestion.cs @@ -64,7 +64,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 临床问题类型(分组,单选。) /// - public string ClinicalQuestionType { get; set; } + public string ClinicalQuestionType { get; set; } = string.Empty; /// /// 问题标识 diff --git a/IRaCIS.Core.Domain/Reading/ClinicalQuestion/TrialClinicalTableQuestion.cs b/IRaCIS.Core.Domain/Reading/ClinicalQuestion/TrialClinicalTableQuestion.cs index 20cf7ec6c..6be127746 100644 --- a/IRaCIS.Core.Domain/Reading/ClinicalQuestion/TrialClinicalTableQuestion.cs +++ b/IRaCIS.Core.Domain/Reading/ClinicalQuestion/TrialClinicalTableQuestion.cs @@ -56,12 +56,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 临床问题类型(分组,单选。) /// - public string ClinicalTableQuestionType { get; set; } - - /// + public string ClinicalTableQuestionType { get; set; } = string.Empty; + + /// /// 问题标识 /// - public ClinicalTableQuestionMark? ClinicalTableQuestionMarkEnum { get; set; } + public ClinicalTableQuestionMark? ClinicalTableQuestionMarkEnum { get; set; } /// /// 最大长度 @@ -76,12 +76,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 自定义选项 /// - public string TypeValue { get; set; } + public string TypeValue { get; set; } = string.Empty; - /// - /// 字典Code - /// - public string DictionaryCode { get; set; } = string.Empty; + /// + /// 字典Code + /// + public string DictionaryCode { get; set; } = string.Empty; /// /// 排序 diff --git a/IRaCIS.Core.Domain/Reading/ClinicalQuestionAnswer/ClinicalQuestionAnswer.cs b/IRaCIS.Core.Domain/Reading/ClinicalQuestionAnswer/ClinicalQuestionAnswer.cs index f08083760..45cd279f7 100644 --- a/IRaCIS.Core.Domain/Reading/ClinicalQuestionAnswer/ClinicalQuestionAnswer.cs +++ b/IRaCIS.Core.Domain/Reading/ClinicalQuestionAnswer/ClinicalQuestionAnswer.cs @@ -37,9 +37,9 @@ namespace IRaCIS.Core.Domain.Models /// public Guid QuestionId { get; set; } - public string Answer { get; set; } - - public Guid ClinicalDataTrialSetId { get; set; } + public string Answer { get; set; } = string.Empty; + + public Guid ClinicalDataTrialSetId { get; set; } } diff --git a/IRaCIS.Core.Domain/Reading/ClinicalQuestionAnswer/ClinicalTableAnswer.cs b/IRaCIS.Core.Domain/Reading/ClinicalQuestionAnswer/ClinicalTableAnswer.cs index 668a68260..e3fed2f34 100644 --- a/IRaCIS.Core.Domain/Reading/ClinicalQuestionAnswer/ClinicalTableAnswer.cs +++ b/IRaCIS.Core.Domain/Reading/ClinicalQuestionAnswer/ClinicalTableAnswer.cs @@ -30,7 +30,7 @@ namespace IRaCIS.Core.Domain.Models public Guid RowId { get; set; } - public string Answer { get; set; } + public string Answer { get; set; }=string.Empty; public Guid TableQuestionId { get; set; } diff --git a/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicalReviewDialog.cs b/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicalReviewDialog.cs index 0a3fc3c2f..bfa14c86f 100644 --- a/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicalReviewDialog.cs +++ b/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicalReviewDialog.cs @@ -70,12 +70,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 用户角色 /// - public string UserTypeShortName { get; set; } + public string UserTypeShortName { get; set; } = string.Empty; - /// - /// 医学审核对话关闭原因 - /// - public MedicalDialogClose? MedicalDialogCloseEnum { get; set; } + /// + /// 医学审核对话关闭原因 + /// + public MedicalDialogClose? MedicalDialogCloseEnum { get; set; } /// /// 用户角色枚举 diff --git a/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineQuestionAnswer.cs b/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineQuestionAnswer.cs index 1be26e10e..7502ef5af 100644 --- a/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineQuestionAnswer.cs +++ b/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineQuestionAnswer.cs @@ -33,8 +33,8 @@ namespace IRaCIS.Core.Domain.Models public Guid VisitTaskId { get; set; } - public string Answer { get; set; } - + public string Answer { get; set; } = string.Empty; + } diff --git a/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineSystemQuestion.cs b/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineSystemQuestion.cs index 47862f8a5..d3f46318f 100644 --- a/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineSystemQuestion.cs +++ b/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineSystemQuestion.cs @@ -32,22 +32,22 @@ namespace IRaCIS.Core.Domain.Models /// /// 类型 /// - public string Type { get; set; } + public string Type { get; set; } = string.Empty; - /// - /// 父问题触发 - /// - public string ParentTriggerValue { get; set; } = string.Empty; + /// + /// 父问题触发 + /// + public string ParentTriggerValue { get; set; } = string.Empty; /// /// 问题名称 /// - public string QuestionName { get; set; } + public string QuestionName { get; set; } = string.Empty; - /// - /// 语言类型 - /// - public LanguageType LanguageType { get; set; } = LanguageType.Chinese; + /// + /// 语言类型 + /// + public LanguageType LanguageType { get; set; } = LanguageType.Chinese; /// /// 是否是必须 @@ -69,14 +69,14 @@ namespace IRaCIS.Core.Domain.Models /// /// 类型值 /// - public string TypeValue { get; set; } - + public string TypeValue { get; set; } = string.Empty; - - /// + + + /// /// 是否启用 /// - public bool IsEnable { get; set; } + public bool IsEnable { get; set; } /// /// 任务类型 diff --git a/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineTrialQuestion.cs b/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineTrialQuestion.cs index 9a4f7557a..42388cf4a 100644 --- a/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineTrialQuestion.cs +++ b/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineTrialQuestion.cs @@ -25,35 +25,35 @@ namespace IRaCIS.Core.Domain.Models /// /// 类型 /// - public string Type { get; set; } - - /// + public string Type { get; set; } = string.Empty; + + /// /// 父问题触发值 /// - public string ParentTriggerValue { get; set; } = string.Empty; + public string ParentTriggerValue { get; set; } = string.Empty; /// /// 问题名称 /// - public string QuestionName { get; set; } + public string QuestionName { get; set; } = string.Empty; - /// - /// 语言类型 - /// - public LanguageType LanguageType { get; set; } = LanguageType.Chinese; + /// + /// 语言类型 + /// + public LanguageType LanguageType { get; set; } = LanguageType.Chinese; /// /// 类型值 /// - public string TypeValue { get; set; } - + public string TypeValue { get; set; } = string.Empty; - /// + + /// /// 项目ID /// - public Guid TrialId { get; set; } + public Guid TrialId { get; set; } /// /// 是否启用 diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterion/OrganInfo.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterion/OrganInfo.cs index e2fd617b9..e822ba3a9 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterion/OrganInfo.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterion/OrganInfo.cs @@ -63,13 +63,13 @@ namespace IRaCIS.Core.Domain.Models /// /// 备注 /// - public string Remark { get; set; } + public string Remark { get; set; } = string.Empty; - /// - /// 是否是淋巴结 - /// - public IsLymph IsLymphNodes { get; set; } + /// + /// 是否是淋巴结 + /// + public IsLymph IsLymphNodes { get; set; } /// /// 器官类型 diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingCriterionPage.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingCriterionPage.cs index 5638cec3e..db1e44a5a 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingCriterionPage.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingCriterionPage.cs @@ -29,12 +29,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 分页名称 /// - public string PageName { get; set; } - - /// + public string PageName { get; set; } = string.Empty; + + /// /// 是否启用 /// - public bool IsEnable { get; set; } + public bool IsEnable { get; set; } diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionSystem.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionSystem.cs index ec37a79d3..9010c0dca 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionSystem.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionSystem.cs @@ -21,7 +21,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 标准 /// - public string CriterionName { get; set; } + public string CriterionName { get; set; } = string.Empty; /// /// 是否启用 @@ -47,14 +47,14 @@ namespace IRaCIS.Core.Domain.Models /// /// 描述 /// - public string Description { get; set; } + public string Description { get; set; } = string.Empty; - /// - /// 标准类型 - /// - public CriterionType CriterionType { get; set; } + /// + /// 标准类型 + /// + public CriterionType CriterionType { get; set; } /// diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs index 32f145c3b..b3f066c19 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs @@ -50,7 +50,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 标准 /// - public string CriterionName { get; set; } + public string CriterionName { get; set; } = string.Empty; /// /// 是否启用 @@ -73,7 +73,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 描述 /// - public string Description { get; set; } + public string Description { get; set; } = string.Empty; /// /// 是否确认 diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterion/SystemCriterionDictionaryCode.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterion/SystemCriterionDictionaryCode.cs index 8698348b9..c7b533e91 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterion/SystemCriterionDictionaryCode.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterion/SystemCriterionDictionaryCode.cs @@ -21,11 +21,11 @@ namespace IRaCIS.Core.Domain.Models public Guid SystemCriterionId { get; set; } - public string Code { get; set; } - + public string Code { get; set; } = string.Empty; - - } + + + } } diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterion/TrialCriterionDictionaryCode.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterion/TrialCriterionDictionaryCode.cs index a1dac37b9..7710591a4 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterion/TrialCriterionDictionaryCode.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterion/TrialCriterionDictionaryCode.cs @@ -24,11 +24,11 @@ namespace IRaCIS.Core.Domain.Models public Guid TrialCriterionId { get; set; } - public string Code { get; set; } - + public string Code { get; set; } = string.Empty; - - } + + + } } diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingQuestionSystem.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingQuestionSystem.cs index bcfd1d304..dbc7e7926 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingQuestionSystem.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingQuestionSystem.cs @@ -99,22 +99,22 @@ namespace IRaCIS.Core.Domain.Models /// /// 类型 /// - public string Type { get; set; } + public string Type { get; set; } = string.Empty; - /// - /// 父问题触发 - /// - public string ParentTriggerValue { get; set; } + /// + /// 父问题触发 + /// + public string ParentTriggerValue { get; set; } = string.Empty; - /// - /// 问题名称 - /// - public string QuestionName { get; set; } + /// + /// 问题名称 + /// + public string QuestionName { get; set; } = string.Empty; - /// - /// 是否是必须 - /// - public IsRequired IsRequired { get; set; } + /// + /// 是否是必须 + /// + public IsRequired IsRequired { get; set; } /// /// 排序 @@ -129,12 +129,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 类型值 /// - public string TypeValue { get; set; } + public string TypeValue { get; set; } = string.Empty; - /// - /// 是否启用 - /// - public bool IsEnable { get; set; } + /// + /// 是否启用 + /// + public bool IsEnable { get; set; } /// @@ -145,12 +145,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 备注 /// - public string Remark { get; set; } + public string Remark { get; set; } = string.Empty; - /// - /// 关联ID - /// - public Guid? RelevanceId { get; set; } + /// + /// 关联ID + /// + public Guid? RelevanceId { get; set; } /// /// 关联Value @@ -160,12 +160,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 分组 /// - public string GroupName { get; set; } + public string GroupName { get; set; } = string.Empty; - /// - /// 图片数量 - /// - public int ImageCount { get; set; } = 1; + /// + /// 图片数量 + /// + public int ImageCount { get; set; } = 1; /// /// 是否显示 @@ -273,7 +273,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 文件类型 /// - public string? FileType { get; set; } + public string FileType { get; set; } = string.Empty; /// /// 分组分类 diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingQuestionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingQuestionTrial.cs index ba9ac4405..ace28be8d 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingQuestionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingQuestionTrial.cs @@ -286,12 +286,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 文件类型 /// - public string? FileType { get; set; } + public string FileType { get; set; } = string.Empty; - /// - /// 是否显示在Dicom阅片中 - /// - public bool IsShowInDicom { get; set; } = false; + /// + /// 是否显示在Dicom阅片中 + /// + public bool IsShowInDicom { get; set; } = false; /// diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingTableQuestionSystem.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingTableQuestionSystem.cs index 6de27d20b..56d6660a8 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingTableQuestionSystem.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingTableQuestionSystem.cs @@ -66,7 +66,7 @@ namespace IRaCIS.Core.Domain.Models /// public Guid ReadingQuestionId { get; set; } - public string Type { get; set; } + public string Type { get; set; } = string.Empty; public Guid? ParentId { get; set; } @@ -74,17 +74,17 @@ namespace IRaCIS.Core.Domain.Models /// ///父问题触发值 /// - public string ParentTriggerValue { get; set; } - - /// + public string ParentTriggerValue { get; set; } = string.Empty; + + /// /// 问题名称 /// - public string QuestionName { get; set; } - - /// + public string QuestionName { get; set; } = string.Empty; + + /// /// IsRequired /// - public IsRequired IsRequired { get; set; } + public IsRequired IsRequired { get; set; } /// /// 排序号 @@ -94,29 +94,29 @@ namespace IRaCIS.Core.Domain.Models /// /// 值 /// - public string TypeValue { get; set; } - - /// + public string TypeValue { get; set; } = string.Empty; + + /// /// 是否启用 /// - public bool IsEnable { get; set; } + public bool IsEnable { get; set; } - public string Remark { get; set; } - - /// + public string Remark { get; set; } = string.Empty; + + /// /// 显示父问题 /// - public Guid? RelevanceId { get; set; } + public Guid? RelevanceId { get; set; } /// /// 显示父问题的值 /// - public string RelevanceValue { get; set; } - - /// + public string RelevanceValue { get; set; } = string.Empty; + + /// /// 是否显示 /// - public int ShowQuestion { get; set; } + public int ShowQuestion { get; set; } /// /// 最大问题数 @@ -126,18 +126,18 @@ namespace IRaCIS.Core.Domain.Models /// /// 数据表名称 /// - public string DataTableName { get; set; } - - /// + public string DataTableName { get; set; } = string.Empty; + + /// /// 数据列 /// - public string DataTableColumn { get; set; } + public string DataTableColumn { get; set; } = string.Empty; - /// - /// 关联父问题 - /// - public Guid? DependParentId { get; set; } + /// + /// 关联父问题 + /// + public Guid? DependParentId { get; set; } /// /// 是否关联 @@ -162,13 +162,13 @@ namespace IRaCIS.Core.Domain.Models /// /// 字典code /// - public string DictionaryCode { get; set; } + public string DictionaryCode { get; set; } = string.Empty; - /// - /// 数值类型 - /// - public ValueOfType? ValueType { get; set; } + /// + /// 数值类型 + /// + public ValueOfType? ValueType { get; set; } /// /// 单位 @@ -198,7 +198,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 文件类型 /// - public string? FileType { get; set; } + public string? FileType { get; set; } = string.Empty; /// /// 问题分类 diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingTableQuestionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingTableQuestionTrial.cs index c10894d8b..a4be6e8ff 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingTableQuestionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingTableQuestionTrial.cs @@ -126,9 +126,9 @@ namespace IRaCIS.Core.Domain.Models public string DataTableName { get; set; } = string.Empty; - public string DataTableColumn { get; set; } + public string DataTableColumn { get; set; } = string.Empty; - public TableQuestionType? TableQuestionType { get; set; } + public TableQuestionType? TableQuestionType { get; set; } public Guid? DependParentId { get; set; } @@ -196,7 +196,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 文件类型 /// - public string? FileType { get; set; } + public string FileType { get; set; } = string.Empty; /// /// 问题分类 diff --git a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingCustomTag.cs b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingCustomTag.cs index 1b056bb37..81905c59f 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingCustomTag.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingCustomTag.cs @@ -28,8 +28,8 @@ namespace IRaCIS.Core.Domain.Models public Guid? InstanceId { get; set; } - public string MeasureData { get; set; } - + public string MeasureData { get; set; } = string.Empty; + public int? NumberOfFrames { get; set; } } diff --git a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingGlobalTaskInfo.cs b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingGlobalTaskInfo.cs index c5b164d7c..38818aa3c 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingGlobalTaskInfo.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingGlobalTaskInfo.cs @@ -46,10 +46,10 @@ namespace IRaCIS.Core.Domain.Models /// 问题答案 /// - public string Answer { get; set; } + public string Answer { get; set; } = string.Empty; - - public Guid TrialId { get; set; } + + public Guid TrialId { get; set; } /// /// 全局答案类型 diff --git a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingOncologyTaskInfo.cs b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingOncologyTaskInfo.cs index ccb6efcde..1d4886e61 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingOncologyTaskInfo.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingOncologyTaskInfo.cs @@ -38,18 +38,18 @@ namespace IRaCIS.Core.Domain.Models /// /// 结果 /// - public string EvaluationResult { get; set; } - - /// + public string EvaluationResult { get; set; } = string.Empty; + + /// /// 原因 /// - public string EvaluationReason { get; set; } + public string EvaluationReason { get; set; } = string.Empty; - - /// + + /// /// 项目Id /// - public Guid TrialId { get; set; } + public Guid TrialId { get; set; } /// /// 受试者Id diff --git a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs index 8338e1031..b54add574 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs @@ -68,9 +68,9 @@ namespace IRaCIS.Core.Domain.Models public Guid? OtherStudyId { get; set; } - public string? OtherMarkTool { get; set; } + public string OtherMarkTool { get; set; } = string.Empty; - public string? OtherPicturePath { get; set; } + public string OtherPicturePath { get; set; } = string.Empty; public int? OtherNumberOfFrames { get; set; } @@ -159,7 +159,7 @@ namespace IRaCIS.Core.Domain.Models - public string? OtherMeasureData { get; set; } = string.Empty; + public string OtherMeasureData { get; set; } = string.Empty; //病灶编号 diff --git a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableQuestionAnswer.cs b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableQuestionAnswer.cs index b524e02de..bbd3c4918 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableQuestionAnswer.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableQuestionAnswer.cs @@ -55,10 +55,10 @@ namespace IRaCIS.Core.Domain.Models public decimal RowIndex { get; set; } - public string Answer { get; set; } - - - public Guid RowId { get; set; } + public string Answer { get; set; } = string.Empty; + + + public Guid RowId { get; set; } diff --git a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTaskQuestionAnswer.cs b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTaskQuestionAnswer.cs index d96db2391..b9ca5c537 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTaskQuestionAnswer.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTaskQuestionAnswer.cs @@ -43,18 +43,18 @@ namespace IRaCIS.Core.Domain.Models /// /// 答案 /// - public string Answer { get; set; } + public string Answer { get; set; } = string.Empty; /// /// 全局阅片修改的答案 /// - public string GlobalChangeAnswer { get; set; } + public string GlobalChangeAnswer { get; set; } = string.Empty; - /// - /// 全局阅片是否修改 - /// - public bool IsGlobalChange { get; set; } = false; + /// + /// 全局阅片是否修改 + /// + public bool IsGlobalChange { get; set; } = false; diff --git a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTaskQuestionMark.cs b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTaskQuestionMark.cs index 9971310d7..8781d16a5 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTaskQuestionMark.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTaskQuestionMark.cs @@ -52,7 +52,7 @@ namespace IRaCIS.Core.Domain.Models public QuestionType? QuestionType { get; set; } - public string? OrderMarkName { get; set; } = string.Empty; + public string OrderMarkName { get; set; } = string.Empty; public Guid? OtherInstanceId { get; set; } @@ -60,12 +60,12 @@ namespace IRaCIS.Core.Domain.Models public Guid? OtherStudyId { get; set; } - public string? OtherMarkTool { get; set; } + public string OtherMarkTool { get; set; } = string.Empty; - public string? OtherPicturePath { get; set; } + public string OtherPicturePath { get; set; } = string.Empty; public int? OtherNumberOfFrames { get; set; } - public string? OtherMeasureData { get; set; } = string.Empty; + public string OtherMeasureData { get; set; } = string.Empty; } diff --git a/IRaCIS.Core.Domain/Reading/ReadingPeriod/ReadModule.cs b/IRaCIS.Core.Domain/Reading/ReadingPeriod/ReadModule.cs index 5be3f9597..8084a6318 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingPeriod/ReadModule.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingPeriod/ReadModule.cs @@ -70,12 +70,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 模块名称 /// - public string ModuleName { get; set; } + public string ModuleName { get; set; } = string.Empty; - /// - /// 是否加急 - /// - public bool? IsUrgent { get; set; } + /// + /// 是否加急 + /// + public bool? IsUrgent { get; set; } public Guid SubjectVisitId { get; set; } diff --git a/IRaCIS.Core.Domain/Reading/ReadingPeriod/ReadingPeriodSet.cs b/IRaCIS.Core.Domain/Reading/ReadingPeriod/ReadingPeriodSet.cs index 7317239db..f4d2ca6b1 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingPeriod/ReadingPeriodSet.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingPeriod/ReadingPeriodSet.cs @@ -38,12 +38,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 阅片期名称 /// - public string ReadingPeriodName { get; set; } + public string ReadingPeriodName { get; set; } = string.Empty; - /// - /// 阅片范围 - /// - public ReadingScopeEnum ReadingScope { get; set; } + /// + /// 阅片范围 + /// + public ReadingScopeEnum ReadingScope { get; set; } /// /// 截止日期 diff --git a/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs b/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs index 40c68b430..642c03d1f 100644 --- a/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs +++ b/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs @@ -44,9 +44,9 @@ namespace IRaCIS.Core.Domain.Models public bool MetaKey { get; set; } = false; - public string Text { get; set; } + public string Text { get; set; } = string.Empty; - public string Code { get; set; } = string.Empty; + public string Code { get; set; } = string.Empty; } diff --git a/IRaCIS.Core.Domain/Reading/ShortcutKey/UserWLTemplate.cs b/IRaCIS.Core.Domain/Reading/ShortcutKey/UserWLTemplate.cs index 88fc6f7f1..f5198f72f 100644 --- a/IRaCIS.Core.Domain/Reading/ShortcutKey/UserWLTemplate.cs +++ b/IRaCIS.Core.Domain/Reading/ShortcutKey/UserWLTemplate.cs @@ -19,10 +19,10 @@ namespace IRaCIS.Core.Domain.Models #endregion - public string TemplateName { get; set; } - + public string TemplateName { get; set; } = string.Empty; - public Guid UserId { get; set; } + + public Guid UserId { get; set; } diff --git a/IRaCIS.Core.Domain/Trial/DataInspection.cs b/IRaCIS.Core.Domain/Trial/DataInspection.cs index 749b10c77..e37cb1b85 100644 --- a/IRaCIS.Core.Domain/Trial/DataInspection.cs +++ b/IRaCIS.Core.Domain/Trial/DataInspection.cs @@ -109,10 +109,10 @@ namespace IRaCIS.Core.Domain.Models public Guid? ObjectRelationParentId3 { get; set; } - public string EntityName { get; set; } + public string EntityName { get; set; } = string.Empty; - public Guid? TrialReadingCriterionId { get; set; } + public Guid? TrialReadingCriterionId { get; set; } public Guid? DoctorUserId { get; set; } diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs index 37c384ca9..f80e1657b 100644 --- a/IRaCIS.Core.Domain/Trial/Trial.cs +++ b/IRaCIS.Core.Domain/Trial/Trial.cs @@ -259,16 +259,16 @@ namespace IRaCIS.Core.Domain.Models public bool IsPDProgressView { get; set; } //研究方案号 - public string ResearchProgramNo { get; set; } + public string ResearchProgramNo { get; set; } = string.Empty; //实验名称 - public string ExperimentName { get; set; } + public string ExperimentName { get; set; } = string.Empty; //主研单位 - public string MainResearchUnit { get; set; } + public string MainResearchUnit { get; set; } = string.Empty; // 负责人PI - public string HeadPI { get; set; } + public string HeadPI { get; set; } = string.Empty; public bool IsUrgent { get; set; } @@ -277,7 +277,6 @@ namespace IRaCIS.Core.Domain.Models /// time public TrialType TrialType { get; set; } - //public string TempCode { get; set; } public int PlanSiteCount { get; set; } diff --git a/IRaCIS.Core.Domain/Trial/TrialBodyPart.cs b/IRaCIS.Core.Domain/Trial/TrialBodyPart.cs index 67d9fadb6..421b4b200 100644 --- a/IRaCIS.Core.Domain/Trial/TrialBodyPart.cs +++ b/IRaCIS.Core.Domain/Trial/TrialBodyPart.cs @@ -23,17 +23,17 @@ namespace IRaCIS.Core.Domain.Models #endregion - public string Code { get; set; } - + public string Code { get; set; } = string.Empty; - public string Name { get; set; } - - public string NameCN { get; set; } + public string Name { get; set; } = string.Empty; - - public Guid TrialId { get; set; } + public string NameCN { get; set; } = string.Empty; + + + + public Guid TrialId { get; set; } public bool IsHandAdd { get; set; } diff --git a/IRaCIS.Core.Domain/Trial/TrialSign.cs b/IRaCIS.Core.Domain/Trial/TrialSign.cs index eead7343c..c5ec2ce7a 100644 --- a/IRaCIS.Core.Domain/Trial/TrialSign.cs +++ b/IRaCIS.Core.Domain/Trial/TrialSign.cs @@ -27,11 +27,11 @@ namespace IRaCIS.Core.Domain.Models //关联基础数据 public Guid? SignCodeId { get; set; } - public string SignCode { get; set; } + public string SignCode { get; set; } = string.Empty; - public string SignText { get; set; } + public string SignText { get; set; } = string.Empty; - public bool IsCompleted { get; set; } + public bool IsCompleted { get; set; } } diff --git a/IRaCIS.Core.Domain/TrialSiteUser/TrialAudit.cs b/IRaCIS.Core.Domain/TrialSiteUser/TrialAudit.cs index cfa84c0a4..4bc2dbd98 100644 --- a/IRaCIS.Core.Domain/TrialSiteUser/TrialAudit.cs +++ b/IRaCIS.Core.Domain/TrialSiteUser/TrialAudit.cs @@ -22,12 +22,12 @@ namespace IRaCIS.Core.Domain.Models public Guid OptUserId { get; set; } - public string OptUser { get; set; } + public string OptUser { get; set; } = string.Empty; public DateTime OptTime { get; set; }=DateTime.Now; - public string Note { get; set; } + public string Note { get; set; } = string.Empty; - public string Detail { get; set; } + public string Detail { get; set; } = string.Empty; } diff --git a/IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs b/IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs index 0ad444f3c..034f3c020 100644 --- a/IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs +++ b/IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs @@ -30,15 +30,15 @@ namespace IRaCIS.Core.Domain.Models /// - public string Email { get; set; } - - - public string FirstName { get; set; } - - public string LastName { get; set; } + public string Email { get; set; } = String.Empty; - public string OrganizationName { get; set; }=String.Empty; + public string FirstName { get; set; } = String.Empty; + + public string LastName { get; set; } = String.Empty; + + + public string OrganizationName { get; set; }=String.Empty; public bool IsSystemUser{ get; set; } @@ -57,12 +57,12 @@ namespace IRaCIS.Core.Domain.Models public DateTime? ConfirmTime { get; set; } - public string RejectReason { get; set; } + public string RejectReason { get; set; } = String.Empty; - /// - /// 邀请状态 - /// - [Required] + /// + /// 邀请状态 + /// + [Required] public TrialExternalUserStateEnum InviteState { get; set; } = TrialExternalUserStateEnum.WaitSent; } diff --git a/IRaCIS.Core.Domain/TrialSiteUser/TrialSiteDicomAE.cs b/IRaCIS.Core.Domain/TrialSiteUser/TrialSiteDicomAE.cs index 36b86415f..ee29aeb28 100644 --- a/IRaCIS.Core.Domain/TrialSiteUser/TrialSiteDicomAE.cs +++ b/IRaCIS.Core.Domain/TrialSiteUser/TrialSiteDicomAE.cs @@ -28,19 +28,19 @@ namespace IRaCIS.Core.Domain.Models public Guid TrialSiteId { get; set; } - public string CallingAE { get; set; } - - - public string IP { get; set; } - - - public string Port { get; set; } - - - public string Description { get; set; } + public string CallingAE { get; set; } = string.Empty; - - } + public string IP { get; set; } = string.Empty; + + + public string Port { get; set; } = string.Empty; + + + public string Description { get; set; } = string.Empty; + + + + } } diff --git a/IRaCIS.Core.Domain/TrialSiteUser/TrialUserPreparation .cs b/IRaCIS.Core.Domain/TrialSiteUser/TrialUserPreparation .cs index e1fb8ec88..1b97fe6c8 100644 --- a/IRaCIS.Core.Domain/TrialSiteUser/TrialUserPreparation .cs +++ b/IRaCIS.Core.Domain/TrialSiteUser/TrialUserPreparation .cs @@ -33,10 +33,10 @@ namespace IRaCIS.Core.Domain.Models public DateTime? JoinTime { get; set; } - public string RejectReason { get; set; } + public string RejectReason { get; set; } = string.Empty; - } + } } diff --git a/IRaCIS.Core.Domain/Visit/Subject.cs b/IRaCIS.Core.Domain/Visit/Subject.cs index 4d69a7de6..a0b5daf26 100644 --- a/IRaCIS.Core.Domain/Visit/Subject.cs +++ b/IRaCIS.Core.Domain/Visit/Subject.cs @@ -69,7 +69,7 @@ namespace IRaCIS.Core.Domain.Models public Guid TrialSiteId { get; set; } - public string Code { get; set; } + public string Code { get; set; } = string.Empty; public string FirstName { get; set; } = string.Empty; public string LastName { get; set; } = string.Empty; public int? Age { get; set; } diff --git a/IRaCIS.Core.Domain/Visit/SubjectCanceDoctor.cs b/IRaCIS.Core.Domain/Visit/SubjectCanceDoctor.cs index 47744b41e..9e44aefd0 100644 --- a/IRaCIS.Core.Domain/Visit/SubjectCanceDoctor.cs +++ b/IRaCIS.Core.Domain/Visit/SubjectCanceDoctor.cs @@ -24,7 +24,7 @@ namespace IRaCIS.Core.Domain.Models public Guid SubjectId { get; set; } - public string Note { get; set; } + public string Note { get; set; } = string.Empty; public Guid? TrialReadingCriterionId { get; set; } diff --git a/IRaCIS.Core.Domain/Visit/SubjectVisit.cs b/IRaCIS.Core.Domain/Visit/SubjectVisit.cs index eaa1465a8..44e477ee1 100644 --- a/IRaCIS.Core.Domain/Visit/SubjectVisit.cs +++ b/IRaCIS.Core.Domain/Visit/SubjectVisit.cs @@ -24,10 +24,6 @@ namespace IRaCIS.Core.Domain.Models - [JsonIgnore] - [ForeignKey("ClinicalDataSignUserId")] - public User ClinicalDataSignUser { get; set; } - [ForeignKey("ForwardUserId")] public User ForwardUser { get; set; } @@ -170,7 +166,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 通过原因 /// - public string ManualPassReason { get; set; } + public string ManualPassReason { get; set; } = string.Empty; public bool IsUrgent { get; set; } @@ -220,7 +216,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 关闭一致性质疑原因 /// - public string CloseTheReason { get; set; } + public string CloseTheReason { get; set; } = string.Empty; public Guid? SubmitUserId { get; set; } diff --git a/IRaCIS.Core.Domain/Visit/VisitPlanInfluenceStudy.cs b/IRaCIS.Core.Domain/Visit/VisitPlanInfluenceStudy.cs index b35e2c1f6..d0173db02 100644 --- a/IRaCIS.Core.Domain/Visit/VisitPlanInfluenceStudy.cs +++ b/IRaCIS.Core.Domain/Visit/VisitPlanInfluenceStudy.cs @@ -33,15 +33,15 @@ namespace IRaCIS.Core.Domain.Models public bool IsDicomStudy { get; set; } - public string Modality { get; set; } + public string Modality { get; set; } = string.Empty; public bool IsOverWindowNowNotOverWindow { get; set; } public DateTime? StudyTime { get; set; } - public string HistoryWindow { get; set; } + public string HistoryWindow { get; set; } = string.Empty; - public string NowWindow { get; set; } + public string NowWindow { get; set; } = string.Empty; public Guid VisitPlanInfluenceStatId { get; set; } diff --git a/IRaCIS.Core.Domain/_Config/_AppSettings.cs b/IRaCIS.Core.Domain/_Config/_AppSettings.cs index ef84fe0c5..2bca1cdfe 100644 --- a/IRaCIS.Core.Domain/_Config/_AppSettings.cs +++ b/IRaCIS.Core.Domain/_Config/_AppSettings.cs @@ -53,27 +53,27 @@ namespace IRaCIS.Core.Domain.Share { public int Port { get; set; } - public string Host { get; set; } + public string Host { get; set; } = string.Empty; - public string FromEmail { get; set; } + public string FromEmail { get; set; } = string.Empty; - public string FromName { get; set; } + public string FromName { get; set; } = string.Empty; - public string AuthorizationCode { get; set; } + public string AuthorizationCode { get; set; } = string.Empty; - public string SiteUrl { get; set; } + public string SiteUrl { get; set; } = string.Empty; - public string OrganizationName { get; set; } - public string OrganizationNameCN { get; set; } + public string OrganizationName { get; set; } = string.Empty; + public string OrganizationNameCN { get; set; } = string.Empty; - public string CompanyName { get; set; } + public string CompanyName { get; set; } = string.Empty; - public string CompanyNameCN { get; set; } + public string CompanyNameCN { get; set; } = string.Empty; - public string CompanyShortName { get; set; } + public string CompanyShortName { get; set; } = string.Empty; - public string CompanyShortNameCN { get; set; } + public string CompanyShortNameCN { get; set; } = string.Empty; } @@ -82,7 +82,7 @@ namespace IRaCIS.Core.Domain.Share { public int Port { get; set; } - public string IP { get; set; } + public string IP { get; set; }=string.Empty; } @@ -94,38 +94,27 @@ namespace IRaCIS.Core.Domain.Share public List ApiPathList { get; set; } } + public class IRaCISBasicConfigOption + { + public string DoctorCodePrefix { get; set; } + public string UserCodePrefix { get; set; } + public string QCChallengeCodePrefix { get; set; } + public string DicomStudyCodePrefix { get; set; } + public string TaskStudyCodePrefix { get; set; } + public string NoneDicomStudyCodePrefix { get; set; } + public int ImageShareExpireDays { get; set; } + public string SystemSiteCodePrefix { get; set; } + public string BlindTaskPrefix { get; set; } + public string DefaultPassword { get; set; } + } /// /// 项目基础配置规则 /// - public class AppSettings + public static class AppSettings { - public static string DoctorCodePrefix { get; set; } - public static string UserCodePrefix { get; set; } - - - public static string QCChallengeCodePrefix { get; set; } - - public static string DicomStudyCodePrefix { get; set; } - - public static string TaskStudyCodePrefix { get; set; } - - public static string NoneDicomStudyCodePrefix { get; set; } - - - - public static int ImageShareExpireDays { get; set; } = 7; - - - public static string SystemSiteCodePrefix { get; set; } - - public static string BlindTaskPrefix { get; set; } - - /// - /// 用户默认密码 - /// - public static readonly string DefaultPassword = "123456"; - + + public static IRaCISBasicConfigOption IRaCISBasicConfig { get; set; } static AppSettings() { @@ -137,19 +126,11 @@ namespace IRaCIS.Core.Domain.Share }) .Build(); - DoctorCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("DoctorCodePrefix"); - UserCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("UserCodePrefix"); - QCChallengeCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("QCChallengeCodePrefix"); - NoneDicomStudyCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("NoneDicomStudyCodePrefix"); - DicomStudyCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("DicomStudyCodePrefix"); - DefaultPassword = configuration.GetSection("IRaCISBasicConfig").GetValue("DefaultPassword"); - SystemSiteCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("SystemSiteCodePrefix"); - TaskStudyCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("TaskStudyCodePrefix"); - - ImageShareExpireDays = configuration.GetSection("IRaCISBasicConfig").GetValue("ImageShareExpireDays"); - - BlindTaskPrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("BlindTaskPrefix"); + // 手动绑定配置 + var appSettings = new IRaCISBasicConfigOption(); + configuration.GetSection("IRaCISBasicConfig").Bind(appSettings); + IRaCISBasicConfig = appSettings; } @@ -159,40 +140,33 @@ namespace IRaCIS.Core.Domain.Share switch (typeStr) { case nameof(Doctor): - - return DoctorCodePrefix + codeInt.ToString("D4"); + return IRaCISBasicConfig.DoctorCodePrefix + codeInt.ToString("D4"); case nameof(User): - - return UserCodePrefix + codeInt.ToString("D4"); + return IRaCISBasicConfig.UserCodePrefix + codeInt.ToString("D4"); case nameof(QCChallenge): - - return QCChallengeCodePrefix + codeInt.ToString("D5"); + return IRaCISBasicConfig.QCChallengeCodePrefix + codeInt.ToString("D5"); case nameof(NoneDicomStudy): - - return NoneDicomStudyCodePrefix + codeInt.ToString("D5"); + return IRaCISBasicConfig.NoneDicomStudyCodePrefix + codeInt.ToString("D5"); case nameof(DicomStudy): - - return DicomStudyCodePrefix + codeInt.ToString("D5"); + return IRaCISBasicConfig.DicomStudyCodePrefix + codeInt.ToString("D5"); case nameof(TaskStudy): - - return TaskStudyCodePrefix + codeInt.ToString("D5"); + return IRaCISBasicConfig.TaskStudyCodePrefix + codeInt.ToString("D5"); case nameof(VisitTask): - return "W" + codeInt.ToString("D5"); case nameof(Site): - - return SystemSiteCodePrefix + codeInt.ToString("D4"); + return IRaCISBasicConfig.SystemSiteCodePrefix + codeInt.ToString("D4"); default: return string.Empty; } + } } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 933e3990a..d6673ef2e 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -65,7 +65,24 @@ namespace IRaCIS.Core.Infra.EFCore protected override void OnModelCreating(ModelBuilder modelBuilder) { + #region pgsql codefirst 配置 暂时屏蔽 + //if (base.Database.IsNpgsql()) + //{ + // modelBuilder.HasPostgresExtension("uuid-ossp"); + // //保证pgsql 生成的时间默认为timestamp 而不是 timestamp with time zone + // foreach (var entityType in modelBuilder.Model.GetEntityTypes()) + // { + // foreach (var property in entityType.GetProperties()) + // { + // if (property.ClrType == typeof(DateTime) || property.ClrType == typeof(DateTime?)) + // { + // property.SetColumnType("timestamp without time zone"); + // } + // } + // } + //} + #endregion //遍历实体模型手动配置 var typesToRegister = Assembly.GetExecutingAssembly().GetTypes().Where(q => q.GetInterface(typeof(IEntityTypeConfiguration<>).FullName) != null); diff --git a/IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj b/IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj index 0f0f66b72..3d99c723f 100644 --- a/IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj +++ b/IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj @@ -19,7 +19,7 @@ - + diff --git a/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs b/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs index b1a694174..6f49c3b84 100644 --- a/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs +++ b/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs @@ -52,6 +52,12 @@ public class AuditEntityInterceptor(IUserInfo _userInfo, ILogger (u.State == EntityState.Modified || u.State == EntityState.Added)) .Where(x => !typeof(DataInspection).IsAssignableFrom(x.Entity.GetType())).ToList()) { + // 检查属性是否为string类型,并且值为null + foreach (var property in entry.Properties.Where(t=>t.Metadata.ClrType==typeof(string) && t.CurrentValue == null)) + { + property.CurrentValue = string.Empty; + } + switch (entry.State) { diff --git a/IRaCIS.Core.Test/AutoTemplatel.ps1 b/IRaCIS.Core.Test/AutoTemplatel.ps1 new file mode 100644 index 000000000..caeeefd0a --- /dev/null +++ b/IRaCIS.Core.Test/AutoTemplatel.ps1 @@ -0,0 +1,29 @@ + + +# б Scaffold +param ( + [string[]]$Tables +) + + +# б +$tablesForScaffold = "" +foreach ($table in $Tables) { + $tablesForScaffold += "-t $table " +} + +$tablesForRun = $Tables -join " " + + +Write-Host "ִ Scaffold-DbContext..." + +#dotnet ef dbcontext scaffold "Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true" Microsoft.EntityFrameworkCore.SqlServer -p IRaCIS.Core.Test -d -o GenerateFolder -c "TempContext" $tablesForScaffold +$scaffoldCommand = "dotnet ef dbcontext scaffold `"Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true`" Microsoft.EntityFrameworkCore.SqlServer -p IRaCIS.Core.Test -d -o GenerateContextModelFolder -c `"TempContext`" $tablesForScaffold" +Invoke-Expression $scaffoldCommand + + +Write-Host "ִ dotnet run..." +#dotnet run --project IRaCIS.Core.Test -- $tablesForRun +# ʹ Invoke-Expression ֱִйõ +$runCommand = "dotnet run --project IRaCIS.Core.Test -- $tablesForRun" +Invoke-Expression $runCommand \ No newline at end of file diff --git a/IRaCIS.Core.Test/CodeFirstTest/PGContext.cs b/IRaCIS.Core.Test/CodeFirstTest/PGContext.cs new file mode 100644 index 000000000..73dffe521 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/PGContext.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; + +namespace IRaCIS.Core.Test.PGModelFolder; + +public partial class PGContext : DbContext +{ + public PGContext() + { + } + + public PGContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet Subjects { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + => optionsBuilder.UseNpgsql("Host=106.14.89.110;Port=5432;Username=sa;Password=pgsql_pwd;Database=Test6_PG"); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + + if (base.Database.IsNpgsql()) + { + modelBuilder.HasPostgresExtension("uuid-ossp"); + + //保证pgsql 生成的时间默认为timestamp 而不是 timestamp with time zone + foreach (var entityType in modelBuilder.Model.GetEntityTypes()) + { + foreach (var property in entityType.GetProperties()) + { + if (property.ClrType == typeof(DateTime) || property.ClrType == typeof(DateTime?)) + { + property.SetColumnType("timestamp without time zone"); + } + } + } + } + + + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/Subject.cs b/IRaCIS.Core.Test/CodeFirstTest/Subject.cs new file mode 100644 index 000000000..8ac7a14d8 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/Subject.cs @@ -0,0 +1,84 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace IRaCIS.Core.Test.PGModelFolder; + +public partial class Subject +{ + public Guid Id { get; set; } + + [MaxLength(200)] + public string LastName { get; set; } + + public int StudyCount { get; set; } + + public DateTime? DeletedTime { get; set; } + + public DateTime? BirthDate { get; set; } + + public DateTime? FirstGiveMedicineTime { get; set; } + + public bool IsMissingImages { get; set; } + + public string MedicalNo { get; set; } + [MaxLength(200)] + public string ShortName { get; set; } + + public string Reason { get; set; } + + public Guid? FinalSubjectVisitId { get; set; } + + public string Height { get; set; } + + [Comment("subject 编号")] + [MaxLength(100)] + public string Code { get; set; } + + public int? Age { get; set; } + + public string Modalities { get; set; } + + public DateTime? SignDate { get; set; } + + public DateTime UpdateTime { get; set; } + + public Guid CreateUserId { get; set; } + + public string Sex { get; set; } + + public Guid? LatestSubjectVisitId { get; set; } + + public bool IsEnrollmentConfirm { get; set; } + + public Guid? DeleteUserId { get; set; } + + public string Weight { get; set; } + + public DateTime? OutEnrollmentTime { get; set; } + + public DateTime CreateTime { get; set; } + + public string FirstName { get; set; } + + public bool IsUrgent { get; set; } + + public long Status { get; set; } + + public DateTime? VisitOverTime { get; set; } + + public Guid UpdateUserId { get; set; } + + public bool IsDeleted { get; set; } + + public Guid TrialId { get; set; } + + public bool IsEnrollment { get; set; } + + public bool IsAssignDoctorUser { get; set; } + + public bool IsReReadingOrBackInfluenceAnalysis { get; set; } + + public Guid TrialSiteId { get; set; } +} diff --git a/IRaCIS.Core.Test/CodeTemplates/EFCore/DbContext.t4 b/IRaCIS.Core.Test/CodeTemplates/EFCore/DbContext.t4 new file mode 100644 index 000000000..1351902b0 --- /dev/null +++ b/IRaCIS.Core.Test/CodeTemplates/EFCore/DbContext.t4 @@ -0,0 +1,355 @@ +<#@ template hostSpecific="true" #> +<#@ assembly name="Microsoft.EntityFrameworkCore" #> +<#@ assembly name="Microsoft.EntityFrameworkCore.Design" #> +<#@ assembly name="Microsoft.EntityFrameworkCore.Relational" #> +<#@ assembly name="Microsoft.Extensions.DependencyInjection.Abstractions" #> +<#@ parameter name="Model" type="Microsoft.EntityFrameworkCore.Metadata.IModel" #> +<#@ parameter name="Options" type="Microsoft.EntityFrameworkCore.Scaffolding.ModelCodeGenerationOptions" #> +<#@ parameter name="NamespaceHint" type="System.String" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="Microsoft.EntityFrameworkCore" #> +<#@ import namespace="Microsoft.EntityFrameworkCore.Design" #> +<#@ import namespace="Microsoft.EntityFrameworkCore.Infrastructure" #> +<#@ import namespace="Microsoft.EntityFrameworkCore.Scaffolding" #> +<#@ import namespace="Microsoft.Extensions.DependencyInjection" #> +<# + if (!ProductInfo.GetVersion().StartsWith("8.0")) + { + Warning("Your templates were created using an older version of Entity Framework. Additional features and bug fixes may be available. See https://aka.ms/efcore-docs-updating-templates for more information."); + } + + var services = (IServiceProvider)Host; + var providerCode = services.GetRequiredService(); + var annotationCodeGenerator = services.GetRequiredService(); + var code = services.GetRequiredService(); + + var usings = new List + { + "System", + "System.Collections.Generic", + "Microsoft.EntityFrameworkCore" + }; + + if (NamespaceHint != Options.ModelNamespace + && !string.IsNullOrEmpty(Options.ModelNamespace)) + { + usings.Add(Options.ModelNamespace); + } + + if (!string.IsNullOrEmpty(NamespaceHint)) + { +#> +namespace <#= NamespaceHint #>; + +<# + } +#> +public partial class <#= Options.ContextName #> : DbContext +{ +<# + if (!Options.SuppressOnConfiguring) + { +#> + public <#= Options.ContextName #>() + { + } + +<# + } +#> + public <#= Options.ContextName #>(DbContextOptions<<#= Options.ContextName #>> options) + : base(options) + { + } + +<# + foreach (var entityType in Model.GetEntityTypes().Where(e => !e.IsSimpleManyToManyJoinEntityType())) + { +#> + public virtual DbSet<<#= entityType.Name #>> <#= entityType.GetDbSetName() #> { get; set; } + +<# + } + + if (!Options.SuppressOnConfiguring) + { +#> + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) +<# + if (!Options.SuppressConnectionStringWarning) + { +#> +#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263. +<# + } + + var useProviderCall = providerCode.GenerateUseProvider(Options.ConnectionString); + usings.AddRange(useProviderCall.GetRequiredUsings()); +#> + => optionsBuilder<#= code.Fragment(useProviderCall, indent: 3) #>; + +<# + } + +#> + protected override void OnModelCreating(ModelBuilder modelBuilder) + { +<# + var anyConfiguration = false; + + var modelFluentApiCalls = Model.GetFluentApiCalls(annotationCodeGenerator); + if (modelFluentApiCalls != null) + { + usings.AddRange(modelFluentApiCalls.GetRequiredUsings()); +#> + modelBuilder<#= code.Fragment(modelFluentApiCalls, indent: 3) #>; +<# + anyConfiguration = true; + } + + StringBuilder mainEnvironment; + foreach (var entityType in Model.GetEntityTypes().Where(e => !e.IsSimpleManyToManyJoinEntityType())) + { + // Save all previously generated code, and start generating into a new temporary environment + mainEnvironment = GenerationEnvironment; + GenerationEnvironment = new StringBuilder(); + + if (anyConfiguration) + { + WriteLine(""); + } + + var anyEntityTypeConfiguration = false; +#> + modelBuilder.Entity<<#= entityType.Name #>>(entity => + { +<# + var key = entityType.FindPrimaryKey(); + if (key != null) + { + var keyFluentApiCalls = key.GetFluentApiCalls(annotationCodeGenerator); + if (keyFluentApiCalls != null + || (!key.IsHandledByConvention() && !Options.UseDataAnnotations)) + { + if (keyFluentApiCalls != null) + { + usings.AddRange(keyFluentApiCalls.GetRequiredUsings()); + } +#> + entity.HasKey(<#= code.Lambda(key.Properties, "e") #>)<#= code.Fragment(keyFluentApiCalls, indent: 4) #>; +<# + anyEntityTypeConfiguration = true; + } + } + + var entityTypeFluentApiCalls = entityType.GetFluentApiCalls(annotationCodeGenerator) + ?.FilterChain(c => !(Options.UseDataAnnotations && c.IsHandledByDataAnnotations)); + if (entityTypeFluentApiCalls != null) + { + usings.AddRange(entityTypeFluentApiCalls.GetRequiredUsings()); + + if (anyEntityTypeConfiguration) + { + WriteLine(""); + } +#> + entity<#= code.Fragment(entityTypeFluentApiCalls, indent: 4) #>; +<# + anyEntityTypeConfiguration = true; + } + + foreach (var index in entityType.GetIndexes() + .Where(i => !(Options.UseDataAnnotations && i.IsHandledByDataAnnotations(annotationCodeGenerator)))) + { + if (anyEntityTypeConfiguration) + { + WriteLine(""); + } + + var indexFluentApiCalls = index.GetFluentApiCalls(annotationCodeGenerator); + if (indexFluentApiCalls != null) + { + usings.AddRange(indexFluentApiCalls.GetRequiredUsings()); + } +#> + entity.HasIndex(<#= code.Lambda(index.Properties, "e") #>, <#= code.Literal(index.GetDatabaseName()) #>)<#= code.Fragment(indexFluentApiCalls, indent: 4) #>; +<# + anyEntityTypeConfiguration = true; + } + + var firstProperty = true; + foreach (var property in entityType.GetProperties()) + { + var propertyFluentApiCalls = property.GetFluentApiCalls(annotationCodeGenerator) + ?.FilterChain(c => !(Options.UseDataAnnotations && c.IsHandledByDataAnnotations) + && !(c.Method == "IsRequired" && Options.UseNullableReferenceTypes && !property.ClrType.IsValueType)); + if (propertyFluentApiCalls == null) + { + continue; + } + + usings.AddRange(propertyFluentApiCalls.GetRequiredUsings()); + + if (anyEntityTypeConfiguration && firstProperty) + { + WriteLine(""); + } +#> + entity.Property(e => e.<#= property.Name #>)<#= code.Fragment(propertyFluentApiCalls, indent: 4) #>; +<# + anyEntityTypeConfiguration = true; + firstProperty = false; + } + + foreach (var foreignKey in entityType.GetForeignKeys()) + { + var foreignKeyFluentApiCalls = foreignKey.GetFluentApiCalls(annotationCodeGenerator) + ?.FilterChain(c => !(Options.UseDataAnnotations && c.IsHandledByDataAnnotations)); + if (foreignKeyFluentApiCalls == null) + { + continue; + } + + usings.AddRange(foreignKeyFluentApiCalls.GetRequiredUsings()); + + if (anyEntityTypeConfiguration) + { + WriteLine(""); + } +#> + entity.HasOne(d => d.<#= foreignKey.DependentToPrincipal.Name #>).<#= foreignKey.IsUnique ? "WithOne" : "WithMany" #>(<#= foreignKey.PrincipalToDependent != null ? $"p => p.{foreignKey.PrincipalToDependent.Name}" : "" #>)<#= code.Fragment(foreignKeyFluentApiCalls, indent: 4) #>; +<# + anyEntityTypeConfiguration = true; + } + + foreach (var skipNavigation in entityType.GetSkipNavigations().Where(n => n.IsLeftNavigation())) + { + if (anyEntityTypeConfiguration) + { + WriteLine(""); + } + + var left = skipNavigation.ForeignKey; + var leftFluentApiCalls = left.GetFluentApiCalls(annotationCodeGenerator, useStrings: true); + var right = skipNavigation.Inverse.ForeignKey; + var rightFluentApiCalls = right.GetFluentApiCalls(annotationCodeGenerator, useStrings: true); + var joinEntityType = skipNavigation.JoinEntityType; + + if (leftFluentApiCalls != null) + { + usings.AddRange(leftFluentApiCalls.GetRequiredUsings()); + } + + if (rightFluentApiCalls != null) + { + usings.AddRange(rightFluentApiCalls.GetRequiredUsings()); + } +#> + entity.HasMany(d => d.<#= skipNavigation.Name #>).WithMany(p => p.<#= skipNavigation.Inverse.Name #>) + .UsingEntity>( + <#= code.Literal(joinEntityType.Name) #>, + r => r.HasOne<<#= right.PrincipalEntityType.Name #>>().WithMany()<#= code.Fragment(rightFluentApiCalls, indent: 6) #>, + l => l.HasOne<<#= left.PrincipalEntityType.Name #>>().WithMany()<#= code.Fragment(leftFluentApiCalls, indent: 6) #>, + j => + { +<# + var joinKey = joinEntityType.FindPrimaryKey(); + var joinKeyFluentApiCalls = joinKey.GetFluentApiCalls(annotationCodeGenerator); + + if (joinKeyFluentApiCalls != null) + { + usings.AddRange(joinKeyFluentApiCalls.GetRequiredUsings()); + } +#> + j.HasKey(<#= code.Arguments(joinKey.Properties.Select(e => e.Name)) #>)<#= code.Fragment(joinKeyFluentApiCalls, indent: 7) #>; +<# + var joinEntityTypeFluentApiCalls = joinEntityType.GetFluentApiCalls(annotationCodeGenerator); + if (joinEntityTypeFluentApiCalls != null) + { + usings.AddRange(joinEntityTypeFluentApiCalls.GetRequiredUsings()); +#> + j<#= code.Fragment(joinEntityTypeFluentApiCalls, indent: 7) #>; +<# + } + + foreach (var index in joinEntityType.GetIndexes()) + { + var indexFluentApiCalls = index.GetFluentApiCalls(annotationCodeGenerator); + if (indexFluentApiCalls != null) + { + usings.AddRange(indexFluentApiCalls.GetRequiredUsings()); + } +#> + j.HasIndex(<#= code.Literal(index.Properties.Select(e => e.Name).ToArray()) #>, <#= code.Literal(index.GetDatabaseName()) #>)<#= code.Fragment(indexFluentApiCalls, indent: 7) #>; +<# + } + + foreach (var property in joinEntityType.GetProperties()) + { + var propertyFluentApiCalls = property.GetFluentApiCalls(annotationCodeGenerator); + if (propertyFluentApiCalls == null) + { + continue; + } + + usings.AddRange(propertyFluentApiCalls.GetRequiredUsings()); +#> + j.IndexerProperty<<#= code.Reference(property.ClrType) #>>(<#= code.Literal(property.Name) #>)<#= code.Fragment(propertyFluentApiCalls, indent: 7) #>; +<# + } +#> + }); +<# + anyEntityTypeConfiguration = true; + } +#> + }); +<# + // If any signicant code was generated, append it to the main environment + if (anyEntityTypeConfiguration) + { + mainEnvironment.Append(GenerationEnvironment); + anyConfiguration = true; + } + + // Resume generating code into the main environment + GenerationEnvironment = mainEnvironment; + } + + foreach (var sequence in Model.GetSequences()) + { + var needsType = sequence.Type != typeof(long); + var needsSchema = !string.IsNullOrEmpty(sequence.Schema) && sequence.Schema != sequence.Model.GetDefaultSchema(); + var sequenceFluentApiCalls = sequence.GetFluentApiCalls(annotationCodeGenerator); +#> + modelBuilder.HasSequence<#= needsType ? $"<{code.Reference(sequence.Type)}>" : "" #>(<#= code.Literal(sequence.Name) #><#= needsSchema ? $", {code.Literal(sequence.Schema)}" : "" #>)<#= code.Fragment(sequenceFluentApiCalls, indent: 3) #>; +<# + } + + if (anyConfiguration) + { + WriteLine(""); + } +#> + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} +<# + mainEnvironment = GenerationEnvironment; + GenerationEnvironment = new StringBuilder(); + + foreach (var ns in usings.Distinct().OrderBy(x => x, new NamespaceComparer())) + { +#> +using <#= ns #>; +<# + } + + WriteLine(""); + + GenerationEnvironment.Append(mainEnvironment); +#> diff --git a/IRaCIS.Core.Test/CodeTemplates/EFCore/EntityType.t4 b/IRaCIS.Core.Test/CodeTemplates/EFCore/EntityType.t4 new file mode 100644 index 000000000..65b856ee7 --- /dev/null +++ b/IRaCIS.Core.Test/CodeTemplates/EFCore/EntityType.t4 @@ -0,0 +1,174 @@ +<#@ template hostSpecific="true" #> +<#@ assembly name="Microsoft.EntityFrameworkCore" #> +<#@ assembly name="Microsoft.EntityFrameworkCore.Design" #> +<#@ assembly name="Microsoft.EntityFrameworkCore.Relational" #> +<#@ assembly name="Microsoft.Extensions.DependencyInjection.Abstractions" #> +<#@ parameter name="EntityType" type="Microsoft.EntityFrameworkCore.Metadata.IEntityType" #> +<#@ parameter name="Options" type="Microsoft.EntityFrameworkCore.Scaffolding.ModelCodeGenerationOptions" #> +<#@ parameter name="NamespaceHint" type="System.String" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ import namespace="System.ComponentModel.DataAnnotations" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="Microsoft.EntityFrameworkCore" #> +<#@ import namespace="Microsoft.EntityFrameworkCore.Design" #> +<#@ import namespace="Microsoft.Extensions.DependencyInjection" #> +<# + if (EntityType.IsSimpleManyToManyJoinEntityType()) + { + // Don't scaffold these + return ""; + } + + var services = (IServiceProvider)Host; + var annotationCodeGenerator = services.GetRequiredService(); + var code = services.GetRequiredService(); + + var usings = new List + { + "System", + "System.Collections.Generic" + }; + + if (Options.UseDataAnnotations) + { + usings.Add("System.ComponentModel.DataAnnotations"); + usings.Add("System.ComponentModel.DataAnnotations.Schema"); + usings.Add("Microsoft.EntityFrameworkCore"); + usings.Add("IRaCIS.Core.Domain.Models"); + } + + if (!string.IsNullOrEmpty(NamespaceHint)) + { +#> +namespace <#= NamespaceHint #>; + +<# + } + + if (!string.IsNullOrEmpty(EntityType.GetComment())) + { +#> +[comment("<#= code.XmlComment(EntityType.GetComment()) #>")] +<# + } + + if (Options.UseDataAnnotations) + { + foreach (var dataAnnotation in EntityType.GetDataAnnotations(annotationCodeGenerator)) + { +#> +<#= code.Fragment(dataAnnotation) #> +<# + } + } +#> +public partial class <#= EntityType.Name #>: BaseFullAuditEntity +{ +<# + var firstProperty = true; + var excludedColumns = new[] { "CreateUserId", "Id", "UpdateUserId", "CreateTime", "UpdateTime", "DeleteUserId", "IsDeleted", "DeletedTime" }; + foreach (var property in EntityType.GetProperties().OrderBy(p => p.GetColumnOrder() ?? -1).OrderBy(t=>t.Name)) + { + if (!excludedColumns.Contains(property.Name)) + { + if (!firstProperty) + { + WriteLine(""); + } + + if (!string.IsNullOrEmpty(property.GetComment())) + { +#> + [Comment(" <#= code.XmlComment(property.GetComment()) #>")] +<# + } + + if (Options.UseDataAnnotations) + { + var dataAnnotations = property.GetDataAnnotations(annotationCodeGenerator) + .Where(a => !(a.Type == typeof(RequiredAttribute) && Options.UseNullableReferenceTypes && !property.ClrType.IsValueType)); + foreach (var dataAnnotation in dataAnnotations) + { +#> + <#= code.Fragment(dataAnnotation) #> +<# + } + } + + usings.AddRange(code.GetRequiredUsings(property.ClrType)); + + var needsNullable = Options.UseNullableReferenceTypes && property.IsNullable && !property.ClrType.IsValueType; + var needsInitializer = Options.UseNullableReferenceTypes && !property.IsNullable && !property.ClrType.IsValueType; +#> + public <#= code.Reference(property.ClrType) #><#= needsNullable ? "?" : "" #> <#= property.Name #> { get; set; }<#= needsInitializer ? " = null!;" : "" #> +<# + firstProperty = false; + } + } + + foreach (var navigation in EntityType.GetNavigations()) + { + WriteLine(""); + + if (Options.UseDataAnnotations) + { + foreach (var dataAnnotation in navigation.GetDataAnnotations(annotationCodeGenerator)) + { +#> + <#= code.Fragment(dataAnnotation) #> +<# + } + } + + var targetType = navigation.TargetEntityType.Name; + if (navigation.IsCollection) + { +#> + public virtual ICollection<<#= targetType #>> <#= navigation.Name #> { get; set; } = new List<<#= targetType #>>(); +<# + } + else + { + var needsNullable = Options.UseNullableReferenceTypes && !(navigation.ForeignKey.IsRequired && navigation.IsOnDependent); + var needsInitializer = Options.UseNullableReferenceTypes && navigation.ForeignKey.IsRequired && navigation.IsOnDependent; +#> + public virtual <#= targetType #><#= needsNullable ? "?" : "" #> <#= navigation.Name #> { get; set; }<#= needsInitializer ? " = null!;" : "" #> +<# + } + } + + foreach (var skipNavigation in EntityType.GetSkipNavigations()) + { + WriteLine(""); + + if (Options.UseDataAnnotations) + { + foreach (var dataAnnotation in skipNavigation.GetDataAnnotations(annotationCodeGenerator)) + { +#> + <#= code.Fragment(dataAnnotation) #> +<# + } + } +#> + public virtual ICollection<<#= skipNavigation.TargetEntityType.Name #>> <#= skipNavigation.Name #> { get; set; } = new List<<#= skipNavigation.TargetEntityType.Name #>>(); +<# + } +#> +} +<# + var previousOutput = GenerationEnvironment; + GenerationEnvironment = new StringBuilder(); + + foreach (var ns in usings.Distinct().OrderBy(x => x, new NamespaceComparer())) + { +#> +using <#= ns #>; +<# + } + + WriteLine(""); + + GenerationEnvironment.Append(previousOutput); +#> diff --git a/IRaCIS.Core.Test/DbHelper.ttinclude b/IRaCIS.Core.Test/DbHelper.ttinclude deleted file mode 100644 index cc5fddb73..000000000 --- a/IRaCIS.Core.Test/DbHelper.ttinclude +++ /dev/null @@ -1,324 +0,0 @@ -<#+ - public class config - { - public static readonly string ConnectionString = "Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true"; - public static readonly string DbDatabase = "Test_IRC"; - //ַ,ƴ - public static readonly string TableName = "UserFeedBack"; - //ļ service Ƿҳ - } -#> -<#+ - public class DbHelper - { - #region GetDbTables - - public static List GetDbTablesNew(string connectionString, string database,string tables = null) - { - if (!string.IsNullOrEmpty(tables)) - { - tables = string.Format(" and obj.name in ('{0}')", tables.Replace(",", "','")); - } - string sql = string.Format(@"SELECT - obj.name tablename - from {0}.sys.objects obj - inner join {0}.dbo.sysindexes idx on obj.object_id=idx.id and idx.indid<=1 - INNER JOIN {0}.sys.schemas schem ON obj.schema_id=schem.schema_id - left join {0}.sys.extended_properties g ON (obj.object_id = g.major_id AND g.minor_id = 0 AND g.name= 'MS_Description') - where type='U' {1} - order by obj.name", database,tables); - DataTable dt = GetDataTable(connectionString, sql); - return dt.Rows.Cast().Select(row =>row.Field("tablename")).ToList(); - } - - public static List GetDbTables(string connectionString, string database, string tables = null) - { - - if (!string.IsNullOrEmpty(tables)) - { - tables = string.Format(" and obj.name in ('{0}')", tables.Replace(",", "','")); - } - #region SQL - string sql = string.Format(@"SELECT - obj.name tablename, - schem.name schemname, - idx.rows, - CAST - ( - CASE - WHEN (SELECT COUNT(1) FROM sys.indexes WHERE object_id= obj.OBJECT_ID AND is_primary_key=1) >=1 THEN 1 - ELSE 0 - END - AS BIT) HasPrimaryKey - from {0}.sys.objects obj - inner join {0}.dbo.sysindexes idx on obj.object_id=idx.id and idx.indid<=1 - INNER JOIN {0}.sys.schemas schem ON obj.schema_id=schem.schema_id - where type='U' {1} - order by obj.name", database, tables); - #endregion - DataTable dt = GetDataTable(connectionString, sql); - return dt.Rows.Cast().Select(row => new DbTable - { - TableName = row.Field("tablename"), - SchemaName = row.Field("schemname"), - Rows = row.Field("rows"), - HasPrimaryKey = row.Field("HasPrimaryKey") - }).ToList(); - } - #endregion - - #region GetDbColumns - - public static List GetDbColumns(string connectionString, string database, string tableName, string schema = "dbo") - { - #region SQL - string sql = string.Format(@" - WITH indexCTE AS - ( - SELECT - ic.column_id, - ic.index_column_id, - ic.object_id - FROM {0}.sys.indexes idx - INNER JOIN {0}.sys.index_columns ic ON idx.index_id = ic.index_id AND idx.object_id = ic.object_id - WHERE idx.object_id =OBJECT_ID(@tableName) AND idx.is_primary_key=1 - ) - select - colm.column_id ColumnID, - CAST(CASE WHEN indexCTE.column_id IS NULL THEN 0 ELSE 1 END AS BIT) IsPrimaryKey, - colm.name ColumnName, - systype.name ColumnType, - colm.is_identity IsIdentity, - colm.is_nullable IsNullable, - cast(colm.max_length as int) ByteLength, - ( - case - when systype.name='nvarchar' and colm.max_length>0 then colm.max_length/2 - when systype.name='nchar' and colm.max_length>0 then colm.max_length/2 - when systype.name='ntext' and colm.max_length>0 then colm.max_length/2 - else colm.max_length - end - ) CharLength, - cast(colm.precision as int) Precision, - cast(colm.scale as int) Scale, - prop.value Remark - from {0}.sys.columns colm - inner join {0}.sys.types systype on colm.system_type_id=systype.system_type_id and colm.user_type_id=systype.user_type_id - left join {0}.sys.extended_properties prop on colm.object_id=prop.major_id and colm.column_id=prop.minor_id - LEFT JOIN indexCTE ON colm.column_id=indexCTE.column_id AND colm.object_id=indexCTE.object_id - where colm.object_id=OBJECT_ID(@tableName) - order by colm.column_id", database); - #endregion - SqlParameter param = new SqlParameter("@tableName", SqlDbType.NVarChar, 100) { Value = string.Format("{0}.{1}.{2}", database, schema, tableName) }; - DataTable dt = GetDataTable(connectionString, sql, param); - return dt.Rows.Cast().Select(row => new DbColumn() - { - ColumnID = row.Field("ColumnID"), - IsPrimaryKey = row.Field("IsPrimaryKey"), - ColumnName = row.Field("ColumnName"), - ColumnType = row.Field("ColumnType"), - IsIdentity = row.Field("IsIdentity"), - IsNullable = row.Field("IsNullable"), - ByteLength = row.Field("ByteLength"), - CharLength = row.Field("CharLength"), - Precision=row.Field("Precision"), - Scale = row.Field("Scale"), - Remark = row["Remark"].ToString() - }).ToList(); - } - - #endregion - - #region GetDataTable - - public static DataTable GetDataTable(string connectionString, string commandText, params SqlParameter[] parms) - { - using (SqlConnection connection = new SqlConnection(connectionString)) - { - SqlCommand command = connection.CreateCommand(); - command.CommandText = commandText; - command.Parameters.AddRange(parms); - SqlDataAdapter adapter = new SqlDataAdapter(command); - - DataTable dt = new DataTable(); - adapter.Fill(dt); - - return dt; - } - } - - #endregion - - #region GetPrimaryKey - public static string GetPrimaryKey(List dbColumns) - { - string primaryKey = string.Empty; - if (dbColumns!=null&&dbColumns.Count>0) - { - foreach (var item in dbColumns) - { - if (item.IsPrimaryKey==true) - { - primaryKey = item.ColumnName; - } - } - } - return primaryKey; - } - #endregion - } - - #region DbTable - public sealed class DbTable - { - public string TableName { get; set; } - public string SchemaName { get; set; } - public int Rows { get; set; } - - public bool HasPrimaryKey { get; set; } - } - #endregion - - #region DbColumn - - public sealed class DbColumn - { - - public int ColumnID { get; set; } - - - public bool IsPrimaryKey { get; set; } - - - public string ColumnName { get; set; } - - - public string ColumnType { get; set; } - - - public string CSharpType - { - get - { - return SqlServerDbTypeMap.MapCsharpType(ColumnType); - } - } - - /// - /// - /// - public Type CommonType - { - get - { - return SqlServerDbTypeMap.MapCommonType(ColumnType); - } - } - - public int ByteLength { get; set; } - - public int CharLength { get; set; } - - public int Precision{get;set;} - public int Scale { get; set; } - - public bool IsIdentity { get; set; } - - public bool IsNullable { get; set; } - - public string Remark { get; set; } - } - #endregion - - #region SqlServerDbTypeMap - - public class SqlServerDbTypeMap - { - public static string MapCsharpType(string dbtype) - { - if (string.IsNullOrEmpty(dbtype)) return dbtype; - dbtype = dbtype.ToLower(); - string csharpType = "object"; - switch (dbtype) - { - case "bigint": csharpType = "long"; break; - case "binary": csharpType = "byte[]"; break; - case "bit": csharpType = "bool"; break; - case "char": csharpType = "string"; break; - case "date": csharpType = "DateTime"; break; - case "datetime": csharpType = "DateTime"; break; - case "datetime2": csharpType = "DateTime"; break; - case "datetimeoffset": csharpType = "DateTimeOffset"; break; - case "decimal": csharpType = "decimal"; break; - case "float": csharpType = "double"; break; - case "image": csharpType = "byte[]"; break; - case "int": csharpType = "int"; break; - case "money": csharpType = "decimal"; break; - case "nchar": csharpType = "string"; break; - case "ntext": csharpType = "string"; break; - case "numeric": csharpType = "decimal"; break; - case "nvarchar": csharpType = "string"; break; - case "real": csharpType = "Single"; break; - case "smalldatetime": csharpType = "DateTime"; break; - case "smallint": csharpType = "short"; break; - case "smallmoney": csharpType = "decimal"; break; - case "sql_variant": csharpType = "object"; break; - case "sysname": csharpType = "object"; break; - case "text": csharpType = "string"; break; - case "time": csharpType = "TimeSpan"; break; - case "timestamp": csharpType = "byte[]"; break; - case "tinyint": csharpType = "byte"; break; - case "uniqueidentifier": csharpType = "Guid"; break; - case "varbinary": csharpType = "byte[]"; break; - case "varchar": csharpType = "string"; break; - case "xml": csharpType = "string"; break; - default: csharpType = "object"; break; - } - return csharpType; - } - - public static Type MapCommonType(string dbtype) - { - if (string.IsNullOrEmpty(dbtype)) return Type.Missing.GetType(); - dbtype = dbtype.ToLower(); - Type commonType = typeof(object); - switch (dbtype) - { - case "bigint": commonType = typeof(long); break; - case "binary": commonType = typeof(byte[]); break; - case "bit": commonType = typeof(bool); break; - case "char": commonType = typeof(string); break; - case "date": commonType = typeof(DateTime); break; - case "datetime": commonType = typeof(DateTime); break; - case "datetime2": commonType = typeof(DateTime); break; - case "datetimeoffset": commonType = typeof(DateTimeOffset); break; - case "decimal": commonType = typeof(decimal); break; - case "float": commonType = typeof(double); break; - case "image": commonType = typeof(byte[]); break; - case "int": commonType = typeof(int); break; - case "money": commonType = typeof(decimal); break; - case "nchar": commonType = typeof(string); break; - case "ntext": commonType = typeof(string); break; - case "numeric": commonType = typeof(decimal); break; - case "nvarchar": commonType = typeof(string); break; - case "real": commonType = typeof(Single); break; - case "smalldatetime": commonType = typeof(DateTime); break; - case "smallint": commonType = typeof(short); break; - case "smallmoney": commonType = typeof(decimal); break; - case "sql_variant": commonType = typeof(object); break; - case "sysname": commonType = typeof(object); break; - case "text": commonType = typeof(string); break; - case "time": commonType = typeof(TimeSpan); break; - case "timestamp": commonType = typeof(byte[]); break; - case "tinyint": commonType = typeof(byte); break; - case "uniqueidentifier": commonType = typeof(Guid); break; - case "varbinary": commonType = typeof(byte[]); break; - case "varchar": commonType = typeof(string); break; - case "xml": commonType = typeof(string); break; - default: commonType = typeof(object); break; - } - return commonType; - } - } - #endregion - #> \ No newline at end of file diff --git a/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj b/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj index 39a20fd0c..77dd99306 100644 --- a/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj +++ b/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj @@ -1,107 +1,75 @@  + + utf-8 + utf-8 + + + enable + + + net8.0 - - net8.0 + false - false + default - default + Exe + - Exe - + + bin + - - bin - + + + + + - - - - - + + + + + + + - - - Always - - - Always - - - Always - - - IRaCIS .Core.ServiceAsync.cs - TextTemplatingFileGenerator - - - IRaCIS .Core.IServiceAsync.cs - TextTemplatingFileGenerator - - - TextTemplatingFileGenerator - IRaCIS.Core.Dto.cs - - - TextTemplatingFileGenerator - IRaCIS.Core.Entity.cs - - + + + Always + + + Always + + + Always + + - - - + + + - - - IRaCIS .Core.IServiceAsync.tt - True - True - - - IRaCIS .Core.ServiceAsync.tt - True - True - - - True - True - IRaCIS.Core.Dto.tt - - - True - True - IRaCIS.Core.Entity.tt - - + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - + + + diff --git a/IRaCIS.Core.Test/Template/EntityService.liquid b/IRaCIS.Core.Test/LiquidTemplate/EntityService.liquid similarity index 93% rename from IRaCIS.Core.Test/Template/EntityService.liquid rename to IRaCIS.Core.Test/LiquidTemplate/EntityService.liquid index f0bce2e1f..479a9dc62 100644 --- a/IRaCIS.Core.Test/Template/EntityService.liquid +++ b/IRaCIS.Core.Test/LiquidTemplate/EntityService.liquid @@ -1,6 +1,6 @@ //-------------------------------------------------------------------- -// 此代码由模板自动生成 byzhouhang 20210918 +// 此代码由liquid模板自动生成 byzhouhang 20240909 // 生成时间 {{DateTimeNow}} // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- @@ -8,6 +8,9 @@ using IRaCIS.Core.Domain.Models; using Microsoft.AspNetCore.Mvc; using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.ViewModel; +using IRaCIS.Core.Infrastructure.Extention; +using System.Threading.Tasks; +using IRaCIS.Core.Infra.EFCore; namespace IRaCIS.Core.Application.Service { diff --git a/IRaCIS.Core.Test/Template/EntityViewModel.liquid b/IRaCIS.Core.Test/LiquidTemplate/EntityViewModel.liquid similarity index 70% rename from IRaCIS.Core.Test/Template/EntityViewModel.liquid rename to IRaCIS.Core.Test/LiquidTemplate/EntityViewModel.liquid index 1face3652..0a5902e97 100644 --- a/IRaCIS.Core.Test/Template/EntityViewModel.liquid +++ b/IRaCIS.Core.Test/LiquidTemplate/EntityViewModel.liquid @@ -1,6 +1,6 @@ //-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 +// 此代码由liquid模板自动生成 byzhouhang 20240909 // 生成时间 {{DateTimeNow}} // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- @@ -12,7 +12,7 @@ namespace IRaCIS.Core.Application.ViewModel public class {{ TableNameView }} : {{ TableNameAddOrEdit }} { {% for field in ViewListFieldList %} - public {{ field.CSharpType }} {{ field.FieldName }} { get; set; } + public {{ field.CSharpType }} {{ field.FieldName }} { get; set; } {% endfor %} } @@ -21,9 +21,9 @@ namespace IRaCIS.Core.Application.ViewModel { {%- for field in AddOrUpdateFieldList -%} {% if field.IsPrimarykey %} - public {{ field.CSharpType }}? {{ field.FieldName }} { get; set; } + public {{ field.CSharpType }}? {{ field.FieldName }} { get; set; } {% else %} - public {{ field.CSharpType }} {{ field.FieldName }} { get; set; } + public {{ field.CSharpType }} {{ field.FieldName }} { get; set; } {% endif %} {%- endfor -%} } @@ -32,9 +32,9 @@ namespace IRaCIS.Core.Application.ViewModel { {%- for field in QueryListFieldList -%} {% if field.IsNullable and field.IsCSharpString == false %} - public {{ field.CSharpType }} {{ field.FieldName }} { get; set; } + public {{ field.CSharpType }} {{ field.FieldName }} { get; set; } {% else %} - public {{ field.CSharpType }}? {{ field.FieldName }} { get; set; } + public {{ field.CSharpType }}? {{ field.FieldName }} { get; set; } {% endif %} {%- endfor -%} } diff --git a/IRaCIS.Core.Test/Template/IEntityService.liquid b/IRaCIS.Core.Test/LiquidTemplate/IEntityService.liquid similarity index 85% rename from IRaCIS.Core.Test/Template/IEntityService.liquid rename to IRaCIS.Core.Test/LiquidTemplate/IEntityService.liquid index 7bd0beea6..9b22f711c 100644 --- a/IRaCIS.Core.Test/Template/IEntityService.liquid +++ b/IRaCIS.Core.Test/LiquidTemplate/IEntityService.liquid @@ -1,9 +1,12 @@ //-------------------------------------------------------------------- -// 此代码由模板自动生成 byzhouhang 20210918 +// 此代码由liquid模板自动生成 byzhouhang 20240909 // 生成时间 {{DateTimeNow}} // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- +using System; +using IRaCIS.Core.Infrastructure.Extention; +using System.Threading.Tasks; using IRaCIS.Core.Application.ViewModel; namespace IRaCIS.Core.Application.Interfaces { diff --git a/IRaCIS.Core.Test/ModelAuto.ttinclude b/IRaCIS.Core.Test/ModelAuto.ttinclude deleted file mode 100644 index b7ab0a374..000000000 --- a/IRaCIS.Core.Test/ModelAuto.ttinclude +++ /dev/null @@ -1,115 +0,0 @@ -<#@ assembly name="System.Core"#> -<#@ assembly name="Microsoft.VisualStudio.Interop"#> -<#@ import namespace="System.Collections.Generic"#> -<#@ import namespace="System.IO"#> -<#@ import namespace="System.Text"#> -<#@ import namespace="Microsoft.VisualStudio.TextTemplating"#> -<#+ -class Manager -{ - public struct Block { - public int Start, Length; - public String Name,OutputPath; - } - - public List blocks = new List(); - public Block currentBlock; - public Block footerBlock = new Block(); - public Block headerBlock = new Block(); - public ITextTemplatingEngineHost host; - public ManagementStrategy strategy; - public StringBuilder template; - public Manager(ITextTemplatingEngineHost host, StringBuilder template, bool commonHeader) { - this.host = host; - this.template = template; - strategy = ManagementStrategy.Create(host); - } - public void StartBlock(String name,String outputPath) { - currentBlock = new Block { Name = name, Start = template.Length ,OutputPath=outputPath}; - } - - public void StartFooter() { - footerBlock.Start = template.Length; - } - - public void EndFooter() { - footerBlock.Length = template.Length - footerBlock.Start; - } - - public void StartHeader() { - headerBlock.Start = template.Length; - } - - public void EndHeader() { - headerBlock.Length = template.Length - headerBlock.Start; - } - - public void EndBlock() { - currentBlock.Length = template.Length - currentBlock.Start; - blocks.Add(currentBlock); - } - public void Process(bool split) { - String header = template.ToString(headerBlock.Start, headerBlock.Length); - String footer = template.ToString(footerBlock.Start, footerBlock.Length); - blocks.Reverse(); - foreach(Block block in blocks) { - String fileName = Path.Combine(block.OutputPath, block.Name); - if (split) { - String content = header + template.ToString(block.Start, block.Length) + footer; - strategy.CreateFile(fileName, content); - template.Remove(block.Start, block.Length); - } else { - strategy.DeleteFile(fileName); - } - } - } -} -class ManagementStrategy -{ - internal static ManagementStrategy Create(ITextTemplatingEngineHost host) { - return (host is IServiceProvider) ? new VSManagementStrategy(host) : new ManagementStrategy(host); - } - - internal ManagementStrategy(ITextTemplatingEngineHost host) { } - - internal virtual void CreateFile(String fileName, String content) { - File.WriteAllText(fileName, content); - } - - internal virtual void DeleteFile(String fileName) { - if (File.Exists(fileName)) - File.Delete(fileName); - } -} - -class VSManagementStrategy : ManagementStrategy -{ - private EnvDTE.ProjectItem templateProjectItem; - - internal VSManagementStrategy(ITextTemplatingEngineHost host) : base(host) { - IServiceProvider hostServiceProvider = (IServiceProvider)host; - if (hostServiceProvider == null) - throw new ArgumentNullException("Could not obtain hostServiceProvider"); - - EnvDTE.DTE dte = (EnvDTE.DTE)hostServiceProvider.GetCOMService(typeof(EnvDTE.DTE)); - if (dte == null) - throw new ArgumentNullException("Could not obtain DTE from host"); - - templateProjectItem = dte.Solution.FindProjectItem(host.TemplateFile); - } - internal override void CreateFile(String fileName, String content) { - base.CreateFile(fileName, content); - //((EventHandler)delegate { templateProjectItem.ProjectItems.AddFromFile(fileName); }).BeginInvoke(null, null, null, null); - } - internal override void DeleteFile(String fileName) { - ((EventHandler)delegate { FindAndDeleteFile(fileName); }).BeginInvoke(null, null, null, null); - } - private void FindAndDeleteFile(String fileName) { - foreach(EnvDTE.ProjectItem projectItem in templateProjectItem.ProjectItems) { - if (projectItem.get_FileNames(0) == fileName) { - projectItem.Delete(); - return; - } - } - } -}#> \ No newline at end of file diff --git a/IRaCIS.Core.Test/Program.cs b/IRaCIS.Core.Test/Program.cs index 6dd7114f1..90e84d66e 100644 --- a/IRaCIS.Core.Test/Program.cs +++ b/IRaCIS.Core.Test/Program.cs @@ -1,6 +1,7 @@  using Fluid; using IRaCIS.Core.Infra.EFCore; +using IRaCIS.Core.Test.GenerateFolder; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; using System; @@ -11,47 +12,50 @@ using System.Text; partial class Program { - static void Main() + + static void Main(string[] args) { //发布的目录和项目的目录有区别的 var rootPath = AppContext.BaseDirectory.Replace(@"\bin\net8.0\", "").Replace(@"\bin\Release\net8.0\", ""); - var templateFolderPath = Path.Combine(rootPath, "Template"); - var outPutTemplateFolderPath = Path.Combine(rootPath, "TemplateOutPut"); + var templateFolderPath = Path.Combine(rootPath, "LiquidTemplate"); + var outPutTemplateFolderPath = Path.Combine(rootPath, "LiquidTemplateOutPut"); #region 生成文件目录准备 if (!Directory.Exists(outPutTemplateFolderPath)) { Directory.CreateDirectory(outPutTemplateFolderPath); } - var servicePath = Path.Combine(outPutTemplateFolderPath, "Service"); - var iServicePath = Path.Combine(outPutTemplateFolderPath, "IService"); - var entityPath = Path.Combine(outPutTemplateFolderPath, "Entity"); - var dtoPath = Path.Combine(outPutTemplateFolderPath, "DTO"); - if (!Directory.Exists(servicePath)) - { - Directory.CreateDirectory(servicePath); - } - if (!Directory.Exists(iServicePath)) - { - Directory.CreateDirectory(iServicePath); - } - if (!Directory.Exists(entityPath)) - { - Directory.CreateDirectory(entityPath); - } - if (!Directory.Exists(dtoPath)) - { - Directory.CreateDirectory(dtoPath); - } + #region 废弃 没必要分目录,还是手动设置文件夹 + //var servicePath = Path.Combine(outPutTemplateFolderPath, "Service"); + //var iServicePath = Path.Combine(outPutTemplateFolderPath, "IService"); + //var entityPath = Path.Combine(outPutTemplateFolderPath, "Entity"); + //var dtoPath = Path.Combine(outPutTemplateFolderPath, "DTO"); + + //if (!Directory.Exists(servicePath)) + //{ + // Directory.CreateDirectory(servicePath); + //} + //if (!Directory.Exists(iServicePath)) + //{ + // Directory.CreateDirectory(iServicePath); + //} + //if (!Directory.Exists(entityPath)) + //{ + // Directory.CreateDirectory(entityPath); + //} + //if (!Directory.Exists(dtoPath)) + //{ + // Directory.CreateDirectory(dtoPath); + //} + #endregion + #endregion - - // 要生成的表名数组 - var tableNames = new List { "Subject"/*, "Order"*/ }; + var tableNames = new List(args); try { @@ -233,9 +237,11 @@ partial class Program public void CheckCodeFirst() { - var contextOptions = new DbContextOptionsBuilder().UseSqlServer(@"Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true").Options; + //var contextOptions = new DbContextOptionsBuilder() + // .UseSqlServer(@"Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true").Options; - using var dbContext = new IRaCISDBContext(contextOptions); + //using var dbContext = new TempContext(contextOptions); + using var dbContext = new TempContext(); var dbModel = dbContext.Model; diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS .Core.IServiceAsync.cs b/IRaCIS.Core.Test/TT_Template/IRaCIS .Core.IServiceAsync.cs deleted file mode 100644 index fe5554c90..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS .Core.IServiceAsync.cs +++ /dev/null @@ -1,10 +0,0 @@ - - -//在这里设置 isPage 是否生成分页的还是不分页 - - - - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS .Core.IServiceAsync.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS .Core.IServiceAsync.tt deleted file mode 100644 index c47056fd8..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS .Core.IServiceAsync.tt +++ /dev/null @@ -1,75 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ output extension=".cs" #> -<#@ assembly name="System.Core.dll" #> -<#@ assembly name="System.Data.dll" #> -<#@ assembly name="System.Data.DataSetExtensions.dll" #> -<#@ assembly name="System.Xml.dll" #> -<#@ import namespace="System" #> -<#@ import namespace="System.Xml" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Data" #> -<#@ import namespace="System.Data.SqlClient" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ include file="$(ProjectDir)DbHelper.ttinclude" #> -<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #> -<# var manager = new Manager(Host, GenerationEnvironment, true); #> - -//在这里设置 isPage 是否生成分页的还是不分页 - -<# - var isPage=true; - #> - -<# - var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+".."); - OutputPath1=Path.Combine(OutputPath1,"IServices_New"); - if (!Directory.Exists(OutputPath1)) - { - Directory.CreateDirectory(OutputPath1); - } -#> - - -<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName)) - { - var tableName=item.ToString(); - manager.StartBlock("I"+tableName+"Service"+".cs",OutputPath1);//文件名 -#> -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#> -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - -using IRaCIS.Core.Application.ViewModel; -namespace IRaCIS.Core.Application.Interfaces -{ - /// - /// I<#=tableName#>Service - /// - public interface I<#=tableName#>Service - { - - <# if(isPage){#> - TaskView>> Get<#=tableName#>List(<#=tableName#>Query inQuery); - <# } else {#> - - TaskView>> Get<#=tableName#>List(<#=tableName#>Query inQuery); - <# }#> - - Task AddOrUpdate<#=tableName#>(<#=tableName#>AddOrEdit addOrEdit<#=tableName#>); - - Task Delete<#=tableName#>(Guid <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id); - - - } -} -<# - manager.EndBlock(); - } - manager.Process(true); - #> - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS .Core.ServiceAsync.cs b/IRaCIS.Core.Test/TT_Template/IRaCIS .Core.ServiceAsync.cs deleted file mode 100644 index 2faa758b0..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS .Core.ServiceAsync.cs +++ /dev/null @@ -1,9 +0,0 @@ - - - - -//在这里设置 isPage 是否生成分页的还是不分页 - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS .Core.ServiceAsync.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS .Core.ServiceAsync.tt deleted file mode 100644 index effdadf11..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS .Core.ServiceAsync.tt +++ /dev/null @@ -1,118 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ output extension=".cs" #> -<#@ assembly name="System.Core.dll" #> -<#@ assembly name="System.Data.dll" #> -<#@ assembly name="System.Data.DataSetExtensions.dll" #> -<#@ assembly name="System.Xml.dll" #> -<#@ import namespace="System" #> -<#@ import namespace="System.Xml" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Data" #> -<#@ import namespace="System.Data.SqlClient" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> - -<#@ include file="$(ProjectDir)DbHelper.ttinclude" #> -<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #> -<# var manager = new Manager(Host, GenerationEnvironment, true); #> - - -//在这里设置 isPage 是否生成分页的还是不分页 - -<# - var isPage=true; - #> - -<# - var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+".."); - OutputPath1=Path.Combine(OutputPath1,"Services_New"); - if (!Directory.Exists(OutputPath1)) - { - Directory.CreateDirectory(OutputPath1); - } -#> - - -<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName)) - { - var tableName=item.ToString(); - manager.StartBlock(tableName+"Service"+".cs",OutputPath1);//文件名 -#> -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#> -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - -using IRaCIS.Core.Domain.Models; -using Microsoft.AspNetCore.Mvc; -using IRaCIS.Core.Application.Interfaces; -using IRaCIS.Core.Application.ViewModel; -namespace IRaCIS.Core.Application.Service -{ - /// - /// <#=tableName#>Service - /// - [ ApiExplorerSettings(GroupName = "Test")] - public class <#=tableName#>Service(IRepository<<#=tableName#>> _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository): BaseService, I<#=tableName#>Service - { - - <# if(isPage){#> - [HttpPost] - public async TaskView>> Get<#=tableName#>List(<#=tableName#>Query inQuery) - { - - var <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Queryable = - - _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository - .ProjectTo<<#=tableName#>View>(_mapper.ConfigurationProvider); - - var pageList= await <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Queryable.ToPagedListAsync(inQuery); - - return pageList; - } - <# } else {#> - [HttpPost] - public async TaskView>> Get<#=tableName#>List(<#=tableName#>Query inQuery) - { - - - var <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Queryable = _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository - .ProjectTo<<#=tableName#>View>(_mapper.ConfigurationProvider); - - return await <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Queryable.ToListAsync(); - } - <# }#> - - - public async Task AddOrUpdate<#=tableName#>(<#=tableName#>AddOrEdit addOrEdit<#=tableName#>) - { - // 在此处拷贝automapper 映射 - - - CreateMap<<#=tableName#>, <#=tableName#>View>(); - // CreateMap< <#=tableName#>,<#=tableName#>AddOrEdit>().ReverseMap(); - - - var entity = await _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository.InsertOrUpdateAsync(addOrEdit<#=tableName#>, true); - - return ResponseOutput.Ok(entity.Id.ToString()); - - } - - - [HttpDelete("{<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id:guid}")] - public async Task Delete<#=tableName#>(Guid <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id) - { - var success = await _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository.DeleteFromQueryAsync(t => t.Id == <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id,true); - return ResponseOutput.Ok(); - } - - - } -} -<# - manager.EndBlock(); - } - manager.Process(true); - #> diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Dto.cs b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Dto.cs deleted file mode 100644 index cb03b0051..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Dto.cs +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Dto.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Dto.tt deleted file mode 100644 index 128807500..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Dto.tt +++ /dev/null @@ -1,86 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ output extension=".cs" #> -<#@ assembly name="System.Core.dll" #> -<#@ assembly name="System.Data.dll" #> -<#@ assembly name="System.Data.DataSetExtensions.dll" #> -<#@ assembly name="System.Xml.dll" #> -<#@ import namespace="System" #> -<#@ import namespace="System.Xml" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Data" #> -<#@ import namespace="System.Data.SqlClient" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ include file="$(ProjectDir)DbHelper.ttinclude" #> -<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #> -<# var manager = new Manager(Host, GenerationEnvironment, true); #> - - - -<# - var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+".."); - OutputPath1=Path.Combine(OutputPath1,"Dto_New"); - if (!Directory.Exists(OutputPath1)) - { - Directory.CreateDirectory(OutputPath1); - } -#> - - -<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName)) - { - var tableName=item.ToString(); - manager.StartBlock(tableName+"ViewModel"+".cs",OutputPath1);//文件名 -#> -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#> -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- -using System; -using IRaCIS.Core.Domain.Share; -using System.Collections.Generic; -namespace IRaCIS.Core.Application.ViewModel -{ - <# var excludedColumns = new[] { "CreateUserId", "UpdateUserId", "CreateTime", "UpdateTime" };#> - - /// <#=tableName#>View 列表视图 - public class <#=tableName#>View:<#=tableName#>AddOrEdit - { - <# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#> - <# if (excludedColumns.Contains(column.ColumnName)){ #> - public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; } - <# }#> - <# }#> - } - - ///<#=tableName#>Query 列表查询参数 - public class <#=tableName#>Query - { - <# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#><# if(column.CSharpType=="string"){#> - public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; } - <# }#> - <# }#> - } - - /// <#=tableName#>AddOrEdit 添加编辑 - public class <#=tableName#>AddOrEdit - { - <# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#> - <# if (!excludedColumns.Contains(column.ColumnName)){ #> - public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; } - <#}#> - <# }#> - } - - -} - - -<# - manager.EndBlock(); - } - manager.Process(true); - #> - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.cs b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.cs deleted file mode 100644 index b28b04f64..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.cs +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.tt deleted file mode 100644 index aa45fe94b..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.tt +++ /dev/null @@ -1,65 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ output extension=".cs" #> -<#@ assembly name="System.Core.dll" #> -<#@ assembly name="System.Data.dll" #> -<#@ assembly name="System.Data.DataSetExtensions.dll" #> -<#@ assembly name="System.Xml.dll" #> -<#@ import namespace="System" #> -<#@ import namespace="System.Xml" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Data" #> -<#@ import namespace="System.Data.SqlClient" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ include file="$(ProjectDir)DbHelper.ttinclude" #> -<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #> -<# var manager = new Manager(Host, GenerationEnvironment, true); #> - -<# - var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+".."); - OutputPath1=Path.Combine(OutputPath1,"Models_New"); - if (!Directory.Exists(OutputPath1)) - { - Directory.CreateDirectory(OutputPath1); - } -#> - -<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName)) - { - var tableName=item.ToString(); - manager.StartBlock(tableName+".cs",OutputPath1);//ļ -#> - -//-------------------------------------------------------------------- -// ˴T4ģԶ byzhouhang 20210918 -// ʱ <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#> -// ԴļĸĿܻᵼ²ȷΪɴ룬ЩĽᶪʧ -using System; -using IRaCIS.Core.Domain.Share; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.ComponentModel; -using Microsoft.EntityFrameworkCore; -namespace IRaCIS.Core.Domain.Models -{ - - [Comment("<#=tableName#>")] - [Table("<#=tableName#>")] - public class <#=tableName#> : BaseFullAuditEntity - { - <# var excludedColumns = new[] { "CreateUserId", "Id", "UpdateUserId", "CreateTime", "UpdateTime", "DeleteUserId", "IsDeleted", "DeletedTime" };#> - <# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){ #> - <# if (!excludedColumns.Contains(column.ColumnName)){ #> - [Comment("<#= column.Remark == "" ? "" : column.Remark.Replace("\r\n"," ") #>")] - public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; } - <#}#> - <#}#> - } - - public virtual DbSet<<#=tableName#>> <#=tableName#> { get; set; } -} -<# - manager.EndBlock(); - } - manager.Process(true); - #> \ No newline at end of file diff --git a/IRaCIS.Core.Test/TempContext.cs b/IRaCIS.Core.Test/TempContext.cs new file mode 100644 index 000000000..381dfe841 --- /dev/null +++ b/IRaCIS.Core.Test/TempContext.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; + +namespace IRaCIS.Core.Test.GenerateFolder; + +/// +/// 必须要,因为Program 依赖反向工程生成的dbcontext 实例化,获取数据库模型 +/// +public partial class TempContext : DbContext +{ +} diff --git a/IRaCIS.Core.Test/appsettings.json b/IRaCIS.Core.Test/appsettings.json new file mode 100644 index 000000000..fc7ead37a --- /dev/null +++ b/IRaCIS.Core.Test/appsettings.json @@ -0,0 +1,5 @@ +{ + "ConnectionStrings": { + "RemoteNew": "Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true" + } +} \ No newline at end of file diff --git a/IRaCIS.Core.Test/模板使用说明 b/IRaCIS.Core.Test/模板使用说明 new file mode 100644 index 000000000..d8aee69ec --- /dev/null +++ b/IRaCIS.Core.Test/模板使用说明 @@ -0,0 +1,44 @@ +优化背景: + 1、之前我们的从数据库自动生成实体对照模型,依赖于T4模板,同时T4模板里面的针对对应数据库获取信息的方法是自己写的,其实没必要,官方有反向生成工具,也是用的T4模板,现在可以自定义了 + 2、如果我们想用pgsql orcal mysql,按照之前的方法就要针对这些数据库进行适配,太麻烦 + 3、本身不同数据库官方提供了不同反向工程的库,利用命令行就可以根据数据库的定义生成实体 + Microsoft.EntityFrameworkCore.SqlServer mssql + Npgsql.EntityFrameworkCore.PostgreSQL pgsql + Pomelo.EntityFrameworkCore.MySql mysql + Oracle.EntityFrameworkCore Oracle + 4、微软官方针对这些不同的库,生成实体的T4模板是一样的,而且也提供了自定义模板的功能,我们可以在官方模板的基础上进行自定义,以适配属于我们项目的实体生成 + 1)继承我们自己的审计基类 + 2)生成的时候过滤Id 以及我们自己的审计字段 + +程序包管理控制台命令行工具使用: + +参数说明: +-o 模型输出目录 +-c 指定数据库上下文名字 +-d 使用数据注解 不指定,默认是fluentAPI +-t 指定要生成的表名 +-p 指定项目名字 + +备注: 因为是从数据库反向生成实体,所以会默认生成dbcontext ,每次生成想要的实体后,删除指定的名称context即可 + 针对字符串类型,我们避免string字段 数据库存储null string? 数据库才存储null(除非有合理的理由),这样可以避免代码里面用string 变量,总是要判断是否为null + 同时在保存数据库实体的时候,在赋值审计字段的时候,针对string 类型的变量,如果当前值是null,设置为""字符串,也可以避免实体定义的每个string 变量赋值默认值,有时候会忘记 + +Scaffold-DbContext "连接字符串" 数据库提供程序包 -Project 项目名称 -OutputDir 输出目录 -Context "生成的上下文名称" -DataAnnotations -Tables 表1, 表2 + +方式1: +Scaffold-DbContext "Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true" Microsoft.EntityFrameworkCore.SqlServer -Project IRaCIS.Core.Test -OutputDir GenerateContextModelFolder -Context "TempContext" -DataAnnotations -Tables Dictionary, Site + +方式2: 多个表 -t Subject -t SubjectVisit +dotnet ef dbcontext scaffold "Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true" Microsoft.EntityFrameworkCore.SqlServer -p IRaCIS.Core.Test -d -o GenerateContextModelFolder -c "TempContext" -t Dictionary -t Site + + +开发者PowerShell || 程序包管理控制台命令行 使用: +通过Liquid模板生成基础视图模型、服务接口、服务实现基本方法(必须先有数据库实体模型,否则视图模型无法生成) + dotnet run --project IRaCIS.Core.Test -- Dictionary Site + + +自动脚本方便执行两句脚本: + +./IRaCIS.Core.Test/AutoTemplatel.ps1 -Tables Dictionary, Site + +如果不能执行ps1脚本,管理员设置:Set-ExecutionPolicy -ExecutionPolicy RemoteSigned \ No newline at end of file