|
@@ -1,5 +1,37 @@
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<?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">
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.lantone.dblayermbg.mapper.RegionMapper">
|
|
<mapper namespace="com.lantone.dblayermbg.mapper.RegionMapper">
|
|
-
|
|
|
|
-</mapper>
|
|
|
|
|
|
+ <select id="getWard" resultType="com.lantone.common.dto.ViewRegionDTO">
|
|
|
|
+ select t1.name,t1.hospital_name as hospitalName,t2.deptName,
|
|
|
|
+ case t1.status
|
|
|
|
+ when 1 then '启用'
|
|
|
|
+ when 0 then '禁用'end as status,
|
|
|
|
+ t1.gmt_create as gmtCreate
|
|
|
|
+ from sys_region t1 LEFT JOIN
|
|
|
|
+ (select a.hospital_id,a.region_id,GROUP_CONCAT(b.name)as deptName
|
|
|
|
+ from sys_region_dept a,sys_dept b
|
|
|
|
+ where
|
|
|
|
+ a.is_deleted = 'N'
|
|
|
|
+ and b.is_deleted = 'N'
|
|
|
|
+ and a.hospital_id = b.hospital_id
|
|
|
|
+ and a.dept_id = b.id
|
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY a.region_id
|
|
|
|
+ )t2
|
|
|
|
+ on t1.hospital_id = t2.hospital_id
|
|
|
|
+ and t1.id = t2.region_id
|
|
|
|
+ where
|
|
|
|
+ t1.is_deleted = 'N'
|
|
|
|
+ <if test='hospitalId != null and hospitalId != ""'>
|
|
|
|
+ AND t1.hospital_id = #{hospitalId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test='name != null and name != ""'>
|
|
|
|
+ and t1.name like CONCAT('%',#{name},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test='status != null and status != ""'>
|
|
|
|
+ and t2.status like CONCAT('%',#{status},'%')
|
|
|
|
+ </if>
|
|
|
|
+ </select>
|
|
|
|
+</mapper>
|