|
@@ -284,17 +284,19 @@
|
|
|
SELECT t.*
|
|
|
FROM t_personal_prescription AS t
|
|
|
<if test="(deptName != null and deptName != '') and ( insName == null or insName == '' )">
|
|
|
- ,sys_department as dept,t_personal_rule_auth as rule
|
|
|
+ ,sys_department as dept
|
|
|
WHERE
|
|
|
(t.IS_DEL = '0' AND t.IS_SHARE = '0' AND t.INS_CODE = #{insCode}
|
|
|
- and rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ID
|
|
|
+ and t.DEPT_ID=dept.DEP_ID
|
|
|
and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
|
<include refid="personalPreWhere"/>
|
|
|
)
|
|
|
- or (t.IS_DEL = '0' AND t.IS_SHARE = '0' AND t.INS_CODE = #{insCode} and rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ORIGIN_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
+ or (t.IS_DEL = '0' AND t.IS_SHARE = '0' AND t.INS_CODE = #{insCode}
|
|
|
+ and
|
|
|
+ t.DEPT_ID=dept.DEP_ORIGIN_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
@@ -303,33 +305,36 @@
|
|
|
</if>
|
|
|
|
|
|
<if test="(deptName != null and deptName != '') and (insName != null and insName != '') ">
|
|
|
- ,sys_department as dept,t_personal_rule_auth as rule,sys_institution as ins
|
|
|
+ ,sys_department as dept,sys_institution as ins
|
|
|
WHERE
|
|
|
|
|
|
- (rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
+ ( t.DEPT_ID=dept.DEP_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
and t.IS_DEL = '0' AND t.IS_SHARE = '0' AND t.INS_CODE = #{insCode}
|
|
|
<include refid="personalPreWhere"/>
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
|
+ and t.INS_CODE = ins.INS_CODE and t.APP_ID = ins.APP_ID
|
|
|
and ins.INS_CODE=dept.INS_CODE and dept.APP_ID=ins.APP_ID and ins.INS_NAME LIKE CONCAT('%',TRIM(#{insName}),'%')
|
|
|
) or
|
|
|
- (rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ORIGIN_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
+ ( t.DEPT_ID=dept.DEP_ORIGIN_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
and t.IS_DEL = '0' AND t.IS_SHARE = '0' AND t.INS_CODE = #{insCode}
|
|
|
<include refid="personalPreWhere"/>
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
|
+ and t.INS_CODE = ins.INS_CODE and t.APP_ID = ins.APP_ID
|
|
|
and ins.INS_CODE=dept.INS_CODE and dept.APP_ID=ins.APP_ID and ins.INS_NAME LIKE CONCAT('%',TRIM(#{insName}),'%')
|
|
|
)
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="(insName != null and insName != '') and (deptName == null or deptName == '')">
|
|
|
- ,sys_department as dept,t_personal_rule_auth as rule,sys_institution as ins
|
|
|
+ ,sys_department as dept,sys_institution as ins
|
|
|
WHERE
|
|
|
- (rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ID
|
|
|
+ ( t.DEPT_ID=dept.DEP_ID
|
|
|
and dept.APP_ID=t.DEPT_ID and dept.INS_CODE = t.INS_CODE
|
|
|
+ and t.INS_CODE = ins.INS_CODE and t.APP_ID = ins.APP_ID
|
|
|
and ins.APP_ID=dept.APP_ID and ins.INS_CODE = dept.INS_CODE
|
|
|
and ins.INS_NAME LIKE CONCAT('%',TRIM(#{insName}),'%') and t.IS_DEL = '0' AND t.IS_SHARE = '0' AND t.INS_CODE = #{insCode}
|
|
|
<include refid="personalPreWhere"/>
|
|
@@ -337,7 +342,8 @@
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
|
) or(
|
|
|
- rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ORIGIN_ID and ins.INS_CODE=dept.INS_CODE and dept.APP_ID=ins.APP_ID
|
|
|
+ t.DEPT_ID=dept.DEP_ORIGIN_ID and ins.INS_CODE=dept.INS_CODE and dept.APP_ID=ins.APP_ID
|
|
|
+ and t.INS_CODE = ins.INS_CODE and t.APP_ID = ins.APP_ID
|
|
|
and ins.INS_NAME LIKE CONCAT('%',TRIM(#{insName}),'%') and t.IS_DEL = '0' AND t.IS_SHARE = '0' AND t.INS_CODE = #{insCode}
|
|
|
<include refid="personalPreWhere"/>
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
@@ -365,17 +371,19 @@
|
|
|
SELECT t.*
|
|
|
FROM t_personal_prescription AS t
|
|
|
<if test="(deptName != null and deptName != '') and ( insName == null or insName == '' )">
|
|
|
- ,sys_department as dept,t_personal_rule_auth as rule
|
|
|
+ ,sys_department as dept
|
|
|
WHERE
|
|
|
(t.IS_DEL = '0' AND t.IS_SHARE = '1' AND t.INS_CODE = #{insCode}
|
|
|
- and rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ID
|
|
|
+ and t.DEPT_ID=dept.DEP_ID
|
|
|
and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
|
<include refid="personalPreWhere"/>
|
|
|
)
|
|
|
- or (t.IS_DEL = '0' AND t.IS_SHARE = '1' AND t.INS_CODE = #{insCode} and rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ORIGIN_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
+ or (t.IS_DEL = '0' AND t.IS_SHARE = '1' AND t.INS_CODE = #{insCode}
|
|
|
+ and
|
|
|
+ t.DEPT_ID=dept.DEP_ORIGIN_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
@@ -384,33 +392,36 @@
|
|
|
</if>
|
|
|
|
|
|
<if test="(deptName != null and deptName != '') and (insName != null and insName != '') ">
|
|
|
- ,sys_department as dept,t_personal_rule_auth as rule,sys_institution as ins
|
|
|
+ ,sys_department as dept,sys_institution as ins
|
|
|
WHERE
|
|
|
|
|
|
- (rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
+ ( t.DEPT_ID=dept.DEP_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
and t.IS_DEL = '0' AND t.IS_SHARE = '1' AND t.INS_CODE = #{insCode}
|
|
|
<include refid="personalPreWhere"/>
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
|
+ and t.INS_CODE = ins.INS_CODE and t.APP_ID = ins.APP_ID
|
|
|
and ins.INS_CODE=dept.INS_CODE and dept.APP_ID=ins.APP_ID and ins.INS_NAME LIKE CONCAT('%',TRIM(#{insName}),'%')
|
|
|
) or
|
|
|
- (rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ORIGIN_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
+ ( t.DEPT_ID=dept.DEP_ORIGIN_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
and t.IS_DEL = '0' AND t.IS_SHARE = '1' AND t.INS_CODE = #{insCode}
|
|
|
<include refid="personalPreWhere"/>
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
|
+ and t.INS_CODE = ins.INS_CODE and t.APP_ID = ins.APP_ID
|
|
|
and ins.INS_CODE=dept.INS_CODE and dept.APP_ID=ins.APP_ID and ins.INS_NAME LIKE CONCAT('%',TRIM(#{insName}),'%')
|
|
|
)
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="(insName != null and insName != '') and (deptName == null or deptName == '')">
|
|
|
- ,sys_department as dept,t_personal_rule_auth as rule,sys_institution as ins
|
|
|
+ ,sys_department as dept,sys_institution as ins
|
|
|
WHERE
|
|
|
- (rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ID
|
|
|
+ ( t.DEPT_ID=dept.DEP_ID
|
|
|
and dept.APP_ID=t.DEPT_ID and dept.INS_CODE = t.INS_CODE
|
|
|
+ and t.INS_CODE = ins.INS_CODE and t.APP_ID = ins.APP_ID
|
|
|
and ins.APP_ID=dept.APP_ID and ins.INS_CODE = dept.INS_CODE
|
|
|
and ins.INS_NAME LIKE CONCAT('%',TRIM(#{insName}),'%') and t.IS_DEL = '0' AND t.IS_SHARE = '1' AND t.INS_CODE = #{insCode}
|
|
|
<include refid="personalPreWhere"/>
|
|
@@ -418,7 +429,8 @@
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
|
) or(
|
|
|
- rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ORIGIN_ID and ins.INS_CODE=dept.INS_CODE and dept.APP_ID=ins.APP_ID
|
|
|
+ t.DEPT_ID=dept.DEP_ORIGIN_ID and ins.INS_CODE=dept.INS_CODE and dept.APP_ID=ins.APP_ID
|
|
|
+ and t.INS_CODE = ins.INS_CODE and t.APP_ID = ins.APP_ID
|
|
|
and ins.INS_NAME LIKE CONCAT('%',TRIM(#{insName}),'%') and t.IS_DEL = '0' AND t.IS_SHARE = '1' AND t.INS_CODE = #{insCode}
|
|
|
<include refid="personalPreWhere"/>
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
@@ -441,17 +453,19 @@
|
|
|
SELECT t.*
|
|
|
FROM t_personal_prescription AS t
|
|
|
<if test="(deptName != null and deptName != '') and ( insName == null or insName == '' )">
|
|
|
- ,sys_department as dept,t_personal_rule_auth as rule
|
|
|
+ ,sys_department as dept
|
|
|
WHERE
|
|
|
(t.IS_DEL = '0' AND t.IS_SHARE = '2' AND t.INS_CODE = #{insCode}
|
|
|
- and rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ID
|
|
|
+ and t.DEPT_ID=dept.DEP_ID
|
|
|
and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
|
<include refid="personalPreWhere"/>
|
|
|
)
|
|
|
- or (t.IS_DEL = '0' AND t.IS_SHARE = '2' AND t.INS_CODE = #{insCode} and rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ORIGIN_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
+ or (t.IS_DEL = '0' AND t.IS_SHARE = '2' AND t.INS_CODE = #{insCode}
|
|
|
+ and
|
|
|
+ t.DEPT_ID=dept.DEP_ORIGIN_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
@@ -460,33 +474,36 @@
|
|
|
</if>
|
|
|
|
|
|
<if test="(deptName != null and deptName != '') and (insName != null and insName != '') ">
|
|
|
- ,sys_department as dept,t_personal_rule_auth as rule,sys_institution as ins
|
|
|
+ ,sys_department as dept,sys_institution as ins
|
|
|
WHERE
|
|
|
|
|
|
- (rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
+ ( t.DEPT_ID=dept.DEP_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
and t.IS_DEL = '0' AND t.IS_SHARE = '2' AND t.INS_CODE = #{insCode}
|
|
|
<include refid="personalPreWhere"/>
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
|
+ and t.INS_CODE = ins.INS_CODE and t.APP_ID = ins.APP_ID
|
|
|
and ins.INS_CODE=dept.INS_CODE and dept.APP_ID=ins.APP_ID and ins.INS_NAME LIKE CONCAT('%',TRIM(#{insName}),'%')
|
|
|
) or
|
|
|
- (rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ORIGIN_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
+ ( t.DEPT_ID=dept.DEP_ORIGIN_ID and dept.DEP_NAME LIKE CONCAT('%',TRIM(#{deptName}),'%')
|
|
|
and t.IS_DEL = '0' AND t.IS_SHARE = '2' AND t.INS_CODE = #{insCode}
|
|
|
<include refid="personalPreWhere"/>
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
|
+ and t.INS_CODE = ins.INS_CODE and t.APP_ID = ins.APP_ID
|
|
|
and ins.INS_CODE=dept.INS_CODE and dept.APP_ID=ins.APP_ID and ins.INS_NAME LIKE CONCAT('%',TRIM(#{insName}),'%')
|
|
|
)
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="(insName != null and insName != '') and (deptName == null or deptName == '')">
|
|
|
- ,sys_department as dept,t_personal_rule_auth as rule,sys_institution as ins
|
|
|
+ ,sys_department as dept,sys_institution as ins
|
|
|
WHERE
|
|
|
- (rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ID
|
|
|
+ ( t.DEPT_ID=dept.DEP_ID
|
|
|
and dept.APP_ID=t.DEPT_ID and dept.INS_CODE = t.INS_CODE
|
|
|
+ and t.INS_CODE = ins.INS_CODE and t.APP_ID = ins.APP_ID
|
|
|
and ins.APP_ID=dept.APP_ID and ins.INS_CODE = dept.INS_CODE
|
|
|
and ins.INS_NAME LIKE CONCAT('%',TRIM(#{insName}),'%') and t.IS_DEL = '0' AND t.IS_SHARE = '2' AND t.INS_CODE = #{insCode}
|
|
|
<include refid="personalPreWhere"/>
|
|
@@ -494,7 +511,8 @@
|
|
|
AND t.PRE_OWNER_NAME LIKE CONCAT('%',TRIM(#{preOwnerName}),'%')
|
|
|
</if>
|
|
|
) or(
|
|
|
- rule.pers_pre_id=t.PERS_PRE_ID and rule.dept_id=dept.DEP_ORIGIN_ID and ins.INS_CODE=dept.INS_CODE and dept.APP_ID=ins.APP_ID
|
|
|
+ t.DEPT_ID=dept.DEP_ORIGIN_ID and ins.INS_CODE=dept.INS_CODE and dept.APP_ID=ins.APP_ID
|
|
|
+ and t.INS_CODE = ins.INS_CODE and t.APP_ID = ins.APP_ID
|
|
|
and ins.INS_NAME LIKE CONCAT('%',TRIM(#{insName}),'%') and t.IS_DEL = '0' AND t.IS_SHARE = '2' AND t.INS_CODE = #{insCode}
|
|
|
<include refid="personalPreWhere"/>
|
|
|
<if test="preOwnerName != null and preOwnerName != ''">
|