From 79d4c6a1166bb6f9b761ce83c04ba2fb5d4296fb Mon Sep 17 00:00:00 2001 From: "{872297557@qq.com}" <872297557@qq.com> Date: Tue, 31 Jan 2023 09:35:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E7=94=9F=E6=97=A2?= =?UTF-8?q?=E5=BE=80=E9=98=85=E7=89=87=E6=83=85=E5=86=B5=E5=A3=B0=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/UploadDownLoadController.cs | 3 + .../NewtonsoftJson/JSONCustomDateConverter.cs | 46 +++++++ .../NewtonsoftJson/NewtonsoftJsonSetup.cs | 4 + .../IRaCIS.Core.Application.xml | 10 -- .../Allocation/VisitTaskHelpeService.cs | 40 ++++-- .../Service/Doctor/DTO/AttachmentModel.cs | 3 + .../Service/Doctor/DTO/DoctorModel.cs | 9 ++ .../Service/Doctor/DoctorService.cs | 41 +++--- .../Service/Management/MenuService.cs | 4 +- .../TrialSiteUser/TrialConfigService.cs | 2 +- .../WorkLoad/DTO/DoctorWorkLoadViewModel.cs | 4 +- .../Service/WorkLoad/DoctorWorkloadService.cs | 120 ++++++++++-------- .../Interface/IDoctorWorkloadService.cs | 4 +- .../AuthUser/IUserInfo.cs | 17 ++- IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs | 17 +++ .../Dcotor/DoctorCriterionFile.cs | 5 + .../Context/IRaCISDBContext.cs | 12 +- .../Context/Triggers/AuditAddTrigger.cs | 4 +- .../Context/Triggers/AuditUpdateTrigger.cs | 2 +- .../Context/Triggers/SoftDeleteTrigger.cs | 2 +- .../Interceptor/AuditInterceptor.cs | 10 +- 21 files changed, 242 insertions(+), 117 deletions(-) create mode 100644 IRaCIS.Core.API/_ServiceExtensions/NewtonsoftJson/JSONCustomDateConverter.cs 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..f9483c7f 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/DTO/DoctorWorkLoadViewModel.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/DTO/DoctorWorkLoadViewModel.cs @@ -340,11 +340,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..1fae5a64 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,30 @@ 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, + 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/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))) {