医院废弃物信息化管理平台
“mitao”
2026-04-21 2f18b3a28054c3917010f95ba84f7425280a2622
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
<?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.SysDepartmentInformationMapper">
 
    <!-- 查询角色列表 -->
    <select id="queryOne" resultType="cn.besteam.modules.system.vo.SysDepartmentInformationVO">
        SELECT
        id ,
        department_id as departmentId,
        department_name as departmentName,
        department_level as departmentLevel,
        department_type as departmentType,
        department_property as departmentProperty,
        department_address as departmentAddress,
        department_linkman as departmentLinkman,
        department_linkphone as departmentLinkphone,
        is_courts as isCourts,
        legal_representative as legalRepresentative,
        service_company as serviceCompany,
        service_linkman as serviceLinkman,
        service_linkphone as serviceLinkphone,
        one_warning_linkman as oneWarningLinkman,
        one_warning_linkphone as oneWarningLinkphone,
        two_warning_linkman as twoWarningLinkman,
        two_warning_linkphone as twoWarningLinkphone,
        leaders_specific_linkman as leadersSpecificLinkman,
        leaders_specific_phone as leadersSpecificPhone,
        work_leader_linkman as workLeaderLinkman,
        work_leader_linkphone as workLeaderLinkphone,
        update_by as updateBy,
        update_time as updateTime
        FROM
        sys_department_information
        <where>
          <if test="departmentId != null">
              and department_id  = #{departmentId}
          </if>
        </where>
    </select>
 
    <select id="queryOneCount" resultType="integer">
        SELECT
        count(1)
        FROM
        sys_department_information
        <where>
          <if test="departmentId != null">
              and department_id  = #{departmentId}
          </if>
        </where>
    </select>
    <!--根据区域获取医院基本信息-->
    <select id="getDepartmentInformationList" resultType="cn.besteam.modules.system.vo.SysDepartmentInformationReportVO">
        SELECT
            d.id as departmentId,
            d.depart_name as departmentName,
            d.create_time as createTime,
            i1.item_text as departmentLevel,
            i2.item_text as departmentType,
            i3.item_text as departmentProperty,
            d.tree_code as treeCode,
            i.is_courts as isCourts,
            case when i.is_courts=0 then '否' else '是' end as isCourtsStr
        FROM
            sys_department d
                LEFT JOIN sys_department_information i ON d.id = i.department_id
                LEFT JOIN sys_dict_item i1 ON i.department_level = i1.id
                LEFT JOIN sys_dict_item i2 ON i.department_type = i2.id
                LEFT JOIN sys_dict_item i3 ON i.department_property = i3.id
        WHERE
            org_type = 2
          AND d.del_flag = 0
          AND d.tree_code like concat(#{dto.treeCode} , '%')
        <!--<if test="dto.startTime !=null">
            <![CDATA[
                  and date_format( d.create_time, '%Y-%m-%d %H:%i:%s' ) >= date_format( #{dto.startTime} , '%Y-%m-%d %H:%i:%s' )
                ]]>
        </if>
        <if test="dto.endTime !=null">
            <![CDATA[
                  and date_format( d.create_time, '%Y-%m-%d %H:%i:%s' ) <= date_format( #{dto.endTime}   , '%Y-%m-%d %H:%i:%s' )
                ]]>
        </if>-->
        <if test="dto.departmentLevel != null">
            and i.department_level = #{dto.departmentLevel}
        </if>
        <if test="dto.departmentType != null">
            and i.department_type = #{dto.departmentType}
        </if>
        <if test="dto.departmentProperty != null">
            and i.department_property = #{dto.departmentProperty}
        </if>
        <if test="dto.isCourts != null">
            and i.is_courts = #{dto.isCourts}
        </if>
        order by d.create_time asc
    </select>
    <!--获取医院科室,有部门的科室数量-->
    <select id="getDepartmentNumber" resultType="map">
        SELECT
            count( 1 ) AS number,
            office_type AS officeType
        FROM
            sys_department d1
        WHERE
            d1.org_type = 4
          AND d1.del_flag = 0
          AND tree_code LIKE concat('%' , #{treeCode} , '%')
          AND d1.is_warehouse = 0
          AND d1.status = 1
        GROUP BY
            office_type UNION
        SELECT
            count( 1 ) AS number,
            0 AS officeType
        FROM
            sys_department d1
        WHERE
            d1.org_type = 4
          AND d1.del_flag = 0
          AND tree_code LIKE concat('%' , #{treeCode} , '%')
          AND d1.is_warehouse = 1
    </select>
</mapper>