增加项目任务配置

This commit is contained in:
2022-06-08 10:39:22 +08:00
parent e26ee1d14a
commit f3b21e4cd4
9 changed files with 86 additions and 4 deletions
@@ -14,7 +14,7 @@ namespace IRaCIS.Core.Application.Interfaces
{
Task<List<TaskAllocationRuleView>> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule);
//Task<List<TaskAllocationRuleView>> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule);
Task<IResponseOutput> AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule);
@@ -8,6 +8,8 @@ using IRaCIS.Core.Domain.Models;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Application.Contracts;
namespace IRaCIS.Core.Application.Service
{
/// <summary>
@@ -20,22 +22,31 @@ namespace IRaCIS.Core.Application.Service
private readonly IRepository<TaskAllocationRule> _taskAllocationRuleRepository;
private readonly IRepository<User> _userRepository;
public TaskAllocationRuleService(IRepository<TaskAllocationRule> taskAllocationRuleRepository, IRepository<User> userRepository)
private readonly IRepository<Trial> _trialRepository;
public TaskAllocationRuleService(IRepository<TaskAllocationRule> taskAllocationRuleRepository, IRepository<User> userRepository, IRepository<Trial> trialRepository)
{
_taskAllocationRuleRepository = taskAllocationRuleRepository;
_userRepository = userRepository;
_trialRepository= trialRepository;
}
[HttpPost]
public async Task<List<TaskAllocationRuleView>> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule)
public async Task<(List<TaskAllocationRuleView>,object)> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule)
{
var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t=>t.TrialId== queryTaskAllocationRule.TrialId)
.ProjectTo<TaskAllocationRuleView>(_mapper.ConfigurationProvider);
return await taskAllocationRuleQueryable.ToListAsync();
var trialTaskConfig= _trialRepository.Where(t=>t.Id==queryTaskAllocationRule.TrialId).ProjectTo<TrialTaskConfig>(_mapper.ConfigurationProvider);
return (await taskAllocationRuleQueryable.ToListAsync(), trialTaskConfig);
}
public async Task<IResponseOutput> AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule)
{
var verifyExp1 = new EntityVerifyExp<TaskAllocationRule>()
@@ -49,6 +49,16 @@ namespace IRaCIS.Core.Application.Service
}
///// <summary>
///// 给医生用户 分配任务
///// </summary>
///// <param name="queryVisitTaskId"></param>
///// <returns></returns>
//public async Task<IResponseOutput> AllocateDoctorUserTask(string queryVisitTaskId)
//{
//}
}
}
@@ -121,6 +121,15 @@ namespace IRaCIS.Core.Application.Contracts
}
public class TrialTaskConfig
{
public Guid TrialId { get; set; }
public TaskAllocateObj TaskAllocateObjEnum { get; set; }
public TaskAllocateDefaultState TaskAllocateDefaultState { get; set; }
}
public class TrialUrgentConfig
{
public Guid TrialId { get; set; }
@@ -348,6 +348,20 @@ namespace IRaCIS.Core.Application
}
/// <summary>
/// 配置项目任务信息
/// </summary>
/// <param name="trialConfig"></param>
/// <returns></returns>
[HttpPut]
public async Task<IResponseOutput> ConfigTrialTaskInfo(TrialTaskConfig trialConfig)
{
var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialConfig.TrialId)).IfNullThrowException();
_mapper.Map(trialConfig, trialInfo);
return ResponseOutput.Ok(await _trialRepository.SaveChangesAsync());
}
}
}
@@ -17,6 +17,10 @@ namespace IRaCIS.Core.Application.Service
//CreateMap<TrialAttachmentCommand, TrialAttachment>().ForMember(t => t.UserTypes, u => u.MapFrom(k => string.Join(',', k.UserTypeList)));
CreateMap<TrialTaskConfig, Trial>().ForMember(d => d.Id, u => u.MapFrom(s => s.TrialId)).ReverseMap();
CreateMap<UserTrialCommand, TrialUser>();
CreateMap<TrialSiteCommand, TrialSite>()