diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 6703597f1..ccdf3f835 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -8425,6 +8425,13 @@ + + + 修改项目医生启用禁用状态 + + + + 0代表裁判和Tp 都可以 1、代表Tp 2 代表裁判 diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index 3f8934159..2028b4b29 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -108,10 +108,10 @@ namespace IRaCIS.Application.Services var query = _tumorAssessmentRepository .Where(x => x.CriterionId == inQuery.CriterionId) .WhereIf(inQuery.OverallEfficacy != null, x => x.OverallEfficacy == inQuery.OverallEfficacy) - .WhereIf(inQuery.TargetLesion != null, x => x.TargetLesion == inQuery.TargetLesion) - .WhereIf(inQuery.NonTargetLesions != null, x => x.NonTargetLesions == inQuery.NonTargetLesions) - .WhereIf(inQuery.NewLesion != null, x => x.NewLesion == inQuery.NewLesion) - .ProjectTo(_mapper.ConfigurationProvider); + .WhereIf(inQuery.TargetLesion != null, x => x.TargetLesion == inQuery.TargetLesion) + .WhereIf(inQuery.NonTargetLesions != null, x => x.NonTargetLesions == inQuery.NonTargetLesions) + .WhereIf(inQuery.NewLesion != null, x => x.NewLesion == inQuery.NewLesion) + .ProjectTo(_mapper.ConfigurationProvider); return await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TumorAssessmentView.Id) : inQuery.SortField, inQuery.Asc); } diff --git a/IRaCIS.Core.Application/Service/WorkLoad/DTO/DoctorWorkLoadViewModel.cs b/IRaCIS.Core.Application/Service/WorkLoad/DTO/DoctorWorkLoadViewModel.cs index 3a7821cef..33619e865 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/DTO/DoctorWorkLoadViewModel.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/DTO/DoctorWorkLoadViewModel.cs @@ -150,6 +150,20 @@ namespace IRaCIS.Application.Contracts public List ReadingCategorys { get; set; } } + + + public class SetEnrollEnableCommand + { + [NotDefault] + public Guid EnrollId { get; set; } + + + public Guid TrialId { get; set; } + + public bool IsEnable { get; set; } + + } + public class WorkLoadDoctorQueryDTO : PageInput { public Guid TrialId { get; set; } = Guid.Empty; @@ -228,6 +242,8 @@ namespace IRaCIS.Application.Contracts public class WorkLoadAndAgreementDTO : WorkLoadAndTrainingDTO { + public bool IsEnable { get; set; } + public Guid EnrollId { get; set; } public DateTime? OutEnrollTime { get; set; } public Guid AgreementId { get; set; } diff --git a/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs b/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs index d7c47b4a9..de32d24b5 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs @@ -23,7 +23,7 @@ namespace IRaCIS.Application.Services private readonly IRepository _trialRevenuesPriceRepository; private readonly IRepository _trialRevenuesPriceVerificationRepository; - + private readonly IRepository _taskAllocationRuleRepository; public DoctorWorkloadService(IRepository clinicalTrialProjectRepository, IRepository intoGroupRepository, IRepository doctorInfoRepository, @@ -32,9 +32,11 @@ namespace IRaCIS.Application.Services IRepository attachmentRepository, IRepository costStatisticsRepository, IRepository trialRevenuesPriceRepository, + IRepository taskAllocationRuleRepository, IRepository trialRevenuesPriceVerificationRepository, IMapper mapper) { + _taskAllocationRuleRepository = taskAllocationRuleRepository; _trialRepository = clinicalTrialProjectRepository; _enrollRepository = intoGroupRepository; _doctorRepository = doctorInfoRepository; @@ -70,7 +72,7 @@ namespace IRaCIS.Application.Services var attachment = await _attachmentRepository.InsertFromDTOAsync(attachmentViewModel); //intoGroupItem.AttachmentId = attachment.Id; - await _enrollRepository.UpdatePartialFromQueryAsync(intoGroupItem.Id,u=>new Enroll(){AttachmentId = attachment.Id}); + await _enrollRepository.UpdatePartialFromQueryAsync(intoGroupItem.Id, u => new Enroll() { AttachmentId = attachment.Id }); var success = await _enrollRepository.SaveChangesAsync(); @@ -88,12 +90,12 @@ namespace IRaCIS.Application.Services 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 ); + await _enrollRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.DoctorId == doctorId, u => + new Enroll() + { + AttachmentId = Guid.Empty + }, true); + return ResponseOutput.Ok(success1); } /// @@ -105,15 +107,15 @@ namespace IRaCIS.Application.Services public async Task SetEnrollReadingCategory(SetEnrollReadingCategoryInDto inDto) { - var enroll = await _enrollRepository.FirstAsync(t => t.Id == inDto.EnrollId); + var enroll = await _enrollRepository.FirstAsync(t => t.Id == inDto.EnrollId); - if (_repository.Where(t=>t.TrialId==enroll.TrialId && t.DoctorUserId==enroll.DoctorUserId && t.TaskAllocationState==TaskAllocationState.Allocated).Any()) + if (_repository.Where(t => t.TrialId == enroll.TrialId && t.DoctorUserId == enroll.DoctorUserId && t.TaskAllocationState == TaskAllocationState.Allocated).Any()) { var readingCategoryList = await _enrollReadingCategoryRepository.Where(t => t.EnrollId == inDto.EnrollId).Select(t => t.ReadingCategory).ToListAsync(); - if(readingCategoryList.Except(inDto.ReadingCategorys).Count() > 0) + if (readingCategoryList.Except(inDto.ReadingCategorys).Count() > 0) { return ResponseOutput.NotOk("已分配任务,不允许减少阅片类型"); @@ -147,6 +149,19 @@ namespace IRaCIS.Application.Services return ResponseOutput.Ok(result); } + /// + /// 修改项目医生启用禁用状态 + /// + /// + /// + [Authorize(Policy = IRaCISPolicy.PM_APM)] + public async Task UpdateTrialReviewerState(SetEnrollEnableCommand inCommand) + { + await _taskAllocationRuleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == inCommand.TrialId && t.EnrollId == inCommand.EnrollId, u => new TaskAllocationRule() { IsEnable = inCommand.IsEnable },true); + + return ResponseOutput.Ok(); + } + /// /// 0代表裁判和Tp 都可以 1、代表Tp 2 代表裁判 @@ -178,6 +193,7 @@ namespace IRaCIS.Application.Services var doctorIntoGroupQueryable = from intoGroup in _enrollRepository.Where(x => x.TrialId == trialId && x.EnrollStatus >= EnrollStatus.ConfirmIntoGroup) + join allocateRule in _taskAllocationRuleRepository.AsQueryable() on intoGroup.Id equals allocateRule.EnrollId join doctor in _doctorRepository.AsQueryable() on intoGroup.DoctorId equals doctor.Id join attachmentItem in _attachmentRepository.AsQueryable() on intoGroup.AttachmentId equals attachmentItem.Id into cc from attachment in cc.DefaultIfEmpty() @@ -203,13 +219,15 @@ namespace IRaCIS.Application.Services select new WorkLoadAndAgreementDTO() { - EnrollId= intoGroup.Id, - ReadingCategorys = intoGroup.EnrollReadingCategoryList.Select(x=>x.ReadingCategory).OrderBy(x=>x).ToList(), + EnrollId = intoGroup.Id, + IsEnable = allocateRule.IsEnable, + + ReadingCategorys = intoGroup.EnrollReadingCategoryList.Select(x => x.ReadingCategory).OrderBy(x => x).ToList(), DoctorId = doctor.Id, Code = doctor.ReviewerCode, FirstName = doctor.FirstName, LastName = doctor.LastName, - FullName=doctor.FullName, + FullName = doctor.FullName, ChineseName = doctor.ChineseName, diff --git a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteEquipmentSurvey.cs b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteEquipmentSurvey.cs index b18094e5d..a7aab4d29 100644 --- a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteEquipmentSurvey.cs +++ b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteEquipmentSurvey.cs @@ -16,8 +16,6 @@ namespace IRaCIS.Core.Domain.Models public class TrialSiteEquipmentSurvey : Entity, IAuditUpdate, IAuditAdd { - - [ForeignKey("TrialSiteSurveyId")] public TrialSiteSurvey TrialSiteSurvey { get; set; } diff --git a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteSurvey.cs b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteSurvey.cs index 28308285b..f31d8782c 100644 --- a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteSurvey.cs +++ b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteSurvey.cs @@ -15,10 +15,7 @@ namespace IRaCIS.Core.Domain.Models /// [Table("TrialSiteSurvey")] public class TrialSiteSurvey : Entity, IAuditUpdate, IAuditAdd,ISoftDelete - { - //public bool IsLocked { get; set; }=false; - - + { public TrialSiteSurveyEnum State { get; set; } = TrialSiteSurveyEnum.ToSubmit; diff --git a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs index 64cdd9ef1..22a29e1b7 100644 --- a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs +++ b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs @@ -21,9 +21,6 @@ namespace IRaCIS.Core.Domain.Models public Guid TrialSiteSurveyId { get; set; } - - - [ForeignKey("UserTypeId")] public UserType UserTypeRole { get; set; }