liusheng
2024-09-24 562a960261b75d70abd65aa10528f09aeece94e8
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<?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.ServiceTaskMapper">
 
    <resultMap type="com.smartor.domain.ServiceTask" id="ServiceTaskResult">
        <result property="taskid" column="taskid"/>
        <result property="taskName" column="task_name"/>
        <result property="templateid" column="templateid"/>
        <result property="templatename" column="templatename"/>
        <result property="labelinfo" column="labelinfo"/>
        <result property="count" column="count"/>
        <result property="executed" column="executed"/>
        <result property="unexecuted" column="unexecuted"/>
        <result property="fail" column="fail"/>
        <result property="checkuserid" column="checkuserid"/>
        <result property="checkusername" column="checkusername"/>
        <result property="checktime" column="checktime"/>
        <result property="type" column="type"/>
        <result property="typename" column="typename"/>
        <result property="deptcode" column="deptcode"/>
        <result property="deptname" column="deptname"/>
        <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="orgid" column="orgid"/>
        <result property="pid" column="pid"/>
        <result property="guid" column="guid"/>
        <result property="preachform" column="preachform"/>
        <result property="sendType" column="send_type"/>
        <result property="sendState" column="send_state"/>
        <result property="hospType" column="hosp_type"/>
        <result property="taskDesc" column="task_desc"/>
        <result property="libtemplateid" column="libtemplateid"/>
        <result property="libtemplatename" column="libtemplatename"/>
        <result property="sendTimeSlot" column="send_time_slot"/>
        <result property="stopState" column="stop_state"/>
        <result property="showDate" column="show_date"/>
        <result property="showTimeMorn" column="show_time_morn"/>
        <result property="showTimeNoon" column="show_time_noon"/>
        <result property="showTimeNight" column="show_time_night"/>
        <result property="textParam" column="text_param"/>
        <result property="serviceType" column="service_type"/>
        <result property="longTask" column="long_task"/>
        <result property="kcb" column="kcb"/>
        <result property="jsy" column="jsy"/>
        <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/>
        <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/>
    </resultMap>
 
    <sql id="selectServiceTaskVo">
        select taskid,
               task_name,
               long_task,
               show_date,
               show_time_morn,
               show_time_noon,
               show_time_night,
               libtemplateid,
               libtemplatename,
               stop_state,
               text_param,
               templateid,
               templatename,
               labelinfo,
               count,
               executed,
               unexecuted,
               fail,
               checkuserid,
               checkusername,
               checktime,
               type,
               task_desc,
               hosp_type,
               typename,
               deptcode,
               deptname,
               del_flag,
               update_by,
               update_time,
               create_by,
               create_time,
               isupload,
               upload_time,
               pid,
               guid,
               preachform,
               send_type,
               send_state,
               send_time_slot,
               service_type,
               kcb,
               jsy,
               leavehospitaldistrictcode,
               leavehospitaldistrictname,
               orgid
        from service_task
    </sql>
 
    <select id="selectServiceTaskList" parameterType="com.smartor.domain.ServiceTask" resultMap="ServiceTaskResult">
        <include refid="selectServiceTaskVo"/>
        <where>
            del_flag=0
            <if test="taskName != null  and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
            <if test="sendTimeSlot != null  and sendTimeSlot != ''">and send_time_slot like concat('%', #{sendTimeSlot},
                '%')
            </if>
            <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if>
            <if test="longTask != null  and longTask != ''">and long_task = #{longTask}</if>
            <if test="serviceType != null  and serviceType != ''">and service_type = #{serviceType}</if>
            <if test="templatename != null  and templatename != ''">and templatename like concat('%', #{templatename},
                '%')
            </if>
            <if test="labelinfo != null  and labelinfo != ''">and labelinfo = #{labelinfo}</if>
            <if test="count != null ">and count = #{count}</if>
            <if test="executed != null ">and executed = #{executed}</if>
            <if test="unexecuted != null ">and unexecuted = #{unexecuted}</if>
            <if test="fail != null ">and fail = #{fail}</if>
            <if test="checkuserid != null  and checkuserid != ''">and checkuserid = #{checkuserid}</if>
            <if test="checkusername != null  and checkusername != ''">and checkusername like concat('%',
                #{checkusername}, '%')
            </if>
            <if test="checktime != null ">and checktime = #{checktime}</if>
            <if test="type != null  and type != ''">and type = #{type}</if>
            <if test="typename != null  and typename != ''">and typename like concat('%', #{typename}, '%')</if>
            <if test="beginTime != null ">and date_format(update_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
            </if>
            <if test="endTime != null ">and date_format(update_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
            </if>
 
            <if test="deptcode != null  and deptcode != ''">and deptcode = #{deptcode}</if>
            <if test="deptname != null  and deptname != ''">and deptname = #{deptname}</if>
            <if test="isupload != null ">and isupload = #{isupload}</if>
            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
            <if test="hospType != null  and hospType != ''">and hosp_type = #{hospType}</if>
            <if test="libtemplateid != null ">and libtemplateid = #{libtemplateid}</if>
            <if test="libtemplatename != null  and libtemplatename != ''">and libtemplatename = #{libtemplatename}</if>
            <if test="createBy != null  and createBy != ''">and create_by = #{createBy}</if>
            <if test="sendState != null  ">and send_state = #{sendState}</if>
            <if test="leavehospitaldistrictname != null  ">and leavehospitaldistrictname = #{leavehospitaldistrictname}</if>
            <if test="leavehospitaldistrictcode != null  ">and leavehospitaldistrictcode = #{leavehospitaldistrictcode}</if>
 
            <if test="leavehospitaldistrictcodes != null ">
                AND leavehospitaldistrictcode IN
                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
                         close=")">
                    #{leavehospitaldistrictcode}
                </foreach>
            </if>
            <if test="leaveldeptcodes != null">
                AND deptcode IN
                <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
                         close=")">
                    #{leaveldeptcode}
                </foreach>
            </if>
 
 
        </where>
        order by update_time desc,taskid desc
    </select>
 
    <select id="selectServiceTaskByTaskid" parameterType="Long" resultMap="ServiceTaskResult">
        <include refid="selectServiceTaskVo"/>
        where taskid = #{taskid}
    </select>
 
    <insert id="insertServiceTask" parameterType="com.smartor.domain.ServiceTask" useGeneratedKeys="true"
            keyProperty="taskid">
        insert into service_task
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="taskName != null">task_name,</if>
            <if test="templateid != null">templateid,</if>
            <if test="templatename != null">templatename,</if>
            <if test="labelinfo != null">labelinfo,</if>
            <if test="count != null">count,</if>
            <if test="executed != null">executed,</if>
            <if test="unexecuted != null">unexecuted,</if>
            <if test="fail != null">fail,</if>
            <if test="checkuserid != null">checkuserid,</if>
            <if test="checkusername != null">checkusername,</if>
            <if test="checktime != null">checktime,</if>
            <if test="type != null">type,</if>
            <if test="typename != null">typename,</if>
            <if test="deptcode != null">deptcode,</if>
            <if test="deptname != null">deptname,</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>
            <if test="orgid != null">orgid,</if>
            <if test="pid != null">pid,</if>
            <if test="guid != null">guid,</if>
            <if test="preachform != null">preachform,</if>
            <if test="sendType != null">send_type,</if>
            <if test="sendState != null">send_state,</if>
            <if test="hospType != null  and hospType != ''">hosp_type,</if>
            <if test="taskDesc != null  and taskDesc != ''">task_desc,</if>
            <if test="libtemplateid != null ">libtemplateid,</if>
            <if test="libtemplatename != null  and libtemplatename != ''">libtemplatename,</if>
            <if test="sendTimeSlot != null  and sendTimeSlot != ''">send_time_slot,</if>
            <if test="stopState != null">stop_state,</if>
            <if test="showDate != null and showDate != ''">show_date,</if>
            <if test="showTimeNight != null and showTimeNight != ''">show_time_night,</if>
            <if test="showTimeNoon != null and showTimeNoon != ''">show_time_noon,</if>
            <if test="showTimeMorn != null and showTimeMorn != ''">show_time_morn,</if>
            <if test="textParam != null and textParam != ''">text_param,</if>
            <if test="serviceType != null  and serviceType != ''">service_type,</if>
            <if test="longTask != null  and longTask != ''">long_task,</if>
            <if test="kcb != null  and kcb != ''">kcb,</if>
            <if test="jsy != null  and jsy != ''">jsy,</if>
            <if test="leavehospitaldistrictname != null  ">leavehospitaldistrictname,</if>
            <if test="leavehospitaldistrictcode != null  ">leavehospitaldistrictcode,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskName != null">#{taskName},</if>
            <if test="templateid != null">#{templateid},</if>
            <if test="templatename != null">#{templatename},</if>
            <if test="labelinfo != null">#{labelinfo},</if>
            <if test="count != null">#{count},</if>
            <if test="executed != null">#{executed},</if>
            <if test="unexecuted != null">#{unexecuted},</if>
            <if test="fail != null">#{fail},</if>
            <if test="checkuserid != null">#{checkuserid},</if>
            <if test="checkusername != null">#{checkusername},</if>
            <if test="checktime != null">#{checktime},</if>
            <if test="type != null">#{type},</if>
            <if test="typename != null">#{typename},</if>
            <if test="deptcode != null">#{deptcode},</if>
            <if test="deptname != null">#{deptname},</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>
            <if test="orgid != null">#{orgid},</if>
            <if test="pid != null">#{pid},</if>
            <if test="guid != null">#{guid},</if>
            <if test="preachform != null">#{preachform},</if>
            <if test="sendType != null">#{sendType},</if>
            <if test="sendState != null">#{sendState},</if>
            <if test="hospType != null  and hospType != ''">#{hospType},</if>
            <if test="taskDesc != null  and taskDesc != ''">#{taskDesc},</if>
            <if test="libtemplateid != null ">#{libtemplateid},</if>
            <if test="libtemplatename != null  and libtemplatename != ''">#{libtemplatename},</if>
            <if test="sendTimeSlot != null  and sendTimeSlot != ''">#{sendTimeSlot},</if>
            <if test="stopState != null">#{stopState},</if>
            <if test="showDate != null and showDate != ''">#{showDate},</if>
            <if test="showTimeNight != null and showTimeNight != ''">#{showTimeNight},</if>
            <if test="showTimeNoon != null and showTimeNoon != ''">#{showTimeNoon},</if>
            <if test="showTimeMorn != null and showTimeMorn != ''">#{showTimeMorn},</if>
            <if test="textParam != null and textParam != ''">#{textParam},</if>
            <if test="serviceType != null  and serviceType != ''">#{serviceType},</if>
            <if test="longTask != null  and longTask != ''">#{longTask},</if>
            <if test="kcb != null  and kcb != ''">#{kcb},</if>
            <if test="jsy != null  and jsy != ''">#{jsy},</if>
            <if test="leavehospitaldistrictname != null  ">#{leavehospitaldistrictname},</if>
            <if test="leavehospitaldistrictcode != null  ">#{leavehospitaldistrictcode},</if>
        </trim>
    </insert>
 
    <update id="updateServiceTask" parameterType="com.smartor.domain.ServiceTask">
        update service_task
        <trim prefix="SET" suffixOverrides=",">
            <if test="taskName != null">task_name = #{taskName},</if>
            <if test="templateid != null">templateid = #{templateid},</if>
            <if test="templatename != null">templatename = #{templatename},</if>
            <if test="labelinfo != null">labelinfo = #{labelinfo},</if>
            <if test="count != null">count = #{count},</if>
            <if test="executed != null">executed = #{executed},</if>
            <if test="unexecuted != null">unexecuted = #{unexecuted},</if>
            <if test="fail != null">fail = #{fail},</if>
            <if test="checkuserid != null">checkuserid = #{checkuserid},</if>
            <if test="checkusername != null">checkusername = #{checkusername},</if>
            <if test="checktime != null">checktime = #{checktime},</if>
            <if test="type != null">type = #{type},</if>
            <if test="typename != null">typename = #{typename},</if>
            <if test="deptcode != null">deptcode = #{deptcode},</if>
            <if test="deptname != null">deptname = #{deptname},</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>
            <if test="orgid != null">orgid = #{orgid},</if>
            <if test="pid != null">pid = #{pid},</if>
            <if test="guid != null">guid = #{guid},</if>
            <if test="preachform != null">preachform = #{preachform},</if>
            <if test="sendType != null">send_type = #{sendType},</if>
            <if test="sendState != null">send_state = #{sendState},</if>
            <if test="hospType != null  and hospType != ''">hosp_type = #{hospType},</if>
            <if test="taskDesc != null  and taskDesc != ''">task_desc= #{taskDesc},</if>
            <if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if>
            <if test="libtemplatename != null  and libtemplatename != ''">libtemplatename = #{libtemplatename},</if>
            <if test="sendTimeSlot != null  and sendTimeSlot != ''">send_time_slot=#{sendTimeSlot},</if>
            <if test="stopState != null ">stop_state=#{stopState},</if>
            <if test="showDate != null and showDate != ''">show_date=#{showDate},</if>
            <if test="showTimeNight != null and showTimeNight != ''">show_time_night=#{showTimeNight},</if>
            <if test="showTimeNoon != null and showTimeNoon != ''">show_time_noon=#{showTimeNoon},</if>
            <if test="showTimeMorn != null and showTimeMorn != ''">show_time_morn=#{showTimeMorn},</if>
            <if test="textParam != null and textParam != ''">text_param=#{textParam},</if>
            <if test="serviceType != null  and serviceType != ''">service_type = #{serviceType},</if>
            <if test="longTask != null  and longTask != ''">long_task = #{longTask},</if>
            <if test="kcb != null  and kcb != ''">kcb = #{kcb},</if>
            <if test="jsy != null  and jsy != ''">kcb = #{jsy},</if>
            <if test="leavehospitaldistrictname != null  ">leavehospitaldistrictname = #{leavehospitaldistrictname},</if>
            <if test="leavehospitaldistrictcode != null  ">leavehospitaldistrictcode = #{leavehospitaldistrictcode},</if>
        </trim>
        where taskid = #{taskid}
    </update>
 
    <update id="deleteServiceTaskByTaskid" parameterType="Long">
        update service_task
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where taskid = #{taskid}
    </update>
 
    <update id="deleteServiceTaskByTaskids" parameterType="String">
        update service_task
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where taskid in
        <foreach item="taskid" collection="array" open="(" separator="," close=")">
            #{taskid}
        </foreach>
    </update>
</mapper>