|
@@ -283,22 +283,64 @@
|
|
UNION
|
|
UNION
|
|
SELECT t.*
|
|
SELECT t.*
|
|
FROM t_personal_prescription AS t
|
|
FROM t_personal_prescription AS t
|
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
|
+ ,sys_department as dept,t_personal_rule_auth as rule
|
|
|
|
+ </if>
|
|
WHERE t.IS_DEL = '0' AND t.IS_SHARE = '0' AND t.INS_CODE = #{insCode}
|
|
WHERE t.IS_DEL = '0' AND t.IS_SHARE = '0' AND t.INS_CODE = #{insCode}
|
|
<include refid="personalPreWhere"/>
|
|
<include refid="personalPreWhere"/>
|
|
|
|
+ <if test="preOwnerName != null and preOwnerName != ''">
|
|
|
|
+ AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
|
+ and (rule.pers_pre_id=t.PERS_PRE_ID and
|
|
|
|
+ rule.dept_id=dept.DEP_ID AND t.INS_CODE = dept.INS_CODE AND t.APP_ID = dept.APP_ID
|
|
|
|
+ and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%') ) or
|
|
|
|
+ (rule.pers_pre_id=t.PERS_PRE_ID and
|
|
|
|
+ rule.dept_id=dept.DEP_ORIGIN_ID AND t.INS_CODE = dept.INS_CODE AND t.APP_ID = dept.APP_ID
|
|
|
|
+ and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%') )
|
|
|
|
+ </if>
|
|
</if>
|
|
</if>
|
|
<if test="shareType != null and shareType.contains('1'.toString())">
|
|
<if test="shareType != null and shareType.contains('1'.toString())">
|
|
UNION
|
|
UNION
|
|
SELECT t.*
|
|
SELECT t.*
|
|
FROM t_personal_prescription AS t
|
|
FROM t_personal_prescription AS t
|
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
|
+ ,sys_department as dept,t_personal_rule_auth as rule
|
|
|
|
+ </if>
|
|
WHERE t.IS_DEL = '0' AND t.IS_SHARE = '1' AND t.INS_CODE = #{insCode}
|
|
WHERE t.IS_DEL = '0' AND t.IS_SHARE = '1' AND t.INS_CODE = #{insCode}
|
|
<include refid="personalPreWhere"/>
|
|
<include refid="personalPreWhere"/>
|
|
|
|
+ <if test="preOwnerName != null and preOwnerName != ''">
|
|
|
|
+ AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
|
+ and (rule.pers_pre_id=t.PERS_PRE_ID and
|
|
|
|
+ rule.dept_id=dept.DEP_ID AND t.INS_CODE = dept.INS_CODE AND t.APP_ID = dept.APP_ID
|
|
|
|
+ and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%') ) or
|
|
|
|
+ (rule.pers_pre_id=t.PERS_PRE_ID and
|
|
|
|
+ rule.dept_id=dept.DEP_ORIGIN_ID AND t.INS_CODE = dept.INS_CODE AND t.APP_ID = dept.APP_ID
|
|
|
|
+ and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%') )
|
|
|
|
+ </if>
|
|
</if>
|
|
</if>
|
|
<if test="shareType != null and shareType.contains('2'.toString())">
|
|
<if test="shareType != null and shareType.contains('2'.toString())">
|
|
UNION
|
|
UNION
|
|
SELECT t.*
|
|
SELECT t.*
|
|
FROM t_personal_prescription AS t
|
|
FROM t_personal_prescription AS t
|
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
|
+ ,sys_department as dept,t_personal_rule_auth as rule
|
|
|
|
+ </if>
|
|
WHERE t.IS_DEL = '0' AND t.IS_SHARE = '2' AND t.INS_CODE = #{insCode}
|
|
WHERE t.IS_DEL = '0' AND t.IS_SHARE = '2' AND t.INS_CODE = #{insCode}
|
|
<include refid="personalPreWhere"/>
|
|
<include refid="personalPreWhere"/>
|
|
|
|
+ <if test="preOwnerName != null and preOwnerName != ''">
|
|
|
|
+ AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
|
+ and (rule.pers_pre_id=t.PERS_PRE_ID and
|
|
|
|
+ rule.dept_id=dept.DEP_ID AND t.INS_CODE = dept.INS_CODE AND t.APP_ID = dept.APP_ID
|
|
|
|
+ and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%') ) or
|
|
|
|
+ (rule.pers_pre_id=t.PERS_PRE_ID and
|
|
|
|
+ rule.dept_id=dept.DEP_ORIGIN_ID AND t.INS_CODE = dept.INS_CODE AND t.APP_ID = dept.APP_ID
|
|
|
|
+ and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%') )
|
|
|
|
+ </if>
|
|
</if>
|
|
</if>
|
|
<if test="shareType != null and shareType.contains('3'.toString())">
|
|
<if test="shareType != null and shareType.contains('3'.toString())">
|
|
UNION
|
|
UNION
|