<?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>
|