From 8b0b18ccf30451da7a18d73ef606197d5f9c8125 Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Tue, 21 May 2024 23:10:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=8C=E4=B8=9A=E7=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OccupationalDiseaseAppService.cs | 9 ++++++-- .../Poisons/PoisonAppService.cs | 1 + .../Poisons/PoisonManager.cs | 23 ++++++++++++++----- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/Shentun.Peis.Application/OccupationalDiseases/OccupationalDiseaseAppService.cs b/src/Shentun.Peis.Application/OccupationalDiseases/OccupationalDiseaseAppService.cs index b74a686..3549f43 100644 --- a/src/Shentun.Peis.Application/OccupationalDiseases/OccupationalDiseaseAppService.cs +++ b/src/Shentun.Peis.Application/OccupationalDiseases/OccupationalDiseaseAppService.cs @@ -50,7 +50,7 @@ namespace Shentun.Peis.OccupationalDiseases /// /// [HttpPost("api/app/OccupationalDisease/CreateOccupationalDiseaseWithDetail")] - public async Task CreateOccupationalDiseaseWithDetailAsync(OccupationalDiseaseWithDetailInputDto input) + public async Task CreateOccupationalDiseaseWithDetailAsync(OccupationalDiseaseWithDetailInputDto input) { if (input == null) { @@ -139,6 +139,11 @@ namespace Shentun.Peis.OccupationalDiseases await _patientOccupationalHistoryRepository.InsertManyAsync(patientOccupationalHistoryList); #endregion + + return await GetOccupationalDiseaseWithDetailByPatientRegisterIdAsync(new PatientRegisterIdInputDto + { + PatientRegisterId = input.PatientRegisterId + }); } @@ -287,7 +292,7 @@ namespace Shentun.Peis.OccupationalDiseases /// 修改检查结论 /// /// - [HttpPost("api/app/OccupationalDisease/GetOccupationalDiseaseWithDetailByPatientRegisterId")] + [HttpPost("api/app/OccupationalDisease/UpdateOccupationalDiseaseInspectionConclusion")] public async Task UpdateOccupationalDiseaseInspectionConclusionAsync(OccupationalDiseaseInspectionConclusionInputDto input) { var patientOccupationalDiseaseEnt = await _patientOccupationalDiseaseRepository.FirstOrDefaultAsync(F => F.PatientRegisterId == input.PatientRegisterId); diff --git a/src/Shentun.Peis.Application/Poisons/PoisonAppService.cs b/src/Shentun.Peis.Application/Poisons/PoisonAppService.cs index 3ad834e..f90698d 100644 --- a/src/Shentun.Peis.Application/Poisons/PoisonAppService.cs +++ b/src/Shentun.Peis.Application/Poisons/PoisonAppService.cs @@ -70,6 +70,7 @@ namespace Shentun.Peis.Poisons CreatorId = s.CreatorId, DisplayName = s.DisplayName, DisplayOrder = s.DisplayOrder, + PoisonTypeId = s.PoisonTypeId, Id = s.Id, LastModificationTime = s.LastModificationTime, LastModifierId = s.LastModifierId, diff --git a/src/Shentun.Peis.Domain/Poisons/PoisonManager.cs b/src/Shentun.Peis.Domain/Poisons/PoisonManager.cs index e4f8eac..06fbfa9 100644 --- a/src/Shentun.Peis.Domain/Poisons/PoisonManager.cs +++ b/src/Shentun.Peis.Domain/Poisons/PoisonManager.cs @@ -9,10 +9,11 @@ using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Services; using Volo.Abp; +using Volo.Abp.Domain.Entities; namespace Shentun.Peis.Poisons { - + public class PoisonManager : DomainService { private readonly IRepository _poisonRepository; @@ -37,12 +38,17 @@ namespace Shentun.Peis.Poisons { DataHelper.CheckEntityIsNull(entity); DataHelper.CheckStringIsNull(entity.DisplayName, "名称"); - await EntityHelper.CheckSameName(_poisonRepository, entity.DisplayName); + + var isPoison = await _poisonRepository.FirstOrDefaultAsync(f => f.PoisonTypeId == entity.PoisonTypeId && f.DisplayName == entity.DisplayName); + if (isPoison != null) + throw new UserFriendlyException($"毒害因素{entity.DisplayName}已存在"); + //await EntityHelper.CheckSameName(_poisonRepository, entity.DisplayName); return new Poison { DisplayName = entity.DisplayName, SimpleCode = LanguageConverter.GetPYSimpleCode(entity.DisplayName), - DisplayOrder = await EntityHelper.CreateMaxDisplayOrder(_poisonRepository) + DisplayOrder = await EntityHelper.CreateMaxDisplayOrder(_poisonRepository), + PoisonTypeId = entity.PoisonTypeId }; } @@ -62,13 +68,18 @@ namespace Shentun.Peis.Poisons DataHelper.CheckStringIsNull(sourceEntity.DisplayName, "名称"); if (sourceEntity.DisplayName != targetEntity.DisplayName) { - - await EntityHelper.CheckSameName(_poisonRepository, sourceEntity.DisplayName, targetEntity); + var isPoison = await _poisonRepository.FirstOrDefaultAsync(f => f.PoisonTypeId == sourceEntity.PoisonTypeId + && f.DisplayName == sourceEntity.DisplayName && f.Id != targetEntity.Id); + if (isPoison != null) + throw new UserFriendlyException($"毒害因素{sourceEntity.DisplayName}已存在"); + //await EntityHelper.CheckSameName(_poisonRepository, sourceEntity.DisplayName, targetEntity); targetEntity.DisplayName = sourceEntity.DisplayName; targetEntity.SimpleCode = LanguageConverter.GetPYSimpleCode(targetEntity.DisplayName); - targetEntity.PoisonTypeId = sourceEntity.PoisonTypeId; + } + targetEntity.PoisonTypeId = sourceEntity.PoisonTypeId; + }