From 787dd9aa5fe1cfcf6e4e9c54943b03740d468a36 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 13 Nov 2024 15:39:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=87=E5=87=86=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E9=85=8D=E7=BD=AE=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=BE=85?= =?UTF-8?q?=E9=98=85=E5=88=97=E8=A1=A8=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Allocation/DTO/VisitTaskViewModel.cs | 9 ++++++ .../Allocation/VisitTaskHelpeService.cs | 10 ++++-- .../Service/Allocation/VisitTaskService.cs | 31 +++++++++++++++++-- .../Service/Visit/PatientService.cs | 6 ++-- .../Service/Visit/SubjectVisitService.cs | 21 +++++-------- .../ReadingQuestionCriterionTrial.cs | 14 ++++----- .../EntityConfigration/ImageConfigration.cs | 5 +++ 7 files changed, 69 insertions(+), 27 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index 80ebf133c..9617e2969 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -390,6 +390,15 @@ namespace IRaCIS.Core.Application.ViewModel public class IRUnReadSubjectView { + #region HIR + public Guid? ClaimUserId { get; set; } + + public string? ClaimUserName { get; set; } + + public string SubjectName { get; set; } + + public List PatientList { get; set; } + #endregion public int Index { get; set; } = 0; public Guid SubjectId { get; set; } diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 27dcea7f7..14e1c07eb 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -336,7 +336,10 @@ namespace IRaCIS.Core.Application.Service ReadingCategory = ReadingCategory.Visit, TrialReadingCriterionId = trialReadingCriterionConfig.TrialReadingCriterionId, IsNeedClinicalDataSign = isNeedClinicalDataSign, - IsClinicalDataSign = isClinicalDataSign + IsClinicalDataSign = isClinicalDataSign, + + //HIR + SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget) }); } @@ -1065,7 +1068,10 @@ namespace IRaCIS.Core.Application.Service TrialReadingCriterionId = trialReadingCriterionConfig.TrialReadingCriterionId, IsNeedClinicalDataSign = isNeedClinicalDataSign, IsClinicalDataSign = isClinicalDataSign, - IsFrontTaskNeedSignButNotSign = isFrontTaskNeedSignButNotSign + IsFrontTaskNeedSignButNotSign = isFrontTaskNeedSignButNotSign, + + //HIR + SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget) }); diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index e672be6cf..ad852802e 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -1143,6 +1143,29 @@ public class VisitTaskService(IRepository _visitTaskRepository, SortField = inQuery.SortField, }); + //给出患者编号 + var currentPageData = result.CurrentPageData; + var subjectIdList = currentPageData.Select(t => t.SubjectId).ToList(); + var list = await _subjectRepository.Where(t => subjectIdList.Contains(t.Id)).Select(t => new + { + SubjectId = t.Id, + PatientList = t.SubjectPatientList.Select(c => new PatientBasicInfo() + { + PatientId = c.PatientId, + PatientAge = c.Patient.PatientAge, + PatientBirthDate = c.Patient.PatientBirthDate, + PatientIdStr = c.Patient.PatientIdStr, + PatientSex = c.Patient.PatientSex, + PatientName = c.Patient.PatientName, + }).ToList(), + }).ToListAsync(); + + foreach (var item in currentPageData) + { + item.PatientList = list.Where(t => t.SubjectId == item.SubjectId).FirstOrDefault()?.PatientList; + } + + } //随机阅片 else @@ -1196,7 +1219,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, if (critrion.IsReadingTaskViewInOrder == ReadingOrder.InOrder) { - var visitQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect) + var visitQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId/* && x.DoctorUserId == _userInfo.Id*/ && x.TaskState == TaskState.Effect) .WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.PatientIdStr), t => t.Subject.SubjectPatientList.Any(t => t.Patient.PatientIdStr.Contains(inQuery.PatientIdStr))) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.PatientName), t => t.Subject.SubjectPatientList.Any(t => t.Patient.PatientName.Contains(inQuery.PatientName))) @@ -1252,12 +1275,16 @@ public class VisitTaskService(IRepository _visitTaskRepository, .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => (t.Subject.Code.Contains(inQuery.SubjectCode!) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(inQuery.SubjectCode!) && t.IsAnalysisCreate)); - var visitGroupQuery = visitQuery.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode }); + var visitGroupQuery = visitQuery.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode, x.Subject.ShortName, x.SubjectCriterionClaimUserId, x.SubjectCriterionClaimUser.UserName }); var visitTaskQuery = visitGroupQuery.Select(x => new IRUnReadSubjectView() { SubjectId = x.Key.SubjectId, SubjectCode = x.Key.BlindSubjectCode == string.Empty ? x.Key.Code : x.Key.BlindSubjectCode, + SubjectName = x.Key.ShortName, + + ClaimUserId = x.Key.SubjectCriterionClaimUserId, + ClaimUserName = x.Key.UserName, SuggesteFinishedTime = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).Min(x => x.SuggesteFinishedTime), diff --git a/IRaCIS.Core.Application/Service/Visit/PatientService.cs b/IRaCIS.Core.Application/Service/Visit/PatientService.cs index d242f5bb7..d178da04a 100644 --- a/IRaCIS.Core.Application/Service/Visit/PatientService.cs +++ b/IRaCIS.Core.Application/Service/Visit/PatientService.cs @@ -1807,7 +1807,7 @@ namespace IRaCIS.Application.Services await _repository.AddAsync(newStuty); //newStuty.Id = NewId.NextSequentialGuid(); - newStuty.SeqId = Guid.Empty; + newStuty.SeqId = NewId.NextSequentialGuid(); newStuty.Code = currentNextCodeInt; newStuty.StudyCode = AppSettings.GetCodeStr(currentNextCodeInt, nameof(DicomStudy)); newStuty.TrialId = item.TrialId; @@ -1824,7 +1824,7 @@ namespace IRaCIS.Application.Services series.Id = seriesId; series.StudyId = newStuty.Id; - series.SeqId = Guid.Empty; + series.SeqId = NewId.NextSequentialGuid(); series.TrialId = item.TrialId; series.SubjectId = item.SubjectId; series.SubjectVisitId = item.SubjectVisitId; @@ -1843,7 +1843,7 @@ namespace IRaCIS.Application.Services instance.SeriesId = seriesId; instance.StudyId = newStuty.Id; - instance.SeqId = Guid.Empty; + instance.SeqId = NewId.NextSequentialGuid(); instance.TrialId = item.TrialId; instance.SubjectId = item.SubjectId; instance.SubjectVisitId = item.SubjectVisitId; diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs index 5bdac402f..8af068503 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs @@ -174,26 +174,21 @@ namespace IRaCIS.Core.Application.Services [HttpDelete, Route("{trialId:guid}/{id:guid}")] [TrialGlobalLimit( "AfterStopCannNotOpt" )] - //[Authorize(Policy = IRaCISPolicy.CRC)] public async Task DeleteSV(Guid id) { - if (await _dicomStudyRepository.AnyAsync(t => t.SubjectVisitId == id)) + var sv = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == id); + + var maxUnsubmmitVisit = await _subjectVisitRepository.Where(t => t.SubjectId == sv.SubjectId && t.SubmitState == SubmitStateEnum.None).OrderByDescending(t => t.VisitNum).FirstOrDefaultAsync(); + if (maxUnsubmmitVisit != null && sv.VisitNum == maxUnsubmmitVisit.VisitNum) { - //---当前访视已经有影像上传,不允许删除。 - return ResponseOutput.NotOk(_localizer["Visit_UploadedNoDelete"]); + await _subjectVisitRepository.DeleteAsync(sv, true); + } - if (await _subjectVisitRepository.AnyAsync(t => t.Id == id && t.InPlan)) + else { - //---计划内的访视不允许删除。 - return ResponseOutput.NotOk(_localizer["Visit_PlanVisitNoDelete"]); - } - if (await _subjectVisitRepository.AnyAsync(t => t.OutPlanPreviousVisitId == id)) - { - //---当前访视已经被设置为另一访视的上一访视,不允许删除。 - return ResponseOutput.NotOk(_localizer["Visit_PreviousVisitNoDelete"]); + return ResponseOutput.NotOk("删除访视操作,每次只允许删除该受试者未绑定检查的最后一个访视"); } - await _subjectVisitRepository.DeleteFromQueryAsync(s => s.Id == id, true); return ResponseOutput.Ok(); } diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs index 2a1c049ff..9c9a345b1 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs @@ -87,10 +87,10 @@ public class ReadingQuestionCriterionTrial : BaseAddAuditEntity public ImagePlatform ImagePlatform { get; set; } = ImagePlatform.PACS; [Comment("阅片工具")] - public ReadingTool? ReadingTool { get; set; } + public ReadingTool? ReadingTool { get; set; } = Share.ReadingTool.Dicom; [Comment("任务组织级别")] - public ReadingTaskViewMethod ReadingTaskViewEnum { get; set; } + public ReadingTaskViewMethod ReadingTaskViewEnum { get; set; } = ReadingTaskViewMethod.Subject; [Comment("阅片是否显示受试者信息")] public bool IsReadingShowSubjectInfo { get; set; } = true; @@ -100,19 +100,19 @@ public class ReadingQuestionCriterionTrial : BaseAddAuditEntity public bool IsConfirmMedicineQuestion { get; set; } = false; [Comment("仲裁对象")] - public ArbitrationRule ArbitrationRule { get; set; } = ArbitrationRule.Reading; + public ArbitrationRule ArbitrationRule { get; set; } = ArbitrationRule.None; [Comment("阅片模式")] - public ReadingMethod ReadingType { get; set; } = ReadingMethod.Double; + public ReadingMethod ReadingType { get; set; } = ReadingMethod.Single; [Comment("存在阅片期")] - public bool IsReadingPeriod { get; set; } = true; + public bool IsReadingPeriod { get; set; } = false; [Comment("是否生成全局阅片任务")] - public bool IsGlobalReading { get; set; } = true; + public bool IsGlobalReading { get; set; } = false; [Comment("是否签名")] public bool IsSigned { get; set; } = false; [Comment("仲裁阅片")] - public bool IsArbitrationReading { get; set; } = true; + public bool IsArbitrationReading { get; set; } = false; [Comment("肿瘤学阅片 原字段 IsClinicalReading")] public bool IsOncologyReading { get; set; } diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/ImageConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/ImageConfigration.cs index 873e12540..dd78d1d62 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/ImageConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/ImageConfigration.cs @@ -83,6 +83,11 @@ public class SCPStudyConfigration : IEntityTypeConfiguration builder.HasMany(s => s.SeriesList).WithOne(se => se.SCPStudy).HasForeignKey(se => se.StudyId).HasPrincipalKey(st => st.Id); + builder.HasMany(s => s.SCPStudySubjectVisitList).WithOne(se => se.SCPStudy).HasForeignKey(se => se.SCPStudyId).HasPrincipalKey(st => st.Id); + + builder.HasMany(s => s.InstanceList).WithOne(se => se.SCPStudy).HasForeignKey(se => se.StudyId).HasPrincipalKey(st => st.Id); + + } }