随机阅片随机序号
parent
c8bbb3da48
commit
05ce4b7155
|
@ -216,6 +216,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
//public bool IsAfterConvertedTask { get; set; }
|
||||
|
||||
public string PMBackReason { get; set; }
|
||||
|
||||
public int? RandomOrder { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
@ -482,6 +484,9 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
public string? RequestReReadingReason { get; set; }
|
||||
|
||||
public ExportResult? ReadingExportType { get; set; }
|
||||
|
||||
public int? RandomOrder { get; set; }
|
||||
public bool? IsRandomOrderList { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
@ -908,6 +913,30 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
CancelAssign = 4,
|
||||
}
|
||||
|
||||
|
||||
public class SetRandomTaskOrderCommand
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public Guid TrialReadingCriterionId { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public Guid DoctorUserId { get; set; }
|
||||
|
||||
public bool IsAutoSet { get; set; }
|
||||
|
||||
public List<VisitTaskOrderCommand> SetList { get; set; }
|
||||
}
|
||||
|
||||
public class VisitTaskOrderCommand
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public int? RandomOrder { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|||
return await _visitTaskRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task<List<TrialReadingCriterionDto>> GetTrialCriterionList(Guid trialId, bool isHaveSigned = true, bool? isAutoCreate = null)
|
||||
public async Task<List<TrialReadingCriterionDto>> GetTrialCriterionList(Guid trialId, bool isHaveSigned = true, bool? isAutoCreate = null, bool? isRandom = null)
|
||||
{
|
||||
var list = await _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsConfirm)
|
||||
|
||||
|
@ -107,7 +107,8 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|||
|
||||
|
||||
return list.AsQueryable().WhereIf(isHaveSigned == true, t => t.ReadingInfoSignTime != null)
|
||||
.WhereIf(isAutoCreate == false, t => t.IsAutoCreate == isAutoCreate).ToList();
|
||||
.WhereIf(isAutoCreate == false, t => t.IsAutoCreate == isAutoCreate)
|
||||
.WhereIf(isRandom == true, t => t.IsReadingTaskViewInOrder == ReadingOrder.Random).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
@ -761,6 +762,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|||
.WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate)
|
||||
.WhereIf(inQuery.BeginSignTime != null, t => t.SignTime > inQuery.BeginSignTime)
|
||||
.WhereIf(inQuery.EndSignTime != null, t => t.SignTime < inQuery.EndSignTime)
|
||||
.WhereIf(inQuery.RandomOrder != null, t => t.RandomOrder == inQuery.RandomOrder)
|
||||
.ProjectTo<ReadingTaskView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var defalutSortArray = new string[] { nameof(ReadingTaskView.IsUrgent) + " desc", nameof(ReadingTaskView.SubjectCode), nameof(ReadingTaskView.VisitTaskNum) };
|
||||
|
@ -1055,7 +1057,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|||
ReadingCategory = u.ReadingCategory,
|
||||
IsAnalysisCreate = u.IsAnalysisCreate,
|
||||
ArmEnum = u.ArmEnum,
|
||||
IsExistUnprocessedFeedback=u.UserFeedBackList.Any(t => t.State ==0),
|
||||
IsExistUnprocessedFeedback = u.UserFeedBackList.Any(t => t.State == 0),
|
||||
TrialReadingCriterionId = u.TrialReadingCriterionId,
|
||||
IsNeedClinicalDataSign = u.IsNeedClinicalDataSign,
|
||||
IsClinicalDataSign = u.IsClinicalDataSign,
|
||||
|
@ -2209,7 +2211,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|||
_ = _readingCustomTagRepository.AddRangeAsync(readingCustomTagList).Result;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var readingTaskQuestionAnswerList = _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == origenalTask.Id).ToList();
|
||||
|
||||
|
@ -2233,7 +2235,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|||
item.MeasureData = item.MeasureData.Replace(origenalTask.Id.ToString(), newTask.Id.ToString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//ReadingTableAnswerRowInfo ReadingTableQuestionAnswer 一起加
|
||||
var readingTableAnswerRowInfoList = _readingTableAnswerRowInfoRepository.Where(t => t.VisitTaskId == origenalTask.Id).Include(t => t.LesionAnswerList).ToList();
|
||||
|
@ -2244,7 +2246,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|||
var originalVisitTaskId = item.VisitTaskId;
|
||||
var originalFristAddTaskId = item.FristAddTaskId;
|
||||
|
||||
var newRowId= NewId.NextSequentialGuid();
|
||||
var newRowId = NewId.NextSequentialGuid();
|
||||
|
||||
foreach (var mark in readingTaskQuestionMarkList)
|
||||
{
|
||||
|
@ -2285,7 +2287,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|||
[UnitOfWork]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
|
||||
public async Task<IResponseOutput> PMSetTaskBack(Guid trialId, Guid taskId,string pmBackReason)
|
||||
public async Task<IResponseOutput> PMSetTaskBack(Guid trialId, Guid taskId, string pmBackReason)
|
||||
{
|
||||
|
||||
//var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
@ -2616,7 +2618,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|||
|
||||
private bool IsSpmOrCPM()
|
||||
{
|
||||
return _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM ;
|
||||
return _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2679,9 +2681,9 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|||
}
|
||||
else
|
||||
{
|
||||
//默认影响的都是该标准的任务
|
||||
filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == filterObj.TrialReadingCriterionId);
|
||||
|
||||
//默认影响的都是该标准的任务
|
||||
filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == filterObj.TrialReadingCriterionId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2942,6 +2944,86 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|||
}
|
||||
|
||||
|
||||
#region 完全随机设置序号
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput> SetRandomTaskOrder(SetRandomTaskOrderCommand inCommand)
|
||||
{
|
||||
|
||||
if (inCommand.IsAutoSet)
|
||||
{
|
||||
//找到所有的已分配的,未阅片的,生效的 非一致性分析
|
||||
|
||||
var needRandomOrderList = _visitTaskRepository.Where(t => t.TrialId == inCommand.TrialId && t.TrialReadingCriterionId == inCommand.TrialReadingCriterionId && t.DoctorUserId == inCommand.DoctorUserId)
|
||||
.Where(t => t.TaskAllocationState == TaskAllocationState.Allocated && t.ReadingTaskState == ReadingTaskState.WaitReading && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze))
|
||||
.Select(t => t.Id).ToList();
|
||||
|
||||
|
||||
//var haveSignOrderList = _visitTaskRepository.Where(t => t.TrialId == inCommand.TrialId && t.TrialReadingCriterionId == inCommand.TrialReadingCriterionId && t.DoctorUserId == inCommand.DoctorUserId)
|
||||
// .Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.SignTime != null && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze))
|
||||
// .Select(t => t.RandomOrder).ToList();
|
||||
|
||||
//已阅,阅片中任务的序号
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == inCommand.TrialId && t.TrialReadingCriterionId == inCommand.TrialReadingCriterionId
|
||||
&& t.DoctorUserId == inCommand.DoctorUserId && t.ReadingTaskState != ReadingTaskState.WaitReading, u => new VisitTask() { RandomOrder = null });
|
||||
|
||||
//随机赋值编号 比如要处理5个任务,实例化一个包含1-5的数组,每次随机取出一个
|
||||
List<int> availableNumbers = Enumerable.Range(1, needRandomOrderList.Count).ToList();
|
||||
Random rng = new Random();
|
||||
foreach (var id in needRandomOrderList)
|
||||
{
|
||||
int randomIndex = rng.Next(availableNumbers.Count);
|
||||
|
||||
var order = 11 + 5 * (randomIndex - 1);
|
||||
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.Id == id, t => new VisitTask() { RandomOrder = randomIndex });
|
||||
|
||||
availableNumbers.RemoveAt(randomIndex);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in inCommand.SetList)
|
||||
{
|
||||
var task = await _visitTaskRepository.Where(t => t.Id == item.Id).Select(t => new { t.RandomOrder, t.ReadingTaskState, t.TaskAllocationState, t.DoctorUserId }).FirstNotNullAsync();
|
||||
|
||||
if (task.ReadingTaskState != ReadingTaskState.WaitReading || task.DoctorUserId != inCommand.DoctorUserId
|
||||
|| task.TaskAllocationState != TaskAllocationState.Allocated)
|
||||
{
|
||||
//"任务不符合设置阅片序号条件"
|
||||
return ResponseOutput.NotOk(_localizer["VisitTask_NotRandomOrderTask"]);
|
||||
}
|
||||
|
||||
//设置交换序号的任务,可能不符合条件
|
||||
|
||||
//没有序号,直接设置
|
||||
if (task.RandomOrder == null)
|
||||
{
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, t => new VisitTask() { RandomOrder = item.RandomOrder });
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!_visitTaskRepository.Any(t => t.TrialId == inCommand.TrialId && t.TrialReadingCriterionId == inCommand.TrialReadingCriterionId && t.DoctorUserId == inCommand.DoctorUserId
|
||||
&& t.TaskAllocationState == TaskAllocationState.Allocated && t.ReadingTaskState == ReadingTaskState.WaitReading && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze)
|
||||
&& t.RandomOrder == item.RandomOrder))
|
||||
{
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, t => new VisitTask() { RandomOrder = item.RandomOrder });
|
||||
}
|
||||
else
|
||||
{
|
||||
//"序号已被占用!"
|
||||
return ResponseOutput.NotOk(_localizer["VisitTask_RandomOrderUserd"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region 暂时废弃
|
||||
|
||||
|
||||
|
|
|
@ -288,4 +288,13 @@ public class VisitTask : BaseFullAuditEntity
|
|||
|
||||
[Comment("退回原因")]
|
||||
public string PMBackReason { get; set; }
|
||||
|
||||
#region 完全随机增加字段
|
||||
|
||||
[Comment("完全随机阅片号")]
|
||||
public int? RandomOrder { get; set; }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
19756
IRaCIS.Core.Infra.EFCore/Migrations/20250613024223_addRandomOrder.Designer.cs
generated
Normal file
19756
IRaCIS.Core.Infra.EFCore/Migrations/20250613024223_addRandomOrder.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,70 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addRandomOrder : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "RandomOrder",
|
||||
table: "VisitTask",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
comment: "完全随机阅片号");
|
||||
|
||||
//migrationBuilder.CreateIndex(
|
||||
// name: "IX_NoneDicomStudy_TrialId",
|
||||
// table: "NoneDicomStudy",
|
||||
// column: "TrialId");
|
||||
|
||||
//migrationBuilder.CreateIndex(
|
||||
// name: "IX_ClinicalForm_ReadingId",
|
||||
// table: "ClinicalForm",
|
||||
// column: "ReadingId");
|
||||
|
||||
//migrationBuilder.AddForeignKey(
|
||||
// name: "FK_ClinicalForm_SubjectVisit_ReadingId",
|
||||
// table: "ClinicalForm",
|
||||
// column: "ReadingId",
|
||||
// principalTable: "SubjectVisit",
|
||||
// principalColumn: "Id");
|
||||
|
||||
//migrationBuilder.AddForeignKey(
|
||||
// name: "FK_NoneDicomStudy_Trial_TrialId",
|
||||
// table: "NoneDicomStudy",
|
||||
// column: "TrialId",
|
||||
// principalTable: "Trial",
|
||||
// principalColumn: "Id",
|
||||
// onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ClinicalForm_SubjectVisit_ReadingId",
|
||||
table: "ClinicalForm");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_NoneDicomStudy_Trial_TrialId",
|
||||
table: "NoneDicomStudy");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_NoneDicomStudy_TrialId",
|
||||
table: "NoneDicomStudy");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ClinicalForm_ReadingId",
|
||||
table: "ClinicalForm");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RandomOrder",
|
||||
table: "VisitTask");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -487,6 +487,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
|
||||
b.HasIndex("CreateUserId");
|
||||
|
||||
b.HasIndex("ReadingId");
|
||||
|
||||
b.HasIndex("SubjectId");
|
||||
|
||||
b.ToTable("ClinicalForm", t =>
|
||||
|
@ -3287,6 +3289,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
|
||||
b.HasIndex("SubjectVisitId");
|
||||
|
||||
b.HasIndex("TrialId");
|
||||
|
||||
b.ToTable("NoneDicomStudy", t =>
|
||||
{
|
||||
t.HasComment("影像 - 非dicom检查");
|
||||
|
@ -14390,6 +14394,10 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
.HasColumnType("nvarchar(2000)")
|
||||
.HasComment("既往任务Id 不包括自己");
|
||||
|
||||
b.Property<int?>("RandomOrder")
|
||||
.HasColumnType("int")
|
||||
.HasComment("完全随机阅片号");
|
||||
|
||||
b.Property<int>("ReReadingApplyState")
|
||||
.HasColumnType("int")
|
||||
.HasComment("重阅状态");
|
||||
|
@ -14867,6 +14875,10 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit")
|
||||
.WithMany("ClinicalFormList")
|
||||
.HasForeignKey("ReadingId");
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject")
|
||||
.WithMany("ClinicalFormList")
|
||||
.HasForeignKey("SubjectId")
|
||||
|
@ -14878,6 +14890,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.Navigation("CreateUserRole");
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
||||
b.Navigation("SubjectVisit");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalQuestionAnswer", b =>
|
||||
|
@ -15467,6 +15481,12 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.Trial", null)
|
||||
.WithMany("NoneDicomStudyList")
|
||||
.HasForeignKey("TrialId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CreateUserRole");
|
||||
|
||||
b.Navigation("Subject");
|
||||
|
@ -16573,7 +16593,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
.IsRequired();
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask")
|
||||
.WithMany()
|
||||
.WithMany("ReadingTaskQuestionMarkList")
|
||||
.HasForeignKey("VisitTaskId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
@ -19241,6 +19261,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
{
|
||||
b.Navigation("CheckChallengeDialogList");
|
||||
|
||||
b.Navigation("ClinicalFormList");
|
||||
|
||||
b.Navigation("NoneDicomStudyList");
|
||||
|
||||
b.Navigation("PreviousHistoryList");
|
||||
|
@ -19309,6 +19331,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
|
||||
b.Navigation("EnrollList");
|
||||
|
||||
b.Navigation("NoneDicomStudyList");
|
||||
|
||||
b.Navigation("ReadModuleList");
|
||||
|
||||
b.Navigation("ReadingClinicalDataList");
|
||||
|
@ -19436,6 +19460,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
|
||||
b.Navigation("ReadingTaskQuestionAnswerList");
|
||||
|
||||
b.Navigation("ReadingTaskQuestionMarkList");
|
||||
|
||||
b.Navigation("TaskInfluenceList");
|
||||
|
||||
b.Navigation("TaskMedicalReviewList");
|
||||
|
|
Loading…
Reference in New Issue