You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
5.0 KiB
144 lines
5.0 KiB
<?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.ccsens.health.persist.dao.HealthAbnormalDao">
|
|
|
|
<resultMap id="resultMap_abnormal_statistics" type="com.ccsens.health.bean.vo.AbnormalVo$AbnormalStatisticsVo">
|
|
<id column="id" property="id"/>
|
|
<result column="wkno" property="wkno"/>
|
|
<result column="name" property="name"/>
|
|
<result column="department" property="department"/>
|
|
<result column="animalHeat" property="animalHeat"/>
|
|
<result column="reason" property="reason"/>
|
|
<result column="healthType" property="healthType"/>
|
|
<result column="healthName" property="healthName"/>
|
|
<result column="startTime" property="startTime"/>
|
|
<result column="endTime" property="endTime"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="resultMap_abnormal_overview" type="com.ccsens.health.bean.vo.AbnormalVo$AbnormalOverview">
|
|
<id column="id" property="id"/>
|
|
<result column="abnormalName" property="abnormalName"/>
|
|
<result column="code" property="code"/>
|
|
<result column="number" property="number"/>
|
|
</resultMap>
|
|
|
|
<select id="getAbnormalList" resultMap="resultMap_abnormal_statistics" parameterType="java.util.Map">
|
|
select
|
|
a.id as id,
|
|
a.wkno as wkno,
|
|
a.name as name,
|
|
a.department as department,
|
|
a.animal_heat as animalHeat,
|
|
a.reason as reason,
|
|
a.health_status as healthType,
|
|
t.`name` as healthName,
|
|
a.start_time as startTime,
|
|
a.end_time as endTime
|
|
from
|
|
t_health_abnormal a left join t_member m on a.wkno = m.wkno join t_health_type t on a.health_status = t.id
|
|
where
|
|
a.rec_status = 0
|
|
<if test="post != null and post !='' and post == 0">
|
|
and
|
|
m.type != 2
|
|
</if>
|
|
<if test="post != null and post !='' and post != 0">
|
|
and
|
|
m.type = 2
|
|
</if>
|
|
<if test="department != null and department !=''">
|
|
and
|
|
a.department = #{department}
|
|
</if>
|
|
<if test="healthType != null and healthType !=''">
|
|
and
|
|
a.health_status = #{healthType}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="abnormalOverview" resultMap="resultMap_abnormal_overview" parameterType="java.util.Map">
|
|
SELECT
|
|
t.`name` as abnormalName,
|
|
t.id as code,
|
|
count(ha.id) as number
|
|
FROM
|
|
t_health_type t LEFT JOIN t_health_abnormal ha on ha.health_status = t.id
|
|
<if test="endTime != null">
|
|
and
|
|
(ha.start_time <= #{endTime} or ha.start_time is null)
|
|
</if>
|
|
<if test="startTime != null">
|
|
and
|
|
(ha.end_time >= #{startTime} or ha.start_time is null)
|
|
</if>
|
|
LEFT JOIN t_member m on ha.wkno = m.wkno
|
|
<if test="department != null and department !=''">
|
|
and
|
|
(m.department = #{department} or m.department is null)
|
|
</if>
|
|
WHERE
|
|
t.scene = 1
|
|
GROUP BY t.id
|
|
|
|
</select>
|
|
|
|
<select id="selectJourneyNumber" resultType="int" parameterType="java.util.Map">
|
|
SELECT
|
|
count(*)
|
|
FROM
|
|
t_journey j JOIN t_journey_abnormal a
|
|
on
|
|
j.car_no = a.car_no
|
|
and
|
|
j.trip_mode = a.trip_mode
|
|
and
|
|
j.start_time <= a.end_time
|
|
AND
|
|
j.end_time >= a.start_time
|
|
JOIN t_real_name_auth rn on j.user_id = rn.user_id
|
|
JOIN t_member m on rn.no = m.wkno
|
|
WHERE
|
|
j.rec_status = 0
|
|
<if test="department != null and department !=''">
|
|
and
|
|
m.department = #{department}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and
|
|
j.start_time <= #{endTime}
|
|
</if>
|
|
<if test="startTime != null">
|
|
and
|
|
j.end_time >= #{startTime}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectByUserId" resultType="com.ccsens.health.bean.po.HealthAbnormal" parameterType="java.util.Map">
|
|
select
|
|
a.id as id,
|
|
a.wkno as wkno,
|
|
a.health_status as healthStatus
|
|
from
|
|
t_health_abnormal a join t_real_name_auth r on a.wkno = r.no
|
|
where
|
|
a.rec_status = 0
|
|
and
|
|
r.user_id = #{userId}
|
|
order by a.created_at DESC
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="selectHealthRecordByWkno" resultType="com.ccsens.health.bean.po.HealthRecords" parameterType="java.util.Map">
|
|
select
|
|
hr.id as id,
|
|
hr.user_id as userId
|
|
from
|
|
t_real_name_auth r join t_health_records hr on hr.user_id = r.user_id
|
|
where
|
|
hr.rec_status = 0
|
|
and
|
|
r.no = #{wkno}
|
|
order by hr.time DESC
|
|
limit 1
|
|
</select>
|
|
</mapper>
|