diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs index ae38017c0..deb966060 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs @@ -67,9 +67,9 @@ namespace IRaCIS.Application.Services ReviewerSelectionQueryDTO selectionQuery) { //项目配置需要的医生过滤 2表示混合 - var trialConfig = await _repository.Where(s => s.Id == selectionQuery.TrialId).Select(t=>new { t.AttendedReviewerType ,t.TrialType} ).FirstOrDefaultAsync().IfNullThrowException(); + var trialConfig = await _repository.Where(s => s.Id == selectionQuery.TrialId).Select(t=>new { t.AttendedReviewerTypeEnumList ,t.TrialType} ).FirstOrDefaultAsync().IfNullThrowException(); - var nation = trialConfig.AttendedReviewerType; + //var nation = trialConfig.AttendedReviewerType; // 临床项目经验 多选 var evaluationCriteriaCount = selectionQuery.EvaluationCriteriaIdList.Count(); @@ -78,7 +78,8 @@ namespace IRaCIS.Application.Services var guidList = selectionQuery.ReadingTypeIdList.Concat(selectionQuery.SubspecialityIdList).Concat(selectionQuery.TitleIdList); - var query = _doctorRepository.WhereIf(nation != AttendedReviewerType.USAndCN, t => t.Nation ==(int) nation) + var query = _doctorRepository/*.WhereIf(nation != AttendedReviewerType.USAndCN, t => t.Nation ==(int) nation)*/ + .WhereIf(selectionQuery.DepartmentId != null, t => t.DepartmentId == selectionQuery.DepartmentId) .WhereIf(selectionQuery.SpecialityId != null, t => t.SpecialityId == selectionQuery.SpecialityId) .WhereIf(trialConfig.TrialType == TrialType.NoneOfficial, t => t.IsVirtual ==true) diff --git a/IRaCIS.Core.Application/Service/Financial/DTO/PaymentModel.cs b/IRaCIS.Core.Application/Service/Financial/DTO/PaymentModel.cs index af3648915..3b70b23fd 100644 --- a/IRaCIS.Core.Application/Service/Financial/DTO/PaymentModel.cs +++ b/IRaCIS.Core.Application/Service/Financial/DTO/PaymentModel.cs @@ -174,6 +174,6 @@ namespace IRaCIS.Application.Contracts public DateTime BeginDate { get; set; } public DateTime EndDate { get; set; } - public AttendedReviewerType? AttendedReviewerType { get; set; } + //public AttendedReviewerType? AttendedReviewerType { get; set; } } } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/Financial/FinancialService.cs b/IRaCIS.Core.Application/Service/Financial/FinancialService.cs index d47b6a4f4..7ddd39012 100644 --- a/IRaCIS.Core.Application/Service/Financial/FinancialService.cs +++ b/IRaCIS.Core.Application/Service/Financial/FinancialService.cs @@ -552,10 +552,12 @@ namespace IRaCIS.Application.Services trialLambda = trialLambda.And(u => u.TrialCode.Contains(trialCode)); } - if (queryParam.AttendedReviewerType != null) - { - trialLambda = trialLambda.And(u => u.AttendedReviewerType == queryParam.AttendedReviewerType); - } + //if (queryParam.AttendedReviewerType != null) + //{ + // trialLambda = trialLambda.And(u => u.AttendedReviewerType == queryParam.AttendedReviewerType); + //} + + Expression> doctorLambda = x => true; @@ -936,15 +938,17 @@ namespace IRaCIS.Application.Services { trialLambda = trialLambda.And(u => u.CROId == param.CroId); } + if (!string.IsNullOrWhiteSpace(param.TrialCode)) { var trialCode = param.TrialCode.Trim(); trialLambda = trialLambda.And(u => u.TrialCode.Contains(trialCode)); } - if (param.AttendedReviewerType != null) - { - trialLambda = trialLambda.And(u => u.AttendedReviewerType == param.AttendedReviewerType); - } + + //if (param.AttendedReviewerType != null) + //{ + // trialLambda = trialLambda.And(u => u.AttendedReviewerType == param.AttendedReviewerType); + //} var lockedPaymentIdAndYearMonth = _paymentRepository.Where(t => t.IsLock && t.YearMonthDate >= bDate && t.YearMonthDate <= eDate).Select(t => new { PaymentId = t.Id, t.YearMonth, t.DoctorId }); diff --git a/IRaCIS.Core.Application/Service/Stat/DTO/StatisticsViewModel.cs b/IRaCIS.Core.Application/Service/Stat/DTO/StatisticsViewModel.cs index a08ddc969..b94104803 100644 --- a/IRaCIS.Core.Application/Service/Stat/DTO/StatisticsViewModel.cs +++ b/IRaCIS.Core.Application/Service/Stat/DTO/StatisticsViewModel.cs @@ -148,7 +148,8 @@ namespace IRaCIS.Application.Contracts //医生付费类型 CN US public int? Nation { get; set; } - public AttendedReviewerType? AttendedReviewerType { get; set; } + + //public AttendedReviewerType? AttendedReviewerType { get; set; } } public class StatisticsWorkloadQueryParam : PageInput diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialViewModel.cs index 66397ab3e..3c2ccfcc2 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialViewModel.cs @@ -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 DeclarationTypeEnumList { get; set; } + + public List 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 DeclarationTypeEnumList { get; set; }=new List(); + + public List AttendedReviewerTypeEnumList { get; set; } = new List(); 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 diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs index 63cdeb120..b37a547db 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs @@ -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> trialDeclarationTypeExpression = x => true; + + + + foreach (var item in searchParam.DeclarationTypeEnumList) + { + trialDeclarationTypeExpression = trialDeclarationTypeExpression.And(t => t.DeclarationTypes.Contains($"|{item}|")); + } + + Expression> 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 })); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index 4ec110bde..0801003c1 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -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)) diff --git a/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs b/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs index beb621e46..292b25a77 100644 --- a/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs +++ b/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs @@ -35,4 +35,15 @@ USAndCN=2, } + + public enum DeclarationType + { + Other=-1, + + US=0, + + CN=1, + EU=2, + JP=3 + } } \ No newline at end of file diff --git a/IRaCIS.Core.Domain/SQLFile/20230606号.sql b/IRaCIS.Core.Domain/SQLFile/20230606号.sql new file mode 100644 index 000000000..603aa7f8d --- /dev/null +++ b/IRaCIS.Core.Domain/SQLFile/20230606号.sql @@ -0,0 +1,30 @@ + +--新增字段 +ALTER TABLE [dbo].[Trial] ADD [AttendedReviewerTypeOther] varchar(255) COLLATE Chinese_PRC_CI_AS DEFAULT '' NOT NULL +GO + +ALTER TABLE [dbo].[Trial] ADD [AttendedReviewerTypes] varchar(255) COLLATE Chinese_PRC_CI_AS DEFAULT '' NOT NULL +GO + +ALTER TABLE [dbo].[Trial] ADD [DeclarationTypeOther] varchar(255) COLLATE Chinese_PRC_CI_AS DEFAULT '' NOT NULL +GO + +ALTER TABLE [dbo].[Trial] ADD [DeclarationTypes] varchar(255) COLLATE Chinese_PRC_CI_AS DEFAULT '' NOT NULL +GO + + +--维护sql +UPDATE Trial SET AttendedReviewerTypes = '|' + CAST(AttendedReviewerType AS VARCHAR(10)) + '|' + +update Trial set DeclarationTypes ='|' + (select Code from Dictionary where Id= Trial.DeclarationTypeId) + '|' + + + +--验证sql +select DISTINCT AttendedReviewerType ,AttendedReviewerTypes, DeclarationTypeId, Dictionary.Code,DeclarationTypes,Dictionary.[Value] from Trial inner join Dictionary on Trial.DeclarationTypeId=Dictionary.Id + + + +--删除多余字段 +ALTER TABLE [dbo].[Trial] DROP COLUMN [DeclarationTypeId]; +ALTER TABLE [dbo].[Trial] DROP COLUMN [AttendedReviewerType]; \ No newline at end of file diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs index c5e627c91..41456b09b 100644 --- a/IRaCIS.Core.Domain/Trial/Trial.cs +++ b/IRaCIS.Core.Domain/Trial/Trial.cs @@ -45,11 +45,6 @@ namespace IRaCIS.Core.Domain.Models [JsonIgnore] public List TrialSiteUserList { get; set; } = new List(); - [JsonIgnore] - [ForeignKey("DeclarationTypeId")] - public Dictionary DeclarationType { get; set; } - - public Guid DeclarationTypeId { get; set; } = Guid.Empty; public Guid IndicationTypeId { get; set; } = Guid.Empty; public Guid? PhaseId { get; set; } = Guid.Empty; @@ -142,13 +137,39 @@ namespace IRaCIS.Core.Domain.Models public DateTime UpdateTime { get; set; } public Guid UpdateUserId { get; set; } - public AttendedReviewerType AttendedReviewerType { get; set; } = AttendedReviewerType.CN;//0ȫйҽ 1ҽ 2йҽҲҽ + + + + // + //public AttendedReviewerType AttendedReviewerType { get; set; } = AttendedReviewerType.CN;//0ȫйҽ 1ҽ 2йҽҲҽ + + //// + //[JsonIgnore] + //[ForeignKey("DeclarationTypeId")] + //public Dictionary DeclarationType { get; set; } + + // + //public Guid DeclarationTypeId { get; set; } = Guid.Empty; + + + public string DeclarationTypeOther { get; set; } + public string DeclarationTypes { get; set; } + + [NotMapped] + public List DeclarationTypeEnumList => AttendedReviewerTypes.Split('|', StringSplitOptions.RemoveEmptyEntries) + .Select(s => Enum.Parse(typeof(DeclarationType), s)).Cast().ToList(); + + [NotMapped] + public List AttendedReviewerTypeEnumList=> AttendedReviewerTypes.Split('|',StringSplitOptions.RemoveEmptyEntries) + .Select(s => Enum.Parse(typeof(AttendedReviewerType), s)).Cast().ToList(); + + public string AttendedReviewerTypes { get; set; } + public string AttendedReviewerTypeOther { get; set; } + + public bool VisitPlanConfirmed { get; set; } - - - /// /// ߱ž /// @@ -359,6 +380,9 @@ namespace IRaCIS.Core.Domain.Models public bool IsConfigureEmail { get; set; } = false; #endregion + + + ///// ///// ͼǷбע /////