From 5c7ea7346d77ab1c8be660c65e721ce3e46328f5 Mon Sep 17 00:00:00 2001
From: zhaowenxuan <chacca165@163.com>
Date: 星期五, 21 二月 2025 17:56:26 +0800
Subject: [PATCH] 小程序报告接口以及his项目查询接口分页修复

---
 ltkj-hosp/src/main/resources/mapper/TjCustomerMapper.xml                        |   57 +++++++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/domain/DictSfxm.java                      |    6 +
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/IDictSfxmService.java             |    4 
 ltkj-admin/src/main/java/com/ltkj/web/controller/api/DefaultController.java     |   18 +++
 ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerMapper.java              |    4 
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictSfxmController.java |   11 +
 ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/DictSfxmMapper.java                |    5 
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/DictSfxmServiceImpl.java     |   10 +
 ltkj-hosp/src/main/resources/mapper/hosp/DictSfxmMapper.xml                     |  204 ++++++++++++++++++++++++++++++++++
 9 files changed, 315 insertions(+), 4 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/api/DefaultController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/api/DefaultController.java
index 52bda6b..d402a70 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/api/DefaultController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/api/DefaultController.java
@@ -4,6 +4,8 @@
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.ltkj.common.core.domain.AjaxResult;
+import com.ltkj.hosp.domain.TjCustomer;
+import com.ltkj.hosp.mapper.TjCustomerMapper;
 import com.ltkj.web.controller.system.TjCheckController;
 import com.ltkj.web.controller.system.TjReportController;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -29,6 +31,8 @@
     private TjReportController tjReportController;
     @Autowired
     private TjCheckController tjCheckController;
+    @Autowired
+    private TjCustomerMapper tjCustomerMapper;
 
     /**
      * 鎻愪緵缁欎笁鏂硅皟鐢ㄧ殑鎶ュ憡鏌ョ湅鎺ュ彛
@@ -55,6 +59,20 @@
         return JSONUtil.toBean(entries, AjaxResult.class);
     }
 
+    /**
+     * 鏍规嵁韬唤璇佸彿鏌ヨ杩斿洖浣撴璁板綍锛氬寘鍚鍚嶃�佽韩浠借瘉鍙枫�佹�у埆銆佸嚭鐢熸棩鏈熴�佸勾榫勩�佷綋妫�鍙枫�佽仈绯荤數璇濓紝浣撴鏃ユ湡锛屾姤鍛婄姸鎬�
+     * @param json
+     * @return
+     */
+    @PostMapping("/getInfo")
+    public AjaxResult getInfo(@RequestBody String json){
+        JSONObject entries = JSONUtil.parseObj(json);
+        String card = entries.getStr("card");
+//        TjCustomer customer = tjCustomerMapper.getCusInfo(card);
+        List<TjCustomer> customer = tjCustomerMapper.getCusInfoList(card);
+        return AjaxResult.success(customer);
+    }
+
     public static void removeNullFields(JSONObject jsonObject) {
         ArrayList<String> strings = new ArrayList<>();
         strings.add("orderId");
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictSfxmController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictSfxmController.java
index ca17cd5..6f929eb 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictSfxmController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictSfxmController.java
@@ -55,14 +55,15 @@
 //    @PreAuthorize("@ss.hasPermi('system:sfxm:list')")
     @PostMapping("/list")
     @ApiOperation(value = "鏌ヨ")
-    public TableDataInfo list(@RequestBody DictSfxm dictSfxm) {
-        startPage();
+    public AjaxResult list(@RequestBody DictSfxm dictSfxm) {
+//        startPage();
         String pym = dictSfxm.getPym();
         if(null !=pym && !pym.isEmpty()) {
             pym=dictSfxm.getPym().toUpperCase(Locale.ROOT);
             dictSfxm.setPym(pym);
         }
-        List<DictSfxm> list = dictSfxmService.selectDictSfxmList(dictSfxm);
+//        List<DictSfxm> list = dictSfxmService.selectDictSfxmList(dictSfxm);
+        List<DictSfxm> list = dictSfxmService.selectDictSfxmListLimit(dictSfxm, (dictSfxm.getPageNum() - 1) * dictSfxm.getPageSize(), dictSfxm.getPageSize());
         if (null != list && !list.isEmpty()) {
             for (DictSfxm sfxm : list) {
                 DictHosp hosp = dictHospService.getById(sfxm.getYqid());
@@ -71,7 +72,9 @@
                 }
             }
         }
-        return getDataTable(list);
+        Integer count = dictSfxmService.selectDictSfxmListCount(dictSfxm);
+        return AjaxResult.success().put("rows",list).put("total",count);
+//        return getDataTable(list);
     }
 
     /**
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/DictSfxm.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/DictSfxm.java
index 0d8d6ec..05d83c7 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/DictSfxm.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/DictSfxm.java
@@ -257,6 +257,12 @@
     @ApiModelProperty(value = "椤圭洰瀛愰泦")
     private List<DictSfxm> dictSfxms;
 
+    @TableField(exist = false)
+    private Integer pageNum;
+
+    @TableField(exist = false)
+    private Integer pageSize;
+
 
 
 
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/DictSfxmMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/DictSfxmMapper.java
index 8d93d41..9a27b26 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/DictSfxmMapper.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/DictSfxmMapper.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ltkj.hosp.domain.DictSfxm;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
@@ -32,6 +33,10 @@
      */
     public List<DictSfxm> selectDictSfxmList(DictSfxm dictSfxm);
 
+    List<DictSfxm> selectDictSfxmListLimit(@Param("dictSfxm") DictSfxm dictSfxm, @Param("page") Integer page, @Param("size") Integer size);
+
+    Integer selectDictSfxmListCount(@Param("dictSfxm") DictSfxm dictSfxm);
+
     /**
      * 鏂板鏀惰垂椤圭洰
      *
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerMapper.java
index e8a7e94..9907aa3 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerMapper.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerMapper.java
@@ -104,4 +104,8 @@
     List<Map<String, Object>> vcustomerlist(@Param("name")String name, @Param("sjh")String sjh, @Param("sfzh") String sfzh);
 
     List<TjCustomer> getcusList(TjCustomer tjCustomer);
+
+    TjCustomer getCusInfo(@Param("card") String card);
+
+    List<TjCustomer> getCusInfoList(String card);
 }
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/IDictSfxmService.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/IDictSfxmService.java
index 1fce0f5..1c67942 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/IDictSfxmService.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/IDictSfxmService.java
@@ -28,6 +28,10 @@
      */
     public List<DictSfxm> selectDictSfxmList(DictSfxm dictSfxm);
 
+    List<DictSfxm> selectDictSfxmListLimit(DictSfxm dictSfxm, Integer page, Integer size);
+
+    Integer selectDictSfxmListCount(DictSfxm dictSfxm);
+
     /**
      * 鏂板鏀惰垂椤圭洰
      *
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/DictSfxmServiceImpl.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/DictSfxmServiceImpl.java
index fa072b4..b09c20f 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/DictSfxmServiceImpl.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/DictSfxmServiceImpl.java
@@ -43,6 +43,16 @@
         return dictSfxmMapper.selectDictSfxmList(dictSfxm);
     }
 
+    @Override
+    public List<DictSfxm> selectDictSfxmListLimit(DictSfxm dictSfxm,Integer page,Integer size) {
+        return dictSfxmMapper.selectDictSfxmListLimit(dictSfxm,page,size);
+    }
+
+    @Override
+    public Integer selectDictSfxmListCount(DictSfxm dictSfxm) {
+        return dictSfxmMapper.selectDictSfxmListCount(dictSfxm);
+    }
+
     /**
      * 鏂板鏀惰垂椤圭洰
      *
diff --git a/ltkj-hosp/src/main/resources/mapper/TjCustomerMapper.xml b/ltkj-hosp/src/main/resources/mapper/TjCustomerMapper.xml
index 36ae58d..7af046b 100644
--- a/ltkj-hosp/src/main/resources/mapper/TjCustomerMapper.xml
+++ b/ltkj-hosp/src/main/resources/mapper/TjCustomerMapper.xml
@@ -251,4 +251,61 @@
             and deleted =0
         </where>
     </select>
+    <select id="getCusInfo" resultType="com.ltkj.hosp.domain.TjCustomer">
+        SELECT
+            c.cus_name as name,
+            c.cus_idcard as card,
+            CASE c.cus_sex
+                WHEN 0 THEN '鐢�'
+                WHEN 1 THEN '濂�'
+                ELSE '鏈煡'
+                END AS sex,
+            c.cus_brithday as csrq,
+            o.tj_number as tjNum,
+            c.cus_phone as phone,
+            o.create_time as time,
+  TIMESTAMPDIFF(YEAR, c.cus_brithday, CURDATE()) -
+    CASE
+      WHEN MONTH(c.cus_brithday) > MONTH(CURDATE())
+        OR (MONTH(c.cus_brithday) = MONTH(CURDATE()) AND DAY(c.cus_brithday) > DAY(CURDATE()))
+      THEN 1
+      ELSE 0
+        END AS age
+FROM
+  tj_order o
+  JOIN tj_customer c ON o.user_id = c.cus_id
+WHERE
+  c.cus_idcard = #{card}
+ORDER BY
+  o.create_time DESC
+LIMIT 1
+    </select>
+    <select id="getCusInfoList" resultType="com.ltkj.hosp.domain.TjCustomer">
+        SELECT
+            c.cus_name as name,
+            c.cus_idcard as card,
+            CASE c.cus_sex
+                WHEN 0 THEN '鐢�'
+                WHEN 1 THEN '濂�'
+                ELSE '鏈煡'
+                END AS sex,
+            c.cus_brithday as csrq,
+            o.tj_number as tjNum,
+            c.cus_phone as phone,
+            o.create_time as time,
+  TIMESTAMPDIFF(YEAR, c.cus_brithday, CURDATE()) -
+    CASE
+      WHEN MONTH(c.cus_brithday) > MONTH(CURDATE())
+        OR (MONTH(c.cus_brithday) = MONTH(CURDATE()) AND DAY(c.cus_brithday) > DAY(CURDATE()))
+      THEN 1
+      ELSE 0
+        END AS age
+FROM
+  tj_order o
+  JOIN tj_customer c ON o.user_id = c.cus_id
+WHERE
+  c.cus_idcard = #{card}
+        ORDER BY
+        o.create_time DESC
+    </select>
 </mapper>
diff --git a/ltkj-hosp/src/main/resources/mapper/hosp/DictSfxmMapper.xml b/ltkj-hosp/src/main/resources/mapper/hosp/DictSfxmMapper.xml
index 3be2152..65a35a8 100644
--- a/ltkj-hosp/src/main/resources/mapper/hosp/DictSfxmMapper.xml
+++ b/ltkj-hosp/src/main/resources/mapper/hosp/DictSfxmMapper.xml
@@ -156,6 +156,210 @@
             <include refid="selectDictSfxmVo"/>
             where id = #{id}
     </select>
+    <select id="selectDictSfxmListLimit" resultType="com.ltkj.hosp.domain.DictSfxm">
+        <include refid="selectDictSfxmVo"/>
+        <where>
+            <if test="dictSfxm.yqid != null  and dictSfxm.yqid != ''">
+                and yqid = #{dictSfxm.yqid}
+            </if>
+            <if test="dictSfxm.xmid != null  and dictSfxm.xmid != ''">
+                and xmid = #{dictSfxm.xmid}
+            </if>
+            <if test="dictSfxm.xmbm != null  and dictSfxm.xmbm != ''">
+                and xmbm = #{dictSfxm.xmbm}
+            </if>
+            <if test="dictSfxm.xmmc != null  and dictSfxm.xmmc != ''">
+                and xmmc like CONCAT("%",#{dictSfxm.xmmc},"%")
+            </if>
+            <if test="dictSfxm.pym != null  and dictSfxm.pym != ''">
+                and pym like CONCAT("%",#{dictSfxm.pym},"%")
+            </if>
+            <if test="dictSfxm.wbm != null  and dictSfxm.wbm != ''">
+                and wbm like CONCAT("%",#{dictSfxm.wbm},"%")
+            </if>
+            <if test="dictSfxm.zjm != null  and dictSfxm.zjm != ''">
+                and zjm = #{zjm}
+            </if>
+            <if test="dictSfxm.dw != null  and dictSfxm.dw != ''">
+                and dw = #{dictSfxm.dw}
+            </if>
+            <if test="dictSfxm.ksxmfl != null  and dictSfxm.ksxmfl != ''">
+                and Ksxmfl = #{dictSfxm.ksxmfl}
+            </if>
+            <if test="dictSfxm.xxxmfl != null  and dictSfxm.xxxmfl != ''">
+                and xxxmfl = #{dictSfxm.xxxmfl}
+            </if>
+            <if test="dictSfxm.cwxmfl != null  and dictSfxm.cwxmfl != ''">
+                and cwxmfl = #{dictSfxm.cwxmfl}
+            </if>
+            <if test="dictSfxm.yjxmfl != null  and dictSfxm.yjxmfl != ''">
+                and yjxmfl = #{dictSfxm.yjxmfl}
+            </if>
+            <if test="dictSfxm.gkfl != null  and dictSfxm.gkfl != ''">
+                and gkfl = #{dictSfxm.gkfl}
+            </if>
+            <if test="dictSfxm.yzfl != null  and dictSfxm.yzfl != ''">
+                and yzfl = #{dictSfxm.yzfl}
+            </if>
+            <if test="dictSfxm.fpfl != null  and dictSfxm.fpfl != ''">
+                and fpfl = #{dictSfxm.fpfl}
+            </if>
+            <if test="dictSfxm.ckdj != null ">
+                and ckdj = #{dictSfxm.ckdj}
+            </if>
+            <if test="dictSfxm.sxh != null ">
+                and sxh = #{dictSfxm.sxh}
+            </if>
+            <if test="dictSfxm.sfsf != null ">
+                and sfsf = #{dictSfxm.sfsf}
+            </if>
+            <if test="dictSfxm.ybxmdj != null  and dictSfxm.ybxmdj != ''">
+                and ybxmdj = #{dictSfxm.ybxmdj}
+            </if>
+            <if test="dictSfxm.gjxmdm != null  and dictSfxm.gjxmdm != ''">
+                and gjxmdm = #{dictSfxm.gjxmdm}
+            </if>
+            <if test="dictSfxm.gjxmmc != null  and dictSfxm.gjxmmc != ''">
+                and gjxmmc = #{dictSfxm.gjxmmc}
+            </if>
+            <if test="dictSfxm.sjxmdm != null  and dictSfxm.sjxmdm != ''">
+                and sjxmdm = #{dictSfxm.sjxmdm}
+            </if>
+            <if test="dictSfxm.sjxmmc != null  and dictSfxm.sjxmmc != ''">
+                and sjxmmc = #{dictSfxm.sjxmmc}
+            </if>
+            <if test="dictSfxm.xmnr != null  and dictSfxm.xmnr != ''">
+                and xmnr = #{dictSfxm.xmnr}
+            </if>
+            <if test="dictSfxm.xmsm != null  and dictSfxm.xmsm != ''">
+                and xmsm = #{dictSfxm.xmsm}
+            </if>
+            <if test="dictSfxm.deleted != null ">
+                and deleted = #{dictSfxm.deleted}
+            </if>
+            <if test="dictSfxm.yjzgxj != null ">
+                and yjzgxj = #{dictSfxm.yjzgxj}
+            </if>
+            <if test="dictSfxm.ejzgxj != null ">
+                and ejzgxj = #{dictSfxm.ejzgxj}
+            </if>
+            <if test="dictSfxm.sjzgxj != null ">
+                and sjzgxj = #{dictSfxm.sjzgxj}
+            </if>
+            <if test="dictSfxm.xmnh != null  and dictSfxm.xmnh != ''">
+                and xmnh = #{dictSfxm.xmnh}
+            </if>
+            <if test="dictSfxm.xmfl != null  and dictSfxm.xmfl != ''">
+                and xmfl = #{dictSfxm.xmfl}
+            </if>
+            <if test="dictSfxm.tdzgxj != null ">
+                and tdzgxj = #{dictSfxm.tdzgxj}
+            </if>
+        </where>
+        LIMIT #{page},#{size}
+    </select>
+    <select id="selectDictSfxmListCount" resultType="java.lang.Integer">
+        select count(1)
+        from dict_sfxm
+        <where>
+            <if test="dictSfxm.yqid != null  and dictSfxm.yqid != ''">
+                and yqid = #{dictSfxm.yqid}
+            </if>
+            <if test="dictSfxm.xmid != null  and dictSfxm.xmid != ''">
+                and xmid = #{dictSfxm.xmid}
+            </if>
+            <if test="dictSfxm.xmbm != null  and dictSfxm.xmbm != ''">
+                and xmbm = #{dictSfxm.xmbm}
+            </if>
+            <if test="dictSfxm.xmmc != null  and dictSfxm.xmmc != ''">
+                and xmmc like CONCAT("%",#{dictSfxm.xmmc},"%")
+            </if>
+            <if test="dictSfxm.pym != null  and dictSfxm.pym != ''">
+                and pym like CONCAT("%",#{dictSfxm.pym},"%")
+            </if>
+            <if test="dictSfxm.wbm != null  and dictSfxm.wbm != ''">
+                and wbm like CONCAT("%",#{dictSfxm.wbm},"%")
+            </if>
+            <if test="dictSfxm.zjm != null  and dictSfxm.zjm != ''">
+                and zjm = #{zjm}
+            </if>
+            <if test="dictSfxm.dw != null  and dictSfxm.dw != ''">
+                and dw = #{dictSfxm.dw}
+            </if>
+            <if test="dictSfxm.ksxmfl != null  and dictSfxm.ksxmfl != ''">
+                and Ksxmfl = #{dictSfxm.ksxmfl}
+            </if>
+            <if test="dictSfxm.xxxmfl != null  and dictSfxm.xxxmfl != ''">
+                and xxxmfl = #{dictSfxm.xxxmfl}
+            </if>
+            <if test="dictSfxm.cwxmfl != null  and dictSfxm.cwxmfl != ''">
+                and cwxmfl = #{dictSfxm.cwxmfl}
+            </if>
+            <if test="dictSfxm.yjxmfl != null  and dictSfxm.yjxmfl != ''">
+                and yjxmfl = #{dictSfxm.yjxmfl}
+            </if>
+            <if test="dictSfxm.gkfl != null  and dictSfxm.gkfl != ''">
+                and gkfl = #{dictSfxm.gkfl}
+            </if>
+            <if test="dictSfxm.yzfl != null  and dictSfxm.yzfl != ''">
+                and yzfl = #{dictSfxm.yzfl}
+            </if>
+            <if test="dictSfxm.fpfl != null  and dictSfxm.fpfl != ''">
+                and fpfl = #{dictSfxm.fpfl}
+            </if>
+            <if test="dictSfxm.ckdj != null ">
+                and ckdj = #{dictSfxm.ckdj}
+            </if>
+            <if test="dictSfxm.sxh != null ">
+                and sxh = #{dictSfxm.sxh}
+            </if>
+            <if test="dictSfxm.sfsf != null ">
+                and sfsf = #{dictSfxm.sfsf}
+            </if>
+            <if test="dictSfxm.ybxmdj != null  and dictSfxm.ybxmdj != ''">
+                and ybxmdj = #{dictSfxm.ybxmdj}
+            </if>
+            <if test="dictSfxm.gjxmdm != null  and dictSfxm.gjxmdm != ''">
+                and gjxmdm = #{dictSfxm.gjxmdm}
+            </if>
+            <if test="dictSfxm.gjxmmc != null  and dictSfxm.gjxmmc != ''">
+                and gjxmmc = #{dictSfxm.gjxmmc}
+            </if>
+            <if test="dictSfxm.sjxmdm != null  and dictSfxm.sjxmdm != ''">
+                and sjxmdm = #{dictSfxm.sjxmdm}
+            </if>
+            <if test="dictSfxm.sjxmmc != null  and dictSfxm.sjxmmc != ''">
+                and sjxmmc = #{dictSfxm.sjxmmc}
+            </if>
+            <if test="dictSfxm.xmnr != null  and dictSfxm.xmnr != ''">
+                and xmnr = #{dictSfxm.xmnr}
+            </if>
+            <if test="dictSfxm.xmsm != null  and dictSfxm.xmsm != ''">
+                and xmsm = #{dictSfxm.xmsm}
+            </if>
+            <if test="dictSfxm.deleted != null ">
+                and deleted = #{dictSfxm.deleted}
+            </if>
+            <if test="dictSfxm.yjzgxj != null ">
+                and yjzgxj = #{dictSfxm.yjzgxj}
+            </if>
+            <if test="dictSfxm.ejzgxj != null ">
+                and ejzgxj = #{dictSfxm.ejzgxj}
+            </if>
+            <if test="dictSfxm.sjzgxj != null ">
+                and sjzgxj = #{dictSfxm.sjzgxj}
+            </if>
+            <if test="dictSfxm.xmnh != null  and dictSfxm.xmnh != ''">
+                and xmnh = #{dictSfxm.xmnh}
+            </if>
+            <if test="dictSfxm.xmfl != null  and dictSfxm.xmfl != ''">
+                and xmfl = #{dictSfxm.xmfl}
+            </if>
+            <if test="dictSfxm.tdzgxj != null ">
+                and tdzgxj = #{dictSfxm.tdzgxj}
+            </if>
+        </where>
+    </select>
 
     <insert id="insertDictSfxm" parameterType="DictSfxm" useGeneratedKeys="true"
             keyProperty="id">

--
Gitblit v1.8.0