liusheng
2024-11-29 8d913e5594f45ca2a4ce656ea9feb99ffe715913
smartor/src/main/resources/mapper/smartor/PatArchiveImportMapper.xml
@@ -5,26 +5,45 @@
<mapper namespace="com.smartor.mapper.PatArchiveImportMapper">
    <resultMap type="com.smartor.domain.PatArchiveImport" id="PatArchiveImportResult">
            <result property="id" column="id"/>
            <result property="patientno" column="patientno"/>
            <result property="pattype" column="pattype"/>
            <result property="name" column="name"/>
            <result property="sex" column="sex"/>
            <result property="idcardno" column="idcardno"/>
            <result property="age" column="age"/>
            <result property="telcode" column="telcode"/>
            <result property="openid" column="openid"/>
            <result property="delFlag" column="del_flag"/>
            <result property="updateBy" column="update_by"/>
            <result property="updateTime" column="update_time"/>
            <result property="createBy" column="create_by"/>
            <result property="createTime" column="create_time"/>
            <result property="batchName" column="batch_name"/>
            <result property="batchNo" column="batch_no"/>
        <result property="id" column="id"/>
        <result property="patientno" column="patientno"/>
        <result property="pattype" column="pattype"/>
        <result property="name" column="name"/>
        <result property="sex" column="sex"/>
        <result property="idcardno" column="idcardno"/>
        <result property="age" column="age"/>
        <result property="telcode" column="telcode"/>
        <result property="openid" column="openid"/>
        <result property="delFlag" column="del_flag"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="batchName" column="batch_name"/>
        <result property="batchNo" column="batch_no"/>
    </resultMap>
    <resultMap type="com.ruoyi.common.core.domain.entity.SysUser" id="SysUserResult">
        <id property="userId" column="user_id"/>
        <result property="userName" column="user_name"/>
    </resultMap>
    <sql id="selectPatArchiveImportVo">
        select id, patientno, pattype, name, sex, idcardno, age, telcode, openid, del_flag, update_by, update_time, create_by, create_time, batch_name, batch_no
        select id,
               patientno,
               pattype,
               name,
               sex,
               idcardno,
               age,
               telcode,
               openid,
               del_flag,
               update_by,
               update_time,
               create_by,
               create_time,
               batch_name,
               batch_no
        from pat_archive_import
    </sql>
@@ -32,175 +51,178 @@
            resultMap="PatArchiveImportResult">
        <include refid="selectPatArchiveImportVo"/>
        <where>
                        <if test="patientno != null  and patientno != ''">
                            and patientno = #{patientno}
                        </if>
                        <if test="pattype != null  and pattype != ''">
                            and pattype = #{pattype}
                        </if>
                        <if test="name != null  and name != ''">
                            and name like concat('%', #{name}, '%')
                        </if>
                        <if test="sex != null ">
                            and sex = #{sex}
                        </if>
                        <if test="idcardno != null  and idcardno != ''">
                            and idcardno = #{idcardno}
                        </if>
                        <if test="age != null ">
                            and age = #{age}
                        </if>
                        <if test="telcode != null  and telcode != ''">
                            and telcode = #{telcode}
                        </if>
                        <if test="openid != null  and openid != ''">
                            and openid = #{openid}
                        </if>
                        <if test="batchName != null  and batchName != ''">
                            and batch_name like concat('%', #{batchName}, '%')
                        </if>
                        <if test="batchNo != null  and batchNo != ''">
                            and batch_no = #{batchNo}
                        </if>
            del_flag=0
            <if test="patientno != null  and patientno != ''">
                and patientno = #{patientno}
            </if>
            <if test="pattype != null  and pattype != ''">
                and pattype = #{pattype}
            </if>
            <if test="name != null  and name != ''">
                and name like concat('%', #{name}, '%')
            </if>
            <if test="sex != null ">
                and sex = #{sex}
            </if>
            <if test="idcardno != null  and idcardno != ''">
                and idcardno = #{idcardno}
            </if>
            <if test="age != null ">
                and age = #{age}
            </if>
            <if test="telcode != null  and telcode != ''">
                and telcode = #{telcode}
            </if>
            <if test="openid != null  and openid != ''">
                and openid = #{openid}
            </if>
            <if test="batchName != null  and batchName != ''">
                and batch_name like concat('%', #{batchName}, '%')
            </if>
            <if test="batchNo != null  and batchNo != ''">
                and batch_no = #{batchNo}
            </if>
        </where>
        ORDER BY create_time desc
    </select>
    <select id="selectPatArchiveImportById" parameterType="Long"
            resultMap="PatArchiveImportResult">
            <include refid="selectPatArchiveImportVo"/>
            where id = #{id}
        <include refid="selectPatArchiveImportVo"/>
        where id = #{id}
    </select>
    <insert id="insertPatArchiveImport" parameterType="com.smartor.domain.PatArchiveImport"            useGeneratedKeys="true" keyProperty="id">
    <insert id="insertPatArchiveImport" parameterType="com.smartor.domain.PatArchiveImport" useGeneratedKeys="true"
            keyProperty="id">
        insert into pat_archive_import
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="patientno != null">patientno,
                    </if>
                    <if test="pattype != null">pattype,
                    </if>
                    <if test="name != null">name,
                    </if>
                    <if test="sex != null">sex,
                    </if>
                    <if test="idcardno != null">idcardno,
                    </if>
                    <if test="age != null">age,
                    </if>
                    <if test="telcode != null">telcode,
                    </if>
                    <if test="openid != null">openid,
                    </if>
                    <if test="delFlag != null">del_flag,
                    </if>
                    <if test="updateBy != null">update_by,
                    </if>
                    <if test="updateTime != null">update_time,
                    </if>
                    <if test="createBy != null">create_by,
                    </if>
                    <if test="createTime != null">create_time,
                    </if>
                    <if test="batchName != null">batch_name,
                    </if>
                    <if test="batchNo != null">batch_no,
                    </if>
            <if test="patientno != null">patientno,
            </if>
            <if test="pattype != null">pattype,
            </if>
            <if test="name != null">name,
            </if>
            <if test="sex != null">sex,
            </if>
            <if test="idcardno != null">idcardno,
            </if>
            <if test="age != null">age,
            </if>
            <if test="telcode != null">telcode,
            </if>
            <if test="openid != null">openid,
            </if>
            <if test="delFlag != null">del_flag,
            </if>
            <if test="updateBy != null">update_by,
            </if>
            <if test="updateTime != null">update_time,
            </if>
            <if test="createBy != null">create_by,
            </if>
            <if test="createTime != null">create_time,
            </if>
            <if test="batchName != null">batch_name,
            </if>
            <if test="batchNo != null">batch_no,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                    <if test="patientno != null">#{patientno},
                    </if>
                    <if test="pattype != null">#{pattype},
                    </if>
                    <if test="name != null">#{name},
                    </if>
                    <if test="sex != null">#{sex},
                    </if>
                    <if test="idcardno != null">#{idcardno},
                    </if>
                    <if test="age != null">#{age},
                    </if>
                    <if test="telcode != null">#{telcode},
                    </if>
                    <if test="openid != null">#{openid},
                    </if>
                    <if test="delFlag != null">#{delFlag},
                    </if>
                    <if test="updateBy != null">#{updateBy},
                    </if>
                    <if test="updateTime != null">#{updateTime},
                    </if>
                    <if test="createBy != null">#{createBy},
                    </if>
                    <if test="createTime != null">#{createTime},
                    </if>
                    <if test="batchName != null">#{batchName},
                    </if>
                    <if test="batchNo != null">#{batchNo},
                    </if>
            <if test="patientno != null">#{patientno},
            </if>
            <if test="pattype != null">#{pattype},
            </if>
            <if test="name != null">#{name},
            </if>
            <if test="sex != null">#{sex},
            </if>
            <if test="idcardno != null">#{idcardno},
            </if>
            <if test="age != null">#{age},
            </if>
            <if test="telcode != null">#{telcode},
            </if>
            <if test="openid != null">#{openid},
            </if>
            <if test="delFlag != null">#{delFlag},
            </if>
            <if test="updateBy != null">#{updateBy},
            </if>
            <if test="updateTime != null">#{updateTime},
            </if>
            <if test="createBy != null">#{createBy},
            </if>
            <if test="createTime != null">#{createTime},
            </if>
            <if test="batchName != null">#{batchName},
            </if>
            <if test="batchNo != null">#{batchNo},
            </if>
        </trim>
    </insert>
    <update id="updatePatArchiveImport" parameterType="com.smartor.domain.PatArchiveImport">
        update pat_archive_import
        <trim prefix="SET" suffixOverrides=",">
                    <if test="patientno != null">patientno =
                        #{patientno},
                    </if>
                    <if test="pattype != null">pattype =
                        #{pattype},
                    </if>
                    <if test="name != null">name =
                        #{name},
                    </if>
                    <if test="sex != null">sex =
                        #{sex},
                    </if>
                    <if test="idcardno != null">idcardno =
                        #{idcardno},
                    </if>
                    <if test="age != null">age =
                        #{age},
                    </if>
                    <if test="telcode != null">telcode =
                        #{telcode},
                    </if>
                    <if test="openid != null">openid =
                        #{openid},
                    </if>
                    <if test="delFlag != null">del_flag =
                        #{delFlag},
                    </if>
                    <if test="updateBy != null">update_by =
                        #{updateBy},
                    </if>
                    <if test="updateTime != null">update_time =
                        #{updateTime},
                    </if>
                    <if test="createBy != null">create_by =
                        #{createBy},
                    </if>
                    <if test="createTime != null">create_time =
                        #{createTime},
                    </if>
                    <if test="batchName != null">batch_name =
                        #{batchName},
                    </if>
                    <if test="batchNo != null">batch_no =
                        #{batchNo},
                    </if>
            <if test="patientno != null">patientno =
                #{patientno},
            </if>
            <if test="pattype != null">pattype =
                #{pattype},
            </if>
            <if test="name != null">name =
                #{name},
            </if>
            <if test="sex != null">sex =
                #{sex},
            </if>
            <if test="idcardno != null">idcardno =
                #{idcardno},
            </if>
            <if test="age != null">age =
                #{age},
            </if>
            <if test="telcode != null">telcode =
                #{telcode},
            </if>
            <if test="openid != null">openid =
                #{openid},
            </if>
            <if test="delFlag != null">del_flag =
                #{delFlag},
            </if>
            <if test="updateBy != null">update_by =
                #{updateBy},
            </if>
            <if test="updateTime != null">update_time =
                #{updateTime},
            </if>
            <if test="createBy != null">create_by =
                #{createBy},
            </if>
            <if test="createTime != null">create_time =
                #{createTime},
            </if>
            <if test="batchName != null">batch_name =
                #{batchName},
            </if>
            <if test="batchNo != null">batch_no =
                #{batchNo},
            </if>
        </trim>
        where id = #{id}
    </update>
                <update id="deletePatArchiveImportById" parameterType="Long">
    <update id="deletePatArchiveImportById" parameterType="Long">
        update pat_archive_import
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where  id = #{id}
        where id = #{id}
    </update>
                            <update id="deletePatArchiveImportByIds" parameterType="String">
        update  pat_archive_import
    <update id="deletePatArchiveImportByIds" parameterType="String">
        update pat_archive_import
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
@@ -210,7 +232,64 @@
        </foreach>
    </update>
    <select id="checkUserExist" parameterType="String" resultMap="SysUserResult">
        select user_id, user_name
        from sys_user
        where id_card = #{idCard}
          and del_flag = '0'
    </select>
    <insert id="insertUser" parameterType="com.ruoyi.common.core.domain.entity.SysUser" useGeneratedKeys="true"
            keyProperty="userId">
        insert into sys_user(
        <if test="userId != null and userId != 0">user_id,</if>
        <if test="deptId != null and deptId != 0">dept_id,</if>
        <if test="userName != null and userName != ''">user_name,</if>
        <if test="nickName != null and nickName != ''">nick_name,</if>
        <if test="email != null and email != ''">email,</if>
        <if test="avatar != null and avatar != ''">avatar,</if>
        <if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
        <if test="sex != null and sex != ''">sex,</if>
        <if test="password != null and password != ''">password,</if>
        <if test="status != null and status != ''">status,</if>
        <if test="createBy != null and createBy != ''">create_by,</if>
        <if test="remark != null and remark != ''">remark,</if>
        <if test="userType != null and userType != ''">user_type,</if>
        <if test="deptInfo != null and deptInfo != ''">dept_info,</if>
        <if test="hospInfo != null and hospInfo != ''">hosp_info,</if>
        <if test="searchscope != null and searchscope != ''">searchscope,</if>
        <if test="idCard != null and idCard != ''">id_card,</if>
        create_time
        )values(
        <if test="userId != null and userId != ''">#{userId},</if>
        <if test="deptId != null and deptId != ''">#{deptId},</if>
        <if test="userName != null and userName != ''">#{userName},</if>
        <if test="nickName != null and nickName != ''">#{nickName},</if>
        <if test="email != null and email != ''">#{email},</if>
        <if test="avatar != null and avatar != ''">#{avatar},</if>
        <if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
        <if test="sex != null and sex != ''">#{sex},</if>
        <if test="password != null and password != ''">#{password},</if>
        <if test="status != null and status != ''">#{status},</if>
        <if test="createBy != null and createBy != ''">#{createBy},</if>
        <if test="remark != null and remark != ''">#{remark},</if>
        <if test="userType != null and userType != ''">#{userType},</if>
        <if test="deptInfo != null and deptInfo != ''">#{deptInfo},</if>
        <if test="hospInfo != null and hospInfo != ''">#{hospInfo},</if>
        <if test="searchscope != null and searchscope != ''">#{searchscope},</if>
        <if test="idCard != null and idCard != ''">#{idCard},</if>
        sysdate()
        )
    </insert>
    <insert id="insertUserRole" parameterType="com.ruoyi.common.core.domain.entity.SysUserRole">
        insert into sys_user_role(
        <if test="roleId != null ">role_id,</if>
        <if test="userId != null ">user_id</if>
        )values(
        <if test="roleId != null ">#{roleId},</if>
        <if test="userId != null">#{userId}</if>
        )
    </insert>
</mapper>