Selaa lähdekoodia

退费的时候可以在选择的时候看到勾了多少钱

hurugang 5 vuotta sitten
vanhempi
commit
16be081546

+ 6 - 4
src/main/java/cn/hnthyy/thmz/mapper/his/MzChargeDetailMapper.java

@@ -547,7 +547,8 @@ public interface MzChargeDetailMapper {
     @Select({"<script>",
             "SELECT distinct rtrim(a.patient_id) patient_id,name,a.times,a.receipt_no,charge_date=convert(char(10),a.charge_date,111) ,a.serial_no,real_no ,a.responce_type," +
                     " cheque_type=case when mz_receipt_serial.cheque_type='Y' and cash_id <![CDATA[<>]]> '99999' " +
-                    " and (len(ltrim(rtrim(mz_receipt_serial.receipt_bill))) >= 10 or len(ltrim(rtrim(mz_receipt_serial.receipt_bill)))=0) then '本院记账' else '自费' end " +
+                    " and (len(ltrim(rtrim(mz_receipt_serial.receipt_bill))) >= 10 or len(ltrim(rtrim(mz_receipt_serial.receipt_bill)))=0) then '本院记账' else '自费' end, " +
+                    " serial_no_order=ABS(a.serial_no)  " +
                     "    FROM mz_charge_detail a,mz_receipt_serial " +
                     "    WHERE a.charge_date <![CDATA[>=]]> #{beginDate,jdbcType=TIMESTAMP} and a.charge_date <![CDATA[<=]]> #{endDate,jdbcType=TIMESTAMP}  " +
                     "<when test='patientId!=null'>",
@@ -559,7 +560,7 @@ public interface MzChargeDetailMapper {
             "<when test='serialNo!=null'>",
             " and mz_receipt_serial.serial_no like #{serialNo}",
             "</when>",
-            " and  real_no=receipt_sn order by a.times desc" +
+            " and  real_no=receipt_sn order by serial_no_order desc" +
                     "</script>"})
     List<Map<String, Object>> selectChargeListByPatient(@Param("patientId") String patientId, @Param("name") String name, @Param("serialNo") String serialNo, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
@@ -657,7 +658,8 @@ public interface MzChargeDetailMapper {
     @Select({"<script>",
             "SELECT distinct rtrim(a.patient_id) patient_id,name,a.times,a.receipt_no,charge_date=convert(char(10),a.charge_date,111) ,a.serial_no,real_no ,a.responce_type," +
                     " cheque_type=case when mz_receipt_serial_b.cheque_type='Y' " +
-                    " and (len(ltrim(rtrim(mz_receipt_serial.receipt_bill))) >= 10 or len(ltrim(rtrim(mz_receipt_serial.receipt_bill)))=0) then '本院记账' else '自费' end " +
+                    " and (len(ltrim(rtrim(mz_receipt_serial.receipt_bill))) >= 10 or len(ltrim(rtrim(mz_receipt_serial.receipt_bill)))=0) then '本院记账' else '自费' end, " +
+                    " serial_no_order=ABS(a.serial_no)  " +
                     "    FROM mz_charge_detail_b a,mz_receipt_serial_b " +
                     "  WHERE a.charge_date <![CDATA[>=]]> #{beginDate,jdbcType=TIMESTAMP} and a.charge_date <![CDATA[<=]]> #{endDate,jdbcType=TIMESTAMP}   " +
                     "<when test='patientId!=null'>",
@@ -669,7 +671,7 @@ public interface MzChargeDetailMapper {
             "<when test='serialNo!=null'>",
             " and mz_receipt_serial_b.serial_no =#{serialNo}",
             "</when>",
-            " and  real_no=receipt_sn order by a.times desc" +
+            " and  real_no=receipt_sn order by serial_no_order desc" +
                     "</script>"})
     List<Map<String, Object>> selectHisChargeListByPatient(@Param("patientId") String patientId, @Param("name") String name, @Param("serialNo") String serialNo, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 

+ 81 - 13
src/main/resources/static/js/toll_administration.js

@@ -1219,7 +1219,7 @@ function saveConfirmFee() {
                 return;
             }
             if (res.code == 0) {
-                prn1Print(patientId, times, true,res.receiptNo);
+                prn1Print(patientId, times, true, res.receiptNo);
                 new PNotify({
                     title: '操作提示',
                     text: res.message,
@@ -1254,8 +1254,8 @@ function saveConfirmFee() {
  * @param times
  * @param chargeFeeFlag 收费 退费标记  true 收费和重打发票来源 false 退费来源
  */
-function prn1Print(patientId, times, chargeFeeFlag,receiptNo) {
-    var url = '/thmz/getAllSerialForThisTime?patientId=' + patientId + "&times=" + times+"&receiptNo="+receiptNo;
+function prn1Print(patientId, times, chargeFeeFlag, receiptNo) {
+    var url = '/thmz/getAllSerialForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo;
     printCommon(url, patientId, times, chargeFeeFlag);
 }
 
@@ -1264,10 +1264,10 @@ function prn1Print(patientId, times, chargeFeeFlag,receiptNo) {
  * @param patientId
  * @param times
  */
-function repPrint(patientId, times,receiptNo) {
+function repPrint(patientId, times, receiptNo) {
     $.ajax({
         type: "GET",
-        url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "&times=" + times+"&receiptNo="+receiptNo,
+        url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo,
         contentType: "application/json;charset=UTF-8",
         dataType: "json",
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
@@ -1632,6 +1632,7 @@ function refundFee(patientId, times, receiptNo, printFlag) {
         });
         return;
     }
+    $("#refundFeePrepare").text(0.00);
     $("#refundFeeDetailModal").modal();
     $("#refund_bill_item_group").removeClass("in").addClass("hide");
     $('#refund_fee_bill_table').bootstrapTable("destroy");
@@ -1798,6 +1799,22 @@ function initRefundFeeDetailTable(patientId, times, receiptNo) {
                 }
             }
         ],
+        //点击全选框时触发的操作
+        onCheckAll: function (rows) {
+            getRefundFee();
+        },
+        //取消所有
+        onUncheckAll: function (row) {
+            getRefundFee();
+        },
+        //点击每一个单选框时触发的操作
+        onCheck: function (row) {
+            getRefundFee();
+        },
+        //取消每一个单选框时对应的操作;
+        onUncheck: function (row) {
+            getRefundFee();
+        },
         responseHandler: function (res) {
             if (res == '401' || res == 401) {
                 window.location.href = '/thmz/login/view'
@@ -1840,15 +1857,70 @@ function queryParamsForRefundFee(patientId, times) {
     return temp;
 };
 
+
+/**
+ * 每次选择费用清单明细时计算实际应退金额
+ */
+function getRefundFee() {
+    var chargeItemCodes = extracted();
+    if(chargeItemCodes==null){
+        $("#refundFeePrepare").text(0.00);
+        return;
+    }
+    $.ajax({
+        type: "POST",
+        url: '/thmz/getNewListForRefundFee',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        data: JSON.stringify({
+            patientId: $("#patientIdRefund").val(),
+            times: $("#timesRefund").val(),
+            chargeItemCodes: chargeItemCodes
+        }),
+        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) {
+                $("#refundFeePrepare").text(res.pageViewVo.data[0].refundFee.toFixed(2));
+            } else {
+                new PNotify({
+                    title: '错误提示',
+                    text: res.message,
+                    type: 'error',
+                    hide: true,
+                    styling: 'bootstrap3'
+                });
+            }
+        }
+    });
+}
+
+
+
 /**
  * 发起预退费
  */
 function readyRefundFee() {
+    var chargeItemCodes = extracted();
+    $("#refundFeeModal").modal();
+    initRefundChargeDetailTable(chargeItemCodes);
+    $("#refundFeeDetailModal").modal("hide");
+
+}
+
+/**
+ * 获取预退费金额
+ * @returns {*}
+ */
+function extracted() {
     var allSelecteds = $('#refund_fee_detail_table').bootstrapTable('getAllSelections');
-    chargeItemCodes = null;
+    var chargeItemCodes = null;
     if (allSelecteds != null && allSelecteds.length > 0) {
         for (var i = 0; i < allSelecteds.length; i++) {
-            var temp = allSelecteds[i].orderNo + "_" + allSelecteds[i].itemNo +"_"+allSelecteds[i].chargeItemCode;
+            var temp = allSelecteds[i].orderNo + "_" + allSelecteds[i].itemNo + "_" + allSelecteds[i].chargeItemCode;
             if (chargeItemCodes == null) {
                 chargeItemCodes = temp;
             } else {
@@ -1856,13 +1928,9 @@ function readyRefundFee() {
             }
         }
     }
-    $("#refundFeeModal").modal();
-    initRefundChargeDetailTable(chargeItemCodes);
-    $("#refundFeeDetailModal").modal("hide");
-
+    return chargeItemCodes;
 }
 
-
 /**
  * 初始化退费重收费明细表格
  */
@@ -2026,7 +2094,7 @@ function saveRefundFee() {
                 });
                 $("#refundFeeModal").modal("hide");
                 if (res.times > 0) {
-                    prn1Print(res.patientId, res.times, false,1);
+                    prn1Print(res.patientId, res.times, false, 1);
                 } else {
                     initFeeTable();
                 }

+ 1 - 0
src/main/resources/templates/toll_administration.html

@@ -419,6 +419,7 @@
                 </form>
             </div>
             <div class="modal-footer">
+                <span style="margin-right: 100px;">应退金额(元)</span><span style="margin-right: 100px;" id="refundFeePrepare">0.00</span>
                 <button type="button" class="btn btn-primary" onclick="readyRefundFee()">退费</button>
                 <button type="button" class="btn btn-default" onclick="closeRefundFeeDetailModal()">关闭</button>
             </div>