diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index edf510dcb..3ee8fae89 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -289,6 +289,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public string CalculateQuestions { get; set; } = "[]"; + /// + /// 限制编辑 + /// + public LimitEdit LimitEdit { get; set; } = LimitEdit.None; + /// /// 数值类型 /// @@ -863,6 +868,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public string CalculateQuestions { get; set; } + /// + /// 限制编辑 + /// + public LimitEdit LimitEdit { get; set; } = LimitEdit.None; + /// /// 数据来源 /// @@ -1622,8 +1632,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public string CalculateQuestions { get; set; } = "[]"; + /// + /// 限制编辑 + /// + public LimitEdit LimitEdit { get; set; } = LimitEdit.None; - public List ParentTriggerValueList { get; set; } public List RelevanceValueList { get; set; } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 85eb024ba..f2ccb55fa 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -354,7 +354,7 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task<(List, object)> GetDicomReadingQuestionAnswer(GetDicomReadingQuestionAnswerInDto inDto) { - await AddDefaultValueToTask(inDto.VisitTaskId); + //await AddDefaultValueToTask(inDto.VisitTaskId); var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync(); var result = await GetReadingQuestion(taskInfo.TrialReadingCriterionId, taskInfo.Id); @@ -410,7 +410,9 @@ namespace IRaCIS.Application.Services private void GetDicomReadingAnswer(DicomReadingQuestionAnswer item, List questions, List answers) { - item.Answer = answers.Where(x => x.ReadingQuestionTrialId == item.Id).Select(x => x.Answer).FirstIsNullReturnEmpty(); + var answer= answers.Where(x => x.ReadingQuestionTrialId == item.Id).Select(x => x.Answer).FirstIsNullReturnEmpty(); + item.Answer = answer.IsNullOrEmpty() ? item.DefaultValue : answer; + item.Childrens = questions.Where(x => x.ParentId == item.Id || ((item.Type == ReadingQestionType.Group && x.Type != ReadingQestionType.Group && x.ParentId == null && x.GroupName == item.GroupName))).ToList(); if (item.Childrens != null && item.Childrens.Count > 0) @@ -470,7 +472,7 @@ namespace IRaCIS.Application.Services public async Task<(GetReadingQuestionAndAnswerOutDto, object)> GetReadingQuestionAndAnswer(GetReadingQuestionAndAnswerInDto inDto) { - await AddDefaultValueToTask(inDto.VisitTaskId); + //await AddDefaultValueToTask(inDto.VisitTaskId); var result = new GetReadingQuestionAndAnswerOutDto(); var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync(); @@ -568,7 +570,8 @@ namespace IRaCIS.Application.Services var answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId).ToListAsync(); qusetionList.ForEach(x => { - x.Answer = answers.Where(y => y.ReadingQuestionTrialId == x.Id).Select(x => x.Answer).FirstOrDefault() ?? string.Empty; + var answer= answers.Where(y => y.ReadingQuestionTrialId == x.Id).Select(x => x.Answer).FirstOrDefault() ?? string.Empty; + x.Answer = answer.IsNullOrEmpty() ? x.DefaultValue : answer; }); } @@ -911,8 +914,17 @@ namespace IRaCIS.Application.Services } var index = await _readingCalculateService.GetDeleteLesionStatrIndex(inDto); - await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.RowId == inDto.RowId); - await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.Id == inDto.RowId); + + + await _readingTableQuestionAnswerRepository.UpdatePartialFromQueryAsync(x => x.RowId == inDto.RowId, x => new ReadingTableQuestionAnswer() + { + + IsDeleted = true + }); + await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.RowId,x=>new ReadingTableAnswerRowInfo() { + + IsDeleted=true + }); await _readingTableAnswerRowInfoRepository.SaveChangesAsync(); @@ -1025,7 +1037,9 @@ namespace IRaCIS.Application.Services public async Task SubmitTableQuestion(SubmitTableQuestionInDto inDto) { SubmitTableQuestionOutDto result = new SubmitTableQuestionOutDto(); + await VerifyTaskIsSign(inDto.VisitTaskId); + var questionInfo = await _readingQuestionTrialRepository.Where(x => x.Id == inDto.QuestionId).FirstNotNullAsync(); var criterionId = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.TrialReadingCriterionId).FirstOrDefaultAsync(); var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == criterionId).FirstNotNullAsync(); var tableQuestionIds = inDto.AnswerList.Select(x => x.TableQuestionId).ToList(); @@ -1043,7 +1057,7 @@ namespace IRaCIS.Application.Services if (inDto.RowIndex % 1 == 0) { - var questionInfo = await _readingQuestionTrialRepository.Where(x => x.Id == inDto.QuestionId).FirstNotNullAsync(); + if (questionInfo.MaxQuestionCount != null && questionInfo.MaxQuestionCount != 0) { if (questionInfo.MaxQuestionCount < @@ -1116,6 +1130,7 @@ namespace IRaCIS.Application.Services rowInfo.InstanceId = inDto.InstanceId; rowInfo.SeriesId = inDto.SeriesId; rowInfo.VisitTaskId = inDto.VisitTaskId; + rowInfo.OrderMark = questionInfo.OrderMark; rowInfo.StudyId = inDto.StudyId; rowInfo.IsCanEditPosition = inDto.IsCanEditPosition; result.RowId = rowInfo.Id; diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingTaskQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingTaskQuestionService.cs index 7ed4d1a2e..ac26a7ba3 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingTaskQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingTaskQuestionService.cs @@ -51,7 +51,7 @@ namespace IRaCIS.Application.Services { if (inDto.VisitTaskId != null) { - await AddDefaultValueToTask(inDto.VisitTaskId.Value); + //await AddDefaultValueToTask(inDto.VisitTaskId.Value); } var result = new GetTrialReadingQuestionPageDto(); diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs index 939cb4bb6..7fae6b88e 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs @@ -1180,6 +1180,29 @@ namespace IRaCIS.Core.Domain.Share } + /// + /// 限制编辑 + /// + public enum LimitEdit + { + + /// + /// 否 + /// + None = 0, + + /// + /// 仅基线 + /// + OnlyBaseLine = 1, + + /// + /// 仅随访 + /// + OnlyVisit = 2 + } + + /// /// 是否必填 /// diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingQuestionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingQuestionTrial.cs index d57ee4ba7..d9359d559 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingQuestionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingQuestionTrial.cs @@ -205,6 +205,11 @@ namespace IRaCIS.Core.Domain.Models /// public CustomCalculateMark? CustomCalculateMark { get; set; } + /// + /// 限制编辑 + /// + public LimitEdit LimitEdit { get; set; } = LimitEdit.None; + /// /// 自定义计算标记 /// diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingTableQuestionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingTableQuestionTrial.cs index a0ccde428..130842ccd 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingTableQuestionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingTableQuestionTrial.cs @@ -165,6 +165,11 @@ namespace IRaCIS.Core.Domain.Models /// public CustomCalculateMark? CustomCalculateMark { get; set; } + /// + /// 限制编辑 + /// + public LimitEdit LimitEdit { get; set; } = LimitEdit.None; + /// /// 自定义计算标记 /// diff --git a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs index 9b945c222..1b4d44769 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs @@ -7,21 +7,23 @@ using System; using IRaCIS.Core.Domain.Share; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Collections.Generic; + namespace IRaCIS.Core.Domain.Models { /// /// 表格问题答案行数据 /// [Table("ReadingTableAnswerRowInfo")] - public class ReadingTableAnswerRowInfo : Entity, IAuditAdd - { - [JsonIgnore] - [ForeignKey("InstanceId")] + public class ReadingTableAnswerRowInfo : Entity, IAuditAdd, IAuditUpdate, ISoftDelete + { + [JsonIgnore] + [ForeignKey("InstanceId")] public DicomInstance Instance { get; set; } /// - /// 第一层的Question - /// + /// 第一层的Question + /// public Guid QuestionId { get; set; } /// @@ -93,6 +95,8 @@ namespace IRaCIS.Core.Domain.Models public string BlindName { get; set; } = string.Empty; + public string OrderMark { get; set; } = string.Empty; + /// /// 第一次添加的任务ID /// @@ -106,6 +110,16 @@ namespace IRaCIS.Core.Domain.Models /// public Guid CreateUserId { get; set; } + public Guid UpdateUserId { get; set; } + //string UpdateUserName { get; set; } + public DateTime UpdateTime { get; set; } + + public bool IsDeleted { get; set; } + + public DateTime? DeletedTime { get; set; } + + public Guid? DeleteUserId { get; set; } + [JsonIgnore] [ForeignKey("SplitRowId")] public ReadingTableAnswerRowInfo SplitRow { get; set; } @@ -117,10 +131,56 @@ namespace IRaCIS.Core.Domain.Models public ReadingQuestionTrial ReadingQuestionTrial { get; set; } + public string RowMark + { + + get + { + + Dictionary splitLesionDic = new Dictionary() + { + {1, "a" }, + {2, "b" }, + {3, "c" }, + {4, "d" }, + {5, "e" }, + {6, "f" }, + {7, "g" }, + {8, "h" }, + {9, "i" }, + {10, "j" }, + {11, "k" }, + {12, "l" }, + {13, "m" }, + {14, "n" }, + {15, "o" }, + {16, "p" }, + {17, "q" }, + {18, "r" }, + {19, "s" }, + {20, "t" }, + {21, "u" }, + {22, "v" }, + {23, "w" }, + {24, "x" }, + {25, "y" }, + {26, "z" }, + + }; + if (RowIndex % 1 == 0) + { + return decimal.ToInt32(RowIndex).ToString().PadLeft(2, '0'); + } + else + { + return Math.Floor(RowIndex).ToString().PadLeft(2, '0') + splitLesionDic[decimal.ToInt32((RowIndex % 1) * 100)]; + } + + } + } + } - } - } diff --git a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableQuestionAnswer.cs b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableQuestionAnswer.cs index f1ca0080a..8fdc622dd 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableQuestionAnswer.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableQuestionAnswer.cs @@ -13,8 +13,8 @@ namespace IRaCIS.Core.Domain.Models ///ReadingTableQuestionAnswer /// [Table("ReadingTableQuestionAnswer")] - public class ReadingTableQuestionAnswer : Entity, IAuditAdd - { + public class ReadingTableQuestionAnswer : Entity, IAuditAdd, IAuditUpdate, ISoftDelete + { /// /// 问题Id /// @@ -63,7 +63,18 @@ namespace IRaCIS.Core.Domain.Models public Guid RowId { get; set; } - [JsonIgnore] + public Guid UpdateUserId { get; set; } + //string UpdateUserName { get; set; } + public DateTime UpdateTime { get; set; } + + public bool IsDeleted { get; set; } + + public DateTime? DeletedTime { get; set; } + + public Guid? DeleteUserId { get; set; } + + + [JsonIgnore] [ForeignKey("QuestionId")] public ReadingQuestionTrial ReadingQuestionTrial { get; set; }