浏览代码

分页查询优化

hurugang 6 年之前
父节点
当前提交
f1d8e11dbd

+ 15 - 6
src/main/java/cn/hnthyy/thmz/controller/UnitCodeController.java

@@ -7,6 +7,7 @@ import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.his.ZdUnitCode;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.YesNoEnum;
+import cn.hnthyy.thmz.pageDto.ZdUnitCodePageDto;
 import cn.hnthyy.thmz.service.his.ZdUnitCodeService;
 import cn.hnthyy.thmz.vo.PageViewVO;
 import com.auth0.jwt.interfaces.DecodedJWT;
@@ -29,13 +30,19 @@ public class UnitCodeController {
 
     /**
      * 查询科室字典列表
-     * @param zdUnitCode
+     * @param zdUnitCodePageDto
      * @return
      */
     @UserLoginToken
     @RequestMapping(value = "/listUnitCode", method = {RequestMethod.GET, RequestMethod.POST})
-    public Map<String, Object> listUnitCode(@RequestBody ZdUnitCode zdUnitCode) {
+    public Map<String, Object> listUnitCode(@RequestBody ZdUnitCodePageDto zdUnitCodePageDto) {
         Map<String, Object> resultMap = new HashMap<>();
+        if(zdUnitCodePageDto==null){
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询科室列表失败,参数为空");
+            return resultMap;
+        }
+        ZdUnitCode zdUnitCode = zdUnitCodePageDto.getZdUnitCode();
         if(zdUnitCode==null){
             resultMap.put("code", -1);
             resultMap.put("message", "查询科室列表失败,参数为空");
@@ -56,10 +63,10 @@ public class UnitCodeController {
             zdUnitCode.setWbCode(null);
         }
         log.info("查询科室字典,参数信息");
-        PageViewVO pageViewVO = new PageViewVO(zdUnitCode.getPageIndex(), zdUnitCode.getPageSize(),zdUnitCode.getOrderByCase());
+        PageViewVO pageViewVO = new PageViewVO(zdUnitCodePageDto.getPageIndex(), zdUnitCodePageDto.getPageSize(),zdUnitCodePageDto.getOrderByCase());
         int total = zdUnitCodeService.countZdUnitCode(zdUnitCode);
         pageViewVO.setTotal(total);
-        pageViewVO.setData(zdUnitCodeService.queryZdUnitCodeWithPage(zdUnitCode));
+        pageViewVO.setData(zdUnitCodeService.queryZdUnitCodeWithPage(zdUnitCodePageDto));
         resultMap.put("code", 0);
         resultMap.put("message", "查询科室列表成功");
         resultMap.put("pageViewVO", pageViewVO);
@@ -78,7 +85,9 @@ public class UnitCodeController {
                                              @RequestParam("pyCode") String pyCode,@RequestParam("wbCode") String wbCode,@RequestParam("delFlag") Integer delFlag,
                                              @RequestParam("classCode") Integer classCode, HttpServletRequest request, HttpServletResponse response) {
         ZdUnitCode zdUnitCode=new ZdUnitCode();
-        zdUnitCode.setOrderByCase(orderByCase);
+        ZdUnitCodePageDto zdUnitCodePageDto = new ZdUnitCodePageDto();
+        zdUnitCodePageDto.setOrderByCase(orderByCase);
+        zdUnitCodePageDto.setZdUnitCode(zdUnitCode);
         zdUnitCode.setName(name);
         zdUnitCode.setCode(code);
         zdUnitCode.setPyCode(pyCode);
@@ -105,7 +114,7 @@ public class UnitCodeController {
         if(StringUtils.isBlank(zdUnitCode.getWbCode())){
             zdUnitCode.setWbCode(null);
         }
-        List<ZdUnitCode> zdUnitCodeList = zdUnitCodeService.queryZdUnitCode(zdUnitCode);
+        List<ZdUnitCode> zdUnitCodeList = zdUnitCodeService.queryZdUnitCode(zdUnitCodePageDto);
         if (zdUnitCodeList == null || zdUnitCodeList.size() == 0) {
             resultMap.put("code", -1);
             resultMap.put("message", "没有查询到符合条件的科室字典列表");

+ 0 - 6
src/main/java/cn/hnthyy/thmz/entity/his/ZdUnitCode.java

@@ -58,12 +58,6 @@ public class ZdUnitCode {
     private String parentName;
     //微信门诊分类标志名称
     private String mzClassValue;
-    //默认页
-    private   Integer pageIndex=0;
-    //默认页面展示数
-    private  Integer pageSize=10;
-    //排序字段
-    private String orderByCase;
 
     public ZdUnitCode(String code, String name) {
         this.code = code;

+ 5 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/MzyReqrecMapper.java

@@ -27,4 +27,9 @@ public interface MzyReqrecMapper {
     @Select("select top 1* from mzy_reqrec where patient_id=#{patientId,jdbcType=CHAR} order by times desc")
     MzyReqrec selectMzyReqrecByPatientId(@Param("patientId") String patientId);
 
+
+
+
+
+
 }

+ 49 - 48
src/main/java/cn/hnthyy/thmz/mapper/his/ZdUnitCodeMapper.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.mapper.his;
 
 import cn.hnthyy.thmz.entity.his.ZdUnitCode;
+import cn.hnthyy.thmz.pageDto.ZdUnitCodePageDto;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -12,49 +13,49 @@ public interface ZdUnitCodeMapper {
     /**
      * 分页查询科室字典列表
      *
-     * @param zdUnitCode 科室查询条件
+     * @param zdUnitCodePageDto 科室查询条件
      * @return
      */
     @Select({"<script>",
             "SELECT top ${pageSize} code,name,class_code,py_code,d_code wbCode,mz_flag,del_flag,n_code ynCode,yj_flag,mzrc_flag,parent_code,gh_charge_flag,office_pos,",
             "supply_flag,xnh_dept_code,xnh_dept_name,ghjz_flag,mz_class,sort_code,op_id,op_date FROM (SELECT ROW_NUMBER() OVER (ORDER BY zd_unit_code_page.${orderByCase} asc) ",
             "AS RowNumber,* from dbo.zd_unit_code zd_unit_code_page where 1=1 ",
-            "<when test='delFlag!=null'>",
-            " and del_flag =#{delFlag,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.delFlag!=null'>",
+            " and del_flag =#{zdUnitCode.delFlag,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='code!=null'>",
-            " and code =#{code,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.code!=null'>",
+            " and code =#{zdUnitCode.code,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='name!=null'>",
-            " and name like #{name,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.name!=null'>",
+            " and name like #{zdUnitCode.name,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='classCode!=null'>",
-            " and class_code =#{classCode,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.classCode!=null'>",
+            " and class_code =#{zdUnitCode.classCode,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='pyCode!=null'>",
-            " and py_code =#{pyCode,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.pyCode!=null'>",
+            " and py_code =#{zdUnitCode.pyCode,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='wbCode!=null'>",
-            " and d_code =#{wbCode,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.wbCode!=null'>",
+            " and d_code =#{zdUnitCode.wbCode,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='mzFlag!=null'>",
-            " and mz_flag =#{mzFlag,jdbcType=CHAR}",
+            "<when test='zdUnitCode.mzFlag!=null'>",
+            " and mz_flag =#{zdUnitCode.mzFlag,jdbcType=CHAR}",
             "</when>",
-            "<when test='ynCode!=null'>",
-            " and n_code =#{ynCode,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.ynCode!=null'>",
+            " and n_code =#{zdUnitCode.ynCode,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='yjFlag!=null'>",
-            " and yj_flag =#{yjFlag,jdbcType=CHAR}",
+            "<when test='zdUnitCode.yjFlag!=null'>",
+            " and yj_flag =#{zdUnitCode.yjFlag,jdbcType=CHAR}",
             "</when>",
-            "<when test='ghChargeFlag!=null'>",
-            " and gh_charge_flag =#{ghChargeFlag,jdbcType=CHAR}",
+            "<when test='zdUnitCode.ghChargeFlag!=null'>",
+            " and gh_charge_flag =#{zdUnitCode.ghChargeFlag,jdbcType=CHAR}",
             "</when>",
-            "<when test='ghjzFlag!=null'>",
-            " and ghjz_flag =#{ghjzFlag,jdbcType=CHAR}",
+            "<when test='zdUnitCode.ghjzFlag!=null'>",
+            " and ghjz_flag =#{zdUnitCode.ghjzFlag,jdbcType=CHAR}",
             "</when>",
             ") as A WHERE RowNumber >#{pageSize}*#{pageIndex} order by RowNumber asc",
             "</script>"})
-    List<ZdUnitCode> selectZdUnitCodeWithPage(ZdUnitCode zdUnitCode);
+    List<ZdUnitCode> selectZdUnitCodeWithPage(ZdUnitCodePageDto zdUnitCodePageDto);
 
 
     /**
@@ -246,46 +247,46 @@ public interface ZdUnitCodeMapper {
     /**
      * 查询科室字典列表
      *
-     * @param zdUnitCode 科室查询条件
+     * @param zdUnitCodePageDto 科室查询条件
      * @return
      */
     @Select({"<script>",
             "SELECT code,name,class_code,py_code,d_code wbCode,mz_flag,del_flag,n_code ynCode,yj_flag,mzrc_flag,parent_code,gh_charge_flag,office_pos,",
             "supply_flag,xnh_dept_code,xnh_dept_name,ghjz_flag,mz_class,sort_code,op_id,op_date FROM  dbo.zd_unit_code where 1=1 ",
-            "<when test='delFlag!=null'>",
-            " and del_flag =#{delFlag,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.delFlag!=null'>",
+            " and del_flag =#{zdUnitCode.delFlag,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='code!=null'>",
-            " and code =#{code,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.code!=null'>",
+            " and code =#{zdUnitCode.code,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='name!=null'>",
-            " and name like #{name,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.name!=null'>",
+            " and name like #{zdUnitCode.name,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='classCode!=null'>",
-            " and class_code =#{classCode,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.classCode!=null'>",
+            " and class_code =#{zdUnitCode.classCode,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='pyCode!=null'>",
-            " and py_code =#{pyCode,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.pyCode!=null'>",
+            " and py_code =#{zdUnitCode.pyCode,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='wbCode!=null'>",
-            " and d_code =#{wbCode,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.wbCode!=null'>",
+            " and d_code =#{zdUnitCode.wbCode,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='mzFlag!=null'>",
-            " and mz_flag =#{mzFlag,jdbcType=CHAR}",
+            "<when test='zdUnitCode.mzFlag!=null'>",
+            " and mz_flag =#{zdUnitCode.mzFlag,jdbcType=CHAR}",
             "</when>",
-            "<when test='ynCode!=null'>",
-            " and n_code =#{ynCode,jdbcType=VARCHAR}",
+            "<when test='zdUnitCode.ynCode!=null'>",
+            " and n_code =#{zdUnitCode.ynCode,jdbcType=VARCHAR}",
             "</when>",
-            "<when test='yjFlag!=null'>",
-            " and yj_flag =#{yjFlag,jdbcType=CHAR}",
+            "<when test='zdUnitCode.yjFlag!=null'>",
+            " and yj_flag =#{zdUnitCode.yjFlag,jdbcType=CHAR}",
             "</when>",
-            "<when test='ghChargeFlag!=null'>",
-            " and gh_charge_flag =#{ghChargeFlag,jdbcType=CHAR}",
+            "<when test='zdUnitCode.ghChargeFlag!=null'>",
+            " and gh_charge_flag =#{zdUnitCode.ghChargeFlag,jdbcType=CHAR}",
             "</when>",
-            "<when test='ghjzFlag!=null'>",
-            " and ghjz_flag =#{ghjzFlag,jdbcType=CHAR}",
+            "<when test='zdUnitCode.ghjzFlag!=null'>",
+            " and ghjz_flag =#{zdUnitCode.ghjzFlag,jdbcType=CHAR}",
             "</when>",
             " order by ${orderByCase} asc",
             "</script>"})
-    List<ZdUnitCode> selectZdUnitCode(ZdUnitCode zdUnitCode);
+    List<ZdUnitCode> selectZdUnitCode(ZdUnitCodePageDto zdUnitCodePageDto);
 }

+ 18 - 0
src/main/java/cn/hnthyy/thmz/pageDto/ZdUnitCodePageDto.java

@@ -0,0 +1,18 @@
+package cn.hnthyy.thmz.pageDto;
+
+import cn.hnthyy.thmz.entity.his.ZdUnitCode;
+import lombok.Data;
+
+/**
+ * 部门字典分页查询参数
+ */
+@Data
+public class ZdUnitCodePageDto {
+    private ZdUnitCode zdUnitCode;
+    //默认页
+    private   Integer pageIndex=0;
+    //默认页面展示数
+    private  Integer pageSize=10;
+    //排序字段
+    private String orderByCase;
+}

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

@@ -1,16 +1,18 @@
 package cn.hnthyy.thmz.service.his;
 
 import cn.hnthyy.thmz.entity.his.ZdUnitCode;
+import cn.hnthyy.thmz.pageDto.ZdUnitCodePageDto;
+
 import java.util.List;
 
 public interface ZdUnitCodeService {
     /**
      * 分页查询科室字典列表
      *
-     * @param zdUnitCode 科室查询条件
+     * @param zdUnitCodePageDto 科室查询条件
      * @return
      */
-    List<ZdUnitCode> queryZdUnitCodeWithPage(ZdUnitCode zdUnitCode);
+    List<ZdUnitCode> queryZdUnitCodeWithPage(ZdUnitCodePageDto zdUnitCodePageDto);
 
 
     /**
@@ -64,10 +66,10 @@ public interface ZdUnitCodeService {
     /**
      * 查询科室字典列表
      *
-     * @param zdUnitCode 科室查询条件
+     * @param zdUnitCodePageDto 科室查询条件
      * @return
      */
-    List<ZdUnitCode> queryZdUnitCode(ZdUnitCode zdUnitCode);
+    List<ZdUnitCode> queryZdUnitCode(ZdUnitCodePageDto zdUnitCodePageDto);
 
 
     /**

+ 9 - 8
src/main/java/cn/hnthyy/thmz/service/impl/his/ZdUnitCodeServiceImpl.java

@@ -6,6 +6,7 @@ import cn.hnthyy.thmz.enums.ClassCodeEnum;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.mapper.his.ZdMzClassMapper;
 import cn.hnthyy.thmz.mapper.his.ZdUnitCodeMapper;
+import cn.hnthyy.thmz.pageDto.ZdUnitCodePageDto;
 import cn.hnthyy.thmz.service.his.ZdUnitCodeService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,11 +29,11 @@ public class ZdUnitCodeServiceImpl implements ZdUnitCodeService {
     private Map<String, ZdUnitCode> map = new HashMap<>();
 
     @Override
-    public List<ZdUnitCode> queryZdUnitCodeWithPage(ZdUnitCode zdUnitCode) {
-        if(StringUtils.isBlank(zdUnitCode.getOrderByCase())){
-            zdUnitCode.setOrderByCase("code");
+    public List<ZdUnitCode> queryZdUnitCodeWithPage(ZdUnitCodePageDto zdUnitCodePageDto) {
+        if(StringUtils.isBlank(zdUnitCodePageDto.getOrderByCase())){
+            zdUnitCodePageDto.setOrderByCase("code");
         }
-        List<ZdUnitCode>  zdUnitCodes= zdUnitCodeMapper.selectZdUnitCodeWithPage(zdUnitCode);
+        List<ZdUnitCode>  zdUnitCodes= zdUnitCodeMapper.selectZdUnitCodeWithPage(zdUnitCodePageDto);
         formatUnitCode(zdUnitCodes);
         return zdUnitCodes;
     }
@@ -108,11 +109,11 @@ public class ZdUnitCodeServiceImpl implements ZdUnitCodeService {
     }
 
     @Override
-    public List<ZdUnitCode> queryZdUnitCode(ZdUnitCode zdUnitCode) {
-        if(StringUtils.isBlank(zdUnitCode.getOrderByCase())){
-            zdUnitCode.setOrderByCase("code");
+    public List<ZdUnitCode> queryZdUnitCode(ZdUnitCodePageDto zdUnitCodePageDto) {
+        if(StringUtils.isBlank(zdUnitCodePageDto.getOrderByCase())){
+            zdUnitCodePageDto.setOrderByCase("code");
         }
-        List<ZdUnitCode>  zdUnitCodes= zdUnitCodeMapper.selectZdUnitCode(zdUnitCode);
+        List<ZdUnitCode>  zdUnitCodes= zdUnitCodeMapper.selectZdUnitCode(zdUnitCodePageDto);
         formatUnitCode(zdUnitCodes);
         return zdUnitCodes;
     }

+ 1 - 1
src/main/resources/static/js/bootstrap-select.js

@@ -817,7 +817,7 @@
 
   // part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both.
   Selectpicker.DEFAULTS = {
-    noneSelectedText: 'Nothing selected',
+    noneSelectedText: '没有合适的选项',
     noneResultsText: 'No results matched {0}',
     countSelectedText: function (numSelected, numTotal) {
       return (numSelected == 1) ? '{0} item selected' : '{0} items selected';

+ 4 - 1
src/main/resources/static/js/registration.js

@@ -1348,7 +1348,10 @@ function initListDoctorSelect() {
             });
             $('#doctorParam').empty();
             $('#doctorParam').html(html);
-            $('#doctorParam').selectpicker('refresh');
+            // $("#doctorParam").selectpicker({
+            //     size: 10
+            // });
+            $('#doctorParam').selectpicker('destroy').selectpicker('refresh');
         }
     });
 }

+ 8 - 6
src/main/resources/static/js/unit_code.js

@@ -217,12 +217,14 @@ var TableInit = function () {
             pageSize: params.limit,   //页面大小
             pageIndex: params.offset / params.limit,  //页码
             orderByCase: $("#orderByCase").val(),
-            code: $("#code").val(),
-            name: $("#name").val(),
-            pyCode: $("#pyCode").val(),
-            wbCode: $("#wbCode").val(),
-            delFlag: $("#delFlag").val(),
-            classCode: $("#classType").val()
+            zdUnitCode: {
+                code: $("#code").val(),
+                name: $("#name").val(),
+                pyCode: $("#pyCode").val(),
+                wbCode: $("#wbCode").val(),
+                delFlag: $("#delFlag").val(),
+                classCode: $("#classType").val()
+            }
         };
         return temp;
     };