mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
<?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.panzhihua.service_community.dao.ComActAcidRecordDao">
 
    <resultMap type="com.panzhihua.service_community.entity.ComActAcidRecord" id="ComActAcidRecordBaseResultMap">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="idCard" column="id_card"/>
        <result property="phone" column="phone"/>
        <result property="departureCity" column="departure_city"/>
        <result property="departureAddress" column="departure_address"/>
        <result property="departureDate" column="departure_date"/>
        <result property="touristCity" column="tourist_city"/>
        <result property="localCity" column="local_city"/>
        <result property="localAddress" column="local_address"/>
        <result property="arriveDate" column="arrive_date"/>
        <result property="colorMark" column="color_mark"/>
        <result property="travelCard" column="travel_card"/>
        <result property="dangerArea" column="danger_area"/>
        <result property="outsideCity" column="outside_city"/>
        <result property="vaccination" column="vaccination"/>
        <result property="acidTest" column="acid_test"/>
    </resultMap>
    <update id="batchCheck">
        UPDATE com_act_acid_record SET check_status = 1
        <if test="batchCheckAcidRecordDTO.remark != null and batchCheckAcidRecordDTO.remark != &quot;&quot;">
            ,remark = #{batchCheckAcidRecordDTO.remark}
        </if>
        WHERE id IN
        <foreach collection="batchCheckAcidRecordDTO.ids" item="id" index="index" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
 
    <select id="pageList" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidRecordVO">
        select * from com_act_acid_record
        <where>
            is_del=0
            <if test="commonPage.userId !=null">
                and user_id = #{commonPage.userId}
            </if>
            <if test="commonPage.checkStatus !=null and commonPage.checkStatus !=''">
                and check_status = #{commonPage.checkStatus}
            </if>
            <if test="commonPage.keyword !=null and commonPage.keyword!=''">
                and (name like concat('%',#{commonPage.keyword},'%') or phone like concat('%',#{commonPage.keyword},'%')
                or id_card like concat('%',#{commonPage.keyword},'%'))
            </if>
            <if test="commonPage.startTime !=null and commonPage.startTime !=''">
                and create_time between #{commonPage.startTime} and #{commonPage.stopTime}
            </if>
            <if test="commonPage.isAddress !=null">
                <if test="commonPage.isAddress == 0">
                    and (local_city is null OR LENGTH(TRIM(local_city)) = 0)
                </if>
                <if test="commonPage.isAddress == 1">
                    and local_city is not null AND LENGTH(TRIM(local_city)) > 0
                </if>
            </if>
            <if test="commonPage.departureCity !=null and commonPage.departureCity !=''">
                and departure_city like concat('%',#{commonPage.departureCity},'%')
            </if>
            <if test="commonPage.touristCity !=null and commonPage.touristCity !=''">
                and tourist_city like concat('%',#{commonPage.touristCity},'%')
            </if>
            <if test="commonPage.dangerArea !=null and commonPage.dangerArea !=''">
                and danger_area = #{commonPage.dangerArea}
            </if>
            <if test="commonPage.localCity !=null and commonPage.localCity !='' and commonPage.localCity !='panzhihua'">
                and local_city like concat('%',#{commonPage.localCity},'%')
            </if>
            <if test="commonPage.colorMark !=null and commonPage.colorMark !=''">
                and color_mark like concat('%',#{commonPage.colorMark},'%')
            </if>
            <if test="commonPage.travelCard !=null and commonPage.travelCard !=''">
                and travel_card like concat('%',#{commonPage.travelCard},'%')
            </if>
            <if test="commonPage.type == 1">
                and local_city like concat('%','社区')
            </if>
            <if test="commonPage.type == 2">
                and local_city like concat('%','村')
            </if>
        </where>
        order by check_status asc,create_time desc
    </select>
 
    <select id="export" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidRecordExcelReturn">
        select t.*,t1.status from com_act_acid_record t left join com_act_acid_danger_member t1 on t.id = t1.record_id
        <where>
            t.is_del=0 and t.name is not null and t.id_card is not null and t.phone is not null
            <if test="commonPage.userId !=null">
                and t.user_id = #{commonPage.userId}
            </if>
            <if test="commonPage.checkStatus !=null and commonPage.checkStatus !=''">
                and check_status = #{commonPage.checkStatus}
            </if>
            <if test="commonPage.keyword !=null and commonPage.keyword!=''">
                and (t.name like concat('%',#{commonPage.keyword},'%') or t.phone like
                concat('%',#{commonPage.keyword},'%') or t.id_card like concat('%',#{commonPage.keyword},'%'))
            </if>
            <if test="commonPage.startTime !=null and commonPage.startTime !=''">
                and t.create_time between #{commonPage.startTime} and #{commonPage.stopTime}
            </if>
            <if test="commonPage.isAddress !=null">
                <if test="commonPage.isAddress == 0">
                    and (local_city is null OR LENGTH(TRIM(local_city)) = 0)
                </if>
                <if test="commonPage.isAddress == 1">
                    and local_city is not null AND LENGTH(TRIM(local_city)) > 0
                </if>
            </if>
            <if test="commonPage.departureCity !=null and commonPage.departureCity !=''">
                and departure_city like concat('%',#{commonPage.departureCity},'%')
            </if>
            <if test="commonPage.touristCity !=null and commonPage.touristCity !=''">
                and tourist_city like concat('%',#{commonPage.touristCity},'%')
            </if>
            <if test="commonPage.dangerArea !=null and commonPage.dangerArea !=''">
                and danger_area = #{commonPage.dangerArea}
            </if>
            <if test="commonPage.localCity !=null and commonPage.localCity !='' and commonPage.localCity !='panzhihua'">
                and local_city like concat('%',#{commonPage.localCity},'%')
            </if>
            <if test="commonPage.colorMark !=null and commonPage.colorMark !=''">
                and color_mark like concat('%',#{commonPage.colorMark},'%')
            </if>
            <if test="commonPage.travelCard !=null and commonPage.travelCard !=''">
                and travel_card like concat('%',#{commonPage.travelCard},'%')
            </if>
        </where>
        order by t.create_time desc
    </select>
 
    <select id="selectByIds" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidRecordExcelReturn">
        select t.*,t1.status from com_act_acid_record t left join com_act_acid_danger_member t1 on t.id = t1.record_id
        <where>
            t.is_del=0 and t.name is not null and t.id_card is not null and t.phone is not null
            <if test="ids !=null and ids !=''">
                and t.id  in (${ids})
            </if>
        </where>
        order by t.create_time desc
    </select>
 
    <select id="exportNew" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidRecordExcelReturn">
        select t.*,t1.status from com_act_acid_record t left join com_act_acid_danger_member t1 on t.id = t1.record_id
        <where>
            t.is_del=0 and t.name is not null and t.id_card is not null and t.phone is not null
            <if test="commonPage.userId !=null">
                and t.user_id = #{commonPage.userId}
            </if>
            <if test="commonPage.keyword !=null and commonPage.keyword!=''">
                and (t.name like concat('%',#{commonPage.keyword},'%') or t.phone like
                concat('%',#{commonPage.keyword},'%') or t.id_card like concat('%',#{commonPage.keyword},'%'))
            </if>
            <if test="commonPage.startTime !=null and commonPage.startTime !=''">
                and t.create_time between #{commonPage.startTime} and concat(#{commonPage.stopTime},' 23:59:59')
            </if>
            <if test="commonPage.isAddress !=null">
                <if test="commonPage.isAddress == 0">
                    and (local_city is null OR LENGTH(TRIM(local_city)) = 0)
                </if>
                <if test="commonPage.isAddress == 1">
                    and local_city is not null AND LENGTH(TRIM(local_city)) > 0
                </if>
            </if>
            <if test="commonPage.departureCity !=null and commonPage.departureCity !=''">
                and departure_city like concat('%',#{commonPage.departureCity},'%')
            </if>
            <if test="commonPage.localCity !=null and commonPage.localCity !='' and commonPage.localCity !='panzhihua'">
                and local_city like concat('%',#{commonPage.localCity},'%')
            </if>
            <if test="commonPage.colorMark !=null and commonPage.colorMark !=''">
                and color_mark like concat('%',#{commonPage.colorMark},'%')
            </if>
            <if test="commonPage.travelCard !=null and commonPage.travelCard !=''">
                and travel_card like concat('%',#{commonPage.travelCard},'%')
            </if>
        </where>
        order by t.create_time desc
    </select>
 
    <select id="fiveCount" resultType="com.panzhihua.common.model.vos.community.reserve.FiveCount">
        select (select count(*) from com_act_acid_record where is_del=0 <if test="localCity!=null and localCity!=''">and
        local_city like concat('%',#{localCity},'%')</if>) allCount,
        (select count(*) from com_act_acid_record where danger_area = '是' and is_del=0<if
            test="localCity!=null and localCity!=''">and local_city like concat('%',#{localCity},'%')</if>) dangerCount,
        (select count(*) from com_act_acid_record where color_mark = '绿码' and is_del=0 <if
            test="localCity!=null and localCity!=''">and local_city like concat('%',#{localCity},'%')</if>) greenMark,
        (select count(*) from com_act_acid_record where color_mark = '红码' and is_del=0<if
            test="localCity!=null and localCity!=''">and local_city like concat('%',#{localCity},'%')</if>) redMark,
        (select count(*) from com_act_acid_record where color_mark = '黄码' and is_del=0<if
            test="localCity!=null and localCity!=''">and local_city like concat('%',#{localCity},'%')</if>) yellowMark,
        (select count(*) from com_act_acid_record where travel_card = '是' and is_del=0<if
            test="localCity!=null and localCity!=''">and local_city like concat('%',#{localCity},'%')</if>) travelCount
    </select>
 
    <select id="areaStatics" resultType="com.panzhihua.common.model.vos.community.acid.ComAcidStaticVO">
        select (select count(*) from com_act_acid_record where is_del=0
        <if
                test="localCity!=null and localCity!='' and localCity!='攀枝花市'">and local_city like
            concat('%',#{localCity},'%')
        </if>
        <if test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')</if>) allCount,
        (select count(*) from com_act_acid_record where danger_area = '是' and is_del=0
        <if
                test="localCity!=null and localCity!='' and localCity!='攀枝花市'">and local_city like
            concat('%',#{localCity},'%')
        </if>
        <if test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')</if>) dangerCount,
        (select count(*) from com_act_acid_record where color_mark = '绿码' and is_del=0
        <if test="localCity!=null and localCity!='' and localCity!='攀枝花市'">and local_city like
            concat('%',#{localCity},'%')
        </if>
        <if test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')</if>) greenMark,
        (select count(*) from com_act_acid_record where color_mark = '红码' and is_del=0
        <if test="localCity!=null and localCity!='' and localCity!='攀枝花市'">and local_city like
            concat('%',#{localCity},'%')
        </if>
        <if test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')</if>) redMark,
        (select count(*) from com_act_acid_record where color_mark = '黄码' and is_del=0
        <if test="localCity!=null and localCity!='' and localCity!='攀枝花市'">and local_city like
            concat('%',#{localCity},'%')
        </if>
        <if test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')</if>) yellowMark,
        (select count(*) from com_act_acid_record where travel_card = '是' and is_del=0
        <if test="localCity!=null and localCity!='' and localCity!='攀枝花市'">and local_city like
            concat('%',#{localCity},'%')
        </if>
        <if test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')</if>) travelCount
    </select>
 
    <select id="countryStatics" resultType="Integer">
        select count(*) from com_act_acid_record where is_del=0 and departure_city like concat('%',#{departureCity},'%')
        <if
                test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity!='攀枝花市'">and local_city like
            concat('%',#{localCity},'%')
        </if>
    </select>
 
    <select id="fiveCountPlus" resultType="com.panzhihua.common.model.vos.community.reserve.FiveCount">
        select (select count(*) from com_act_acid_record where 1=1 and is_del=0
        <if test="type == 1">
            and local_city like
            concat('%','社区')
        </if>
        <if test="type == 2">
            and local_city like
            concat('%','村')
        </if>
        <if test="date!=null and date!=''">and
            create_time between concat(#{date},' 00:00:00') and concat(#{date},' 23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and local_city like
            concat('%',#{localCity},'%')
            <if test="type == 1">
                and local_city like
                concat('%','社区')
            </if>
            <if test="type == 2">
                and local_city like
                concat('%','村')
            </if></if>) allCount,
        (select count(*) from com_act_acid_record where danger_area = '是' and is_del=0
        <if test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')
        </if>
        <if test="type == 1">
            and local_city like
            concat('%','社区')
        </if>
        <if test="type == 2">
            and local_city like
            concat('%','村')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and local_city like
            concat('%',#{localCity},'%')
            </if>) dangerCount,
        (select count(*) from com_act_acid_record where color_mark = '绿码' and is_del=0
        <if test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and local_city like
            concat('%',#{localCity},'%')</if>
        <if test="type == 1">
            and local_city like
            concat('%','社区')
        </if>
        <if test="type == 2">
            and local_city like
            concat('%','村')
        </if>) greenMark,
        (select count(*) from com_act_acid_record where color_mark = '红码' and is_del=0
        <if test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')
        </if>
        <if test="type == 1">
            and local_city like
            concat('%','社区')
        </if>
        <if test="type == 2">
            and local_city like
            concat('%','村')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and local_city like
            concat('%',#{localCity},'%')
            </if>) redMark,
        (select count(*) from com_act_acid_record where color_mark = '黄码' and is_del=0
        <if test="type == 1">
            and local_city like
            concat('%','社区')
        </if>
        <if test="type == 2">
            and local_city like
            concat('%','村')
        </if>
        <if test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and local_city like
            concat('%',#{localCity},'%')
        </if>) yellowMark,
        (select count(*) from com_act_acid_record where travel_card = '是' and is_del=0
        <if test="type == 1">
            and local_city like
            concat('%','社区')
        </if>
        <if test="type == 2">
            and local_city like
            concat('%','村')
        </if>
        <if test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and local_city like
            concat('%',#{localCity},'%')
           </if>) travelCount,
        (select count(*) from com_act_acid_record where outside_city = '是' and is_del=0
        <if test="type == 1">
            and local_city like
            concat('%','社区')
        </if>
        <if test="type == 2">
            and local_city like
            concat('%','村')
        </if>
        <if test="date!=null and date!=''">and create_time between concat(#{date},' 00:00:00') and concat(#{date},'
            23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and local_city like
            concat('%',#{localCity},'%')
           </if>) outsideCount
    </select>
 
    <select id="pushStatics" resultType="com.panzhihua.common.model.vos.community.reserve.FiveCount">
        select (select count(*) from com_act_acid_record where 1=1 and is_del=0
        <if test="date!=null and date!=''">and
            create_time between concat(#{date},' 00:00:00') and concat(#{date},' 23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and local_city like
            concat('%',#{localCity},'%')</if>) allCount,
        (select count(*) from com_act_acid_danger_member t LEFT JOIN com_act_acid_danger_member t1 on t.record_id =
        t1.id where 1=1 and t.is_del=0
        <if test="date!=null and date!=''">and t.create_time between concat(#{date},'
            00:00:00') and concat(#{date},' 23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and t1.local_city like
            concat('%',#{localCity},'%')</if>) dangerCount
    </select>
 
    <select id="selectLastNext" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidRecordVO">
        select(select min(id) from com_act_acid_record where id > #{id} and check_status = 0 and is_del =0 <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and local_city like
        concat('%',#{localCity},'%')</if>)            last_id,
              (select max(id) as next_id from com_act_acid_record where #{id} > id and check_status = 0 and is_del =0 <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and local_city like
        concat('%',#{localCity},'%')</if>) next_id
    </select>
 
    <select id="selectAcidCount" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidChartsVO">
        select count(*) as numOne from com_act_acid_record where 1=1 and is_del=0
        <if test="date!=null and date!=''">and
            create_time between concat(#{date},' 00:00:00') and concat(#{date},' 23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and local_city like
            concat('%',#{localCity},'%')
        </if>
    </select>
 
    <select id="selectDangerCount" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidChartsVO">
        select (select count(*) as numOne from com_act_acid_danger_member where type = 1
        <if test="date!=null and date!=''">
            and create_time between concat(#{date},' 00:00:00') and concat(#{date},' 23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and relation_name like
            concat('%',#{localCity},'%')</if>) numOne,
        (select count(*) as numTwo from com_act_acid_danger_member where type = 2
        <if test="date!=null and date!=''">and
            create_time between concat(#{date},' 00:00:00') and concat(#{date},' 23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and relation_name like
            concat('%',#{localCity},'%')</if>) numTwo
    </select>
 
    <select id="selectCheck" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidChartsVO">
        select (select count(id) from com_act_acid_danger_member where type=1
        <if test="date!=null and date!=''">and
            create_time between concat(#{date},' 00:00:00') and concat(#{date},' 23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and relation_name like
            concat('%',#{localCity},'%')</if>) numTwo,count(id) numOne,
        case
        WHEN status = 1 THEN "集中隔离"
        WHEN status = 2 THEN "居家隔离"
        WHEN status = 3 THEN "健康监测"
        WHEN status = 4 THEN "失联或尚需追踪"
        WHEN status = 5 THEN "排除风险"
        WHEN status = 6 THEN "暂未管控" end name
        from com_act_acid_danger_member where type=1
        <if test="date!=null and date!=''">and
            create_time between concat(#{date},' 00:00:00') and concat(#{date},' 23:23:59')
        </if>
        <if test="localCity!=null and localCity!='' and localCity !='panzhihua'">and relation_name like
            concat('%',#{localCity},'%')
        </if>
        GROUP BY status
    </select>
 
    <select id="selectColorMarkGroup"
            resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidColorChartsVO">
        SELECT count(1) count_num,color_mark FROM `com_act_acid_record` GROUP BY color_mark
    </select>
    <select id="selectColorMarkGroupByMonth"
            resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidColorChartsVO">
        SELECT COUNT(1) count_num,date_format(create_time,'%Y-%m')   as count_name,color_mark FROM `com_act_acid_record`
        WHERE date_format(create_time,'%Y-%m') >= date_format(date_sub(now(), INTERVAL 4 MONTH),'%Y-%m') GROUP BY  count_name,color_mark
    </select>
 
</mapper>