zss
2023-08-22 59ae18f04a602bdfdc91299bbe2ff74a2ae1d215
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?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.InspectionMapper">
    <select id="selectInspectsList" resultType="map">
        select i.id,
        i.code icode,
        type,
        DATE_FORMAT(`form_time`,'%Y-%m-%d'),
        supplier,
        im.code mcode,
        im.name,
        specifications,
        unit,
        num,
        DATE_FORMAT(i.`create_time`,'%Y-%m-%d'),
        u.name userName,
        inspection_status,
        DATE_FORMAT(i.`start_time`,'%Y-%m-%d'),
        DATE_FORMAT(i.`end_time`,'%Y-%m-%d')
        from lims_laboratory.inspection i
        join lims_laboratory.user u on i.user_id = u.id
        join lims_laboratory.inspection_material im on i.id = im.inspection_id
        where i.state=1
        <if test="message!=null">
            and i.code like concat('%', #{message}, '%')
            or im.name like concat('%', #{message}, '%')
        </if>
    </select>
 
    <!--计算检验的检验单数量-->
    <select id="seleCountIns" resultType="java.lang.Integer">
        select count(id)
        from lims_laboratory.inspection
        where state = 1
          and inspection_status in (0, 1)
    </select>
 
    <!--计算未检验的检验单数量-->
    <select id="seleCountUnIns" resultType="java.lang.Integer">
        select count(id)
        from lims_laboratory.inspection
        where state = 1
          and inspection_status is null
    </select>
 
    <!--获取检验单总数-->
    <select id="getcount" resultType="java.lang.Integer">
        select count(id)
        from lims_laboratory.inspection
        where state = 1
    </select>
 
    <!--检验结论,检验数量-->
    <select id="getResultNum" resultType="java.util.Map">
        select inspection_status result,
               count(id)         num
        from lims_laboratory.inspection
        where state=1
        group by result
        order by num desc
    </select>
</mapper>