From e575c328ca6ec9652f66e1f291ae220faa25a32f Mon Sep 17 00:00:00 2001 From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com> Date: Wed, 19 Jun 2024 03:25:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppointPatientRegisterAppService.cs | 2 +- .../MedicalPackages/MedicalPackageAppservice.cs | 5 +++++ .../Persons/PersonAppService.cs | 6 +++++- .../QuestionRegisters/QuestionRegisterAppService.cs | 8 +++++--- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs b/src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs index d0cc270..95bbae6 100644 --- a/src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs +++ b/src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs @@ -794,7 +794,7 @@ namespace Shentun.WebPeis.AppointPatientRegisters var medicalPackage = medicalPackages.FirstOrDefault(); if (medicalPackage == null) { - return null; + throw new UserFriendlyException("没有设置基础套餐"); } var recommendMedicalPackageDto = new RecommendMedicalPackageDto() diff --git a/src/Shentun.WebPeis.Application/MedicalPackages/MedicalPackageAppservice.cs b/src/Shentun.WebPeis.Application/MedicalPackages/MedicalPackageAppservice.cs index a1189e6..93aa05d 100644 --- a/src/Shentun.WebPeis.Application/MedicalPackages/MedicalPackageAppservice.cs +++ b/src/Shentun.WebPeis.Application/MedicalPackages/MedicalPackageAppservice.cs @@ -139,6 +139,10 @@ namespace Shentun.WebPeis.MedicalPackages medicalPackages = medicalPackages.Where(o => o.MaritalStatusId == MaritalStatusFlag.All).ToList(); } } + if(!medicalPackages.Any()) + { + throw new UserFriendlyException("没有设置基础套餐"); + } var medicalPackage = medicalPackages.OrderBy(o => o.DisplayOrder).Single(); var result = ObjectMapper.Map(medicalPackage); ; result.ForSexName = await _cacheService.GetForSexNameAsync(result.ForSexId); @@ -157,6 +161,7 @@ namespace Shentun.WebPeis.MedicalPackages //[AllowAnonymous] public async Task> GetCheckTypeWithAsbitemsListByMedicalPackageIdAsync(MedicalPackageIdInput input) { + if(input == null) throw new UserFriendlyException("input参数不能为空"); //获取套餐所有组合项目 var asbitems = (from medicalPackageDetail in await _medicalPackageDetailRepository.GetQueryableAsync() join asbitem in await _asbitemRepository.GetQueryableAsync() diff --git a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs index cb9dcb6..29061e3 100644 --- a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs +++ b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs @@ -149,6 +149,8 @@ namespace Shentun.WebPeis.Persons [UnitOfWork(IsDisabled = false)] public async Task CreateAsync(CreatePersonDto input) { + if(input == null) throw new UserFriendlyException("input参数不能为空"); + using (var unitOfWork = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true)) { var entity = ObjectMapper.Map(input); @@ -252,6 +254,8 @@ namespace Shentun.WebPeis.Persons [HttpPost("api/app/Person/Update")] public async Task UpdateAsync(UpdatePersonDto input) { + if (input == null) throw new UserFriendlyException("input参数不能为空"); + var entity = ObjectMapper.Map(input); if (string.IsNullOrWhiteSpace(input.MobileTelephone)) @@ -294,7 +298,7 @@ namespace Shentun.WebPeis.Persons [HttpPost("api/app/Person/CreatePersonKinship")] public async Task CreatePersonKinshipAsync(CreatePersonKinshipDto input) { - + if (input == null) throw new UserFriendlyException("input参数不能为空"); var entity = ObjectMapper.Map(input); if (string.IsNullOrWhiteSpace(input.KinshipId)) { diff --git a/src/Shentun.WebPeis.Application/QuestionRegisters/QuestionRegisterAppService.cs b/src/Shentun.WebPeis.Application/QuestionRegisters/QuestionRegisterAppService.cs index f954e8b..b2734d8 100644 --- a/src/Shentun.WebPeis.Application/QuestionRegisters/QuestionRegisterAppService.cs +++ b/src/Shentun.WebPeis.Application/QuestionRegisters/QuestionRegisterAppService.cs @@ -554,7 +554,8 @@ namespace Shentun.WebPeis.QuestionRegisters } private async Task GetBasicDataAsync(PersonIdInputDto input) { - var questions = await _questionRepository.GetListAsync(o => o.IsActive == 'Y'); + var questions = (await _questionRepository.GetListAsync(o => o.IsActive == 'Y')).OrderBy(o=>o.DisplayOrder); + var questionAnswers = await _questionAnswerRepository.GetListAsync(); var questionRegisterDto = new QuestionRegisterDto() { @@ -578,7 +579,7 @@ namespace Shentun.WebPeis.QuestionRegisters }; //一级答案 var firstLevelQuestionAnswers = questionAnswers.Where(o => o.QuestionId == question.QuestionId && - o.PathCode.Length == 5).ToList(); + o.PathCode.Length == 5).OrderBy(o=>o.DisplayOrder).ToList(); foreach (var questionAnswer in firstLevelQuestionAnswers) { var questionRegisterAnswer = new QuestionRegisterAnswerDto() @@ -598,7 +599,8 @@ namespace Shentun.WebPeis.QuestionRegisters }; //二级答案 - var childQuestionAnswers = questionAnswers.Where(o => o.ParentId == questionAnswer.QuestionAnswerId).ToList(); + var childQuestionAnswers = questionAnswers.Where(o => + o.ParentId == questionAnswer.QuestionAnswerId).OrderBy(o=>o.DisplayOrder).ToList(); foreach (var ChilduestionAnswer in childQuestionAnswers) { var childQuestionRegisterAnswer = new QuestionRegisterAnswerDto()