Browse Source

取消延时改价,取消延时启用和取消延时停用,邹兰的收费方式只支持本院记账

hurugang 3 years ago
parent
commit
14be4f64ce

+ 19 - 2
src/main/java/cn/hnthyy/thmz/controller/mz/CriticalValueController.java

@@ -4,7 +4,10 @@ import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.thmz.CriticalValue;
 import cn.hnthyy.thmz.entity.thmz.User;
+import cn.hnthyy.thmz.entity.thmz.UserRoleRelation;
+import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.service.thmz.CriticalValueService;
+import cn.hnthyy.thmz.service.thmz.UserRoleRelationService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,7 +23,8 @@ import java.util.Map;
 public class CriticalValueController {
     @Autowired
     private CriticalValueService criticalValueService;
-
+    @Autowired
+    private UserRoleRelationService userRoleRelationService;
 
     /**
      * 获取危急值列表
@@ -43,7 +47,20 @@ public class CriticalValueController {
                 criticalValue.setCommonParams("%" + criticalValue.getCommonParams() + "%");
             }
             User tokenUser = TokenUtil.getUser(httpServletRequest);
-            criticalValue.setEmployeeCodes("%" + tokenUser.getUserCode() + "%");
+            List<UserRoleRelation> userRoleRelationList=userRoleRelationService.queryByUserId(tokenUser.getId());
+            //超级管理员可以看所有的数据
+            boolean isAdmin = false;
+            if(userRoleRelationList!=null && userRoleRelationList.size()>0){
+                for(UserRoleRelation userRoleRelation:userRoleRelationList){
+                    if(userRoleRelation!=null && userRoleRelation.getRoleId()==1){
+                        isAdmin=true;
+                        break;
+                    }
+                }
+            }
+            if(!isAdmin){
+                criticalValue.setEmployeeCodes("%" + tokenUser.getUserCode() + "%");
+            }
             if (StringUtils.isBlank(criticalValue.getBeginDate())) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "查询记录失败,开始日期参数为空");

+ 35 - 1
src/main/java/cn/hnthyy/thmz/controller/mz/ZdChargeItemController.java

@@ -385,7 +385,7 @@ public class ZdChargeItemController {
                 resultMap.put("message", "参数不能为空");
                 return resultMap;
             }
-            if(zdChargeItem.getCode()==null){
+            if(StringUtils.isBlank(zdChargeItem.getCode())){
                 resultMap.put("code", -1);
                 resultMap.put("message", "收费项目编码不能为空");
                 return resultMap;
@@ -425,6 +425,40 @@ public class ZdChargeItemController {
     }
 
 
+    /**
+     * 取消延迟改价/取消延时启用或停用
+     * @param code 项目编码
+     * @param type 类型 1 取消延时调价  2 取消延时启用或停用
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/cancelEffective", method = {RequestMethod.GET})
+    public Map<String, Object> cancelEffective(@RequestParam("code") String code,@RequestParam("type") Integer type) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(StringUtils.isBlank(code)){
+                resultMap.put("code", -1);
+                resultMap.put("message", "收费项目编码不能为空");
+                return resultMap;
+            }
+            if(type==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "操作类型不能为空");
+                return resultMap;
+            }
+            zdChargeItemService.cancelEffective(code,type);
+            resultMap.put("code", 0);
+            resultMap.put("message", "取消延时操作成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("取消延时操作失败,错误信息{}", e);
+            resultMap.put("code", -1);
+            resultMap.put("message", "保取消延时操作失败");
+            return resultMap;
+        }
+    }
+
 
 
 

+ 15 - 1
src/main/java/cn/hnthyy/thmz/controller/mz/ZdChequeTypeComtroller.java

@@ -1,6 +1,10 @@
 package cn.hnthyy.thmz.controller.mz;
 
+import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.common.Constants;
+import cn.hnthyy.thmz.entity.his.zd.ZdChequeType;
+import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.service.his.zd.ZdChequeTypeService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -8,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.*;
 
 @Slf4j
@@ -23,11 +28,20 @@ public class ZdChequeTypeComtroller {
      */
     @UserLoginToken
     @RequestMapping(value = "/getAllZdChequeTypeForMz", method = {RequestMethod.GET, RequestMethod.POST})
-    public Map<String, Object> getAllZdChequeTypeForMz() {
+    public Map<String, Object> getAllZdChequeTypeForMz(HttpServletRequest httpServletRequest) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
             resultMap.put("code", 0);
             resultMap.put("message", "查询所有门诊可用的付款方式成功");
+            User tokenUser = TokenUtil.getUser(httpServletRequest);
+            //邹兰的账号只返回本院记账收款方式
+            if("1437".equals(tokenUser.getUserCode())){
+                ZdChequeType zdChequeType = new ZdChequeType();
+                zdChequeType.setCode(Constants.BYJZ);
+                zdChequeType.setName(Constants.BYJZ_NAME);
+                resultMap.put("data", Arrays.asList(zdChequeType));
+                return resultMap;
+            }
             resultMap.put("data", zdChequeTypeService.queryAllZdChequeTypeForMz());
             return resultMap;
         } catch (Exception e) {

+ 15 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/zd/ZdChargeItemMapper.java

@@ -329,5 +329,20 @@ public interface ZdChargeItemMapper {
             "</script>"})
     List<JyZdItem> selectZlByCommonParams(@Param("commonParams") String commonParams, @Param("letterParamsLowerCase") String letterParamsLowerCase, @Param("letterParamsUpperCase") String letterParamsUpperCase, @Param("pageSize") Integer pageSize);
 
+    /**
+     * 取消延时改价
+     * @param code
+     * @return
+     */
+    @Update("update zd_charge_item set effective_time=null,effective_price=null where code = #{code}")
+    int cancelEffectivePrice(@Param("code") String code);
+
 
+    /**
+     * 取消延时启用或停用
+     * @param code
+     * @return
+     */
+    @Update("update zd_charge_item set effective_date=null where code = #{code}")
+    int cancelEffectiveDelFlag(@Param("code") String code);
 }

+ 2 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/zd/ZdChequeTypeMapper.java

@@ -11,14 +11,14 @@ public interface ZdChequeTypeMapper {
      * 查询所有门诊可用的付款方式
      * @return
      */
-    @Select("select rtrim(code) code,rtrim(name) name,mz_flag,zy_flag from zd_cheque_type WITH(NOLOCK)   where mz_flag =0 or mz_flag is null ")
+    @Select("select rtrim(code) code,rtrim(name) name,mz_flag,zy_flag from zd_cheque_type WITH(NOLOCK)   where mz_flag =0 or mz_flag is null order by  code")
     List<ZdChequeType> selectAllZdChequeTypeForMz();
 
     /**
      * 查询所有住院可用的付款方式
      * @return
      */
-    @Select("select rtrim(code) code,rtrim(name) name,mz_flag,zy_flag from zd_cheque_type WITH(NOLOCK)   where zy_flag =0 or zy_flag is null")
+    @Select("select rtrim(code) code,rtrim(name) name,mz_flag,zy_flag from zd_cheque_type WITH(NOLOCK)   where zy_flag =0 or zy_flag is null order by  code")
     List<ZdChequeType> selectAllZdChequeTypeForZy();
 
     /**

+ 8 - 0
src/main/java/cn/hnthyy/thmz/service/his/zd/ZdChargeItemService.java

@@ -75,4 +75,12 @@ public interface ZdChargeItemService {
      * @return
      */
     List<ZdChargeItem> queryAllZdCharge();
+
+    /**
+     *
+     * @param code 项目编码
+     * @param type 类型 1 取消延时调价  2 取消延时启用或停用
+     * @return
+     */
+    int cancelEffective(String code,Integer type);
 }

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

@@ -62,4 +62,12 @@ public class ZdChargeItemServiceImpl implements ZdChargeItemService {
     public List<ZdChargeItem> queryAllZdCharge() {
         return zdChargeItemMapper.selectAllZdCharge();
     }
+
+    @Override
+    public int cancelEffective(String code, Integer type) {
+        if(YesNoEnum.YES.code.equals(type)){
+            return zdChargeItemMapper.cancelEffectivePrice(code);
+        }
+        return zdChargeItemMapper.cancelEffectiveDelFlag(code);
+    }
 }

+ 48 - 0
src/main/resources/static/js/mz/charge_detail.js

@@ -116,6 +116,7 @@ $(function () {
                 if (res.code == 0) {
                     $("#priceModal").modal("hide");
                     clearPriceInput();
+                    $('#tb_table').bootstrapTable("refresh");
                     successMesage(res);
                 } else {
                     errorMesage(res);
@@ -145,6 +146,7 @@ $(function () {
                 if (res.code == 0) {
                     $("#delayToEnableOrStopModal").modal("hide");
                     clearDelayToEnableOrStopInput();
+                    $('#tb_table').bootstrapTable("refresh");
                     successMesage(res);
                 } else {
                     errorMesage(res);
@@ -201,12 +203,21 @@ function initZdChargeItemList() {
                 formatter: function (value, row, index) {
                     var str = '<button type="button" class="btn btn-primary  btn-sm" onclick="updateZdChargeItem(\'' + row.code + '\')">编辑</button>';
                     str += '<button type="button" class="btn btn-primary  btn-sm" onclick="updateZdChargeItemPrice(\'' + row.code + '\')">延时调价</button>';
+                    if(row.effectiveTime!=null){
+                        str += '<button type="button" class="btn btn-primary  btn-sm" onclick="cancelEffective(\'' + row.code + '\',\'' + row.name + '\',1)">取消延时调价</button>';
+                    }
                     if (row.delFlag == 0) {
                         str += '<button type="button" class="btn btn-warning  btn-sm" onclick="updateZdChargeItemDelFlag(\'' + row.code + '\',\'' + row.name + '\',1)">停用</button>';
                         str += '<button type="button" class="btn btn-warning  btn-sm" onclick="delayStopOrToEnable(\'' + row.code + '\',1)">延时停用</button>';
+                        if(row.effectiveDate!=null){
+                            str += '<button type="button" class="btn btn-primary  btn-sm" onclick="cancelEffective(\'' + row.code + '\',\'' + row.name + '\',3)">取消延时停用</button>';
+                        }
                     } else if (row.delFlag == 1) {
                         str += '<button type="button" class="btn btn-success  btn-sm" onclick="updateZdChargeItemDelFlag(\'' + row.code + '\',\'' + row.name + '\',0)">启用</button>';
                         str += '<button type="button" class="btn btn-success  btn-sm" onclick="delayStopOrToEnable(\'' + row.code + '\',0)">延时启用</button>';
+                        if(row.effectiveDate!=null){
+                            str += '<button type="button" class="btn btn-primary  btn-sm" onclick="cancelEffective(\'' + row.code + '\',\'' + row.name + '\',2)">取消延时启用</button>';
+                        }
                     }
                     return [str].join('');
                 }
@@ -488,6 +499,43 @@ function queryParams(params) {
     return temp;
 }
 
+/**
+ * 取消延迟改价/取消延时启用或停用
+ * @param code 项目编码
+ * @param name 项目名称
+ * @param type 类型 1 取消延时调价  2 取消延时启用 3 取消延时停用
+ */
+function cancelEffective(code,name,type) {
+    if (type == 1 && !confirm("确认要取消项目【"+name+"】的延时改价吗?")) {
+        return;
+    }
+    if (type == 2 && !confirm("确认要取消项目【"+name+"】的延时启用吗?")) {
+        return;
+    }
+    if (type == 3 && !confirm("确认要取消项目【"+name+"】的延时停用吗?")) {
+        type=2;
+        return;
+    }
+    $.ajax({
+        type: "GET",
+        url: '/thmz/cancelEffective?code='+code+'&type='+type,
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        async: false,
+        success: function (data) {
+            if (data == '401' || data == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if(data.code==0){
+                successMesage(data);
+                $('#tb_table').bootstrapTable("refresh");
+            }else {
+                errorMesage(data);
+            }
+        }
+    });
+}
 
 /**
  * 初始化下拉选

+ 12 - 2
src/main/resources/static/js/mz/registration.js

@@ -671,7 +671,11 @@ function initChequeType(payType) {
             $('#' + payType).empty();
             $('#' + payType).html(html);
             $('#' + payType).selectpicker('refresh');
-            $('#' + payType).selectpicker('val', 1);
+            if(res.data.length==1){
+                $('#' + payType).selectpicker('val', 'Y');
+            }else {
+                $('#' + payType).selectpicker('val', 1);
+            }
             $('#' + payType).selectpicker('refresh');
         }
     });
@@ -772,7 +776,13 @@ function confirmFeeModal() {
     if (!validatorResult) {
         return;
     }
-    $('#payType').selectpicker('val', 1);
+    var payTypeList = $("#payType").children();
+    if(payTypeList.length==1){
+        $('#payType').selectpicker('val', 'Y');
+    }else {
+        $('#payType').selectpicker('val', 1);
+    }
+   //$('#payType').selectpicker('val', 1);
     $('#payType').selectpicker('refresh');
     var prevAll = $("#changeAmountParent").prevAll();
     while (prevAll.length > 2) {

+ 16 - 4
src/main/resources/static/js/mz/toll_administration.js

@@ -814,7 +814,12 @@ function confirmFeeModal(times, totalCharge, receiptNo) {
     } else {
         $("#projectDiv").removeClass("in").addClass("hide");
     }
-    $('#payType').selectpicker('val', 1);
+    var payTypeList = $("#payType").children();
+    if(payTypeList.length==1){
+        $('#payType').selectpicker('val', 'Y');
+    }else {
+        $('#payType').selectpicker('val', 1);
+    }
     $('#payType').selectpicker('refresh');
     var data = parseFloat($("#dataIdHaveTally").val());
     if (totalCharge != null && totalCharge > 0) {
@@ -851,8 +856,11 @@ function confirmFeeModal(times, totalCharge, receiptNo) {
         //默认光标在卡号输入框
         $("#cash").focus();
     }, 800);
-    $("#payType").selectpicker('val', 1);
-    $("#payType").selectpicker('refresh');
+    if(payTypeList.length==1){
+        $('#payType').selectpicker('val', 'Y');
+    }else {
+        $('#payType').selectpicker('val', 1);
+    }
     $("#changeAmount").val(0.0);
     $("#surplusAmount").val(0.0);
     sendPriceMessage(realMoney, 0, 0, $("#patientIdHaveTally").val());
@@ -942,7 +950,11 @@ function initChequeType(payType) {
             $('#' + payType).empty();
             $('#' + payType).html(html);
             $('#' + payType).selectpicker('refresh');
-            $('#' + payType).selectpicker('val', 1);
+            if(res.data.length==1){
+                $('#' + payType).selectpicker('val', 'Y');
+            }else {
+                $('#' + payType).selectpicker('val', 1);
+            }
             $('#' + payType).selectpicker('refresh');
         }
     });

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

@@ -18,7 +18,7 @@
     <div class="col-md-12 col-sm-12 col-xs-12">
         <div class="x_panel">
             <div class="panel-body">
-                <form id="formSearch" class="form-horizontal" autocomplete="off">
+                <form id="formSearch" class="form-horizontal" autocomplete="off" onsubmit="return">
                     <div class="form-group" style="margin-top:15px">
                         <label class="control-label col-sm-1" for="commonParams" style="width: 12%;">患者住院号/姓名</label>
                         <div class="col-md-2 col-sm-2 col-xs-12" style="width: 15%;float: left;">