2024-03-21 10:03:52 +08:00
|
|
|
<?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.rax.admin.mapper.SysHospitalMapper">
|
2024-03-25 11:01:06 +08:00
|
|
|
<sql id="hospitalPropertiesSQL">
|
|
|
|
|
id,
|
|
|
|
|
name,
|
|
|
|
|
code,
|
|
|
|
|
status,
|
|
|
|
|
province,
|
2024-05-09 09:43:26 +08:00
|
|
|
start_time "startTime",
|
|
|
|
|
end_time "endTime",
|
|
|
|
|
domain,
|
2024-03-25 11:01:06 +08:00
|
|
|
city
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<sql id="hospitalSelectSQL">
|
|
|
|
|
|
2024-03-25 11:21:32 +08:00
|
|
|
FROM sys_hospital
|
2024-03-25 11:01:06 +08:00
|
|
|
|
2024-05-09 09:43:26 +08:00
|
|
|
WHERE del_flag = 0
|
2024-03-25 11:01:06 +08:00
|
|
|
|
|
|
|
|
<if test="name != null and name != ''">
|
|
|
|
|
<bind name="bindName" value="'%' + name + '%'"/>
|
2024-04-26 18:54:32 +08:00
|
|
|
AND name LIKE #{bindName}
|
2024-03-25 11:01:06 +08:00
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="getHospitalList" resultType="com.rax.admin.api.dto.HospitalDTO">
|
|
|
|
|
SELECT
|
|
|
|
|
|
|
|
|
|
<include refid="hospitalPropertiesSQL"/>
|
|
|
|
|
|
|
|
|
|
<include refid="hospitalSelectSQL"/>
|
|
|
|
|
|
2024-03-25 11:21:32 +08:00
|
|
|
ORDER BY create_time DESC
|
|
|
|
|
LIMIT #{offset},#{limit};
|
2024-03-25 11:01:06 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getHospitalTotal" resultType="java.lang.Integer">
|
|
|
|
|
SELECT COUNT(*)
|
|
|
|
|
<include refid="hospitalSelectSQL"/>
|
|
|
|
|
</select>
|
|
|
|
|
|
2024-05-09 09:43:26 +08:00
|
|
|
<update id="deleteByIds">
|
|
|
|
|
update sys_hospital set del_flag = 1
|
|
|
|
|
where
|
|
|
|
|
<if test="ids != null and ids.length != 0">
|
|
|
|
|
<foreach item="item" index="index" collection="ids"
|
|
|
|
|
open="id in (" separator="," close=")" nullable="false">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="delHospitalManager">
|
|
|
|
|
DELETE FROM sys_hospital_manager where hospital_id = #{hospitalId};
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<insert id="insertHospitalManager">
|
|
|
|
|
INSERT INTO sys_hospital_manager VALUES (#{hospitalId}, #{userId});
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<select id="getHospitalManager" resultType="map">
|
|
|
|
|
select u.user_id "id", u.name, u.phone
|
|
|
|
|
from sys_hospital_manager hm
|
|
|
|
|
left join sys_user u
|
|
|
|
|
on u.user_id = hm.user_id
|
|
|
|
|
where u.del_flag = 0 and hm.hospital_id = #{hospitalId};
|
|
|
|
|
</select>
|
2024-03-25 11:01:06 +08:00
|
|
|
|
2024-05-29 09:33:22 +08:00
|
|
|
<delete id="delCurrentHospital">
|
|
|
|
|
DELETE FROM sys_hospital_current where user_id = #{userId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<insert id="insertCurrentHospital">
|
|
|
|
|
INSERT INTO sys_hospital_current VALUES (#{userId}, #{hospitalId});
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<select id="getCurrentHospital" resultType="map">
|
|
|
|
|
SELECT hospital_id from sys_hospital_current where user_id = #{userId};
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getCountByProvince" resultType="map">
|
|
|
|
|
select province, count(*) "count" from sys_hospital where del_flag = 0 group by province
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getCountByCity" resultType="map">
|
|
|
|
|
select city, count(*) "count" from sys_hospital where province = #{province} and del_flag = 0 group by city
|
|
|
|
|
</select>
|
|
|
|
|
|
2024-03-21 10:03:52 +08:00
|
|
|
</mapper>
|