liusheng
2023-06-15 77d7257c02fc811a53b8d9207e4239f69c8a600c
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.smartor.mapper.PatArchiveMapper">
    
    <resultMap type="PatArchive" id="PatArchiveResult">
    <resultMap type="com.smartor.domain.PatArchive" id="PatArchiveResult">
        <result property="patid"    column="patid"    />
        <result property="name"    column="name"    />
        <result property="sex"    column="sex"    />
@@ -26,13 +26,35 @@
        <result property="createTime"    column="create_time"    />
        <result property="isupload"    column="isupload"    />
        <result property="uploadTime"    column="upload_time"    />
        <result property="tag" column="tag"/>
    </resultMap>
    <sql id="selectPatArchiveVo">
        select patid, name, sex, iccardno, birthdate, age, source, archivetime, archiveby, telcode, relativetelcode, iccardtype, orgid, openid, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time from pat_archive
        select patid,
               name,
               sex,
               iccardno,
               birthdate,
               age,
               source,
               archivetime,
               archiveby,
               telcode,
               relativetelcode,
               iccardtype,
               orgid,
               openid,
               del_flag,
               update_by,
               update_time,
               create_by,
               create_time,
               isupload,
               upload_time
        from pat_archive
    </sql>
    <select id="selectPatArchiveList" parameterType="PatArchive" resultMap="PatArchiveResult">
    <select id="selectPatArchiveList" parameterType="com.smartor.domain.PatArchive" resultMap="PatArchiveResult">
        <include refid="selectPatArchiveVo"/>
        <where>  
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
@@ -40,8 +62,33 @@
            <if test="source != null "> and source = #{source}</if>
            <if test="telcode != null  and telcode != ''"> and telcode = #{telcode}</if>
            <if test="orgid != null  and orgid != ''"> and orgid = #{orgid}</if>
            <if test="patid != null  and patid != ''">and patid = #{patid}</if>
            <if test="isupload != null "> and isupload = #{isupload}</if>
            <if test="uploadTime != null "> and upload_time = #{uploadTime}</if>
        </where>
    </select>
    <select id="patInfoByContion" parameterType="com.smartor.domain.PatArchiveReq" resultMap="PatArchiveResult">
        select
        a.patid,
        a.name,
        a.sex,
        c.tagname as tag,
        a.iccardtype,
        a.iccardno,
        a.age,
        a.telcode,
        a.create_time,
        a.update_time,
        a.birthdate
        from pat_archive a,pat_archivetag b ,base_tag c
        <where>
            a.patid = b.patid and b.tagid = c.tagid
            <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
            <if test="iccardno != null  and iccardno != ''">and iccardno = #{iccardno}</if>
            <if test="telcode != null  and telcode != ''">and telcode = #{telcode}</if>
            <if test="tagId != null  and tagId != ''">and c.tagid = #{tagId}</if>
        </where>
    </select>
    
@@ -50,7 +97,7 @@
        where patid = #{patid}
    </select>
        
    <insert id="insertPatArchive" parameterType="PatArchive" useGeneratedKeys="true" keyProperty="patid">
    <insert id="insertPatArchive" parameterType="com.smartor.domain.PatArchive" useGeneratedKeys="true" keyProperty="patid">
        insert into pat_archive
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="name != null">name,</if>
@@ -98,7 +145,7 @@
         </trim>
    </insert>
    <update id="updatePatArchive" parameterType="PatArchive">
    <update id="updatePatArchive" parameterType="com.smartor.domain.PatArchive">
        update pat_archive
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null">name = #{name},</if>
@@ -126,7 +173,9 @@
    </update>
    <delete id="deletePatArchiveByPatid" parameterType="Long">
        delete from pat_archive where patid = #{patid}
        delete
        from pat_archive
        where patid = #{patid}
    </delete>
    <delete id="deletePatArchiveByPatids" parameterType="String">
@@ -135,4 +184,5 @@
            #{patid}
        </foreach>
    </delete>
</mapper>