随机阅片随机序号
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
483c7c68e8
commit
15dd21451e
|
@ -216,6 +216,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
//public bool IsAfterConvertedTask { get; set; }
|
//public bool IsAfterConvertedTask { get; set; }
|
||||||
|
|
||||||
public string PMBackReason { 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 string? RequestReReadingReason { get; set; }
|
||||||
|
|
||||||
public ExportResult? ReadingExportType { 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,
|
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();
|
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)
|
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)
|
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.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate)
|
||||||
.WhereIf(inQuery.BeginSignTime != null, t => t.SignTime > inQuery.BeginSignTime)
|
.WhereIf(inQuery.BeginSignTime != null, t => t.SignTime > inQuery.BeginSignTime)
|
||||||
.WhereIf(inQuery.EndSignTime != null, t => t.SignTime < inQuery.EndSignTime)
|
.WhereIf(inQuery.EndSignTime != null, t => t.SignTime < inQuery.EndSignTime)
|
||||||
|
.WhereIf(inQuery.RandomOrder != null, t => t.RandomOrder == inQuery.RandomOrder)
|
||||||
.ProjectTo<ReadingTaskView>(_mapper.ConfigurationProvider);
|
.ProjectTo<ReadingTaskView>(_mapper.ConfigurationProvider);
|
||||||
|
|
||||||
var defalutSortArray = new string[] { nameof(ReadingTaskView.IsUrgent) + " desc", nameof(ReadingTaskView.SubjectCode), nameof(ReadingTaskView.VisitTaskNum) };
|
var defalutSortArray = new string[] { nameof(ReadingTaskView.IsUrgent) + " desc", nameof(ReadingTaskView.SubjectCode), nameof(ReadingTaskView.VisitTaskNum) };
|
||||||
|
@ -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 暂时废弃
|
#region 暂时废弃
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -293,4 +293,13 @@ public class VisitTask : BaseFullAuditEntity
|
||||||
|
|
||||||
[Comment("退回原因")]
|
[Comment("退回原因")]
|
||||||
public string PMBackReason { get; set; }
|
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("CreateUserId");
|
||||||
|
|
||||||
|
b.HasIndex("ReadingId");
|
||||||
|
|
||||||
b.HasIndex("SubjectId");
|
b.HasIndex("SubjectId");
|
||||||
|
|
||||||
b.ToTable("ClinicalForm", t =>
|
b.ToTable("ClinicalForm", t =>
|
||||||
|
@ -3290,6 +3292,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
|
||||||
b.HasIndex("SubjectVisitId");
|
b.HasIndex("SubjectVisitId");
|
||||||
|
|
||||||
|
b.HasIndex("TrialId");
|
||||||
|
|
||||||
b.ToTable("NoneDicomStudy", t =>
|
b.ToTable("NoneDicomStudy", t =>
|
||||||
{
|
{
|
||||||
t.HasComment("影像 - 非dicom检查");
|
t.HasComment("影像 - 非dicom检查");
|
||||||
|
@ -14575,6 +14579,10 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
.HasColumnType("nvarchar(2000)")
|
.HasColumnType("nvarchar(2000)")
|
||||||
.HasComment("既往任务Id 不包括自己");
|
.HasComment("既往任务Id 不包括自己");
|
||||||
|
|
||||||
|
b.Property<int?>("RandomOrder")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("完全随机阅片号");
|
||||||
|
|
||||||
b.Property<int>("ReReadingApplyState")
|
b.Property<int>("ReReadingApplyState")
|
||||||
.HasColumnType("int")
|
.HasColumnType("int")
|
||||||
.HasComment("重阅状态");
|
.HasComment("重阅状态");
|
||||||
|
@ -15052,6 +15060,10 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit")
|
||||||
|
.WithMany("ClinicalFormList")
|
||||||
|
.HasForeignKey("ReadingId");
|
||||||
|
|
||||||
b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject")
|
b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject")
|
||||||
.WithMany("ClinicalFormList")
|
.WithMany("ClinicalFormList")
|
||||||
.HasForeignKey("SubjectId")
|
.HasForeignKey("SubjectId")
|
||||||
|
@ -15063,6 +15075,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.Navigation("CreateUserRole");
|
b.Navigation("CreateUserRole");
|
||||||
|
|
||||||
b.Navigation("Subject");
|
b.Navigation("Subject");
|
||||||
|
|
||||||
|
b.Navigation("SubjectVisit");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalQuestionAnswer", b =>
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalQuestionAnswer", b =>
|
||||||
|
@ -15652,6 +15666,12 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.Trial", null)
|
||||||
|
.WithMany("NoneDicomStudyList")
|
||||||
|
.HasForeignKey("TrialId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("CreateUserRole");
|
b.Navigation("CreateUserRole");
|
||||||
|
|
||||||
b.Navigation("Subject");
|
b.Navigation("Subject");
|
||||||
|
@ -16758,7 +16778,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask")
|
b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask")
|
||||||
.WithMany()
|
.WithMany("ReadingTaskQuestionMarkList")
|
||||||
.HasForeignKey("VisitTaskId")
|
.HasForeignKey("VisitTaskId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
@ -19499,6 +19519,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
{
|
{
|
||||||
b.Navigation("CheckChallengeDialogList");
|
b.Navigation("CheckChallengeDialogList");
|
||||||
|
|
||||||
|
b.Navigation("ClinicalFormList");
|
||||||
|
|
||||||
b.Navigation("NoneDicomStudyList");
|
b.Navigation("NoneDicomStudyList");
|
||||||
|
|
||||||
b.Navigation("PreviousHistoryList");
|
b.Navigation("PreviousHistoryList");
|
||||||
|
@ -19567,6 +19589,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
|
||||||
b.Navigation("EnrollList");
|
b.Navigation("EnrollList");
|
||||||
|
|
||||||
|
b.Navigation("NoneDicomStudyList");
|
||||||
|
|
||||||
b.Navigation("ReadModuleList");
|
b.Navigation("ReadModuleList");
|
||||||
|
|
||||||
b.Navigation("ReadingClinicalDataList");
|
b.Navigation("ReadingClinicalDataList");
|
||||||
|
@ -19711,6 +19735,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
|
||||||
b.Navigation("ReadingTaskQuestionAnswerList");
|
b.Navigation("ReadingTaskQuestionAnswerList");
|
||||||
|
|
||||||
|
b.Navigation("ReadingTaskQuestionMarkList");
|
||||||
|
|
||||||
b.Navigation("TaskInfluenceList");
|
b.Navigation("TaskInfluenceList");
|
||||||
|
|
||||||
b.Navigation("TaskMedicalReviewList");
|
b.Navigation("TaskMedicalReviewList");
|
||||||
|
|
Loading…
Reference in New Issue