Kaynağa Gözat

科室权限和就诊已诊列表刷新优化

lihong 9 ay önce
ebeveyn
işleme
ebf1f6a3c7

+ 8 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/ButtonController.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.controller.mz;
 
+import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.thmz.*;
@@ -7,6 +8,7 @@ import cn.hnthyy.thmz.service.thmz.ButtonService;
 import cn.hnthyy.thmz.service.thmz.MenuService;
 import cn.hnthyy.thmz.service.thmz.RoleButtonRelationService;
 import cn.hnthyy.thmz.vo.RoleButtonVo;
+import cn.hutool.core.collection.CollUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -231,5 +233,11 @@ public class ButtonController {
             return resultMap;
         }
     }
+    @GetMapping("/queryButtonByUserId")
+    @UserLoginToken
+    public R queryButtonByUserId(){
+        List<Button> buttons = buttonService.queryByUserId(TokenUtil.getUser().getId());
+        return R.ok().put("data", buttons);
+    }
 
 }

+ 14 - 0
src/main/java/cn/hnthyy/thmz/controller/zd/UnitCodeController.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.controller.zd;
 
+import cn.hnthyy.thmz.Utils.AssertUtil;
 import cn.hnthyy.thmz.Utils.ExcelUtil;
 import cn.hnthyy.thmz.Utils.JsonUtil;
 import cn.hnthyy.thmz.Utils.PyWbUtil;
@@ -17,6 +18,7 @@ import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
 import cn.hnthyy.thmz.service.thmz.UserDeptRelationService;
 import cn.hnthyy.thmz.service.thmz.UserService;
 import cn.hnthyy.thmz.vo.PageViewVo;
+import cn.hutool.core.util.StrUtil;
 import com.auth0.jwt.interfaces.DecodedJWT;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -252,6 +254,18 @@ public class UnitCodeController {
     }
 
 
+    @PostMapping("/saveDeptAddress")
+    @UserLoginToken
+    public R saveDeptAddress(@RequestBody ZdUnitCode zdUnitCode){
+        AssertUtil.isNotBlank(zdUnitCode.getOriginalCode(),"修改的科室编码不能为空!");
+        AssertUtil.isNotBlank(zdUnitCode.getOfficePos(),"就诊地点不能为空");
+        if(StrUtil.isBlank(zdUnitCode.getOfficePos1())){
+            zdUnitCode.setOfficePos1("");
+        }
+        zdUnitCodeService.modifyZdUnitCode(zdUnitCode);
+        return R.ok();
+    }
+
 
     /**
      * 保存科室字典

+ 1 - 1
src/main/java/cn/hnthyy/thmz/interceptor/AuthenticationInterceptor.java

@@ -117,7 +117,7 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
                 throw new AuthException("401");
             }
             //用户已经登录。
-            evaluationService.login(httpServletRequest);
+            //evaluationService.login(httpServletRequest);
             return true;
         }
         return true;

+ 1 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/zd/ZdUnitCodeServiceImpl.java

@@ -12,6 +12,7 @@ import cn.hnthyy.thmz.mapper.his.zd.ZdUnitCodeMapper;
 import cn.hnthyy.thmz.mapper.thmz.ConfigMapper;
 import cn.hnthyy.thmz.pageDto.ZdUnitCodePageDto;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
+import cn.hnthyy.thmz.service.thmz.ButtonService;
 import cn.hnthyy.thmz.service.thmz.HaiCiAdapterService;
 import cn.hutool.core.collection.CollUtil;
 import org.apache.commons.lang3.StringUtils;

+ 1 - 1
src/main/resources/static/js/mz/clinic.js

@@ -1048,7 +1048,7 @@ function refreshList() {
     //加载候诊患者列表
     loadUnClinicTableList();
     //加载已接诊患者列表 病人会缴费,需要刷新状态
-    loadClinicTableList();
+    // loadClinicTableList();
     timer = setInterval(() => {
         refreshList()
     }, 60000);

+ 100 - 17
src/main/resources/static/js/mz/unit_code.js

@@ -1,6 +1,26 @@
 //@ sourceURL=unit_code.js
 var $dataTableHot;
 var TableInit = function () {
+    //编辑权限
+    let deptEditFlag = false;
+    //科室就诊地点修改权限
+    let deptAddressFlag = false;
+    getAjaxRequst("/thmz/queryButtonByUserId",{},false,function (response) {
+        if(response.code == 0){
+            if(response.data !=null && response.data.length > 0){
+                for (let i = 0; i <response.data.length ; i++) {
+                    if(response.data[i].buttonCode == "dept-edit"){
+                        deptEditFlag = true;
+                    }
+                    if(response.data[i].buttonCode == "dept-address-edit"){
+                        deptAddressFlag = true;
+                    }
+                }
+            }
+
+        }
+    })
+
     var oTableInit = new Object();
     //初始化Table
     oTableInit.Init = function () {
@@ -39,13 +59,19 @@ var TableInit = function () {
                 align: "center",
                 valign: 'middle',
                 formatter: function (value, row, index) {
-                    var str;
-                    if (row.delFlag == 1) {
+                    var str="";
+                    if (row.delFlag == 1 && deptEditFlag) {
                         str = '<button type="button" class="btn btn-success  btn-sm" onclick="updateDeleteUnitCode(\'' + row.code + '\',\'' + row.name + '\',\'' + row.delFlag + '\')">启用</button>';
-                    } else {
+                    } else if(row.delFlag !=1 && deptEditFlag){
                         str = '<button type="button" class="btn btn-primary  btn-sm" onclick="updateDeleteUnitCode(\'' + row.code + '\',\'' + row.name + '\',\'' + row.delFlag + '\')">停用</button>';
                     }
-                    str += '<button type="button" class="btn btn-default  btn-sm" onclick="editUnitCode(\'' + row.code + '\')">编辑</button>';
+                    if(deptEditFlag){
+                        str += '<button type="button" class="btn btn-default  btn-sm" onclick="editUnitCode(\'' + row.code + '\')">编辑</button>';
+                    }
+                    if(deptAddressFlag){
+                        str += '<button type="button" class="btn btn-default  btn-sm" onclick="editUnitAddress(\'' + row.code + '\')">修改就诊地点</button>';
+                    }
+
                     return [str].join('');
                 }
             }, {
@@ -423,6 +449,41 @@ function editUnitCode(code) {
     fillModel(code);
 }
 
+/**
+ * 修改就诊地点
+ * @param code
+ */
+function editUnitAddress(code) {
+    $("#originalAddressCode").val(code);
+    clearModel();
+    $("#addressUnitCodeModal").modal();
+    fillModel(code);
+}
+
+/**
+ * 保存就诊地点
+ */
+function saveDeptAddress() {
+    postAjaxJsonHttpRequst("/thmz/saveDeptAddress",{
+        "officePos":$("#deptAddress").val(),
+        "officePos1":$("#deptYjAddress").val(),
+        "originalCode":$("#originalAddressCode").val()
+    },true,function (res) {
+        if(res.code == 0){
+            $("#originalAddressCode").val(null);
+            successMesageSimaple("修改就诊地点成功")
+            $("#addressUnitCodeModal").modal("hide");
+            $dataTableHot.bootstrapTable('refresh');
+        }else {
+            errorMesage(res)
+        }
+    })
+
+
+
+}
+
+
 /**
  * 删除记录 (停用)
  * @param code
@@ -498,6 +559,9 @@ function clearModel() {
     // $("#xnhDeptCodePlus").val(null);
     // $("#xnhDeptNamePlus").val(null);
     $("#officePosPlus").val(null);
+    $("#officePosPlus1").val(null);
+    $("#deptAddress").val(null);
+    $("#deptYjAddress").val(null);
     $("#sortCodePlus").val(null);
     $("#unitNumPlus").val(null);
     $("#ksZklPlus").val(null);
@@ -549,7 +613,9 @@ function fillModel(code) {
                 // $("#xnhDeptNamePlus").val(res.data.xnhDeptName);
                 $("#unitNumPlus").val(res.data.unitNum);
                 $("#officePosPlus").val(res.data.officePos);
+                $("#deptAddress").val(res.data.officePos);
                 $("#officePosPlus1").val(res.data.officePos1);
+                $("#deptYjAddress").val(res.data.officePos1);
                 $("#sortCodePlus").val(res.data.sortCode);
                 $("#ksZklPlus").val(res.data.ksZkl);
                 $("#deptDescribePlus").val(res.data.deptDescribe);
@@ -589,29 +655,46 @@ function fillModel(code) {
 
 $(function () {
     initDeptSelect();
+    //changeOrderByCause();
     //1.初始化Table
     var oTable = new TableInit();
     oTable.Init();
     //2.初始化Button的点击事件
     var oButtonInit = new ButtonInit();
     oButtonInit.Init();
-    //changeOrderByCause();
     initSelect();
     //数据校验
     init_validator();
-    //在刷新按钮前添加新增按钮
-    $("button[name='refresh']").before("<button class='btn btn-default' type='button' name='plus' aria-label='' title='新增'>" +
-        "<i class='glyphicon glyphicon glyphicon-plus icon-plus'></i></button>");
-    //为新增按钮增加事件
-    $("button[name='plus']").on("click", function (t) {
-        $("#originalCode").val(null);
-        clearModel();
-        if ($('#parentCodePlus').find("option").length == 1) {
-            initParentCodePlus();
+
+    getAjaxRequst("/thmz/queryButtonByUserId",{},true,function (bures) {
+        //编辑权限
+        let deptEditFlag = false;
+        if(bures.code == 0){
+            if(bures.data != null && bures.data.length > 0){
+                for (let i = 0; i <bures.data.length ; i++) {
+                    if(bures.data[i].buttonCode == "dept-edit"){
+                        deptEditFlag = true;
+                    }
+                }
+                if(deptEditFlag){
+                    //在刷新按钮前添加新增按钮
+                    $("button[name='refresh']").before("<button class='btn btn-default' type='button' name='plus' aria-label='' title='新增'>" +
+                        "<i class='glyphicon glyphicon glyphicon-plus icon-plus'></i></button>");
+                    //为新增按钮增加事件
+                    $("button[name='plus']").on("click", function (t) {
+                        $("#originalCode").val(null);
+                        clearModel();
+                        if ($('#parentCodePlus').find("option").length == 1) {
+                            initParentCodePlus();
+                        }
+                        $("#myModalLabel").text("新增科室");
+                        $("#unitCodeModal").modal();
+                    });
+                }
+            }
         }
-        $("#myModalLabel").text("新增科室");
-        $("#unitCodeModal").modal();
-    });
+    })
+
 
     $("#saveUnitCode").on("click", function (t) {
         var validatorResult = validator.checkAll($("#formPlus"));

+ 1 - 0
src/main/resources/templates/mz/clinic.html

@@ -321,6 +321,7 @@
                     <h>已诊患者 (</h>
                     <h id="ClinicNum">0</h>
                     <h>)</h>
+                    <button class="btn btn-sm btn-primary" type="button" title="刷新已诊患者列表" onclick="loadClinicTableList()"><i class="fa fa-rotate-right"></i></button>
                     <ul class="nav navbar-right panel_toolbox">
                         <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                         </li>

+ 41 - 0
src/main/resources/templates/mz/unit_code.html

@@ -277,6 +277,47 @@
             </div>
         </div>
 
+        <!--修改就诊地点-->
+        <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="addressUnitCodeModal">
+            <div class="modal-dialog modal-lg">
+                <div class="modal-content">
+
+                    <div class="modal-header">
+                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
+                        </button>
+                        <h4 class="modal-title modal-title-thmz" >修改就诊地点</h4>
+                    </div>
+                    <div class="modal-body">
+                        <form class="form-horizontal form-label-left" novalidate id="formDeptAddressPlus" autocomplete="off">
+                            <div class="item form-group">
+                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="deptAddress">就诊地点
+                                </label>
+                                <div class="col-md-6 col-sm-6 col-xs-12">
+                                    <input type="text" id="deptAddress" data-validate-length-range="1,20"
+                                           class="form-control col-md-7 col-xs-12">
+                                </div>
+                            </div>
+                            <div class="item form-group">
+                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="deptYjAddress">夜间门诊地点
+                                </label>
+                                <div class="col-md-6 col-sm-6 col-xs-12">
+                                    <input type="text" id="deptYjAddress"
+                                           class="form-control col-md-7 col-xs-12">
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                    <div class="modal-footer">
+                        <input type="hidden" id="originalAddressCode"/>
+                        <button type="button" class="btn btn-primary" onclick="saveDeptAddress()">保存</button>
+                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+
+
         <!-- 信息删除确认 -->
         <div class="modal fade" id="deleteConfirmModel">
             <div class="modal-dialog">