|
|
|
<?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="yq.system.mapper.MineHealthMapper">
|
|
|
|
|
|
|
|
<resultMap type="mineHealth" id="MineHealthResult">
|
|
|
|
<result property="id" column="id" />
|
|
|
|
<result property="bpHigh" column="bp_high" />
|
|
|
|
<result property="bpLow" column="bp_low" />
|
|
|
|
<result property="br" column="br" />
|
|
|
|
<result property="hr" column="hr" />
|
|
|
|
<result property="hrv" column="hrv" />
|
|
|
|
<result property="temperature" column="temperature" />
|
|
|
|
<result property="isWork" column="is_work" />
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
<result property="faceName" column="face_name" />
|
|
|
|
<result property="facePhone" column="face_phone" />
|
|
|
|
<result property="deptId" column="dept_id" />
|
|
|
|
<result property="warningId" column="warning_id" />
|
|
|
|
<result property="userName" column="user_name" />
|
|
|
|
<result property="userId" column="user_id" />
|
|
|
|
<result property="deptName" column="dept_name" />
|
|
|
|
<result property="age" column="age" />
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectMineHealthVo">
|
|
|
|
SELECT
|
|
|
|
mh.id,
|
|
|
|
mh.bp_high,
|
|
|
|
mh.bp_low,
|
|
|
|
mh.br,
|
|
|
|
mh.hr,
|
|
|
|
mh.hrv,
|
|
|
|
mh.temperature,
|
|
|
|
mh.is_work,
|
|
|
|
mh.create_time,
|
|
|
|
mh.user_id,
|
|
|
|
mh.user_name,
|
|
|
|
mh.warning_id,
|
|
|
|
mf.face_name,
|
|
|
|
mf.face_phone ,
|
|
|
|
FLOOR(TIMESTAMPDIFF(MONTH,mf.birth_date , SYSDATE()) / 12) AS age ,
|
|
|
|
mf.dept_id,
|
|
|
|
d.dept_name
|
|
|
|
FROM
|
|
|
|
mine_health mh
|
|
|
|
INNER JOIN mine_face mf
|
|
|
|
on mf.id =mh.face_id
|
|
|
|
inner join sys_dept d
|
|
|
|
on d.dept_id =mf.dept_id
|
|
|
|
</sql>
|
|
|
|
<select id="selectMineHealthList" parameterType="mineHealthVo" resultMap="MineHealthResult">
|
|
|
|
<include refid="selectMineHealthVo"/>
|
|
|
|
<where>
|
|
|
|
<if test="deptName != null and deptName != ''"> and d.dept_name like concat('%', #{deptName}, '%')</if>
|
|
|
|
<if test="deptId != null "> and d.dept_id = #{deptId}</if>
|
|
|
|
<if test="faceName != null and faceName != ''"> and mf.face_name like concat('%', #{faceName}, '%')</if>
|
|
|
|
<if test="bpHigh != null "> and mh.bp_high = #{bpHigh}</if>
|
|
|
|
<if test="bpLow != null "> and mh.bp_low = #{bpLow}</if>
|
|
|
|
<if test="br != null "> and mh.br = #{br}</if>
|
|
|
|
<if test="hr != null "> and mh.hr = #{hr}</if>
|
|
|
|
<if test="hrv != null "> and mh.hrv = #{hrv}</if>
|
|
|
|
<if test="userId != null "> and mh.user_id = #{userId}</if>
|
|
|
|
<if test="userName != null and userName != ''"> and mh.user_name like concat('%', #{userName}, '%')</if>
|
|
|
|
<if test="warningId != null "> and mh.waring_id = #{warningId}</if>
|
|
|
|
<if test="temperature != null and temperature != ''"> and mh.temperature = #{temperature}</if>
|
|
|
|
<if test="isWork != null "> and mf.is_work = #{isWork}</if>
|
|
|
|
</where>
|
|
|
|
order by mh.user_id,mh.create_time desc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectMineHealthById" parameterType="Long" resultMap="MineHealthResult">
|
|
|
|
<include refid="selectMineHealthVo"/>
|
|
|
|
where mh.id = #{id}
|
|
|
|
</select>
|
|
|
|
<select id="selectMineHealthByList" resultMap="MineHealthResult">
|
|
|
|
<include refid="selectMineHealthVo"/>
|
|
|
|
<where>
|
|
|
|
<if test="mineGroupName != null and mineGroupName != ''"> and mg.mine_group_name like concat('%', #{mineGroupName}, '%')</if>
|
|
|
|
<if test="faceName != null and faceName != ''"> and mf.face_name like concat('%', #{faceName}, '%')</if>
|
|
|
|
<if test="bpHigh != null "> and mh.bp_high = #{bpHigh}</if>
|
|
|
|
<if test="bpLow != null "> and mh.bp_low = #{bpLow}</if>
|
|
|
|
<if test="br != null "> and mh.br = #{br}</if>
|
|
|
|
<if test="hr != null "> and mh.hr = #{hr}</if>
|
|
|
|
<if test="hrv != null "> and mh.hrv = #{hrv}</if>
|
|
|
|
<if test="userId != null "> and mh.user_id = #{userId}</if>
|
|
|
|
<if test="warningId != null "> and mh.waring_id = #{warningId}</if>
|
|
|
|
<if test="temperature != null and temperature != ''"> and mh.temperature = #{temperature}</if>
|
|
|
|
<if test="isWork != null "> and mf.is_work = #{isWork}</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<insert id="insertMineHealth" parameterType="MineHealth" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
insert into mine_health
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="bpHigh != null">bp_high,</if>
|
|
|
|
<if test="bpLow != null">bp_low,</if>
|
|
|
|
<if test="br != null">br,</if>
|
|
|
|
<if test="hr != null">hr,</if>
|
|
|
|
<if test="userId != null "> user_id,</if>
|
|
|
|
<if test="faceId != null">face_id,</if>
|
|
|
|
<if test="warningId != null">warning_id,</if>
|
|
|
|
<if test="hrv != null">hrv,</if>
|
|
|
|
<if test="temperature != null">temperature,</if>
|
|
|
|
<if test="isWork != null">is_work,</if>
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="bpHigh != null">#{bpHigh},</if>
|
|
|
|
<if test="bpLow != null">#{bpLow},</if>
|
|
|
|
<if test="br != null">#{br},</if>
|
|
|
|
<if test="hr != null">#{hr},</if>
|
|
|
|
<if test="userId != null "> #{userId},</if>
|
|
|
|
<if test="faceId != null">#{faceId},</if>
|
|
|
|
<if test="warningId != null">#{warningId},</if>
|
|
|
|
<if test="hrv != null">#{hrv},</if>
|
|
|
|
<if test="temperature != null">#{temperature},</if>
|
|
|
|
<if test="isWork != null">#{isWork},</if>
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateMineHealth" parameterType="MineHealth">
|
|
|
|
update mine_health
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="faceId != null">face_id=#{faceId}</if>
|
|
|
|
<if test="bpHigh != null">bp_high = #{bpHigh},</if>
|
|
|
|
<if test="bpLow != null">bp_low = #{bpLow},</if>
|
|
|
|
<if test="br != null">br = #{br},</if>
|
|
|
|
<if test="hr != null">hr = #{hr},</if>
|
|
|
|
<if test="hrv != null">hrv = #{hrv},</if>
|
|
|
|
<if test="temperature != null">temperature = #{temperature},</if>
|
|
|
|
<if test="isWork != null">is_work = #{isWork},</if>
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
</trim>
|
|
|
|
where id = #{id}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteMineHealthById" parameterType="Long">
|
|
|
|
delete from mine_health where id = #{id}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteMineHealthByIds" parameterType="String">
|
|
|
|
delete from mine_health where id in
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
</mapper>
|