自定义问题标记修改
parent
395e7b4388
commit
02beaa24fc
|
@ -8399,6 +8399,11 @@
|
|||
保存表格问题标记
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SaveTableQuestionMarkInDto.MarkId">
|
||||
<summary>
|
||||
标记的唯一标识符
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetPreviousOtherPicturePathInDto.QuestionType">
|
||||
<summary>
|
||||
问题类型
|
||||
|
@ -8794,6 +8799,11 @@
|
|||
表格问题标记
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.QuestionMarkInfo.MarkId">
|
||||
<summary>
|
||||
标记的唯一标识符
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReadingQuestionAndAnswerInDto.QuestionClassify">
|
||||
<summary>
|
||||
问题分类
|
||||
|
|
|
@ -505,6 +505,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public int? OtherNumberOfFrames { get; set; }
|
||||
|
||||
public string OtherMeasureData { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 标记的唯一标识符
|
||||
/// </summary>
|
||||
public Guid? MarkId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
@ -675,6 +680,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public bool UpdateMark { get; set; } = false;
|
||||
|
||||
public string param { get; set; }
|
||||
|
||||
public List<ChangeDicomReadingQuestionAnswerDto> Answers { get; set; }
|
||||
|
||||
|
||||
|
@ -1295,6 +1302,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public Guid? RowId { get; set; }
|
||||
|
||||
public Guid? TableQuestionId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 标记的唯一标识符
|
||||
/// </summary>
|
||||
public Guid? MarkId { get; set; }
|
||||
}
|
||||
public class GetReadingQuestionAndAnswerInDto
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ using IRaCIS.Core.Infra.EFCore.Common;
|
|||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
@ -1915,9 +1916,16 @@ namespace IRaCIS.Core.Application.Service
|
|||
[HttpPost]
|
||||
public async Task<IResponseOutput> SaveTaskQuestion(ChangeDicomReadingQuestionAnswerInDto inDto, string param)
|
||||
{
|
||||
|
||||
inDto.param= param;
|
||||
|
||||
// 当 param == -10 时,为自定义标准 需要区分 绑定 更改 标记
|
||||
if (param == "-10")
|
||||
{
|
||||
// 自定义这边 移除标记 还是会传过来 不过 MeasureData 为空字符串
|
||||
inDto.QuestionMarkInfoList = inDto.QuestionMarkInfoList.Where(x => x.MeasureData.IsNotNullOrEmpty()).ToList();
|
||||
|
||||
|
||||
var questionMarkList = inDto.QuestionMarkInfoList.Select(x => x.QuestionId).ToList();
|
||||
|
||||
var existsMark = await _readingTaskQuestionMarkRepository.AnyAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.MeasureData != string.Empty && questionMarkList.Contains(x.QuestionId));
|
||||
|
@ -1984,7 +1992,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x=>x.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
|
||||
var tumorQuestionId = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId && x.QuestionType == QuestionType.Tumor).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
|
@ -2034,7 +2042,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
if (inDto.UpdateMark)
|
||||
{
|
||||
var questionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).Select(x => new
|
||||
var questionList = inDto.Answers.Select(x => x.Id as Guid?).ToList();
|
||||
|
||||
var questionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId&& questionList.Contains(x.QuestionId)).Select(x => new
|
||||
{
|
||||
x.QuestionId,
|
||||
x.FristAddTaskId,
|
||||
|
@ -2045,37 +2055,104 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
List<Guid?> needDeleteMarkQuestonIds = inDto.Answers.Where(x => x.Answer == string.Empty).Select(x => (Guid?)x.Id).ToList();
|
||||
|
||||
|
||||
await _readingTaskQuestionMarkRepository.BatchUpdateNoTrackingAsync(x =>
|
||||
(x.QuestionType == QuestionType.SplenicTopPosition || x.QuestionType == QuestionType.SplenicBottomPosition) &&
|
||||
x.VisitTaskId == inDto.VisitTaskId && needDeleteMarkQuestonIds.Contains(x.QuestionId), x => new ReadingTaskQuestionMark()
|
||||
switch (taskInfo.TrialReadingCriterion.CriterionType)
|
||||
{
|
||||
PicturePath = string.Empty,
|
||||
MeasureData = string.Empty,
|
||||
});
|
||||
|
||||
await _readingTaskQuestionMarkRepository.BatchUpdateNoTrackingAsync(x =>
|
||||
(x.QuestionType == QuestionType.LiverSUVmax || x.QuestionType == QuestionType.MediastinumSUVmax) &&
|
||||
x.VisitTaskId == inDto.VisitTaskId && needDeleteMarkQuestonIds.Contains(x.QuestionId), x => new ReadingTaskQuestionMark()
|
||||
case CriterionType.SelfDefine:
|
||||
// 先找到需要删除的
|
||||
var needDeleteMarkQuestionIds = questionList.Except(markquestionId).ToList();
|
||||
foreach (var item in needDeleteMarkQuestionIds)
|
||||
{
|
||||
// 对于要删除的标记不能删除 要与问题解绑
|
||||
// 但是对于一个标记绑定多个问题的情况 相当于是要删除掉这条信息
|
||||
var questionMark=await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == item).FirstOrDefaultAsync();
|
||||
if (questionMark != null)
|
||||
{
|
||||
if (questionMark.MarkId == null)
|
||||
{
|
||||
await _readingTaskQuestionMarkRepository.DeleteAsync(questionMark);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (await _readingTaskQuestionMarkRepository.AnyAsync(x => x.MarkId == questionMark.MarkId && x.Id != questionMark.Id))
|
||||
{
|
||||
await _readingTaskQuestionMarkRepository.DeleteAsync(questionMark);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _readingTaskQuestionMarkRepository.UpdatePartialFromQueryAsync(x => x.Id == questionMark.Id, x => new ReadingTaskQuestionMark()
|
||||
{
|
||||
QuestionId = null,
|
||||
MeasureData = string.Empty,
|
||||
PicturePath = string.Empty,
|
||||
OtherMeasureData = string.Empty,
|
||||
OtherPicturePath = string.Empty,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 新增或者修改的标记
|
||||
var otherMark = inDto.QuestionMarkInfoList.Where(x => !needDeleteMarkQuestionIds.Contains(x.QuestionId)).Select(x => x.QuestionId).ToList();
|
||||
|
||||
await addOrEditmark(inDto.QuestionMarkInfoList.Where(x => otherMark.Contains(x.QuestionId)).ToList());
|
||||
break;
|
||||
|
||||
case CriterionType.Lugano2014:
|
||||
|
||||
await _readingTaskQuestionMarkRepository.BatchUpdateNoTrackingAsync(x =>
|
||||
(x.QuestionType == QuestionType.SplenicTopPosition || x.QuestionType == QuestionType.SplenicBottomPosition) &&
|
||||
x.VisitTaskId == inDto.VisitTaskId && needDeleteMarkQuestonIds.Contains(x.QuestionId), x => new ReadingTaskQuestionMark()
|
||||
{
|
||||
PicturePath = string.Empty,
|
||||
MeasureData = string.Empty,
|
||||
});
|
||||
|
||||
await _readingTaskQuestionMarkRepository.BatchUpdateNoTrackingAsync(x =>
|
||||
(x.QuestionType == QuestionType.LiverSUVmax || x.QuestionType == QuestionType.MediastinumSUVmax) &&
|
||||
x.VisitTaskId == inDto.VisitTaskId && needDeleteMarkQuestonIds.Contains(x.QuestionId), x => new ReadingTaskQuestionMark()
|
||||
{
|
||||
OtherPicturePath = string.Empty,
|
||||
OtherMeasureData = string.Empty,
|
||||
});
|
||||
|
||||
await addOrEditmark(inDto.QuestionMarkInfoList);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
await addOrEditmark(inDto.QuestionMarkInfoList);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
async Task addOrEditmark(List<QuestionMarkInfo> addOrUpdatemarkList)
|
||||
{
|
||||
OtherPicturePath = string.Empty,
|
||||
OtherMeasureData = string.Empty,
|
||||
});
|
||||
|
||||
var markQuestionIds= addOrUpdatemarkList.Select(y => (Guid?)y.QuestionId).ToList();
|
||||
|
||||
await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId));
|
||||
|
||||
var datetime = DateTime.Now;
|
||||
|
||||
var markList = _mapper.Map<List<QuestionMarkInfo>, List<ReadingTaskQuestionMark>>(addOrUpdatemarkList);
|
||||
markList.ForEach(x =>
|
||||
{
|
||||
x.Id = NewId.NextGuid();
|
||||
x.VisitTaskId = inDto.VisitTaskId;
|
||||
x.CreateTime = datetime;
|
||||
x.FristAddTaskId = questionMarkList.Where(y => y.QuestionId == x.QuestionId).Select(x => x.FristAddTaskId).FirstOrDefault() ?? inDto.VisitTaskId;
|
||||
});
|
||||
await _readingTaskQuestionMarkRepository.AddRangeAsync(markList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && markquestionId.Contains(x.QuestionId));
|
||||
|
||||
var datetime = DateTime.Now;
|
||||
|
||||
var markList = _mapper.Map<List<QuestionMarkInfo>, List<ReadingTaskQuestionMark>>(inDto.QuestionMarkInfoList);
|
||||
markList.ForEach(x =>
|
||||
{
|
||||
x.Id = NewId.NextGuid();
|
||||
x.VisitTaskId = inDto.VisitTaskId;
|
||||
x.CreateTime = datetime;
|
||||
x.FristAddTaskId = questionMarkList.Where(y => y.QuestionId == x.QuestionId).Select(x => x.FristAddTaskId).FirstOrDefault() ?? inDto.VisitTaskId;
|
||||
});
|
||||
await _readingTaskQuestionMarkRepository.AddRangeAsync(markList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -68,4 +68,9 @@ public class ReadingTaskQuestionMark : BaseAddAuditEntity
|
|||
/// 把之前历史的ReadingCustomTag 数据移动到这个表中 这个是历史数据的迁移字段
|
||||
/// </summary>
|
||||
public Guid? CustomTagId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标记的唯一标识符
|
||||
/// </summary>
|
||||
public Guid? MarkId { get; set; }
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class markId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "MarkId",
|
||||
table: "ReadingTaskQuestionMark",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MarkId",
|
||||
table: "ReadingTaskQuestionMark");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7273,6 +7273,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.Property<Guid?>("InstanceId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("MarkId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("MarkTool")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
|
Loading…
Reference in New Issue