LIJU 3 weeks ago
parent
commit
07aaf2021d

+ 34 - 7
src/main/resources/static/js/mz/west_pharmacy_send.js

@@ -133,10 +133,17 @@ $(function () {
                 tracCodgCount = tracCodgList.length;
             }
             
-            console.log('药品:', drug.drugname, '处方数量:', prescriptionQuantity, '追溯码数量:', tracCodgCount);
+            console.log('药品:', drug.drugname, '处方数量:', prescriptionQuantity, '追溯码数量:', tracCodgCount, '拆零状态:', drug.serial);
             
-            // 检查数量是否匹配
-            if (tracCodgCount !== prescriptionQuantity) {
+            // ================= 新增:根据药品类型区分验证逻辑 =================
+            // 目的:拆零药品不强制上传追溯码,不拆零药品维持原样
+            // 判断逻辑:serial="01"为拆零药品,serial="99"为不拆零药品
+            
+            let isSplitDrug = (drug.serial === '01'); // 拆零药品
+            let isNonSplitDrug = (drug.serial === '99'); // 不拆零药品
+            
+            // 只有不拆零药品才检查追溯码数量是否匹配
+            if (isNonSplitDrug && tracCodgCount !== prescriptionQuantity) {
                 hasMismatch = true;
                 let difference = tracCodgCount - prescriptionQuantity;
                 let differenceText = '';
@@ -149,6 +156,12 @@ $(function () {
                 
                 mismatchMessage += '药品【' + drug.drugname + '】: 处方数量 ' + prescriptionQuantity + ',追溯码数量 ' + tracCodgCount + ',' + differenceText + ';\n';
             }
+            
+            // 拆零药品不检查追溯码数量,直接跳过
+            if (isSplitDrug) {
+                console.log('拆零药品【' + drug.drugname + '】不强制上传追溯码,跳过数量验证');
+            }
+            // ================= 新增结束 =================
         }
         
         // 如果数量不匹配,阻止发药并显示错误提示
@@ -3722,19 +3735,33 @@ function validateTracCodgQuantity(realNo, orderNo, receiptNo, times, patientId,
             tracCodgCount = tracCodgList.length;
         }
         
-        console.log('药品:', drug.drugname, '处方数量:', prescriptionQuantity, '追溯码数量:', tracCodgCount);
+        console.log('药品:', drug.drugname, '处方数量:', prescriptionQuantity, '追溯码数量:', tracCodgCount, '拆零状态:', drug.serial);
+        
+        // ================= 新增:根据药品类型区分验证逻辑 =================
+        // 目的:拆零药品不强制上传追溯码,不拆零药品维持原样
+        // 判断逻辑:serial="01"为拆零药品,serial="99"为不拆零药品
         
-        // 检查数量是否匹配
-        if (tracCodgCount !== prescriptionQuantity) {
+        let isSplitDrug = (drug.serial === '01'); // 拆零药品
+        let isNonSplitDrug = (drug.serial === '99'); // 不拆零药品
+        
+        // 只有不拆零药品才检查追溯码数量是否匹配
+        if (isNonSplitDrug && tracCodgCount !== prescriptionQuantity) {
             hasMismatch = true;
             let mismatchInfo = {
                 drugName: drug.drugname,
                 prescriptionQuantity: prescriptionQuantity,
                 tracCodgCount: tracCodgCount,
-                difference: tracCodgCount - prescriptionQuantity
+                difference: tracCodgCount - prescriptionQuantity,
+                isSplitDrug: isSplitDrug
             };
             mismatchDetails.push(mismatchInfo);
         }
+        
+        // 拆零药品不检查追溯码数量,直接跳过
+        if (isSplitDrug) {
+            console.log('拆零药品【' + drug.drugname + '】不强制上传追溯码,跳过数量验证');
+        }
+        // ================= 新增结束 =================
     }
     
     // 如果有不匹配的情况,显示确认弹框

+ 1 - 1
src/main/resources/templates/mz/west_pharmacy_send.html

@@ -1108,7 +1108,7 @@
                             <strong>注意:</strong>以下药品的追溯码数量与处方数量不匹配,请确认是否继续发药?<br/>
                             <span style="color: #007bff; font-weight: bold;">
                             <strong>追溯码上传规则:</strong><br/>
-                            • <strong>拆零药品</strong>:需要上传与处方数量相同的追溯码,允许上传相同的追溯码<br/>
+                            • <strong>拆零药品</strong>:不强制上传追溯码,可以选择性上传<br/>
                             • <strong>不拆零药品</strong>:需要上传与处方数量相同的追溯码,不允许上传相同的追溯码或之前已上传过的追溯码
                             </span>
                         </div>