Uat_Study
parent
b5687431f0
commit
74b73e2e59
|
@ -1295,6 +1295,16 @@
|
||||||
阅片计算Dto
|
阅片计算Dto
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto.IsChangeOtherTask">
|
||||||
|
<summary>
|
||||||
|
是否修改其他任务
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto.IsOnlyChangeAllTask">
|
||||||
|
<summary>
|
||||||
|
是否只改其他任务
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.QuestionInfo.Answer">
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.QuestionInfo.Answer">
|
||||||
<summary>
|
<summary>
|
||||||
答案
|
答案
|
||||||
|
@ -3710,6 +3720,11 @@
|
||||||
阅片计算
|
阅片计算
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="F:IRaCIS.Core.Application.Service.ReadingCalculateService.sODData">
|
||||||
|
<summary>
|
||||||
|
获取Sod的值
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.CalculateTask(IRaCIS.Core.Application.Service.Reading.Dto.CalculateTaskInDto)">
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.CalculateTask(IRaCIS.Core.Application.Service.Reading.Dto.CalculateTaskInDto)">
|
||||||
<summary>
|
<summary>
|
||||||
计算任务
|
计算任务
|
||||||
|
@ -3827,20 +3842,25 @@
|
||||||
<param name="inDto"></param>
|
<param name="inDto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.ChangeAllLowestIncrease(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto,System.Guid)">
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.ChangeAllLowestIncrease(IRaCIS.Core.Application.Service.Reading.Dto.ChangeAllTaskDto)">
|
||||||
<summary>
|
<summary>
|
||||||
修改与整个访视期间最低点相比增加的值(mm)
|
修改与整个访视期间最低点相比增加的值(mm)
|
||||||
</summary>
|
</summary>
|
||||||
<param name="inDto"></param>
|
<param name="inDto"></param>
|
||||||
<param name="questionId"></param>
|
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.ChangeAllLowPercent(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto,System.Guid)">
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.ChangeAllLowPercent(IRaCIS.Core.Application.Service.Reading.Dto.ChangeAllTaskDto)">
|
||||||
<summary>
|
<summary>
|
||||||
修改整个访视期间最低点相比增加的百分比
|
修改整个访视期间最低点相比增加的百分比
|
||||||
</summary>
|
</summary>
|
||||||
<param name="inDto"></param>
|
<param name="inDto"></param>
|
||||||
<param name="questionId"></param>
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.ChangeAllLowVisitName(IRaCIS.Core.Application.Service.Reading.Dto.ChangeAllTaskDto)">
|
||||||
|
<summary>
|
||||||
|
修改最低方式点名称
|
||||||
|
</summary>
|
||||||
|
<param name="inDto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.ChangeAllVisitTaskAnswer(System.Collections.Generic.List{System.Guid},System.Guid,System.String)">
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.ChangeAllVisitTaskAnswer(System.Collections.Generic.List{System.Guid},System.Guid,System.String)">
|
||||||
|
|
|
@ -90,7 +90,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ReadingCalculateDto
|
public class ReadingCalculateDto
|
||||||
{
|
{
|
||||||
|
|
||||||
public Guid SubjectId { get; set; }
|
public Guid SubjectId { get; set; }
|
||||||
|
|
||||||
public Guid VisitTaskId { get; set; }
|
public Guid VisitTaskId { get; set; }
|
||||||
|
@ -103,7 +102,15 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
|
|
||||||
public Guid SubjectVisitId { get; set; }
|
public Guid SubjectVisitId { get; set; }
|
||||||
|
|
||||||
public bool IsChangeOtherTask { get; set; }
|
/// <summary>
|
||||||
|
/// 是否修改其他任务
|
||||||
|
/// </summary>
|
||||||
|
public bool IsChangeOtherTask { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否只改其他任务
|
||||||
|
/// </summary>
|
||||||
|
public bool IsOnlyChangeAllTask { get; set; } = false;
|
||||||
|
|
||||||
public List<QuestionInfo> QuestionInfo { get; set; } = new List<QuestionInfo>();
|
public List<QuestionInfo> QuestionInfo { get; set; } = new List<QuestionInfo>();
|
||||||
|
|
||||||
|
@ -191,7 +198,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
{
|
{
|
||||||
public QuestionType QuestionType { get; set; }
|
public QuestionType QuestionType { get; set; }
|
||||||
|
|
||||||
public Func<ReadingCalculateDto, Task<dynamic>> GetSingleDataFun { get; set; }
|
public Func<ReadingCalculateDto, Task<decimal>> GetDecimalFun { get; set; }
|
||||||
|
|
||||||
|
public Func<ReadingCalculateDto, Task<decimal?>> GetDecimalNullFun { get; set; }
|
||||||
|
|
||||||
|
public Func<ReadingCalculateDto, Task<string>> GetStringFun { get; set; }
|
||||||
|
|
||||||
public Func<ChangeAllTaskDto,Task> ChangeAllTaskFun { get; set; }
|
public Func<ChangeAllTaskDto,Task> ChangeAllTaskFun { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Infra.EFCore.Common;
|
using IRaCIS.Core.Infra.EFCore.Common;
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
|
using IRaCIS.Core.Infrastructure;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service
|
namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
|
@ -54,7 +55,12 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 临时对象 单个请求的生命周期 避免重复查询数据库
|
#region 临时对象 单个请求的生命周期 避免重复查询数据库
|
||||||
|
|
||||||
private List<VisitTaskAnswerInfo> visitTaskAnswerList;
|
private List<VisitTaskAnswerInfo> visitTaskAnswerList;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取Sod的值
|
||||||
|
/// </summary>
|
||||||
private decimal? sODData;
|
private decimal? sODData;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -78,151 +84,112 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task ReadingCalculate(ReadingCalculateDto inDto)
|
public async Task ReadingCalculate(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
// 找到所有访视任务的Id
|
|
||||||
|
|
||||||
var visitTaskIds = await _visitTaskRepository.Where(x => !x.IsAnalysisCreate && x.ReadingCategory == ReadingCategory.Visit &&
|
|
||||||
x.TaskState == TaskState.Effect && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.DoctorUserId == inDto.DoctorUserId).Select(x => x.Id).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 计算 这里顺序非常重要 后面计算的值要依赖前面计算的结果
|
#region 计算 这里顺序非常重要 后面计算的值要依赖前面计算的结果
|
||||||
var needAddList = new List<ReadingTaskQuestionAnswer>();
|
var needAddList = new List<ReadingTaskQuestionAnswer>();
|
||||||
// 循环找要计算的值进行计算
|
|
||||||
foreach (var item in inDto.QuestionInfo.Where(x => x.QuestionType != null))
|
|
||||||
|
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
||||||
|
{
|
||||||
|
//靶病灶径线之和(SOD)
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.SOD,GetDecimalNullFun=GetSODData},
|
||||||
|
|
||||||
|
//非淋巴结靶病灶长径之和
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.SumOfDiameter,GetDecimalNullFun=GetSumOfDiameter},
|
||||||
|
|
||||||
|
//与基线SOD相比变化量(mm)
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.SODChange,GetDecimalNullFun=GetSODChange},
|
||||||
|
|
||||||
|
//与基线访视相比SOD变化百分比
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.SODPercent,GetDecimalNullFun=GetSODPercent},
|
||||||
|
|
||||||
|
//与整个访视期间最低点相比增加的值(mm) 其他任务需要改
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.LowestIncrease,GetDecimalNullFun=GetLowestIncrease,ChangeAllTaskFun=ChangeAllLowestIncrease},
|
||||||
|
|
||||||
|
//与整个访视期间最低点相比增加的百分比 其他任务需要改
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.LowPercent,GetDecimalNullFun=GetLowPercent,ChangeAllTaskFun=ChangeAllLowPercent},
|
||||||
|
|
||||||
|
//整个访视期间最低点访视名称 其他任务需要改
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.LowVisit,GetStringFun=GetLowVisit,ChangeAllTaskFun=ChangeAllLowVisitName},
|
||||||
|
|
||||||
|
//是否存在非淋巴结靶病灶
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.IsLymphTarget,GetStringFun=GetIsLymphTarget},
|
||||||
|
|
||||||
|
//是否存在淋巴结靶病灶且该病灶比上一访视短径增加5MM以上
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.IsAddFive,GetStringFun=GetIsAddFive},
|
||||||
|
|
||||||
|
//被评估为NE的单个靶病灶
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.NETarget,GetStringFun=GetNETarget},
|
||||||
|
|
||||||
|
//靶病灶评估
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.TargetLesion,GetStringFun=GetTargetLesionEvaluate},
|
||||||
|
|
||||||
|
//非靶病灶评估
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.NoTargetLesion,GetStringFun=GetNoTargetLesionEvaluate},
|
||||||
|
|
||||||
|
//是否存在新病灶
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.NewLesions,GetStringFun=GetNewLesionEvaluate},
|
||||||
|
|
||||||
|
//整体肿瘤评估
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.Tumor,GetStringFun=GetTumor},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var calculate in calculateList)
|
||||||
|
{
|
||||||
|
var item=inDto.QuestionInfo.FirstOrDefault(x => x.QuestionType == calculate.QuestionType);
|
||||||
|
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
//计算答案
|
||||||
|
if(inDto.IsOnlyChangeAllTask==false)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (item.QuestionType)
|
#region 计算答案
|
||||||
|
if (calculate.GetDecimalFun != null)
|
||||||
{
|
{
|
||||||
// 靶病灶径线之和(SOD)
|
item.Answer = (await calculate.GetDecimalFun(inDto)).ToString();
|
||||||
case QuestionType.SOD:
|
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = (await GetSODData(inDto)).ToString(),
|
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
// 非淋巴结靶病灶长径之和
|
}
|
||||||
case QuestionType.SumOfDiameter:
|
else if (calculate.GetDecimalNullFun != null)
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
|
||||||
{
|
{
|
||||||
Answer = (await GetSumOfDiameter(inDto)).ToString(),
|
var value = await calculate.GetDecimalNullFun(inDto);
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
if (value == null)
|
||||||
});
|
|
||||||
break;
|
|
||||||
// 与基线SOD相比变化量(mm)
|
|
||||||
case QuestionType.SODChange:
|
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
|
||||||
{
|
{
|
||||||
Answer = (await GetSODChange(inDto)).ToString(),
|
item.Answer = string.Empty;
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
}
|
||||||
});
|
else
|
||||||
break;
|
|
||||||
// 与基线访视相比SOD变化百分比
|
|
||||||
case QuestionType.SODPercent:
|
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = (await GetSODPercent(inDto)).ToString(),
|
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
// 与整个访视期间最低点相比增加的值(mm) 其他任务需要改
|
|
||||||
case QuestionType.LowestIncrease:
|
|
||||||
|
|
||||||
if (!inDto.IsChangeOtherTask)
|
|
||||||
{
|
{
|
||||||
|
item.Answer = value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (calculate.GetStringFun != null)
|
||||||
|
{
|
||||||
|
item.Answer = await calculate.GetStringFun(inDto);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
needAddList.Add(new ReadingTaskQuestionAnswer()
|
||||||
{
|
{
|
||||||
Answer = (await GetLowestIncrease(inDto)).ToString(),
|
Answer = item.Answer,
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
ReadingQuestionTrialId = item.QuestionId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// 修改全局
|
||||||
|
if (inDto.IsChangeOtherTask && calculate.ChangeAllTaskFun != null)
|
||||||
{
|
{
|
||||||
await ChangeAllLowestIncrease(new ChangeAllTaskDto()
|
await calculate.ChangeAllTaskFun(new ChangeAllTaskDto()
|
||||||
{
|
{
|
||||||
calculateDto = inDto,
|
calculateDto = inDto,
|
||||||
QuestionId = item.QuestionId,
|
QuestionId = item.QuestionId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
|
||||||
// 与整个访视期间最低点相比增加的百分比 其他任务需要改
|
|
||||||
case QuestionType.LowPercent:
|
|
||||||
|
|
||||||
if (!inDto.IsChangeOtherTask)
|
|
||||||
{
|
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = (await GetLowPercent(inDto)).ToString(),
|
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await ChangeAllLowPercent(inDto, item.QuestionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
|
||||||
// 整个访视期间最低点访视名称 其他任务需要改
|
|
||||||
case QuestionType.LowVisit:
|
|
||||||
var answer = (await GetLowVisit(inDto)).ToString();
|
|
||||||
if (!inDto.IsChangeOtherTask)
|
|
||||||
{
|
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = answer,
|
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (inDto.IsChangeOtherTask)
|
|
||||||
{
|
|
||||||
await this.ChangeAllVisitTaskAnswer(visitTaskIds, item.QuestionId, answer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
// 是否存在非淋巴结靶病灶
|
|
||||||
case QuestionType.IsLymphTarget:
|
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = await GetIsLymphTarget(inDto),
|
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
// 是否存在淋巴结靶病灶且该病灶比上一访视短径增加5MM以上
|
|
||||||
case QuestionType.IsAddFive:
|
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = await GetIsAddFive(inDto),
|
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
// 被评估为NE的单个靶病灶
|
|
||||||
case QuestionType.NETarget:
|
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = await GetNETarget(inDto),
|
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
// 整体肿瘤评估
|
|
||||||
case QuestionType.Tumor:
|
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = await GetTumor(inDto),
|
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var questionIds = needAddList.Select(x => x.ReadingQuestionTrialId).ToList();
|
var questionIds = needAddList.Select(x => x.ReadingQuestionTrialId).ToList();
|
||||||
|
|
||||||
|
@ -252,13 +219,12 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<VerifyVisitTaskQuestionsOutDto> VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto)
|
public async Task<VerifyVisitTaskQuestionsOutDto> VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto)
|
||||||
{
|
{
|
||||||
await this.CalculateTask(new CalculateTaskInDto()
|
|
||||||
{
|
|
||||||
VisitTaskId = inDto.VisitTaskId,
|
|
||||||
IsChangeOtherTask = true
|
|
||||||
});
|
|
||||||
visitTaskAnswerList = null;
|
|
||||||
ReadingCalculateDto data = await GetReadingCalculateDto(inDto.VisitTaskId);
|
ReadingCalculateDto data = await GetReadingCalculateDto(inDto.VisitTaskId);
|
||||||
|
data.IsChangeOtherTask = true;
|
||||||
|
data.IsOnlyChangeAllTask = true;
|
||||||
|
await ReadingCalculate(data);
|
||||||
|
|
||||||
VerifyVisitTaskQuestionsOutDto result = new VerifyVisitTaskQuestionsOutDto() {
|
VerifyVisitTaskQuestionsOutDto result = new VerifyVisitTaskQuestionsOutDto() {
|
||||||
|
|
||||||
IsVerified=true,
|
IsVerified=true,
|
||||||
|
@ -285,6 +251,10 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!result.ErrorMessage.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException(result.ErrorMessage);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,7 +332,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// 非淋巴结的长径 和淋巴结的短径
|
/// 非淋巴结的长径 和淋巴结的短径
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<decimal> GetSODData(ReadingCalculateDto inDto)
|
public async Task<decimal?> GetSODData(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
if (sODData != null)
|
if (sODData != null)
|
||||||
{
|
{
|
||||||
|
@ -371,6 +341,11 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
|
var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
|
||||||
|
|
||||||
|
if (tableQuestion.Count() == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
decimal result = 0;
|
decimal result = 0;
|
||||||
|
|
||||||
foreach (var item in tableQuestion)
|
foreach (var item in tableQuestion)
|
||||||
|
@ -403,10 +378,15 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<decimal> GetSumOfDiameter(ReadingCalculateDto inDto)
|
public async Task<decimal?> GetSumOfDiameter(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
|
var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
|
||||||
|
|
||||||
|
if (tableQuestion.Count() == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
decimal result = 0;
|
decimal result = 0;
|
||||||
|
|
||||||
foreach (var item in tableQuestion)
|
foreach (var item in tableQuestion)
|
||||||
|
@ -429,9 +409,16 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<decimal> GetSODChange(ReadingCalculateDto inDto)
|
public async Task<decimal?> GetSODChange(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
return await GetSODData(inDto) - await GetBaseLineSOD(inDto);
|
|
||||||
|
var value = await GetSODData(inDto);
|
||||||
|
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return value.NullChange0() - await GetBaseLineSOD(inDto);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -441,9 +428,15 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<decimal> GetSODPercent(ReadingCalculateDto inDto)
|
public async Task<decimal?> GetSODPercent(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
var thisSOD = await GetSODData(inDto);
|
var thisSOD = await GetSODData(inDto);
|
||||||
|
|
||||||
|
if (thisSOD == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var baseLineSOD = await GetBaseLineSOD(inDto);
|
var baseLineSOD = await GetBaseLineSOD(inDto);
|
||||||
|
|
||||||
if (baseLineSOD == 0)
|
if (baseLineSOD == 0)
|
||||||
|
@ -452,7 +445,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return decimal.Round(thisSOD * 100 / baseLineSOD, 2);
|
return decimal.Round(thisSOD.NullChange0() * 100 / baseLineSOD, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -466,11 +459,16 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// 要更新之前的
|
/// 要更新之前的
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<decimal> GetLowestIncrease(ReadingCalculateDto inDto)
|
public async Task<decimal?> GetLowestIncrease(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
|
var value = await GetSODData(inDto);
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
var decimalAnswerList = await GetVisitTaskAnswerList(inDto);
|
var decimalAnswerList = await GetVisitTaskAnswerList(inDto);
|
||||||
var minSOD = decimalAnswerList.OrderBy(x => x.SOD).Select(x => x.SOD).FirstOrDefault();
|
var minSOD = decimalAnswerList.OrderBy(x => x.SOD).Select(x => x.SOD).FirstOrDefault();
|
||||||
return await GetSODData(inDto) - minSOD;
|
return value.NullChange0() - minSOD;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -483,9 +481,13 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// 要更新之前的
|
/// 要更新之前的
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<decimal> GetLowPercent(ReadingCalculateDto inDto)
|
public async Task<decimal?> GetLowPercent(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
var thisSOD = await GetSODData(inDto);
|
var thisSOD = await GetSODData(inDto);
|
||||||
|
if (thisSOD == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
var decimalAnswerList = await GetVisitTaskAnswerList(inDto);
|
var decimalAnswerList = await GetVisitTaskAnswerList(inDto);
|
||||||
var minSOD = decimalAnswerList.OrderBy(x => x.SOD).Select(x => x.SOD).FirstOrDefault();
|
var minSOD = decimalAnswerList.OrderBy(x => x.SOD).Select(x => x.SOD).FirstOrDefault();
|
||||||
|
|
||||||
|
@ -495,7 +497,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return decimal.Round((thisSOD- minSOD) * 100 / minSOD, 2);
|
return decimal.Round((thisSOD.NullChange0()- minSOD) * 100 / minSOD, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -618,7 +620,6 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// 修改与整个访视期间最低点相比增加的值(mm)
|
/// 修改与整个访视期间最低点相比增加的值(mm)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <param name="questionId"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task ChangeAllLowestIncrease(ChangeAllTaskDto inDto)
|
public async Task ChangeAllLowestIncrease(ChangeAllTaskDto inDto)
|
||||||
{
|
{
|
||||||
|
@ -642,11 +643,10 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// 修改整个访视期间最低点相比增加的百分比
|
/// 修改整个访视期间最低点相比增加的百分比
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <param name="questionId"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task ChangeAllLowPercent(ReadingCalculateDto inDto, Guid questionId)
|
public async Task ChangeAllLowPercent(ChangeAllTaskDto inDto)
|
||||||
{
|
{
|
||||||
var visitTaskList = await GetVisitTaskAnswerList(inDto);
|
var visitTaskList = await GetVisitTaskAnswerList(inDto.calculateDto);
|
||||||
var lowSod = visitTaskList.Select(x => x.SOD).OrderBy(x => x).FirstOrDefault();
|
var lowSod = visitTaskList.Select(x => x.SOD).OrderBy(x => x).FirstOrDefault();
|
||||||
foreach (var item in visitTaskList)
|
foreach (var item in visitTaskList)
|
||||||
{
|
{
|
||||||
|
@ -660,7 +660,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
percent= decimal.Round((item.SOD - lowSod) * 100 / lowSod, 2);
|
percent= decimal.Round((item.SOD - lowSod) * 100 / lowSod, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == item.VisitTaskId && x.ReadingQuestionTrialId == questionId, x => new ReadingTaskQuestionAnswer()
|
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == item.VisitTaskId && x.ReadingQuestionTrialId == inDto.QuestionId, x => new ReadingTaskQuestionAnswer()
|
||||||
{
|
{
|
||||||
Answer = percent.ToString()
|
Answer = percent.ToString()
|
||||||
});
|
});
|
||||||
|
@ -669,6 +669,26 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 修改最低方式点名称
|
||||||
|
/// <summary>
|
||||||
|
/// 修改最低方式点名称
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task ChangeAllLowVisitName(ChangeAllTaskDto inDto)
|
||||||
|
{
|
||||||
|
// 找到所有访视任务的Id
|
||||||
|
|
||||||
|
var visitTaskIds = await _visitTaskRepository.Where(x => !x.IsAnalysisCreate && x.ReadingCategory == ReadingCategory.Visit &&
|
||||||
|
x.TaskState == TaskState.Effect && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.DoctorUserId == inDto.calculateDto.DoctorUserId).Select(x => x.Id).ToListAsync();
|
||||||
|
|
||||||
|
var answer = (await GetLowVisit(inDto.calculateDto)).ToString();
|
||||||
|
await this.ChangeAllVisitTaskAnswer(visitTaskIds, inDto.QuestionId, answer);
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 通用方法
|
#region 通用方法
|
||||||
|
@ -772,6 +792,11 @@ namespace IRaCIS.Core.Application.Service
|
||||||
public async Task<string> GetTargetLesionEvaluate(ReadingCalculateDto inDto)
|
public async Task<string> GetTargetLesionEvaluate(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
|
var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
|
||||||
|
|
||||||
|
if (tableQuestion.Count() == 0)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
TargetLesionCalculateDto resultData = new TargetLesionCalculateDto()
|
TargetLesionCalculateDto resultData = new TargetLesionCalculateDto()
|
||||||
{
|
{
|
||||||
//非淋巴结靶病灶长径之和 decimal
|
//非淋巴结靶病灶长径之和 decimal
|
||||||
|
@ -965,6 +990,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
var tableQuestions = tableRows.SelectMany(x => x.TableQuestionList).ToList();
|
var tableQuestions = tableRows.SelectMany(x => x.TableQuestionList).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 当前访视存在至少一个明确新病灶
|
// 当前访视存在至少一个明确新病灶
|
||||||
if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer == "明确"))
|
if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer == "明确"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1851,9 +1851,21 @@ namespace IRaCIS.Application.Services
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<VerifyVisitTaskQuestionsOutDto> VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto)
|
public async Task<IResponseOutput> VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto)
|
||||||
{
|
{
|
||||||
return await _readingCalculateService.VerifyVisitTaskQuestions(inDto);
|
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
||||||
|
{
|
||||||
|
|
||||||
|
new ReadingCalculateData (){
|
||||||
|
QuestionType=QuestionType.SOD,
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
await _readingCalculateService.VerifyVisitTaskQuestions(inDto);
|
||||||
|
return ResponseOutput.Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -38,6 +38,19 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static decimal NullChange0(this decimal? value)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return value.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static decimal IsNullOrEmptyReturn0(this string value)
|
public static decimal IsNullOrEmptyReturn0(this string value)
|
||||||
{
|
{
|
||||||
if (value == null || value == string.Empty)
|
if (value == null || value == string.Empty)
|
||||||
|
|
Loading…
Reference in New Issue