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

Merge branch '20210512_yw_check' into test

songxinlu преди 4 години
родител
ревизия
e9c854f519

+ 3 - 0
src/main/java/com/diagbot/dto/CheckWorkDTO.java

@@ -40,6 +40,9 @@ public class CheckWorkDTO {
      * 年龄
      */
     private String age;
+    private String ageYear;
+    private String ageMon;
+    private String ageDay;
 
     /**
      * 科室

+ 32 - 10
src/main/java/com/diagbot/facade/MedCheckInfoFacade.java

@@ -45,6 +45,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import static java.sql.JDBCType.NULL;
+
 /**
  * @author wangfeng
  * @Description:
@@ -396,8 +398,21 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         checkUserVOS.setHospitalId(hospitalId);
         List<CheckUserDTO> checkUserDTOS = baseMapper.getCheckUser(checkUserVOS);
         //2.1获取科室详情
-        Map<String,String> deptMap = checkUserDTOS.stream()
-                .collect(Collectors.toMap(CheckUserDTO::getDeptId,CheckUserDTO::getDeptName, (v1, v2) -> v2));
+        //2.1.1获取院区核查的人员id
+        List<Long> userIds = sysUserRoleFacade.list(new QueryWrapper<SysUserRole>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("role_id",CheckerRoleEnum.HOSP_GENERAL.getKey())).stream()
+                .map(SysUserRole::getUserId).collect(Collectors.toList());
+        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());
+        Map<String,String> deptMap = basDeptInfoFacade.list(new QueryWrapper<BasDeptInfo>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id",hospitalId)
+                .in("dept_id",deptIds)).stream()
+                .collect(Collectors.toMap(BasDeptInfo::getDeptId,BasDeptInfo::getDeptName, (v1, v2) -> v2));
         if(deptMap!=null&&!deptMap.isEmpty())
         {
             //2.3获取所有医生信息的核查数
@@ -451,8 +466,11 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
             checkUserVOS.setHospitalId(hospitalId);
             List<CheckUserDTO> checkUserDTOS = baseMapper.getCheckUser(checkUserVOS);
             //2.1获取科室详情
-            Map<String,String> deptMap = checkUserDTOS.stream()
-                    .collect(Collectors.toMap(CheckUserDTO::getDeptId,CheckUserDTO::getDeptName, (v1, v2) -> v2));
+            Map<String,String> deptMap = basDeptInfoFacade.list(new QueryWrapper<BasDeptInfo>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id",hospitalId)
+                    .in("dept_id",Lists.newArrayList(zkkDeptId))).stream()
+                    .collect(Collectors.toMap(BasDeptInfo::getDeptId,BasDeptInfo::getDeptName, (v1, v2) -> v2));
             if(deptMap!=null&&!deptMap.isEmpty())
             {
                 //2.3获取质控科核查人员的核查数
@@ -503,8 +521,11 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         checkUserVOS.setHospitalId(hospitalId);
         List<CheckUserDTO> checkUserDTOS = baseMapper.getCheckUser(checkUserVOS);
         //2.1获取科室详情
-        Map<String,String> deptMap = checkUserDTOS.stream()
-                .collect(Collectors.toMap(CheckUserDTO::getDeptId,CheckUserDTO::getDeptName, (v1, v2) -> v2));
+        Map<String,String> deptMap = basDeptInfoFacade.list(new QueryWrapper<BasDeptInfo>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id",hospitalId)
+                .in("dept_id",deptIds)).stream()
+                .collect(Collectors.toMap(BasDeptInfo::getDeptId,BasDeptInfo::getDeptName, (v1, v2) -> v2));
         if(deptMap!=null&&!deptMap.isEmpty())
         {
             //2.3获取所有医生信息的核查数
@@ -691,15 +712,16 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
             {
                 Date now = DateUtil.now();
                 //4.3取消分配
+                Long a = null;
                 return  this.update(new UpdateWrapper<MedCheckInfo>()
                         .eq("is_deleted", IsDeleteEnum.N.getKey())
                         .eq("hospital_id", hospitalId)
                         .eq("check_id",  distributionJobVO.getCheckId())
                         .in("behospital_code", distributionJobVO.getBehospitalCodes())
-                        .set("job_distributor",-1)
-                        .set("job_distribution_name", null)
-                        .set("check_id", -1)
-                        .set("check_name", "")
+                        .set("job_distributor",a)
+                        .set("job_distribution_name", a)
+                        .set("check_id", a)
+                        .set("check_name", a)
                         .set("job_distribution_time", now));
             }
         }

+ 22 - 5
src/main/java/com/diagbot/facade/MedCheckWorkFacade.java

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.BasDeptInfoDTO;
 import com.diagbot.dto.CheckWorkDTO;
 import com.diagbot.dto.MedicalRecordDTO;
 import com.diagbot.entity.MedBehospitalType;
@@ -24,11 +25,11 @@ import com.diagbot.vo.CheckWorkPageVO;
 import com.diagbot.vo.MedCheckWorkAddVO;
 import com.diagbot.vo.RecordTypeVO;
 import com.diagbot.vo.SysUserBaseVO;
+import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -153,9 +154,8 @@ public class MedCheckWorkFacade {
         recordContentVO.setHospitalId(hospiatlId);
         recordContentVO.setModeList(new ArrayList<>(typeValue.keySet()));
         List<MedicalRecordDTO> medicalRecordList = medicalRecordServiceImpl.getMedicalRecord(recordContentVO);
-        if(medicalRecordList!=null&&!medicalRecordList.isEmpty())
-        {
-            getPatientRecordType(medBehospitalTypeMap,medicalRecordList, typeValue, typeName, hospiatlId);
+        if (medicalRecordList != null && !medicalRecordList.isEmpty()) {
+            getPatientRecordType(medBehospitalTypeMap, medicalRecordList, typeValue, typeName, hospiatlId);
         }
         //2.批量执行插入操作
         try {
@@ -219,6 +219,19 @@ public class MedCheckWorkFacade {
     public IPage<CheckWorkDTO> pageFac(CheckWorkPageVO checkWorkPageVO) {
         checkWorkPageSet(checkWorkPageVO);
         IPage<CheckWorkDTO> res = medCheckInfoFacade.getBaseMapper().getCheckWorkPage(checkWorkPageVO);
+        if (res == null || ListUtil.isEmpty(res.getRecords())) {
+            return res;
+        }
+        res.getRecords().forEach(i -> {
+            String age = "";
+            if (StringUtil.isNotBlank(i.getAgeYear()) && !i.getAgeYear().equals("0")) {
+                age += i.getAgeYear() + "岁";
+            } else {
+                age += (StringUtil.isNotBlank(i.getAgeMon()) && !i.getAgeMon().equals("0") ? (i.getAgeMon() + "个月") : "")
+                        + (StringUtil.isNotBlank(i.getAgeDay()) && !i.getAgeDay().equals("0") ? (i.getAgeDay() + "天") : "");
+            }
+            i.setAge(age);
+        });
         return res;
     }
 
@@ -247,7 +260,11 @@ public class MedCheckWorkFacade {
         if (StringUtil.isNotBlank(checkWorkPageVO.getJobType()) && (CheckJobTypeEnum.DEPT_SUPERVISOR.getKey() + "").equals(checkWorkPageVO.getJobType())) {
             SysUserBaseVO sysUserBaseVO = new SysUserBaseVO();
             sysUserBaseVO.setUserId(Long.parseLong(SysUserUtils.getCurrentPrincipleID()));
-            List<String> deptIds = sysUserFacade.getUserDepts(sysUserBaseVO).getSelDepts().stream().map(i -> i.getDeptId()).collect(Collectors.toList());
+            List<String> deptIds = Lists.newArrayList();
+            List<BasDeptInfoDTO> selDepts = sysUserFacade.getUserDepts(sysUserBaseVO).getSelDepts();
+            if (ListUtil.isNotEmpty(selDepts)) {
+                deptIds = selDepts.stream().map(i -> i.getDeptId()).collect(Collectors.toList());
+            }
             if (ListUtil.isNotEmpty(checkWorkPageVO.getDepartment())) {
                 deptIds.retainAll(checkWorkPageVO.getDepartment());
             }

+ 1 - 2
src/main/java/com/diagbot/facade/QcClientFacade.java

@@ -34,8 +34,7 @@ public class QcClientFacade {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "配置表内找不到评分接口地址数据!");
         }
         try {
-//            uri = new URI(url);
-            uri = new URI("http://localhost:6010");
+            uri = new URI(url);
         } catch (Exception e) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR);
         }

+ 5 - 2
src/main/java/com/diagbot/facade/RecordCheckFacade.java

@@ -65,11 +65,14 @@ public class RecordCheckFacade {
             } else if (roleId.intValue() == CheckerRoleEnum.DEPT_SUPERVISOR.getKey()
                     && (ListUtil.isEmpty(checkedRecordListVO.getCheckJobTypes()) || checkedRecordListVO.getCheckJobTypes().contains(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey() + ""))) {
                 userIds.addAll(getUserIdsOfRoleId(hospitalId, deptIds, CheckerRoleEnum.DEPT_GENERAL.getKey()));
+            } else if (roleId.intValue() == CheckerRoleEnum.DEPT_GENERAL.getKey() || roleId.intValue() == CheckerRoleEnum.QUAT_GENERAL.getKey() || roleId.intValue() == CheckerRoleEnum.HOSP_GENERAL.getKey()) {
+                userIds.add(userId);
             }
         });
 
         checkedRecordListVO.setCurrentDeptIds(String.join(",", deptIds));
         checkedRecordListVO.setCurrentGeneralUserIds(userIds);
+        checkedRecordListVO.setHospitalId(hospitalId);
         IPage<CheckedRecordListDTO> iPage = medCheckInfoFacade.getBaseMapper().checkedRecordList(checkedRecordListVO);
 
         if (ListUtil.isNotEmpty(iPage.getRecords())) {
@@ -80,7 +83,7 @@ public class RecordCheckFacade {
             medQcresultDetailQueryWrapper.select("behospital_code", "cases_entry_id");
             Map<String, Long> behospitalCodeCasesMap = medQcresultDetailService.list(medQcresultDetailQueryWrapper).stream().collect(Collectors.groupingBy(MedQcresultDetail::getBehospitalCode, Collectors.counting()));
             iPage.getRecords().forEach(i -> {
-                i.setCasesEntryNum(behospitalCodeCasesMap.get(i.getBehospitalCode()).intValue());
+                i.setCasesEntryNum(behospitalCodeCasesMap.get(i.getBehospitalCode()) == null ? 0 : behospitalCodeCasesMap.get(i.getBehospitalCode()).intValue());
             });
         }
 
@@ -119,7 +122,7 @@ public class RecordCheckFacade {
         medCheckInfo.setStatus(1);
         medCheckInfo.setCheckTime(DateUtil.now());
         medCheckInfoFacade.updateById(medCheckInfo);
-        
+
         return true;
     }
 

+ 1 - 1
src/main/java/com/diagbot/vo/MedCheckWorkAddVO.java

@@ -30,5 +30,5 @@ public class MedCheckWorkAddVO {
     @ApiModelProperty("操作时间")
     private String createTime;          // 操作时间
     @ApiModelProperty("核查类型 0病历,1病案首页,2全部 默认")
-    private Integer checkType;          // 核查类型 0病历,1病案首页,2全部 默认
+    private Integer checkType=2;          // 核查类型 0病历,1病案首页,2全部 默认
 }

+ 8 - 3
src/main/resources/mapper/MedCheckInfoMapper.xml

@@ -81,7 +81,7 @@
                 #{item}
             </foreach>
         </if>
-        GROUP BY a.beh_dept_id
+        GROUP BY a.beh_dept_id,b.check_id
     </select>
 
     <!--获取待分配核查任务列表-->
@@ -203,6 +203,9 @@
         mbi.file_code fileCode,
         mbi.sex,
         mhp.age,
+        TIMESTAMPDIFF(year,ifnull(mhp.birthday,mbi.birthday),mbi.behospital_date) as ageYear,
+        TIMESTAMPDIFF(month,DATE_ADD(ifnull(mhp.birthday,mbi.birthday),INTERVAL TIMESTAMPDIFF(year,ifnull(mhp.birthday,mbi.birthday),mbi.behospital_date) year),mbi.behospital_date) as ageMon,
+        TIMESTAMPDIFF(day,DATE_ADD(ifnull(mhp.birthday,mbi.birthday),INTERVAL TIMESTAMPDIFF(month,ifnull(mhp.birthday,mbi.birthday),mbi.behospital_date) month),mbi.behospital_date) as ageDay,
         mbi.beh_dept_name behDeptName,
         mbi.leave_hospital_date leaveHospitalDate,
         mhp.behospital_day_num behospitalDayNum,
@@ -236,6 +239,7 @@
         LEFT JOIN med_behospital_type mbt ON mbi.behospital_code = mbt.behospital_code
         AND mbi.hospital_id = mbt.hospital_id AND mbt.is_deleted = 'N'
         WHERE mbi.hospital_id=#{hospitalId} AND mbi.is_deleted = 'N' and mqi.score_res is not null
+        AND mci.check_id is null
         <if test="startDate != null">
             <![CDATA[ AND mbi.leave_hospital_date >= #{startDate}]]>
         </if>
@@ -267,7 +271,7 @@
             <![CDATA[ AND mhp.behospital_day_num >= #{smallDay}]]>
         </if>
         <if test="bigDay != null">
-            <![CDATA[ AND mhp.behospital_day_num < #{bigDay}]]>
+            <![CDATA[ AND mhp.behospital_day_num <= #{bigDay}]]>
         </if>
         <if test="doctorName != null and doctorName != ''">
             AND mbi.doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
@@ -311,7 +315,8 @@
         a.check_time as checkTime,
         c.`level` as level,
         c.score_res as scoreRes,
-        case when a.check_type='0' and FIND_IN_SET(b.beh_dept_id,#{currentDeptIds}) then 0 else 1 end as isDel
+        <!-- 张三是A科室的监管员,李四是A科室和B科室的普通质控员,那么张三在核查任务列表中不能看到李四B科室的数据  -->
+        case when a.check_type='0' and FIND_IN_SET(b.beh_dept_id,#{currentDeptIds})=0 then 0 else 1 end as isDel
         from med_check_info a join med_behospital_info b on a.hospital_id=b.hospital_id and
         a.behospital_code=b.behospital_code
         join med_qcresult_info c on b.hospital_id=c.hospital_id and b.behospital_code=c.behospital_code and