|
@@ -1,15 +1,16 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.dto.DeptInfoDTO;
|
|
|
-import com.diagbot.exception.CommonErrorCode;
|
|
|
-import com.diagbot.exception.CommonException;
|
|
|
+import com.diagbot.entity.DeptInfo;
|
|
|
+import com.diagbot.entity.HospitalDept;
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.service.impl.DeptInfoServiceImpl;
|
|
|
-import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.vo.DeptInfoVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
/**
|
|
|
* @Description:
|
|
|
* @author: wangyu
|
|
@@ -18,18 +19,26 @@ import java.util.List;
|
|
|
@Component
|
|
|
public class DeptInfoFacade extends DeptInfoServiceImpl {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ HospitalDeptFacade hospitalDeptFacade;
|
|
|
/**
|
|
|
* 获取科室信息
|
|
|
*
|
|
|
* @param deptInfoVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<DeptInfoDTO> getDeptInfo(DeptInfoVO deptInfoVO) {
|
|
|
- List<DeptInfoDTO> deptInfoDTOList = this.getDeptInfos(deptInfoVO.getDeptCode(), deptInfoVO.getHospitalCode());
|
|
|
- if (ListUtil.isEmpty(deptInfoDTOList)) {
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS,
|
|
|
- "获取科室信息失败");
|
|
|
- }
|
|
|
- return deptInfoDTOList;
|
|
|
+ public DeptInfoDTO getDeptInfo(DeptInfoVO deptInfoVO) {
|
|
|
+ QueryWrapper<HospitalDept> hospitalDeptQueryWrapper = new QueryWrapper<>();
|
|
|
+ hospitalDeptQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_code",deptInfoVO.getHospitalCode())
|
|
|
+ .eq("code",deptInfoVO.getDeptCode());
|
|
|
+ HospitalDept hospitalDept = hospitalDeptFacade.getOne(hospitalDeptQueryWrapper);
|
|
|
+ QueryWrapper<DeptInfo> deptInfoDTOQueryWrapper = new QueryWrapper<>();
|
|
|
+ deptInfoDTOQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("id",hospitalDept.getDeptId());
|
|
|
+ DeptInfo deptInfo = this.getOne(deptInfoDTOQueryWrapper);
|
|
|
+ DeptInfoDTO deptInfoDTO = new DeptInfoDTO();
|
|
|
+ BeanUtil.copyProperties(deptInfo,deptInfoDTO);
|
|
|
+ return deptInfoDTO;
|
|
|
}
|
|
|
}
|