Quellcode durchsuchen

处方调用的时候,如果报错,就将出错的项目删除

hurugang vor 3 Jahren
Ursprung
Commit
01084ba69e

+ 42 - 13
src/main/resources/static/js/mz/clinic.js

@@ -3035,7 +3035,7 @@ function editPrescription(jsonData, type) {
     }
     setTimeout(function () {
         //设置总金额 计算金额的时候,可能处方还没有回写完
-        calculateTotalAmount();
+        calculateTotalAmount(false);
     }, 1000);
     //清空映射map
     orderNoAndTableIdMap = null;
@@ -3755,6 +3755,9 @@ function saveMedicine(index) {
 function saveWesternMedicineWithCheck(calculateTotalAmountFlag, orderNoParmams) {
     //当前药房编码
     var currentGroupNo = $("#current_groupNo").val();
+    if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
+        initNavTabs(0, currentGroupNo, orderNoParmams);
+    }
     var tableId = $("#xyTab li.active").find("a").attr("href");
     var childrens = $(tableId).find("div:eq(0)").children().length;
     var thisGroupNo = $(tableId).find("input.current_groupNo").val();
@@ -3953,10 +3956,10 @@ function saveWesternMedicine(calculateTotalAmountFlag) {
     if (medicalAdvice != null && medicalAdvice != '') {
         html += '医嘱:' + medicalAdviceText;
     }
-    html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="editWesternMedicine(this)"></i>';
-    html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="removeYpOrProject(0,this)"></i>';
     html += ' <i class="fa fa-long-arrow-up" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="arrowUp(this)"></i>';
     html += '<i class="fa fa-long-arrow-down" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="arrowDown(this)"></i>';
+    html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="editWesternMedicine(this)"></i>';
+    html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="removeYpOrProject(0,this)"></i>';
     html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
     html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
     html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
@@ -4036,7 +4039,7 @@ function saveWesternMedicine(calculateTotalAmountFlag) {
     //calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 0, 0);
     if (calculateTotalAmountFlag) {
         //设置总金额
-        calculateTotalAmount();
+        calculateTotalAmount(true);
         resetGroupIdSelect()
     }
     //判断当前组号是不是最后一个,是最后一个组号,就需要新增组号
@@ -4506,10 +4509,10 @@ function saveJyJcItemReal(calculateTotalAmountFlag) {
     html += ' <i class="fa fa-long-arrow-up" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="arrowUp(this)"></i>';
     html += '<i class="fa fa-long-arrow-down" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="arrowDown(this)"></i>';
     html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="editJyJcItem(this)"></i>';
+    html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="removeYpOrProject(2,this)"></i>';
     if ($("#jcJyItemChargeDetail").hasClass("in")) {
         html += '<i class="fa fa-eye" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="getJcJyItemChargeByCode(\'' + currentCode + '\',' + jcJyZltype + ')"></i>';
     }
-    html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="removeYpOrProject(2,this)"></i>';
     html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
     html += '<input type="hidden" class="temporary_items_jcJyItemName" value="' + jcJyItem + '"/>';
     html += '<input type="hidden" class="temporary_items_amount" value="' + jcjyItemPrice + '"/>';
@@ -4528,7 +4531,7 @@ function saveJyJcItemReal(calculateTotalAmountFlag) {
     //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
     if (calculateTotalAmountFlag) {
         //设置总金额
-        calculateTotalAmount();
+        calculateTotalAmount(true);
     }
     clearJyJcItem();
 }
@@ -4719,7 +4722,7 @@ function saveZlItemReal(calculateTotalAmountFlag) {
     //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
     if (calculateTotalAmountFlag) {
         //设置总金额
-        calculateTotalAmount();
+        calculateTotalAmount(true);
     }
     clearZlItem();
 }
@@ -4794,7 +4797,7 @@ function saveZyReq(messageFlag) {
 
 /**
  * 删除药品或者项目
- * @param index 0 西药 1 中药  2 项目
+ * @param index 0 西药 1 中药  2 检查检验  3诊疗
  * @param obj 当前点击的对象
  */
 function removeYpOrProject(index, obj) {
@@ -4833,7 +4836,7 @@ function removeYpOrProject(index, obj) {
     }
     $(obj).parent().remove();
     if (index != 4) {
-        calculateTotalAmount();
+        calculateTotalAmount(false);
     }
     var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
     if (formGroups == null || formGroups.length == 0) {
@@ -5017,7 +5020,7 @@ function saveChineseMedicine(calculateTotalAmountFlag) {
     // calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 1, 0);
     if (calculateTotalAmountFlag) {
         //设置总金额
-        calculateTotalAmount();
+        calculateTotalAmount(true);
     }
     clearChineseMedicine();
 }
@@ -5118,8 +5121,9 @@ function clearZyReq() {
 
 /**
  * 计算总金额
+ * @param needRemoveLastObject 是否需要删除最后一次加进来的项目
  */
-function calculateTotalAmount() {
+function calculateTotalAmount(needRemoveLastObject) {
     //调用后去除所有的验证提示
     $("div.alert ").each(function (index, obj) {
         $(obj).remove();
@@ -5146,11 +5150,36 @@ function calculateTotalAmount() {
                     }
                 }
             } else {
+                if (needRemoveLastObject) {
+                    var index = getIndex("bill_item_group");
+                    var tabId = null;
+                    //西药
+                    if (index == 0) {
+                        tabId = "xyTab";
+                    } else if (index == 1) {
+                        //中成药
+                        tabId = "zyTab";
+                    } else if (index == 2) {
+                        //辅助检查、检验
+                        tabId = "jcjyTab";
+                    } else if (index == 3) {
+                        //诊疗
+                        tabId = "zlTab";
+                    } else if (index == 4) {
+                        //入院
+                        tabId = "zyReqTab";
+                    }
+                    var tableId = $("#" + tabId + " li.active").find("a").attr("href");
+                    var last = $(tableId).find("div:eq(0)").find("div:last");
+                    if (last != null) {
+                        $(last).find("i:eq(2)").click();
+                        $(last).find("i:eq(3)").click();
+                    }
+                }
                 errorMesage(res);
             }
         }
     });
-
 }
 
 
@@ -7468,7 +7497,7 @@ function calculateZyAmount() {
     var zyfs = $("#zyfs").val();
     var cfAmount = Multiply(zyfs, singleAmount);
     $(tableId).find("span.cf_amount").html(cfAmount);
-    calculateTotalAmount();
+    calculateTotalAmount(false);
 }
 
 

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

@@ -829,7 +829,7 @@
                                         <div style="width: 83px;float: left;">
                                             <select class="form-control selectpicker show-tick zy_supplyType"
                                                     data-live-search="true"
-                                                    id="zy_supplyType_1" title="请选择" onchange="calculateTotalAmount()">
+                                                    id="zy_supplyType_1" title="请选择" onchange="calculateTotalAmount(false)">
                                             </select>
                                         </div>
                                     </div>