|
@ -15,11 +15,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
<result property="temperature" column="temperature" /> |
|
|
<result property="temperature" column="temperature" /> |
|
|
<result property="isWork" column="is_work" /> |
|
|
<result property="isWork" column="is_work" /> |
|
|
<result property="createTime" column="create_time" /> |
|
|
<result property="createTime" column="create_time" /> |
|
|
<result property="mineGroupName" column="mine_group_name" /> |
|
|
|
|
|
<result property="faceName" column="face_name" /> |
|
|
<result property="faceName" column="face_name" /> |
|
|
<result property="facePhone" column="face_phone" /> |
|
|
<result property="facePhone" column="face_phone" /> |
|
|
<result property="age" column="age" /> |
|
|
<result property="age" column="age" /> |
|
|
<result property="groupId" column="group_id" /> |
|
|
|
|
|
</resultMap> |
|
|
</resultMap> |
|
|
|
|
|
|
|
|
<resultMap type="MineWarning" id="MineWarningUnResult"> |
|
|
<resultMap type="MineWarning" id="MineWarningUnResult"> |
|
@ -33,11 +31,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
<result property="temperature" column="temperature" /> |
|
|
<result property="temperature" column="temperature" /> |
|
|
<result property="isWork" column="is_work" /> |
|
|
<result property="isWork" column="is_work" /> |
|
|
<result property="createTime" column="create_time" /> |
|
|
<result property="createTime" column="create_time" /> |
|
|
<result property="mineGroupName" column="mine_group_name" /> |
|
|
|
|
|
<result property="faceName" column="face_name" /> |
|
|
<result property="faceName" column="face_name" /> |
|
|
<result property="facePhone" column="face_phone" /> |
|
|
<result property="facePhone" column="face_phone" /> |
|
|
<result property="age" column="age" /> |
|
|
<result property="age" column="age" /> |
|
|
<result property="groupId" column="group_id" /> |
|
|
|
|
|
</resultMap> |
|
|
</resultMap> |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -57,14 +54,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
mf.face_name, |
|
|
mf.face_name, |
|
|
mf.age, |
|
|
mf.age, |
|
|
mf.face_phone, |
|
|
mf.face_phone, |
|
|
mf.group_id, |
|
|
mf.dept_id, |
|
|
mg.mine_group_name |
|
|
d.dept_name |
|
|
FROM |
|
|
FROM |
|
|
mine_warning mw |
|
|
mine_warning mw |
|
|
INNER JOIN mine_face mf |
|
|
INNER JOIN mine_face mf |
|
|
on mf.id =mw.face_id |
|
|
on mf.id =mw.face_id |
|
|
INNER JOIN mine_group mg |
|
|
inner join sys_dept d on mf.dept_id = d.dept_id |
|
|
on mg.id =mf.group_id |
|
|
|
|
|
</sql> |
|
|
</sql> |
|
|
<sql id="selectMineWarningMedicalVo"> |
|
|
<sql id="selectMineWarningMedicalVo"> |
|
|
SELECT |
|
|
SELECT |
|
@ -79,13 +75,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
mf.is_work, |
|
|
mf.is_work, |
|
|
mw.create_time, |
|
|
mw.create_time, |
|
|
mf.face_name, |
|
|
mf.face_name, |
|
|
mg.mine_group_name |
|
|
d.dept_name |
|
|
FROM |
|
|
FROM |
|
|
mine_warning mw |
|
|
mine_warning mw |
|
|
INNER JOIN mine_face mf |
|
|
INNER JOIN mine_face mf |
|
|
on mf.id =mw.face_id |
|
|
on mf.id =mw.face_id |
|
|
INNER JOIN mine_group mg |
|
|
inner join sys_dept d on mf.dept_id = d.dept_id |
|
|
on mg.id =mf.group_id |
|
|
|
|
|
</sql> |
|
|
</sql> |
|
|
<sql id="selectMineWarningList"> |
|
|
<sql id="selectMineWarningList"> |
|
|
SELECT |
|
|
SELECT |
|
@ -107,12 +102,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
<select id="selectMineWarningList" parameterType="MineWarning" resultMap="MineWarningResult"> |
|
|
<select id="selectMineWarningList" parameterType="MineWarning" resultMap="MineWarningResult"> |
|
|
<include refid="selectMineWarningVo"/> |
|
|
<include refid="selectMineWarningVo"/> |
|
|
<where> |
|
|
<where> |
|
|
<if test="mineGroupName != null and mineGroupName != ''"> and mg.mine_group_name like concat('%', #{mineGroupName}, '%')</if> |
|
|
<if test="deptName != null and deptName != ''"> and d.dept_name like concat('%', #{deptName}, '%')</if> |
|
|
<if test="faceName != null and faceName != ''"> and mf.face_name like concat('%', #{faceName}, '%')</if> |
|
|
<if test="faceName != null and faceName != ''"> and mf.face_name like concat('%', #{faceName}, '%')</if> |
|
|
<if test="groupId != null "> and mf.group_id =#{groupId}</if> |
|
|
|
|
|
<if test="bpHigh != null "> and mw.bp_high = #{bpHigh}</if> |
|
|
<if test="bpHigh != null "> and mw.bp_high = #{bpHigh}</if> |
|
|
<if test="bpLow != null "> and mw.bp_low = #{bpLow}</if> |
|
|
<if test="bpLow != null "> and mw.bp_low = #{bpLow}</if> |
|
|
<if test="groupId != null "> and mg.id = #{groupId}</if> |
|
|
<if test="deptId != null "> and d.dept_id = #{deptId}</if> |
|
|
<if test="br != null "> and mw.br = #{br}</if> |
|
|
<if test="br != null "> and mw.br = #{br}</if> |
|
|
<if test="hr != null "> and mw.hr = #{hr}</if> |
|
|
<if test="hr != null "> and mw.hr = #{hr}</if> |
|
|
<if test="hrv != null "> and mw.hrv = #{hrv}</if> |
|
|
<if test="hrv != null "> and mw.hrv = #{hrv}</if> |
|
@ -160,18 +154,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
mf.is_work, |
|
|
mf.is_work, |
|
|
mw.create_time, |
|
|
mw.create_time, |
|
|
mf.face_name, |
|
|
mf.face_name, |
|
|
mg.mine_group_name, |
|
|
d.dept_name, |
|
|
ROW_NUMBER() OVER (PARTITION BY mf.face_name ORDER BY mw.create_time DESC) AS rn |
|
|
ROW_NUMBER() OVER (PARTITION BY mf.face_name ORDER BY mw.create_time DESC) AS rn |
|
|
FROM |
|
|
FROM |
|
|
mine_warning mw |
|
|
mine_warning mw |
|
|
INNER JOIN mine_face mf ON mf.id = mw.face_id |
|
|
INNER JOIN mine_face mf ON mf.id = mw.face_id |
|
|
INNER JOIN mine_group mg ON mg.id = mf.group_id |
|
|
inner join sys_dept d on mf.dept_id = d.dept_id |
|
|
<where> |
|
|
<where> |
|
|
<if test="mineGroupName != null and mineGroupName != ''"> and mg.mine_group_name like concat('%', #{mineGroupName}, '%')</if> |
|
|
<if test="deptName != null and deptName != ''"> and d.dept_name like concat('%', #{deptName}, '%')</if> |
|
|
<if test="faceName != null and faceName != ''"> and mf.face_name like concat('%', #{faceName}, '%')</if> |
|
|
<if test="faceName != null and faceName != ''"> and mf.face_name like concat('%', #{faceName}, '%')</if> |
|
|
<if test="bpHigh != null "> and mw.bp_high = #{bpHigh}</if> |
|
|
<if test="bpHigh != null "> and mw.bp_high = #{bpHigh}</if> |
|
|
<if test="bpLow != null "> and mw.bp_low = #{bpLow}</if> |
|
|
<if test="bpLow != null "> and mw.bp_low = #{bpLow}</if> |
|
|
<if test="groupId != null "> and mg.id = #{groupId}</if> |
|
|
<if test="deptId != null "> and d.dept_id = #{deptId}</if> |
|
|
<if test="br != null "> and mw.br = #{br}</if> |
|
|
<if test="br != null "> and mw.br = #{br}</if> |
|
|
<if test="hr != null "> and mw.hr = #{hr}</if> |
|
|
<if test="hr != null "> and mw.hr = #{hr}</if> |
|
|
<if test="hrv != null "> and mw.hrv = #{hrv}</if> |
|
|
<if test="hrv != null "> and mw.hrv = #{hrv}</if> |
|
@ -197,7 +191,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
is_work as isWork, |
|
|
is_work as isWork, |
|
|
create_time as createTime, |
|
|
create_time as createTime, |
|
|
face_name as faceName, |
|
|
face_name as faceName, |
|
|
mine_group_name as mineGroupName |
|
|
dept_name as deptName |
|
|
FROM |
|
|
FROM |
|
|
RankedWarnings |
|
|
RankedWarnings |
|
|
WHERE |
|
|
WHERE |
|
@ -206,20 +200,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
</select> |
|
|
</select> |
|
|
<select id="selectMineWarningStatisticList" resultType="yq.system.domain.vo.StatisticVo"> |
|
|
<select id="selectMineWarningStatisticList" resultType="yq.system.domain.vo.StatisticVo"> |
|
|
SELECT |
|
|
SELECT |
|
|
mg.mine_group_name AS mineGroupName, |
|
|
d.dept_name AS deptName, |
|
|
COUNT(DISTINCT CASE WHEN mw.create_time IS NOT NULL THEN mf.id END) AS clock, -- 统计已打卡的人数 |
|
|
COUNT(DISTINCT CASE WHEN mw.create_time IS NOT NULL THEN mf.id END) AS clock, -- 统计已打卡的人数 |
|
|
COUNT(DISTINCT CASE WHEN mw.create_time IS NULL THEN mf.id END) AS unClock , -- 统计未打卡的人数 |
|
|
COUNT(DISTINCT CASE WHEN mw.create_time IS NULL THEN mf.id END) AS unClock , -- 统计未打卡的人数 |
|
|
GROUP_CONCAT(CASE WHEN mw.create_time IS NULL THEN mf.face_name END) AS unClockNames -- 统计未打卡的人员名称 |
|
|
GROUP_CONCAT(CASE WHEN mw.create_time IS NULL THEN mf.face_name END) AS unClockNames -- 统计未打卡的人员名称 |
|
|
FROM |
|
|
FROM |
|
|
mine_group mg |
|
|
sys_dept d |
|
|
LEFT JOIN mine_face mf ON mg.id = mf.group_id |
|
|
inner JOIN mine_face mf ON d.dept_id = mf.dept_id |
|
|
LEFT JOIN mine_warning mw ON mw.face_id = mf.id |
|
|
LEFT JOIN mine_warning mw ON mw.face_id = mf.id |
|
|
<if test="search == '今日' "> AND DATE(mw.create_time) = CURDATE() </if> |
|
|
<if test="search == '今日' "> AND DATE(mw.create_time) = CURDATE() </if> |
|
|
<if test="search == '7天' "> AND mw.create_time >= CURDATE() - INTERVAL 7 DAY -- 过去7天内的打卡记录 </if> |
|
|
<if test="search == '7天' "> AND mw.create_time >= CURDATE() - INTERVAL 7 DAY -- 过去7天内的打卡记录 </if> |
|
|
<if test="search == '30天' "> AND DATE(mw.create_time) = CURDATE() - INTERVAL 1 MONTH </if> |
|
|
<if test="search == '30天' "> AND DATE(mw.create_time) = CURDATE() - INTERVAL 1 MONTH </if> |
|
|
|
|
|
|
|
|
GROUP BY |
|
|
GROUP BY |
|
|
mg.dept_id, mg.id; |
|
|
d.dept_id |
|
|
|
|
|
order by d.dept_name |
|
|
</select> |
|
|
</select> |
|
|
<select id="selectMineWarningUnMedicalList" resultMap="MineWarningResult"> |
|
|
<select id="selectMineWarningUnMedicalList" resultMap="MineWarningResult"> |
|
|
select mw.id, |
|
|
select mw.id, |
|
@ -233,11 +228,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
mw.is_work, |
|
|
mw.is_work, |
|
|
mw.create_time, |
|
|
mw.create_time, |
|
|
mf.face_name, |
|
|
mf.face_name, |
|
|
mg.mine_group_name |
|
|
d.dept_name |
|
|
from mine_warning mw |
|
|
from mine_warning mw |
|
|
INNER join mine_health mh on mw.id =mh.warning_id |
|
|
INNER join mine_health mh on mw.id =mh.warning_id |
|
|
INNER JOIN mine_face mf ON mf.id = mw.face_id |
|
|
INNER JOIN mine_face mf ON mf.id = mw.face_id |
|
|
INNER JOIN mine_group mg ON mg.id = mf.group_id |
|
|
inner join sys_dept d on mf.dept_id = d.dept_id |
|
|
|
|
|
</select> |
|
|
|
|
|
<select id="selectMineWarningNormalList" resultType="yq.system.domain.vo.NormalCountVo"> |
|
|
|
|
|
SELECT |
|
|
|
|
|
d.dept_name AS deptName, -- 部门名称 |
|
|
|
|
|
COUNT(DISTINCT CASE WHEN valid_count = total_count THEN mf.id END) AS normalCount, -- 正常人数(is_word = 0 的次数 = 总打卡次数) |
|
|
|
|
|
COUNT(DISTINCT CASE WHEN valid_count != total_count THEN mf.id END) AS abnormalCount, -- 异常人数(is_word = 0 的次数 != 总打卡次数) |
|
|
|
|
|
COUNT(DISTINCT mf.id) AS totalCount, -- 小组总人数 |
|
|
|
|
|
ROUND(COUNT(DISTINCT CASE WHEN valid_count = total_count THEN mf.id END) * 100.0 / COUNT(DISTINCT mf.id), 2) AS normalPercentage, -- 正常人数占比 |
|
|
|
|
|
ROUND(COUNT(DISTINCT CASE WHEN valid_count != total_count THEN mf.id END) * 100.0 / COUNT(DISTINCT mf.id), 2) AS abnormalPercentage, -- 异常人数占比 |
|
|
|
|
|
GROUP_CONCAT(DISTINCT CASE WHEN valid_count != total_count THEN mf.face_name END) AS abnormalNmaes -- 显示异常人员的姓名(假设是mf.name字段) |
|
|
|
|
|
FROM |
|
|
|
|
|
sys_dept d |
|
|
|
|
|
INNER JOIN |
|
|
|
|
|
mine_face mf ON d.dept_id = mf.dept_id -- 连接部门和员工 |
|
|
|
|
|
LEFT JOIN ( |
|
|
|
|
|
SELECT |
|
|
|
|
|
mw.face_id, |
|
|
|
|
|
COUNT(mw.id) AS total_count, -- 计算每个员工的打卡总次数 |
|
|
|
|
|
SUM(CASE WHEN mw.is_work = 1 THEN 1 ELSE 0 END) AS valid_count -- 计算is_word = 0的次数(正常打卡次数) |
|
|
|
|
|
FROM |
|
|
|
|
|
mine_warning mw |
|
|
|
|
|
<where> |
|
|
|
|
|
<if test="search == '今日' "> AND DATE(mw.create_time) = CURDATE() </if> |
|
|
|
|
|
<if test="search == '7天' "> AND mw.create_time >= CURDATE() - INTERVAL 7 DAY -- 过去7天内的打卡记录 </if> |
|
|
|
|
|
<if test="search == '30天' "> AND DATE(mw.create_time) = CURDATE() - INTERVAL 1 MONTH </if> |
|
|
|
|
|
</where> |
|
|
|
|
|
GROUP BY |
|
|
|
|
|
mw.face_id -- 按员工分组,统计每个员工的打卡次数 |
|
|
|
|
|
) AS card_info ON card_info.face_id = mf.id -- 连接打卡信息 |
|
|
|
|
|
GROUP BY |
|
|
|
|
|
d.dept_id -- 按部门分组 |
|
|
|
|
|
ORDER BY |
|
|
|
|
|
d.dept_name; |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<insert id="insertMineWarning" parameterType="MineWarning" useGeneratedKeys="true" keyProperty="id"> |
|
|
<insert id="insertMineWarning" parameterType="MineWarning" useGeneratedKeys="true" keyProperty="id"> |
|
|