From 441eb455e1e8a9283cd569c132b14ba8da4c54a6 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期六, 11 十月 2025 17:49:47 +0800
Subject: [PATCH] 导出,短信,模板消息

---
 ruoyi-system/src/main/resources/mapper/system/TSysAppUserMapper.xml |   70 +++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/TSysAppUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TSysAppUserMapper.xml
index 5c3c9f3..4628b35 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TSysAppUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TSysAppUserMapper.xml
@@ -59,6 +59,7 @@
                tsau.chronic_disease_id,tsau.status,tsau.last_reminder_time, tsau.create_time, tsau.update_time, tsau.create_by,
                tsau.update_by, tsau.disabled
         from t_sys_app_user tsau
+        left join (select id,app_user_id, max(check_time) as lastInspectionTime from t_sys_inspection limit 1) tsi on tsi.app_user_id = tsau.id
         <where>
             <if test="query.phone != null and query.phone != ''">
                 and tsau.phone = #{query.phone}
@@ -74,5 +75,74 @@
         </where>
         ORDER BY tsau.create_time DESC
     </select>
+    <select id="exportList" resultType="com.ruoyi.system.export.TSysAppUserListExport">
+        select tsau.id, tsau.nick_name, tsau.phone, tsau.birth_time, tsau.sex, tsau.open_id,tsau.office_open_id,
+        tsau.chronic_disease_id,tsau.status,tsau.last_reminder_time, tsau.create_time, tsau.update_time, tsau.create_by,
+        tsau.update_by, tsau.disabled
+        from t_sys_app_user tsau
+        <where>
+            <if test="query.phone != null and query.phone != ''">
+                and tsau.phone = #{query.phone}
+            </if>
+            <if test="query.nickName != null and query.nickName != ''">
+                and tsau.nick_name like concat('%',#{query.nickName},'%')
+            </if>
+            <if test="query.inspectionId != null and query.inspectionId != ''">
+                and FIND_IN_SET(#{query.inspectionId},tsau.chronic_disease_id)
+            </if>
+            AND tsau.chronic_disease_id IS NOT NULL
+            AND tsau.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        </where>
+        ORDER BY tsau.create_time DESC
+    </select>
+    <select id="exportListClinic" resultType="com.ruoyi.system.export.TSysAppUserClinicExport">
+        select tsau.id, tsau.nick_name, tsau.phone, tsau.birth_time, tsau.sex, tsau.open_id,tsau.office_open_id,
+        tsau.chronic_disease_id,tsau.status,tsau.last_reminder_time, tsau.create_time, tsau.update_time, tsau.create_by,
+        tsau.update_by, tsau.disabled
+        from t_sys_app_user tsau
+        <where>
+            <if test="query.phone != null and query.phone != ''">
+                and tsau.phone = #{query.phone}
+            </if>
+            <if test="query.nickName != null and query.nickName != ''">
+                and tsau.nick_name like concat('%',#{query.nickName},'%')
+            </if>
+            <if test="query.inspectionId != null and query.inspectionId != ''">
+                and FIND_IN_SET(#{query.inspectionId},tsau.chronic_disease_id)
+            </if>
+            AND tsau.chronic_disease_id IS NOT NULL
+            AND tsau.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        </where>
+        ORDER BY tsau.create_time DESC
+    </select>
+    <select id="exportListAppUser" resultType="com.ruoyi.system.export.TSysAppUserExport">
+        select tsau.id, tsau.nick_name, tsau.phone, tsau.birth_time, tsau.sex, tsau.open_id,tsau.office_open_id,
+        tsau.chronic_disease_id,tsau.status,tsau.last_reminder_time, tsau.create_time, tsau.update_time, tsau.create_by,
+        tsau.update_by, tsau.disabled, tsi.lastInspectionTime
+        from t_sys_app_user tsau
+        left join (select id,app_user_id, max(check_time) as lastInspectionTime from t_sys_inspection limit 1) tsi on tsi.app_user_id = tsau.id
+        <where>
+            <if test="query.phone != null and query.phone != ''">
+                and tsau.phone = #{query.phone}
+            </if>
+            <if test="query.nickName != null and query.nickName != ''">
+                and tsau.nick_name like concat('%',#{query.nickName},'%')
+            </if>
+            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
+                and tsau.id in (select app_user_id from t_sys_inspection where check_time between #{query.startTime} and #{query.endTime})
+            </if>
+            <if test="query.isInspection != null and query.isInspection == 1">
+                and tsau.chronic_disease_id IS NOT NULL
+            </if>
+            <if test="query.isInspection != null and query.isInspection == 0">
+                and tsau.chronic_disease_id IS NULL
+            </if>
+            <if test="query.status != null">
+                and tsau.status = #{query.status}
+            </if>
+            AND tsau.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        </where>
+        ORDER BY tsau.create_time DESC
+    </select>
 
 </mapper>

--
Gitblit v1.7.1