医院废弃物信息化管理平台
“mitao”
2025-12-24 3763145f34d7706923d55edc32f5cfbc8bc08b92
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?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="cn.besteam.modules.system.mapper.SysDepartmentMapper">
 
 
<select id="queryDepartmentPageList" resultType="cn.besteam.modules.system.vo.SysDepartmentVO">
    SELECT
    c.id as hospitalId,
    c.parent_id AS parentId,
    c.depart_name AS hospitalName ,
    c.select_switch as selectSwitch,
    c.checkall_switch as checkallSwitch,
    c.signature_switch as signatureSwitch,
    c.bluetooth_print_switch as bluetoothPrintSwitch,
    c.bluetooth_weigh_switch as bluetoothWeighSwitch,
    c.environmental_handover_switch as environmentalHandoverSwitch,
    c.outbound_weighing_switch as outboundWeighingSwitch,
    c.outbound_printing_switch as outboundPrintingSwitch,
    c.chip_box_switch as chipBoxSwitch
    FROM
    sys_department c
    <where>
        and org_type  = 2
        <if test="dto.departmentIdList != null and dto.departmentIdList.size > 0 ">
            and c.id in
            <foreach collection="dto.departmentIdList" item="tempId" open="(" close=")" separator=",">
                #{tempId}
            </foreach>
        </if>
        <if test="dto.selectSwitch!=null">
            and c.select_switch = #{dto.selectSwitch}
        </if>
        <if test="dto.checkallSwitch!=null">
            and c.checkall_switch = #{dto.checkallSwitch}
        </if>
        <if test="dto.signatureSwitch!=null">
            and c.signature_switch = #{dto.signatureSwitch}
        </if>
        <if test="dto.environmentalHandoverSwitch!=null">
            and c.environmental_handover_switch = #{dto.environmentalHandoverSwitch}
        </if>
        <if test="dto.outboundWeighingSwitch!=null">
            and c.outbound_weighing_switch = #{dto.outboundWeighingSwitch}
        </if>
        <if test="dto.outboundPrintingSwitch!=null">
            and c.outbound_printing_switch = #{dto.outboundPrintingSwitch}
        </if>
        <if test="dto.chipBoxSwitch!=null">
            and c.chip_box_switch = #{dto.chipBoxSwitch}
        </if>
    </where>
    order by c.create_time desc
    </select>
 
 
 
    <select id="getCollectAppletAuthorization" resultType="cn.besteam.modules.system.vo.CollectAppletAuthorizationListVO">
        select
        a.id,
        CONCAT(g.depart_name, '/', f.depart_name, '/', e.depart_name) as area,
        a.depart_name as hospital,
        a.applet_switch as appletSwitch,
        DATE_FORMAT(a.applet_operate_time, '%Y-%m-%d %H:%i:%s') as appletOperateTime,
        b.`name` as appletOperateUser
        from sys_department a
        left join sys_user b on (a.applet_operate_user = b.id)
        left join sys_department e on(a.parent_id = e.id)
        left join sys_department f on(e.parent_id = f.id)
        left join sys_department g on(f.parent_id = g.id)
        where a.status = 1 and a.del_flag = 0 and a.org_type = 2
        and a.id in
         <foreach collection="ids" separator="," open="(" item="id" index="index" close=")">
               #{id}
         </foreach>
        <if test="null != vo.auth">
            and a.applet_switch = #{vo.auth}
        </if>
        order by a.id
    </select>
 
 
    <update id="batchEditCollectAppletAuthorization">
        update sys_department set applet_switch = #{status}, applet_operate_user = #{userId}, applet_operate_time = now()
        where status = 1 and del_flag = 0 and org_type = 2 and id in
        <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </update>
 
 
    <select id="getMonthlySmsAuthorization" resultType="cn.besteam.modules.system.vo.MonthlySmsAuthorizationListVO">
        select
        a.id,
        CONCAT(e.depart_name, '/', d.depart_name, '/', c.depart_name) as area,
        a.depart_name as hospital,
        a.sms_switch as smsSwitch,
        DATE_FORMAT(a.sms_operate_time, '%Y-%m-%d %H:%i:%s') as smsOperateTime,
        b.`name` as smsOperateUser
        from sys_department a
        left join sys_user b on (a.sms_operate_user = b.id)
        left join sys_department c on(a.parent_id = c.id)
        left join sys_department d on(c.parent_id = d.id)
        left join sys_department e on(d.parent_id = e.id)
        where a.status = 1 and a.del_flag = 0 and a.org_type = 2
        <if test="null != vo.id">
            and a.id = #{vo.id}
        </if>
        <if test="null != vo.smsSwitch">
            and a.sms_switch = #{vo.smsSwitch}
        </if>
        order by a.id
    </select>
 
 
    <update id="batchEditMonthlySmsAuthorization">
        update sys_department set sms_switch = #{status}, sms_operate_user = #{userId}, sms_operate_time = now()
        where status = 1 and del_flag = 0 and org_type = 2 and id in
        <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </update>
 
 
    <select id="getMonthlySMSHospitalData" resultType="map">
        select
        a.id,
        a.depart_name as hospital,
        c.work_leader_linkphone as phone
        from sys_department a
        left join sys_department_information c on (a.id = c.department_id)
        where a.org_type = 2 and a.`status` = 1 and a.del_flag = 0 and a.sms_switch = 1 and c.work_leader_linkphone is not null
        and c.work_leader_linkphone != ''
    </select>
 
    <select id="getMonthlySMSData" resultType="map">
        select
        waste_type as wasteType,
        sum(weight) as weight
        from mw_collect_record
        where audit_status = 2 and del_flag = 0 and DATE_FORMAT(create_time, '%Y-%m') = #{month}
        and hospital_id = #{id} and `status` = #{status} group by waste_type
    </select>
  <select id="getDeptIdListByTreeCode" resultType="java.lang.Integer"
    parameterType="java.lang.String">
      SELECT
          id
      FROM
          sys_department
      WHERE
          del_flag = 0
        AND (
          tree_code LIKE CONCAT(#{treeCode},'%'))
  </select>
    <!-- 科室列表分页查询 -->
    <select id="queryOfficePageList" resultType="cn.besteam.modules.system.vo.SysDepartmentOfficeVO">
        SELECT
        d.id,
        d.parent_id as parentId,
        d.depart_name as departName,
        d.department_location as departmentLocation,
        d.bed_count as bedCount,
        d.waste_threshold as wasteThreshold,
        d.tree_code as treeCode,
        d.status,
        DATE_FORMAT(d.create_time, '%Y-%m-%d %H:%i:%s') as createTime,
        DATE_FORMAT(d.update_time, '%Y-%m-%d %H:%i:%s') as updateTime
        FROM sys_department d
        WHERE d.del_flag = 0
        AND d.org_type = 4
        <if test="treeCode != null and treeCode != ''">
            AND d.tree_code LIKE CONCAT(#{treeCode},'%')
        </if>
        <if test="queryVO.departName != null and queryVO.departName != ''">
            AND d.depart_name LIKE CONCAT('%', #{queryVO.departName}, '%')
        </if>
        ORDER BY d.create_time DESC
    </select>
</mapper>