| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -14,6 +14,7 @@ using Shentun.Peis.RegisterCheckPictures; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					using Shentun.Peis.RegisterChecks; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					using Shentun.Peis.RegisterCheckSuggestions; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					using Shentun.Peis.RegisterCheckSummarys; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					using Shentun.Peis.SysParmValues; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					using Shentun.Utilities; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					using System; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					using System.Collections.Generic; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -65,7 +66,7 @@ namespace Shentun.Peis.PatientRegisters | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        private readonly RegisterCheckManager _registerCheckManager; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        private readonly IRepository<SysParmValue> _sysParmValueRepository; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        private readonly IGuidGenerator _guidGenerator; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        private readonly SysParmValueManager _sysParmValueManager; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public PatientRegisterManager( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IRepository<PatientRegister, Guid> repository, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IRepository<CustomerOrgRegister, Guid> customerOrgRegisterRepository, | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -95,7 +96,8 @@ namespace Shentun.Peis.PatientRegisters | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            RegisterCheckItemManager registerCheckItemManager, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            RegisterCheckCriticalValueManager registerCheckCriticalValueManager, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            RegisterCheckManager registerCheckManager, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IGuidGenerator guidGenerator) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IGuidGenerator guidGenerator, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            SysParmValueManager sysParmValueManager) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            _repository = repository; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            this._customerOrgRepository = customerOrgRepository; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -126,6 +128,7 @@ namespace Shentun.Peis.PatientRegisters | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            this._registerCheckManager = registerCheckManager; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            this._sysParmValueRepository = sysParmValueRepository; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            _guidGenerator = guidGenerator; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            _sysParmValueManager = sysParmValueManager; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// 创建
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -756,90 +759,25 @@ namespace Shentun.Peis.PatientRegisters | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// 生成条码号(规则,先找体检中心的配置,如未找到,就直接使用全局的)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// 模式(0 日期+尾号   1.顺序递增)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// </summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <param name="OrganizationUnitId">体检中心ID</param>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <param name="medicalCenterId">体检中心ID</param>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <returns></returns>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public async Task<string> CreatePatientRegisterNo(Guid OrganizationUnitId) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public async Task<string> CreatePatientRegisterNo(Guid medicalCenterId) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            string PatientRegisterNo = "";  //条码号
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<SysParmValue> spvlist = await _sysParmValueRepository.GetListAsync(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            var spv_tjzx = spvlist.Where(m => m.MedicalCenterId == OrganizationUnitId); //体检中心配置
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            var spv_tjzx = spvlist.Where(m => m.MedicalCenterId == medicalCenterId); //体检中心配置
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            var spv_global = spvlist.Where(m => m.MedicalCenterId == Guid.Empty);  //全局配置
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            var patient_register_no_rule_coding = "";  // 模式(0 日期+尾号   1.顺序递增)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            var patient_register_no_rule_tail_len = "";  //尾号长度
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            var patient_register_no_rule_prefix = ""; //前缀
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            patient_register_no_rule_coding = await _sysParmValueManager.GetSysParmValueAsync(medicalCenterId, "patient_register_no_rule_coding"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            patient_register_no_rule_tail_len = await _sysParmValueManager.GetSysParmValueAsync(medicalCenterId, "patient_register_no_rule_tail_len"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            patient_register_no_rule_prefix = await _sysParmValueManager.GetSysParmValueAsync(medicalCenterId, "patient_register_no_rule_prefix"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (spv_tjzx.Where(m => m.SysParmId == "patient_register_no_rule_coding").Count() > 0) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //获取体检中心配置
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                patient_register_no_rule_coding = spv_tjzx.Where(m => m.SysParmId == "patient_register_no_rule_coding").FirstOrDefault().ParmValue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (string.IsNullOrWhiteSpace(patient_register_no_rule_coding)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                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)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new UserFriendlyException("人员条码号编码方式不能为空"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            patient_register_no_rule_coding = patient_register_no_rule_coding.Trim(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (spv_tjzx.Where(m => m.SysParmId == "patient_register_no_rule_prefix").Count() > 0) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //获取体检中心配置
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                patient_register_no_rule_prefix = spv_tjzx.Where(m => m.SysParmId == "patient_register_no_rule_prefix").FirstOrDefault().ParmValue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (string.IsNullOrWhiteSpace(patient_register_no_rule_prefix)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                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)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                patient_register_no_rule_prefix = patient_register_no_rule_prefix.Trim(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (spv_tjzx.Where(m => m.SysParmId == "patient_register_no_rule_tail_len").Count() > 0) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //获取体检中心配置
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                patient_register_no_rule_tail_len = spv_tjzx.Where(m => m.SysParmId == "patient_register_no_rule_tail_len").FirstOrDefault().ParmValue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (string.IsNullOrWhiteSpace(patient_register_no_rule_tail_len)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                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)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |