From 8187a0bc2acc456adc0eef84f958734baa2790a8 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 15 Aug 2022 16:13:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A8=BD=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/IRaCIS.Core.API.csproj | 8 +- .../Properties/launchSettings.json | 27 ++-- .../IRaCIS.Core.Application.xml | 137 ++++++++++++++++++ .../Service/Document/TrialDocumentService.cs | 40 ++++- IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs | 14 +- IRaCIS.Core.Domain/BaseModel/IAuditUpdate.cs | 4 +- .../Common/AuditingData.cs | 82 +++++++---- 7 files changed, 253 insertions(+), 59 deletions(-) diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj index 9b92f10c8..054a52c58 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj +++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj @@ -97,10 +97,6 @@ - - - - @@ -135,6 +131,10 @@ + + + + diff --git a/IRaCIS.Core.API/Properties/launchSettings.json b/IRaCIS.Core.API/Properties/launchSettings.json index 06fb17adc..b71f6f966 100644 --- a/IRaCIS.Core.API/Properties/launchSettings.json +++ b/IRaCIS.Core.API/Properties/launchSettings.json @@ -1,4 +1,5 @@ { + "$schema": "http://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, @@ -7,16 +8,8 @@ "sslPort": 0 } }, - "$schema": "http://json.schemastore.org/launchsettings.json", "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IRaCIS.Core.API": { + "IRaCIS.Development": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { @@ -29,6 +22,22 @@ "launchBrowser": true, "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", "publishAllPorts": true + }, + "IRaCIS.Staging": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Staging" + }, + "applicationUrl": "http://localhost:6200" + }, + "IRaCIS.Production": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Production" + }, + "applicationUrl": "http://localhost:6300" } } } \ No newline at end of file diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 503816281..ca4b94f51 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -2330,9 +2330,24 @@ 阅片期名称 + + + 表格问题类型 + + + + + 表格问题类型 + + ReadingTableQuestionSystemAddOrEdit 列表查询参数模型 + + + 表格问题类型 + + PageName @@ -2966,6 +2981,60 @@ 是否是系统数据 + + + 器官服务层 + + + + + 获取系统器官信息 + + + + + + + 新增或修改系统器官数据 + + + + + + + 删除系统器官 + + + + + + + 批量添加项目器官 + + + + + + + 删除系统器官 + + + + + + + 获取项目器官信息 + + + + + + + 获取项目勾选器官信息 + + + + 阅片医学审核 @@ -3114,6 +3183,14 @@ + + + 验证医学审核问题 + + + + + 确认医学审核问题 @@ -3472,6 +3549,53 @@ SystemNoticeAddOrEdit 列表查询参数模型 + + OrganInfoView 列表视图模型 + + + + 备注 + + + + + 类型枚举 + + + + + 类型枚举 + + + + + 类型枚举 + + + + + 备注 + + + + OrganInfoQuery 列表查询参数模型 + + + 类型名称 + + + OrganInfoAddOrEdit 列表查询参数模型 + + + + 类型枚举 + + + + + 备注 + + 类型 @@ -3747,6 +3871,11 @@ ISystemNoticeService + + + IOrganInfoService + + ITrialExternalUserService @@ -5319,6 +5448,14 @@ + + + 验证签名确认 + + + + + 签名确认 包括项目的三组配置 + QC问题确认 后修改状态 (适用于不会回退的,项目废除、状态修改, 存在回退 不在这里弄,提供单独接口修改状态) diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index 875bf71e4..ac04609bb 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -480,12 +480,23 @@ namespace IRaCIS.Core.Application.Services var success = false; if (isSystemDoc) { - await _repository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, SignFirstViewTime = DateTime.Now }); + if(!await _systemDocConfirmedUserRepository.AnyAsync(t=>t.SystemDocumentId==documentId && t.ConfirmUserId == _userInfo.Id)) + { + await _repository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now }); + + } + } else { - await _repository.AddAsync(new TrialDocUserTypeConfirmedUser() { TrialDocumentId = documentId, SignFirstViewTime = DateTime.Now }); + if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.Id)) + { + + await _repository.AddAsync(new TrialDocUserTypeConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now }); + + } + } @@ -497,7 +508,13 @@ namespace IRaCIS.Core.Application.Services [HttpPut("{documentId:guid}")] public async Task SetSystemDocFirstViewTime(Guid documentId) { - await _repository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, SignFirstViewTime = DateTime.Now }); + if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.Id)) + { + await _repository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now }); + + } + + var success = await _repository.SaveChangesAsync(); return ResponseOutput.Result(success); @@ -506,7 +523,12 @@ namespace IRaCIS.Core.Application.Services [HttpPut("{trialId:guid}/{documentId:guid}")] public async Task SetTrialDocFirstViewTime(Guid documentId) { - await _repository.AddAsync(new TrialDocUserTypeConfirmedUser() { TrialDocumentId = documentId, SignFirstViewTime = DateTime.Now }); + if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.Id)) + { + + await _repository.AddAsync(new TrialDocUserTypeConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now }); + + } var success = await _repository.SaveChangesAsync(); return ResponseOutput.Result(success); @@ -525,11 +547,13 @@ namespace IRaCIS.Core.Application.Services { return ResponseOutput.NotOk("该文件已经签名"); } - if (!await _systemDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId) || await _trialDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId && t.IsDeleted, true)) + if (!await _systemDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId) || await _systemDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId && t.IsDeleted, true)) { - return ResponseOutput.NotOk("文件已删除或者废除,签署失败!"); + return ResponseOutput.NotOk("文件已废除,签署失败!"); } + + await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id, IsDeleted = false, SystemDocumentId = userConfirmCommand.DocumentId }, true); } else @@ -539,9 +563,9 @@ namespace IRaCIS.Core.Application.Services return ResponseOutput.NotOk("该文件已经签名"); } - if (!await _trialDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId) || await _repository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId && t.IsDeleted, true)) + if (!await _trialDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId) || await _trialDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId && t.IsDeleted, true)) { - return ResponseOutput.NotOk("文件已删除或者废除,签署失败!"); + return ResponseOutput.NotOk("文件已废除,签署失败!"); } await _trialDocUserTypeConfirmedUserRepository.AddAsync(new TrialDocUserTypeConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id, IsDeleted = false, TrialDocumentId = userConfirmCommand.DocumentId }, true); diff --git a/IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs b/IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs index a9d71ae11..70cd25e2b 100644 --- a/IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs +++ b/IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs @@ -2,19 +2,19 @@ namespace IRaCIS.Core.Domain.Models { - public interface IAuditAdd where TKey: struct + public interface IAuditAdd where TKey : struct { - TKey CreateUserId { get; set; } - - DateTime CreateTime { get; set; } - + public TKey CreateUserId { get; set; } + + public DateTime CreateTime { get; set; } + } - public interface IAuditAdd: IAuditAdd + public interface IAuditAdd : IAuditAdd { - + } public interface IAuditAddWithUserName : IAuditAdd diff --git a/IRaCIS.Core.Domain/BaseModel/IAuditUpdate.cs b/IRaCIS.Core.Domain/BaseModel/IAuditUpdate.cs index ab9de6757..e154ccecc 100644 --- a/IRaCIS.Core.Domain/BaseModel/IAuditUpdate.cs +++ b/IRaCIS.Core.Domain/BaseModel/IAuditUpdate.cs @@ -4,9 +4,9 @@ namespace IRaCIS.Core.Domain.Models { public interface IAuditUpdate where TKey : struct { - TKey UpdateUserId { get; set; } + public TKey UpdateUserId { get; set; } //string UpdateUserName { get; set; } - DateTime UpdateTime { get; set; } + public DateTime UpdateTime { get; set; } } public interface IAuditUpdate : IAuditUpdate diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index e2c801df0..4fc835f33 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -127,7 +127,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common // 项目 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Trial))) { - + var entity = item.Entity as Trial; List trialDics = new List(); var dictionaryIds = new List(); @@ -298,7 +298,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common EMail = user.EMail, Phone = user.Phone, OrganizationName = user.OrganizationName, - + }); } @@ -344,7 +344,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common SiteAliasName = entity.TrialSite.TrialSiteAliasName, City = entity.Site.City, Country = entity.Site.Country, - + UserName = user.UserName, UserRealName = user.FullName, UserType = userType.UserTypeShortName, @@ -387,7 +387,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common Email = entity.Email, PreliminaryUser = entity.PreliminaryUser == null ? "" : entity.PreliminaryUser.LastName + " / " + entity.PreliminaryUser.FirstName, ReviewerUser = entity.ReviewerUser == null ? "" : entity.ReviewerUser.LastName + " / " + entity.ReviewerUser.FirstName, - + }); } @@ -463,7 +463,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common { var entity = item.Entity as NoneDicomStudy; var fileCount = await _dbContext.NoneDicomStudyFile.Where(x => x.NoneDicomStudyId == entity.Id).CountAsync(); - + await InsertInspection(item.Entity as NoneDicomStudy, type, x => new DataInspection() { @@ -507,7 +507,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common //一致性核查 // 特殊GeneralId foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(CheckChallengeDialog))) { - + var entity = item.Entity as CheckChallengeDialog; var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync(); subjectvisit = subjectvisit ?? new SubjectVisit(); @@ -529,7 +529,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common SubjectVisitName = subjectvisit.VisitName, BlindName = subjectvisit.BlindName, Reason = reason, - CreateTime=x.CreateTime, + CreateTime = x.CreateTime, }, new { CheckState = subjectvisit.CheckState, @@ -548,7 +548,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common { reason = entity.ManualPassReason; } - + var subjectCode = entity.Subject?.Code; await InsertInspection(item.Entity as SubjectVisit, type, x => new DataInspection() @@ -559,7 +559,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common SubjectVisitName = x.VisitName, BlindName = x.BlindName, Reason = reason, - },null, item.OriginalValues); + }, null, item.OriginalValues); } // 既往手术史 @@ -624,7 +624,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallenge))) { var entity = item.Entity as QCChallenge; - + var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync(); subjectvisit = subjectvisit ?? new SubjectVisit(); var content = string.Empty; @@ -661,7 +661,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common reason = entity.TalkContent.Substring(entity.TalkContent.LastIndexOf(':') + 1); break; } - + var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync(); var qCChallenge = await _dbContext.QCChallenge.Where(x => x.Id == entity.QCChallengeId).FirstOrDefaultAsync(); subjectvisit = subjectvisit ?? new SubjectVisit(); @@ -679,7 +679,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common }, new { AuditState = subjectvisit.AuditState, - + ReuploadEnum = qCChallenge.ReuploadEnum, Content = qCChallenge.Content, DeadlineTime = qCChallenge.DeadlineTime, @@ -688,7 +688,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } - + //Qc 问题 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCQuestion))) { @@ -706,7 +706,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common await InsertInspection(item.Entity as ConsistencyCheckFile, type, x => new DataInspection() { GeneralId = x.Id, - CreateTime=x.CreateTime, + CreateTime = x.CreateTime, }); } @@ -722,7 +722,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common await AddInspectionRecordAsync(new DataInspection() { SiteId = subjectVisit.SiteId, - Identification = $"{_userInfo.RequestUrl}/{ firstEntity.GetType().Name}/{type}", + Identification = $"{_userInfo.RequestUrl}/{firstEntity.GetType().Name}/{type}", SubjectId = subjectVisit.SubjectId, SubjectVisitName = subjectVisit.VisitName, TrialId = subjectVisit.TrialId, @@ -735,14 +735,14 @@ namespace IRaCIS.Core.Infra.EFCore.Common } else if (type == "Update") { - + var questionIds = entitylist.Where(x => x.SubjectVisitId == subjectVisit.Id).Select(x => x.Id).ToList(); var createUserId = entitylist.Select(x => x.CreateUserId).FirstOrDefault(); - var noUpdateData = _dbContext.TrialQCQuestionAnswer.Where(x => x.CreateUserId== createUserId&& x.SubjectVisitId == subjectVisit.Id && !questionIds.Contains(x.Id)).ToList(); + var noUpdateData = _dbContext.TrialQCQuestionAnswer.Where(x => x.CreateUserId == createUserId && x.SubjectVisitId == subjectVisit.Id && !questionIds.Contains(x.Id)).ToList(); entitylist.AddRange(noUpdateData); await AddInspectionRecordAsync(new DataInspection() { - Identification = $"{_userInfo.RequestUrl}/{ firstEntity.GetType().Name}/{type}", + Identification = $"{_userInfo.RequestUrl}/{firstEntity.GetType().Name}/{type}", SiteId = subjectVisit.SiteId, SubjectId = subjectVisit.SubjectId, TrialId = subjectVisit.TrialId, @@ -761,7 +761,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common var trialQCQuestionConfigureDatas = await _dbContext.TrialQCQuestionConfigure.Where(x => ids.Contains(x.Id)).ToListAsync(); var collect = questionAnswers.GroupJoin(trialQCQuestionConfigureDatas, one => one.TrialQCQuestionConfigureId, two => two.Id, (x, y) => new { one = x, two = y }) .SelectMany(a => a.two.DefaultIfEmpty(), (c, d) => new { c = c.one, d }) - .OrderBy(x=>x.d.ShowOrder) + .OrderBy(x => x.d.ShowOrder) .Select(o => new AnswerDto() { QuestionName = o.d.QuestionName, @@ -803,7 +803,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common /// 表达式 /// 其他对象 /// - public async Task InsertInspection(T data, string type, Expression> expression = null, object otherItem = null,object originaldata=null) where T : class + public async Task InsertInspection(T data, string type, Expression> expression = null, object otherItem = null, object originaldata = null) where T : class { object entityobj = data; DataInspection inspection = new DataInspection(); @@ -835,18 +835,18 @@ namespace IRaCIS.Core.Infra.EFCore.Common switch (_userInfo.RequestUrl.ToLower()) { case "nonedicomstudy/addorupdatenonedicomstudy": - type = type + "/("+ _userInfo.UserTypeShortName + ")"; + type = type + "/(" + _userInfo.UserTypeShortName + ")"; break; } break; case nameof(SystemBasicData): - entity = entityobj as SystemBasicData; + entity = entityobj as SystemBasicData; type = type + (entity.ParentId == null ? "/parent" : string.Empty); break; case nameof(Trial): entity = entityobj as Trial; Guid id = entity.Id; - Trial oldentity =await _dbContext.Trial.Where(x=>x.Id==id).FirstOrDefaultAsync(); + Trial oldentity = await _dbContext.Trial.Where(x => x.Id == id).FirstOrDefaultAsync(); switch (_userInfo.RequestUrl.ToLower()) { case "configtrialbasicinfo/configtrialbasicinfoconfirm": @@ -880,7 +880,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common break; } - inspection.Identification = $"{_userInfo.RequestUrl}/{ entityTypeName}/{type}"; + inspection.Identification = $"{_userInfo.RequestUrl}/{entityTypeName}/{type}"; #region 注释 //if (data != null) @@ -927,6 +927,31 @@ namespace IRaCIS.Core.Infra.EFCore.Common } } + /// + /// 将数据库实体属性,映射到稽查实体属性 避免重复赋值 + /// + /// + /// + public void EntityMapPropertyToAuditEntity(object data, DataInspection auditEntity) + { + foreach (var auditEntityPropertyInfo in auditEntity.GetType().GetProperties()) + { + var excepetNameList = typeof(Entity).GetProperties().Select(t => t.Name) + .Concat(typeof(ISoftDelete).GetProperties().Select(t => t.Name)) + .Concat(typeof(IAuditAdd<>).GetProperties().Select(t => t.Name)) + .Concat(typeof(IAuditUpdate<>).GetProperties().Select(t => t.Name)); + + var filterProperties = data.GetType().GetProperties().Where(t => !excepetNameList.Any(u=>u==t.Name)); + + if (filterProperties.Any(t => t.Name == auditEntityPropertyInfo.Name)) + { + var value = data.GetType().GetProperty(auditEntityPropertyInfo.Name).GetValue(data); + + auditEntity.GetType().GetProperty(auditEntityPropertyInfo.Name).SetValue(auditEntity, value); + } + } + } + /// /// 添加稽查 /// @@ -936,7 +961,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common /// public async Task AddInspectionRecordAsync(DataInspection add, object data, object otherItem = null) { - MapData(data, add); + //MapData(data, add); + + EntityMapPropertyToAuditEntity(data, add); + InspectionGeneralData generalData = new InspectionGeneralData() { CreateUserName = add.CreateUserName, @@ -1050,8 +1078,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common generalData.TrialName = trialdata.ExperimentName; } - - } #endregion @@ -1088,8 +1114,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common } } - - #endregion #region 访视