Browse Source

his入库成功不能退费

hurugang 4 years ago
parent
commit
d2991b3099

+ 53 - 1
src/main/java/cn/hnthyy/thmz/controller/PaidForZZController.java

@@ -2,8 +2,14 @@ package cn.hnthyy.thmz.controller;
 
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.entity.his.MzDepositFile;
+import cn.hnthyy.thmz.entity.his.MzyReqrec;
+import cn.hnthyy.thmz.entity.his.ZyDepositFile;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.entity.zz.WxPayOrder;
+import cn.hnthyy.thmz.service.his.MzDepositFileService;
+import cn.hnthyy.thmz.service.his.MzyReqrecService;
+import cn.hnthyy.thmz.service.his.ZyDepositFileService;
 import cn.hnthyy.thmz.service.thmz.PaidForZZService;
 import cn.hnthyy.thmz.vo.PageViewVo;
 import lombok.extern.slf4j.Slf4j;
@@ -22,7 +28,12 @@ import java.util.*;
 public class PaidForZZController {
     @Autowired
     private PaidForZZService paidForZZService;
-
+    @Autowired
+    private MzDepositFileService mzDepositFileService;
+    @Autowired
+    private MzyReqrecService mzyReqrecService;
+    @Autowired
+    private ZyDepositFileService zyDepositFileService;
     /**
      * 查询自助缴费列表
      *
@@ -111,6 +122,47 @@ public class PaidForZZController {
                 resultMap.put("message", "退费金额不能为空");
                 return resultMap;
             }
+            if(wxPayOrder.getOrderType()==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "订单类型参数不能为空");
+                return resultMap;
+            }
+            if(wxPayOrder.getOrderType()==1){
+                MzyReqrec mzyReqrec= mzyReqrecService.queryMzyReqrecByAgtordnum(wxPayOrder.getTradeNo(),null,null);
+                if(mzyReqrec!=null){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "当前缴费已经成功挂号,无法退费,如需退费,请到挂号列表进行对应操作!");
+                    return resultMap;
+                }
+                mzyReqrec= mzyReqrecService.queryMzyReqrecByAgtordnum(wxPayOrder.getTradeNo(),null,"mzy_reqrec_b");
+                if(mzyReqrec!=null){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "当前缴费已经成功挂号,无法退费,如需退费,请到挂号列表进行对应操作!");
+                    return resultMap;
+                }
+            }
+            if(wxPayOrder.getOrderType()==2){
+                MzDepositFile mzDepositFile= mzDepositFileService.queryMzDepositFileByAgtordnum(wxPayOrder.getTradeNo(),null,null);
+                if(mzDepositFile!=null){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "当前缴费已经成功缴纳门诊费用,无法退费,如需退费,请到收费列表进行对应操作!");
+                    return resultMap;
+                }
+                mzDepositFile= mzDepositFileService.queryMzDepositFileByAgtordnum(wxPayOrder.getTradeNo(),null,"mz_deposit_file_b");
+                if(mzDepositFile!=null){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "当前缴费已经成功缴纳门诊费用,无法退费,如需退费,请到收费列表进行对应操作!");
+                    return resultMap;
+                }
+            }
+            if(wxPayOrder.getOrderType()==3){
+                ZyDepositFile zyDepositFile= zyDepositFileService.queryZyDepositFileByAgtordnum(wxPayOrder.getTradeNo(),null,null);
+                if(zyDepositFile!=null){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "当前缴费已经成功缴纳住院预缴金,无法退费,如需退费,请到住院鱼胶金列表进行对应操作!");
+                    return resultMap;
+                }
+            }
             User tokenUser = TokenUtil.getUser(httpServletRequest);
             wxPayOrder.setRefundOpCode(tokenUser.getUserIdCode());
             Map<String,Object> map= paidForZZService.refundOrder(wxPayOrder);

+ 3 - 3
src/main/java/cn/hnthyy/thmz/controller/api/MedicalViewApiController.java

@@ -676,7 +676,7 @@ public class MedicalViewApiController {
             return results;
         }
         try {
-            MzDepositFile mzDepositFileDb = mzDepositFileService.queryMzDepositFileByAgtordnum(haiciCharge.getPsOrdNum(), haiciCharge.getAgtOrdNum());
+            MzDepositFile mzDepositFileDb = mzDepositFileService.queryMzDepositFileByAgtordnum(haiciCharge.getPsOrdNum(), haiciCharge.getAgtOrdNum(),null);
             if (mzDepositFileDb != null && PayMarkEnum.CHARGED.code.equals(mzDepositFileDb.getPayMark())) {
                 results.put("resultCode", 0);
                 results.put("resultMessage", "缴费成功");
@@ -762,7 +762,7 @@ public class MedicalViewApiController {
             return results;
         }
         try {
-            MzDepositFile mzDepositFileDb = mzDepositFileService.queryMzDepositFileByAgtordnum(haiciCharge.getPsOrdNum(), haiciCharge.getAgtOrdNum());
+            MzDepositFile mzDepositFileDb = mzDepositFileService.queryMzDepositFileByAgtordnum(haiciCharge.getPsOrdNum(), haiciCharge.getAgtOrdNum(),null);
             if (mzDepositFileDb != null && PayMarkEnum.CHARGED.code.equals(mzDepositFileDb.getPayMark())) {
                 results.put("resultCode", 0);
                 results.put("resultMessage", "门诊缴费订单支付状态查询成功");
@@ -1612,7 +1612,7 @@ public class MedicalViewApiController {
 //            return results;
 //        }
         try {
-            MzyReqrec mzyReqrec = mzyReqrecService.queryMzyReqrecByAgtordnum(haiciCharge.getPsOrdNum(), haiciCharge.getAgtOrdNum());
+            MzyReqrec mzyReqrec = mzyReqrecService.queryMzyReqrecByAgtordnum(haiciCharge.getPsOrdNum(), haiciCharge.getAgtOrdNum(),null);
             if (mzyReqrec != null) {
                 results.put("resultCode", 0);
                 results.put("resultMessage", "门诊挂号订单支付状态查询成功");

+ 10 - 3
src/main/java/cn/hnthyy/thmz/mapper/his/MzDepositFileMapper.java

@@ -144,10 +144,15 @@ public interface MzDepositFileMapper {
      * @param agtordnum
      * @return
      */
-    @Select("select rtrim(patient_id) patient_id,times,receipt_no,rtrim(pay_mark) pay_mark,rtrim(cheque_type) cheque_type,rtrim(cheque_no) cheque_no," +
+    @Select({"<script>",
+            "select rtrim(patient_id) patient_id,times,receipt_no,rtrim(pay_mark) pay_mark,rtrim(cheque_type) cheque_type,rtrim(cheque_no) cheque_no," +
             "amount,charge_date,dcount_date,rtrim(dcount_no) dcount_no,rtrim(op_id) op_id,receipt_sn,serial_no,rtrim(responce_type) responce_type,yb_jlh,yb_ywh,dept_no," +
-            "psordnum,agtordnum,hisrefundnum from mz_deposit_file where psordnum=#{psordnum} and agtordnum = #{agtordnum}")
-    MzDepositFile selectMzDepositFileByAgtordnum(@Param("psordnum") String psordnum,@Param("agtordnum") String agtordnum);
+            "psordnum,agtordnum,hisrefundnum from ${tableName} where psordnum=#{psordnum} and pay_mark = 0 ",
+            "<when test='agtordnum!=null'>",
+            " and agtordnum = #{agtordnum}",
+            "</when>",
+            "</script>"})
+    MzDepositFile selectMzDepositFileByAgtordnum(@Param("psordnum") String psordnum,@Param("agtordnum") String agtordnum,@Param("tableName") String tableName);
 
     /**
      * 根据日期统计当天的收费总额
@@ -219,4 +224,6 @@ public interface MzDepositFileMapper {
             "</when>",
             "</script>"})
     int countMzDepositFile(MzDepositFile mzDepositFile);
+
+
 }

+ 8 - 3
src/main/java/cn/hnthyy/thmz/mapper/his/MzyReqrecMapper.java

@@ -294,12 +294,17 @@ public interface MzyReqrecMapper {
      * @param agtordnum
      * @return
      */
-    @Select("select rtrim(patient_id) patient_id,times,rtrim(name) name,rtrim(req_type) req_type,request_day,rtrim(ampm) ampm,rtrim(unit_code) unit_code,"+
+    @Select({"<script>",
+            "select rtrim(patient_id) patient_id,times,rtrim(name) name,rtrim(req_type) req_type,request_day,rtrim(ampm) ampm,rtrim(unit_code) unit_code,"+
             "rtrim(group_code) group_code,rtrim(doctor_code) doctor_code,rtrim(charge_type) charge_type,req_order,req_fee,oth_fee,rtrim(cancel_mark) cancel_mark,"+
             "rtrim(admiss_time) admiss_time,rtrim(op_id) op_id,op_day,clinic_fee,rtrim(visited_mark) visited_mark,rtrim(plus_mark) plus_mark,closing_date,"+
             "rtrim(printer_id) printer_id,rtrim(print_flag) print_flag,rtrim(windows_no) windows_no,serial_no,rtrim(receipt_bill) receipt_bill,dcount_no,brochure_fee,dept_no,visit_dept,"+
-            "visit_doctor,visit_date,paymode,psordnum,agtordnum,print_closing_date,print_dcount_no   from dbo.mzy_reqrec where psordnum=#{psordnum} and agtordnum = #{agtordnum}")
-    MzyReqrec selectMzyReqrecByAgtordnum(@Param("psordnum") String psordnum,@Param("agtordnum") String agtordnum);
+            "visit_doctor,visit_date,paymode,psordnum,agtordnum,print_closing_date,print_dcount_no   from dbo.${tableName} where psordnum=#{psordnum} and cancel_mark =0 ",
+            "<when test='agtordnum!=null'>",
+            " and agtordnum = #{agtordnum}",
+            "</when>",
+            "</script>"})
+    MzyReqrec selectMzyReqrecByAgtordnum(@Param("psordnum") String psordnum,@Param("agtordnum") String agtordnum,@Param("tableName") String tableName);
 
 
 

+ 16 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/ZyDepositFileMapper.java

@@ -90,4 +90,20 @@ public interface ZyDepositFileMapper {
     @Update("update zy_deposit_file set printed=1 where receipt_no=#{receiptNo}")
     int updatePrinted(@Param("receiptNo") String receiptNo);
 
+
+
+    /**
+     * 判断手机自助缴费平台对应的流水号有无成功住院预交金
+     * @param psordnum
+     * @param agtordnum
+     * @return
+     */
+    @Select({"<script>",
+            "select * from dbo.${tableName} where psordnum=#{psordnum}  and depo_amount>0 ",
+            "<when test='agtordnum!=null'>",
+            " and agtordnum = #{agtordnum}",
+            "</when>",
+            "</script>"})
+    ZyDepositFile selectZyDepositFileByAgtordnum(@Param("psordnum") String psordnum,@Param("agtordnum") String agtordnum,@Param("tableName") String tableName);
+
 }

+ 1 - 1
src/main/java/cn/hnthyy/thmz/service/his/MzDepositFileService.java

@@ -37,7 +37,7 @@ public interface MzDepositFileService {
      * @param agtordnum
      * @return
      */
-    MzDepositFile queryMzDepositFileByAgtordnum(String psordnum,String agtordnum);
+    MzDepositFile queryMzDepositFileByAgtordnum(String psordnum,String agtordnum,String tableName);
 
 
     /**

+ 1 - 1
src/main/java/cn/hnthyy/thmz/service/his/MzyReqrecService.java

@@ -118,7 +118,7 @@ public interface MzyReqrecService {
      * @param agtordnum
      * @return
      */
-    MzyReqrec queryMzyReqrecByAgtordnum(String psordnum,String agtordnum);
+    MzyReqrec queryMzyReqrecByAgtordnum(String psordnum,String agtordnum,String tableName);
 
     /**
      * 判断是否减免挂号费

+ 9 - 0
src/main/java/cn/hnthyy/thmz/service/his/ZyDepositFileService.java

@@ -52,4 +52,13 @@ public interface ZyDepositFileService {
      */
     int modifyPrinted(String receiptNo);
 
+
+    /**
+     * 判断手机自助缴费平台对应的流水号有无成功住院预交金
+     * @param psordnum
+     * @param agtordnum
+     * @return
+     */
+    ZyDepositFile queryZyDepositFileByAgtordnum(String psordnum,String agtordnum,String tableName);
+
 }

+ 5 - 2
src/main/java/cn/hnthyy/thmz/service/impl/his/MzDepositFileServiceImpl.java

@@ -70,8 +70,11 @@ public class MzDepositFileServiceImpl implements MzDepositFileService {
     }
 
     @Override
-    public MzDepositFile queryMzDepositFileByAgtordnum(String psordnum, String agtordnum) {
-        return mzDepositFileMapper.selectMzDepositFileByAgtordnum(psordnum, agtordnum);
+    public MzDepositFile queryMzDepositFileByAgtordnum(String psordnum, String agtordnum,String tableName) {
+        if(tableName==null){
+            tableName="mz_deposit_file";
+        }
+        return mzDepositFileMapper.selectMzDepositFileByAgtordnum(psordnum, agtordnum,tableName);
     }
 
     @Override

+ 5 - 2
src/main/java/cn/hnthyy/thmz/service/impl/his/MzyReqrecServiceImpl.java

@@ -601,8 +601,11 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
     }
 
     @Override
-    public MzyReqrec queryMzyReqrecByAgtordnum(String psordnum, String agtordnum) {
-        return mzyReqrecMapper.selectMzyReqrecByAgtordnum(psordnum, agtordnum);
+    public MzyReqrec queryMzyReqrecByAgtordnum(String psordnum, String agtordnum,String tableName) {
+        if(tableName==null){
+            tableName="mzy_reqrec";
+        }
+        return mzyReqrecMapper.selectMzyReqrecByAgtordnum(psordnum, agtordnum,tableName);
     }
 
     @Override

+ 8 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/ZyDepositFileServiceImpl.java

@@ -102,4 +102,12 @@ public class ZyDepositFileServiceImpl implements ZyDepositFileService {
     public int modifyPrinted(String receiptNo) {
         return zyDepositFileMapper.updatePrinted(receiptNo);
     }
+
+    @Override
+    public ZyDepositFile queryZyDepositFileByAgtordnum(String psordnum, String agtordnum, String tableName) {
+        if(tableName==null){
+            tableName="zy_deposit_file";
+        }
+        return zyDepositFileMapper.selectZyDepositFileByAgtordnum(psordnum, agtordnum,tableName);
+    }
 }

+ 6 - 3
src/main/resources/static/js/charge/paid_from_zz.js

@@ -140,7 +140,7 @@ function initFeeTable() {
                 formatter: function (value, row, index) {
                     var str = '';
                     if (payMarkGroup == 0) {
-                        str += '<button type="button" class="registration-no-color-foot-button" title="退费" onclick="refundFee(\'' + row.patientId + '\',' + row.id + ',' + row.totalFee + ',\'' + row.tradeNo + '\',\'' + row.patientName + '\',\'' + row.body + '\',);"><i class="fa fa-reply"></i></button>';
+                        str += '<button type="button" class="registration-no-color-foot-button" title="退费" onclick="refundFee(\'' + row.patientId + '\',' + row.id + ',' + row.totalFee + ',\'' + row.tradeNo + '\',\'' + row.patientName + '\',\'' + row.body + '\',' + row.orderType + ',);"><i class="fa fa-reply"></i></button>';
                     }
                     return str;
                 }
@@ -319,7 +319,7 @@ function getRePortRangeArr() {
 /**
  * 退费操作
  */
-function refundFee(patientId,id, totalFee, tradeNo,name,body) {
+function refundFee(patientId,id, totalFee, tradeNo,name,body,orderType) {
     $("#refundId").val(id);
     $("#patientIdRead").val(patientId);
     $("#nameRead").val(name);
@@ -327,6 +327,7 @@ function refundFee(patientId,id, totalFee, tradeNo,name,body) {
     $("#amountRead").val(totalFee);
     $("#refundFeeModal").modal();
     $("#tradeNoRead").val(tradeNo);
+    $("#refundOrderType").val(orderType);
 }
 
 
@@ -340,6 +341,7 @@ function clearMode() {
     $("#patientId").val(null);
     $("#bodyRead").val(null);
     $("#amountRead").val(null);
+    $("#refundOrderType").val(null);
 }
 
 
@@ -356,7 +358,8 @@ function saveRefundFee() {
         data: JSON.stringify({
             id: $("#refundId").val(),
             totalFee: $("#amountRead").val(),
-            tradeNo: $("#tradeNoRead").val()
+            tradeNo: $("#tradeNoRead").val(),
+            orderType: $("#refundOrderType").val()
         }),
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
         success: function (res) {

+ 1 - 0
src/main/resources/templates/charge/paid_from_zz.html

@@ -123,6 +123,7 @@
             </div>
             <div class="modal-footer">
                 <input id="refundId" type="hidden"/>
+                <input id="refundOrderType" type="hidden"/>
                 <button type="button" class="btn btn-primary" onclick="saveRefundFee()">确定</button>
                 <button type="button" class="btn btn-default" data-dismiss="modal" onclick="clearMode()">取消</button>
             </div>