bug
luoyisheng
2025-02-24 ccd758bcd9b357b365c28f62efde203faa83fb93
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?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.sinata.system.mapper.MwMicroEquipmentMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.sinata.system.domain.MwMicroEquipment">
        <id column="ID" property="id" />
        <result column="DEL_FLAG" property="delFlag" />
        <result column="CREATE_BY" property="createBy" />
        <result column="CREATE_TIME" property="createTime" />
        <result column="UPDATE_BY" property="updateBy" />
        <result column="UPDATE_TIME" property="updateTime" />
        <result column="DEPARTMENT_ID" property="departmentId" />
        <result column="EQUIPMENT_NAME" property="equipmentName" />
        <result column="EQUIPMENT_NUMBER" property="equipmentNumber" />
        <result column="STATUS" property="status" />
        <result column="REMARK" property="remark" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        DEL_FLAG,
        CREATE_BY,
        CREATE_TIME,
        UPDATE_BY,
        UPDATE_TIME,
        ID, DEPARTMENT_ID, EQUIPMENT_NAME, EQUIPMENT_NUMBER, STATUS, REMARK
    </sql>
    <select id="pageList" resultType="com.sinata.system.domain.vo.MwMicroEquipmentVO">
        SELECT mme.ID,
        mme.DEPARTMENT_ID,
        mme.EQUIPMENT_NAME,
        mme.EQUIPMENT_NUMBER,
        mme.STATUS,
        mme.REMARK,
        mme.RELATION,
        SD.DEPARTMENT_NAME AS hospitalName
        FROM MW_MICRO_EQUIPMENT mme
        LEFT JOIN SYS_DEPARTMENT sd ON SD.ID = mme.DEPARTMENT_ID
        <where>
            mme.DEL_FLAG = 0
            <if test="treeCode != null and treeCode != ''">
                AND sd.TREE_CODE LIKE concat(#{treeCode}, '%')
            </if>
            <if test="equipmentName != null and equipmentName != ''">
                AND mme.EQUIPMENT_NAME LIKE concat('%',#{equipmentName},'%')
            </if>
            <if test="equipmentNumber != null and equipmentNumber != ''">
                AND mme.EQUIPMENT_NUMBER LIKE concat('%',#{equipmentNumber},'%')
            </if>
            <if test="status!= null">
                AND mme.STATUS = #{status}
            </if>
        </where>
        ORDER BY mme.CREATE_TIME DESC
    </select>
    <select id="storedMedicalWastePage" resultType="com.sinata.system.domain.vo.MwMedicalWasteBoxVO">
        SELECT mcr.BOX_ID AS id,
        mcr.HOSPITAL_NAME,
        mcr.MEDICAL_WASTE_NUMBER,
        mcr.BOX_NUMBER,
        mcr.WASTE_TYPE_STR,
        mcr.COLLECT_TIME,
        su.NICK_NAME AS COLLECT_USER_NAME,
        msr.ROOM_NAME,
        COUNT(*) AS bagNum,
        SUM(mcr.WEIGHT) AS totalWeight
        FROM MW_COLLECT_RECORD mcr
        LEFT JOIN SYS_USER su
        ON mcr.COLLECT_USER_ID = su.USER_ID
        LEFT JOIN SYS_DEPARTMENT sd ON su.DEPARTMENT_ID = sd.ID
        LEFT JOIN MW_STAGING_ROOM msr ON msr.ID = mcr.STAGING_ROOM_ID
        <where>
            mcr.STATUS = 1 AND mcr.DEL_FLAG = 0
            <if test="treeCode != null and treeCode != ''">
                and sd.TREE_CODE like concat(#{treeCode},'%')
            </if>
            <if test="query.stagingRoomId != null and query.stagingRoomId != ''">
                and mcr.STAGING_ROOM_ID = #{query.stagingRoomId}
            </if>
            <if test="query.wasteType != null">
                and mcr.WASTE_TYPE = #{query.wasteType}
            </if>
            <if test="query.collectTimeStart != null and query.collectTimeEnd != null">
                and mcr.COLLECT_TIME between #{query.collectTimeStart} and #{query.collectTimeEnd}
            </if>
        </where>
        GROUP BY mcr.BOX_ID
        ORDER BY mcr.CREATE_TIME DESC
    </select>
 
</mapper>