修改项目属性 单选变为多选

This commit is contained in:
2023-06-06 10:10:49 +08:00
parent bcad91dc18
commit 76965111fe
10 changed files with 146 additions and 30 deletions
@@ -1,6 +1,7 @@
using IRaCIS.Core.Infrastructure.Extention;
using IRaCIS.Core.Domain.Share;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations.Schema;
namespace IRaCIS.Application.Contracts
{
@@ -30,7 +31,7 @@ namespace IRaCIS.Application.Contracts
public int? GRRReviewers { get; set; }
public int TotalReviewers { get; set; }
public int? Expedited { get; set; }
public int? AttendedReviewerType { get; set; }
//研究方案号
public string ResearchProgramNo { get; set; } = string.Empty;
@@ -44,12 +45,22 @@ namespace IRaCIS.Application.Contracts
// 负责人PI
public string HeadPI { get; set; } = string.Empty;
public Guid DeclarationTypeId { get; set; }
//public Guid DeclarationTypeId { get; set; }
//public int? AttendedReviewerType { get; set; }
public Guid IndicationTypeId { get; set; }
public Guid? PhaseId { get; set; }
public string DeclarationTypeOther { get; set; }
public List<DeclarationType> DeclarationTypeEnumList { get; set; }
public List<AttendedReviewerType> AttendedReviewerTypeEnumList { get; set; }
public string DeclarationTypes { get; set; }
public string AttendedReviewerTypes { get; set; }
public string AttendedReviewerTypeOther { get; set; }
}
@@ -116,7 +127,7 @@ namespace IRaCIS.Application.Contracts
//统计字段
public string Phase { get; set; } = string.Empty;
public string DeclarationType { get; set; } = string.Empty;
public string IndicationType { get; set; } = string.Empty;
@@ -140,6 +151,9 @@ namespace IRaCIS.Application.Contracts
public bool IsDeleted { get; set; }
public bool IsLocked { get; set; }
//public string DeclarationType { get; set; } = string.Empty;
//public int? SubjectCount { get; set; }
//public int? StudyCount { get; set; } = 0;
@@ -174,7 +188,11 @@ namespace IRaCIS.Application.Contracts
public class TrialQueryDTO : PageInput
{
public Guid? DeclarationTypeId { get; set; }
//public Guid? DeclarationTypeId { get; set; }
public List<DeclarationType> DeclarationTypeEnumList { get; set; }=new List<DeclarationType>();
public List<AttendedReviewerType> AttendedReviewerTypeEnumList { get; set; } = new List<AttendedReviewerType>();
public Guid? IndicationTypeId { get; set; }
public Guid? SponsorId { get; set; }
@@ -200,7 +218,7 @@ namespace IRaCIS.Application.Contracts
public DateTime? BeginDate { get; set; }
public DateTime? EndDate { get; set; }
public int? Expedited { get; set; }
public AttendedReviewerType? AttendedReviewerType { get; set; }
//public AttendedReviewerType? AttendedReviewerType { get; set; }
}
public class ReviewerTrialQueryDTO : PageInput
@@ -9,6 +9,8 @@ using IRaCIS.Core.Infrastructure;
using Microsoft.Extensions.Options;
using static IRaCIS.Core.Domain.Share.StaticData;
using Microsoft.AspNetCore.Authorization;
using System.Linq.Expressions;
using System.Linq;
namespace IRaCIS.Application.Services
{
@@ -49,6 +51,23 @@ namespace IRaCIS.Application.Services
var multiCriteriaSelectCount = searchParam.CriterionIds.Count;
var multiReviewTypeSelectCount = searchParam.ReviewTypeIds.Count;
Expression<Func<Trial, bool>> trialDeclarationTypeExpression = x => true;
foreach (var item in searchParam.DeclarationTypeEnumList)
{
trialDeclarationTypeExpression = trialDeclarationTypeExpression.And(t => t.DeclarationTypes.Contains($"|{item}|"));
}
Expression<Func<Trial, bool>> trialAttendedReviewerTypeExpression = x => true;
foreach (var item in searchParam.AttendedReviewerTypeEnumList)
{
trialAttendedReviewerTypeExpression = trialAttendedReviewerTypeExpression.And(t => t.AttendedReviewerTypes.Contains($"|{item}|"));
}
var query = _trialRepository.AsQueryable().IgnoreQueryFilters()
.WhereIf(!string.IsNullOrEmpty(searchParam.TrialStatusStr), o => o.TrialStatusStr.Contains(searchParam.TrialStatusStr))
.WhereIf(searchParam.SponsorId != null, o => o.SponsorId == searchParam.SponsorId)
@@ -58,12 +77,17 @@ namespace IRaCIS.Application.Services
.WhereIf(!string.IsNullOrEmpty(searchParam.ResearchProgramNo), o => o.ResearchProgramNo.Contains(searchParam.ResearchProgramNo))
.WhereIf(!string.IsNullOrWhiteSpace(searchParam.ExperimentName), o => o.ExperimentName.Contains(searchParam.ExperimentName))
.WhereIf(searchParam.PhaseId != null, o => o.PhaseId == searchParam.PhaseId)
.WhereIf(searchParam.DeclarationTypeId != null, o => o.DeclarationTypeId == searchParam.DeclarationTypeId)
.WhereIf(searchParam.DeclarationTypeEnumList.Count>0 , trialDeclarationTypeExpression)
.WhereIf(searchParam.AttendedReviewerTypeEnumList.Count > 0, trialAttendedReviewerTypeExpression)
//.WhereIf(searchParam.AttendedReviewerType != null, o => o.AttendedReviewerType == searchParam.AttendedReviewerType)
.WhereIf(searchParam.IndicationTypeId != null, o => o.IndicationTypeId == searchParam.IndicationTypeId)
.WhereIf(searchParam.CROId != null, o => o.CROId == searchParam.CROId)
.WhereIf(searchParam.BeginDate != null, o => o.CreateTime >= searchParam.BeginDate)
.WhereIf(searchParam.EndDate != null, o => o.CreateTime <= searchParam.EndDate)
.WhereIf(searchParam.AttendedReviewerType != null, o => o.AttendedReviewerType == searchParam.AttendedReviewerType)
.WhereIf(multiModalityIdSelectCount > 0, t => t.TrialDicList.Count(t => t.KeyName == StaticData.Modality) == multiModalityIdSelectCount)
.WhereIf(multiCriteriaSelectCount > 0, t => t.TrialDicList.Count(t => t.KeyName == StaticData.Criterion) == multiCriteriaSelectCount)
.WhereIf(multiReviewTypeSelectCount > 0, t => t.TrialDicList.Count(t => t.KeyName == StaticData.ReviewType) == multiReviewTypeSelectCount)
@@ -171,6 +195,9 @@ namespace IRaCIS.Application.Services
trial.TrialCode = (trial.TrialType == TrialType.NoneOfficial ? "T0" : yearStr.Substring(yearStr.Length - 2)) + trial.TrialCode + currentYearMaxCodeNext.ToString("D3");
trial.DeclarationTypes = $"|{string.Join('|', trialAddModel.DeclarationTypeEnumList)}|";
trial.AttendedReviewerTypes = $"|{string.Join('|', trialAddModel.AttendedReviewerTypes)}|";
//多选信息
trialAddModel.ModalityIds.ForEach(modalityId => trial.TrialDicList.Add(new TrialDictionary() { DictionaryId = modalityId, KeyName = StaticData.Modality, TrialId = trial.Id }));
trialAddModel.CriterionIds.ForEach(criterionId => trial.TrialDicList.Add(new TrialDictionary() { DictionaryId = criterionId, KeyName = StaticData.Criterion, TrialId = trial.Id }));
@@ -70,7 +70,7 @@ namespace IRaCIS.Core.Application.Service
//.ForMember(d => d.Code, u => u.MapFrom(s => s.TrialCode))
.ForMember(d => d.Sponsor, u => u.MapFrom(s => s.Sponsor.SponsorName))
.ForMember(d => d.Phase, u => u.MapFrom(s => s.Phase.MappedValue))
.ForMember(d => d.DeclarationType, u => u.MapFrom(s => s.DeclarationType.MappedValue))
//.ForMember(d => d.DeclarationType, u => u.MapFrom(s => s.DeclarationType.MappedValue))
.ForMember(d => d.IndicationType, u => u.MapFrom(s => s.IndicationType.MappedValue))
.ForMember(d => d.CRO, u => u.MapFrom(s => s.CRO.CROName))
.ForMember(d => d.ReviewMode, u => u.MapFrom(s => s.ReviewMode.MappedValue))