Преглед на файлове

1.修改协定放使用权限-增加查询条件-创建者和科室名(通过权限表关联查询)

zjh преди 2 години
родител
ревизия
610ffd5594
променени са 1 файла, в които са добавени 42 реда и са изтрити 0 реда
  1. 42 0
      cbkj_web_api/src/main/resources/mappers/myData/TPersonalPrescriptionMapper.xml

+ 42 - 0
cbkj_web_api/src/main/resources/mappers/myData/TPersonalPrescriptionMapper.xml

@@ -283,22 +283,64 @@
             UNION
             SELECT 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}
             <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 test="shareType != null and shareType.contains('1'.toString())">
             UNION
             SELECT 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}
             <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 test="shareType != null and shareType.contains('2'.toString())">
             UNION
             SELECT 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}
             <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 test="shareType != null and shareType.contains('3'.toString())">
             UNION