代码整理
parent
3c4a8534f0
commit
1e544937fc
|
@ -7,7 +7,6 @@ using Panda.DynamicWebApi.Attributes;
|
|||
using AutoMapper;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Newtonsoft.Json;
|
||||
using IRaCIS.Core.Application.Service;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
|
||||
|
@ -347,81 +346,9 @@ namespace IRaCIS.Application.Services
|
|||
#endregion
|
||||
|
||||
|
||||
#region 表格问题相关
|
||||
#region 访视任务 - Dicom 阅片 表格问题相关查询
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除表格行数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> DeleteReadingRowAnswer(DeleteReadingRowAnswerInDto inDto)
|
||||
{
|
||||
|
||||
var deleteRowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId).FirstNotNullAsync();
|
||||
if (deleteRowInfo==null)
|
||||
{
|
||||
return ResponseOutput.Ok(true);
|
||||
}
|
||||
|
||||
|
||||
if(await _readingTableAnswerRowInfoRepository.AnyAsync(x=>x.SplitRowId== deleteRowInfo.Id&&x.MergeRowId==deleteRowInfo.Id))
|
||||
{
|
||||
throw new BusinessValidationFailedException($"当前病灶分裂出其他病灶或者其他病灶合并到了当前病灶,删除失败");
|
||||
}
|
||||
|
||||
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId);
|
||||
await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId);
|
||||
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId).OrderBy(x => x.RowIndex).ToListAsync();
|
||||
|
||||
var index = 1;
|
||||
foreach (var item in rowInfoList.Where(x=>x.RowIndex%1==0))
|
||||
{
|
||||
|
||||
|
||||
|
||||
await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer()
|
||||
{
|
||||
RowIndex = index
|
||||
});
|
||||
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
RowIndex = index
|
||||
});
|
||||
|
||||
|
||||
|
||||
var spiltList = rowInfoList.Where(x => x.RowIndex % 1 != 0 && x.RowIndex > item.RowIndex && x.RowIndex < Math.Floor(item.RowIndex + 1)).OrderBy(x=>x.RowIndex).ToList();
|
||||
|
||||
decimal spiltindex = 0.01M;
|
||||
foreach (var spiltitem in spiltList)
|
||||
{
|
||||
await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == spiltitem.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer()
|
||||
{
|
||||
RowIndex = index+spiltindex
|
||||
});
|
||||
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == spiltitem.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
RowIndex = index+spiltindex
|
||||
});
|
||||
|
||||
spiltindex += 0.01M;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取DIcom阅片问题答案
|
||||
/// </summary>
|
||||
|
@ -780,9 +707,6 @@ namespace IRaCIS.Application.Services
|
|||
}); ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取子元素
|
||||
/// </summary>
|
||||
|
@ -868,7 +792,7 @@ namespace IRaCIS.Application.Services
|
|||
#endregion
|
||||
|
||||
|
||||
#region 访视任务 - Dicom 阅片
|
||||
#region 访视任务 - Dicom 阅片 提交、修改
|
||||
|
||||
/// <summary>
|
||||
/// 修改Dicom阅片问题
|
||||
|
@ -899,6 +823,78 @@ namespace IRaCIS.Application.Services
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除表格行数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> DeleteReadingRowAnswer(DeleteReadingRowAnswerInDto inDto)
|
||||
{
|
||||
|
||||
var deleteRowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId).FirstNotNullAsync();
|
||||
if (deleteRowInfo == null)
|
||||
{
|
||||
return ResponseOutput.Ok(true);
|
||||
}
|
||||
|
||||
|
||||
if (await _readingTableAnswerRowInfoRepository.AnyAsync(x => x.SplitRowId == deleteRowInfo.Id && x.MergeRowId == deleteRowInfo.Id))
|
||||
{
|
||||
throw new BusinessValidationFailedException($"当前病灶分裂出其他病灶或者其他病灶合并到了当前病灶,删除失败");
|
||||
}
|
||||
|
||||
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId);
|
||||
await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId);
|
||||
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId).OrderBy(x => x.RowIndex).ToListAsync();
|
||||
|
||||
var index = 1;
|
||||
foreach (var item in rowInfoList.Where(x => x.RowIndex % 1 == 0))
|
||||
{
|
||||
|
||||
|
||||
|
||||
await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer()
|
||||
{
|
||||
RowIndex = index
|
||||
});
|
||||
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
RowIndex = index
|
||||
});
|
||||
|
||||
|
||||
|
||||
var spiltList = rowInfoList.Where(x => x.RowIndex % 1 != 0 && x.RowIndex > item.RowIndex && x.RowIndex < Math.Floor(item.RowIndex + 1)).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
decimal spiltindex = 0.01M;
|
||||
foreach (var spiltitem in spiltList)
|
||||
{
|
||||
await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == spiltitem.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer()
|
||||
{
|
||||
RowIndex = index + spiltindex
|
||||
});
|
||||
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == spiltitem.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
RowIndex = index + spiltindex
|
||||
});
|
||||
|
||||
spiltindex += 0.01M;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok(true);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提交表格问题答案 病灶
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue