|
@@ -3,22 +3,26 @@ package com.diagbot.facade;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.diagbot.dto.CheckDeptDTO;
|
|
|
import com.diagbot.dto.CheckMedoupDTO;
|
|
|
import com.diagbot.dto.DeptCheckUserDTO;
|
|
|
+import com.diagbot.dto.RejectPatientDTO;
|
|
|
import com.diagbot.entity.*;
|
|
|
-import com.diagbot.enums.CheckJobTypeEnum;
|
|
|
import com.diagbot.enums.CheckTypeEnum;
|
|
|
-import com.diagbot.enums.CheckerRoleEnum;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.impl.MedExamineInfoServiceImpl;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.util.SysUserUtils;
|
|
|
import com.diagbot.vo.BehospitalcodeVO;
|
|
|
+import com.diagbot.vo.MedAppealInfoVO;
|
|
|
import com.diagbot.vo.MedCheckInfoAddVO;
|
|
|
+import com.diagbot.vo.RejectedVo;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -43,11 +47,26 @@ public class MedExamineInfoFacade extends MedExamineInfoServiceImpl {
|
|
|
SysUserFacade sysUserFacade;
|
|
|
@Autowired
|
|
|
MedExamineInfoFacade medExamineInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ private BehospitalInfoFacade behospitalInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ private QcresultDetailFacade qcresultDetailFacade;
|
|
|
+ @Autowired
|
|
|
+ private MedRejectedInfoFacade medRejectedInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ private MedAppealInfoFacade medAppealInfoFacade;
|
|
|
|
|
|
public boolean passAudit(BehospitalcodeVO behospitalcodeVO) {
|
|
|
Long hospitalId = Long.parseLong(SysUserUtils.getCurrentHospitalID());
|
|
|
Long userId = Long.parseLong(SysUserUtils.getCurrentPrincipleID());
|
|
|
|
|
|
+ UpdateWrapper<BehospitalInfo> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("behospital_code", behospitalcodeVO.getBehospitalCode())
|
|
|
+ .eq("hospital_id", behospitalcodeVO.getHospitalId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N)
|
|
|
+ .set("status", "2");
|
|
|
+ behospitalInfoFacade.update(updateWrapper);
|
|
|
+
|
|
|
//获取判断是否有审核
|
|
|
QueryWrapper<MedExamineInfo> medExamineInfoQueryWrapper = new QueryWrapper<>();
|
|
|
medExamineInfoQueryWrapper.eq("behospital_code", behospitalcodeVO.getBehospitalCode());
|
|
@@ -58,6 +77,7 @@ public class MedExamineInfoFacade extends MedExamineInfoServiceImpl {
|
|
|
SysUser user = sysUserFacade.getOne(new QueryWrapper<SysUser>()
|
|
|
.eq("id", userId)
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey()));
|
|
|
+
|
|
|
if (medExamineInfo == null) {
|
|
|
MedExamineInfo insertCheckInfo = new MedExamineInfo();
|
|
|
insertCheckInfo.setBehospitalCode(behospitalcodeVO.getBehospitalCode());
|
|
@@ -84,238 +104,222 @@ public class MedExamineInfoFacade extends MedExamineInfoServiceImpl {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @param medCheckInfoAddVO
|
|
|
- * @return
|
|
|
+ * 驳回接口
|
|
|
*/
|
|
|
- public Boolean addMedCheckInfos(MedCheckInfoAddVO medCheckInfoAddVO) {
|
|
|
- boolean res = false;
|
|
|
- Date now = DateUtil.now();
|
|
|
- //获取人员id 和 该人员的医院id
|
|
|
- Long hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
|
|
|
- Long principleId = Long.valueOf(SysUserUtils.getCurrentPrincipleID());
|
|
|
- QueryWrapper<SysUser> userQuer = new QueryWrapper<>();
|
|
|
- userQuer.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("id", principleId)
|
|
|
- .eq("status", 1);
|
|
|
- SysUser user = sysUserFacade.getOne(userQuer);
|
|
|
- String principleName = user.getLinkman();
|
|
|
- Map<String, Object> mapAll = new HashMap<String, Object>();
|
|
|
- mapAll.put("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
- mapAll.put("behospital_code", medCheckInfoAddVO.getBehospitalCode());
|
|
|
- mapAll.put("hospital_id", hospitalId);
|
|
|
- mapAll.put("check_type", medCheckInfoAddVO.getCheckType());
|
|
|
- QueryWrapper<MedExamineInfo> medCheckInfoQuerys = new QueryWrapper<>();
|
|
|
- medCheckInfoQuerys.allEq(mapAll);
|
|
|
- MedExamineInfo data = this.getOne(medCheckInfoQuerys, false);
|
|
|
- if (data != null) {
|
|
|
- //检验核查人是否是本人
|
|
|
- if (data.getCheckId().equals(principleId)) {
|
|
|
- res = saveNew(mapAll, now, hospitalId, principleId, principleName, medCheckInfoAddVO);
|
|
|
- } else {
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "该数据已被人核查,您暂无权限!");
|
|
|
- }
|
|
|
+ public Boolean rejected(RejectedVo rejectedVo) {
|
|
|
+ //通过医院id+病历id+条目ID+未删除 获取该缺陷记录
|
|
|
+ QcresultDetail qcresultDetail = getQcresultDetailById(rejectedVo);
|
|
|
+ //获取该病历缺陷申诉记录(医院id+病历id+质控缺陷id+未删除)
|
|
|
+ MedRejectedInfo medRejectedInfo = getMedRejectedInfo(rejectedVo.getHospitalId()
|
|
|
+ , rejectedVo.getBehospitalCode()
|
|
|
+ , rejectedVo.getCasesEntryId());
|
|
|
+ //缺陷状态-删除或忽略
|
|
|
+ if (IsDeleteEnum.Y.getKey().equals(qcresultDetail.getIsDeleted())) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该缺陷已被删除或忽略!");
|
|
|
+ }
|
|
|
+ //修改病历状态-驳回
|
|
|
+ UpdateWrapper<BehospitalInfo> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("behospital_code", rejectedVo.getBehospitalCode())
|
|
|
+ .eq("hospital_id", rejectedVo.getHospitalId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N)
|
|
|
+ .set("status", "3");
|
|
|
+ behospitalInfoFacade.update(updateWrapper);
|
|
|
+
|
|
|
+ // 获取病历信息
|
|
|
+ BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
|
|
|
+ .eq("behospital_code", rejectedVo.getBehospitalCode())
|
|
|
+ .eq("hospital_id", rejectedVo.getHospitalId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N));
|
|
|
+
|
|
|
+ //驳回记录不存在
|
|
|
+ if (medRejectedInfo == null) {
|
|
|
+ //新增驳回记录
|
|
|
+ return addmedRejectedInfo(rejectedVo, behospitalInfo.getDoctorId());
|
|
|
} else {
|
|
|
- //该病历没有核查的时候, 就添加核查记录
|
|
|
- MedExamineInfo medCheckInfo = new MedExamineInfo();
|
|
|
- medCheckInfo.setGmtCreate(now);
|
|
|
- medCheckInfo.setGmtModified(now);
|
|
|
- medCheckInfo.setHospitalId(hospitalId);
|
|
|
- medCheckInfo.setCheckId(principleId);
|
|
|
- medCheckInfo.setCheckName(principleName);
|
|
|
- medCheckInfo.setCheckTime(now);
|
|
|
- medCheckInfo.setAction(medCheckInfoAddVO.getCheckType());
|
|
|
- medCheckInfo.setStatus(medCheckInfoAddVO.getCheckStatus());
|
|
|
- medCheckInfo.setBehospitalCode(medCheckInfoAddVO.getBehospitalCode());
|
|
|
- res = this.save(medCheckInfo);
|
|
|
+ //删除驳回记录
|
|
|
+ medRejectedInfoFacade.update(new UpdateWrapper<MedRejectedInfo>().set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
+ .eq("id", medRejectedInfo.getId()));
|
|
|
+ //新增驳回记录
|
|
|
+ return addmedRejectedInfo(rejectedVo, behospitalInfo.getDoctorId());
|
|
|
}
|
|
|
|
|
|
- return res;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @param mapAll
|
|
|
- * @param now
|
|
|
- * @param hospitalId
|
|
|
- * @param principleId
|
|
|
- * @param principleName
|
|
|
- * @param medCheckInfoAddVO
|
|
|
- * @return
|
|
|
+ * @param rejectedVo
|
|
|
+ * @Description通过医院id+病历id+条目ID+未删除 获取该缺陷记录
|
|
|
+ * @Return QcresultDetail
|
|
|
*/
|
|
|
- public boolean saveNew(Map<String, Object> mapAll, Date now, Long hospitalId, Long principleId, String principleName, MedCheckInfoAddVO medCheckInfoAddVO) {
|
|
|
- boolean res = false;
|
|
|
- UpdateWrapper<MedExamineInfo> medCheckInfoUpdate = new UpdateWrapper<>();
|
|
|
- medCheckInfoUpdate.allEq(mapAll).set("is_deleted", IsDeleteEnum.Y.getKey()).set("gmt_modified", now);
|
|
|
- res = this.update(medCheckInfoUpdate);
|
|
|
- //删除原来的成功后, 再新建一条核查数据
|
|
|
- if (res) {
|
|
|
- MedExamineInfo medCheckInfo = new MedExamineInfo();
|
|
|
- medCheckInfo.setGmtCreate(now);
|
|
|
- medCheckInfo.setGmtModified(now);
|
|
|
- medCheckInfo.setHospitalId(hospitalId);
|
|
|
- medCheckInfo.setCheckId(principleId);
|
|
|
- medCheckInfo.setCheckName(principleName);
|
|
|
- medCheckInfo.setCheckTime(now);
|
|
|
- medCheckInfo.setAction(medCheckInfoAddVO.getCheckType());
|
|
|
- medCheckInfo.setStatus(medCheckInfoAddVO.getCheckStatus());
|
|
|
- medCheckInfo.setBehospitalCode(medCheckInfoAddVO.getBehospitalCode());
|
|
|
- res = this.save(medCheckInfo);
|
|
|
+ private QcresultDetail getQcresultDetailById(RejectedVo rejectedVo) {
|
|
|
+ if (rejectedVo.getCasesEntryId() == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "条目ID为空!");
|
|
|
+ }
|
|
|
+ List<QcresultDetail> qcresultDetails = qcresultDetailFacade.list(new QueryWrapper<QcresultDetail>()
|
|
|
+ .eq("hospital_id", rejectedVo.getHospitalId())
|
|
|
+ .eq("behospital_code", rejectedVo.getBehospitalCode())
|
|
|
+ .eq("cases_entry_id", rejectedVo.getCasesEntryId())
|
|
|
+ .orderByDesc("id"));
|
|
|
+ if (ListUtil.isEmpty(qcresultDetails)) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "质控缺陷不存在!");
|
|
|
}
|
|
|
- return res;
|
|
|
+ return qcresultDetails.get(0);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @Author songxl
|
|
|
- * @Description 院区人员用户科室合并
|
|
|
- * @time: 2024/6/1
|
|
|
- * @Param [checkRoleMap, checkUserDTOS, s]
|
|
|
- * @Return void
|
|
|
- * @MethodName margeDept
|
|
|
+ * @param hospitalId
|
|
|
+ * @param behospitalCode
|
|
|
+ * @param getCasesEntryId
|
|
|
+ * @Description获取该病历缺陷申诉记录
|
|
|
+ * @Return MedRejectedInfo
|
|
|
*/
|
|
|
- private void margeDept(Map<String, List<CheckDeptDTO>> checkRoleMap, List<DeptCheckUserDTO> checkUserDTOS, String roleId) {
|
|
|
- if (ListUtil.isEmpty(checkUserDTOS)) {
|
|
|
- return;
|
|
|
+ private MedRejectedInfo getMedRejectedInfo(Long hospitalId, String behospitalCode, Long getCasesEntryId) {
|
|
|
+
|
|
|
+ if (getCasesEntryId == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "质控缺陷id为空!");
|
|
|
+ }
|
|
|
+ List<MedRejectedInfo> medRejectedInfos = medRejectedInfoFacade.list(new QueryWrapper<MedRejectedInfo>()
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .eq("behospital_code", behospitalCode)
|
|
|
+ .eq("cases_entry_id", getCasesEntryId)
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .orderByDesc("gmt_create"));
|
|
|
+ if (ListUtil.isNotEmpty(medRejectedInfos)) {
|
|
|
+ return medRejectedInfos.get(0);
|
|
|
}
|
|
|
- Set<String> userIds = checkUserDTOS.stream().map(DeptCheckUserDTO::getDoctorId).collect(Collectors.toSet());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param rejectedVo
|
|
|
+ * @Description 驳回记录插入
|
|
|
+ * @Return Boolean
|
|
|
+ */
|
|
|
+ private Boolean addmedRejectedInfo(RejectedVo rejectedVo,String doctorId) {
|
|
|
try {
|
|
|
- List<CheckDeptDTO> tempDepts = new ArrayList<>();
|
|
|
- //全部
|
|
|
- CheckDeptDTO allCheckDept = new CheckDeptDTO();
|
|
|
- allCheckDept.setDeptId("-1");
|
|
|
- allCheckDept.setDeptName("全部");
|
|
|
- userIds.stream().forEach(userId -> {
|
|
|
- //获取该用户的科室拼接
|
|
|
- StringBuilder deptIdBuilder = new StringBuilder();
|
|
|
- StringBuilder deptNameBuilder = new StringBuilder();
|
|
|
- StringBuilder userName = new StringBuilder();
|
|
|
- checkUserDTOS.stream().forEach(checkUserDTO -> {
|
|
|
- if (userId.equals(checkUserDTO.getDoctorId())) {
|
|
|
- deptIdBuilder.append(checkUserDTO.getDeptId()).append(",");
|
|
|
- deptNameBuilder.append(checkUserDTO.getDeptName()).append(",");
|
|
|
- if (userName.length() == 0) {
|
|
|
- userName.append(checkUserDTO.getDoctorName());
|
|
|
- }
|
|
|
- //除了全部以外添加科室信息
|
|
|
- if (!tempDepts.stream().map(CheckDeptDTO::getDeptId).collect(Collectors.toList())
|
|
|
- .contains(checkUserDTO.getDeptId())) {
|
|
|
- CheckDeptDTO oneCheckUser = new CheckDeptDTO();
|
|
|
- oneCheckUser.setDeptId(checkUserDTO.getDeptId());
|
|
|
- oneCheckUser.setDeptName(checkUserDTO.getDeptName());
|
|
|
- tempDepts.add(oneCheckUser);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //合并科室
|
|
|
- String deptId = deptIdBuilder.substring(0, deptIdBuilder.length() - 1);
|
|
|
- String deptName = deptNameBuilder.substring(0, deptNameBuilder.length() - 1);
|
|
|
- //科室用户
|
|
|
- DeptCheckUserDTO deptCheckUserDTO = new DeptCheckUserDTO();
|
|
|
- deptCheckUserDTO.setDoctorId(userId);
|
|
|
- deptCheckUserDTO.setDoctorName(userName.toString());
|
|
|
- deptCheckUserDTO.setDeptId(deptId);
|
|
|
- deptCheckUserDTO.setDeptName(deptName);
|
|
|
- AtomicBoolean hasFlag = new AtomicBoolean(false);
|
|
|
- //全部处理
|
|
|
-// if (ListUtil.isEmpty(allCheckDept.getDeptcheckUsers())) {
|
|
|
-// allCheckDept.getDeptcheckUsers().add(deptCheckUserDTO);
|
|
|
-// }
|
|
|
-// allCheckDept.getDeptcheckUsers().forEach(oneDeptCheckUser -> {
|
|
|
-// if (!userId.equals(oneDeptCheckUser.getDoctorId())) {
|
|
|
-// hasFlag.set(true);
|
|
|
-// }
|
|
|
-// });
|
|
|
-// if (hasFlag.get()) {
|
|
|
-// allCheckDept.getDeptcheckUsers().add(deptCheckUserDTO);
|
|
|
-// }
|
|
|
-//
|
|
|
-// tempDepts.stream().forEach(checkDeptDTO -> {
|
|
|
-// if (deptId.contains(checkDeptDTO.getDeptId())) {
|
|
|
-// checkDeptDTO.getDeptcheckUsers().add(deptCheckUserDTO);
|
|
|
-// }
|
|
|
-// });
|
|
|
- });
|
|
|
- tempDepts.add(0, allCheckDept);
|
|
|
- checkRoleMap.put(roleId + "", tempDepts);
|
|
|
+ MedRejectedInfo medRejectedInfo = new MedRejectedInfo();
|
|
|
+ BeanUtils.copyProperties(rejectedVo, medRejectedInfo);
|
|
|
+ medRejectedInfo.setDoctorId(doctorId);
|
|
|
+ medRejectedInfo.setGmtCreate(DateUtil.now());
|
|
|
+ return medRejectedInfoFacade.save(medRejectedInfo);
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ throw new CommonException(CommonErrorCode.SERVICE_STOP_ERROR, "驳回记录插入失败!");
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 申诉接口
|
|
|
+ **/
|
|
|
+ public Boolean addAppealInfo(MedAppealInfoVO medAppealInfoVO) {
|
|
|
+
|
|
|
+ if (medAppealInfoVO.getCasesEntryId() == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "质控缺陷id为空!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改病历状态-申诉
|
|
|
+ UpdateWrapper<BehospitalInfo> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("behospital_code", medAppealInfoVO.getBehospitalCode())
|
|
|
+ .eq("hospital_id", medAppealInfoVO.getHospitalId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N)
|
|
|
+ .set("status", "5");
|
|
|
+ behospitalInfoFacade.update(updateWrapper);
|
|
|
|
|
|
+ //获取该病历缺陷申诉记录(医院id+病历id+质控缺陷id+未删除)
|
|
|
+ List<MedAppealInfo> medAppealInfos = medAppealInfoFacade.list(new QueryWrapper<MedAppealInfo>()
|
|
|
+ .eq("hospital_id", medAppealInfoVO.getHospitalId())
|
|
|
+ .eq("behospital_code", medAppealInfoVO.getBehospitalCode())
|
|
|
+ .eq("cases_entry_id", medAppealInfoVO.getCasesEntryId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .orderByDesc("gmt_create"));
|
|
|
+ if (ListUtil.isEmpty(medAppealInfos)) {
|
|
|
+ return addmedAppealInfo(medAppealInfoVO);
|
|
|
+ } else {
|
|
|
+ //删除申诉记录
|
|
|
+ medAppealInfoFacade.update(new UpdateWrapper<MedAppealInfo>().set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
+ .eq("id", medAppealInfos.get(0).getId()));
|
|
|
+
|
|
|
+ //新增申诉记录
|
|
|
+ return addmedAppealInfo(medAppealInfoVO);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @Author songxl
|
|
|
- * @Description 拼装科室、核查人员、任务数对象
|
|
|
- * @time: 2024/5/17
|
|
|
- * @Param [checkRoleMap, doctorInfos, userJobs, deptInfos, roleId]
|
|
|
- * @Return void
|
|
|
- * @MethodName addCheckInfoMap
|
|
|
+ * @param medAppealInfoVO
|
|
|
+ * @Description 申诉记录插入
|
|
|
+ * @Return Boolean
|
|
|
*/
|
|
|
- private void addCheckInfoMaps(Map<String, List<CheckDeptDTO>> checkRoleMap, Map<String, String> deptMap,
|
|
|
- List<DeptCheckUserDTO> userJobs, List<DeptCheckUserDTO> checkUserDTOS, int roleId, int jobType) {
|
|
|
- //非院区任务
|
|
|
- if (CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() != jobType) {
|
|
|
- if (deptMap.isEmpty() || checkUserDTOS.isEmpty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- checkRoleMap.put(roleId + "", new ArrayList<>());
|
|
|
- //遍历科室
|
|
|
- for (String deptId : deptMap.keySet()) {
|
|
|
- //科室对象
|
|
|
- CheckDeptDTO checkDeptDTO = new CheckDeptDTO();
|
|
|
- checkDeptDTO.setDeptId(deptId);
|
|
|
- checkDeptDTO.setDeptName(deptMap.get(deptId));
|
|
|
-// checkDeptDTO.setDeptcheckUsers(new ArrayList<DeptCheckUserDTO>());
|
|
|
- //遍历医生
|
|
|
- for (DeptCheckUserDTO checkUserDTO : checkUserDTOS) {
|
|
|
- //同一科室
|
|
|
- if (checkDeptDTO.getDeptId().equals(checkUserDTO.getDeptId())) {
|
|
|
- DeptCheckUserDTO deptCheckUserDTO = new DeptCheckUserDTO();
|
|
|
- deptCheckUserDTO.setDeptId(checkUserDTO.getDeptId());
|
|
|
- deptCheckUserDTO.setDeptName(checkUserDTO.getDeptName());
|
|
|
- deptCheckUserDTO.setDoctorId(checkUserDTO.getDoctorId());
|
|
|
- deptCheckUserDTO.setDoctorName(checkUserDTO.getDoctorName());
|
|
|
-// checkDeptDTO.getDeptcheckUsers().add(deptCheckUserDTO);
|
|
|
- }
|
|
|
- }
|
|
|
-// for (DeptCheckUserDTO deptCheckUserDTO : checkDeptDTO.getDeptcheckUsers()) {
|
|
|
-// //遍历数量
|
|
|
-// for (DeptCheckUserDTO jobNumDto : userJobs) {
|
|
|
-// //这个科室有这个人
|
|
|
-// if (deptCheckUserDTO.getDeptId().equals(jobNumDto.getDeptId())) {
|
|
|
-// if (deptCheckUserDTO.getDoctorId().equals(jobNumDto.getDoctorId())) {
|
|
|
-// if (jobNumDto.getStatus() == 0) {
|
|
|
-// deptCheckUserDTO.setJobNum(jobNumDto.getJobNum());
|
|
|
-// }
|
|
|
-// if (jobNumDto.getStatus() == 1) {
|
|
|
-//
|
|
|
-// deptCheckUserDTO.setCheckNum(jobNumDto.getJobNum());
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
- checkRoleMap.get(roleId + "").add(checkDeptDTO);
|
|
|
- }
|
|
|
+ private Boolean addmedAppealInfo(MedAppealInfoVO medAppealInfoVO) {
|
|
|
+ try {
|
|
|
+ MedAppealInfo medAppealInfo = new MedAppealInfo();
|
|
|
+ BeanUtils.copyProperties(medAppealInfoVO, medAppealInfo);
|
|
|
+ medAppealInfo.setGmtCreate(DateUtil.now());
|
|
|
+ return medAppealInfoFacade.save(medAppealInfo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVICE_STOP_ERROR, "申诉记录插入失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param behospitalcodeVO
|
|
|
+ * @Description 获取全部驳回记录
|
|
|
+ * @Return QcresultDetail
|
|
|
+ */
|
|
|
+ public List<RejectPatientDTO> getRejectPatient(BehospitalcodeVO behospitalcodeVO) {
|
|
|
+ List<RejectPatientDTO> rejectPatientDTOList = new ArrayList<>();
|
|
|
+ //获取该病历缺陷申诉记录(医院id+病历id+质控缺陷id+未删除)
|
|
|
+ List<MedRejectedInfo> medRejectedInfos = medRejectedInfoFacade.list(new QueryWrapper<MedRejectedInfo>()
|
|
|
+ .eq("hospital_id", behospitalcodeVO.getHospitalId())
|
|
|
+ .eq("behospital_code", behospitalcodeVO.getBehospitalCode())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .orderByDesc("gmt_create"));
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(medRejectedInfos)) {
|
|
|
+ return rejectPatientDTOList;
|
|
|
+ }
|
|
|
+
|
|
|
+ String doctorId = medRejectedInfos.get(0).getDoctorId();
|
|
|
+ if (StringUtil.isEmpty(doctorId)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "入院登记信息中未找到主治医生!");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<MedRejectedInfo> medReInfos = medRejectedInfoFacade.list(new QueryWrapper<MedRejectedInfo>()
|
|
|
+ .eq("hospital_id", behospitalcodeVO.getHospitalId())
|
|
|
+ .eq("doctor_id", doctorId)
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .orderByDesc("gmt_create"));
|
|
|
+
|
|
|
+ List<String> beHospitalCodeList = new ArrayList<>();
|
|
|
+ for (MedRejectedInfo medRejectedInfo : medReInfos) {
|
|
|
+ beHospitalCodeList.add(medRejectedInfo.getBehospitalCode());
|
|
|
}
|
|
|
- //院区任务不是同一科室的人员数量增加
|
|
|
-// else if (CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() == jobType) {
|
|
|
-// checkRoleMap.get(roleId + "").stream().forEach(checkDeptDTO -> {
|
|
|
-// if (!ListUtil.isEmpty(checkDeptDTO.getDeptcheckUsers())) {
|
|
|
-// checkDeptDTO.getDeptcheckUsers().stream().forEach(deptCheckUser -> {
|
|
|
-// userJobs.stream().forEach(userJob -> {
|
|
|
-// if (deptCheckUser.getDoctorId().equals(userJob.getDoctorId())) {
|
|
|
-// if (userJob.getStatus() == 0) {
|
|
|
-// deptCheckUser.setJobNum(userJob.getJobNum());
|
|
|
-// }
|
|
|
-// if (userJob.getStatus() == 1) {
|
|
|
-// deptCheckUser.setCheckNum(userJob.getJobNum());
|
|
|
-// }
|
|
|
-// }
|
|
|
-// });
|
|
|
-// });
|
|
|
-// }
|
|
|
-// });
|
|
|
-// }
|
|
|
+ // 构建查询条件(含空值检查)
|
|
|
+ QueryWrapper<BehospitalInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda()
|
|
|
+ .eq(BehospitalInfo::getHospitalId, behospitalcodeVO.getHospitalId())
|
|
|
+ .eq(BehospitalInfo::getIsDeleted, IsDeleteEnum.N);
|
|
|
+ if (!CollectionUtils.isEmpty(beHospitalCodeList)) {
|
|
|
+ queryWrapper.lambda().in(BehospitalInfo::getBehospitalCode, beHospitalCodeList);
|
|
|
+ }
|
|
|
+ queryWrapper.lambda().select(BehospitalInfo::getName,
|
|
|
+ BehospitalInfo::getSex,
|
|
|
+ BehospitalInfo::getFileCode,
|
|
|
+ BehospitalInfo::getBehospitalCode);
|
|
|
+
|
|
|
+ rejectPatientDTOList = behospitalInfoFacade.list(queryWrapper)
|
|
|
+ .stream()
|
|
|
+ .map(this::convertToRejectPatientDTO)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return rejectPatientDTOList;
|
|
|
}
|
|
|
+
|
|
|
+ // 对象转换方法
|
|
|
+ private RejectPatientDTO convertToRejectPatientDTO(BehospitalInfo info) {
|
|
|
+ return RejectPatientDTO.builder()
|
|
|
+ .name(info.getName())
|
|
|
+ .sex(info.getSex())
|
|
|
+ .fileCode(info.getFileCode())
|
|
|
+ .behospitalCode(info.getBehospitalCode())
|
|
|
+ .build();
|
|
|
+ }
|
|
|
+
|
|
|
}
|