Przeglądaj źródła

质控核查分配核查任务--获取待分配核查任务列表接口修改

songxinlu 4 lat temu
rodzic
commit
f4104f4dde

+ 42 - 8
src/main/java/com/diagbot/facade/MedCheckInfoFacade.java

@@ -153,11 +153,6 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有时间区间!");
         }
-        if(checkJobVO.getDeptList()==null||checkJobVO.getDeptList().isEmpty())
-        {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有传科室列表!");
-        }
-
         //质控管理员要判断该角色是否是质控科
         //1.获取质控科id
         //获取人员id 和 该人员的医院id
@@ -190,6 +185,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         //质控科监管人员
         if(searchRoleIds.contains(5L)&&"2".equals(checkJobVO.getJobType()))
         {
+            //用户是不是质管科人员校验
             String zkkDeptId = basDeptInfoFacade.getOne(new QueryWrapper<BasDeptInfo>()
                     .eq("is_deleted", IsDeleteEnum.N.getKey())
                     .eq("hospital_id",hospitalId)
@@ -210,12 +206,50 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                 return baseMapper.getCheckList(checkJobVO);
             }
         }
-        //临床科室监管人员、院级监管人员
-        else if(searchRoleIds.contains(4L)&&"0".equals(checkJobVO.getJobType())||
-                searchRoleIds.contains(6L)&&"1".equals(checkJobVO.getJobType()))
+        //临床科室监管人员
+        else if(searchRoleIds.contains(4L)&&"0".equals(checkJobVO.getJobType()))
         {
+            //获取监管人员所在科室集合
+            List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id",hospitalId)
+                    .eq("user_id",principleId)
+            ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
+            if(deptIds.isEmpty()){
+                checkJobVO.setDeptList(deptIds);
+            }
             return baseMapper.getCheckList(checkJobVO);
         }
+        //院级监管人员
+        else if(searchRoleIds.contains(6L)&&"1".equals(checkJobVO.getJobType()))
+        {
+            //1.获取院级质控人员有哪些
+            //1.1获取院级质控人员角色id
+            Long roleId = sysRoleFacade.getOne(new QueryWrapper<SysRole>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("name","院级质控人员")).getId();
+            //1.2获取院级质控人员该角色的用户id集合
+            List<Long> userIds = sysUserRoleFacade.list(new QueryWrapper<SysUserRole>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("role_id",roleId)
+            ).stream().map(SysUserRole::getUserId).collect(Collectors.toList());
+            if(userIds.isEmpty()){
+                //1.3获取该用户id集合的科室id集合
+                List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("hospital_id",hospitalId)
+                        .in("user_id",userIds)
+                ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
+                if(deptIds.isEmpty()){
+                    checkJobVO.setDeptList(deptIds);
+                }
+            }
+            return baseMapper.getCheckList(checkJobVO);
+        }
+        else
+        {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该用户的角色和任务类型不对应!");
+        }
        return new ArrayList<>();
     }
     /**

+ 1 - 2
src/main/java/com/diagbot/web/MedCheckInfoController.java

@@ -66,8 +66,7 @@ public class MedCheckInfoController {
                     "或<br>" +
                     "behosDateStart:  出院开始时间 必填<br>" +
                     "behosDateEnd:  出院结束时间 必填<br>" +
-                    "jobType:核查任务类型 必填 0-科室任务 1-院级 2-质控科<br>" +
-                    "deptList:科室id集合,必填<br>")
+                    "jobType:核查任务类型 必填 0-科室任务 1-院级 2-质控科<br>" )
     @PostMapping("/getCheckList")
     @SysLogger("getCheckList")
     public RespDTO<List<CheckJobDTO>> getCheckList(@RequestBody CheckJobVO checkJobVO) {

+ 4 - 4
src/main/resources/mapper/MedCheckInfoMapper.xml

@@ -60,8 +60,8 @@
                 <if test="behosDateStart !=null and behosDateEnd !=null">
                     and a.leave_hospital_date BETWEEN #{behosDateStart} AND #{behosDateEnd}
                 </if>
-                <if test="name !=null">
-                    and a.doctor_name = #{name}
+                <if test="doctorName !=null">
+                    and a.doctor_name = #{doctorName}
                 </if>
                 <if test="behospitalCode !=null">
                     and a.behospital_code = #{behospitalCode}
@@ -69,13 +69,13 @@
                 <if test="name !=null">
                     and a.`name` LIKE CONCAT('%',#{name},'%')
                 </if>
-                <if test="deptList !=null and checkType ==0">
+                <if test="deptList !=null and jobType ==0">
                     and a.beh_dept_id in
                     <foreach collection="deptList" item="item" open="(" close=")" separator=",">
                         #{item}
                     </foreach>
                 </if>
-                <if test="deptList !=null and checkType ==1">
+                <if test="deptList !=null and jobType ==1">
                     and a.beh_dept_id not in
                     <foreach collection="deptList" item="item" open="(" close=")" separator=",">
                         #{item}