自身一致性分析提交
parent
6c29ececb0
commit
a7cb06fed0
|
@ -61,6 +61,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper.Collection.EntityFrameworkCore" Version="8.0.0" />
|
<PackageReference Include="AutoMapper.Collection.EntityFrameworkCore" Version="8.0.0" />
|
||||||
|
<PackageReference Include="BeetleX.BNR" Version="1.0.1" />
|
||||||
<PackageReference Include="Castle.Core.AsyncInterceptor" Version="2.1.0" />
|
<PackageReference Include="Castle.Core.AsyncInterceptor" Version="2.1.0" />
|
||||||
<PackageReference Include="EasyCaching.Interceptor.AspectCore" Version="1.5.1" />
|
<PackageReference Include="EasyCaching.Interceptor.AspectCore" Version="1.5.1" />
|
||||||
<PackageReference Include="ExcelDataReader" Version="3.6.0" />
|
<PackageReference Include="ExcelDataReader" Version="3.6.0" />
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
<param name="inCommand"></param>
|
<param name="inCommand"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.TaskConsistentRuleService.GetSelfConsistentRuleList(IRaCIS.Core.Application.ViewModel.TaskConsistentRuleQuery)">
|
<member name="M:IRaCIS.Core.Application.Service.TaskConsistentRuleService.GetSelfConsistentDoctorStatList(IRaCIS.Core.Application.ViewModel.TaskConsistentRuleQuery)">
|
||||||
<summary>
|
<summary>
|
||||||
自身一致性分配 配置+ 统计已经生成数量统计表
|
自身一致性分配 配置+ 统计已经生成数量统计表
|
||||||
</summary>
|
</summary>
|
||||||
|
|
|
@ -7,6 +7,7 @@ using System;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.ViewModel
|
namespace IRaCIS.Core.Application.ViewModel
|
||||||
{
|
{
|
||||||
|
@ -23,14 +24,21 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
|
|
||||||
public int? GeneratedSubjectCount { get; set; }
|
public int? GeneratedSubjectCount { get; set; }
|
||||||
|
|
||||||
public int? GeneratedVisitCount { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class TaskConsistentRuleBasic : TaskConsistentRuleAddOrEdit
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ConsistentQuery : PageInput
|
public class ConsistentQuery : PageInput
|
||||||
{
|
{
|
||||||
|
[NotDefault]
|
||||||
|
public Guid DoctorUserId { get; set; }
|
||||||
|
[NotDefault]
|
||||||
public Guid TaskConsistentRuleId { get; set; }
|
public Guid TaskConsistentRuleId { get; set; }
|
||||||
|
|
||||||
//public int PlanSubjectCount { get; set; }
|
//public int PlanSubjectCount { get; set; }
|
||||||
|
@ -46,6 +54,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
public class ConsistentConfirmGenerateCommand
|
public class ConsistentConfirmGenerateCommand
|
||||||
{
|
{
|
||||||
public Guid TaskConsistentRuleId { get; set; }
|
public Guid TaskConsistentRuleId { get; set; }
|
||||||
|
[NotDefault]
|
||||||
|
public Guid DoctorUserId { get; set; }
|
||||||
|
|
||||||
public List<Guid> SubejctIdList { get; set; }
|
public List<Guid> SubejctIdList { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -180,7 +190,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
{
|
{
|
||||||
public Guid TrialId { get; set; }
|
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 IsHaveReadingPeriod { get; set; }
|
||||||
public bool IsGenerateGlobalTask { get; set; }
|
public bool IsGenerateGlobalTask { get; set; }
|
||||||
|
|
||||||
public Guid AnalysisDoctorUserId { get; set; }
|
public bool IsSelfAnalysis { get; set; }
|
||||||
|
|
||||||
public int BlindSubjectNumberOfPlaces { get; set; }
|
public int BlindSubjectNumberOfPlaces { get; set; }
|
||||||
public string BlindTrialSiteCode { get; set; } = string.Empty;
|
public string BlindTrialSiteCode { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,15 @@ namespace IRaCIS.Core.Application.Service
|
||||||
private readonly IRepository<VisitTask> _visitTaskRepository;
|
private readonly IRepository<VisitTask> _visitTaskRepository;
|
||||||
private readonly IRepository<SubjectUser> _subjectUserRepository;
|
private readonly IRepository<SubjectUser> _subjectUserRepository;
|
||||||
private readonly IRepository<Subject> _subjectRepository;
|
private readonly IRepository<Subject> _subjectRepository;
|
||||||
|
private readonly IRepository<Enroll> _enrollRepository;
|
||||||
|
|
||||||
public TaskConsistentRuleService(IRepository<VisitTask> visitTaskRepository, IRepository<TaskConsistentRule> taskConsistentRuleRepository, IRepository<SubjectUser> subjectUserRepository, IRepository<Subject> subjectRepository)
|
public TaskConsistentRuleService(IRepository<VisitTask> visitTaskRepository, IRepository<Enroll> enrollRepository, IRepository<TaskConsistentRule> taskConsistentRuleRepository, IRepository<SubjectUser> subjectUserRepository, IRepository<Subject> subjectRepository)
|
||||||
{
|
{
|
||||||
_taskConsistentRuleRepository = taskConsistentRuleRepository;
|
_taskConsistentRuleRepository = taskConsistentRuleRepository;
|
||||||
_visitTaskRepository = visitTaskRepository;
|
_visitTaskRepository = visitTaskRepository;
|
||||||
_subjectUserRepository = subjectUserRepository;
|
_subjectUserRepository = subjectUserRepository;
|
||||||
_subjectRepository = subjectRepository;
|
_subjectRepository = subjectRepository;
|
||||||
|
_enrollRepository = enrollRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +81,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inQuery.TaskConsistentRuleId);
|
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<IResponseOutput> ConfirmGenerateSelfConsistentTask(ConsistentConfirmGenerateCommand inCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService)
|
public async Task<IResponseOutput> ConfirmGenerateSelfConsistentTask(ConsistentConfirmGenerateCommand inCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService)
|
||||||
{
|
{
|
||||||
var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inCommand.TaskConsistentRuleId);
|
var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inCommand.TaskConsistentRuleId);
|
||||||
|
var doctorUserId = inCommand.DoctorUserId;
|
||||||
|
|
||||||
|
var list = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, doctorUserId, inCommand.SubejctIdList).ToListAsync();
|
||||||
var list = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, inCommand.SubejctIdList).ToListAsync();
|
|
||||||
|
|
||||||
//var (group, query) = GetIQueryableDoctorSelfConsistentRuleSubjectView(filterObj, inCommand.SubejctIdList);
|
//var (group, query) = GetIQueryableDoctorSelfConsistentRuleSubjectView(filterObj, inCommand.SubejctIdList);
|
||||||
|
|
||||||
|
@ -124,11 +126,27 @@ namespace IRaCIS.Core.Application.Service
|
||||||
foreach (var subject in list)
|
foreach (var subject in list)
|
||||||
{
|
{
|
||||||
//处理 Subject 编号
|
//处理 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 =>
|
subject.VisitTaskList.Take(filterObj.PlanVisitCount).ForEach(t =>
|
||||||
{
|
{
|
||||||
t.DoctorUserId = filterObj.AnalysisDoctorUserId;
|
t.DoctorUserId = doctorUserId;
|
||||||
t.TaskConsistentRuleId = filterObj.Id;
|
t.TaskConsistentRuleId = filterObj.Id;
|
||||||
t.BlindTrialSiteCode = filterObj.BlindTrialSiteCode;
|
t.BlindTrialSiteCode = filterObj.BlindTrialSiteCode;
|
||||||
|
t.BlindSubjectCode = blindSubjectCode;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,9 +175,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IQueryable<DoctorSelfConsistentSubjectView> GetIQueryableDoctorSelfConsistentSubjectView(TaskConsistentRule filterObj, List<Guid>? subejctIdList = null)
|
private IQueryable<DoctorSelfConsistentSubjectView> GetIQueryableDoctorSelfConsistentSubjectView(TaskConsistentRule filterObj, Guid doctorUserId, List<Guid>? subejctIdList = null)
|
||||||
{
|
{
|
||||||
var doctorUserId = filterObj.AnalysisDoctorUserId;
|
|
||||||
var trialId = filterObj.TrialId;
|
var trialId = filterObj.TrialId;
|
||||||
|
|
||||||
#region Subejct 维度
|
#region Subejct 维度
|
||||||
|
@ -241,100 +258,11 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private (IQueryable<IGrouping<Guid, VisitTask>>, IQueryable<DoctorConsistentRuleSubjectView>) GetIQueryableDoctorSelfConsistentRuleSubjectView(TaskConsistentRule filterObj, List<Guid>? subejctIdList = null)
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<TaskConsistentRuleBasic?> GetConsistentRule(TaskConsistentRuleQuery inQuery)
|
||||||
{
|
{
|
||||||
var doctorUserId = filterObj.AnalysisDoctorUserId;
|
return await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsSelfAnalysis == inQuery.IsSelfAnalysis).ProjectTo<TaskConsistentRuleBasic>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -343,90 +271,124 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// <param name="inQuery"></param>
|
/// <param name="inQuery"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<List<TaskConsistentRuleView>> GetSelfConsistentRuleList(TaskConsistentRuleQuery inQuery)
|
public async Task<List<TaskConsistentRuleView>> GetSelfConsistentDoctorStatList(TaskConsistentRuleQuery inQuery)
|
||||||
{
|
{
|
||||||
|
var trialId = inQuery.TrialId;
|
||||||
|
|
||||||
#region 是否有新的医生加入 自动加入配置
|
var taskConsistentRuleQueryable = from enroll in _repository.Where<Enroll>(t => t.TrialId == trialId)
|
||||||
|
join user in _repository.Where<User>() on enroll.DoctorId equals user.DoctorId
|
||||||
|
join taskConsistentRule in _repository.Where<TaskConsistentRule>(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<TaskConsistentRuleBatchAddOrEdit>(_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<TaskConsistentRuleBatchAddOrEdit>(_mapper.ConfigurationProvider).FirstAsync();
|
||||||
|
|
||||||
await BatchAddOrUpdateTaskConsistentRule(rule);
|
// rule.IsBatchAdd = true;
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
// await BatchAddOrUpdateTaskConsistentRule(rule);
|
||||||
|
//}
|
||||||
|
|
||||||
var taskConsistentRuleQueryable = _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId)
|
//#endregion
|
||||||
.ProjectTo<TaskConsistentRuleView>(_mapper.ConfigurationProvider);
|
|
||||||
|
//var taskConsistentRuleQueryable = _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||||
|
// .ProjectTo<TaskConsistentRuleView>(_mapper.ConfigurationProvider);
|
||||||
|
|
||||||
return await taskConsistentRuleQueryable.ToListAsync();
|
return await taskConsistentRuleQueryable.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IResponseOutput> BatchAddOrUpdateTaskConsistentRule(TaskConsistentRuleBatchAddOrEdit addOrEdit)
|
|
||||||
{
|
|
||||||
var trialId = addOrEdit.TrialId;
|
//public async Task<IResponseOutput> BatchAddOrUpdateTaskConsistentRule(TaskConsistentRuleBatchAddOrEdit addOrEdit)
|
||||||
|
//{
|
||||||
|
// var trialId = addOrEdit.TrialId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (addOrEdit.IsBatchAdd)
|
// if (addOrEdit.IsBatchAdd)
|
||||||
{
|
// {
|
||||||
var query = from enroll in _repository.Where<Enroll>(t => t.TrialId == trialId)
|
// var query = from enroll in _repository.Where<Enroll>(t => t.TrialId == trialId)
|
||||||
join user in _repository.Where<User>() on enroll.DoctorId equals user.DoctorId
|
// join user in _repository.Where<User>() on enroll.DoctorId equals user.DoctorId
|
||||||
join taskConsistentRule in _repository.Where<TaskConsistentRule>(t => t.TrialId == trialId) on user.Id equals taskConsistentRule.AnalysisDoctorUserId into c
|
// join taskConsistentRule in _repository.Where<TaskConsistentRule>(t => t.TrialId == trialId) on user.Id equals taskConsistentRule.AnalysisDoctorUserId into c
|
||||||
from taskConsistentRule in c.DefaultIfEmpty()
|
// from taskConsistentRule in c.DefaultIfEmpty()
|
||||||
select new
|
// select new
|
||||||
{
|
// {
|
||||||
TrialId = enroll.TrialId,
|
// TrialId = enroll.TrialId,
|
||||||
|
|
||||||
DoctorUserId = user.Id,
|
// DoctorUserId = user.Id,
|
||||||
//FullName = user.FullName,
|
// //FullName = user.FullName,
|
||||||
//UserCode = user.UserCode,
|
// //UserCode = user.UserCode,
|
||||||
//UserName = user.UserName,
|
// //UserName = user.UserName,
|
||||||
|
|
||||||
IsHaveConfig = taskConsistentRule != null
|
// IsHaveConfig = taskConsistentRule != null
|
||||||
};
|
// };
|
||||||
|
|
||||||
var doctorList = await query.ToListAsync();
|
// var doctorList = await query.ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
foreach (var doctor in doctorList)
|
// foreach (var doctor in doctorList)
|
||||||
{
|
// {
|
||||||
if (!doctor.IsHaveConfig)
|
// if (!doctor.IsHaveConfig)
|
||||||
{
|
// {
|
||||||
var verifyExp1 = new EntityVerifyExp<TaskConsistentRule>()
|
// var verifyExp1 = new EntityVerifyExp<TaskConsistentRule>()
|
||||||
{
|
// {
|
||||||
VerifyExp = t => t.AnalysisDoctorUserId == doctor.DoctorUserId && t.TrialId == trialId,
|
// VerifyExp = t => t.AnalysisDoctorUserId == doctor.DoctorUserId && t.TrialId == trialId,
|
||||||
VerifyMsg = "已有该医生配置,不允许继续增加"
|
// VerifyMsg = "已有该医生配置,不允许继续增加"
|
||||||
};
|
// };
|
||||||
|
|
||||||
addOrEdit.AnalysisDoctorUserId = doctor.DoctorUserId;
|
// addOrEdit.AnalysisDoctorUserId = doctor.DoctorUserId;
|
||||||
addOrEdit.Id = Guid.Empty;
|
// addOrEdit.Id = Guid.Empty;
|
||||||
|
|
||||||
var entity = await _taskConsistentRuleRepository.InsertOrUpdateAsync(addOrEdit, true, verifyExp1);
|
// var entity = await _taskConsistentRuleRepository.InsertOrUpdateAsync(addOrEdit, true, verifyExp1);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
await _taskConsistentRuleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId, c => new TaskConsistentRule()
|
// await _taskConsistentRuleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId, c => new TaskConsistentRule()
|
||||||
{
|
// {
|
||||||
PlanSubjectCount = c.PlanSubjectCount,
|
// PlanSubjectCount = c.PlanSubjectCount,
|
||||||
PlanVisitCount = c.PlanVisitCount,
|
// PlanVisitCount = c.PlanVisitCount,
|
||||||
IntervalWeeks = c.IntervalWeeks,
|
// IntervalWeeks = c.IntervalWeeks,
|
||||||
IsGenerateGlobalTask = c.IsGenerateGlobalTask,
|
// IsGenerateGlobalTask = c.IsGenerateGlobalTask,
|
||||||
IsHaveReadingPeriod = c.IsHaveReadingPeriod
|
// 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<TaskConsistentRule>()
|
var verifyExp1 = new EntityVerifyExp<TaskConsistentRule>()
|
||||||
{
|
{
|
||||||
VerifyExp = t => t.AnalysisDoctorUserId == addOrEditTaskConsistentRule.AnalysisDoctorUserId && t.TrialId == addOrEditTaskConsistentRule.TrialId,
|
VerifyExp = t => t.TrialId == addOrEditTaskConsistentRule.TrialId && t.IsSelfAnalysis == addOrEditTaskConsistentRule.IsSelfAnalysis,
|
||||||
VerifyMsg = "已有该医生配置,不允许继续增加"
|
VerifyMsg = "已有该项目配置,不允许继续增加"
|
||||||
};
|
};
|
||||||
|
|
||||||
var entity = await _taskConsistentRuleRepository.InsertOrUpdateAsync(addOrEditTaskConsistentRule, true, verifyExp1);
|
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);
|
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("已产生一致性分析任务,不允许删除");
|
throw new BusinessValidationFailedException("已产生一致性分析任务,不允许删除");
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,11 +198,15 @@ namespace IRaCIS.Core.Application.Service
|
||||||
CreateMap<TaskMedicalReviewRuleAddOrEdit, TaskMedicalReviewRule>();
|
CreateMap<TaskMedicalReviewRuleAddOrEdit, TaskMedicalReviewRule>();
|
||||||
|
|
||||||
|
|
||||||
|
//CreateMap<Enroll, TaskConsistentRuleView>().IncludeMembers(t => t.TaskConsistentRule)
|
||||||
|
// .ForMember(o => o.AnalysisDoctorUser, t => t.MapFrom(u => u.do));
|
||||||
|
|
||||||
CreateMap<TaskConsistentRule, TaskConsistentRuleView>()
|
|
||||||
.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<TaskConsistentRule, TaskConsistentRuleView>()
|
||||||
|
// .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<TaskConsistentRule, TaskConsistentRuleBasic>();
|
||||||
|
|
||||||
CreateMap<TaskConsistentRuleAddOrEdit, TaskConsistentRule>();
|
CreateMap<TaskConsistentRuleAddOrEdit, TaskConsistentRule>();
|
||||||
|
|
||||||
CreateMap<TaskConsistentRuleBatchAddOrEdit, TaskConsistentRule>().ForMember(t=>t.Id,u=>u.Ignore()).ReverseMap();
|
CreateMap<TaskConsistentRuleBatchAddOrEdit, TaskConsistentRule>().ForMember(t=>t.Id,u=>u.Ignore()).ReverseMap();
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using BeetleX.BNR;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Caching.Distributed;
|
using Microsoft.Extensions.Caching.Distributed;
|
||||||
|
|
||||||
namespace IRaCIS.Application.Services
|
namespace IRaCIS.Application.Services
|
||||||
|
@ -18,8 +19,31 @@ namespace IRaCIS.Application.Services
|
||||||
//_cache = cache;
|
//_cache = cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Get()
|
public async Task<string> Get()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var subject1 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391693");
|
||||||
|
var subject2 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391694");
|
||||||
|
|
||||||
|
var subjectList = new List<Guid>() { 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;
|
return _userInfo.LocalIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,16 +11,17 @@ using System.Linq;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Domain.Models
|
namespace IRaCIS.Core.Domain.Models
|
||||||
{
|
{
|
||||||
///<summary>
|
///<summary>
|
||||||
///TaskConsistentRule
|
///TaskConsistentRule
|
||||||
///</summary>
|
///</summary>
|
||||||
[Table("TaskConsistentRule")]
|
[Table("TaskConsistentRule")]
|
||||||
public class TaskConsistentRule : Entity, IAuditUpdate, IAuditAdd
|
public class TaskConsistentRule : Entity, IAuditUpdate, IAuditAdd
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public Guid CreateUserId { get; set; }
|
public Trial Trial { get; set; }
|
||||||
|
|
||||||
|
public Guid CreateUserId { get; set; }
|
||||||
|
|
||||||
public DateTime CreateTime { get; set; }
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
@ -28,14 +29,6 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
public Guid UpdateUserId { get; set; }
|
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; }
|
public Guid TrialId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,30 +36,32 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
public int PlanVisitCount { get; set; }
|
public int PlanVisitCount { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public int IntervalWeeks { get; set; }
|
public int IntervalWeeks { get; set; }
|
||||||
|
|
||||||
|
|
||||||
//public Guid? CompareDoctorUserId { get; set; }
|
|
||||||
//public User AnalysisDoctorUser { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public bool IsHaveReadingPeriod { get; set; }
|
public bool IsHaveReadingPeriod { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public bool IsGenerateGlobalTask { get; set; }
|
public bool IsGenerateGlobalTask { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public User CompareDoctorUser { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public List<VisitTask> DoctorVisitTaskList { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public int BlindSubjectNumberOfPlaces { get; set; }
|
public int BlindSubjectNumberOfPlaces { get; set; }
|
||||||
|
|
||||||
public string BlindTrialSiteCode { get; set; } = string.Empty;
|
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<VisitTask> DoctorVisitTaskList { get; set; }
|
||||||
|
|
||||||
|
public bool IsEnable { get; set; }
|
||||||
|
|
||||||
|
public string Note { get; set; }
|
||||||
|
|
||||||
|
|
||||||
//[Projectable]
|
//[Projectable]
|
||||||
//public List<VisitTask> DoctorConsistentTaskList => DoctorVisitTaskList.Where(t => t.IsAnalysisCreate && t.TaskConsistentRuleId == Id).ToList();
|
//public List<VisitTask> DoctorConsistentTaskList => DoctorVisitTaskList.Where(t => t.IsAnalysisCreate && t.TaskConsistentRuleId == Id).ToList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,12 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
[Table("Enroll")]
|
[Table("Enroll")]
|
||||||
public partial class Enroll : Entity,IAuditUpdate,IAuditAdd
|
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 Trial Trial { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public virtual Doctor Doctor { get; set; }
|
public virtual Doctor Doctor { get; set; }
|
||||||
|
|
||||||
//public TrialPaymentPrice TrialPaymentPrice { get; set; }
|
//public TrialPaymentPrice TrialPaymentPrice { get; set; }
|
||||||
|
|
|
@ -15,6 +15,8 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
TrialDicList = new List<TrialDictionary>();
|
TrialDicList = new List<TrialDictionary>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<TaskConsistentRule> TaskConsistentRuleList { get; set; }
|
||||||
|
|
||||||
public List<SubjectUser> SubjectDoctorUserList { get; set; } = new List<SubjectUser>();
|
public List<SubjectUser> SubjectDoctorUserList { get; set; } = new List<SubjectUser>();
|
||||||
public List<VisitTask> VisitTaskList { get; set; } = new List<VisitTask>() { };
|
public List<VisitTask> VisitTaskList { get; set; } = new List<VisitTask>() { };
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
modelBuilder.Entity<VisitTask>().HasOne(t => t.Subject).WithMany(s=>s.SubjectVisitTaskList).HasForeignKey(t => t.SubjectId);
|
modelBuilder.Entity<VisitTask>().HasOne(t => t.Subject).WithMany(s=>s.SubjectVisitTaskList).HasForeignKey(t => t.SubjectId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
modelBuilder.Entity<Dictionary>().HasMany(t => t.ChildList).WithOne(t => t.Parent);
|
modelBuilder.Entity<Dictionary>().HasMany(t => t.ChildList).WithOne(t => t.Parent);
|
||||||
modelBuilder.Entity<SubjectUser>().HasMany(t => t.EarlierSubjectUserList).WithOne(t => t.OrignalSubjectUser);
|
modelBuilder.Entity<SubjectUser>().HasMany(t => t.EarlierSubjectUserList).WithOne(t => t.OrignalSubjectUser);
|
||||||
if (_userInfo.IsEn_Us)
|
if (_userInfo.IsEn_Us)
|
||||||
|
|
Loading…
Reference in New Issue