hurugang пре 4 година
родитељ
комит
fd500336a4
2 измењених фајлова са 172 додато и 101 уклоњено
  1. 167 39
      src/main/resources/static/js/mz/clinic.js
  2. 5 62
      src/main/resources/templates/mz/clinic.html

+ 167 - 39
src/main/resources/static/js/mz/clinic.js

@@ -1378,43 +1378,33 @@ function listTypeChange(object) {
  * @param index 0 西药 1中药 2 诊疗和社备
  */
 function saveMedicine(index) {
-    var tabId = null;
-    //西药
     if (index == 0) {
-        tabId = "xyTab";
-    } else if (index == 1) {
-        //中成药
-        tabId = "zyTab";
-    } else if (index == 2) {
-        //医技与诊疗
-        tabId = "zlTab";
-    }
-    //每个处方不能超过5个药品
-    var tableId = $("#" + tabId + " li.active").find("a").attr("href");
-    var childrens = $(tableId).find("div:eq(0)").children().length;
-    if (childrens === 5) {
-        $("#messageModal").modal();
-        $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
-        $("#messageButton").off("click").on("click", function (t) {
-            $("#messageModal").modal("hide");
-            refreshNavTabs(index);
-            if (index == 0) {
-                saveWesternMedicine();
-            } else if (index == 1) {
-
-            } else if (index == 2) {
+        //每个处方不能超过5个药品
+        var tableId = $("#xyTab li.active").find("a").attr("href");
+        var childrens = $(tableId).find("div:eq(0)").children().length;
+        if (childrens === 5) {
+            $("#messageModal").modal();
+            $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
+            $("#messageButton").off("click").on("click", function (t) {
+                $("#messageModal").modal("hide");
+                refreshNavTabs(index);
+                if (index == 0) {
+                    saveWesternMedicine();
+                } else if (index == 1) {
+
+                } else if (index == 2) {
 
-            }
-        });
-    } else {
-        if (index == 0) {
+                }
+            });
+        }else {
             saveWesternMedicine();
-        } else if (index == 1) {
-
-        } else if (index == 2) {
-
         }
+    } else if (index == 1) {
+        saveChineseMedicine();
+    } else if (index == 2) {
+
     }
+
 }
 
 
@@ -1454,8 +1444,6 @@ function saveWesternMedicine() {
     var medicalAdvice = $("#medicalAdvice").val();
     //金额
     var totalRetprice = parseFloat($("#totalRetprice").val());
-    //总金额
-    var totalAmount = parseFloat($("#totalAmount").html());
     var html = '<div class="form-group">';
     html += groupId + '.&nbsp;&nbsp;';
     html += westernMedicineNamme + ' ';
@@ -1482,8 +1470,7 @@ function saveWesternMedicine() {
     cfAmount = Add(cfAmount, totalRetprice);
     $(tableId).find("span.cf_amount").html(cfAmount);
     //设置总金额
-    totalAmount = Add(totalAmount, totalRetprice).toFixed(1);
-    $("#totalAmount").html(totalAmount)
+    calculateTotalAmount();
     //判断当前组号是不是最后一个,是最后一个组号,就需要新增组号
     var groupIdLast = $("#groupId option:last-child").text();
     if (groupId === groupIdLast) {
@@ -1533,6 +1520,95 @@ function clearWesternMedicine() {
 }
 
 
+
+
+/**
+ * 保存当前药品到右边处方区域  中药
+ */
+function saveChineseMedicine() {
+    //药品名称
+    var chineseMedicineNamme = $("#chinese_medicine_name").val();
+    //当前药品编码
+    var currentCode = $("#current_code").val();
+    //当前药品规格
+    var currentSerial = $("#current_serial").val();
+    //处方实际单次使用剂量
+    var drugWin = $("#zy_drugWin").val();
+    //医嘱
+    var zyInstruction = $("#zyInstruction").val();
+    //医嘱
+    var zyInstructionText=$('#zyInstruction option:selected').text();
+    //单价
+    var zyPackRetprice = parseFloat($("#zy_packRetprice").val());
+    var html = '<div class="form-group" style="float: left;">';
+    html += chineseMedicineNamme;
+    if(zyInstruction!=null && zyInstruction!=''){
+        html+='['+zyInstructionText+']';
+    }
+    html+='&nbsp;&nbsp;';
+    html += drugWin+ 'g';
+    html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 30px;font-size: 20px;"></i>';
+    html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 30px;font-size: 20px;"></i>';
+    html += '</div>';
+
+    var tableId = $("#zyTab li.active").find("a").attr("href");
+    $(tableId).find("div:eq(0)").append(html);
+    //当前中药的总价
+    var totalRetprice =Multiply(drugWin,zyPackRetprice);
+    //获取中药付数
+    var zyfs = $(tableId).find("input.zyfs").val();
+    //当前处方单付金额
+    var singleAmount=$("#singleAmount").val();
+    if(singleAmount==null || singleAmount==''){
+        singleAmount=0;
+    }
+    singleAmount =Add(singleAmount, totalRetprice);
+    var cfAmount = Multiply(singleAmount, zyfs);
+    $(tableId).find("span.cf_amount").html(cfAmount);
+    //单张处方的价格
+    $("#singleAmount").val(singleAmount);
+    //设置总金额
+    calculateTotalAmount();
+    clearChineseMedicine();
+}
+
+
+/**
+ * 清空中药
+ */
+function clearChineseMedicine() {
+    //药品名称
+    $("#chinese_medicine_name").val(null);
+    //当前药品编码
+    $("#current_code").val(null);
+    //当前药品规格
+    $("#current_serial").val(null);
+    //医嘱
+    $("#zyInstruction").selectpicker('val', null);
+    $('#zyInstruction').selectpicker('refresh');
+    //剂量
+    $("#zy_drugWin").val(null);
+    //单价
+    $("#zy_packRetprice").val(null);
+}
+
+/**
+ * 计算总金额
+ */
+function calculateTotalAmount() {
+    var cfAmounts=$("span.cf_amount");
+    var totalAmount=0;
+    if(cfAmounts!=null && cfAmounts.length>0){
+
+        for(var i=0;i<cfAmounts.length;i++){
+            totalAmount=Add(totalAmount,parseFloat($(cfAmounts[i]).html()));
+        }
+    }
+    $("#totalAmount").html(totalAmount.toFixed(1));
+}
+
+
+
 /**
  * 打开编辑用户信息窗口
  * @param data
@@ -2497,7 +2573,7 @@ function loadYpList(index) {
                 checkYpInfo(row.code, row.serial);
             }
             if (index == 1) {
-
+                checkZyInfo(row.code, row.serial);
             }
             if (index == 2) {
 
@@ -2547,6 +2623,42 @@ function checkYpInfo(code, serial) {
     });
 }
 
+
+
+/**
+ * 按照药品的编码 和药品拆零规格查询药品信息 中药
+ * @param code
+ * @param serial
+ */
+function checkZyInfo(code, serial) {
+    $.ajax({
+        type: "GET",
+        url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                if (res.data != null) {
+                    $("#chinese_medicine_name").val(res.data.name);
+                    $("#chinese_medicine_name").blur();
+                    $("#zy_drugWin").val(res.data.weight);
+                    $("#zy_packRetprice").val(res.data.packRetprice);
+                    $("#current_code").val(res.data.code);
+                    $("#current_serial").val(res.data.serial);
+                }
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+}
+
+
 /**
  * 初始化处方分页
  * @param index 0 西药 1 中药 2 诊疗
@@ -2581,7 +2693,7 @@ function initNavTabs(index) {
             html += ' <div style="width: 130px;float: left;">' +
                 '                                        <label class="my_label_2">付数:</label>' +
                 '                                        <input type="text" class="form-control my_label_input_2 zyfs"' +
-                '                                               placeholder="请输入" style="padding-left: 10px;">' +
+                '                                               placeholder="请输入" style="padding-left: 10px;" onchange="calculateZyAmount()" value="1">' +
                 '                                    </div>';
             html += '<div style="width: 130px;float: left;">' +
                 '                                        <label class="my_label_2">频次:</label>' +
@@ -2600,6 +2712,7 @@ function initNavTabs(index) {
                 '                                        </div>' +
                 '                                    </div>';
             html += '</div><div style="width: 460px;">'
+            html+='<input id="singleAmount" type="hidden"/>';
         }
         html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
         if (index == 1) {
@@ -2670,7 +2783,7 @@ function refreshNavTabs(index) {
     childrens++;
     var cfTitle = "处方" + numToChineseNum(childrens);
     var paneId = paneIdPrfix + childrens;
-    //清选中的样式
+    //清选中的样式
     $("#" + tabId).find("li.active").removeClass("active");
     $("#" + tabId).append('<li><a href="#' + paneId + '" role="tab" data-toggle="tab">' + cfTitle + '</a></li>');
     $("#" + tabContentId).append('<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">' +
@@ -2780,6 +2893,21 @@ function calculate() {
     $("#totalRetprice").val(Multiply(totalNum, packRetprice));
 }
 
+
+/**
+ * 根据中药付数计算金额
+ */
+function calculateZyAmount() {
+    var singleAmount=$("#singleAmount").val();
+    var tableId = $("#zyTab li.active").find("a").attr("href");
+    //获取中药付数
+    var zyfs = $(tableId).find("input.zyfs").val();
+    var cfAmount =Multiply(zyfs,singleAmount);
+    $(tableId).find("span.cf_amount").html(cfAmount);
+    calculateTotalAmount();
+}
+
+
 function getByPatientId(patientId) {
     $.ajax({
         type: "GET",

+ 5 - 62
src/main/resources/templates/mz/clinic.html

@@ -513,16 +513,6 @@
                                                style="padding-left: 10px;" readonly>
                                     </div>
                                 </div>
-                                <!--<div class="item form-group">-->
-                                    <!--<div style="width: 260px;float: left;">-->
-                                        <!--<label class="my_label_2">嘱托:</label>-->
-                                        <!--<div style="width: 85px;float: left;">-->
-                                            <!--<select class="form-control selectpicker show-tick"-->
-                                                    <!--id="xyInstruction">-->
-                                            <!--</select>-->
-                                        <!--</div>-->
-                                    <!--</div>-->
-                                <!--</div>-->
                                 <div class="item form-group">
                                     <div style="width: 100%">
                                         <label class="my_label_2">医嘱:</label>
@@ -567,27 +557,12 @@
                                                   aria-hidden="true"></span>
                                         </div>
                                     </div>
-                                    <!--<div style="width: 130px;float: left;">-->
-                                    <!--<label class="my_label_2">剂量<span-->
-                                    <!--class="required">*</span>:</label>-->
-                                    <!--<input type="text" class="form-control my_label_input_2" id="symptom61"-->
-                                    <!--placeholder="请输入" style="padding-left: 10px;" required="required">-->
-                                    <!--</div>-->
                                 </div>
                                 <div class="item form-group">
-                                    <!--<div style="width: 256px;float: left;">-->
-                                    <!--<label class="my_label_2">脚注:</label>-->
-                                    <!--<div class="form-group has-feedback" style="float: right;width: 210px;">-->
-                                    <!--<input type="text" class="form-control has-feedback-left" id="symptom52"-->
-                                    <!--placeholder="请输入" style="padding-left: 10px;width: 99%">-->
-                                    <!--<span class="fa fa-search form-control-feedback right"-->
-                                    <!--aria-hidden="true"></span>-->
-                                    <!--</div>-->
-                                    <!--</div>-->
                                     <div style="width: 130px;float: left;">
                                         <label class="my_label_2">单价:</label>
-                                        <input type="text" class="form-control my_label_input_2" id="symptom62"
-                                               placeholder="请输入" style="padding-left: 10px;">
+                                        <input type="text" class="form-control my_label_input_2" id="zy_packRetprice"
+                                                style="padding-left: 10px;" readonly="">
                                     </div>
                                     <div style="width: 256px;float: left;">
                                         <label class="my_label_2">剂量:</label>
@@ -596,55 +571,23 @@
                                                                                      id="zy_drugWin" onchange="">
                                         </div>
                                         <div style="width: 38px;float: left;margin-left: 13px;">
-                                            <input readonly value="g" class="form-control"/>
+                                            <span style="line-height: 30px;font-size: 20px;">g</span>
                                         </div>
                                     </div>
                                 </div>
-                                <!--<div class="item form-group">-->
-                                <!--<div style="width: 386px;float: left;">-->
-                                <!--<label class="my_label_2">用法:</label>-->
-                                <!--<div class="form-group has-feedback" style="float: right;width: 340px;">-->
-                                <!--<input type="text" class="form-control has-feedback-left" id="symptom778"-->
-                                <!--placeholder="请输入" style="padding-left: 10px;width: 99%">-->
-                                <!--<span class="fa fa-search form-control-feedback right"-->
-                                <!--aria-hidden="true"></span>-->
-                                <!--</div>-->
-                                <!--</div>-->
-                                <!--</div>-->
-                                <!--<div class="item form-group">-->
-                                <!--<div style="width: 386px;float: left;">-->
-                                <!--<label class="my_label_2">频次:</label>-->
-                                <!--<div class="form-group has-feedback" style="float: right;width: 340px;">-->
-                                <!--<input type="text" class="form-control has-feedback-left" id="symptom77"-->
-                                <!--placeholder="请输入" style="padding-left: 10px;width: 99%">-->
-                                <!--<span class="fa fa-search form-control-feedback right"-->
-                                <!--aria-hidden="true"></span>-->
-                                <!--</div>-->
-                                <!--</div>-->
-                                <!--</div>-->
-                                <!--<div class="item form-group">-->
-                                    <!--<div style="width: 260px;float: left;">-->
-                                        <!--<label class="my_label_2">嘱托:</label>-->
-                                        <!--<div style="width: 85px;float: left;">-->
-                                            <!--<select class="form-control selectpicker show-tick"-->
-                                                    <!--id="zyInstruction">-->
-                                            <!--</select>-->
-                                        <!--</div>-->
-                                    <!--</div>-->
-                                <!--</div>-->
                                 <div class="item form-group">
                                     <div style="width: 100%">
                                         <label class="my_label_2">医嘱:</label>
                                         <div style="width: 340px;float: left;">
                                             <select class="form-control selectpicker show-tick"
-                                                    id="zyInstruction">
+                                                    id="zyInstruction" title="请选择">
                                             </select>
                                         </div>
                                     </div>
                                 </div>
                                 <div style="width: 100%;height: 22px;line-height: 22px;">
                                     <div style="float: left;display: inline-block;"><a id="clearRegistration8"
-                                                                                       onclick="clearWesternMedicine()"
+                                                                                       onclick="clearChineseMedicine()"
                                                                                        style="cursor: pointer;font-size: 14px;color: #2e69eb!important;"><i
                                             class="fa fa-trash">&nbsp;&nbsp;清空</i></a></div>