liusheng
2023-06-21 3acec3660921f22b58bdaa85d61a2fcfba8e6c98
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?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>