You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.1 KiB
101 lines
3.1 KiB
<?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.ccsens.carbasics.persist.dao.OrganizationPositionDao">
|
|
|
|
<select id="queryPosition" resultType="com.ccsens.carbasics.bean.vo.QuestionnaireVo$PositionInfo">
|
|
SELECT
|
|
id,
|
|
`name`
|
|
FROM
|
|
t_organization_position_type
|
|
WHERE
|
|
rec_status = 0
|
|
AND `code` IN (
|
|
'ZhiKong',
|
|
'KeZhuRen',
|
|
'FuZhuRen',
|
|
'YiSheng'
|
|
)
|
|
</select>
|
|
|
|
<select id="queryByCode" resultType="java.lang.Long">
|
|
SELECT
|
|
p.id
|
|
FROM
|
|
t_organization_position_type AS pt
|
|
LEFT JOIN t_organization_position_type_relation AS ptr ON pt.id = ptr.position_type_id
|
|
LEFT JOIN t_organization_position AS p ON p.id = ptr.position_id
|
|
LEFT JOIN t_organization_department AS od ON od.id = p.department_id
|
|
LEFT JOIN t_organization AS o ON od.organization_id = o.id
|
|
WHERE
|
|
pt.rec_status = 0
|
|
AND ptr.rec_status = 0
|
|
AND p.rec_status = 0
|
|
AND od.rec_status = 0
|
|
AND o.rec_status = 0
|
|
AND pt.`code` = #{code}
|
|
AND o.`name` = #{hospitalName}
|
|
</select>
|
|
|
|
<select id="queryByName" resultType="java.lang.Long">
|
|
SELECT
|
|
id
|
|
FROM
|
|
t_organization_position
|
|
WHERE
|
|
rec_status = 0
|
|
AND `name` = #{name}
|
|
</select>
|
|
|
|
<select id="queryIsExist" resultType="com.ccsens.carbasics.bean.po.OrganizationPosition">
|
|
SELECT
|
|
p.id,
|
|
p.`name`,
|
|
p.role_name,
|
|
p.department_id
|
|
FROM
|
|
`t_organization_position` AS p
|
|
LEFT JOIN t_organization_position_type_relation AS ptr ON p.id = ptr.position_id
|
|
LEFT JOIN t_organization_position_type AS pt ON pt.id = ptr.position_type_id
|
|
WHERE
|
|
p.rec_status = 0
|
|
AND ptr.rec_status = 0
|
|
AND pt.rec_status = 0
|
|
AND p.`name` = #{positionName}
|
|
AND pt.`code` = #{positionCode}
|
|
AND p.department_id = #{did}
|
|
</select>
|
|
|
|
<select id="queryNameRepeat" resultType="java.lang.Integer">
|
|
SELECT
|
|
COUNT(p.id)
|
|
FROM
|
|
t_organization_position AS p
|
|
WHERE
|
|
p.rec_status = 0
|
|
AND p.department_id = #{departmentId}
|
|
AND p.`name` = #{positionName}
|
|
</select>
|
|
<select id="getHospitalNameAndDoctorName"
|
|
resultType="com.ccsens.carbasics.bean.vo.QuestionnaireVo$ShareQuestionnaire">
|
|
SELECT
|
|
d.`name` as hospitalName,
|
|
m.`name` as doctorName
|
|
FROM
|
|
t_organization_position p,
|
|
t_organization_member_position mp,
|
|
t_organization_member m,
|
|
t_organization_department d
|
|
WHERE
|
|
p.id = mp.position_id
|
|
and mp.member_id = m.id
|
|
and p.department_id = d.id
|
|
and p.rec_status = 0
|
|
and mp.rec_status = 0
|
|
and m.rec_status = 0
|
|
and d.rec_status = 0
|
|
and m.user_id = #{userId}
|
|
and p.id = #{roleId}
|
|
</select>
|
|
|
|
</mapper>
|