From 36afc3a1f1437b8a3283dc0bf6475e96fded05a7 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 12 Apr 2021 22:35:36 +0800
Subject: [PATCH] 新增主动报警alarm,健康码,体温,包裹,违禁品导出数据接口

---
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml |  127 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 127 insertions(+), 0 deletions(-)

diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml
index 3225b9b..5bbaea7 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml
@@ -150,6 +150,44 @@
         <if test="healthcodeVO.begTime!=null and healthcodeVO.begTime!='' and healthcodeVO.endTime!=null and healthcodeVO.endTime!='' ">
             and date(dtime) between #{healthcodeVO.begTime} and #{healthcodeVO.endTime}
         </if>
+        <if test="healthcodeVO.timeDesc!=null and healthcodeVO.timeDesc!=''">
+            <if test="healthcodeVO.timeDesc=='0-2'">
+                and hour(dtime)>=0 and hour(dtime) &lt;2
+            </if>
+            <if test="healthcodeVO.timeDesc=='2-4'">
+                and hour(dtime)>=2 and hour(dtime) &lt;4
+            </if>
+            <if test="healthcodeVO.timeDesc=='4-6'">
+                and hour(dtime)>=4 and hour(dtime) &lt;6
+            </if>
+            <if test="healthcodeVO.timeDesc=='6-8'">
+                and hour(dtime)>=6 and hour(dtime) &lt;8
+            </if>
+            <if test="healthcodeVO.timeDesc=='8-10'">
+                and hour(dtime)>=8 and hour(dtime) &lt;10
+            </if>
+            <if test="healthcodeVO.timeDesc=='10-12'">
+                and hour(dtime)>=10 and hour(dtime) &lt;12
+            </if>
+            <if test="healthcodeVO.timeDesc=='12-14'">
+                and hour(dtime)>=12 and hour(dtime) &lt;14
+            </if>
+            <if test="healthcodeVO.timeDesc=='14-16'">
+                and hour(dtime)>=14 and hour(dtime) &lt;16
+            </if>
+            <if test="healthcodeVO.timeDesc=='16-18'">
+                and hour(dtime)>=16 and hour(dtime) &lt;18
+            </if>
+            <if test="healthcodeVO.timeDesc=='18-20'">
+                and hour(dtime)>=18 and hour(dtime) &lt;20
+            </if>
+            <if test="healthcodeVO.timeDesc=='20-22'">
+                and hour(dtime)>=20 and hour(dtime) &lt;22
+            </if>
+            <if test="healthcodeVO.timeDesc=='22-24'">
+                and hour(dtime)>=22 and hour(dtime) &lt;24
+            </if>
+        </if>
         ORDER BY dtime desc
     </select>
 
@@ -168,4 +206,93 @@
             where type =3
         and dtime between #{conditionVo.startTime} and #{conditionVo.endTime}
     </select>
+
+    <!--统计时间段内红色健康码人数数量数据-->
+    <select id="selectHealthcodeTimeData" resultType="java.lang.Integer">
+        select ifnull(count,0) count from
+        (
+            SELECT @date := DATE_ADD( @date, INTERVAL + 1 DAY ) days FROM
+            (
+                SELECT @date := DATE_ADD( #{conditionVo.startTime}, INTERVAL - 1 DAY ) FROM sys_date
+            ) time
+            WHERE to_days( @date ) &lt; to_days( #{conditionVo.endTime} )
+        ) a
+        left join
+        (
+            select DATE_FORMAT(dtime,'%Y-%m-%d') as datetime, count(*) as count from healthcode
+            where type=3
+            group by DATE_FORMAT(dtime,'%Y-%m-%d')
+        ) b
+        on
+        a.days = b.datetime
+    </select>
+
+    <!--导出健康码数据表格-->
+    <select id="exportHealthcode" resultType="org.springblade.jfpt.healthcode.vo.HealthcodeExcel">
+        SELECT * FROM healthcode
+        where 1=1
+        <if test="healthcodeVO.status==0">
+            and to_days(dtime)=to_days(now())
+        </if>
+        <if test="healthcodeVO.status==1">
+            and YEARWEEK(date_format(dtime,'%Y-%m-%d'),1) = YEARWEEK(now(),1)
+        </if>
+        <if test="healthcodeVO.status==2">
+            and date_format(dtime,'%Y%m') = date_format(now(),'%Y%m')
+        </if>
+        <if test="healthcodeVO.type!=null">
+            and type=#{healthcodeVO.type}
+        </if>
+        <if test="healthcodeVO.province!=null">
+            and province like concat('%',#{healthcodeVO.province},'%')
+        </if>
+        <if test="healthcodeVO.city!=null">
+            and city like concat('%',#{healthcodeVO.city},'%')
+        </if>
+        <if test="healthcodeVO.district!=null">
+            and district like concat('%',#{healthcodeVO.district},'%')
+        </if>
+        <if test="healthcodeVO.begTime!=null and healthcodeVO.begTime!='' and healthcodeVO.endTime!=null and healthcodeVO.endTime!='' ">
+            and date(dtime) between #{healthcodeVO.begTime} and #{healthcodeVO.endTime}
+        </if>
+        <if test="healthcodeVO.timeDesc!=null and healthcodeVO.timeDesc!=''">
+            <if test="healthcodeVO.timeDesc=='0-2'">
+                and hour(dtime)>=0 and hour(dtime) &lt;2
+            </if>
+            <if test="healthcodeVO.timeDesc=='2-4'">
+                and hour(dtime)>=2 and hour(dtime) &lt;4
+            </if>
+            <if test="healthcodeVO.timeDesc=='4-6'">
+                and hour(dtime)>=4 and hour(dtime) &lt;6
+            </if>
+            <if test="healthcodeVO.timeDesc=='6-8'">
+                and hour(dtime)>=6 and hour(dtime) &lt;8
+            </if>
+            <if test="healthcodeVO.timeDesc=='8-10'">
+                and hour(dtime)>=8 and hour(dtime) &lt;10
+            </if>
+            <if test="healthcodeVO.timeDesc=='10-12'">
+                and hour(dtime)>=10 and hour(dtime) &lt;12
+            </if>
+            <if test="healthcodeVO.timeDesc=='12-14'">
+                and hour(dtime)>=12 and hour(dtime) &lt;14
+            </if>
+            <if test="healthcodeVO.timeDesc=='14-16'">
+                and hour(dtime)>=14 and hour(dtime) &lt;16
+            </if>
+            <if test="healthcodeVO.timeDesc=='16-18'">
+                and hour(dtime)>=16 and hour(dtime) &lt;18
+            </if>
+            <if test="healthcodeVO.timeDesc=='18-20'">
+                and hour(dtime)>=18 and hour(dtime) &lt;20
+            </if>
+            <if test="healthcodeVO.timeDesc=='20-22'">
+                and hour(dtime)>=20 and hour(dtime) &lt;22
+            </if>
+            <if test="healthcodeVO.timeDesc=='22-24'">
+                and hour(dtime)>=22 and hour(dtime) &lt;24
+            </if>
+        </if>
+        ORDER BY dtime desc
+    </select>
 </mapper>

--
Gitblit v1.9.3