修改稽查标识

This commit is contained in:
2022-12-09 14:19:24 +08:00
parent dae537a223
commit b825d8f55a
6 changed files with 85 additions and 52 deletions
@@ -1183,7 +1183,6 @@ namespace IRaCIS.Application.Services
await _readingTableQuestionAnswerRepository.UpdatePartialFromQueryAsync(x => x.RowId == inDto.RowId && x.TableQuestionId == item.TableQuestionId, x => new ReadingTableQuestionAnswer()
{
Answer = item.Answer
});
@@ -3,6 +3,7 @@ using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Application.Triggers
{
//访视 质疑状态 触发修改
public class ChallengeStateTrigger : IAfterSaveTrigger<QCChallenge>
{
@@ -40,4 +41,8 @@ namespace IRaCIS.Core.Application.Triggers
u => new SubjectVisit() { ChallengeState = subjectVisitChallengeState });
}
}
}
@@ -0,0 +1,55 @@
using EntityFrameworkCore.Triggered;
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Application.Triggers
{
//病灶编号维护
public class TableQuestionRowTrigger : IBeforeSaveTrigger<ReadingTableAnswerRowInfo>
{
public Task BeforeSave(ITriggerContext<ReadingTableAnswerRowInfo> context, CancellationToken cancellationToken)
{
Dictionary<int, string> splitLesionDic = new Dictionary<int, string>()
{
{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 (context.Entity.RowIndex % 1 == 0)
{
context.Entity.RowMark = context.Entity.OrderMark + decimal.ToInt32(context.Entity.RowIndex).ToString().PadLeft(2, '0');
}
else
{
context.Entity.RowMark = context.Entity.OrderMark + Math.Floor(context.Entity.RowIndex).ToString().PadLeft(2, '0') + splitLesionDic[decimal.ToInt32((context.Entity.RowIndex % 1) * 100)];
}
return Task.CompletedTask;
}
}
}