diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index bb9980db9..d1764f822 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -295,6 +295,27 @@ + + + new- 首次审核 后续编辑审核 + + + + + + + new- 回复审核内容 + + + + + + + new- 获取审核对话列表 + + + + PM阅片跟踪 diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index cf4f5b786..d7f91c7c7 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -8,6 +8,7 @@ using IRaCIS.Core.Domain.Share; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Newtonsoft.Json; +using System.ComponentModel.DataAnnotations.Schema; namespace IRaCIS.Core.Application.ViewModel { @@ -75,9 +76,9 @@ namespace IRaCIS.Core.Application.ViewModel public bool IsClinicalDataSign { get; set; } - public CompleteClinicalDataEnum CompleteClinicalDataEnum => + public CompleteClinicalDataEnum CompleteClinicalDataEnum => (IsNeedClinicalDataSign && IsClinicalDataSign) ? CompleteClinicalDataEnum.Complete : (IsNeedClinicalDataSign && IsClinicalDataSign == false) ? CompleteClinicalDataEnum.NotComplete : CompleteClinicalDataEnum.NA; - + /// @@ -147,7 +148,7 @@ namespace IRaCIS.Core.Application.ViewModel } - public class PIReaingTaskView: ReadingTaskView + public class PIReaingTaskView : ReadingTaskView { public Guid? FirstAuditUserId { get; set; } @@ -250,7 +251,7 @@ namespace IRaCIS.Core.Application.ViewModel public Guid SubjectId { get; set; } public string SubjectCode { get; set; } = String.Empty; - public Guid? ClaimUserId { get;set; } + public Guid? ClaimUserId { get; set; } public bool IsUrgent => UnReadTaskList.Any(t => t.IsUrgent); @@ -318,9 +319,9 @@ namespace IRaCIS.Core.Application.ViewModel public class GetOrderReadingIQueryableInDto { - public Guid TrialId { get; set; } - - public Guid TrialReadingCriterionId { get; set; } + public Guid TrialId { get; set; } + + public Guid TrialReadingCriterionId { get; set; } public string? SubjectCode { get; set; } = null; @@ -381,7 +382,7 @@ namespace IRaCIS.Core.Application.ViewModel public string? FirstAuditUserName { get; set; } - + public bool? IsWaitPIAudit { get; set; } @@ -399,9 +400,41 @@ namespace IRaCIS.Core.Application.ViewModel + public class PIAuditTaskCommand + { + [NotDefault] + public Guid VisitTaskId { get; set; } + public string NotAgreeReason { get; set; } + public string PIAuditNote { get; set; } = string.Empty; + + public List PIAuditImagePathList { get; set; } + + public PIAuditState PIAuditState { get; set; } + + public bool? IsEnrollment { get; set; } + + public bool? IsPDConfirm { get; set; } + } + + public class PIAuditTaskReplyCommand + { + [NotDefault] + public Guid VisitTaskId { get; set; } + + public string ReplyContent { get; set; } = string.Empty; + } + + public class PIAuditDialogQuery + { + [NotDefault] + public Guid VisitTaskId { get; set; } + } + public class PIAuditDialogListView: PIAuditTaskCommand + { + } diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 5c20add50..648faed97 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -23,6 +23,7 @@ using Org.BouncyCastle.Crypto; using IRaCIS.Core.Domain.Share.Reading; using Quartz; using IRaCIS.Application.Services.BackGroundJob; +using Magicodes.ExporterAndImporter.Core.Extension; namespace IRaCIS.Core.Application.Service.Allocation { @@ -51,6 +52,7 @@ namespace IRaCIS.Core.Application.Service.Allocation private readonly IRepository _trialReadingCriterionRepository; private readonly IRepository _subjectCriteriaEvaluationVisitStudyFilterRepository; + private readonly IRepository _PIAuditRepository; public VisitTaskService(IRepository subjectVisitRepository, IRepository visitTaskRepository, IRepository trialRepository, IRepository subjectRepository, IRepository subjectUserRepository, IRepository taskAllocationRuleRepository, @@ -61,9 +63,11 @@ namespace IRaCIS.Core.Application.Service.Allocation IRepository readingClinicalDataReposiotry, IRepository subjectCriteriaEvaluationRepository, IRepository subjectCriteriaEvaluationVisitFilterRepository, - IRepository subjectCriteriaEvaluationVisitStudyFilterRepository + IRepository subjectCriteriaEvaluationVisitStudyFilterRepository, + IRepository PIAuditRepository ) { + _PIAuditRepository = PIAuditRepository; _readingClinicalDataReposiotry = readingClinicalDataReposiotry; _taskAllocationRuleRepository = taskAllocationRuleRepository; _visitTaskRepository = visitTaskRepository; @@ -122,8 +126,8 @@ namespace IRaCIS.Core.Application.Service.Allocation [HttpGet("{trialId:guid}")] public async Task> GetTrialDoctorUserSelectList(Guid trialId) { - var query = from trialUser in _trialRepository.Where(t => t.Id == trialId ).SelectMany(t=>t.TrialUserList).Where(t=>t.User.UserTypeEnum==UserTypeEnum.SR || t.User.UserTypeEnum == UserTypeEnum.PI) - + var query = from trialUser in _trialRepository.Where(t => t.Id == trialId).SelectMany(t => t.TrialUserList).Where(t => t.User.UserTypeEnum == UserTypeEnum.SR || t.User.UserTypeEnum == UserTypeEnum.PI) + select new TrialDoctorUserSelectView() { TrialId = trialUser.TrialId, @@ -132,7 +136,7 @@ namespace IRaCIS.Core.Application.Service.Allocation FullName = trialUser.User.FullName, UserCode = trialUser.User.UserCode, UserName = trialUser.User.UserName, - UserTypeEnum = trialUser.User.UserTypeRole.UserTypeEnum + UserTypeEnum = trialUser.User.UserTypeRole.UserTypeEnum }; return await query.ToListAsync(); @@ -210,22 +214,19 @@ namespace IRaCIS.Core.Application.Service.Allocation .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate) .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate!.Value.AddDays(1)) - .WhereIf(queryVisitTask.IsWaitPIAudit ==true, t => t.FirstAuditUserId==null) + .WhereIf(queryVisitTask.IsWaitPIAudit == true, t => t.FirstAuditUserId == null) .WhereIf(queryVisitTask.IsWaitPIAudit == false, t => t.FirstAuditUserId != null) .WhereIf(queryVisitTask.FirstAuditTimeBegin != null, t => t.AllocateTime > queryVisitTask.FirstAuditTimeBegin) .WhereIf(queryVisitTask.FirstAuditTimeEnd != null, t => t.AllocateTime < queryVisitTask.FirstAuditTimeEnd) .WhereIf(queryVisitTask.LatestReplyTimeBegin != null, t => t.AllocateTime > queryVisitTask.LatestReplyTimeBegin) - .WhereIf(queryVisitTask.LatestReplyTimeEnd != null, t => t.AllocateTime < queryVisitTask.LatestReplyTimeEnd) + .WhereIf(queryVisitTask.LatestReplyTimeEnd != null, t => t.AllocateTime < queryVisitTask.LatestReplyTimeEnd); - - ; - - return visitTaskQueryable; + return visitTaskQueryable; } [HttpPost] - public async Task> > GetPIReadingAuditList(VisitTaskQuery queryVisitTask) + public async Task>> GetPIReadingAuditList(VisitTaskQuery queryVisitTask) { var visitTaskQueryable = GetReadingTaskQueryable(queryVisitTask) @@ -239,7 +240,77 @@ namespace IRaCIS.Core.Application.Service.Allocation return ResponseOutput.Ok(pageList, trialTaskConfig); } - + + + /// + ///new- 首次审核 后续编辑审核 + /// + /// + /// + [HttpPost] + + public async Task PIAuditTask(PIAuditTaskCommand incommand) + { + //需要设置首次审核时间 审核人 + var visitTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.Id == incommand.VisitTaskId); + var isFirstAudit = visitTask.FirstAuditUserId == null; + + visitTask.NotAgreeReason = incommand.NotAgreeReason; + visitTask.PIAuditNote = incommand.PIAuditNote; + visitTask.PIAuditImagePath = string.Join('|', incommand.PIAuditImagePathList); + visitTask.PIAuditState = incommand.PIAuditState; + visitTask.IsEnrollment = incommand.IsEnrollment; + visitTask.IsPDConfirm = incommand.IsPDConfirm; + visitTask.LatestReplyUserId = _userInfo.Id; + visitTask.LatestReplyTime = DateTime.Now; + + if (isFirstAudit) + { + visitTask.FirstAuditUserId = _userInfo.Id; + visitTask.FirstAuditTime = DateTime.Now; + } + + //发送对话 + var addDialig = _mapper.Map(incommand); + + await _PIAuditRepository.AddAsync(addDialig); + + await _visitTaskRepository.SaveChangesAsync(); + + return ResponseOutput.Ok(); + + } + + /// + ///new- 回复审核内容 + /// + /// + /// + public async Task PIAuditTaskReply(PIAuditTaskReplyCommand incommand) + { + await _PIAuditRepository.AddAsync(new PIAudit() { ReplyContent=incommand.ReplyContent,VisitTaskId=incommand.VisitTaskId}); + + await _PIAuditRepository.SaveChangesAsync(); + + return ResponseOutput.Ok(); + } + + /// + /// new- 获取审核对话列表 + /// + /// + /// + [HttpPost] + public async Task> GetPIAuditDialogList(PIAuditDialogQuery inQuery) + { + + + var list = await _PIAuditRepository.Where(t => t.VisitTaskId == inQuery.VisitTaskId).OrderBy(t=>t.CreateTime).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + + return list; + } + + /// @@ -259,7 +330,7 @@ namespace IRaCIS.Core.Application.Service.Allocation var trialTaskConfig = _trialRepository.Where(t => t.Id == queryVisitTask.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); - return ResponseOutput.Ok (pageList, trialTaskConfig); + return ResponseOutput.Ok(pageList, trialTaskConfig); } @@ -526,7 +597,7 @@ namespace IRaCIS.Core.Application.Service.Allocation //PI 读随访的时候, subject 如果基线没阅片完,SR就不能看 .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI && piReadingScopenEnum == PIReadingScopenEnum.AllVisit, - t => t.Subject.SubjectVisitTaskList.Any(c => c.SourceSubjectVisit.IsBaseLine == true && c.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState==TaskState.Effect)) + t => t.Subject.SubjectVisitTaskList.Any(c => c.SourceSubjectVisit.IsBaseLine == true && c.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR, t => t.Subject.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) // 仅仅SR阅片 PI 没有任务列表 @@ -1050,7 +1121,7 @@ namespace IRaCIS.Core.Application.Service.Allocation { //IR申请 PM 审批 注意这里有一致性分析的申请同意 不会回退访视,在此要生成影响的访视任务 - if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.DocotorApply && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager ) + if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.DocotorApply && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) { //有序阅片 @@ -1199,7 +1270,7 @@ namespace IRaCIS.Core.Application.Service.Allocation _ = _readingTaskQuestionAnswerRepository.AddRangeAsync(list).Result; } - + } } @@ -1772,8 +1843,8 @@ namespace IRaCIS.Core.Application.Service.Allocation //IR 申请 PM 同意 仅仅影响自己 - if ((_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && (t.CreateUser.UserTypeEnum == UserTypeEnum.SR|| t.CreateUser.UserTypeEnum == UserTypeEnum.PI))) - || ( (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR|| _userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI) && applyId == null)) + if ((_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && (t.CreateUser.UserTypeEnum == UserTypeEnum.SR || t.CreateUser.UserTypeEnum == UserTypeEnum.PI))) + || ((_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI) && applyId == null)) { //当前任务及其之后的所有访视任务、全局任务、裁判任务、肿瘤学阅片任务 diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index 608fc9c20..d5d93b403 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -315,8 +315,9 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.Id, t => t.MapFrom(u => u.InfluenceTask.Id)); + CreateMap(); - + CreateMap(); } } diff --git a/IRaCIS.Core.Domain/Allocation/PIAudit.cs b/IRaCIS.Core.Domain/Allocation/PIAudit.cs index f760f4699..81ad9cd25 100644 --- a/IRaCIS.Core.Domain/Allocation/PIAudit.cs +++ b/IRaCIS.Core.Domain/Allocation/PIAudit.cs @@ -7,48 +7,61 @@ using System; using IRaCIS.Core.Domain.Share; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Collections.Generic; +using System.Linq; + namespace IRaCIS.Core.Domain.Models { - /// - ///PIAudit - /// - [Table("PIAudit")] - public class PIAudit : Entity, IAuditAdd - { - - /// - /// Id - /// - [Key] - [Required] - public Guid Id { get; set; } - - /// - /// PIAuditNote - /// - public string PIAuditNote { get; set; } - - /// - /// NotAgreeReason - /// - public string NotAgreeReason { get; set; } - - /// - /// PIAuditImagePath - /// - public string PIAuditImagePath { get; set; } - - /// - /// CreateUserId - /// - [Required] - public Guid CreateUserId { get; set; } - - /// - /// CreateTime - /// - [Required] - public DateTime CreateTime { get; set; } - - } -} + /// + ///PIAudit + /// + [Table("PIAudit")] + public class PIAudit : Entity, IAuditAdd + { + + [JsonIgnore] + public VisitTask VisitTask { get; set; } + + public Guid VisitTaskId { get; set; } + + public string ReplyContent { get; set; }=string.Empty; + + public bool? IsEnrollment { get; set; } + + public bool? IsPDConfirm { get; set; } + + public string PIAuditNote { get; set; } = string.Empty; + + + public string NotAgreeReason { get; set; } = string.Empty; + + + public string PIAuditImagePath { get; set; } = string.Empty; + + + public Guid CreateUserId { get; set; } + + + public DateTime CreateTime { get; set; } + + [NotMapped] + public List PIAuditImagePathList + { + get + { + + try + { + return this.PIAuditImagePath.Trim().Split('|').ToList(); + } + catch (Exception) + { + + return new List(); + } + + } + } + + } +} diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index 807a75aad..decee508a 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -19,7 +19,7 @@ namespace IRaCIS.Core.Domain.Models [Table("VisitTask")] public class VisitTask : Entity, IAuditUpdate, IAuditAdd { - + public List PIAuditList { get; set; } = new List(); public string TaskName { get; set; } = string.Empty; public string TaskBlindName { get; set; } = string.Empty; @@ -451,7 +451,9 @@ namespace IRaCIS.Core.Domain.Models public PIAuditState PIAuditState { get; set; } + public bool? IsEnrollment { get; set; } + public bool? IsPDConfirm { get; set; } [JsonIgnore]