Переглянути джерело

优化代码。项目录入中查看模板添加分页。

xiaochan 3 роки тому
батько
коміт
29b74612fa

+ 6 - 2
src/main/java/thyyxxk/webserver/controller/yibao/XiangMuLuRuController.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.controller.yibao;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -48,8 +49,11 @@ public class XiangMuLuRuController {
     }
 
     @GetMapping("/getMuBan")
-    public ResultVo<List<ZyDetailCharge>> getMuBan(String deptCode) {
-        return service.getMuBan(deptCode);
+    public ResultVo<IPage<ZyDetailCharge>> getMuBan(@RequestParam("deptCode") String deptCode,
+                                                    @RequestParam("currentPage") long currentPage,
+                                                    @RequestParam("pageSize") long pageSize,
+                                                    @RequestParam("total") long total) {
+        return service.getMuBan(deptCode, currentPage, pageSize, total);
     }
 
     @GetMapping("/getMuBanXinXi")

+ 13 - 21
src/main/java/thyyxxk/webserver/dao/his/yibao/XiangMuLuRuDao.java

@@ -1,6 +1,10 @@
 package thyyxxk.webserver.dao.his.yibao;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.*;
 import thyyxxk.webserver.entity.datamodify.FeiYongLeiXin;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
@@ -416,27 +420,15 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
      * @param deptCode 根据科室来搜索
      * @return 返回模板信息
      */
-    @Select("<script>" +
-            "SELECT rtrim(a.pattern_name) name,  " +
-            "       group_no=max(a.group_no),  " +
-            "       op_id_code=max(op_id_code),  " +
-            "       rtrim(b.name) op_name,  " +
-            "       a.op_dept  " +
-            "FROM zy_charge_pattern a,  " +
-            "     a_employee_mi b  " +
-            "WHERE  " +
-            "    ( a.op_id_code = b.code )  and  " +
-            "        a.pattern_name &lt;&gt; ''   " +
-            "<if test=\"deptCode != '3100000' \">" +
-            "   and  op_dept=#{deptCode}  " +
-            "</if>" +
-            "<if test=\"defaultNo == 0\">" +
-            "and default_no &gt; 0 " +
-            "</if>" +
-            "group by a.pattern_name,a.op_dept, b.name" +
-            "</script>")
-    List<ZyDetailCharge> getMuBan(@Param("deptCode") String deptCode,
-                                  @Param("defaultNo") Integer defaultNo);
+    @Select("SELECT rtrim(pattern_name) as name, " +
+            "       max(group_no)       as group_no, " +
+            "       max(op_id_code)     as op_id_code, " +
+            "       op_dept " +
+            "FROM zy_charge_pattern " +
+            " ${ew.customSqlSegment} " +
+            "group by pattern_name, op_dept ")
+    Page<ZyDetailCharge> getMuBan(IPage<ZyDetailCharge> page,
+                                  @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
 
     /**
      * 这个是获取模板下面的那些项目具体信息

+ 23 - 17
src/main/java/thyyxxk/webserver/service/yibao/XiangMuLuRuService.java

@@ -2,6 +2,8 @@ package thyyxxk.webserver.service.yibao;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.ListUtils;
@@ -224,8 +226,15 @@ public class XiangMuLuRuService {
      * @param deptCode 根据科室搜索
      * @return 返回模板
      */
-    public ResultVo<List<ZyDetailCharge>> getMuBan(String deptCode) {
-        return ResultVoUtil.success(dao.getMuBan(deptCode, 1));
+    public ResultVo<IPage<ZyDetailCharge>> getMuBan(String deptCode, long currentPage, long pageSize, long total) {
+        IPage<ZyDetailCharge> page = new Page<>(currentPage, pageSize, total == 0);
+        QueryWrapper<?> qw = new QueryWrapper<>();
+        qw.ne("isnull(pattern_name,'')", "''");
+        if (publicServer.noNeedRule()) {
+            qw.eq("op_dept", deptCode);
+        }
+        dao.getMuBan(page, qw);
+        return ResultVoUtil.success(page);
     }
 
     /**
@@ -301,7 +310,7 @@ public class XiangMuLuRuService {
         if (dao.getHuanZheSFZaiYuan(param.getInpatientNo(), param.getAdmissTimes()) == 0) {
             errorStr.append("没有患者的在院信息 <br />");
         }
-        if (errorStr.length() > 3) {
+        if (errorStr.length() > 0) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, errorStr.toString());
         }
         // 收费项目的编码
@@ -317,13 +326,9 @@ public class XiangMuLuRuService {
 //        if (ListUtil.notBlank(meiYouKuCun)) {
 //            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "费用录入错误,药品无库存 【" + JSON.toJSONString(meiYouKuCun) + "】");
 //        }
-
-
         if (ListUtil.notBlank(yiTingYong)) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "费用录入错误,包含已停用的项目 【" + JSON.toJSONString(yiTingYong) + "】");
         }
-
-
         // 婴儿 要特殊处理
         // 如果带有这个 $ 说明是婴儿
         int infantFlag = publicServer.getInfantFlag(param.getInpatientNo());
@@ -356,7 +361,6 @@ public class XiangMuLuRuService {
                     zyDetailCharge.setChargeCode(zyDetailCharge.getChargeCodeMx());
                     break;
             }
-
             if (zyDetailCharge.getChargeAmount() == null || zyDetailCharge.getAmount() == null) {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "数量或金额不能为空。");
             }
@@ -389,7 +393,7 @@ public class XiangMuLuRuService {
             // 这里不会保存单价 只会总价
             zyDetailCharge.setChargeAmount(zyDetailCharge.getChargeAmount().multiply(zyDetailCharge.getAmount()));
             zyDetailCharge.setDetailSn(maxDetailSn += 1);
-            if (zyDetailCharge.getSerial().equals("01")) {
+            if ("01".equals(zyDetailCharge.getSerial())) {
                 ZyDetailCharge shenQing = new ZyDetailCharge();
                 BeanUtils.copyProperties(zyDetailCharge, shenQing);
                 shenQing.setChargeFee(zyDetailCharge.getChargeAmount());
@@ -421,10 +425,10 @@ public class XiangMuLuRuService {
         zyDetailCharge.setOpIdCode(TokenUtil.getTokenUserId());
         for (ZyDetailCharge detailCharge : zyDetailCharge.getList()) {
             if (StringUtil.notBlank(zyDetailCharge.getBillItemCode())) {
-                if (detailCharge.getBillItemCode().equals("001") || detailCharge.getBillItemCode().equals("002")) {
+                if ("001".equals(detailCharge.getBillItemCode()) || "002".equals(detailCharge.getBillItemCode())) {
                     detailCharge.setSerial("01");
                     detailCharge.setGroupNo("73");
-                } else if (zyDetailCharge.getBillItemCode().equals("028")) {
+                } else if ("028".equals(zyDetailCharge.getBillItemCode())) {
                     zyDetailCharge.setSerial("01");
                     zyDetailCharge.setChargeCode("BILL28");
                 } else {
@@ -583,7 +587,7 @@ public class XiangMuLuRuService {
         if (zyDetailCharge == null) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未查询到对应信息,可能该费用可能已经被撤销了或被正负相抵了。");
         }
-        if (!zyDetailCharge.getTransFlagYb().equals("0")) {
+        if (!"0".equals(zyDetailCharge.getTransFlagYb())) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "费用已经被上传了,无法撤销。");
         }
         if (zyDetailCharge.getOriDetailSn() != null && zyDetailCharge.getOriDetailSn() == -1) {
@@ -613,7 +617,7 @@ public class XiangMuLuRuService {
         }
         patient.setWeiPiPei(new ArrayList<>());
         patient.setWeiXieDaiYuanLiuShui(new ArrayList<>());
-        if (patient.getResponceType().equals("al")) {
+        if ("al".equals(patient.getResponceType())) {
             patient.getWeiPiPei().addAll(dao.gongShangWeiPiPei(patient.getInpatientNo(), patient.getAdmissTimes(), patient.getLedgerSn(), patient.getInfantFlag()));
         } else {
             patient.getWeiPiPei().addAll(dao.weiGuiYaoPin(patient.getInpatientNo(), patient.getAdmissTimes(), patient.getLedgerSn(), patient.getInfantFlag()));
@@ -674,7 +678,7 @@ public class XiangMuLuRuService {
         ZyDetailCharge zy = dao.piPeiXinXiFuShu(inpatientNo, zyDetailCharge.getAdmissTimes(), zyDetailCharge.getLedgerSn(), infantFlag, zyDetailCharge.getDetailSn());
         if (zy == null) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未找到负数费用信息,可能已经被删除了,请刷新页面重试。");
-        } else if (zy.getOriDetailSn() != null || zy.getTransFlagYb().equals("2")) {
+        } else if (zy.getOriDetailSn() != null || "2".equals(zy.getTransFlagYb())) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该负数费用已被正负相抵。");
         }
         List<ZyDetailCharge> zhenShuShuJu = dao.piPeiXinXi(inpatientNo, zyDetailCharge.getAdmissTimes(), zyDetailCharge.getLedgerSn(), infantFlag, detailSnList);
@@ -689,9 +693,11 @@ public class XiangMuLuRuService {
         for (ZyDetailCharge detailCharge : zhenShuShuJu) {
             if (!BigUtils.dengYu(detailCharge.getOrderNo(), zyDetailCharge.getOrderNo())) {
                 ResultVo<String> LOGICAL_ERROR = getStringResultVo(yongHuJueSe, zhiXinKeShi, zyDetailCharge, detailCharge, false);
-                if (LOGICAL_ERROR != null) return LOGICAL_ERROR;
+                if (LOGICAL_ERROR != null) {
+                    return LOGICAL_ERROR;
+                }
             }
-            if (detailCharge.getTransFlagYb().equals("2")) {
+            if ("2".equals(detailCharge.getTransFlagYb())) {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为:{%d},已被正负抵消。", detailCharge.getDetailSn()));
             }
             if (tuiFeiYuErPiPei.containsKey(detailCharge.getDetailSn())) {
@@ -734,7 +740,7 @@ public class XiangMuLuRuService {
             content[i][8] = pojo.getDeptCode();
             content[i][9] = pojo.getChargeFee().toString();
             content[i][10] = pojo.getChargeAmount().toString();
-            content[i][11] = pojo.getChargeStatus().equals("1") ? "录入" : pojo.getChargeStatus().equals("2") ? "上账" : "结算";
+            content[i][11] = "1".equals(pojo.getChargeStatus()) ? "录入" : "2".equals(pojo.getChargeStatus()) ? "上账" : "结算";
             content[i][12] = pojo.getOpName();
             content[i][13] = pojo.getBillItemName();
         }