<?xml version="1.0" encoding="UTF-8" ?>
|
<!DOCTYPE mapper
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.smartor.mapper.PatArchiveMapper">
|
|
<resultMap type="com.smartor.domain.PatArchive" id="PatArchiveResult">
|
<result property="patid" column="patid"/>
|
<result property="name" column="name"/>
|
<result property="sex" column="sex"/>
|
<result property="iccardno" column="iccardno"/>
|
<result property="birthdate" column="birthdate"/>
|
<result property="age" column="age"/>
|
<result property="source" column="source"/>
|
<result property="archivetime" column="archivetime"/>
|
<result property="archiveby" column="archiveby"/>
|
<result property="telcode" column="telcode"/>
|
<result property="relativetelcode" column="relativetelcode"/>
|
<result property="iccardtype" column="iccardtype"/>
|
<result property="orgid" column="orgid"/>
|
<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="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
|
</sql>
|
|
<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>
|
<if test="iccardno != null and iccardno != ''">and iccardno = #{iccardno}</if>
|
<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="tagIds != null and tagIds != ''">and c.tagid in
|
<foreach collection="tagIds" item="tagId" open="(" separator="," close=")">
|
#{tagId}
|
</foreach>
|
</if>
|
</where>
|
</select>
|
|
<select id="selectPatArchiveByPatid" parameterType="Long" resultMap="PatArchiveResult">
|
<include refid="selectPatArchiveVo"/>
|
where patid = #{patid}
|
</select>
|
|
<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>
|
<if test="sex != null">sex,</if>
|
<if test="iccardno != null">iccardno,</if>
|
<if test="birthdate != null">birthdate,</if>
|
<if test="age != null">age,</if>
|
<if test="source != null">source,</if>
|
<if test="archivetime != null">archivetime,</if>
|
<if test="archiveby != null">archiveby,</if>
|
<if test="telcode != null">telcode,</if>
|
<if test="relativetelcode != null">relativetelcode,</if>
|
<if test="iccardtype != null">iccardtype,</if>
|
<if test="orgid != null">orgid,</if>
|
<if test="openid != null">openid,</if>
|
<if test="delFlag != null and delFlag != ''">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="isupload != null">isupload,</if>
|
<if test="uploadTime != null">upload_time,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="name != null">#{name},</if>
|
<if test="sex != null">#{sex},</if>
|
<if test="iccardno != null">#{iccardno},</if>
|
<if test="birthdate != null">#{birthdate},</if>
|
<if test="age != null">#{age},</if>
|
<if test="source != null">#{source},</if>
|
<if test="archivetime != null">#{archivetime},</if>
|
<if test="archiveby != null">#{archiveby},</if>
|
<if test="telcode != null">#{telcode},</if>
|
<if test="relativetelcode != null">#{relativetelcode},</if>
|
<if test="iccardtype != null">#{iccardtype},</if>
|
<if test="orgid != null">#{orgid},</if>
|
<if test="openid != null">#{openid},</if>
|
<if test="delFlag != null and delFlag != ''">#{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="isupload != null">#{isupload},</if>
|
<if test="uploadTime != null">#{uploadTime},</if>
|
</trim>
|
</insert>
|
|
<update id="updatePatArchive" parameterType="com.smartor.domain.PatArchive">
|
update pat_archive
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="name != null">name = #{name},</if>
|
<if test="sex != null">sex = #{sex},</if>
|
<if test="iccardno != null">iccardno = #{iccardno},</if>
|
<if test="birthdate != null">birthdate = #{birthdate},</if>
|
<if test="age != null">age = #{age},</if>
|
<if test="source != null">source = #{source},</if>
|
<if test="archivetime != null">archivetime = #{archivetime},</if>
|
<if test="archiveby != null">archiveby = #{archiveby},</if>
|
<if test="telcode != null">telcode = #{telcode},</if>
|
<if test="relativetelcode != null">relativetelcode = #{relativetelcode},</if>
|
<if test="iccardtype != null">iccardtype = #{iccardtype},</if>
|
<if test="orgid != null">orgid = #{orgid},</if>
|
<if test="openid != null">openid = #{openid},</if>
|
<if test="delFlag != null and delFlag != ''">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="isupload != null">isupload = #{isupload},</if>
|
<if test="uploadTime != null">upload_time = #{uploadTime},</if>
|
</trim>
|
where patid = #{patid}
|
</update>
|
|
<delete id="deletePatArchiveByPatid" parameterType="Long">
|
delete
|
from pat_archive
|
where patid = #{patid}
|
</delete>
|
|
<delete id="deletePatArchiveByPatids" parameterType="String">
|
delete from pat_archive where patid in
|
<foreach item="patid" collection="array" open="(" separator="," close=")">
|
#{patid}
|
</foreach>
|
</delete>
|
|
</mapper>
|