diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj index af2f05374..6e9aa8f26 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj @@ -61,6 +61,7 @@ + diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index fee870b58..2afcd15b6 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -79,7 +79,7 @@ - + 自身一致性分配 配置+ 统计已经生成数量统计表 diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs index 82db25c2a..43b604e9e 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs @@ -7,6 +7,7 @@ using System; using IRaCIS.Core.Domain.Share; using System.Collections.Generic; using Newtonsoft.Json; +using System.ComponentModel.DataAnnotations; namespace IRaCIS.Core.Application.ViewModel { @@ -23,14 +24,21 @@ namespace IRaCIS.Core.Application.ViewModel public int? GeneratedSubjectCount { get; set; } - public int? GeneratedVisitCount { get; set; } + } + + + public class TaskConsistentRuleBasic : TaskConsistentRuleAddOrEdit + { + } public class ConsistentQuery : PageInput { - + [NotDefault] + public Guid DoctorUserId { get; set; } + [NotDefault] public Guid TaskConsistentRuleId { get; set; } //public int PlanSubjectCount { get; set; } @@ -46,6 +54,8 @@ namespace IRaCIS.Core.Application.ViewModel public class ConsistentConfirmGenerateCommand { public Guid TaskConsistentRuleId { get; set; } + [NotDefault] + public Guid DoctorUserId { get; set; } public List SubejctIdList { get; set; } } @@ -180,7 +190,7 @@ namespace IRaCIS.Core.Application.ViewModel { public Guid TrialId { get; set; } - //public bool IsSelfAnalysis { get; set; } + public bool IsSelfAnalysis { get; set; } } @@ -197,8 +207,7 @@ namespace IRaCIS.Core.Application.ViewModel public bool IsHaveReadingPeriod { get; set; } public bool IsGenerateGlobalTask { get; set; } - public Guid AnalysisDoctorUserId { get; set; } - + public bool IsSelfAnalysis { get; set; } public int BlindSubjectNumberOfPlaces { get; set; } public string BlindTrialSiteCode { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs index 5c16abd93..5ec5a9f45 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs @@ -27,13 +27,15 @@ namespace IRaCIS.Core.Application.Service private readonly IRepository _visitTaskRepository; private readonly IRepository _subjectUserRepository; private readonly IRepository _subjectRepository; + private readonly IRepository _enrollRepository; - public TaskConsistentRuleService(IRepository visitTaskRepository, IRepository taskConsistentRuleRepository, IRepository subjectUserRepository, IRepository subjectRepository) + public TaskConsistentRuleService(IRepository visitTaskRepository, IRepository enrollRepository, IRepository taskConsistentRuleRepository, IRepository subjectUserRepository, IRepository subjectRepository) { _taskConsistentRuleRepository = taskConsistentRuleRepository; _visitTaskRepository = visitTaskRepository; _subjectUserRepository = subjectUserRepository; _subjectRepository = subjectRepository; + _enrollRepository = enrollRepository; } @@ -79,7 +81,7 @@ namespace IRaCIS.Core.Application.Service { var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inQuery.TaskConsistentRuleId); - var pagedList = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj).ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(DoctorSelfConsistentSubjectView.SubjectCode) : inQuery.SortField, inQuery.Asc); + var pagedList = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj,inQuery.DoctorUserId).ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(DoctorSelfConsistentSubjectView.SubjectCode) : inQuery.SortField, inQuery.Asc); @@ -113,9 +115,9 @@ namespace IRaCIS.Core.Application.Service public async Task ConfirmGenerateSelfConsistentTask(ConsistentConfirmGenerateCommand inCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService) { var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inCommand.TaskConsistentRuleId); + var doctorUserId = inCommand.DoctorUserId; - - var list = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, inCommand.SubejctIdList).ToListAsync(); + var list = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, doctorUserId, inCommand.SubejctIdList).ToListAsync(); //var (group, query) = GetIQueryableDoctorSelfConsistentRuleSubjectView(filterObj, inCommand.SubejctIdList); @@ -124,11 +126,27 @@ namespace IRaCIS.Core.Application.Service foreach (var subject in list) { //处理 Subject 编号 + + var blindSubjectCode = string.Empty; + + var subjectTask = _visitTaskRepository.Where(t => t.SubjectId == subject.SubjectId).OrderByDescending(t => t.BlindSubjectCode).FirstOrDefault().IfNullThrowException(); + if (subjectTask.BlindSubjectCode != String.Empty) + { + blindSubjectCode = subjectTask.BlindSubjectCode; + } + else + { + var maxCodeStr = _visitTaskRepository.Where(t => t.TrialId == subject.TrialId).OrderByDescending(t => t.BlindSubjectCode).Select(t => t.BlindSubjectCode).FirstOrDefault(); + + blindSubjectCode = (int.Parse(maxCodeStr) + 1).ToString($"D{filterObj.BlindSubjectNumberOfPlaces}"); + } + subject.VisitTaskList.Take(filterObj.PlanVisitCount).ForEach(t => { - t.DoctorUserId = filterObj.AnalysisDoctorUserId; + t.DoctorUserId = doctorUserId; t.TaskConsistentRuleId = filterObj.Id; t.BlindTrialSiteCode = filterObj.BlindTrialSiteCode; + t.BlindSubjectCode = blindSubjectCode; }); @@ -157,9 +175,8 @@ namespace IRaCIS.Core.Application.Service } - private IQueryable GetIQueryableDoctorSelfConsistentSubjectView(TaskConsistentRule filterObj, List? subejctIdList = null) + private IQueryable GetIQueryableDoctorSelfConsistentSubjectView(TaskConsistentRule filterObj, Guid doctorUserId, List? subejctIdList = null) { - var doctorUserId = filterObj.AnalysisDoctorUserId; var trialId = filterObj.TrialId; #region Subejct 维度 @@ -241,100 +258,11 @@ namespace IRaCIS.Core.Application.Service } - private (IQueryable>, IQueryable) GetIQueryableDoctorSelfConsistentRuleSubjectView(TaskConsistentRule filterObj, List? subejctIdList = null) + + [HttpPost] + public async Task GetConsistentRule(TaskConsistentRuleQuery inQuery) { - var doctorUserId = filterObj.AnalysisDoctorUserId; - var trialId = filterObj.TrialId; - - #region 任务维度 - - var group = _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && t.IsAnalysisCreate == false && t.ReadingCategory == ReadingCategory.Visit && t.DoctorUserId == doctorUserId) - - - // 自身一致性分析 - //.WhereIf(isSelfAnalysis, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId) - //// 组内一致性分析 - //.WhereIf(isSelfAnalysis == false && subjectfilter != null, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId && subjectfilter.Contains(t.SubjectId)) - //.WhereIf(subejctIdList != null && subejctIdList?.Count > 0, t => subejctIdList.Contains(t.SubjectId)) - .Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) - .Where(t => t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now) - //重阅产生的访视任务 要把之前的访视任务去除 - .Where(t => t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject) - - .WhereIf(filterObj.IsHaveReadingPeriod == true, t => t.Subject.SubjectVisitTaskList.Any(u => u.VisitTaskNum == t.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] - && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now)) - .GroupBy(t => t.SubjectId) - .Where(g => g.Count() >= filterObj.PlanVisitCount); - - - var query = group.Select(g => new DoctorConsistentRuleSubjectView() - { - SubjectId = g.Key, - - IsHaveGeneratedTask = g.Any(c => c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id)), - - VisitTaskList = g.OrderBy(t => t.VisitTaskNum) - - .Select(c => new VisitTaskSimpleView() - { - Id = c.Id, - ReadingCategory = c.ReadingCategory, - ReadingTaskState = c.ReadingTaskState, - TaskBlindName = c.TaskBlindName, - TaskCode = c.TaskCode, - TaskName = c.TaskName, - TaskState = c.TaskState, - ArmEnum = c.ArmEnum, - SubjectId = c.SubjectId, - TrialId = c.TrialId, - SiteId = c.Subject.SiteId, - SubjectCode = c.Subject.Code, - TrialSiteCode = c.Subject.TrialSite.TrialSiteCode, - - GlobalVisitTaskList = c.Subject.SubjectVisitTaskList.Where(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Select(t => new VisitTaskSimpleView() - { - Id = t.Id, - ReadingCategory = t.ReadingCategory, - ReadingTaskState = t.ReadingTaskState, - TaskBlindName = t.TaskBlindName, - TaskCode = t.TaskCode, - TaskName = t.TaskName, - TaskState = t.TaskState, - ArmEnum = t.ArmEnum, - SubjectId = t.SubjectId, - TrialId = t.TrialId, - SiteId = t.Subject.SiteId, - SubjectCode = t.Subject.Code, - TrialSiteCode = t.Subject.TrialSite.TrialSiteCode, - }).ToList(), - - //RelationDoctorUserList = c.SourceSubjectVisit.VisitTaskList/*Where(t=>t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)*/.Select(c => new UserSimpleInfo() - //{ - // FullName = c.DoctorUser.FullName, - // UserCode = c.DoctorUser.UserCode, - // UserId = c.DoctorUser.Id, - // UserName = c.DoctorUser.UserName - //}).ToList(), - - IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.ConsistentAnalysisOriginalTaskId == c.Id), - - }).ToList(), - - ValidTaskCount = g.Count() - - }); - - return (group, query); - - #endregion - - - - - - - - + return await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsSelfAnalysis == inQuery.IsSelfAnalysis).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); } /// @@ -343,90 +271,124 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - public async Task> GetSelfConsistentRuleList(TaskConsistentRuleQuery inQuery) + public async Task> GetSelfConsistentDoctorStatList(TaskConsistentRuleQuery inQuery) { + var trialId = inQuery.TrialId; - #region 是否有新的医生加入 自动加入配置 + var taskConsistentRuleQueryable = from enroll in _repository.Where(t => t.TrialId == trialId) + join user in _repository.Where() on enroll.DoctorId equals user.DoctorId + join taskConsistentRule in _repository.Where(t => t.TrialId == trialId) on enroll.TrialId equals taskConsistentRule.TrialId + select new TaskConsistentRuleView() + { + Id = taskConsistentRule.Id, + CreateTime = taskConsistentRule.CreateTime, + BlindTrialSiteCode = taskConsistentRule.BlindTrialSiteCode, + BlindSubjectNumberOfPlaces = taskConsistentRule.BlindSubjectNumberOfPlaces, + CreateUserId = taskConsistentRule.CreateUserId, + IntervalWeeks = taskConsistentRule.IntervalWeeks, + IsEnable = taskConsistentRule.IsEnable, + PlanSubjectCount = taskConsistentRule.PlanSubjectCount, + Note = taskConsistentRule.Note, + TrialId = taskConsistentRule.TrialId, + UpdateTime = taskConsistentRule.UpdateTime, + UpdateUserId = taskConsistentRule.UpdateUserId, + IsGenerateGlobalTask = taskConsistentRule.IsGenerateGlobalTask, + IsHaveReadingPeriod = taskConsistentRule.IsHaveReadingPeriod, + PlanVisitCount = taskConsistentRule.PlanVisitCount, + + GeneratedSubjectCount = taskConsistentRule.Trial.VisitTaskList.Where(t => t.IsAnalysisCreate && t.IsSelfAnalysis == true).Select(t => t.SubjectId).Distinct().Count(), + + AnalysisDoctorUser = new UserSimpleInfo() + { + UserId = user.Id, + UserCode = user.UserCode, + FullName = user.FullName, + UserName = user.UserName + } + }; - if (await _taskConsistentRuleRepository.AnyAsync(t => t.TrialId == inQuery.TrialId)) - { - var rule = await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstAsync(); - rule.IsBatchAdd = true; + //if (await _taskConsistentRuleRepository.AnyAsync(t => t.TrialId == inQuery.TrialId)) + //{ + // var rule = await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstAsync(); - await BatchAddOrUpdateTaskConsistentRule(rule); - } + // rule.IsBatchAdd = true; - #endregion + // await BatchAddOrUpdateTaskConsistentRule(rule); + //} - var taskConsistentRuleQueryable = _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId) - .ProjectTo(_mapper.ConfigurationProvider); + //#endregion + + //var taskConsistentRuleQueryable = _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId) + // .ProjectTo(_mapper.ConfigurationProvider); return await taskConsistentRuleQueryable.ToListAsync(); } - public async Task BatchAddOrUpdateTaskConsistentRule(TaskConsistentRuleBatchAddOrEdit addOrEdit) - { - var trialId = addOrEdit.TrialId; + + + //public async Task BatchAddOrUpdateTaskConsistentRule(TaskConsistentRuleBatchAddOrEdit addOrEdit) + //{ + // var trialId = addOrEdit.TrialId; - if (addOrEdit.IsBatchAdd) - { - var query = from enroll in _repository.Where(t => t.TrialId == trialId) - join user in _repository.Where() on enroll.DoctorId equals user.DoctorId - join taskConsistentRule in _repository.Where(t => t.TrialId == trialId) on user.Id equals taskConsistentRule.AnalysisDoctorUserId into c - from taskConsistentRule in c.DefaultIfEmpty() - select new - { - TrialId = enroll.TrialId, + // if (addOrEdit.IsBatchAdd) + // { + // var query = from enroll in _repository.Where(t => t.TrialId == trialId) + // join user in _repository.Where() on enroll.DoctorId equals user.DoctorId + // join taskConsistentRule in _repository.Where(t => t.TrialId == trialId) on user.Id equals taskConsistentRule.AnalysisDoctorUserId into c + // from taskConsistentRule in c.DefaultIfEmpty() + // select new + // { + // TrialId = enroll.TrialId, - DoctorUserId = user.Id, - //FullName = user.FullName, - //UserCode = user.UserCode, - //UserName = user.UserName, + // DoctorUserId = user.Id, + // //FullName = user.FullName, + // //UserCode = user.UserCode, + // //UserName = user.UserName, - IsHaveConfig = taskConsistentRule != null - }; + // IsHaveConfig = taskConsistentRule != null + // }; - var doctorList = await query.ToListAsync(); + // var doctorList = await query.ToListAsync(); - foreach (var doctor in doctorList) - { - if (!doctor.IsHaveConfig) - { - var verifyExp1 = new EntityVerifyExp() - { - VerifyExp = t => t.AnalysisDoctorUserId == doctor.DoctorUserId && t.TrialId == trialId, - VerifyMsg = "已有该医生配置,不允许继续增加" - }; + // foreach (var doctor in doctorList) + // { + // if (!doctor.IsHaveConfig) + // { + // var verifyExp1 = new EntityVerifyExp() + // { + // VerifyExp = t => t.AnalysisDoctorUserId == doctor.DoctorUserId && t.TrialId == trialId, + // VerifyMsg = "已有该医生配置,不允许继续增加" + // }; - addOrEdit.AnalysisDoctorUserId = doctor.DoctorUserId; - addOrEdit.Id = Guid.Empty; + // addOrEdit.AnalysisDoctorUserId = doctor.DoctorUserId; + // addOrEdit.Id = Guid.Empty; - var entity = await _taskConsistentRuleRepository.InsertOrUpdateAsync(addOrEdit, true, verifyExp1); - } - } - } - else - { - await _taskConsistentRuleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId, c => new TaskConsistentRule() - { - PlanSubjectCount = c.PlanSubjectCount, - PlanVisitCount = c.PlanVisitCount, - IntervalWeeks = c.IntervalWeeks, - IsGenerateGlobalTask = c.IsGenerateGlobalTask, - IsHaveReadingPeriod = c.IsHaveReadingPeriod + // var entity = await _taskConsistentRuleRepository.InsertOrUpdateAsync(addOrEdit, true, verifyExp1); + // } + // } + // } + // else + // { + // await _taskConsistentRuleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId, c => new TaskConsistentRule() + // { + // PlanSubjectCount = c.PlanSubjectCount, + // PlanVisitCount = c.PlanVisitCount, + // IntervalWeeks = c.IntervalWeeks, + // IsGenerateGlobalTask = c.IsGenerateGlobalTask, + // IsHaveReadingPeriod = c.IsHaveReadingPeriod - }, true); - } + // }, true); + // } - await _taskConsistentRuleRepository.SaveChangesAsync(); + // await _taskConsistentRuleRepository.SaveChangesAsync(); - return ResponseOutput.Ok(); - } + // return ResponseOutput.Ok(); + //} @@ -435,8 +397,8 @@ namespace IRaCIS.Core.Application.Service var verifyExp1 = new EntityVerifyExp() { - VerifyExp = t => t.AnalysisDoctorUserId == addOrEditTaskConsistentRule.AnalysisDoctorUserId && t.TrialId == addOrEditTaskConsistentRule.TrialId, - VerifyMsg = "已有该医生配置,不允许继续增加" + VerifyExp = t => t.TrialId == addOrEditTaskConsistentRule.TrialId && t.IsSelfAnalysis == addOrEditTaskConsistentRule.IsSelfAnalysis, + VerifyMsg = "已有该项目配置,不允许继续增加" }; var entity = await _taskConsistentRuleRepository.InsertOrUpdateAsync(addOrEditTaskConsistentRule, true, verifyExp1); @@ -452,7 +414,7 @@ namespace IRaCIS.Core.Application.Service var config = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == taskConsistentRuleId); - if (await _visitTaskRepository.AnyAsync(t => t.IsAnalysisCreate && t.DoctorUserId == config.AnalysisDoctorUserId && t.TrialId == config.TrialId)) + if (await _visitTaskRepository.AnyAsync(t => t.IsAnalysisCreate && t.TrialId == config.TrialId && t.IsSelfAnalysis == config.IsSelfAnalysis)) { throw new BusinessValidationFailedException("已产生一致性分析任务,不允许删除"); } diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index e2ef659c8..0dd71abd2 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -198,11 +198,15 @@ namespace IRaCIS.Core.Application.Service CreateMap(); + //CreateMap().IncludeMembers(t => t.TaskConsistentRule) + // .ForMember(o => o.AnalysisDoctorUser, t => t.MapFrom(u => u.do)); - CreateMap() - .ForMember(o => o.GeneratedSubjectCount, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.IsAnalysisCreate && t.TaskConsistentRuleId == u.Id).Select(t => t.SubjectId).Distinct().Count())) - .ForMember(o => o.GeneratedVisitCount, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.IsAnalysisCreate && t.TaskConsistentRuleId == u.Id).Count())); + //CreateMap() + // .ForMember(o => o.GeneratedSubjectCount, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.IsAnalysisCreate && t.TaskConsistentRuleId == u.Id).Select(t => t.SubjectId).Distinct().Count())) ; + + CreateMap(); + CreateMap(); CreateMap().ForMember(t=>t.Id,u=>u.Ignore()).ReverseMap(); diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index dd9a6cd2c..ea54d4b3d 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Mvc; +using BeetleX.BNR; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Distributed; namespace IRaCIS.Application.Services @@ -18,8 +19,31 @@ namespace IRaCIS.Application.Services //_cache = cache; } - public string Get() + public async Task Get() { + + var subject1 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391693"); + var subject2 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391694"); + + var subjectList = new List() { Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391693") , + Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391694") , + Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391695") + }; + + string[] citys = new string[] { "广州", "深圳", "上海", "北京" }; + foreach (var item in subjectList) + { + Console.WriteLine(await BNRFactory.Default.Create($"[CN:{item}][N:[CN:{item}]/0000000]")); + } + foreach (var item in subjectList) + { + Console.WriteLine(await BNRFactory.Default.Create($"[N:[CN:{item}]/0000000]")); + } + + foreach (var item in subjectList) + { + Console.WriteLine(await BNRFactory.Default.Create($"[CN:{item}][redis:city/0000000]")); + } return _userInfo.LocalIp; } diff --git a/IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs b/IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs index e58b4a476..9734b67dc 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs @@ -11,16 +11,17 @@ using System.Linq; namespace IRaCIS.Core.Domain.Models { - /// - ///TaskConsistentRule - /// - [Table("TaskConsistentRule")] - public class TaskConsistentRule : Entity, IAuditUpdate, IAuditAdd - { - - - public Guid CreateUserId { get; set; } - + /// + ///TaskConsistentRule + /// + [Table("TaskConsistentRule")] + public class TaskConsistentRule : Entity, IAuditUpdate, IAuditAdd + { + + + public Trial Trial { get; set; } + + public Guid CreateUserId { get; set; } public DateTime CreateTime { get; set; } @@ -28,14 +29,6 @@ namespace IRaCIS.Core.Domain.Models public Guid UpdateUserId { get; set; } - - public Guid AnalysisDoctorUserId { get; set; } - - - public bool IsEnable { get; set; } - - public string Note { get; set; } - public Guid TrialId { get; set; } @@ -43,30 +36,32 @@ namespace IRaCIS.Core.Domain.Models public int PlanVisitCount { get; set; } - public int IntervalWeeks { get; set; } - //public Guid? CompareDoctorUserId { get; set; } - //public User AnalysisDoctorUser { get; set; } - - - public bool IsHaveReadingPeriod { get; set; } public bool IsGenerateGlobalTask { get; set; } - - - public User CompareDoctorUser { get; set; } - - - public List DoctorVisitTaskList { get; set; } - + public int BlindSubjectNumberOfPlaces { get; set; } + public string BlindTrialSiteCode { get; set; } = string.Empty; + + public bool IsSelfAnalysis { get; set; } + + //public Guid? CompareDoctorUserId { get; set; } + //public User AnalysisDoctorUser { get; set; } + //public Guid AnalysisDoctorUserId { get; set; } + //public List DoctorVisitTaskList { get; set; } + + public bool IsEnable { get; set; } + + public string Note { get; set; } + + //[Projectable] //public List DoctorConsistentTaskList => DoctorVisitTaskList.Where(t => t.IsAnalysisCreate && t.TaskConsistentRuleId == Id).ToList(); } diff --git a/IRaCIS.Core.Domain/Trial/Enroll.cs b/IRaCIS.Core.Domain/Trial/Enroll.cs index 765e67e73..9b365ae68 100644 --- a/IRaCIS.Core.Domain/Trial/Enroll.cs +++ b/IRaCIS.Core.Domain/Trial/Enroll.cs @@ -7,10 +7,12 @@ namespace IRaCIS.Core.Domain.Models [Table("Enroll")] public partial class Enroll : Entity,IAuditUpdate,IAuditAdd { + [ForeignKey("TrialId")] + public virtual TaskConsistentRule TaskConsistentRule { get; set; } + [ForeignKey("TrialId")] public virtual Trial Trial { get; set; } - public virtual Doctor Doctor { get; set; } //public TrialPaymentPrice TrialPaymentPrice { get; set; } diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs index 016a09682..4766719f7 100644 --- a/IRaCIS.Core.Domain/Trial/Trial.cs +++ b/IRaCIS.Core.Domain/Trial/Trial.cs @@ -15,6 +15,8 @@ namespace IRaCIS.Core.Domain.Models TrialDicList = new List(); } + public List TaskConsistentRuleList { get; set; } + public List SubjectDoctorUserList { get; set; } = new List(); public List VisitTaskList { get; set; } = new List() { }; diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 8507fe51e..41c2ca6b8 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -106,6 +106,7 @@ namespace IRaCIS.Core.Infra.EFCore modelBuilder.Entity().HasOne(t => t.Subject).WithMany(s=>s.SubjectVisitTaskList).HasForeignKey(t => t.SubjectId); + modelBuilder.Entity().HasMany(t => t.ChildList).WithOne(t => t.Parent); modelBuilder.Entity().HasMany(t => t.EarlierSubjectUserList).WithOne(t => t.OrignalSubjectUser); if (_userInfo.IsEn_Us)