From 7eb4c98f4d96bebf28685d801e7b978d6c3d251e Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 24 七月 2025 22:23:40 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/resources/mapper/smartor/HNGatherPatArchiveMapper.xml |  123 ++++++++++++++++++++++++++--------------
 1 files changed, 79 insertions(+), 44 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/HNGatherPatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/HNGatherPatArchiveMapper.xml
index 5592a9f..ac28143 100644
--- a/smartor/src/main/resources/mapper/smartor/HNGatherPatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/HNGatherPatArchiveMapper.xml
@@ -4,6 +4,28 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.smartor.mapper.HNGatherPatArchiveMapper">
 
+
+    <resultMap type="com.ruoyi.common.core.domain.entity.SysUserDept" id="SysUserDeptResult">
+        <result property="id" column="id"/>
+        <result property="orgid" column="orgid"/>
+        <result property="userId" column="user_id"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="deptCode" column="dept_code"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="deptType" column="dept_type"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+
+    <resultMap type="com.ruoyi.common.core.domain.entity.SysUserRole" id="SysUserRoleResult">
+        <result property="userId" column="user_id"/>
+        <result property="roleId" column="role_id"/>
+        <result property="orgid" column="orgid"/>
+    </resultMap>
+
+
     <resultMap type="com.smartor.domain.PatArchive" id="PatArchiveResult">
         <result property="id" column="id"/>
         <result property="patientno" column="patientno"/>
@@ -307,22 +329,16 @@
     </resultMap>
 
     <sql id="selectPatArchiveVo">
-        select id,
-               notrequired_flag,
+        select notrequired_flag,
                notrequiredreason,
                patientno,
-               filter_drname,
-               filter_drcode,
                patid_his,
-               age_unit,
-               age_unit2,
                sd_flag,
                name,
                sex,
                idcardno,
                birthdate,
                age,
-               age2,
                nation,
                native_place,
                place_of_residence,
@@ -335,15 +351,7 @@
                idcardtype,
                orgid,
                openid,
-               del_flag,
-               update_by,
-               update_time,
-               create_by,
-               create_time,
-               isupload,
-               pattype,
                viptype,
-               upload_time,
                care_facilities,
                case_path,
                degree_of_education,
@@ -351,10 +359,29 @@
                income,
                medicare_type,
                care_person,
-               guid,
                case_person_age
         from hzjbxx
     </sql>
+
+
+    <select id="yhyjsxx" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserRoleResult">
+        select user_id, role_id, orgid
+        FROM yhyjsxx
+        <where>
+            <if test="hisUserId != null ">and user_id = #{hisUserId}</if>
+        </where>
+    </select>
+
+    <select id="yhyksxx" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserDeptResult">
+        select user_id, user_code, dept_type,department_id as
+        dept_id,dept_name,deptparent,del_flag,orgid,create_time,create_by,update_time,update_by
+        FROM yhyksxx
+        <where>
+            user_id != 'admin'
+            <if test="hisUserId != null ">and user_id = #{hisUserId}</if>
+        </where>
+    </select>
+
 
     <select id="selectPatArchiveList" parameterType="com.smartor.domain.PatArchive" resultMap="PatArchiveResult">
         <include refid="selectPatArchiveVo"/>
@@ -369,7 +396,7 @@
             <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
             <if test="viptype != null ">and viptype = #{viptype}</if>
             <if test="pattype != null ">and pattype = #{pattype}</if>
-            <if test="patientno != null ">and patientno = #{patientno}</if>
+            <if test="patientno != null ">and patientno = CAST(#{patientno} AS INTEGER)</if>
             <if test="patidHis != null ">and patid_his = #{patidHis}</if>
             <if test="sdFlag != null ">and sd_flag = #{sdFlag}</if>
             <if test="ageUnit != null ">and age_unit = #{ageUnit}</if>
@@ -389,7 +416,6 @@
             <if test="filterDrname != null ">and filter_drname = #{filterDrname}</if>
             <if test="filterDrcode != null ">and filter_drcode = #{filterDrcode}</if>
         </where>
-        limit #{ps} OFFSET #{pn}
     </select>
 
 
@@ -397,6 +423,26 @@
         select count(*)
         FROM cryxx
     </select>
+
+    <select id="selectPatArchiveListByLastId" resultMap="PatArchiveResult">
+        SELECT *
+        FROM (
+                 SELECT *,
+                        ROW_NUMBER() OVER (ORDER BY patid_his) as row_num
+                 FROM hzjbxx
+             ) a
+        WHERE row_num > #{lastRowNumber} LIMIT #{ps}
+    </select>
+
+    <select id="selectPatMedInhospListByLastId" resultMap="PatMedInhospResult">
+        SELECT *
+        FROM (SELECT *,
+                     ROW_NUMBER() OVER (ORDER BY patno) as row_num
+              FROM cryxx
+             ) a
+        WHERE row_num > #{lastRowNumber} LIMIT #{ps}
+    </select>
+
     <select id="selectPatArchiveCount" parameterType="com.smartor.domain.PatMedInhosp" resultType="Long">
         select count(*)
         FROM hzjbxx
@@ -449,17 +495,18 @@
         FROM
         cryxx b
         <where>
-            <if test="startOutHospTime != null ">and date_format(b.endtime,'%y%m%d') &gt;=
-                date_format(#{startOutHospTime},'%y%m%d')
+
+            <if test="startOutHospTime != null ">and to_char(b.endtime,'YYMMDD') &gt;=
+                to_char(#{startOutHospTime}::date,'YYMMDD')
             </if>
-            <if test="endOutHospTime != null ">and date_format(b.endtime,'%y%m%d') &lt;=
-                date_format(#{endOutHospTime},'%y%m%d')
+            <if test="endOutHospTime != null ">and to_char(b.endtime,'YYMMDD') &lt;=
+                to_char(#{endOutHospTime}::date,'YYMMDD')
             </if>
-            <if test="startInHospTime != null ">and date_format(b.starttime,'%y%m%d') &gt;=
-                date_format(#{startInHospTime},'%y%m%d')
+            <if test="startInHospTime != null ">and to_char(b.starttime,'YYMMDD') &gt;=
+                to_char(#{startInHospTime}::date,'%y%m%d')
             </if>
-            <if test="endInHospTime != null ">and date_format(b.starttime,'%y%m%d') &lt;=
-                date_format(#{endInHospTime},'%y%m%d')
+            <if test="endInHospTime != null ">and to_char(b.starttime,'YYMMDD') &lt;=
+                to_char(#{endInHospTime}::date,'YYMMDD')
             </if>
             <if test="inhospno != null ">and b.inhospno = #{inhospno}</if>
             <if test="fuflag != null ">and b.fuflag = #{fuflag}</if>
@@ -472,7 +519,6 @@
             <if test="outWayName != null ">and b.out_way_name = #{outWayName}</if>
             <if test="orgid != null ">and b.orgid = #{orgid}</if>
         </where>
-        limit #{ps} OFFSET #{pn}
     </select>
 
 
@@ -507,19 +553,14 @@
         mainsuit
         from mzxx
         <where>
-            <if test="deptname != null  and deptname != ''">and deptname like concat('%', #{deptname}, '%')</if>
-            <if test="drname != null  and drname != ''">and drname like concat('%', #{drname}, '%')</if>
-            <if test="patname != null  and patname != ''">and patname like concat('%', #{patname}, '%')</if>
-            <if test="beginTime != null ">and date_format( admitdate,'%y%m%d') &gt;=
-                date_format(#{beginTime},'%y%m%d')
+
+            <if test="beginTime != null ">and to_char( admitdate,'YYMMDD') &gt;=
+                to_char(#{beginTime}::date,'YYMMDD')
             </if>
-            <if test="endTime != null ">and date_format( admitdate,'%y%m%d') &lt;=
-                date_format(#{endTime},'%y%m%d')
+            <if test="endTime != null ">and to_char( admitdate,'YYMMDD') &lt;=
+                to_char(#{endTime}::date,'YYMMDD')
             </if>
-            <if test="patid != null ">and patid = #{patid}</if>
-            <if test="patno != null ">and patno = #{patno}</if>
-            <if test="outhospno != null  and outhospno != ''">and outhospno = #{outhospno}</if>
-            <if test="diagcheckFlag != null  and diagcheckFlag != ''">and diagcheck_flag = #{diagcheckFlag}</if>
+
         </where>
     </select>
 
@@ -585,12 +626,6 @@
             </if>
             <if test="phonenumber != null and phonenumber != ''">
                 AND u.phonenumber like concat('%', #{phonenumber}, '%')
-            </if>
-            <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
-                AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
-            </if>
-            <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
-                AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
             </if>
         </where>
     </select>

--
Gitblit v1.9.3