| 
					
				 | 
			
			
				@@ -1498,25 +1498,25 @@ function prescriptionDetail(realNo, orderNo, receiptNo, times, patientId, confir 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                      
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 设置防抖定时器,0.5秒后触发验证 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     inputTimer = setTimeout(function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (inputValue && inputValue.trim().length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (inputValue && inputValue.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             // 直接按<br>分割,获取所有追溯码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            let codes = inputValue.split('<br>').filter(code => code.trim().length > 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            let codes = inputValue.split('<br>').filter(code => code.length > 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             console.log('分割后的追溯码列表:', codes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            // 检查最后一个追溯码是否为20位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            // 检查最后一个追溯码是否为20位或以上 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             if (codes.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 let lastCode = codes[codes.length - 1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 console.log('最后一个追溯码:', lastCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 console.log('最后一个追溯码长度:', lastCode.length); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if (lastCode.length === 20) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (lastCode.length >= 20) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     console.log('防抖触发,准备验证追溯码:', lastCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     // 验证最后一个完整的追溯码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     validateAndAddTracCodg(lastCode, row, $element); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     console.log('最后一个追溯码长度不正确,不进行验证:', lastCode.length); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     // 添加报错提示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    errorMesageSimaple('追溯码长度不正确,应为20位,当前为' + lastCode.length + '位'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    errorMesageSimaple('追溯码长度不正确,应为20位或以上,当前为' + lastCode.length + '位'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     // 去掉长度不正确的追溯码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     codes.pop(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     // 重新设置单元格内容 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3127,7 +3127,7 @@ function validateAndAddTracCodg(tracCodg, rowData, $element) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 errorMesage(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 验证失败时,清理掉无效的追溯码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 let currentContent = $element.html(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let codes = currentContent.split('<br>').filter(code => code.trim().length > 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let codes = currentContent.split('<br>').filter(code => code.length > 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 去掉最后一个追溯码(无效的追溯码) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (codes.length > 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3155,7 +3155,7 @@ function validateAndAddTracCodg(tracCodg, rowData, $element) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             errorMesageSimaple("验证请求失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 错误时也清理掉无效的追溯码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             let currentContent = $element.html(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let codes = currentContent.split('<br>').filter(code => code.trim().length > 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let codes = currentContent.split('<br>').filter(code => code.length > 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 去掉最后一个追溯码(无效的追溯码) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (codes.length > 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3328,11 +3328,11 @@ function callYbSaleGoodsItem(realNo, orderNo, receiptNo, times, patientId, name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 追溯码信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let drugtracinfo = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 处理追溯码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (item.drugTracCodg && item.drugTracCodg.trim() !== '') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let tracCodes = item.drugTracCodg.split('<br>').filter(code => code.trim() !== ''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (item.drugTracCodg && item.drugTracCodg !== '') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let tracCodes = item.drugTracCodg.split('<br>').filter(code => code !== ''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (let j = 0; j < tracCodes.length; j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 drugtracinfo.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    drugTracCodg: tracCodes[j].trim() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    drugTracCodg: tracCodes[j] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3497,9 +3497,9 @@ function callYbReturnGoodsItem(realNo, orderNo, receiptNo, times, patientId, nam 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 将追溯码添加到医保接口参数中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     for (let k = 0; k < tracRes.data.length; k++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         let tracItem = tracRes.data[k]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (tracItem.drugTracCodg && tracItem.drugTracCodg.trim() !== '') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (tracItem.drugTracCodg && tracItem.drugTracCodg !== '') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             ybData.drugtracinfo.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                drugTracCodg: tracItem.drugTracCodg.trim() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                drugTracCodg: tracItem.drugTracCodg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3585,7 +3585,7 @@ function validateTracCodgQuantity(realNo, orderNo, receiptNo, times, patientId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 计算该药品的追溯码数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!isEmpty(drug.drugTracCodg)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 按<br>分割追溯码,过滤空值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let tracCodgList = drug.drugTracCodg.split('<br>').filter(code => code.trim().length > 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let tracCodgList = drug.drugTracCodg.split('<br>').filter(code => code.length > 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             tracCodgCount = tracCodgList.length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 |