Browse Source

特门收费开发完成

hurugang 5 years ago
parent
commit
ec39e0c70e

+ 122 - 0
src/main/java/cn/hnthyy/thmz/controller/MzChargeDetailController.java

@@ -6,11 +6,13 @@ import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.*;
+import cn.hnthyy.thmz.entity.thmz.PayInfo;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.PayMarkEnum;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.pageDto.MzChargeDetailPageDto;
 import cn.hnthyy.thmz.service.his.*;
+import cn.hnthyy.thmz.service.thmz.TsmzService;
 import cn.hnthyy.thmz.vo.ChargeFeeParamsVo;
 import cn.hnthyy.thmz.vo.MzDepositFileVo;
 import cn.hnthyy.thmz.vo.PageViewVo;
@@ -45,6 +47,10 @@ public class MzChargeDetailController {
     private ZyZdAuditItemService zyZdAuditItemService;
     @Autowired
     private ZdChargeItemService zdChargeItemService;
+    @Autowired
+    private MzChargeDetailYbService mzChargeDetailYbService;
+    @Autowired
+    private TsmzService tsmzService;
 
     /**
      * 查询费用列表
@@ -1172,4 +1178,120 @@ public class MzChargeDetailController {
         }
     }
 
+
+
+
+    /**
+     * 获取病人特门与自费金额
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getTmFee", method = {RequestMethod.POST})
+    public Map<String, Object> getTmFee(@RequestBody MzChargeDetailYb mzChargeDetailYb, HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (mzChargeDetailYb == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "获取病人特门与自费金额参数不能为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(mzChargeDetailYb.getPatientId())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "病人编码不能为空");
+                return resultMap;
+            }
+            if (mzChargeDetailYb.getTimes() == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "病人就诊次数不能为空");
+                return resultMap;
+            }
+            if (mzChargeDetailYb.getReceiptNo() == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "缴费次数不能为空");
+                return resultMap;
+            }
+            int count = mzChargeDetailYbService.queryTmCount(mzChargeDetailYb);
+            if(count>0){
+                String token = TokenUtil.getToken(httpServletRequest);
+                if (StringUtils.isBlank(token)) {
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "获取病人特门与自费金额失败,用户Token不存在");
+                    return resultMap;
+                }
+                DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
+                User tokenUser = (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
+                PayInfo result= tsmzService.uploadFees(tokenUser.getUserIdCode(), mzChargeDetailYb.getPatientId(),mzChargeDetailYb.getTimes(),mzChargeDetailYb.getReceiptNo());
+                resultMap.put("data", result);
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "获取病人特门与自费金额成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            resultMap.put("code", -1);
+            resultMap.put("message", "获取病人特门与自费金额失败,系统出错,请联系管理员");
+            log.error("获取病人特门与自费金额失败");
+            return resultMap;
+        }
+    }
+
+
+
+
+    /**
+     * 取消病人特门费用上传
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/cancelTmFee", method = {RequestMethod.POST})
+    public Map<String, Object> cancelTmFee(@RequestBody MzChargeDetailYb mzChargeDetailYb, HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (mzChargeDetailYb == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "取消病人特门费用上传参数不能为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(mzChargeDetailYb.getPatientId())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "病人编码不能为空");
+                return resultMap;
+            }
+            if (mzChargeDetailYb.getTimes() == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "病人就诊次数不能为空");
+                return resultMap;
+            }
+            if (mzChargeDetailYb.getReceiptNo() == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "缴费次数不能为空");
+                return resultMap;
+            }
+            int count = mzChargeDetailYbService.queryTmCount(mzChargeDetailYb);
+            if(count>0){
+                String token = TokenUtil.getToken(httpServletRequest);
+                if (StringUtils.isBlank(token)) {
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "取消病人特门费用上传失败,用户Token不存在");
+                    return resultMap;
+                }
+                DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
+                User tokenUser = (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
+                PayInfo result= tsmzService.retractFees(tokenUser.getUserIdCode(), mzChargeDetailYb.getPatientId(),mzChargeDetailYb.getTimes(),mzChargeDetailYb.getReceiptNo());
+                resultMap.put("data", result);
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "取消病人特门费用上传成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            resultMap.put("code", -1);
+            resultMap.put("message", "取消病人特门费用上传失败,系统出错,请联系管理员");
+            log.error("取消病人特门费用上传失败");
+            return resultMap;
+        }
+    }
+
 }

+ 37 - 0
src/main/java/cn/hnthyy/thmz/entity/his/MzChargeDetailYb.java

@@ -0,0 +1,37 @@
+package cn.hnthyy.thmz.entity.his;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 门诊处方类型表
+ */
+@Data
+public class MzChargeDetailYb implements Serializable,Comparable<MzChargeDetailYb> {
+    //主键
+    private Integer id;
+    //病人ID码
+    private String patientId;
+    //次数
+    private Integer times;
+    //是发票分票号,现在不用了,默认为1就好 没有缴费是0 缴费了是1
+    private Integer receiptNo;
+    //处方号
+    private Integer orderNo;
+    //项目数
+    private Integer itemNo;
+    //病人身份
+    private String responseType;
+    //医保类型 12-单病种  13-特门
+    private String ybType;
+
+
+   //根据处方号升序排列,降序修改相减顺序即可
+    @Override
+    public int compareTo(MzChargeDetailYb o) {
+        return this.orderNo-o.orderNo;
+    }
+}

+ 19 - 0
src/main/java/cn/hnthyy/thmz/entity/thmz/PayInfo.java

@@ -0,0 +1,19 @@
+package cn.hnthyy.thmz.entity.thmz;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 费用信息
+ */
+@Data
+public class PayInfo {
+    //自费部分
+    private BigDecimal selfPay;
+    //报销部分
+    private BigDecimal fundPay;
+    //总金额
+    private BigDecimal totalCost;
+
+}

+ 14 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/MzChargeDetailYbMapper.java

@@ -0,0 +1,14 @@
+package cn.hnthyy.thmz.mapper.his;
+
+import cn.hnthyy.thmz.entity.his.MzChargeDetailYb;
+import org.apache.ibatis.annotations.Select;
+
+public interface MzChargeDetailYbMapper {
+    /**
+     * 查询特门处方单张数
+     * @param mzChargeDetailYb
+     * @return
+     */
+    @Select("select count(yb_type) count from mz_charge_detail_yb where patient_id=#{patientId} and  times = #{times} and receipt_no=#{receiptNo} and yb_type =13 ")
+    int selectTmCount(MzChargeDetailYb mzChargeDetailYb);
+}

+ 12 - 0
src/main/java/cn/hnthyy/thmz/service/his/MzChargeDetailYbService.java

@@ -0,0 +1,12 @@
+package cn.hnthyy.thmz.service.his;
+
+import cn.hnthyy.thmz.entity.his.MzChargeDetailYb;
+
+public interface MzChargeDetailYbService {
+    /**
+     * 查询特门处方单张数
+     * @param mzChargeDetailYb
+     * @return
+     */
+    int queryTmCount(MzChargeDetailYb mzChargeDetailYb);
+}

+ 18 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/MzChargeDetailYbServiceImpl.java

@@ -0,0 +1,18 @@
+package cn.hnthyy.thmz.service.impl.his;
+
+import cn.hnthyy.thmz.entity.his.MzChargeDetailYb;
+import cn.hnthyy.thmz.mapper.his.MzChargeDetailYbMapper;
+import cn.hnthyy.thmz.service.his.MzChargeDetailYbService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class MzChargeDetailYbServiceImpl implements MzChargeDetailYbService {
+    @SuppressWarnings("all")
+    @Autowired
+    private MzChargeDetailYbMapper mzChargeDetailYbMapper;
+    @Override
+    public int queryTmCount(MzChargeDetailYb mzChargeDetailYb) {
+        return mzChargeDetailYbMapper.selectTmCount(mzChargeDetailYb);
+    }
+}

+ 132 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/TsmzServiceImpl.java

@@ -0,0 +1,132 @@
+package cn.hnthyy.thmz.service.impl.thmz;
+
+import cn.hnthyy.thmz.Utils.HttpUtil;
+import cn.hnthyy.thmz.entity.thmz.PayInfo;
+import cn.hnthyy.thmz.service.thmz.TsmzService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.json.JSONObject;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.Map;
+@Slf4j
+@Service
+public class TsmzServiceImpl implements TsmzService {
+    @Value("${tsmzServiceUrl}")
+    private String tsmzServiceUrl;
+    @Override
+    public Map<String, Object> getPersonInfo(String idCard, String bizType, String opId) {
+        String realUrl =tsmzServiceUrl+"/getPersonInfo";
+        return null;
+    }
+
+    @Override
+    public PayInfo uploadFees(String staffId, String patientId, Integer times, Integer receiptNo) {
+        String realUrl =tsmzServiceUrl+"/uploadFees";
+        Map<String,Object> map=new HashMap<>();
+        //Map 对象存入 用户名,密码,电话号码
+        map.put("staffId", staffId);
+        map.put("patientId", patientId);
+        map.put("times", times);
+        map.put("receiptNo", receiptNo);
+        //Map 转成  JSONObject 字符串
+        JSONObject jsonObj=new JSONObject(map);
+        try {
+            String result= HttpUtil.sendHttpPost(realUrl, jsonObj.toString());
+            if(StringUtils.isBlank(result)){
+                return null;
+            }
+            JSONObject resultJSONO =  new JSONObject(result);
+            if(resultJSONO==null){
+                return null;
+            }
+            if((int)resultJSONO.get("code")==0){
+                return getPayInfo(resultJSONO);
+            }else if((int)resultJSONO.get("code")==99){
+                realUrl =tsmzServiceUrl+"/calculateCost";
+                result= HttpUtil.sendHttpPost(realUrl, jsonObj.toString());
+                if(StringUtils.isBlank(result)){
+                    return null;
+                }
+                resultJSONO =  new JSONObject(result);
+                if(resultJSONO==null){
+                    return null;
+                }
+                if((int)resultJSONO.get("code")==0){
+                    return getPayInfo(resultJSONO);
+                }
+            }
+            return null;
+        } catch (Exception e) {
+            log.error("特殊门诊病人费用上传失败,病人id={},就诊次数times={},缴费次数receiptNo={}",patientId,times,receiptNo);
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    private PayInfo getPayInfo(JSONObject resultJSONO) {
+        JSONObject tempJSONO=(JSONObject)resultJSONO.get("payInfo");
+        PayInfo payInfo= new PayInfo();
+        String  fundPay= (String) tempJSONO.get("fundPay");
+        String  selfPay= (String) tempJSONO.get("selfPay");
+        String  totalCost= (String) tempJSONO.get("totalCost");
+        payInfo.setFundPay(StringUtils.isBlank(fundPay)?BigDecimal.ZERO:new BigDecimal(fundPay).setScale(1, BigDecimal.ROUND_HALF_UP));
+        payInfo.setSelfPay(StringUtils.isBlank(selfPay)?BigDecimal.ZERO:new BigDecimal(selfPay).setScale(1, BigDecimal.ROUND_HALF_UP));
+        payInfo.setTotalCost(StringUtils.isBlank(totalCost)?BigDecimal.ZERO:new BigDecimal(totalCost).setScale(1, BigDecimal.ROUND_HALF_UP));
+        return payInfo;
+    }
+
+    @Override
+    public PayInfo retractFees(String staffId, String patientId, Integer times, Integer receiptNo) {
+        String realUrl =tsmzServiceUrl+"/retractFees";
+        Map<String,Object> map=new HashMap<>();
+        //Map 对象存入 用户名,密码,电话号码
+        map.put("staffId", staffId);
+        map.put("patientId", patientId);
+        map.put("times", times);
+        map.put("receiptNo", receiptNo);
+        //Map 转成  JSONObject 字符串
+        JSONObject jsonObj=new JSONObject(map);
+        try {
+            String result= HttpUtil.sendHttpPost(realUrl, jsonObj.toString());
+            if(StringUtils.isBlank(result)){
+                return null;
+            }
+            JSONObject resultJSONO =  new JSONObject(result);
+            if(resultJSONO==null){
+                return null;
+            }
+            if((int)resultJSONO.get("code")==0){
+                return getPayInfo(resultJSONO);
+            }else if((int)resultJSONO.get("code")==98){
+                realUrl =tsmzServiceUrl+"/calculateCost";
+                result= HttpUtil.sendHttpPost(realUrl, jsonObj.toString());
+                if(StringUtils.isBlank(result)){
+                    return null;
+                }
+                resultJSONO =  new JSONObject(result);
+                if(resultJSONO==null){
+                    return null;
+                }
+                if((int)resultJSONO.get("code")==0){
+                    return getPayInfo(resultJSONO);
+                }
+            }
+            return null;
+        } catch (Exception e) {
+            log.error("特殊门诊病人取消费用上传失败,病人id={},就诊次数times={},缴费次数receiptNo={}",patientId,times,receiptNo);
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    @Override
+    public String calculateCost(String staffId, String patientId, Integer times, Integer receiptNo) {
+        String realUrl =tsmzServiceUrl+"/calculateCost";
+        return null;
+    }
+
+}

+ 49 - 0
src/main/java/cn/hnthyy/thmz/service/thmz/TsmzService.java

@@ -0,0 +1,49 @@
+package cn.hnthyy.thmz.service.thmz;
+
+import cn.hnthyy.thmz.entity.thmz.PayInfo;
+
+import java.util.Map;
+
+/**
+ * 特殊门诊服务
+ */
+public interface TsmzService {
+    /**
+     * 获取病人身份信息
+     * @param idCard 身份证号码
+     * @param bizType 医保类型
+     * @param opId 操作员Id
+     * @return
+     */
+    Map<String,Object> getPersonInfo(String idCard, String bizType, String opId);
+
+    /**
+     * 医保费用上传
+     * @param staffId 操作员Id
+     * @param patientId 病人id
+     * @param times
+     * @param receiptNo
+     * @return
+     */
+    PayInfo uploadFees(String staffId, String patientId, Integer times, Integer receiptNo);
+
+    /**
+     * 费用撤销
+     * @param staffId
+     * @param patientId
+     * @param times
+     * @param receiptNo
+     * @return
+     */
+    PayInfo retractFees(String staffId, String patientId, Integer times, Integer receiptNo);
+
+    /**
+     * 获取结算信息
+     * @param staffId
+     * @param patientId
+     * @param times
+     * @param receiptNo
+     * @return
+     */
+    String calculateCost(String staffId,String patientId,Integer times,Integer receiptNo);
+}

+ 5 - 0
src/main/resources/application.yml

@@ -117,3 +117,8 @@ sendNoticeToPatient: true
 #haiciServiceUrl: "https://sapi.med.gzhc365.com/openapi/health"
 #海慈开放服务地址生产环境
 haiciServiceUrl: "https://api.med.gzhc365.com/openapi/health"
+
+#特殊门诊测试地址
+#tsmzServiceUrl: "http://172.16.30.27:8704/shengyb/mt"
+#特殊门诊生产地址
+tsmzServiceUrl: "http://172.16.32.163:8704/shengyb/mt"

+ 144 - 53
src/main/resources/static/js/toll_administration.js

@@ -26,31 +26,8 @@ $(function () {
     /**
      * 增加收款方式按钮事件
      */
-    $("#addPayType").on("click", function (t) {
-        // var arr = $("#payForm").find("div.pay-item");
-        // if (arr.length > 0) {
-        //     for (var i = 0; i < arr.length; i++) {
-        //         var temp = parseFloat($(arr[i]).find("input").val());
-        //         if (temp == 0) {
-        //             new PNotify({
-        //                 title: '错误提示',
-        //                 text: "存在未使用的收款方式,请不要重复添加!",
-        //                 type: 'error',
-        //                 hide: true,
-        //                 styling: 'bootstrap3'
-        //             });
-        //             return;
-        //         }
-        //     }
-        // }
-        var payTypeIndex = $("#payTypeIndex").val();
-        var payTypeId = "payType_" + payTypeIndex;
-        var html = '<div class="item form-group pay-item"><div class="col-md-12 col-sm-12 col-xs-12"><div class="col-md-2 col-sm-2 col-xs-12"></div><label class="col-md-3 col-sm-3 col-xs-12"><select class="form-control selectpicker show-tick" required="true" id="' + payTypeId + '" onchange="checkFee(false)"></select></label><div class="col-md-3 col-sm-3 col-xs-12"><input class="form-control col-md-5 col-xs-12" type="number" data-placement="bottom-right" min="0" onchange="checkFee()"></div><div class="col-md-1 col-sm-1 col-xs-12" style="line-height: 34px;">元&nbsp;&nbsp;<a style="line-height: 34px;cursor: pointer;" onclick="closeThisParent(this)"><i class="fa fa-close"></i></a></div></div></div>';
-        $("#changeAmountParent").before(html);
-        initChequeType(payTypeId)
-        payTypeIndex = payTypeIndex + 1;
-        $("#payTypeIndex").val(payTypeIndex);
-        $("#addPayType").parent().removeClass("in").addClass("hide");
+    $("#addPayType").on("click", function () {
+        addPayType(null);
     });
 
     //初始门诊收银方式下拉选
@@ -94,7 +71,7 @@ $(function () {
 //         });
 //         $("#editWindowsModal").modal();
 //     });
-    postCMD("login",localStorage.getItem("userID"),'000000','收费项目',0,0,0, '','祝您早日康复',0,0,0);
+    postCMD("login", localStorage.getItem("userID"), '000000', '收费项目', 0, 0, 0, '', '祝您早日康复', 0, 0, 0);
     // setTimeout(function () {
     //     postCMD("login",localStorage.getItem("userID"),'000000','收费项目',0,0,0, '','祝您早日康复',0,0,0);
     // }, 3000);
@@ -376,7 +353,7 @@ function initFeeTable() {
                     if (payMarkGroup == 1) {
                         str += '<button type="button" class="registration-no-color-foot-button" title="退费" onclick="refundFee(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ',' + row.printFlag + ');"><i class="fa fa-reply"></i></button>';
                         if (row.printFlag == 0) {
-                            str += '<button type="button" id="button_'+row.realNo+'" class="registration-no-color-foot-button" title="发票打印" onclick="prn1PrintHand(\'' + row.patientId + '\',' + row.times + ',true,' + row.receiptNo + ','+row.realNo+');" style="color: #35D082;"><i class="fa fa-print"></i></button>';
+                            str += '<button type="button" id="button_' + row.realNo + '" class="registration-no-color-foot-button" title="发票打印" onclick="prn1PrintHand(\'' + row.patientId + '\',' + row.times + ',true,' + row.receiptNo + ',' + row.realNo + ');" style="color: #35D082;"><i class="fa fa-print"></i></button>';
                         } else if (row.printFlag == 1) {
                             str += '<button type="button" class="registration-no-color-foot-button" title="发票重打" onclick="repPrint(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ');" style="color: #F4BD00;"><i class="fa fa-print"></i></button>';
                             str += '<button type="button" class="registration-no-color-foot-button" title="发票作废重打" onclick="obsoleteAndRepPrint(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ');" style="color: #E73E48;"><i class="fa fa-print"></i></button>';
@@ -796,14 +773,23 @@ function confirmFeeModal(times, totalCharge, receiptNo) {
         $("#changeAmountParent").prev().remove();
         prevAll = $("#changeAmountParent").prevAll();
     }
-    $("#realMoney").val($("#amountMoneyConfirm").text());
-    $("#cash").val($("#amountMoneyConfirm").text());
+    // $("#realMoney").val($("#amountMoneyConfirm").text());
+    // $("#cash").val($("#amountMoneyConfirm").text());
     $("#tallyDetailModal").modal('hide');
     $("#haveTallyModal").modal('hide');
     $("#confirmFeeModal").modal();
     $("#amountMoneyConfirm").text(data);
+    var fundPay = $("#fundPay").val();
+    if (fundPay > 0) {
+        addPayType("payType_0");
+        $('#payType_0').selectpicker('val', 2);
+        $('#payType_0').selectpicker('refresh');
+        $("#payType_0").parent().parent().next().children(':first').val(fundPay);
+        $("#payType_0").parent().parent().next().next().children(':first').remove();
+    }
+    var realMoney = Minus(data, fundPay);
     $("#realMoney").val(data);
-    $("#cash").val(data);
+    $("#cash").val(realMoney);
     // $("#cash").val(null);
     setTimeout(function () {
         //默认光标在卡号输入框
@@ -813,11 +799,10 @@ function confirmFeeModal(times, totalCharge, receiptNo) {
     $("#payType").selectpicker('refresh');
     $("#changeAmount").val(0.0);
     $("#surplusAmount").val(0.0);
-    sendPeiceMessage(data,0,0,'您本次应付金额为'+data+'元',$("#patientIdHaveTally").val(),$("#nameHaveTally").val());
+    sendPeiceMessage(realMoney, 0, 0, '您本次应付金额为' + realMoney + '元', $("#patientIdHaveTally").val(), $("#nameHaveTally").val());
 }
 
 
-
 /**
  * 打开收费明细窗口
  * @param data
@@ -831,7 +816,6 @@ function chargeDetailModal(patientId, times, receiptNo) {
 }
 
 
-
 /**
  * 病人当前就诊次数的诊断查询
  * @param data
@@ -889,6 +873,7 @@ function initChequeType(payType) {
         url: '/thmz/getAllZdChequeTypeForMz',
         dataType: "json",
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        async: false,
         success: function (res) {
             if (res == '401' || res == 401) {
                 window.location.href = '/thmz/login/view'
@@ -924,7 +909,7 @@ function closeThisParent(obj) {
 function checkFee(flag) {
     var realMoney = parseFloat($("#realMoney").val());
     realMoney = realMoney.toFixed(2);
-    $("#realMoney").val(realMoney)
+    $("#realMoney").val(realMoney);
     var arr = $("#payForm").find("div.pay-item");
     if (arr.length > 0) {
         //非现金收款总金额
@@ -937,9 +922,9 @@ function checkFee(flag) {
                 temp = 0;
             }
             if ($(arr[i]).find("select").val() != 1) {
-                notCashAmount=Add(notCashAmount,temp);
+                notCashAmount = Add(notCashAmount, temp);
             } else {
-                cashAmount =Add(cashAmount,temp);
+                cashAmount = Add(cashAmount, temp);
             }
             for (var j = 0; j < arr.length; j++) {
                 if ($(arr[i]).find("select").val() == $(arr[j]).find("select").val() && i != j) {
@@ -965,7 +950,7 @@ function checkFee(flag) {
             $("#addPayType").parent().removeClass("in").addClass("hide");
             return;
         }
-        var totalAmount = Add(cashAmount,notCashAmount);
+        var totalAmount = Add(cashAmount, notCashAmount);
         $("#surplusAmount").val(0.0);
         if (totalAmount < realMoney) {
             if (flag) {
@@ -995,7 +980,7 @@ function checkFee(flag) {
             $("#changeAmount").val(changeAmount);
             $("#addPayType").parent().removeClass("in").addClass("hide");
             if (!flag) {
-                sendPeiceMessage(realMoney,totalAmount,changeAmount,'实际支付金额为'+totalAmount+'元,应找零'+changeAmount+'元',$("#patientIdHaveTally").val(),$("#nameHaveTally").val());
+                sendPeiceMessage(realMoney, totalAmount, changeAmount, '实际支付金额为' + totalAmount + '元,应找零' + changeAmount + '元', $("#patientIdHaveTally").val(), $("#nameHaveTally").val());
             }
         }
         //设置收费首页找零与应收和实收金额
@@ -1007,7 +992,7 @@ function checkFee(flag) {
     var amountMoneyConfirm = parseFloat($("#amountMoneyConfirm").text());
     var discount = 100;
     if (realMoney < amountMoneyConfirm) {
-        discount = Division(realMoney,Multiply(amountMoneyConfirm ,100));
+        discount = Division(realMoney, Multiply(amountMoneyConfirm, 100));
     }
     $("#discount").text(discount.toFixed(2))
     return true;
@@ -1056,6 +1041,40 @@ function tipHaveTally(data, patientId, times, name, receiptNo) {
     //         }
     //     }
     // });
+
+    $.ajax({
+        type: "POST",
+        url: '/thmz/getTmFee',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        async: false,
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                if (res.data != undefined && res.data != null) {
+                    $("#fundPay").val(res.data.fundPay);
+                    //$("#realMoney").val(res.data.selfPay);
+                } else {
+                    $("#fundPay").val(0.0);
+                }
+            } else {
+                new PNotify({
+                    title: '错误提示',
+                    text: res.message,
+                    type: 'error',
+                    hide: true,
+                    styling: 'bootstrap3'
+                });
+            }
+            $("#saveConfirmFee").attr("disabled", false);
+        }
+    });
+
     confirmFeeModal(null, null, null);
 }
 
@@ -1201,9 +1220,9 @@ function initTallyDetailTable() {
  * 提交缴费申请
  */
 function saveConfirmFee() {
-    $("#saveConfirmFee").attr("disabled",true);
+    $("#saveConfirmFee").attr("disabled", true);
     if (!checkFee(true)) {
-        $("#saveConfirmFee").attr("disabled",false);
+        $("#saveConfirmFee").attr("disabled", false);
         return;
     }
     var jsonData = JSON.parse('{"patientId":"","times":"","receiptNo":"","mzDepositFiles":[]}');
@@ -1252,10 +1271,11 @@ function saveConfirmFee() {
                 $("#patientId").val(null);
                 $("#cardNo").val(null);
                 $("#name").val(null);
+                $("#fundPay").val(0);
                 initFeeTable();
                 //默认光标在卡号输入框
                 $("#cardNo").focus();
-                postCMD("appraise",localStorage.getItem("userID"),'000000','收费项目',0,0,0, '','祝您早日康复',0,0,0);
+                postCMD("appraise", localStorage.getItem("userID"), '000000', '收费项目', 0, 0, 0, '', '祝您早日康复', 0, 0, 0);
             } else {
                 new PNotify({
                     title: '错误提示',
@@ -1265,7 +1285,7 @@ function saveConfirmFee() {
                     styling: 'bootstrap3'
                 });
             }
-            $("#saveConfirmFee").attr("disabled",false);
+            $("#saveConfirmFee").attr("disabled", false);
         }
     });
 }
@@ -1277,8 +1297,8 @@ function saveConfirmFee() {
  * @param times
  * @param chargeFeeFlag 收费 退费标记  true 收费和重打发票来源 false 退费来源
  */
-function prn1PrintHand(patientId, times, chargeFeeFlag, receiptNo,realNo) {
-    $("#button_"+realNo).css("display","none");
+function prn1PrintHand(patientId, times, chargeFeeFlag, receiptNo, realNo) {
+    $("#button_" + realNo).css("display", "none");
     prn1Print(patientId, times, chargeFeeFlag, receiptNo);
 }
 
@@ -1695,7 +1715,7 @@ function initRefundFeeDetailTable(patientId, times, receiptNo) {
         sortable: true,                     //是否启用排序
         sortOrder: "asc",                   //排序方式
         // sortName: 'orderNo',                //排序字段
-        queryParams: queryParamsForRefundFee(patientId, times,receiptNo),           //传递参数(*)
+        queryParams: queryParamsForRefundFee(patientId, times, receiptNo),           //传递参数(*)
         sidePagination: "server",           //分页方式:client客户端分页,server服务端分页(*)
         pageNumber: 1,                       //初始化加载第一页,默认第一页
         pageSize: 10,                       //每页的记录行数(*)
@@ -1774,7 +1794,7 @@ function initRefundFeeDetailTable(patientId, times, receiptNo) {
                 valign: 'middle'
                 ,
                 formatter: function (value, row, index) {
-                    return value*row.drugWin;
+                    return value * row.drugWin;
                 }
             }, {
                 field: 'unitPrice',
@@ -1888,11 +1908,11 @@ function initRefundFeeDetailTable(patientId, times, receiptNo) {
  * @param times
  * @returns {{patientId: *, times: *}}
  */
-function queryParamsForRefundFee(patientId, times,receiptNo) {
+function queryParamsForRefundFee(patientId, times, receiptNo) {
     var temp = {
         patientId: patientId,
         times: times,
-        receiptNo:receiptNo
+        receiptNo: receiptNo
     };
     return temp;
 };
@@ -1903,7 +1923,7 @@ function queryParamsForRefundFee(patientId, times,receiptNo) {
  */
 function getRefundFee() {
     extracted();
-    if(chargeItemCodes==null){
+    if (chargeItemCodes == null) {
         $("#refundFeePrepare").text(0.00);
         return;
     }
@@ -1915,7 +1935,7 @@ function getRefundFee() {
         data: JSON.stringify({
             patientId: $("#patientIdRefund").val(),
             times: $("#timesRefund").val(),
-            receiptNo:$("#receiptNoRefund").val(),
+            receiptNo: $("#receiptNoRefund").val(),
             chargeItemCodes: chargeItemCodes
         }),
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
@@ -1940,7 +1960,6 @@ function getRefundFee() {
 }
 
 
-
 /**
  * 发起预退费
  */
@@ -2096,7 +2115,7 @@ function queryParamsForRefundDetail(chargeItemCodes) {
     return {
         patientId: $("#patientIdRefund").val(),
         times: $("#timesRefund").val(),
-        receiptNo:$("#receiptNoRefund").val(),
+        receiptNo: $("#receiptNoRefund").val(),
         chargeItemCodes: chargeItemCodes
     };
 };
@@ -2170,3 +2189,75 @@ function cleanParams() {
     $("#ownData").removeAttr("checked");
 }
 
+
+/**
+ * 增加收费方式
+ */
+function addPayType(id) {
+    // var arr = $("#payForm").find("div.pay-item");
+    // if (arr.length > 0) {
+    //     for (var i = 0; i < arr.length; i++) {
+    //         var temp = parseFloat($(arr[i]).find("input").val());
+    //         if (temp == 0) {
+    //             new PNotify({
+    //                 title: '错误提示',
+    //                 text: "存在未使用的收款方式,请不要重复添加!",
+    //                 type: 'error',
+    //                 hide: true,
+    //                 styling: 'bootstrap3'
+    //             });
+    //             return;
+    //         }
+    //     }
+    // }
+    var payTypeId = null;
+    if (id != undefined && id != null) {
+        payTypeId = id;
+    } else {
+        var payTypeIndex = $("#payTypeIndex").val();
+        payTypeId = "payType_" + payTypeIndex;
+    }
+    var html = '<div class="item form-group pay-item"><div class="col-md-12 col-sm-12 col-xs-12"><div class="col-md-2 col-sm-2 col-xs-12"></div><label class="col-md-3 col-sm-3 col-xs-12"><select class="form-control selectpicker show-tick" required="true" id="' + payTypeId + '" onchange="checkFee(false)"></select></label><div class="col-md-3 col-sm-3 col-xs-12"><input class="form-control col-md-5 col-xs-12" type="number" data-placement="bottom-right" min="0" onchange="checkFee()"></div><div class="col-md-1 col-sm-1 col-xs-12" style="line-height: 34px;">元&nbsp;&nbsp;<a style="line-height: 34px;cursor: pointer;" onclick="closeThisParent(this)"><i class="fa fa-close"></i></a></div></div></div>';
+    $("#changeAmountParent").before(html);
+    initChequeType(payTypeId)
+    if (id != undefined && id != null) {
+        payTypeIndex = Add(payTypeIndex, 1);
+        $("#payTypeIndex").val(payTypeIndex);
+    }
+    $("#addPayType").parent().removeClass("in").addClass("hide");
+}
+
+/**
+ * 取消费用上传
+ */
+function cancelFee() {
+    var patientId = $("#patientIdHaveTally").val();
+    var times = $("#timesHaveTally").val();
+    var receiptNo = $("#receiptNoHaveTally").val();
+    $.ajax({
+        type: "POST",
+        url: '/thmz/cancelTmFee',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+       // async: false,
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                $("#fundPay").val(0);
+            } else {
+                new PNotify({
+                    title: '错误提示',
+                    text: res.message,
+                    type: 'error',
+                    hide: true,
+                    styling: 'bootstrap3'
+                });
+            }
+        }
+    });
+}

+ 5 - 4
src/main/resources/templates/toll_administration.html

@@ -131,7 +131,7 @@
     <div class="modal-dialog modal-lg">
         <div class="modal-content" style="width: 680px;margin-left: 120px;">
             <div class="modal-header">
-                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
+                <button type="button" class="close" data-dismiss="modal" onclick="cancelFee()"><span aria-hidden="true">×</span>
                 </button>
                 <h4 class="modal-title">收费</h4>
             </div>
@@ -140,17 +140,18 @@
                     <div class="item form-group"
                          style="padding: 20px 10px;background: rgb(245, 246, 250);border-radius: 4px;border: none;">
                         <div class="col-md-12 col-sm-12 col-xs-12">
-                            <div class="col-md-4 col-sm-4 col-xs-12">
+                            <div class="col-md-3 col-sm-3 col-xs-12">
                                 <div class="total"> 合计:
                                     <span class="amountMoney" id="amountMoneyConfirm">0.00</span><span>元</span>
                                 </div>
                             </div>
-                            <div class="col-md-5 col-sm-5 col-xs-12">
+                            <div class="col-md-6 col-sm-6 col-xs-12">
                                 <label class="control-label col-md-4 col-sm-4 col-xs-12" for="realMoney">实收:
                                 </label>
                                 <div class="col-md-8 col-sm-8 col-xs-12">
                                     <input id="realMoney" class="form-control col-md-5 col-xs-12" type="number"
                                            data-placement="bottom-right" min="0" onchange="checkFee(false)" readonly>
+                                    <input id="fundPay"  type="hidden" readonly>
                                 </div>
                             </div>
                             <div class="col-md-3 col-sm-3 col-xs-12" style="line-height: 34px;">
@@ -210,7 +211,7 @@
                 <!--</div>-->
                 <!--<input type="hidden" id="benYuanJiZhangTimes"/>-->
                 <button type="button" class="btn btn-primary" onclick="saveConfirmFee()" id="saveConfirmFee">确定</button>
-                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+                <button type="button" class="btn btn-default" data-dismiss="modal" onclick="cancelFee()">取消</button>
             </div>
         </div>
     </div>