|  |  | 
 |  |  |         "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"/> | 
 |  |  | 
 |  |  |     </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, | 
 |  |  | 
 |  |  |                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, | 
 |  |  | 
 |  |  |                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"/> | 
 |  |  | 
 |  |  |             <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> | 
 |  |  | 
 |  |  |             <if test="filterDrname != null ">and filter_drname = #{filterDrname}</if> | 
 |  |  |             <if test="filterDrcode != null ">and filter_drcode = #{filterDrcode}</if> | 
 |  |  |         </where> | 
 |  |  |         limit #{ps} OFFSET #{pn} | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |         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 | 
 |  |  | 
 |  |  |         FROM | 
 |  |  |         cryxx b | 
 |  |  |         <where> | 
 |  |  |             <if test="startOutHospTime != null ">and date_format(b.endtime,'%y%m%d') >= | 
 |  |  |                 date_format(#{startOutHospTime},'%y%m%d') | 
 |  |  |  | 
 |  |  |             <if test="startOutHospTime != null ">and to_char(b.endtime,'YYMMDD') >= | 
 |  |  |                 to_char(#{startOutHospTime}::date,'YYMMDD') | 
 |  |  |             </if> | 
 |  |  |             <if test="endOutHospTime != null ">and date_format(b.endtime,'%y%m%d') <= | 
 |  |  |                 date_format(#{endOutHospTime},'%y%m%d') | 
 |  |  |             <if test="endOutHospTime != null ">and to_char(b.endtime,'YYMMDD') <= | 
 |  |  |                 to_char(#{endOutHospTime}::date,'YYMMDD') | 
 |  |  |             </if> | 
 |  |  |             <if test="startInHospTime != null ">and date_format(b.starttime,'%y%m%d') >= | 
 |  |  |                 date_format(#{startInHospTime},'%y%m%d') | 
 |  |  |             <if test="startInHospTime != null ">and to_char(b.starttime,'YYMMDD') >= | 
 |  |  |                 to_char(#{startInHospTime}::date,'%y%m%d') | 
 |  |  |             </if> | 
 |  |  |             <if test="endInHospTime != null ">and date_format(b.starttime,'%y%m%d') <= | 
 |  |  |                 date_format(#{endInHospTime},'%y%m%d') | 
 |  |  |             <if test="endInHospTime != null ">and to_char(b.starttime,'YYMMDD') <= | 
 |  |  |                 to_char(#{endInHospTime}::date,'YYMMDD') | 
 |  |  |             </if> | 
 |  |  |             <if test="inhospno != null ">and b.inhospno = #{inhospno}</if> | 
 |  |  |             <if test="fuflag != null ">and b.fuflag = #{fuflag}</if> | 
 |  |  | 
 |  |  |             <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> | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |         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') >= | 
 |  |  |                 date_format(#{beginTime},'%y%m%d') | 
 |  |  |  | 
 |  |  |             <if test="beginTime != null ">and to_char( admitdate,'YYMMDD') >= | 
 |  |  |                 to_char(#{beginTime}::date,'YYMMDD') | 
 |  |  |             </if> | 
 |  |  |             <if test="endTime != null ">and date_format( admitdate,'%y%m%d') <= | 
 |  |  |                 date_format(#{endTime},'%y%m%d') | 
 |  |  |             <if test="endTime != null ">and to_char( admitdate,'YYMMDD') <= | 
 |  |  |                 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> | 
 |  |  |  | 
 |  |  | 
 |  |  |             <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') >= 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') <= date_format(#{params.endTime},'%y%m%d') | 
 |  |  |             </if> | 
 |  |  |         </where> | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  | 
 |  |  |                d.create_time, | 
 |  |  |                d.his_dept_id, | 
 |  |  |                d.his_parent_id | 
 |  |  |         FROM bmxx d | 
 |  |  |         FROM HEALTHY_DEPT d | 
 |  |  |  | 
 |  |  |     </select> | 
 |  |  | </mapper> |