裁判任务

Uat_Study
hang 2022-06-21 13:46:03 +08:00
parent 6607b916bb
commit 689fb4d8e0
4 changed files with 13 additions and 8 deletions

View File

@ -7,6 +7,7 @@ using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
namespace IRaCIS.Core.Application.ViewModel
{
@ -235,7 +236,10 @@ namespace IRaCIS.Core.Application.ViewModel
public bool IsAssignedDoctorUser { get; set; }
public bool IsAssignDoctorApplyedTask => DoctorUserList.All(t => t.IsAssignDoctorApplyedTask) && DoctorUserList.Count > 0;
[JsonIgnore]
public bool IsJudge { get; set; }
public bool IsAssignDoctorApplyedTask => DoctorUserList.Where(t=> IsJudge? t.ArmEnum==Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).All(t => t.IsAssignDoctorApplyedTask) && DoctorUserList.Where(t => IsJudge ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Count() > 0;
public List<Guid> DoctorUserIdList => DoctorUserList.Select(t => t.DoctorUserId).ToList();

View File

@ -40,7 +40,7 @@ namespace IRaCIS.Core.Application.Service
.ProjectTo<DoctorVisitTaskStatView>(_mapper.ConfigurationProvider);
var trialTaskConfig= _trialRepository.Where(t=>t.Id==queryTaskAllocationRule.TrialId).ProjectTo<TrialTaskConfigView>(_mapper.ConfigurationProvider).FirstOrDefault();
var trialTaskConfig= _trialRepository.Where(t=>t.Id==queryTaskAllocationRule.TrialId).ProjectTo<TrialTaskConfigView>(_mapper.ConfigurationProvider, new { isJudgeDoctor = queryTaskAllocationRule.IsJudgeDoctor }).FirstOrDefault();
return (await taskAllocationRuleQueryable.ToListAsync(), trialTaskConfig);
}
@ -65,7 +65,7 @@ namespace IRaCIS.Core.Application.Service
{
var verifyExp1 = new EntityVerifyExp<TaskAllocationRule>()
{
VerifyExp = t => t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId && t.TrialId== addOrEditTaskAllocationRule.TrialId,
VerifyExp = t => t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId && t.TrialId== addOrEditTaskAllocationRule.TrialId && t.IsJudgeDoctor,
VerifyMsg = "已有该医生配置,不允许继续增加"
};
@ -79,7 +79,7 @@ namespace IRaCIS.Core.Application.Service
[HttpDelete("{taskAllocationRuleId:guid}/{isJudgeDoctor:bool}")]
public async Task<IResponseOutput> DeleteTaskAllocationRule(Guid taskAllocationRuleId, bool isJudgeDoctor )
{
if(await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId && t.IsJudgeDoctor== isJudgeDoctor).AnyAsync(t => t.DoctorVisitTaskList.Count() > 0))
if(await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId ).AnyAsync(t => t.DoctorVisitTaskList.Where(t=>isJudgeDoctor?t.ArmEnum==Domain.Share.Arm.JudgeArm: t.ArmEnum != Domain.Share.Arm.JudgeArm).Count() > 0))
{
return ResponseOutput.NotOk("已分配任务给该医生,不允许删除");
}

View File

@ -333,7 +333,7 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(querySubjectAssign.DoctorUserId != null && querySubjectAssign.IsJudgeDoctor == false, t => t.SubjectDoctorList.Where(t=>t.ArmEnum != Arm.JudgeArm).Any(t => t.DoctorUserId == querySubjectAssign.DoctorUserId))
.WhereIf(querySubjectAssign.DoctorUserId != null && querySubjectAssign.IsJudgeDoctor, t => t.SubjectDoctorList.Where(t => t.ArmEnum == Arm.JudgeArm).Any(t => t.DoctorUserId == querySubjectAssign.DoctorUserId))
.ProjectTo<SubjectAssignView>(_mapper.ConfigurationProvider);
.ProjectTo<SubjectAssignView>(_mapper.ConfigurationProvider, new { isJudgeDoctor = querySubjectAssign.IsJudgeDoctor });
var pageList = await subjectQuery.ToPagedListAsync(querySubjectAssign.PageIndex, querySubjectAssign.PageSize, string.IsNullOrWhiteSpace(querySubjectAssign.SortField) ? nameof(querySubjectAssign.SubjectId) : querySubjectAssign.SortField, querySubjectAssign.Asc);
@ -560,7 +560,7 @@ namespace IRaCIS.Core.Application.Service
.Select(t => new {
SubjectId = t.Id,
DoctorUserList = t.SubjectDoctorList.Where(t => isJudge? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Select(t => new { t.DoctorUserId, t.ArmEnum }),
IsApplyed = t.SubjectVisitTaskList.Where(t => isJudge? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Any(c => c.DoctorUserId != null)
IsApplyed = t.SubjectDoctorList.Where(t => isJudge? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).SelectMany(t=>t.SubjectArmVisitTaskList).Any(c => c.DoctorUserId != null)
}).ToList();
//已产生任务的Subject数量裁判情况下就是产生裁判任务Subject 的数量)

View File

@ -139,10 +139,11 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.SubjectId, t => t.MapFrom(u => u.Id))
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Code))
.ForMember(o => o.IsAssignedDoctorUser, t => t.MapFrom(u => u.SubjectDoctorList.Any()))
.ForMember(o => o.IsJudge, t => t.MapFrom(u => isJudgeDoctor))
.ForMember(o => o.IsAssignedDoctorUser, t => t.MapFrom(u => u.SubjectDoctorList.Where(t=>isJudgeDoctor? t.ArmEnum == Arm.JudgeArm: t.ArmEnum != Arm.JudgeArm).Any()))
.ForMember(o => o.DoctorUserList, t => t.MapFrom(u => u.SubjectDoctorList.OrderBy(t => t.ArmEnum)));
.ForMember(o => o.DoctorUserList, t => t.MapFrom(u => u.SubjectDoctorList.Where(t => isJudgeDoctor ? true : t.ArmEnum != Arm.JudgeArm).OrderBy(t => t.ArmEnum)));
CreateMap<SubjectUser, AssignDoctorView>()
//.ForMember(o => o.AssignTime, t => t.MapFrom(u => u.AssignTime))