diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index d127d261..78789fad 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -913,6 +913,9 @@ namespace IRaCIS.Core.API.Controllers } + + + /// /// 上传文件( 不是医生个人的文件)[FileUpload] /// 例如:阅片章程等 diff --git a/IRaCIS.Core.API/_ServiceExtensions/NewtonsoftJson/JSONCustomDateConverter.cs b/IRaCIS.Core.API/_ServiceExtensions/NewtonsoftJson/JSONCustomDateConverter.cs new file mode 100644 index 00000000..15b7fa50 --- /dev/null +++ b/IRaCIS.Core.API/_ServiceExtensions/NewtonsoftJson/JSONCustomDateConverter.cs @@ -0,0 +1,46 @@ +using IRaCIS.Core.Domain.Share; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; + +namespace IRaCIS.Core.API +{ + public class JSONCustomDateConverter : DateTimeConverterBase + { + private TimeZoneInfo _timeZoneInfo; + private string _dateFormat; + + private IUserInfo _userInfo; + public JSONCustomDateConverter(string dateFormat, TimeZoneInfo timeZoneInfo, IUserInfo userInfo) + { + _dateFormat = dateFormat; + _timeZoneInfo = timeZoneInfo; + + _userInfo = userInfo; + } + + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + var timeZoneId = _userInfo.TimeZoneId; + + var needConvertUtcDateTime = Convert.ToDateTime(value); + + + var tz = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId); + + + var dateTimeOffset = new DateTimeOffset(needConvertUtcDateTime); + + var time = TimeZoneInfo.ConvertTimeFromUtc(needConvertUtcDateTime, tz).ToString(_dateFormat); + + writer.WriteValue(time); + writer.Flush(); + } + + } +} diff --git a/IRaCIS.Core.API/_ServiceExtensions/NewtonsoftJson/NewtonsoftJsonSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/NewtonsoftJson/NewtonsoftJsonSetup.cs index 0fcc5830..438e180b 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/NewtonsoftJson/NewtonsoftJsonSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/NewtonsoftJson/NewtonsoftJsonSetup.cs @@ -1,6 +1,7 @@  using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; +using Newtonsoft.Json.Converters; using System; namespace IRaCIS.Core.API @@ -22,6 +23,9 @@ namespace IRaCIS.Core.API // 设置时间格式 options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; + //options.SerializerSettings.Converters.Add(new JSONCustomDateConverter()) ; + + //IsoDateTimeConverter //options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; }) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index eaf13411..74213ed4 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -9942,16 +9942,6 @@ 删除项目计划某一项 废弃 - - - 保存协议- ack Sow [AUTH] - - - - - 删除协议 - - 修改项目医生的阅片类型 diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 8626eafd..0bfd8fe0 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -98,7 +98,7 @@ namespace IRaCIS.Core.Application.Service var trialReadingCriterionConfig = await _trialReadingCriterionRepository.Where(t => t.Id == confirmedTrialReadingCriterionId).Select(t => new { TrialReadingCriterionId = t.Id, t.ReadingTool, t.ReadingType, t.IsReadingTaskViewInOrder, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.FollowVisitAutoAssignDefaultState, t.TaskAllocateObjEnum, t.CriterionType }).FirstOrDefaultAsync(); //获取确认的临床数据配置 - var clinicalDataConfirmList = _trialClinicalDataSetRepository.Where(t => t.TrialId == trialId && t.IsConfirm).Include(t=>t.TrialClinicalDataSetCriteriaList).ToList(); + var clinicalDataConfirmList = _trialClinicalDataSetRepository.Where(t => t.TrialId == trialId && t.IsConfirm).Include(t => t.TrialClinicalDataSetCriteriaList).ToList(); var visitBlindConfig = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.BlindBaseLineName, t.BlindFollowUpPrefix }).FirstOrDefault(); @@ -207,7 +207,7 @@ namespace IRaCIS.Core.Application.Service } - + _provider.Set($"{trialId}_{StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt, TimeSpan.FromMinutes(30)); @@ -215,7 +215,7 @@ namespace IRaCIS.Core.Application.Service var defaultState = trialReadingCriterionConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated; - if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm1) && task1!=null) + if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm1) && task1 != null) { task1.TaskAllocationState = defaultState; //分配给对应Arm的人 @@ -225,7 +225,7 @@ namespace IRaCIS.Core.Application.Service task1.SuggesteFinishedTime = DateTime.Now.AddDays(7); } - if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm2) && task2!=null) + if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm2) && task2 != null) { task2.TaskAllocationState = defaultState; task2.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.DoubleReadingArm2).DoctorUserId; @@ -339,7 +339,7 @@ namespace IRaCIS.Core.Application.Service { return false; } - + var isClinicalDataSign = false; @@ -391,7 +391,7 @@ namespace IRaCIS.Core.Application.Service } - + return isClinicalDataSign; } @@ -621,12 +621,19 @@ namespace IRaCIS.Core.Application.Service else { var arm1 = visitGroup.FirstOrDefault(t => t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.DoctorUserId == null && t.ArmEnum == Arm.DoubleReadingArm1); + if (arm1 != null) { - arm1.TaskAllocationState = TaskAllocationState.Allocated; - arm1.AllocateTime = DateTime.Now; - arm1.DoctorUserId = task1.DoctorUserId; - arm1.SuggesteFinishedTime = DateTime.Now.AddDays(7); + + //有可能仅仅只分配了一个Subject 未分配 那么 + if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm1) && task1 != null) + { + arm1.TaskAllocationState = TaskAllocationState.Allocated; + arm1.AllocateTime = DateTime.Now; + arm1.DoctorUserId = task1.DoctorUserId; + arm1.SuggesteFinishedTime = DateTime.Now.AddDays(7); + } + } else { @@ -677,10 +684,15 @@ namespace IRaCIS.Core.Application.Service var arm2 = visitGroup.FirstOrDefault(t => t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.DoctorUserId == null && t.ArmEnum == Arm.DoubleReadingArm2); if (arm2 != null) { - arm2.TaskAllocationState = TaskAllocationState.Allocated; - arm2.AllocateTime = DateTime.Now; - arm2.DoctorUserId = task2.DoctorUserId; - arm2.SuggesteFinishedTime = DateTime.Now.AddDays(7); + //有可能仅仅只分配了一个Subject + if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm2) && task2 != null) + { + arm2.TaskAllocationState = TaskAllocationState.Allocated; + arm2.AllocateTime = DateTime.Now; + arm2.DoctorUserId = task2.DoctorUserId; + arm2.SuggesteFinishedTime = DateTime.Now.AddDays(7); + } + } else { diff --git a/IRaCIS.Core.Application/Service/Doctor/DTO/AttachmentModel.cs b/IRaCIS.Core.Application/Service/Doctor/DTO/AttachmentModel.cs index 7cce4330..1eb34fc0 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DTO/AttachmentModel.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DTO/AttachmentModel.cs @@ -26,6 +26,9 @@ } + + + public class TrialSOWPathDTO { public Guid TrialId { get; set; } diff --git a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs index be08159d..cc3666dc 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs @@ -691,6 +691,12 @@ namespace IRaCIS.Application.Contracts { public Guid? Id { get; set; } + public Guid? TrialId { get; set; } + + public Guid? TrialReadingCriterionId { get; set; } + + public string CriterionName { get; set; } + public bool IsEnable { get; set; } = true; /// @@ -772,6 +778,9 @@ namespace IRaCIS.Application.Contracts /// CreateTime /// public DateTime CreateTime { get; set; } + + + } public class GetDoctorCriterionFileInDto diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs index eb2d01d0..1244af69 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs @@ -72,7 +72,7 @@ namespace IRaCIS.Application.Services { return ResponseOutput.NotOk("The current phone number already existed!", new DoctorBasicInfoCommand()); } - + if (await _doctorRepository.AnyAsync(t => t.EMail == doctor.EMail)) { return ResponseOutput.NotOk("The current email already existed!", new DoctorBasicInfoCommand()); @@ -80,7 +80,7 @@ namespace IRaCIS.Application.Services doctor.Code = (await _doctorRepository.MaxAsync(t => t.Code)) + 1; - doctor.ReviewerCode = AppSettings.GetCodeStr(doctor.Code,nameof(Doctor)) ; + doctor.ReviewerCode = AppSettings.GetCodeStr(doctor.Code, nameof(Doctor)); doctor.Password = MD5Helper.Md5(doctor.Phone); @@ -103,7 +103,7 @@ namespace IRaCIS.Application.Services var updateModel = basicInfoModel; var phone = updateModel.Phone.Trim(); - if ((await _doctorRepository.FirstOrDefaultAsync(t => t.Phone == phone && t.Id != updateModel.Id) )!= null) + if ((await _doctorRepository.FirstOrDefaultAsync(t => t.Phone == phone && t.Id != updateModel.Id)) != null) { return ResponseOutput.NotOk("The current phone number already existed!", new DoctorBasicInfoCommand()); } @@ -116,10 +116,10 @@ namespace IRaCIS.Application.Services var doctor = await _doctorRepository.FirstOrDefaultAsync(t => t.Id == updateModel.Id).IfNullThrowException(); //删除中间表 Title对应的记录 - await _repository.BatchDeleteAsync(t => t.DoctorId == updateModel.Id && t.KeyName == StaticData.Title); - + await _repository.BatchDeleteAsync(t => t.DoctorId == updateModel.Id && t.KeyName == StaticData.Title); - var adddata=new List(); + + var adddata = new List(); //重新插入新的 Title记录 updateModel.TitleIds.ForEach(titleId => adddata.Add(new DoctorDictionary() { DoctorId = updateModel.Id.Value, KeyName = StaticData.Title, DictionaryId = titleId })); @@ -284,7 +284,7 @@ namespace IRaCIS.Application.Services } [HttpPost] - + public async Task UpdateEmploymentInfo(EmploymentCommand doctorWorkInfoModel) { #region 废弃 @@ -314,7 +314,7 @@ namespace IRaCIS.Application.Services //_mapper.Map(doctorWorkInfoModel, doctor); //var success = _doctorRepository.SaveChanges(); #endregion - + var entity = await _repository.InsertOrUpdateAsync(doctorWorkInfoModel, true); @@ -369,7 +369,7 @@ namespace IRaCIS.Application.Services return test; } - + [HttpPost] public async Task UpdateSpecialtyInfo(SpecialtyCommand specialtyUpdateModel) { @@ -421,7 +421,7 @@ namespace IRaCIS.Application.Services #endregion #region 简历审核 - + [HttpPost] public async Task UpdateAuditResume(ResumeConfirmCommand auditResumeParam) { @@ -441,8 +441,8 @@ namespace IRaCIS.Application.Services ReviewStatus = auditResumeParam.ReviewStatus, AcceptingNewTrial = auditResumeParam.AcceptingNewTrial, ActivelyReading = auditResumeParam.ActivelyReading, - IsVirtual=auditResumeParam.IsVirtual, - BlindName=auditResumeParam.BlindName, + IsVirtual = auditResumeParam.IsVirtual, + BlindName = auditResumeParam.BlindName, BlindNameCN = auditResumeParam.BlindNameCN, BlindPublications = auditResumeParam.BlindPublications, AuditTime = DateTime.Now, @@ -479,11 +479,22 @@ namespace IRaCIS.Application.Services public async Task AddDoctorCriterionFile(AddDoctorCriterionFileDto inDto) { - if (await _doctorCriterionFileRepository.AnyAsync(x =>inDto.IsEnable&& x.DoctorId == inDto.DoctorId && x.FileType == inDto.FileType && x.IsEnable && x.CriterionType == inDto.CriterionType && x.Id != inDto.Id)) + if (await _doctorCriterionFileRepository.AnyAsync(x => inDto.IsEnable && x.DoctorId == inDto.DoctorId && x.FileType == inDto.FileType && x.TrialId==inDto.TrialId &&x.TrialReadingCriterionId==inDto.TrialReadingCriterionId && x.IsEnable && x.CriterionType == inDto.CriterionType && x.Id != inDto.Id)) { throw new BusinessValidationFailedException("当前标准已添加过此类型文件"); } - var entity = await _doctorCriterionFileRepository.InsertOrUpdateAsync(inDto, true); + + + var entity = await _doctorCriterionFileRepository.InsertOrUpdateAsync(inDto); + + if (inDto.TrialId != null) + { + entity.Remark = await _trialRepository.Where(t => t.Id == inDto.TrialId).Select(t => t.TrialCode).FirstOrDefaultAsync(); + } + + + await _doctorCriterionFileRepository.SaveChangesAsync(); + return ResponseOutput.Ok(entity.Id.ToString()); } @@ -523,7 +534,7 @@ namespace IRaCIS.Application.Services var doctor = (await _doctorRepository .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(t => t.Id == doctorId)).IfNullThrowException(); - doctor.InHoliday = (await _repository.CountAsync(x=>x.DoctorId==doctorId&&x.EndDate<=DateTime.Now&&x.StartDate<=DateTime.Now)) > 0; + doctor.InHoliday = (await _repository.CountAsync(x => x.DoctorId == doctorId && x.EndDate <= DateTime.Now && x.StartDate <= DateTime.Now)) > 0; return doctor; } diff --git a/IRaCIS.Core.Application/Service/Management/MenuService.cs b/IRaCIS.Core.Application/Service/Management/MenuService.cs index e0c24926..51fa9e2f 100644 --- a/IRaCIS.Core.Application/Service/Management/MenuService.cs +++ b/IRaCIS.Core.Application/Service/Management/MenuService.cs @@ -1,5 +1,6 @@ using IRaCIS.Application.Contracts; using IRaCIS.Core.Infra.EFCore; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace IRaCIS.Application.Services @@ -164,6 +165,7 @@ namespace IRaCIS.Application.Services } + [AllowAnonymous] public async Task> GetUserMenuTree() { @@ -182,7 +184,7 @@ namespace IRaCIS.Application.Services return list; } - + [AllowAnonymous] public async Task> GetUserPermissions() { diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs index d19f2d90..b19c44a8 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs @@ -874,7 +874,7 @@ namespace IRaCIS.Core.Application EnrollStatus = EnrollStatus.Finished }); - await _trialRepository.BatchUpdateNoTrackingAsync(u => u.Id == trialId, s => new Trial { TrialFinishedTime = DateTime.UtcNow.AddHours(8) }); + await _trialRepository.BatchUpdateNoTrackingAsync(u => u.Id == trialId, s => new Trial { TrialFinishedTime = DateTime.Now }); } diff --git a/IRaCIS.Core.Application/Service/WorkLoad/DTO/DoctorWorkLoadViewModel.cs b/IRaCIS.Core.Application/Service/WorkLoad/DTO/DoctorWorkLoadViewModel.cs index 056058ec..0fa52a4e 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/DTO/DoctorWorkLoadViewModel.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/DTO/DoctorWorkLoadViewModel.cs @@ -281,11 +281,16 @@ namespace IRaCIS.Application.Contracts new CriterionReadingCategory() { EnrollId = EnrollId, - PendingCount= ReadingTaskStateList.Where(x=>x.ReadingTaskState != ReadingTaskState.HaveSigned&&x.CriterionType== t.CriterionType).Count(), - ComplectedCount = ReadingTaskStateList.Where(x => x.ReadingTaskState == ReadingTaskState.HaveSigned && x.CriterionType == t.CriterionType).Count(), - TotalCount = ReadingTaskStateList.Where(x => x.CriterionType == t.CriterionType).Count(), - StatementCriterionFileList = CriterionFileList.Where(x=>x.CriterionType==t.CriterionType&&x.FileType==CriterionFileType.Statement).ToList(), - AcknowledgementCriterionFileList = CriterionFileList.Where(x => x.CriterionType == t.CriterionType && x.FileType == CriterionFileType.Acknowledgement).ToList(), + PendingCount= ReadingTaskStateList.Where(x=>x.ReadingTaskState != ReadingTaskState.HaveSigned&& x.TrialReadingCriterionId == t.TrialReadingCriterionId).Count(), + + ComplectedCount = ReadingTaskStateList.Where(x => x.ReadingTaskState == ReadingTaskState.HaveSigned && x.TrialReadingCriterionId == t.TrialReadingCriterionId).Count(), + + TotalCount = ReadingTaskStateList.Where(x => x.TrialReadingCriterionId == t.TrialReadingCriterionId) .Count(), + + StatementCriterionFileList = CriterionFileList.Where(x=>x.CriterionType==t.CriterionType&&x.FileType==CriterionFileType.Statement) + .WhereIf(t.CriterionType == CriterionType.SelfDefine, x => x.TrialReadingCriterionId == t.TrialReadingCriterionId).ToList(), + AcknowledgementCriterionFileList = CriterionFileList.Where(x => x.CriterionType == t.CriterionType && x.FileType == CriterionFileType.Acknowledgement) + .WhereIf(t.CriterionType == CriterionType.SelfDefine, x => x.TrialReadingCriterionId == t.TrialReadingCriterionId).ToList(), TrialReadingCriterionId = t.TrialReadingCriterionId, ReadingCategorys = CriterionReadingCategoryList.Where(c => c.TrialReadingCriterionId == t.TrialReadingCriterionId).Select(t => t.ReadingCategory).OrderBy(c => c).ToList() }).ToList(); @@ -305,6 +310,8 @@ namespace IRaCIS.Application.Contracts public ReadingTaskState ReadingTaskState { get; set; } public CriterionType? CriterionType { get; set; } + + public Guid TrialReadingCriterionId { get; set; } } public class TrialReadingCriterionDto @@ -340,11 +347,11 @@ namespace IRaCIS.Application.Contracts public Guid Id { get; set; } - + public Guid? TrialReadingCriterionId { get; set; } /// /// 文件名称 /// - public string FileName { get; set; } + public string FileName { get; set; } /// /// 文件路径 diff --git a/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs b/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs index 4b020c7e..38a259d4 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs @@ -50,53 +50,63 @@ namespace IRaCIS.Application.Services } #region 入组工作量统计列表 具体详情 增删改查相关 上传\删除协议 - /// - /// 保存协议- ack Sow [AUTH] - /// - [HttpPost("{trialId}")] - - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] - [Authorize(Policy = IRaCISPolicy.PM_APM)] - public async Task UploadReviewerAckSOW(Guid trialId, - ReviewerAckDTO attachmentViewModel) - { - - var intoGroupItem = (await _enrollRepository.Where(t => t.TrialId == trialId && t.DoctorId == attachmentViewModel.DoctorId).FirstOrDefaultAsync()).IfNullThrowException(); - if (attachmentViewModel.Id != Guid.Empty) - { - await _attachmentRepository.BatchDeleteNoTrackingAsync(t => t.Id == attachmentViewModel.Id); - } + #region 协议废弃 + ///// + ///// 保存协议- ack Sow [AUTH] + ///// + //[HttpPost("{trialId}")] - var attachment = await _attachmentRepository.InsertFromDTOAsync(attachmentViewModel); + //[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + //[Authorize(Policy = IRaCISPolicy.PM_APM)] + //public async Task UploadReviewerAckSOW(Guid trialId, + // ReviewerAckDTO attachmentViewModel) + //{ - //intoGroupItem.AttachmentId = attachment.Id; - await _enrollRepository.UpdatePartialFromQueryAsync(intoGroupItem.Id, u => new Enroll() { AttachmentId = attachment.Id }); + // var intoGroupItem = (await _enrollRepository.Where(t => t.TrialId == trialId && t.DoctorId == attachmentViewModel.DoctorId).FirstOrDefaultAsync()).IfNullThrowException(); - var success = await _enrollRepository.SaveChangesAsync(); + // if (attachmentViewModel.Id != Guid.Empty) + // { + // await _attachmentRepository.BatchDeleteNoTrackingAsync(t => t.Id == attachmentViewModel.Id); + // } + + // var attachment = await _attachmentRepository.InsertFromDTOAsync(attachmentViewModel); + + // //intoGroupItem.AttachmentId = attachment.Id; + // await _enrollRepository.UpdatePartialFromQueryAsync(intoGroupItem.Id, u => new Enroll() { AttachmentId = attachment.Id }); + + + // var success = await _enrollRepository.SaveChangesAsync(); + + // return ResponseOutput.Result(success, attachment.Id.ToString()); + //} + + ///// + ///// 删除协议 + ///// + //[HttpDelete, Route("{trialId}/{doctorId}/{attachmentId}")] + + //[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + //[Authorize(Policy = IRaCISPolicy.PM_APM)] + //public async Task DeleteReviewerAckSOW(Guid trialId, Guid doctorId, Guid attachmentId) + //{ + // var success1 = await _attachmentRepository.BatchDeleteNoTrackingAsync(a => a.Id == attachmentId); + // await _enrollRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.DoctorId == doctorId, u => + // new Enroll() + // { + // AttachmentId = Guid.Empty + // }, true); + // return ResponseOutput.Ok(success1); + //} + + + + #endregion - return ResponseOutput.Result(success, attachment.Id.ToString()); - } - /// - /// 删除协议 - /// - [HttpDelete, Route("{trialId}/{doctorId}/{attachmentId}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] - [Authorize(Policy = IRaCISPolicy.PM_APM)] - public async Task DeleteReviewerAckSOW(Guid trialId, Guid doctorId, Guid attachmentId) - { - var success1 = await _attachmentRepository.BatchDeleteNoTrackingAsync(a => a.Id == attachmentId); - await _enrollRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.DoctorId == doctorId, u => - new Enroll() - { - AttachmentId = Guid.Empty - }, true); - return ResponseOutput.Ok(success1); - } /// /// 修改项目医生的阅片类型 @@ -207,22 +217,31 @@ namespace IRaCIS.Application.Services IsEnable = allocateRule.IsEnable, TrialReadingCriterionList = intoGroup.Trial.ReadingQuestionCriterionTrialList.Where(t=>t.IsConfirm).Select(t=>new TrialReadingCriterionDto() { TrialReadingCriterionId=t.Id,TrialReadingCriterionName=t.CriterionName,CriterionType=t.CriterionType,IsOncologyReading=t.IsOncologyReading,IsArbitrationReading=t.IsArbitrationReading,IsGlobalReading=t.IsGlobalReading,ReadingInfoSignTime=t.ReadingInfoSignTime,ReadingType=t.ReadingType}).ToList(), - CriterionFileList= doctor.CriterionFileList.Where(x=>x.IsEnable).Select(x=> new CriterionFile() { - CriterionType=x.CriterionType, - DoctorId=x.DoctorId, - FileName=x.FileName, - FilePath=x.FilePath, - FileType=x.FileType, - Remark=x.Remark, - Id=x.Id - }).ToList(), + + + CriterionReadingCategoryList =intoGroup.EnrollReadingCategoryList.Select(t=>new TrialCriterionReadingCategory() { EnrollId=t.EnrollId,ReadingCategory=t.ReadingCategory, TrialReadingCriterionId = t.TrialReadingCriterionId }).ToList(), - - ReadingTaskStateList=doctor.User.VisitTaskList.Where(x=>x.TaskState==TaskState.Effect&&x.TrialId== trialId).Select(x=> new DoctorUserTask() { - ReadingTaskState= x.ReadingTaskState, - CriterionType=x.TrialReadingCriterion.CriterionType, + + CriterionFileList = doctor.CriterionFileList.Where(x => x.IsEnable && (x.TrialId==null ||x.TrialId==trialId)).Select(x => new CriterionFile() + { + CriterionType = x.CriterionType, + DoctorId = x.DoctorId, + FileName = x.FileName, + FilePath = x.FilePath, + FileType = x.FileType, + Remark = x.Remark, + TrialReadingCriterionId=x.TrialReadingCriterionId, + Id = x.Id + }).ToList(), + + ReadingTaskStateList = doctor.User.VisitTaskList.Where(x => x.TaskState == TaskState.Effect && x.TrialId == trialId).Select(x => new DoctorUserTask() + { + ReadingTaskState = x.ReadingTaskState, + TrialReadingCriterionId=x.TrialReadingCriterionId, + CriterionType = x.TrialReadingCriterion.CriterionType, }).ToList(), + DoctorId = doctor.Id, Code = doctor.ReviewerCode, FirstName = doctor.FirstName, diff --git a/IRaCIS.Core.Application/Service/WorkLoad/Interface/IDoctorWorkloadService.cs b/IRaCIS.Core.Application/Service/WorkLoad/Interface/IDoctorWorkloadService.cs index 7af152ad..b3972e41 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/Interface/IDoctorWorkloadService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/Interface/IDoctorWorkloadService.cs @@ -5,14 +5,14 @@ namespace IRaCIS.Application.Services public interface IDoctorWorkloadService { Task AddOrUpdateWorkload(WorkloadCommand workLoadAddOrUpdateModel, Guid userId); - Task DeleteReviewerAckSOW(Guid trialId, Guid doctorId, Guid attachmentId); + //Task DeleteReviewerAckSOW(Guid trialId, Guid doctorId, Guid attachmentId); Task DeleteWorkload(Guid workloadId); PageOutput GetEnrollmentWorkloadStatsDetail(WorkLoadStatsQueryDTO workLoadSearch); Task> GetReviewerWorkLoadListDetail(WorkLoadDetailQueryDTO workLoadSearch); Task> GetTrialEnrollmentWorkloadStats(WorkLoadDoctorQueryDTO doctorSearchModel); Task GetWorkloadDetailById(Guid id); Task UpdateReviewerReadingType(Guid trialId, Guid doctorId, int type); - Task UploadReviewerAckSOW(Guid trialId, ReviewerAckDTO attachmentViewModel); + //Task UploadReviewerAckSOW(Guid trialId, ReviewerAckDTO attachmentViewModel); Task> WorkloadExist(WorkloadExistQueryDTO param); } } \ No newline at end of file diff --git a/IRaCIS.Core.Domain.Share/AuthUser/IUserInfo.cs b/IRaCIS.Core.Domain.Share/AuthUser/IUserInfo.cs index 1d9e5668..eb4448ce 100644 --- a/IRaCIS.Core.Domain.Share/AuthUser/IUserInfo.cs +++ b/IRaCIS.Core.Domain.Share/AuthUser/IUserInfo.cs @@ -23,7 +23,7 @@ namespace IRaCIS.Core.Domain.Share string RealName { get; } string ReviewerCode { get; } - bool IsAdmin { get; } + bool IsAdmin { get; } bool IsTestUser { get; } @@ -31,9 +31,9 @@ namespace IRaCIS.Core.Domain.Share string UserTypeEnumStr { get; } - int UserTypeEnumInt { get; } + int UserTypeEnumInt { get; } - Guid UserTypeId { get; } + Guid UserTypeId { get; } string UserToken { get; } @@ -43,13 +43,18 @@ namespace IRaCIS.Core.Domain.Share string LocalIp { get; } - bool IsEn_Us { get; } + bool IsEn_Us { get; } string RequestUrl { get; } - Guid? SignId { get; set; } + Guid? SignId { get; set; } Guid? BatchId { get; set; } - + + + /// + /// 字符串形式 标识时区 + /// + string TimeZoneId { get; } } } diff --git a/IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs b/IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs index 94d83f80..890033cd 100644 --- a/IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs +++ b/IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs @@ -266,6 +266,23 @@ namespace IRaCIS.Core.Domain.Share } } + public string TimeZoneId + { + + get + { + var timeZoneId = _accessor?.HttpContext?.Request?.Headers["TimeZoneId"]; + + if (timeZoneId is not null && !string.IsNullOrEmpty(timeZoneId.Value)) + { + return timeZoneId.Value; + } + return "Asia/Shanghai"; + + + } + } + public Guid? SignId { diff --git a/IRaCIS.Core.Domain/Dcotor/DoctorCriterionFile.cs b/IRaCIS.Core.Domain/Dcotor/DoctorCriterionFile.cs index 47fa4c0b..84baafcf 100644 --- a/IRaCIS.Core.Domain/Dcotor/DoctorCriterionFile.cs +++ b/IRaCIS.Core.Domain/Dcotor/DoctorCriterionFile.cs @@ -65,6 +65,11 @@ namespace IRaCIS.Core.Domain.Models [ForeignKey("DoctorId")] public Doctor Doctor { get; set; } + public string CriterionName { get; set; } + public Guid? TrialReadingCriterionId { get; set; } + public Guid? TrialId { get; set; } + + } diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index a29dd95a..23c7ade6 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -113,26 +113,39 @@ namespace IRaCIS.Core.Infra.EFCore.Common var type = GetEntityAuditOpt(item); var entity = item.Entity as Trial; - List trialDics = new List(); - var dictionaryIds = new List(); - if (entity.TrialDicList == null || entity.TrialDicList.Count == 0) - { - dictionaryIds = await this._dbContext.TrialDictionary.Where(x => x.TrialId == entity.Id && x.KeyName == "Criterion").Select(x => x.DictionaryId).ToListAsync(); - } - else - { - dictionaryIds = entity.TrialDicList.Select(x => x.DictionaryId).ToList(); - } - trialDics = await this._dbContext.Dictionary.Where(x => dictionaryIds.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync(); + //阅片标准 + var criterionNameList = await _dbContext.ReadingQuestionCriterionTrial.Where(t => t.TrialId == entity.Id && t.IsConfirm).OrderBy(t => t.ShowOrder).Select(t => t.CriterionName).ToListAsync(); + + //临床数据配置 + var clinicalDataSetNameList = await _dbContext.ClinicalDataTrialSet.Where(t => t.TrialId == entity.Id && t.IsConfirm).Select(t => t.ClinicalDataSetName).ToListAsync(); + + + + //List trialDics = new List(); + //var dictionaryIds = new List(); + //if (entity.TrialDicList == null || entity.TrialDicList.Count == 0) + //{ + // dictionaryIds = await this._dbContext.TrialDictionary.Where(x => x.TrialId == entity.Id && x.KeyName == "Criterion").Select(x => x.DictionaryId).ToListAsync(); + //} + //else + //{ + // dictionaryIds = entity.TrialDicList.Select(x => x.DictionaryId).ToList(); + //} + //trialDics = await this._dbContext.Dictionary.Where(x => dictionaryIds.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync(); await InsertInspection(item.Entity as Trial, type, x => new InspectionConvertDTO() { TrialId = x.Id, }, new { - TrialDicList = string.Join(",", trialDics) - }); + //TrialDicList = string.Join(",", trialDics) + + CriterionNames = criterionNameList.Count() > 0? string.Join(",", criterionNameList):string.Empty, + + ClinicalDataSetNames = clinicalDataSetNameList.Count() > 0 ? string.Join(",", clinicalDataSetNameList):String.Empty, + + }); ; } @@ -183,7 +196,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common var isDistinctionInterface = false; //设置项目配置 肿瘤学配置 和阅片标准配置 - if (_userInfo.RequestUrl == "TrialConfig/setOncologySet" || _userInfo.RequestUrl == "TrialConfig/setTrialReadingCriterion"|| _userInfo.RequestUrl== "configTrialBasicInfo/ConfigTrialProcessInfoConfirm") + if (_userInfo.RequestUrl == "TrialConfig/setOncologySet" || _userInfo.RequestUrl == "TrialConfig/setTrialReadingCriterion" || _userInfo.RequestUrl == "configTrialBasicInfo/ConfigTrialProcessInfoConfirm" + ) { isDistinctionInterface = true; } @@ -191,7 +205,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common //同步的数据 后面加"/Auto" 因为同步的地方可能会改 所以取反 var extraIdentification = string.Empty; - if (_userInfo.RequestUrl!= "ReadingQuestion/addOrUpdateReadingQuestionCriterionTrial" && type==AuditOpt.Add) + if (_userInfo.RequestUrl != "ReadingQuestion/addOrUpdateReadingQuestionCriterionTrial" && type == AuditOpt.Add) { extraIdentification = "/Auto"; } @@ -205,7 +219,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common ObjectRelationParentId = x.TrialId, - ExtraIndentification=extraIdentification + ExtraIndentification = extraIdentification }); } @@ -287,7 +301,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common ObjectRelationParentId = x.TrialId, - ExtraIndentification=extraIdentification + ExtraIndentification = extraIdentification }, new { ParentQuestionShowOrder = parentQuestionShowOrder, RelavantQuestionShowOrder = relavantQuestionShowOrder }); } @@ -369,7 +383,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common ObjectRelationParentId = x.TrialId, - ExtraIndentification=extraIdentification + ExtraIndentification = extraIdentification }, new { ParentQuestionShowOrder = parentQuestionShowOrder, RelavantQuestionShowOrder = relavantQuestionShowOrder, DependQuestionShowOrder = dependQuestionShowOrder }); } @@ -403,7 +417,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common var extraIdentification = string.Empty; //同步添加 - if (_userInfo.RequestUrl != "OrganInfo/batchAddTrialOrgan" && organTrialEntityEnrtyList.Any( t=>GetEntityAuditOpt(t) == AuditOpt.Add) ) + if (_userInfo.RequestUrl != "OrganInfo/batchAddTrialOrgan" && organTrialEntityEnrtyList.Any(t => GetEntityAuditOpt(t) == AuditOpt.Add)) { extraIdentification = "/Auto"; @@ -439,7 +453,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common { QuestionAnswerList = list.Join(organList, t => t.OrganInfoId, u => u.Id, (t, u) => u).OrderBy(t => t.ShowOrder).ToList(), }); - + } else { @@ -483,7 +497,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common { extraIdentification = "/IsTrial"; - if(_userInfo.RequestUrl!= "OrganInfo/addOrUpdateCriterionNidus" && type==AuditOpt.Add) + if (_userInfo.RequestUrl != "OrganInfo/addOrUpdateCriterionNidus" && type == AuditOpt.Add) { extraIdentification = "/IsTrial/Auto"; } @@ -499,9 +513,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common TrialReadingCriterionId = entity.IsSystemCriterion == false ? entity.CriterionId : null, - ExtraIndentification=extraIdentification + ExtraIndentification = extraIdentification + - }); } @@ -572,7 +586,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common //不显示区分接口 通过是否是系统字典 以及字典Code 区分 IsDistinctionInterface = false, - ExtraIndentification=extraIdentification + ExtraIndentification = extraIdentification }, new @@ -697,7 +711,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common var extraIdentification = string.Empty; //失效的时候 不区分标识 - if (_userInfo.UserTypeEnumInt==(int)UserTypeEnum.MIM) + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.MIM) { extraIdentification = $"/MIM"; } @@ -713,7 +727,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common ObjectRelationParentId = entity.TaskMedicalReviewId, - ExtraIndentification=extraIdentification + ExtraIndentification = extraIdentification }); } @@ -730,7 +744,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common var extraIdentification = string.Empty; //失效的时候 不区分标识 - if (_dbContext.Entry(entity).Property(t => t.IsInvalid).IsModified == true && entity.IsInvalid==true) + if (_dbContext.Entry(entity).Property(t => t.IsInvalid).IsModified == true && entity.IsInvalid == true) { extraIdentification = $"/Invalid"; } @@ -745,7 +759,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common ExtraIndentification = extraIdentification, - IsDistinctionInterface= (type==AuditOpt.Add || extraIdentification !=String.Empty)?false:true + IsDistinctionInterface = (type == AuditOpt.Add || extraIdentification != String.Empty) ? false : true }); } @@ -1547,7 +1561,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common { IsDistinctionInterface = false, ObjectRelationParentId = entity.TrialId, - ExtraIndentification=extraIdentification, + ExtraIndentification = extraIdentification, }); } @@ -1989,11 +2003,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common QuestionId = u.ReadingQuestionTrialId, u.Answer }).ToListAsync(); - + var obj = new { - TaskBlindName=visitAnswerList.Select(t=>t.TaskBlindName).FirstOrDefault(), + TaskBlindName = visitAnswerList.Select(t => t.TaskBlindName).FirstOrDefault(), VisitQuestionAnswerList = visitAnswerList.Join(quesionList, t => t.QuestionId, u => u.QuestionId, (t, u) => new { t.Answer, u.QuestionName, u.DictionaryCode, u.ShowOrder }).OrderBy(t => t.ShowOrder).ToList(), Reason = group.Where(t => t.QuestionId == null && t.GlobalAnswerType == GlobalAnswerType.Reason).FirstOrDefault()?.Answer, AgreeOrNot = group.Where(t => t.QuestionId == null && t.GlobalAnswerType == GlobalAnswerType.AgreeOrNot).FirstOrDefault()?.Answer, @@ -2038,7 +2052,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common VisitTaskId = x.GlobalTaskId, TrialReadingCriterionId = trialReadingCriterionId, ObjectRelationParentId = x.TaskId, - }, new { GlobalAnswerList = objList } ); + }, new { GlobalAnswerList = objList }); } @@ -2097,14 +2111,14 @@ namespace IRaCIS.Core.Infra.EFCore.Common { var visitTaskNum = entity.VisitTaskNum - ReadingCommon.TaskNumDic[ReadingCategory.Judge]; - var list = await _dbContext.VisitTask.Where(t => t.TaskState == TaskState.Effect && t.SubjectId == entity.SubjectId && t.VisitTaskNum == visitTaskNum && t.JudgeVisitTaskId==entity.Id && t.TrialReadingCriterionId==entity.TrialReadingCriterionId).Select(t => new { t.Id, t.DoctorUser.FullName, t.ArmEnum }).OrderBy(t => t.ArmEnum).ToListAsync(); + var list = await _dbContext.VisitTask.Where(t => t.TaskState == TaskState.Effect && t.SubjectId == entity.SubjectId && t.VisitTaskNum == visitTaskNum && t.JudgeVisitTaskId == entity.Id && t.TrialReadingCriterionId == entity.TrialReadingCriterionId).Select(t => new { t.Id, t.DoctorUser.FullName, t.ArmEnum }).OrderBy(t => t.ArmEnum).ToListAsync(); var r1 = list.Where(t => t.ArmEnum == Arm.DoubleReadingArm1).FirstOrDefault(); var r2 = list.Where(t => t.ArmEnum == Arm.DoubleReadingArm2).FirstOrDefault(); - obj = new { R1 = r1.FullName, R2 = r2.FullName, SelectResult = r1.Id== entity.JudgeResultTaskId ? "R1":"R2" }; + obj = new { R1 = r1.FullName, R2 = r2.FullName, SelectResult = r1.Id == entity.JudgeResultTaskId ? "R1" : "R2" }; } #region 通过链接跳转 2022 12-19 @@ -2708,20 +2722,20 @@ namespace IRaCIS.Core.Infra.EFCore.Common } break; - #endregion + #endregion - ////标准 器官病灶表 - //case nameof(CriterionNidus): + ////标准 器官病灶表 + //case nameof(CriterionNidus): - // var criterionNidus = entityObj as CriterionNidus; + // var criterionNidus = entityObj as CriterionNidus; - // if (criterionNidus.IsSystemCriterion == false) - // { - // type = type + "/IsTrial"; - // } + // if (criterionNidus.IsSystemCriterion == false) + // { + // type = type + "/IsTrial"; + // } - // break; + // break; ////系统 项目公用 //case nameof(ReadingCriterionDictionary): diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 94bc0377..e8f53b7c 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -501,7 +501,7 @@ namespace IRaCIS.Core.Infra.EFCore await auditingData.InsertAddEntitys(entities); } - + } @@ -529,7 +529,7 @@ namespace IRaCIS.Core.Infra.EFCore if (t.Entity is IAuditUpdate updateEntity1) { - updateEntity1.UpdateTime = DateTime.UtcNow.AddHours(8); + updateEntity1.UpdateTime = DateTime.Now; updateEntity1.UpdateUserId = _userInfo.Id; } @@ -538,7 +538,7 @@ namespace IRaCIS.Core.Infra.EFCore if (softDelete.IsDeleted) { softDelete.DeleteUserId = _userInfo.Id; - softDelete.DeletedTime = DateTime.UtcNow.AddHours(8); + softDelete.DeletedTime = DateTime.Now; } else { @@ -555,7 +555,7 @@ namespace IRaCIS.Core.Infra.EFCore { if (addEntity.CreateTime == default(DateTime)) { - addEntity.CreateTime = DateTime.UtcNow.AddHours(8); + addEntity.CreateTime = DateTime.Now; } addEntity.CreateUserId = _userInfo.Id; @@ -563,7 +563,7 @@ namespace IRaCIS.Core.Infra.EFCore if (t.Entity is IAuditUpdate updateEntity) { - updateEntity.UpdateTime = DateTime.UtcNow.AddHours(8); + updateEntity.UpdateTime = DateTime.Now; updateEntity.UpdateUserId = _userInfo.Id; } @@ -571,7 +571,7 @@ namespace IRaCIS.Core.Infra.EFCore { if (addEntity3.CreateTime == default(DateTime)) { - addEntity3.CreateTime = DateTime.UtcNow.AddHours(8); + addEntity3.CreateTime = DateTime.Now; } diff --git a/IRaCIS.Core.Infra.EFCore/Context/Triggers/AuditAddTrigger.cs b/IRaCIS.Core.Infra.EFCore/Context/Triggers/AuditAddTrigger.cs index 917c0ee5..6b297847 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/Triggers/AuditAddTrigger.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/Triggers/AuditAddTrigger.cs @@ -24,7 +24,7 @@ // if (context.Entity.CreateTime == default(DateTime)) // { -// context.Entity.CreateTime = DateTime.UtcNow.AddHours(8); +// context.Entity.CreateTime = DateTime.Now; // } @@ -53,7 +53,7 @@ // if (context.Entity.CreateTime == default(DateTime)) // { -// context.Entity.CreateTime = DateTime.UtcNow.AddHours(8); +// context.Entity.CreateTime = DateTime.Now; // } // } diff --git a/IRaCIS.Core.Infra.EFCore/Context/Triggers/AuditUpdateTrigger.cs b/IRaCIS.Core.Infra.EFCore/Context/Triggers/AuditUpdateTrigger.cs index 3df8319c..5b0d732a 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/Triggers/AuditUpdateTrigger.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/Triggers/AuditUpdateTrigger.cs @@ -20,7 +20,7 @@ // { // if (context.ChangeType == ChangeType.Modified || context.ChangeType == ChangeType.Added) // { -// context.Entity.UpdateTime = DateTime.UtcNow.AddHours(8); +// context.Entity.UpdateTime = DateTime.Now; // context.Entity.UpdateUserId = _userInfo.Id; diff --git a/IRaCIS.Core.Infra.EFCore/Context/Triggers/SoftDeleteTrigger.cs b/IRaCIS.Core.Infra.EFCore/Context/Triggers/SoftDeleteTrigger.cs index afa7d0ce..27c03674 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/Triggers/SoftDeleteTrigger.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/Triggers/SoftDeleteTrigger.cs @@ -26,7 +26,7 @@ // if (context.Entity.IsDeleted) // { // context.Entity.DeleteUserId = _userInfo.Id; -// context.Entity.DeletedTime = DateTime.UtcNow.AddHours(8); +// context.Entity.DeletedTime = DateTime.Now; // } // else // { diff --git a/IRaCIS.Core.Infra.EFCore/Interceptor/AuditInterceptor.cs b/IRaCIS.Core.Infra.EFCore/Interceptor/AuditInterceptor.cs index efa8f6c9..75a4ee34 100644 --- a/IRaCIS.Core.Infra.EFCore/Interceptor/AuditInterceptor.cs +++ b/IRaCIS.Core.Infra.EFCore/Interceptor/AuditInterceptor.cs @@ -49,7 +49,7 @@ public class AuditingInterceptor : ISaveChangesInterceptor { var auditContext = eventData.Context as IRaCISDBContext; _audit.Succeeded = true; - _audit.EndTime = DateTime.UtcNow.AddHours(8); + _audit.EndTime = DateTime.Now; auditContext.SaveChangesAudits.Add(_audit); auditContext.SaveChanges(); } @@ -67,7 +67,7 @@ public class AuditingInterceptor : ISaveChangesInterceptor var auditContext = eventData.Context as IRaCISDBContext; _audit.Succeeded = true; auditContext.SaveChangesAudits.Add(_audit); - _audit.EndTime = DateTime.UtcNow.AddHours(8); + _audit.EndTime = DateTime.Now; await auditContext.SaveChangesAsync(); } @@ -83,7 +83,7 @@ public class AuditingInterceptor : ISaveChangesInterceptor { auditContext.Attach(_audit); _audit.Succeeded = false; - _audit.EndTime = DateTime.UtcNow.AddHours(8); + _audit.EndTime = DateTime.Now; _audit.ErrorMessage = eventData.Exception.Message; auditContext.SaveChanges(); @@ -98,7 +98,7 @@ public class AuditingInterceptor : ISaveChangesInterceptor { auditContext.Attach(_audit); _audit.Succeeded = false; - _audit.EndTime = DateTime.UtcNow.AddHours(8); + _audit.EndTime = DateTime.Now; _audit.ErrorMessage = eventData.Exception.InnerException?.Message; await auditContext.SaveChangesAsync(cancellationToken); @@ -119,7 +119,7 @@ public class AuditingInterceptor : ISaveChangesInterceptor { context.ChangeTracker.DetectChanges(); - var audit = new SaveChangesAudit { StartTime = DateTime.UtcNow.AddHours(8) }; + var audit = new SaveChangesAudit { StartTime = DateTime.Now }; foreach (var entry in context.ChangeTracker.Entries().Where(t => NeedAudit(t))) {