Browse Source

质控核查分配核查任务--获取指定核查人员任务列表接口时间改为选填

songxinlu 4 years ago
parent
commit
5e90125014

+ 5 - 9
src/main/java/com/diagbot/facade/MedCheckInfoFacade.java

@@ -22,6 +22,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.CheckJobPageVO;
 import com.diagbot.vo.CheckJobVO;
 import com.diagbot.vo.CheckUserVO;
 import com.diagbot.vo.DistributionJobVO;
@@ -147,7 +148,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
      * @Return java.util.Map<java.lang.String,java.util.List<com.diagbot.dto.CheckDeptDTO>>
      * @MethodName getCheckUserMap
      */
-    public IPage<CheckJobDTO> getUserCheckList(CheckJobVO checkJobVO) {
+    public IPage<CheckJobDTO> getUserCheckList(CheckJobPageVO  checkJobVO) {
         //校验
         userCheckPageSet(checkJobVO);
         //质控管理员要判断该角色是否是质控科
@@ -211,7 +212,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                     .eq("hospital_id",hospitalId)
                     .eq("user_id",principleId)
             ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
-            if(deptIds.isEmpty()){
+            if(deptIds!=null&&!deptIds.isEmpty()){
                 checkJobVO.setDeptList(deptIds);
             }
             return getCheckList(checkJobVO);
@@ -236,7 +237,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                         .eq("hospital_id",hospitalId)
                         .in("user_id",userIds)
                 ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
-                if(deptIds.isEmpty()){
+                if(deptIds!=null&&!deptIds.isEmpty()){
                     checkJobVO.setDeptList(deptIds);
                 }
             }
@@ -256,7 +257,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
      * @Return void
      * @MethodName userCheckPageSet
      */
-    private void userCheckPageSet(CheckJobVO checkJobVO) {
+    private void userCheckPageSet(CheckJobPageVO  checkJobVO) {
         if(StringUtil.isBlank(checkJobVO.getStartTime())&&StringUtil.isBlank(checkJobVO.getEndTime())
                 &&StringUtil.isBlank(checkJobVO.getBehosDateStart())&&StringUtil.isBlank(checkJobVO.getBehosDateEnd()))
         {
@@ -673,11 +674,6 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
      */
     public List<CheckJobDTO> getCheckListByUserId(CheckJobVO checkJobVO) {
         //非空校验
-        if(StringUtil.isBlank(checkJobVO.getStartTime())&&StringUtil.isBlank(checkJobVO.getEndTime())
-                &&StringUtil.isBlank(checkJobVO.getBehosDateStart())&&StringUtil.isBlank(checkJobVO.getBehosDateEnd()))
-        {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有时间区间!");
-        }
         if(StringUtil.isBlank(checkJobVO.getCheckId()))
         {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有传核查用户id!");

+ 32 - 20
src/main/java/com/diagbot/facade/MedCheckWorkFacade.java

@@ -16,6 +16,7 @@ import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.*;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -27,6 +28,7 @@ import java.util.stream.Collectors;
  * @author songxl
  * @since 2021-05-11
  */
+@Slf4j
 @Component
 public class MedCheckWorkFacade {
     @Autowired
@@ -144,8 +146,7 @@ public class MedCheckWorkFacade {
             recordContentVO.setIsPlacefile(1l);//获取已归档的患者
             recordContentVO.setStartTime(DateUtil.formatDateTime(DateUtil.addMinutes(DateUtil.now(), -30)));
             recordContentVO.setEndTime(DateUtil.formatDateTime(DateUtil.now()));
-            getPatientRecordType(medBehospitalTypeMap,
-                    medicalRecordServiceImpl.getMedicalRecord(recordContentVO), typeValue, typeName, hospiatlId);
+            putBehospitalTypeMap(medBehospitalTypeMap,recordContentVO,typeValue,typeName,hospiatlId,searchSize);
         } else {
             //2.2添加今天之前所有患者的类型
             //2.2.1获取所有数据数量
@@ -154,16 +155,36 @@ public class MedCheckWorkFacade {
             recordContentVO.setHospitalId(hospiatlId);
             recordContentVO.setModeList(new ArrayList<String>(typeValue.keySet()));
             recordContentVO.setIsPlacefile(1l);//获取已归档的患者
-            int num = medicalRecordServiceImpl.getRecordCount(recordContentVO);
-            if (num > 0) {
+            putBehospitalTypeMap(medBehospitalTypeMap,recordContentVO,typeValue,typeName,hospiatlId,searchSize);
+        }
+        //3.批量执行插入操作
+        try {
+            if (medBehospitalTypeMap!=null&&medBehospitalTypeMap.size() > 0) {
+                List<MedBehospitalType> medBehospitalTypeList = new ArrayList<>(medBehospitalTypeMap.values());
+                medBehospitalTypeServiceImpl.saveBatch(medBehospitalTypeList, batchSize);
+            }
+        }
+        catch(Exception e)
+        {
+            log.error(e.getMessage(),e);
+        }
+    }
 
-                if (num < searchSize) {
-                    //执行一次
-                    recordContentVO.setStart(0L);
-                    recordContentVO.setEnd(num + 0L);
-                    getPatientRecordType(medBehospitalTypeMap,
-                            medicalRecordServiceImpl.getMedicalRecord(recordContentVO), typeValue, typeName, hospiatlId);
-                }
+    private void putBehospitalTypeMap(HashMap<String, MedBehospitalType> medBehospitalTypeMap,
+                                      RecordTypeVO recordContentVO, JSONObject typeValue,
+                                      JSONObject typeName, Long hospiatlId,int searchSize) {
+        int num = medicalRecordServiceImpl.getRecordCount(recordContentVO);
+        if (num > 0) {
+
+            if (num < searchSize) {
+                //执行一次
+                recordContentVO.setStart(0L);
+                recordContentVO.setEnd(num + 0L);
+                getPatientRecordType(medBehospitalTypeMap,
+                        medicalRecordServiceImpl.getMedicalRecord(recordContentVO), typeValue, typeName, hospiatlId);
+            }
+            else
+            {
                 int i = num / searchSize + 1;
                 for (int j = 0; j < i; j++) {
                     //5000个一次循环添加
@@ -172,17 +193,8 @@ public class MedCheckWorkFacade {
                     getPatientRecordType(medBehospitalTypeMap,
                             medicalRecordServiceImpl.getMedicalRecord(recordContentVO), typeValue, typeName, hospiatlId);
                 }
-
-            }
-
-            //3.批量执行插入操作
-            if (medBehospitalTypeMap.size() > 0) {
-                List<MedBehospitalType> medBehospitalTypeList = new ArrayList<>(medBehospitalTypeMap.values());
-                medBehospitalTypeServiceImpl.saveBatch(medBehospitalTypeList, batchSize);
             }
-
         }
-
     }
 
     /**

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

@@ -6,6 +6,7 @@ import com.diagbot.dto.CheckWorkDTO;
 import com.diagbot.dto.DeptCheckUserDTO;
 import com.diagbot.entity.MedCheckInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.CheckJobPageVO;
 import com.diagbot.vo.CheckJobVO;
 import com.diagbot.vo.CheckUserVO;
 import com.diagbot.vo.CheckWorkPageVO;
@@ -22,7 +23,7 @@ import java.util.List;
  */
 public interface MedCheckInfoMapper extends BaseMapper<MedCheckInfo> {
     //获取未分配的核查任务
-    IPage<CheckJobDTO> getCheckList(CheckJobVO checkJobVO);
+    IPage<CheckJobDTO> getCheckList(CheckJobPageVO checkJobVO);
     //通过核查人员id获取核查人员的核查任务数
     List<DeptCheckUserDTO> getJobNumByUserId(CheckUserVO checkUserVO);
     //核查任务列表

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

@@ -5,6 +5,7 @@ import com.diagbot.dto.CheckJobDTO;
 import com.diagbot.dto.DeptCheckUserDTO;
 import com.diagbot.entity.MedCheckInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.vo.CheckJobPageVO;
 import com.diagbot.vo.CheckJobVO;
 import com.diagbot.vo.CheckUserVO;
 
@@ -19,5 +20,5 @@ import java.util.List;
  * @since 2020-07-06
  */
 public interface MedCheckInfoService extends IService<MedCheckInfo> {
-    public IPage<CheckJobDTO> getCheckList(CheckJobVO checkJobVO);
+    public IPage<CheckJobDTO> getCheckList(CheckJobPageVO checkJobVO);
 }

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

@@ -7,6 +7,7 @@ import com.diagbot.entity.MedCheckInfo;
 import com.diagbot.mapper.MedCheckInfoMapper;
 import com.diagbot.service.MedCheckInfoService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.CheckJobPageVO;
 import com.diagbot.vo.CheckJobVO;
 import com.diagbot.vo.CheckWorkPageVO;
 import org.springframework.stereotype.Service;
@@ -32,7 +33,7 @@ public class MedCheckInfoServiceImpl extends ServiceImpl<MedCheckInfoMapper, Med
         return baseMapper.deleteBatchCodes(list);
     }
     @Override
-    public IPage<CheckJobDTO> getCheckList(CheckJobVO checkJobVO) {
+    public IPage<CheckJobDTO> getCheckList(CheckJobPageVO checkJobVO) {
         return baseMapper.getCheckList(checkJobVO);
     }
 }

+ 41 - 0
src/main/java/com/diagbot/vo/CheckJobPageVO.java

@@ -0,0 +1,41 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @description: 分配任务入参对象-分页
+ * @author: songxl
+ * @time: 2021/05/17
+ */
+@Data
+public class CheckJobPageVO extends Page implements Serializable {
+    //生成开始时间
+    private String startTime;
+    //生成任务结束时间
+    private String endTime;
+    //出院开始时间
+    private String behosDateStart;
+    //出院结束时间
+    private String behosDateEnd;
+    //任务类型
+    private String jobType;
+    //核查用户id
+    private String checkId;
+    //病人姓名
+    private String name;
+    //病人住院序号
+    private String behospitalCode;
+    //主诊断医生
+    private String doctorName;
+    //科室id集合
+    @ApiModelProperty(hidden = true)
+    private List<String> deptList;
+
+
+
+}

+ 7 - 3
src/main/java/com/diagbot/vo/CheckJobVO.java

@@ -13,7 +13,7 @@ import java.util.List;
  * @time: 2021/05/17
  */
 @Data
-public class CheckJobVO extends Page implements Serializable {
+public class CheckJobVO {
     //生成开始时间
     private String startTime;
     //生成任务结束时间
@@ -22,15 +22,19 @@ public class CheckJobVO extends Page implements Serializable {
     private String behosDateStart;
     //出院结束时间
     private String behosDateEnd;
-    //任务类型
-    private String jobType;
     //核查用户id
     private String checkId;
+    //任务类型
+    @ApiModelProperty(hidden = true)
+    private String jobType;
     //病人姓名
+    @ApiModelProperty(hidden = true)
     private String name;
     //病人住院序号
+    @ApiModelProperty(hidden = true)
     private String behospitalCode;
     //主诊断医生
+    @ApiModelProperty(hidden = true)
     private String doctorName;
     //科室id集合
     @ApiModelProperty(hidden = true)

+ 5 - 9
src/main/java/com/diagbot/web/MedCheckInfoController.java

@@ -7,6 +7,7 @@ import com.diagbot.dto.CheckDeptDTO;
 import com.diagbot.dto.CheckJobDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.MedCheckInfoFacade;
+import com.diagbot.vo.CheckJobPageVO;
 import com.diagbot.vo.CheckJobVO;
 import com.diagbot.vo.DistributionJobVO;
 import com.diagbot.vo.MedCheckInfoAddVO;
@@ -70,8 +71,8 @@ public class MedCheckInfoController {
                     "jobType:核查任务类型 必填 0-科室任务 1-院级 2-质控科<br>" )
     @PostMapping("/getCheckList")
     @SysLogger("getCheckList")
-    public RespDTO<IPage<CheckJobDTO>> getCheckList(@RequestBody CheckJobVO checkJobVO) {
-        IPage<CheckJobDTO> userInfos = medCheckInfoFacade.getUserCheckList(checkJobVO);
+    public RespDTO<IPage<CheckJobDTO>> getCheckList(@RequestBody CheckJobPageVO checkJobPageVO) {
+        IPage<CheckJobDTO> userInfos = medCheckInfoFacade.getUserCheckList(checkJobPageVO);
         return RespDTO.onSuc(userInfos);
     }
 
@@ -79,7 +80,7 @@ public class MedCheckInfoController {
             notes = "behospitalCodes:病人住院序号集合 必填<br>" +
                     "checkId:  核查用户id 必填<br>" +
                     "checkName:  核查用户姓名 必填<br>" +
-                    "checkType:操作类型 必填 分配或取消 0-分配,1-取消分配<br>")
+                    "distributionType:操作类型 必填 分配或取消 0-分配,1-取消分配<br>")
     @PostMapping("/updateDistributionCheck")
     @SysLogger("updateDistributionCheck")
     public RespDTO<Boolean> distributionJobs(@RequestBody DistributionJobVO distributionJobVO) {
@@ -88,12 +89,7 @@ public class MedCheckInfoController {
 
 
     @ApiOperation(value = "分配核查任务--获取指定核查人员的核查任务[by:songxl]",
-            notes = "startTime:任务生成开始时间 必填<br>" +
-                    "endTime:  任务生成结束时间 必填<br>" +
-                    "或<br>" +
-                    "behosDateStart:  出院开始时间 必填<br>" +
-                    "behosDateEnd:  出院结束时间 必填<br>" +
-                    "checkId:核查用户id")
+            notes = "checkId:核查用户id")
     @PostMapping("/getCheckListByUserId")
     @SysLogger("getCheckListByUserId")
     public RespDTO<List<CheckJobDTO>> getCheckListByUserId(@RequestBody CheckJobVO checkJobVO) {

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

@@ -75,7 +75,7 @@
                         #{item}
                     </foreach>
                 </if>
-                <if test="deptList !=null and jobType ==1">
+                <if test="deptList !=null and deptList.size()!=0 and jobType ==1">
                     and a.beh_dept_id not in
                     <foreach collection="deptList" item="item" open="(" close=")" separator=",">
                         #{item}
@@ -95,7 +95,7 @@
         (select a.behospital_code,a.`name`,a.beh_dept_name,a.doctor_name,a.leave_hospital_date,a.hospital_id,
         a.beh_dept_id,b.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.is_deleted = 'N' and b.`status` = 0
         <if test="startTime !=null and startTime != '' and endTime !=null and endTime != ''">
             and b.job_create_time BETWEEN #{startTime} AND #{endTime}
         </if>

+ 30 - 28
src/main/resources/mapper/MedicalRecordMapper.xml

@@ -51,45 +51,47 @@
 
     <select id="getRecordCount"  resultType="java.lang.Integer">
         select count(*) as num from
-          (select DISTINCT b.behospital_code ,b.mode_id from med_behospital_info a LEFT OUTER JOIN med_medical_record b on a.behospital_code = b.behospital_code and a.hospital_id = b.hospital_id  where
-              a.hospital_id = #{hospitalId}
-
-        <if test="modeList != null and modeList.size() > 0">
-            and b.mode_id in
-            <foreach collection="modeList" open="(" separator="," close=")" item="item">
-                '${item}'
-            </foreach>
-        </if>
-        <if test="isPlacefile !=null">
-            and a.is_placefile  =#{isPlacefile}
-        </if>
-        <if test="startTime !=null and endTime !=null">
-            and a.placefile_date BETWEEN #{startTime} AND #{endTime}
-        </if>
+          (select  DISTINCT behospital_code,mode_id  from med_medical_record where behospital_code in
+                (select  behospital_code from med_behospital_info   where hospital_id = #{hospitalId}
+                <if test="isPlacefile !=null and isPlacefile !=''">
+                    and is_placefile  =#{isPlacefile}
+                </if>
+                <if test="startTime !=null and endTime !=null">
+                    and placefile_date BETWEEN #{startTime} AND #{endTime}
+                </if>
+                )
+                <if test="modeList != null and modeList.size() > 0">
+                    and mode_id in
+                    <foreach collection="modeList" open="(" separator="," close=")" item="item">
+                        '${item}'
+                    </foreach>
+                </if>
+                <if test="start != null and end !=null">
+                    limit #{start},#{end}
+                </if>
         ) a
     </select>
 
 
-    <select id="getMedicalRecord"  resultType="com.diagbot.dto.MedicalRecordDTO">
-        select DISTINCT b.behospital_code ,b.mode_id from med_behospital_info a LEFT OUTER JOIN med_medical_record b on a.behospital_code = b.behospital_code and a.hospital_id = b.hospital_id  where
-        a.hospital_id = #{hospitalId}
 
+    <select id="getMedicalRecord"  resultType="com.diagbot.dto.MedicalRecordDTO">
+        select  DISTINCT behospital_code,mode_id  from med_medical_record where behospital_code in
+          (select  behospital_code from med_behospital_info   where hospital_id = #{hospitalId}
+            <if test="isPlacefile !=null and isPlacefile !=''">
+                and is_placefile  =#{isPlacefile}
+            </if>
+            <if test="startTime !=null and endTime !=null">
+                and placefile_date BETWEEN #{startTime} AND #{endTime}
+            </if>
+            )
         <if test="modeList != null and modeList.size() > 0">
-            and b.mode_id in
+            and mode_id in
             <foreach collection="modeList" open="(" separator="," close=")" item="item">
                 '${item}'
             </foreach>
         </if>
-
-        <if test="isPlacefile !=null">
-            and a.is_placefile  =#{isPlacefile}
-        </if>
-        <if test="startTime !=null and endTime !=null">
-            and a.placefile_date BETWEEN #{startTime} AND #{endTime}
-        </if>
-
         <if test="start != null and end !=null">
-           limit #{start},#{end}
+            limit #{start},#{end}
         </if>
     </select>