zjh
2025-02-13 955a66eec02b8c3fde019110d9c1b604eac017e5
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<?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.ltkj.hosp.mapper.DictHospMapper">
 
    <resultMap type="DictHosp" id="DictHospResult">
        <result property="hospAreaId" column="hosp_area_id"/>
        <result property="hospAreaName" column="hosp_area_name"/>
        <result property="hospid" column="hospId"/>
        <result property="hospName" column="hosp_name"/>
        <result property="code" column="code"/>
        <result property="wbm" column="wbm"/>
        <result property="spell" column="spell"/>
        <result property="areaid" column="areaId"/>
        <result property="areaName" column="area_name"/>
        <result property="mainHospArea" column="main_hosp_area"/>
        <result property="principal" column="principal"/>
        <result property="phone" column="phone"/>
        <result property="plaitBed" column="plait_bed"/>
        <result property="openBed" column="open_bed"/>
        <result property="buildDate" column="build_date"/>
        <result property="remark" column="remark"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="orderNum" column="order_num"/>
        <result property="effective" column="effective"/>
        <result property="createByName" column="create_by_name"/>
        <result property="updateByName" column="update_by_name"/>
        <result property="imgbase64" column="imgBase64"/>
        <result property="deleted" column="deleted"/>
    </resultMap>
 
    <sql id="selectDictHospVo">
        select hosp_area_id,
               hosp_area_name,
               hospId,
               hosp_name,
               code,
               wbm,
               spell,
               areaId,
               area_name,
               main_hosp_area,
               principal,
               phone,
               plait_bed,
               open_bed,
               build_date,
               remark,
               create_by,
               create_time,
               update_by,
               update_time,
               order_num,
               effective,
               create_by_name,
               update_by_name,
               imgBase64,
               deleted
        from dict_hosp
    </sql>
 
    <select id="selectDictHospList" parameterType="DictHosp" resultMap="DictHospResult">
        <include refid="selectDictHospVo"/>
        <where>
            <if test="hospAreaName != null  and hospAreaName != ''">and hosp_area_name like concat('%', #{hospAreaName},
                '%')
            </if>
            <if test="hospid != null  and hospid != ''">and hospId = #{hospid}</if>
            <if test="hospName != null  and hospName != ''">and hosp_name like concat('%', #{hospName}, '%')</if>
            <if test="code != null  and code != ''">and code = #{code}</if>
            <if test="areaid != null  and areaid != ''">and areaId = #{areaid}</if>
            <if test="areaName != null  and areaName != ''">and area_name like concat('%', #{areaName}, '%')</if>
            <if test="mainHospArea != null  and mainHospArea != ''">and main_hosp_area = #{mainHospArea}</if>
            <if test="principal != null  and principal != ''">and principal = #{principal}</if>
            <if test="plaitBed != null ">and plait_bed = #{plaitBed}</if>
            <if test="openBed != null ">and open_bed = #{openBed}</if>
            <if test="orderNum != null ">and order_num = #{orderNum}</if>
        </where>
    </select>
 
    <select id="selectDictHospByHospAreaId" parameterType="String" resultMap="DictHospResult">
        <include refid="selectDictHospVo"/>
        where hosp_area_id = #{hospAreaId}
    </select>
 
    <insert id="insertDictHosp" parameterType="DictHosp">
        insert into dict_hosp
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="hospAreaId != null">hosp_area_id,</if>
            <if test="hospAreaName != null and hospAreaName != ''">hosp_area_name,</if>
            <if test="hospid != null and hospid != ''">hospId,</if>
            <if test="hospName != null and hospName != ''">hosp_name,</if>
            <if test="code != null and code != ''">code,</if>
            <if test="wbm != null">wbm,</if>
            <if test="spell != null">spell,</if>
            <if test="areaid != null">areaId,</if>
            <if test="areaName != null">area_name,</if>
            <if test="mainHospArea != null and mainHospArea != ''">main_hosp_area,</if>
            <if test="principal != null">principal,</if>
            <if test="phone != null">phone,</if>
            <if test="plaitBed != null">plait_bed,</if>
            <if test="openBed != null">open_bed,</if>
            <if test="buildDate != null">build_date,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null and createBy != ''">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="orderNum != null">order_num,</if>
            <if test="effective != null and effective != ''">effective,</if>
            <if test="createByName != null and createByName != ''">create_by_name,</if>
            <if test="updateByName != null and updateByName != ''">update_by_name,</if>
            <if test="imgbase64 != null">imgBase64,</if>
            <if test="deleted != null">deleted,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="hospAreaId != null">#{hospAreaId},</if>
            <if test="hospAreaName != null and hospAreaName != ''">#{hospAreaName},</if>
            <if test="hospid != null and hospid != ''">#{hospid},</if>
            <if test="hospName != null and hospName != ''">#{hospName},</if>
            <if test="code != null and code != ''">#{code},</if>
            <if test="wbm != null">#{wbm},</if>
            <if test="spell != null">#{spell},</if>
            <if test="areaid != null">#{areaid},</if>
            <if test="areaName != null">#{areaName},</if>
            <if test="mainHospArea != null and mainHospArea != ''">#{mainHospArea},</if>
            <if test="principal != null">#{principal},</if>
            <if test="phone != null">#{phone},</if>
            <if test="plaitBed != null">#{plaitBed},</if>
            <if test="openBed != null">#{openBed},</if>
            <if test="buildDate != null">#{buildDate},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null and createBy != ''">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="orderNum != null">#{orderNum},</if>
            <if test="effective != null and effective != ''">#{effective},</if>
            <if test="createByName != null and createByName != ''">#{createByName},</if>
            <if test="updateByName != null and updateByName != ''">#{updateByName},</if>
            <if test="imgbase64 != null">#{imgbase64},</if>
            <if test="deleted != null">#{deleted},</if>
        </trim>
    </insert>
 
    <update id="updateDictHosp" parameterType="DictHosp">
        update dict_hosp
        <trim prefix="SET" suffixOverrides=",">
            <if test="hospAreaName != null and hospAreaName != ''">hosp_area_name = #{hospAreaName},</if>
            <if test="hospid != null and hospid != ''">hospId = #{hospid},</if>
            <if test="hospName != null and hospName != ''">hosp_name = #{hospName},</if>
            <if test="code != null and code != ''">code = #{code},</if>
            <if test="wbm != null">wbm = #{wbm},</if>
            <if test="spell != null">spell = #{spell},</if>
            <if test="areaid != null">areaId = #{areaid},</if>
            <if test="areaName != null">area_name = #{areaName},</if>
            <if test="mainHospArea != null and mainHospArea != ''">main_hosp_area = #{mainHospArea},</if>
            <if test="principal != null">principal = #{principal},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="plaitBed != null">plait_bed = #{plaitBed},</if>
            <if test="openBed != null">open_bed = #{openBed},</if>
            <if test="buildDate != null">build_date = #{buildDate},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="orderNum != null">order_num = #{orderNum},</if>
            <if test="effective != null and effective != ''">effective = #{effective},</if>
            <if test="createByName != null and createByName != ''">create_by_name = #{createByName},</if>
            <if test="updateByName != null and updateByName != ''">update_by_name = #{updateByName},</if>
            <if test="imgbase64 != null">imgBase64 = #{imgbase64},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
        </trim>
        where hosp_area_id = #{hospAreaId}
    </update>
 
    <delete id="deleteDictHospByHospAreaId" parameterType="String">
        delete
        from dict_hosp
        where hosp_area_id = #{hospAreaId}
    </delete>
 
    <delete id="deleteDictHospByHospAreaIds" parameterType="String">
        delete from dict_hosp where hosp_area_id in
        <foreach item="hospAreaId" collection="array" open="(" separator="," close=")">
            #{hospAreaId}
        </foreach>
    </delete>
</mapper>