Browse Source

义乌核查-待分配列表页功能提交

songxinlu 4 years atrás
parent
commit
2f3e2f6aa1

+ 40 - 18
src/main/java/com/diagbot/facade/MedCheckInfoFacade.java

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.diagbot.dto.CheckDeptDTO;
+import com.diagbot.dto.CheckJobDTO;
 import com.diagbot.dto.DeptCheckUserDTO;
 import com.diagbot.entity.BasDeptInfo;
 import com.diagbot.entity.BasDoctorInfo;
@@ -18,6 +19,7 @@ import com.diagbot.service.impl.MedCheckInfoServiceImpl;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.CheckJobVO;
 import com.diagbot.vo.CheckUserVO;
 import com.diagbot.vo.MedCheckInfoAddVO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -131,6 +133,18 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         }
         return res;
     }
+    /**
+     * @Author songxl
+     * @Description 获取操作用户的核查科室以及人员
+     * @Date  2021/5/14
+     * @Param []
+     * @Return java.util.Map<java.lang.String,java.util.List<com.diagbot.dto.CheckDeptDTO>>
+     * @MethodName getCheckUserMap
+     */
+    public List<CheckJobDTO> getUserCheckList(CheckJobVO checkJobVO) {
+        //质控管理员要判断该角色是否是质控科
+        return this.getCheckList(checkJobVO);
+    }
     /**
      * @Author songxl
      * @Description 获取操作用户的核查科室以及人员
@@ -186,25 +200,30 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         Map<String, List<CheckDeptDTO>> checkRoleMap = new HashMap<>();
         for(Long id:searchRoleIds)
         {
-            //不同角色不同查询方式
-            switch (id.intValue())
+            try
             {
-                //临床科室监管人员
-                case 4:
-                    getDeptCheckInfo(checkRoleMap,hospitalId,principleId);
-                    break;
-                //质控科监管人员
-                case 5:
-                    getZKKCheckInfo(checkRoleMap,hospitalId,principleId);
-                    break;
-                //院级监管人员
-                case 6:
-                    getYQCheckInfo(checkRoleMap,hospitalId,principleId);
-                    break;
-                default:
-                    break;
-
-
+                //不同角色不同查询方式
+                switch (id.intValue())
+                {
+                    //临床科室监管人员
+                    case 4:
+                        getDeptCheckInfo(checkRoleMap,hospitalId,principleId);
+                        break;
+                    //质控科监管人员
+                    case 5:
+                        getZKKCheckInfo(checkRoleMap,hospitalId,principleId);
+                        break;
+                    //院级监管人员
+                    case 6:
+                        getYQCheckInfo(checkRoleMap,hospitalId,principleId);
+                        break;
+                    default:
+                        break;
+                }
+            }
+            catch (Exception e)
+            {
+                e.printStackTrace();
             }
         }
         return checkRoleMap;
@@ -221,12 +240,14 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("role_id",roleId)
         ).stream().map(SysUserRole::getUserId).collect(Collectors.toList());
+        if(userIds.isEmpty()){return;}
         //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()){return;}
         //2.1获取质控人员的科室信息
         List<BasDeptInfo> deptInfos = basDeptInfoFacade.list(new QueryWrapper<BasDeptInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -293,6 +314,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                 .eq("hospital_id",hospitalId)
                 .eq("user_id",principleId)
         ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
+        if(deptIds.isEmpty()){return;}
         //2.1获取科室详情
         List<BasDeptInfo> deptInfos = basDeptInfoFacade.list(new QueryWrapper<BasDeptInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())

+ 2 - 1
src/main/java/com/diagbot/mapper/MedCheckInfoMapper.java

@@ -1,5 +1,6 @@
 package com.diagbot.mapper;
 
+import com.diagbot.dto.CheckJobDTO;
 import com.diagbot.dto.DeptCheckUserDTO;
 import com.diagbot.entity.MedCheckInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -20,5 +21,5 @@ public interface MedCheckInfoMapper extends BaseMapper<MedCheckInfo> {
     //通过核查人员id获取核查人员的核查任务数
     List<DeptCheckUserDTO> getJobNumByUserId(CheckUserVO checkUserVO);
     //获取未分配的核查任务
-    List<Object> getCheckList(CheckJobVO checkJobVO);
+    List<CheckJobDTO> getCheckList(CheckJobVO checkJobVO);
 }

+ 2 - 1
src/main/java/com/diagbot/service/MedCheckInfoService.java

@@ -1,5 +1,6 @@
 package com.diagbot.service;
 
+import com.diagbot.dto.CheckJobDTO;
 import com.diagbot.dto.DeptCheckUserDTO;
 import com.diagbot.entity.MedCheckInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -20,5 +21,5 @@ public interface MedCheckInfoService extends IService<MedCheckInfo> {
     //通过核查人员id获取核查人员的核查任务数
     List<DeptCheckUserDTO> getJobNumByUserId(CheckUserVO checkUserVO);
 
-    List<Object> getCheckList(CheckJobVO checkJobVO);
+    List<CheckJobDTO> getCheckList(CheckJobVO checkJobVO);
 }

+ 3 - 1
src/main/java/com/diagbot/service/impl/MedCheckInfoServiceImpl.java

@@ -1,5 +1,6 @@
 package com.diagbot.service.impl;
 
+import com.diagbot.dto.CheckJobDTO;
 import com.diagbot.dto.DeptCheckUserDTO;
 import com.diagbot.entity.MedCheckInfo;
 import com.diagbot.mapper.MedCheckInfoMapper;
@@ -28,7 +29,8 @@ public class MedCheckInfoServiceImpl extends ServiceImpl<MedCheckInfoMapper, Med
     }
 
     @Override
-    public List<Object> getCheckList(CheckJobVO checkJobVO) {
+    public List<CheckJobDTO> getCheckList(CheckJobVO checkJobVO) {
+        //
         return baseMapper.getCheckList(checkJobVO);
     }
 }

+ 4 - 3
src/main/java/com/diagbot/web/MedCheckInfoController.java

@@ -3,6 +3,7 @@ package com.diagbot.web;
 
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.CheckDeptDTO;
+import com.diagbot.dto.CheckJobDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.MedCheckInfoFacade;
 import com.diagbot.vo.CheckJobVO;
@@ -60,11 +61,11 @@ public class MedCheckInfoController {
             notes = "startTime:任务生成开始时间 必填<br>" +
                     "endTime:  任务生成结束时间 必填<br>" +
                     "checkType:核查类型 必填 0-科室任务 1-院级 2-质控科<br>" +
-                    "deptList:明细id,必填<br>")
+                    "deptList:科室id集合,必填<br>")
     @PostMapping("/getCheckList")
     @SysLogger("getCheckList")
-    public RespDTO<List<Object>> getCheckList(@RequestBody CheckJobVO checkJobVO) {
-        List<Object> userInfos = medCheckInfoFacade.getCheckList(checkJobVO);
+    public RespDTO<List<CheckJobDTO>> getCheckList(@RequestBody CheckJobVO checkJobVO) {
+        List<CheckJobDTO> userInfos = medCheckInfoFacade.getUserCheckList(checkJobVO);
         return RespDTO.onSuc(userInfos);
     }
 }

+ 40 - 13
src/main/resources/mapper/MedCheckInfoMapper.xml

@@ -44,18 +44,45 @@
 
     <!--获取待分配核查任务列表-->
     <select id="getCheckList" resultType="com.diagbot.dto.CheckJobDTO">
-        SELECT job_distributor doctorId, count(*) as jobNum
-        from med_check_info
-        where is_deleted = 'N'
-        <if test="jobType != null">
-            and job_type = #{jobType}
-        </if>
-        <if test="userList !=null">
-            and job_distributor in
-            <foreach collection="userList" item="item" open="(" close=")" separator=",">
-                #{item}
-            </foreach>
-        </if>
-        GROUP BY job_distributor
+        SELECT a.behospital_code behospitalCode,a.beh_dept_name behospitalDept,
+        a.doctor_name attendingDoctor,a.leave_hospital_date leaveHospitalDate,
+        a.`name`,b.`value` from
+        (select a.behospital_code,a.`name`,a.beh_dept_name,a.doctor_name,a.leave_hospital_date,a.hospital_id,
+            a.beh_dept_id from med_behospital_info a ,med_check_info b
+              where a.behospital_code = b.behospital_code and a.hospital_id = b.hospital_id and a.is_deleted = 'N'
+                and b.is_deleted = 'N' and b.job_distributor is NULL  and b.check_type = 0
+                <if test="checkType !=null">
+                    and b.job_type = #{checkType}
+                </if>
+                <if test="startTime !=null and endTime !=null">
+                    and b.job_create_time BETWEEN #{startTime} AND #{endTime}
+                </if>
+                <if test="name !=null">
+                    and a.doctor_name = #{name}
+                </if>
+                <if test="behospitalCode !=null">
+                    and a.behospital_code = #{behospitalCode}
+                </if>
+                <if test="name !=null">
+                    and a.`name` LIKE CONCAT('%',#{name},'%')
+                </if>
+--                 科室任务
+                <if test="deptList !=null and job_type =0">
+                    and a.beh_dept_id in
+                    <foreach collection="deptList" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                </if>
+--                 院区任务
+                <if test="deptList !=null and job_type =1">
+                    and a.beh_dept_id not in
+                    <foreach collection="deptList" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                </if>
+--                 质控科没有科室筛选条件,只要角色是质控科人员即可
+
+        ) a LEFT JOIN med_behospital_type b on a.behospital_code = b.behospital_code
+        and a.hospital_id = b.hospital_id and b.is_deleted = 'N' ORDER BY b.`value` DESC ,a.leave_hospital_date DESC
     </select>
 </mapper>