<?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.yuanchu.limslaboratory.mapper.WorkMapper">
|
<!--责任人项目数统计-->
|
<select id="dutyMater" resultType="java.util.Map">
|
select n.name, unfinish, finsh
|
from (select distinct user.name, count(inspection_product.id) unfinish
|
from lims_laboratory.inspection_product
|
left join lims_laboratory.user on inspection_product.user_pro_id = user.id
|
where inspection_product.state = 1
|
and test_state is null
|
and inspection_product.inspection_material_id in
|
(select id
|
from lims_laboratory.inspection_material
|
where inspection_material.state = 1
|
and inspection_id in
|
(select id
|
from lims_laboratory.inspection
|
where inspection.state = 1
|
and type = #{type}
|
and start_time between #{startTime} and #{endTime}))
|
group by user.name) n,
|
(select distinct user.name, count(inspection_product.id) finsh
|
from lims_laboratory.inspection_product
|
left join lims_laboratory.user on inspection_product.user_pro_id = user.id
|
where inspection_product.state = 1
|
and test_state is not null
|
and inspection_product.inspection_material_id in
|
(select id
|
from lims_laboratory.inspection_material
|
where inspection_material.state = 1
|
and inspection_id in
|
(select id
|
from lims_laboratory.inspection
|
where inspection.state = 1
|
and type = #{type}
|
and start_time between #{startTime} and #{endTime}))
|
group by user.name) y
|
where n.name = y.name
|
</select>
|
|
<!--执行人项目数统计-->
|
<select id="executeMater" resultType="java.util.Map">
|
select n.name, unfinsh, finsh
|
from (select distinct user.name, count(inspection_product.id) unfinsh
|
from lims_laboratory.inspection_product
|
left join lims_laboratory.user on inspection_product.user_id = user.id
|
where inspection_product.state = 1
|
and test_state is null
|
and inspection_product.inspection_material_id in
|
(select id
|
from lims_laboratory.inspection_material
|
where inspection_material.state = 1
|
and inspection_id in
|
(select id
|
from lims_laboratory.inspection
|
where inspection.state = 1
|
and type = #{type}
|
and start_time between #{startTime} and #{endTime}))
|
group by user.name) n,
|
(select distinct user.name, count(inspection_product.id) finsh
|
from lims_laboratory.inspection_product
|
left join lims_laboratory.user on inspection_product.user_id = user.id
|
where inspection_product.state = 1
|
and test_state is not null
|
and inspection_product.inspection_material_id in
|
(select id
|
from lims_laboratory.inspection_material
|
where inspection_material.state = 1
|
and inspection_id in
|
(select id
|
from lims_laboratory.inspection
|
where inspection.state = 1
|
and type = #{type}
|
and start_time between #{startTime} and #{endTime}))
|
group by user.name) y
|
where n.name = y.name
|
</select>
|
|
<!--责任人执行率-->
|
<select id="dutytimely" resultType="java.util.Map">
|
select n.name, total, finshByTime / total * 100 timely
|
from (select distinct user.name, count(inspection_product.id) total
|
from lims_laboratory.inspection_product
|
left join lims_laboratory.user on inspection_product.user_pro_id = user.id
|
where inspection_product.state = 1
|
and inspection_product.inspection_material_id in
|
(select id
|
from lims_laboratory.inspection_material
|
where inspection_material.state = 1
|
and inspection_id in
|
(select id
|
from lims_laboratory.inspection
|
where inspection.state = 1
|
and type = #{type}
|
and start_time between #{startTime} and #{endTime}))
|
group by user.name) n,
|
(select distinct user.name, count(inspection_product.id) finshByTime
|
from lims_laboratory.inspection_product
|
left join lims_laboratory.user
|
on inspection_product.user_pro_id = user.id
|
left join lims_laboratory.inspection_material im
|
on inspection_product.inspection_material_id = im.id
|
left join lims_laboratory.inspection
|
on im.inspection_id = inspection.id
|
where inspection_product.state = 1
|
and test_state is not null
|
and inspection_product.update_time between start_time and end_time
|
and inspection_product.inspection_material_id in
|
(select id
|
from lims_laboratory.inspection_material
|
where inspection_material.state = 1
|
and inspection_id in
|
(select id
|
from inspection
|
where inspection.state = 1
|
and type = #{type}
|
and start_time between #{startTime} and #{endTime}))
|
group by user.name) y
|
where n.name = y.name
|
</select>
|
|
<!--执行人及时率-->
|
<select id="executetimely" resultType="java.util.Map">
|
select n.name, total, finshByTime / total * 100 timely
|
from (select distinct user.name, count(inspection_product.id) total
|
from lims_laboratory.inspection_product
|
left join lims_laboratory.user on inspection_product.user_id = user.id
|
where inspection_product.state = 1
|
and inspection_product.inspection_material_id in
|
(select id
|
from lims_laboratory.inspection_material
|
where inspection_material.state = 1
|
and inspection_id in
|
(select id
|
from lims_laboratory.inspection
|
where inspection.state = 1
|
and type = #{type}
|
and start_time between #{startTime} and #{endTime}))
|
group by user.name) n,
|
(select distinct user.name, count(inspection_product.id) finshByTime
|
from lims_laboratory.inspection_product
|
left join lims_laboratory.user
|
on inspection_product.user_id = user.id
|
left join lims_laboratory.inspection_material im
|
on inspection_product.inspection_material_id = im.id
|
left join lims_laboratory.inspection
|
on im.inspection_id = inspection.id
|
where inspection_product.state = 1
|
and test_state is not null
|
and inspection_product.update_time between start_time and end_time
|
and inspection_product.inspection_material_id in
|
(select id
|
from lims_laboratory.inspection_material
|
where inspection_material.state = 1
|
and inspection_id in
|
(select id
|
from inspection
|
where inspection.state = 1
|
and type = #{type}
|
and start_time between #{startTime} and #{endTime}))
|
group by user.name) y
|
where n.name = y.name
|
</select>
|
</mapper>
|