LIJU 1 week ago
parent
commit
1c3be1d384
1 changed files with 42 additions and 5 deletions
  1. 42 5
      src/main/resources/static/js/mz/west_pharmacy_send.js

+ 42 - 5
src/main/resources/static/js/mz/west_pharmacy_send.js

@@ -2853,13 +2853,50 @@ function matchingDrugCodg(patientId, times, receiptNo, orderNo, realNo){
                 }
                 return {
                     "total": 0,//总页数
-                    "rows": {}   //数据
+                    "rows": []   //数据
                 };
             }
-            return {
-                "total": re.data.length,//总页数
-                "rows": re.data   //数据
-            };
+            // 仅展示需要匹配的药品(非中药 且 不拆零 且 本次退药>0)
+            try {
+                let refundData = window.currentRefundData || $table.bootstrapTable('getData');
+                let needMatchKeySet = new Set();
+                if (refundData && refundData.length > 0) {
+                    for (let i = 0; i < refundData.length; i++) {
+                        let r = refundData[i];
+                        let isTcm = (r.drugKind === '09' || r.drugKind === '10');
+                        let isNonSplit = (r.serial === '99');
+                        if (!isTcm && isNonSplit && r.dec_amount > 0) {
+                            needMatchKeySet.add(r.charge_item_code + '||' + r.serial + '||' + r.item_no);
+                        }
+                    }
+                }
+                let filtered = (re.data || []).filter(function(row){
+                    let key = row.chargeItemCode + '||' + row.serial + '||' + row.itemNo;
+                    return needMatchKeySet.has(key);
+                });
+                return {
+                    "total": filtered.length,
+                    "rows": filtered
+                };
+            } catch (e) {
+                console.warn('过滤匹配列表异常,回退为原始数据:', e);
+                return {
+                    "total": re.data.length,//总页数
+                    "rows": re.data   //数据
+                };
+            }
+        },
+        onLoadSuccess: function () {
+            // 如果没有需要匹配的药品,自动关闭弹窗并视为匹配完成
+            try {
+                let rows = $('#ty_table_detail').bootstrapTable('getData') || [];
+                if (rows.length === 0) {
+                    if (!isTyOk) { isTyOk = true; }
+                    $('#tyModal').modal('hide');
+                }
+            } catch (e) {
+                console.warn('匹配表加载后自动关闭判断异常:', e);
+            }
         },
     });
     $("#tyModal").modal();