From 102a6f851ae02a6f6e33009c2b508c529e578501 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 1 Sep 2022 10:35:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BB=E5=AD=A6=E5=AE=A1=E6=A0=B8=E5=88=9D?= =?UTF-8?q?=E6=AD=A5=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Allocation/TaskMedicalReview.cs | 4 +- .../Common/AuditingData.cs | 89 ++++++++++++++----- 2 files changed, 71 insertions(+), 22 deletions(-) diff --git a/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs b/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs index f70c1c260..2dc262d70 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs @@ -85,7 +85,7 @@ namespace IRaCIS.Core.Domain.Models /// public Guid DoctorUserId { get; set; } - + [JsonIgnore] public TaskMedicalReviewRule TaskMedicalReviewRule { get; set; } @@ -144,7 +144,7 @@ namespace IRaCIS.Core.Domain.Models /// public string FileName { get; set; } = string.Empty; - + [JsonIgnore] public List ReadingMedicalReviewDialogList { get; set; } diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 2cc97ec45..6ad47e325 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -135,16 +135,16 @@ namespace IRaCIS.Core.Infra.EFCore.Common } - - #endregion + + #endregion - #region 已修改 + #region 已修改 - // 系统文件签署 父层级未记录稽查(系统文档初始数据) - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemDocConfirmedUser))) + // 系统文件签署 父层级未记录稽查(系统文档初始数据) + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemDocConfirmedUser))) { var type = GetEntityAuditOpt(item); @@ -196,7 +196,71 @@ namespace IRaCIS.Core.Infra.EFCore.Common } + //医学审核 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TaskMedicalReview))) + { + var type = GetEntityAuditOpt(item); + var entity = item.Entity as TaskMedicalReview; + + await InsertInspection(entity, type, x => new InspectionConvertDTO() + { + VisitTaskId = entity.VisitTaskId, + + ObjectRelationParentId = entity.VisitTaskId, + + ObjectRelationParentId2 = entity.MedicalManagerUserId + }); + } + + //医学审核 问题答案 + if (entitys.Any(x => x.Entity.GetType() == typeof(ReadingMedicineQuestionAnswer))) + { + + var type = AuditOpt.Add; + + var list = entitys.Where(x => x.Entity.GetType() == typeof(ReadingMedicineQuestionAnswer)).Select(t => t.Entity as ReadingMedicineQuestionAnswer); + + var questionIdList = list.Select(t => t.ReadingMedicineQuestionId).ToList(); + + var questionNameList = await _dbContext.ReadingMedicineTrialQuestion.Where(x => questionIdList.Contains(x.Id)).Select(t => new { t.QuestionName, ReadingMedicineQuestionId = t.Id, t.ShowOrder }).ToListAsync(); + + var firstEntity = list.FirstOrDefault(); + + var cloneEntity = firstEntity.Clone(); + + //保证Id 唯一 + cloneEntity.Id = IdentifierHelper.CreateGuid(firstEntity.VisitTaskId.ToString(), firstEntity.TaskMedicalReviewId.ToString() ); + + await InsertInspection(cloneEntity, type, x => new InspectionConvertDTO() + { + VisitTaskId = x.VisitTaskId, + + //byzhouhang + ObjectRelationParentId = x.TaskMedicalReviewId, + }, new + { + QuestionAnswerList = list.Join(questionNameList, t => t.ReadingMedicineQuestionId, u => u.ReadingMedicineQuestionId, (t, u) => new { t.Answer, u.QuestionName, u.ShowOrder }).OrderBy(t => t.ShowOrder).ToList(), + }); + } + + + //医学审核对话 + + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingMedicalReviewDialog))) + { + var type = GetEntityAuditOpt(item); + + var entity = item.Entity as ReadingMedicalReviewDialog; + + await InsertInspection(entity, type, x => new InspectionConvertDTO() + { + VisitTaskId = entity.VisitTaskId, + + ObjectRelationParentId = entity.TaskMedicalReviewId, + + }); + } // Qc 问题答案 @@ -1182,22 +1246,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common - //医学审核 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TaskMedicalReview))) - { - var type = GetEntityAuditOpt(item); - var entity = item.Entity as TaskMedicalReview; - - await InsertInspection(entity, type, x => new InspectionConvertDTO() - { - VisitTaskId = entity.VisitTaskId, - - ObjectRelationParentId = entity.VisitTaskId, - - ObjectRelationParentId2 = entity.MedicalManagerUserId - }); - } //一致性分析规则