diff --git a/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs b/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs index 761c372..8e63474 100644 --- a/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs +++ b/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs @@ -526,7 +526,7 @@ namespace Shentun.Peis.DiagnosisFunctions if (!referenceRanges2.Any()) { //未找到,去匹配适用性别为A的 - referenceRanges2 = referenceRanges.Where(m => m.ForSexId.ToString() == ForSexFlag.All).ToList(); + referenceRanges2 = referenceRanges.Where(m => m.ForSexId == ForSexFlag.All).ToList(); if (referenceRanges2.Any()) { diff --git a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs index edfe882..88c0deb 100644 --- a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs +++ b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs @@ -291,7 +291,7 @@ namespace Shentun.Peis.PatientRegisters if (!string.IsNullOrEmpty(input.Phone)) entlist = entlist.Where(m => m.Patient.MobileTelephone == input.Phone || m.Patient.Telephone == input.Phone); - if (input.SexId != null && input.SexId.ToString() != ForSexFlag.All) + if (input.SexId != null && input.SexId != ForSexFlag.All) entlist = entlist.Where(m => m.SexId == input.SexId); if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate)) @@ -1326,7 +1326,7 @@ namespace Shentun.Peis.PatientRegisters #region 检测单位分组的性别是否符合 //单位分组信息 - if (CustomerOrgGroupEnt.ForSexId.ToString() != ForSexFlag.All + if (CustomerOrgGroupEnt.ForSexId != ForSexFlag.All && SexId != null && CustomerOrgGroupEnt.ForSexId != SexId) { @@ -1744,7 +1744,7 @@ namespace Shentun.Peis.PatientRegisters query = query.Where(m => m.a.PatientName != null && m.a.PatientName.Contains(input.PatientName)); } - if (input.SexId != null && input.SexId.ToString() != ForSexFlag.All) + if (input.SexId != null && input.SexId != ForSexFlag.All) { query = query.Where(m => m.a.SexId == input.SexId); } @@ -1864,7 +1864,7 @@ namespace Shentun.Peis.PatientRegisters var customerOrgGroupEntity = await _customerOrgGroupRepository.FindAsync(m => m.Id == input.CustomerOrgGroupId); if (customerOrgGroupEntity != null) { - if (customerOrgGroupEntity.ForSexId.ToString() != ForSexFlag.All + if (customerOrgGroupEntity.ForSexId != ForSexFlag.All && oldPatientRegisterEntity.SexId != null && customerOrgGroupEntity.ForSexId != oldPatientRegisterEntity.SexId) { diff --git a/src/Shentun.Peis.Domain.Shared/Enums/ForSexFlag.cs b/src/Shentun.Peis.Domain.Shared/Enums/ForSexFlag.cs index 3bfd1ce..846afc9 100644 --- a/src/Shentun.Peis.Domain.Shared/Enums/ForSexFlag.cs +++ b/src/Shentun.Peis.Domain.Shared/Enums/ForSexFlag.cs @@ -14,16 +14,16 @@ namespace Shentun.Peis.Enums /// 男 /// [Description("男")] - public const string Male = "M"; + public const char Male = 'M'; /// /// 女 /// [Description("女")] - public const string Female = "F"; + public const char Female = 'F'; /// /// 全部 /// [Description("全部")] - public const string All = "A"; + public const char All = 'A'; } } diff --git a/src/Shentun.Peis.Domain/AsbitemGuides/AsbitemGuideManager.cs b/src/Shentun.Peis.Domain/AsbitemGuides/AsbitemGuideManager.cs index ff5a274..67be699 100644 --- a/src/Shentun.Peis.Domain/AsbitemGuides/AsbitemGuideManager.cs +++ b/src/Shentun.Peis.Domain/AsbitemGuides/AsbitemGuideManager.cs @@ -33,7 +33,7 @@ namespace Shentun.Peis.AsbitemGuides if (SexFlag.UnKnown == SexId.ToString()) { //判断是否为未知、未知去找适用性别为全部的 - entlist = entlist.Where(m => m.ForSexId.ToString() == ForSexFlag.All).ToList(); + entlist = entlist.Where(m => m.ForSexId == ForSexFlag.All).ToList(); } else { @@ -41,7 +41,7 @@ namespace Shentun.Peis.AsbitemGuides if (!entlist.Any()) { //找不到直接匹配的 去找全部的匹配数据 - entlist = entlist.Where(m => m.ForSexId.ToString() == ForSexFlag.All).ToList(); + entlist = entlist.Where(m => m.ForSexId == ForSexFlag.All).ToList(); } } diff --git a/src/Shentun.Peis.Domain/Diagnosises/DiagnosisManager.cs b/src/Shentun.Peis.Domain/Diagnosises/DiagnosisManager.cs index 683fd8e..d65b51e 100644 --- a/src/Shentun.Peis.Domain/Diagnosises/DiagnosisManager.cs +++ b/src/Shentun.Peis.Domain/Diagnosises/DiagnosisManager.cs @@ -1,4 +1,5 @@ -using Shentun.Peis.HelperDto; +using Shentun.Peis.Enums; +using Shentun.Peis.HelperDto; using Shentun.Peis.Models; using Shentun.Utilities; using System; @@ -118,6 +119,23 @@ namespace Shentun.Peis.Diagnosises } + private void Verify(Diagnosis entity) + { + DataHelper.CheckEntityIsNull(entity); + DataHelper.CheckStringIsNull(entity.DisplayName, "名称"); + DataHelper.CheckGuidIsDefaultValue(entity.ItemTypeId, "项目类别"); + + DataHelper.CheckCharIsYOrN(entity.IsIll, "是否疾病"); + DataHelper.CheckCharIsYOrN(entity.IsSummaryTemplate, "是否总检模板"); + if (entity.ForSexId != ForSexFlag.Male && entity.ForSexId != ForSexFlag.Female && entity.ForSexId != ForSexFlag.All) + { + throw new ArgumentOutOfRangeException("适用性别参数不正确"); + } + if (entity.DiagnosisLevelId < 0 || entity.DiagnosisLevelId > 10) + { + throw new ArgumentOutOfRangeException("诊断级别参数不正确"); + } + } } } diff --git a/src/Shentun.Peis.EntityFrameworkCore/SumSummaryReports/SumSummaryReportRepository.cs b/src/Shentun.Peis.EntityFrameworkCore/SumSummaryReports/SumSummaryReportRepository.cs index dbea40f..a626a64 100644 --- a/src/Shentun.Peis.EntityFrameworkCore/SumSummaryReports/SumSummaryReportRepository.cs +++ b/src/Shentun.Peis.EntityFrameworkCore/SumSummaryReports/SumSummaryReportRepository.cs @@ -86,7 +86,7 @@ namespace Shentun.Peis.SumSummaryReports //数字型 if (SexId != null && Age != null) { - ReferenceRangeList = ReferenceRangeList.Where(m => (m.ForSexId == SexId || m.ForSexId.ToString() == ForSexFlag.All) + ReferenceRangeList = ReferenceRangeList.Where(m => (m.ForSexId == SexId || m.ForSexId == ForSexFlag.All) && m.AgeLowerLimit <= Age && m.AgeUpperLimit >= Age).ToList(); //查询性别跟年龄(性别增加全部) msg = ReferenceRangeList.Any() ? ReferenceRangeList.First().ReferenceRangeValue : "";