diff --git a/src/Shentun.Peis.Application/CustomerReports/CustomerReportAppService.cs b/src/Shentun.Peis.Application/CustomerReports/CustomerReportAppService.cs index 6dcbada..4df0095 100644 --- a/src/Shentun.Peis.Application/CustomerReports/CustomerReportAppService.cs +++ b/src/Shentun.Peis.Application/CustomerReports/CustomerReportAppService.cs @@ -33,7 +33,7 @@ namespace Shentun.Peis.CustomerReports /// 客户报表 /// [ApiExplorerSettings(GroupName = "Work")] - //[Authorize] + [Authorize] public class CustomerReportAppService : ApplicationService { private readonly IRepository _patientRepository; @@ -1952,8 +1952,9 @@ namespace Shentun.Peis.CustomerReports sumquery = sumquery.Where(m => m.a.CompleteFlag == PatientRegisterCompleteFlag.PartCheck || m.a.CompleteFlag == PatientRegisterCompleteFlag.SumCheck); } + // 分组数据 - var groupDetails = sumquery.GroupBy(g => g.a.CustomerOrgGroupId).Select(s => new GetCustomerOrgFeeSettlementInGroupReportDetail_GroupDetail + var groupDetails = sumquery.ToList().GroupBy(g => g.a.CustomerOrgGroupId).Select(s => new GetCustomerOrgFeeSettlementInGroupReportDetail_GroupDetail { CustomerOrgGroupName = s.FirstOrDefault().ac != null ? s.FirstOrDefault().ac.DisplayName : "", CustomerOrgGroupPrice = s.FirstOrDefault().ac != null ? Math.Round(s.FirstOrDefault().ac.Price, 2).ToString() : "0", @@ -1989,7 +1990,7 @@ namespace Shentun.Peis.CustomerReports query_addItem = query_addItem.Where(m => m.a.PayTypeFlag == PayTypeFlag.OrgPay); } - var addItems = query_addItem.GroupBy(g => g.a.AsbitemId).Select(s => new GetCustomerOrgFeeSettlementInGroupReportDetail_AddItem + var addItems = query_addItem.ToList().GroupBy(g => g.a.AsbitemId).Select(s => new GetCustomerOrgFeeSettlementInGroupReportDetail_AddItem { AsbitemName = s.FirstOrDefault().ab != null ? s.FirstOrDefault().ab.DisplayName : "", PatientCount = s.Count(), @@ -2115,7 +2116,7 @@ namespace Shentun.Peis.CustomerReports ChargeAmount = Math.Round(s.Sum(v => v.c.ChargePrice * v.c.Amount), 2).ToString(), ChargePrice = Math.Round(s.Sum(v => v.c.ChargePrice * v.c.Amount) / s.Sum(v => v.c.Amount), 2).ToString(), ItmeTypeName = s.FirstOrDefault().ae.DisplayName, - Discount = ((int)Math.Ceiling(s.Sum(v => v.c.ChargePrice * v.c.Amount) / s.Sum(v => v.c.StandardPrice * v.c.Amount))).ToString() + Discount = s.Sum(v => v.c.StandardPrice * v.c.Amount) == 0 ? "0" : ((int)Math.Ceiling(s.Sum(v => v.c.ChargePrice * v.c.Amount) / s.Sum(v => v.c.StandardPrice * v.c.Amount))).ToString() }).ToList(); //v.a.ChargePrice.Value* v.a.Amount.Value diff --git a/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs b/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs index e64a1ff..ed0c5f0 100644 --- a/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs +++ b/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs @@ -42,8 +42,8 @@ namespace Shentun.Peis.DataMigrations /// /// 基础数据处理 /// - //[Authorize] - //[RemoteService(false)] + [Authorize] + [RemoteService(false)] public class BaseDataHandleAppService : ApplicationService { @@ -133,6 +133,9 @@ namespace Shentun.Peis.DataMigrations private readonly IRepository _reportFormatTemplateRepository; private readonly IRepository _sampleGroupRepository; private readonly IRepository _sampleGroupDetailRepository; + private readonly IRepository _sysParmTypeRepository; + private readonly IRepository _sysParmRepository; + private readonly IRepository _sysParmValueRepository; private Dictionary veryPatientNo = new Dictionary(); @@ -184,7 +187,10 @@ namespace Shentun.Peis.DataMigrations IRepository reportFormatRepository, IRepository reportFormatTemplateRepository, IRepository sampleGroupRepository, - IRepository sampleGroupDetailRepository) + IRepository sampleGroupDetailRepository, + IRepository sysParmTypeRepository, + IRepository sysParmRepository, + IRepository sysParmValueRepository) { _deviceTypeRepository = deviceTypeRepository; _itemTypeRepository = itemTypeRepository; @@ -234,6 +240,9 @@ namespace Shentun.Peis.DataMigrations _reportFormatTemplateRepository = reportFormatTemplateRepository; _sampleGroupRepository = sampleGroupRepository; _sampleGroupDetailRepository = sampleGroupDetailRepository; + _sysParmTypeRepository = sysParmTypeRepository; + _sysParmRepository = sysParmRepository; + _sysParmValueRepository = sysParmValueRepository; } @@ -3214,6 +3223,108 @@ namespace Shentun.Peis.DataMigrations #endregion + #region 迁移系统参数 + + /// + /// 迁移系统参数类别数据 + /// + /// + public async Task TransferSysParmTypeData() + { + var oldSysParmType = await PgDb.Ado.GetDataTableAsync("select * from sys_parm_type "); + + + if (oldSysParmType.Rows.Count > 0) + { + foreach (DataRow row in oldSysParmType.Rows) + { + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true)) + { + SysParmType data = new SysParmType + { + Id = row["id"].ToString(), + DisplayName = row["display_name"].ToString(), + DisplayOrder = Convert.ToInt32(row["display_order"].ToString()), + ParentId = row["parent_id"].ToString(), + SimpleCode = row["simple_code"].ToString() + }; + + await _sysParmTypeRepository.InsertAsync(data, true); + + await uow.CompleteAsync(); + } + } + } + } + + /// + /// 迁移系统参数数据 + /// + /// + public async Task TransferSysParmData() + { + var oldSysParm = await PgDb.Ado.GetDataTableAsync("select * from sys_parm "); + + + if (oldSysParm.Rows.Count > 0) + { + foreach (DataRow row in oldSysParm.Rows) + { + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true)) + { + SysParm data = new SysParm + { + Id = row["id"].ToString(), + DisplayName = row["display_name"].ToString(), + DisplayOrder = Convert.ToInt32(row["display_order"].ToString()), + IsPublic = Convert.ToChar(row["is_public"].ToString()), + Remark = row["remark"].ToString(), + ValueType = Convert.ToChar(row["value_type"].ToString()), + SysParmTypeId = row["sys_parm_type_id"].ToString(), + SimpleCode = row["simple_code"].ToString() + }; + + await _sysParmRepository.InsertAsync(data, true); + + await uow.CompleteAsync(); + } + } + } + } + + /// + /// 迁移系统参数值数据 + /// + /// + public async Task TransferSysParmValueData() + { + var oldSysParmValue = await PgDb.Ado.GetDataTableAsync("select * from sys_parm_value where medical_center_id='00000000-0000-0000-0000-000000000000' "); + + + if (oldSysParmValue.Rows.Count > 0) + { + foreach (DataRow row in oldSysParmValue.Rows) + { + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true)) + { + SysParmValue data = new SysParmValue + { + SysParmId = row["sys_parm_id"].ToString(), + Remark = row["remark"].ToString(), + MedicalCenterId = Guid.Empty, + ParmValue = row["parm_value"].ToString() + }; + + await _sysParmValueRepository.InsertAsync(data, true); + + await uow.CompleteAsync(); + } + } + } + } + + #endregion + private void LoadDLL() { // 定义dll文件夹路径 diff --git a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs index e0099c0..eb9d39e 100644 --- a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs +++ b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs @@ -401,7 +401,7 @@ namespace Shentun.Peis.PatientRegisters int totalCount = entlist.Count(); - entlist = entlist.Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount); + entlist = entlist.OrderBy(o => o.Id).Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount); var entdto = entlist.Select(s => new PatientRegisterOrNoDto diff --git a/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs b/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs index 091211d..3d85a82 100644 --- a/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs +++ b/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs @@ -623,10 +623,15 @@ namespace Shentun.Peis.PrintReports medicalReportRegisterCheckDto.Items.Add(medicalReportCheckItemDto); } //小结 - medicalReportRegisterCheckDto.Summarys = registerCheckRows.Select(o => new MedicalReportCheckAsbitemSummaryDto() + //medicalReportRegisterCheckDto.Summarys = registerCheckRows.Select(o => new MedicalReportCheckAsbitemSummaryDto() + //{ + // Summary = o.registerCheckSummaryHaveEmpty.Summary, + // DisplayOrder = o.registerCheckSummaryHaveEmpty.DisplayOrder + //}).OrderBy(o => o.DisplayOrder).Distinct().ToList(); + medicalReportRegisterCheckDto.Summarys = registerCheckRows.GroupBy(g=>g.registerCheckSummaryHaveEmpty.Id).Select(o => new MedicalReportCheckAsbitemSummaryDto() { - Summary = o.registerCheckSummaryHaveEmpty.Summary, - DisplayOrder = o.registerCheckSummaryHaveEmpty.DisplayOrder + Summary = o.FirstOrDefault().registerCheckSummaryHaveEmpty.Summary, + DisplayOrder = o.FirstOrDefault().registerCheckSummaryHaveEmpty.DisplayOrder }).OrderBy(o => o.DisplayOrder).Distinct().ToList(); //图片 var registerCheckPictures = registerCheckRows.Where(o => o.registerCheckPictureHaveEmpty != null && diff --git a/src/Shentun.Peis.Application/SysParmTypes/SysParmTypeAppService.cs b/src/Shentun.Peis.Application/SysParmTypes/SysParmTypeAppService.cs index ff75bc2..348e57f 100644 --- a/src/Shentun.Peis.Application/SysParmTypes/SysParmTypeAppService.cs +++ b/src/Shentun.Peis.Application/SysParmTypes/SysParmTypeAppService.cs @@ -64,7 +64,8 @@ namespace Shentun.Peis.SysParmTypes DisplayOrder = p.DisplayOrder }; - return GetTree(items.ToList(), null); + + return GetTree(items.ToList(), ""); } /// diff --git a/src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs b/src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs index cc55521..371c1c3 100644 --- a/src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs +++ b/src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs @@ -779,8 +779,16 @@ namespace Shentun.Peis.PatientRegisters } if (string.IsNullOrWhiteSpace(patient_register_no_rule_coding)) { - //获取全局配置 - patient_register_no_rule_coding = spv_global.Where(m => m.SysParmId == "patient_register_no_rule_coding").FirstOrDefault().ParmValue; + var patient_register_no_rule_coding_ent = spv_global.Where(m => m.SysParmId == "patient_register_no_rule_coding").FirstOrDefault(); + if (patient_register_no_rule_coding_ent == null) + { + throw new UserFriendlyException("全局系统参数patient_register_no_rule_coding未配置"); + } + else + { + //获取全局配置 + patient_register_no_rule_coding = patient_register_no_rule_coding_ent.ParmValue; + } } if (string.IsNullOrWhiteSpace(patient_register_no_rule_coding)) { @@ -795,8 +803,17 @@ namespace Shentun.Peis.PatientRegisters } if (string.IsNullOrWhiteSpace(patient_register_no_rule_prefix)) { - //获取全局配置 - patient_register_no_rule_prefix = spv_global.Where(m => m.SysParmId == "patient_register_no_rule_prefix").FirstOrDefault().ParmValue; + var patient_register_no_rule_prefix_ent = spv_global.Where(m => m.SysParmId == "patient_register_no_rule_prefix").FirstOrDefault(); + if (patient_register_no_rule_prefix_ent == null) + { + throw new UserFriendlyException("全局系统参数patient_register_no_rule_prefix未配置"); + } + else + { + //获取全局配置 + patient_register_no_rule_prefix = patient_register_no_rule_prefix_ent.ParmValue; + } + } if (!string.IsNullOrEmpty(patient_register_no_rule_prefix)) { @@ -811,8 +828,17 @@ namespace Shentun.Peis.PatientRegisters if (string.IsNullOrWhiteSpace(patient_register_no_rule_tail_len)) { - //获取全局配置 - patient_register_no_rule_tail_len = spv_global.Where(m => m.SysParmId == "patient_register_no_rule_tail_len").FirstOrDefault().ParmValue; + var patient_register_no_rule_tail_len_ent = spv_global.Where(m => m.SysParmId == "patient_register_no_rule_tail_len").FirstOrDefault(); + if (patient_register_no_rule_tail_len_ent == null) + { + throw new UserFriendlyException("全局系统参数patient_register_no_rule_tail_len未配置"); + } + else + { + //获取全局配置 + patient_register_no_rule_tail_len = patient_register_no_rule_tail_len_ent.ParmValue; + } + } if (string.IsNullOrWhiteSpace(patient_register_no_rule_tail_len)) diff --git a/src/Shentun.Peis.Domain/Patients/PatientManager.cs b/src/Shentun.Peis.Domain/Patients/PatientManager.cs index a89b642..8cc086f 100644 --- a/src/Shentun.Peis.Domain/Patients/PatientManager.cs +++ b/src/Shentun.Peis.Domain/Patients/PatientManager.cs @@ -50,7 +50,7 @@ namespace Shentun.Peis.Patients Patient entity ) { - await Verify(entity); + await Verify(entity); if (!string.IsNullOrWhiteSpace(entity.NationId)) { @@ -72,7 +72,7 @@ namespace Shentun.Peis.Patients } //允许指定档案号,主要是导入人员名单时使用 var patientNo = entity.PatientNo; - if(string.IsNullOrWhiteSpace(patientNo)) + if (string.IsNullOrWhiteSpace(patientNo)) { patientNo = await CreatePatientNo(entity.MedicalCenterId); } @@ -94,7 +94,7 @@ namespace Shentun.Peis.Patients PostalCode = entity.PostalCode, SexId = entity.SexId, Telephone = entity.Telephone, - PatientNo = patientNo, + PatientNo = patientNo, SimpleCode = LanguageConverter.GetPYSimpleCode(entity.DisplayName) }; @@ -110,7 +110,7 @@ namespace Shentun.Peis.Patients Patient targetEntity ) { - if(sourceEntity == targetEntity) + if (sourceEntity == targetEntity) { throw new UserFriendlyException("更新人员信息时源实体不能等于目标实体"); } @@ -124,7 +124,7 @@ namespace Shentun.Peis.Patients throw new UserFriendlyException("民族ID不存在"); } } - if(!string.IsNullOrWhiteSpace(sourceEntity.IdNo)) + if (!string.IsNullOrWhiteSpace(sourceEntity.IdNo)) { DataHelper.CheckIdNo(sourceEntity.IdNo); } @@ -137,22 +137,22 @@ namespace Shentun.Peis.Patients } sourceEntity.BirthDate = ConvertExtr.ToBirthDateByIdNo(sourceEntity.IdNo); } - if (targetEntity.DisplayName != sourceEntity.DisplayName && targetEntity.SexId != sourceEntity.SexId) + if (targetEntity.DisplayName != sourceEntity.DisplayName && targetEntity.SexId != sourceEntity.SexId) { throw new UserFriendlyException("人员信息姓名和性别和原来的信息都不一致,禁止修改"); } //targetEntity.MedicalCenterId = sourceEntity.MedicalCenterId; targetEntity.DisplayName = sourceEntity.DisplayName; targetEntity.MaritalStatusId = sourceEntity.MaritalStatusId; - if(!string.IsNullOrWhiteSpace(sourceEntity.Address)) + if (!string.IsNullOrWhiteSpace(sourceEntity.Address)) { targetEntity.Address = sourceEntity.Address; } - if(sourceEntity.BirthDate!=null) + if (sourceEntity.BirthDate != null) { targetEntity.BirthDate = sourceEntity.BirthDate; } - + targetEntity.BirthPlaceId = sourceEntity.BirthPlaceId; if (!string.IsNullOrWhiteSpace(sourceEntity.Email)) { @@ -178,16 +178,16 @@ namespace Shentun.Peis.Patients { targetEntity.PostalCode = sourceEntity.PostalCode; } - if(sourceEntity.SexId != SexFlag.UnKnown) + if (sourceEntity.SexId != SexFlag.UnKnown) { targetEntity.SexId = sourceEntity.SexId; } - - if(targetEntity.DisplayName != sourceEntity.DisplayName) + + if (targetEntity.DisplayName != sourceEntity.DisplayName) { targetEntity.SimpleCode = LanguageConverter.GetPYSimpleCode(targetEntity.DisplayName); } - + } @@ -209,9 +209,9 @@ namespace Shentun.Peis.Patients throw new UserFriendlyException("民族ID不存在"); } } - if(!string.IsNullOrWhiteSpace(entity.IdNo)) + if (!string.IsNullOrWhiteSpace(entity.IdNo)) { - var existPatient = await _repository.FindAsync(o=>o.IdNo == entity.IdNo); + var existPatient = await _repository.FindAsync(o => o.IdNo == entity.IdNo); if (existPatient != null) { throw new UserFriendlyException("该身份证号已经在人员信息中注册"); @@ -219,7 +219,7 @@ namespace Shentun.Peis.Patients entity.BirthDate = ConvertExtr.ToBirthDateByIdNo(entity.IdNo); } - + var ent = new Patient { DisplayName = entity.DisplayName, @@ -263,7 +263,7 @@ namespace Shentun.Peis.Patients { throw new UserFriendlyException($"人员\"{patientEnt.DisplayName}\"已被登记,登记的条码号为(\"{patientRegisterEnt.PatientRegisterNo}\"),不能删除"); } - + await _repository.DeleteAsync(id); } @@ -300,10 +300,18 @@ namespace Shentun.Peis.Patients //获取体检中心配置 patient_id_rule_prefix = spv_tjzx.Where(m => m.SysParmId == "patient_id_rule_prefix").FirstOrDefault().ParmValue; } - if(string.IsNullOrWhiteSpace(patient_id_rule_prefix)) + if (string.IsNullOrWhiteSpace(patient_id_rule_prefix)) { - //获取全局配置 - patient_id_rule_prefix = spv_global.Where(m => m.SysParmId == "patient_id_rule_prefix").FirstOrDefault().ParmValue; + var patient_id_rule_prefix_ent = spv_global.Where(m => m.SysParmId == "patient_id_rule_prefix").FirstOrDefault(); + if (patient_id_rule_prefix_ent == null) + { + throw new UserFriendlyException("全局系统参数patient_id_rule_prefix未配置"); + } + else + { + //获取全局配置 + patient_id_rule_prefix = patient_id_rule_prefix_ent.ParmValue; + } } if (spv_tjzx.Where(m => m.SysParmId == "patient_id_rule_tail_len").Count() > 0) @@ -311,10 +319,18 @@ namespace Shentun.Peis.Patients //获取体检中心配置 patient_id_rule_tail_len = spv_tjzx.Where(m => m.SysParmId == "patient_id_rule_tail_len").FirstOrDefault().ParmValue; } - if(string.IsNullOrWhiteSpace(patient_id_rule_tail_len)) + if (string.IsNullOrWhiteSpace(patient_id_rule_tail_len)) { - //获取全局配置 - patient_id_rule_tail_len = spv_global.Where(m => m.SysParmId == "patient_id_rule_tail_len").FirstOrDefault().ParmValue; + var patient_id_rule_tail_len_ent = spv_global.Where(m => m.SysParmId == "patient_id_rule_tail_len").FirstOrDefault(); + if (patient_id_rule_tail_len_ent == null) + { + throw new UserFriendlyException("全局系统参数patient_id_rule_tail_len未配置"); + } + else + { + //获取全局配置 + patient_id_rule_tail_len = patient_id_rule_tail_len_ent.ParmValue; + } } if (string.IsNullOrWhiteSpace(patient_id_rule_tail_len)) @@ -332,9 +348,6 @@ namespace Shentun.Peis.Patients } - - - string maxnum = "1"; //未补位的档案号 var primarykeyBuilderEnt = await _primarykeyBuilderRepository.FirstOrDefaultAsync(f => f.PrimarykeyBuilderId == "patient_no"); @@ -363,7 +376,7 @@ namespace Shentun.Peis.Patients } - + private bool IsParmNUll(object obj) { if (obj == null) @@ -374,7 +387,7 @@ namespace Shentun.Peis.Patients private async Task Verify(Patient entity) { DataHelper.CheckEntityIsNull(entity); - if(!string.IsNullOrEmpty(entity.DisplayName)) + if (!string.IsNullOrEmpty(entity.DisplayName)) { entity.DisplayName = entity.DisplayName.Trim(); } @@ -382,7 +395,7 @@ namespace Shentun.Peis.Patients if (!string.IsNullOrEmpty(entity.IdNo)) { entity.IdNo = entity.IdNo.Trim(); - if(entity.IdNo.Length != 18) + if (entity.IdNo.Length != 18) { throw new UserFriendlyException("身份证长度必须为18位"); } @@ -398,16 +411,16 @@ namespace Shentun.Peis.Patients throw new UserFriendlyException("身份证号解析出的性别与填入的性别不一致"); } } - + } //DataHelper.CheckStringIsNull(entity.PatientNo, "病人号"); - DataHelper.CheckGuidIsDefaultValue(entity.MedicalCenterId,"组织单位ID"); + DataHelper.CheckGuidIsDefaultValue(entity.MedicalCenterId, "组织单位ID"); DataHelper.CheckStringIsNull(entity.DisplayName, "姓名"); DataHelper.CheckSex(entity.SexId); DataHelper.CheckMaritalStatus(entity.MaritalStatusId); - - - + + + } } } diff --git a/src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs b/src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs index 33e45ee..adc841e 100644 --- a/src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs +++ b/src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs @@ -69,10 +69,10 @@ namespace Shentun.Peis.RegisterChecks public async Task UpdateCompleteAsync(Guid RegisterCheckId, char CompleteFlag) { var registerCheckEnt = await _registerCheckRepository.GetAsync(RegisterCheckId); - + //if (registerCheckEnt == null) // throw new UserFriendlyException($"数据有误"); - if(CompleteFlag != RegisterCheckCompleteFlag.UnChecked && CompleteFlag != RegisterCheckCompleteFlag.GiveUpChecked) + if (CompleteFlag != RegisterCheckCompleteFlag.UnChecked && CompleteFlag != RegisterCheckCompleteFlag.GiveUpChecked) { throw new UserFriendlyException("只能删除结果和弃检时使用,禁止调用"); } @@ -81,7 +81,7 @@ namespace Shentun.Peis.RegisterChecks { throw new UserFriendlyException("已总检,不能修改检查状态"); } - if (patientRegister.IsLock == 'Y') + if (patientRegister.IsLock == 'Y') { throw new UserFriendlyException("人员登记信息已加锁,不能修改检查状态"); } @@ -92,7 +92,7 @@ namespace Shentun.Peis.RegisterChecks var count = (await _registerCheckRepository.GetQueryableAsync()).Where(o => o.PatientRegisterId == patientRegister.Id && o.Id != RegisterCheckId && o.CompleteFlag != RegisterCheckCompleteFlag.UnChecked).Count(); - if(count == 0) + if (count == 0) { patientRegister.CompleteFlag = PatientRegisterCompleteFlag.Registration; await _patientRegisterRepository.UpdateAsync(patientRegister); @@ -106,7 +106,7 @@ namespace Shentun.Peis.RegisterChecks { item.Result = ""; } - + await _registerCheckItemRepository.UpdateManyAsync(registerCheckItems); await _registerCheckSummaryManager.CheckAndDeleteAsync(RegisterCheckId); @@ -393,10 +393,20 @@ namespace Shentun.Peis.RegisterChecks //获取体检中心配置 check_request_no_rule_coding = spv_tjzx.Where(m => m.SysParmId == "check_request_no_rule_coding").FirstOrDefault().ParmValue; } - if(string.IsNullOrWhiteSpace(check_request_no_rule_coding)) + if (string.IsNullOrWhiteSpace(check_request_no_rule_coding)) { - //获取全局配置 - check_request_no_rule_coding = spv_global.Where(m => m.SysParmId == "check_request_no_rule_coding").FirstOrDefault().ParmValue; + + var check_request_no_rule_coding_ent = spv_global.Where(m => m.SysParmId == "check_request_no_rule_coding").FirstOrDefault(); + if (check_request_no_rule_coding_ent == null) + { + throw new UserFriendlyException("全局系统参数check_request_no_rule_coding未配置"); + } + else + { + //获取全局配置 + check_request_no_rule_coding = check_request_no_rule_coding_ent.ParmValue; + } + } if (string.IsNullOrWhiteSpace(check_request_no_rule_coding)) @@ -411,10 +421,20 @@ namespace Shentun.Peis.RegisterChecks } if (string.IsNullOrWhiteSpace(check_request_no_rule_tail_len)) { - //获取全局配置 - check_request_no_rule_tail_len = spv_global.Where(m => m.SysParmId == "check_request_no_rule_tail_len").FirstOrDefault().ParmValue; + + var check_request_no_rule_tail_len_ent = spv_global.Where(m => m.SysParmId == "check_request_no_rule_tail_len").FirstOrDefault(); + if (check_request_no_rule_tail_len_ent == null) + { + throw new UserFriendlyException("全局系统参数check_request_no_rule_tail_len未配置"); + } + else + { + //获取全局配置 + check_request_no_rule_tail_len = check_request_no_rule_tail_len_ent.ParmValue; + } + } - + if (spv_tjzx.Where(m => m.SysParmId == "check_request_no_rule_prefix").Count() > 0) { @@ -423,8 +443,17 @@ namespace Shentun.Peis.RegisterChecks } if (string.IsNullOrWhiteSpace(check_request_no_rule_prefix)) { - //获取全局配置 - check_request_no_rule_prefix = spv_global.Where(m => m.SysParmId == "check_request_no_rule_prefix").FirstOrDefault().ParmValue; + var check_request_no_rule_prefix_ent = spv_global.Where(m => m.SysParmId == "check_request_no_rule_prefix").FirstOrDefault(); + if (check_request_no_rule_prefix_ent == null) + { + throw new UserFriendlyException("全局系统参数check_request_no_rule_prefix未配置"); + } + else + { + //获取全局配置 + check_request_no_rule_prefix = check_request_no_rule_prefix_ent.ParmValue; + } + } if (string.IsNullOrWhiteSpace(check_request_no_rule_tail_len)) diff --git a/src/Shentun.Peis.Domain/ReportTemplates/CustomerOrgReportManager.cs b/src/Shentun.Peis.Domain/ReportTemplates/CustomerOrgReportManager.cs index c93a051..b66c56a 100644 --- a/src/Shentun.Peis.Domain/ReportTemplates/CustomerOrgReportManager.cs +++ b/src/Shentun.Peis.Domain/ReportTemplates/CustomerOrgReportManager.cs @@ -1916,9 +1916,11 @@ namespace Shentun.Peis.ReportTemplates string Checked_MaleExamineRatio = Register_MaleNumber != 0 ? Math.Round(Checked_MaleNumber * 100M / Register_MaleNumber, 2).ToString() + "%" : "0%"; string Checked_FemaleExamineRatio = Register_FemaleNumber != 0 ? Math.Round(Checked_FemaleNumber * 100M / Register_FemaleNumber, 2).ToString() + "%" : "0%"; string Checked_AverageExamineRatio = Math.Round( - (Register_MaleNumber != 0 ? Math.Round(Checked_MaleNumber * 100M / Register_MaleNumber, 2) : 0 - + Register_FemaleNumber != 0 ? Math.Round(Checked_FemaleNumber * 100M / Register_FemaleNumber, 2) : 0) / 2, 2 - ).ToString() + "%"; + ( + (Register_MaleNumber != 0 ? Math.Round(Checked_MaleNumber * 100M / Register_MaleNumber, 2) : 0) + + (Register_FemaleNumber != 0 ? Math.Round(Checked_FemaleNumber * 100M / Register_FemaleNumber, 2) : 0) + ) / 2 + , 2).ToString() + "%"; documentData.CheckedDetail = new InspectionPersonnel_Detail { @@ -1948,8 +1950,11 @@ namespace Shentun.Peis.ReportTemplates string UnChecked_MaleExamineRatio = Register_MaleNumber != 0 ? Math.Round(UnChecked_MaleNumber * 100M / Register_MaleNumber, 2).ToString() + "%" : "0%"; string UnChecked_FemaleExamineRatio = Register_FemaleNumber != 0 ? Math.Round(UnChecked_FemaleNumber * 100M / Register_FemaleNumber, 2).ToString() + "%" : "0%"; string UnChecked_AverageExamineRatio = Math.Round( - (Register_MaleNumber != 0 ? Math.Round(UnChecked_MaleNumber * 100M / Register_MaleNumber, 2) : 0 - + Register_FemaleNumber != 0 ? Math.Round(UnChecked_FemaleNumber * 100M / Register_FemaleNumber, 2) : 0) / 2, 2).ToString() + "%"; + ( + (Register_MaleNumber != 0 ? Math.Round(UnChecked_MaleNumber * 100M / Register_MaleNumber, 2) : 0) + + (Register_FemaleNumber != 0 ? Math.Round(UnChecked_FemaleNumber * 100M / Register_FemaleNumber, 2) : 0) + ) / 2, 2 + ).ToString() + "%"; documentData.UnCheckedDetail = new InspectionPersonnel_Detail { @@ -2041,8 +2046,8 @@ namespace Shentun.Peis.ReportTemplates FemaleAsbitemCheckRatio = documentData.CheckedDetail.FemaleNumber != 0 ? Math.Round(s.Where(m => m.SexId == SexFlag.Female).Count() * 100M / documentData.CheckedDetail.FemaleNumber, 2) + "%" : "0%", TotalAsbitemCheckRatio = Math.Round( - (documentData.CheckedDetail.MaleNumber != 0 ? Math.Round(s.Where(m => m.SexId == SexFlag.Male).Count() * 100M / documentData.CheckedDetail.MaleNumber, 2) : 0 - + documentData.CheckedDetail.FemaleNumber != 0 ? Math.Round(s.Where(m => m.SexId == SexFlag.Female).Count() * 100M / documentData.CheckedDetail.FemaleNumber, 2) : 0) / 2, 2 + ((documentData.CheckedDetail.MaleNumber != 0 ? Math.Round(s.Where(m => m.SexId == SexFlag.Male).Count() * 100M / documentData.CheckedDetail.MaleNumber, 2) : 0) + + (documentData.CheckedDetail.FemaleNumber != 0 ? Math.Round(s.Where(m => m.SexId == SexFlag.Female).Count() * 100M / documentData.CheckedDetail.FemaleNumber, 2) : 0)) / 2, 2 ) + "%" });