Pārlūkot izejas kodu

门诊科室药品维护科室类型改为临床和医技

WANGJIALIANG 2 gadi atpakaļ
vecāks
revīzija
1da121a26e

+ 21 - 1
src/main/java/cn/hnthyy/thmz/controller/zd/UnitCodeController.java

@@ -5,7 +5,6 @@ import cn.hnthyy.thmz.Utils.JsonUtil;
 import cn.hnthyy.thmz.Utils.PyWbUtil;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
-import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.his.mz.Employee;
 import cn.hnthyy.thmz.entity.his.zd.ZdUnitCode;
 import cn.hnthyy.thmz.entity.thmz.User;
@@ -22,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.*;
@@ -493,4 +493,24 @@ public class UnitCodeController {
        }
     }
 
+    /**
+     * 根据科室类型查询科室字典列表
+     * @param classCode
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getDeptByClassCode", method = {RequestMethod.GET, RequestMethod.POST})
+    public Map<String, Object> getDeptByClassCode(@RequestParam("classCode") String classCode) {
+        Map<String, Object> resultMap = new HashMap<>();
+        if(StringUtils.isBlank(classCode)){
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询科室列表失败,参数为空");
+            return resultMap;
+        }
+        List<ZdUnitCode> zdUnitCode = zdUnitCodeService.queryDeptByClassCode(classCode);
+        resultMap.put("code", 0);
+        resultMap.put("message", "查询科室列表成功");
+        resultMap.put("data", zdUnitCode);
+        return resultMap;
+    }
 }

+ 6 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/zd/ZdUnitCodeMapper.java

@@ -388,4 +388,10 @@ public interface ZdUnitCodeMapper {
     @Select("select count(1) from zy_bed_mi WITH(NOLOCK)   where ward_code =#{code}  and bed_status = 1")
     Integer selectFreeBedNumByDept(@Param("code") String code);
 
+    /**
+     * 根据科室类型查询科室
+     * @return
+     */
+    @Select("SELECT t.code,t.name,t.py_code FROM zd_unit_code t where isnull(t.del_flag,0)=0 and class_code in (${classCode}) order by code")
+    List<ZdUnitCode> selectDeptByClassCode(@Param("classCode") String classCode);
 }

+ 6 - 1
src/main/java/cn/hnthyy/thmz/service/his/zd/ZdUnitCodeService.java

@@ -155,5 +155,10 @@ public interface ZdUnitCodeService {
      * @return
      */
     Map<String,Integer> queryBedStatusNumByDept(String code);
-    
+
+    /**
+     * 根据科室类型查询科室
+     * @return
+     */
+    List<ZdUnitCode> queryDeptByClassCode(String classCode);
 }

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

@@ -256,4 +256,9 @@ public class ZdUnitCodeServiceImpl implements ZdUnitCodeService {
         return map;
     }
 
+    @Override
+    public List<ZdUnitCode> queryDeptByClassCode(String classCode) {
+        return zdUnitCodeMapper.selectDeptByClassCode(classCode);
+    }
+
 }

+ 13 - 10
src/main/resources/static/js/yf/yf_yp_zd_dept.js

@@ -22,7 +22,7 @@ function initTable() {
     $("#tb_table").jqGrid({
         datatype: 'json',
         mtype: 'get',
-        url: '/thmz/getAllZyAdtward',
+        url: '/thmz/getDeptByClassCode',
         loadBeforeSend: function (jqXHR) {
             jqXHR.setRequestHeader("Authorization", 'Bearer ' + localStorage.getItem("token"));
             jqXHR.setRequestHeader("Accept", 'application/json');
@@ -32,19 +32,22 @@ function initTable() {
                 XMLHttpRequest.setRequestHeader("Authorization", 'Bearer ' + localStorage.getItem("token"));
             }
         },
+        postData: {
+            classCode: "1,2"
+        },
         styleUI: 'Bootstrap',
         viewrecords: true,
         autowidth: true,
         rowNum: -1,//取消分页
         height:  screen.height*0.6,
         multiselect:true,
-        caption: '住院科室',
+        caption: '科室',
         shrinkToFit:false,
         loadonce:true, //一次加载全部数据到客户端,由客户端进行排序。
         colNames: ['编码','名称'],
         colModel: [
-            {name: 'deptCode', index: 'deptCode',width:100,align:'center'},
-            {name: 'deptName', index: 'deptName',width:200}
+            {name: 'code', index: 'code',width:100,align:'center'},
+            {name: 'name', index: 'name',width:200}
         ],
         jsonReader: {
             root: "data", repeatitems: false
@@ -118,8 +121,8 @@ function initYpZdDept() {
             let temp = eval('(' + '{ "'+cellname+'": "'+value+'"}' + ')');
             temp.chargeCode = record.chargeCode;
             let selRowId = $("#tb_table").jqGrid('getGridParam','selrow');
-            let deptCode = $("#tb_table").jqGrid('getCell',selRowId,'deptCode');
-            temp.deptCode = deptCode;
+            let code = $("#tb_table").jqGrid('getCell',selRowId,'code');
+            temp.deptCode = code;
             return temp
         },
         afterSubmitCell (serverresponse, rowid, cellname, value, iRow, iCol){
@@ -152,13 +155,13 @@ function initYpZdDept() {
  */
 function initYpZdDeptParam(){
     let selRowId = $("#tb_table").jqGrid('getGridParam','selrow');
-    let deptCode = $("#tb_table").jqGrid('getCell',selRowId,'deptCode');
-    if(!deptCode){
-        deptCode = null;
+    let code = $("#tb_table").jqGrid('getCell',selRowId,'code');
+    if(!code){
+        code = null;
     }
     let tem = {
         searchText: $("#searchText").val(),
-        deptCode: deptCode,
+        deptCode: code,
         groupNo: pharmacyGroupNo
     }
     return tem

+ 4 - 1
src/main/resources/static/js/yk/drug_return.js

@@ -1,5 +1,6 @@
 //@ sourceURL=drug_return.js
 var groupYk = window.localStorage["groupYk"];//药房编码
+var groupNo = window.localStorage["groupNo"];//药房编码
 $(function () {
     $(".selectpicker").selectpicker();
     initAllGroup('groupNoSearchText');
@@ -145,6 +146,8 @@ function resetSearch() {
     $("#deptCode").val(null);
     $("#deptCode").selectpicker('refresh');
     $("#drawNoSearch").val(null);
+    $("#groupNoSearchText").val(groupNo);
+    $("#groupNoSearchText").selectpicker('refresh');
 }
 
 /**
@@ -235,7 +238,7 @@ function initTbTable() {
                 align: "center",
                 valign: 'middle',
                 formatter: function (value, row, index) {
-                    return -value;
+                    return isEmpty(value)?0:-value;
                 }
             },
             {