فهرست منبع

ICSS获取科室信息修改

wangyu 6 سال پیش
والد
کامیت
7b1ab3cdb2

+ 21 - 12
icss-service/src/main/java/com/diagbot/facade/DeptInfoFacade.java

@@ -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;
     }
 }

+ 1 - 12
icss-service/src/main/java/com/diagbot/mapper/DeptInfoMapper.java

@@ -1,11 +1,7 @@
 package com.diagbot.mapper;
 
-import com.diagbot.dto.DeptInfoDTO;
-import com.diagbot.entity.DeptInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
+import com.diagbot.entity.DeptInfo;
 
 /**
  * <p>
@@ -17,11 +13,4 @@ import java.util.List;
  */
 public interface DeptInfoMapper extends BaseMapper<DeptInfo> {
 
-    /**
-     *  获取科室信息
-     * @param deptCode
-     * @param hospitalCode
-     * @return
-     */
-    public List<DeptInfoDTO> getDeptInfos(@Param("deptCode")String deptCode, @Param("hospitalCode")String hospitalCode);
 }

+ 0 - 11
icss-service/src/main/java/com/diagbot/service/DeptInfoService.java

@@ -1,11 +1,8 @@
 package com.diagbot.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.dto.DeptInfoDTO;
 import com.diagbot.entity.DeptInfo;
 
-import java.util.List;
-
 /**
  * <p>
  * 科室信息表 服务类
@@ -16,12 +13,4 @@ import java.util.List;
  */
 public interface DeptInfoService extends IService<DeptInfo> {
 
-    /**
-     * 获取科室信息
-     *
-     * @param deptCode
-     * @param hospitalCode
-     * @return
-     */
-    public List<DeptInfoDTO> getDeptInfos(String deptCode, String hospitalCode);
 }

+ 0 - 4
icss-service/src/main/java/com/diagbot/service/impl/DeptInfoServiceImpl.java

@@ -20,8 +20,4 @@ import java.util.List;
 @Service
 public class DeptInfoServiceImpl extends ServiceImpl<DeptInfoMapper, DeptInfo> implements DeptInfoService {
 
-    @Override
-    public List<DeptInfoDTO> getDeptInfos(String deptCode, String hospitalCode) {
-        return baseMapper.getDeptInfos(deptCode, hospitalCode);
-    }
 }

+ 2 - 3
icss-service/src/main/java/com/diagbot/web/DeptInfoController.java

@@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
-import java.util.List;
 
 /**
  * <p>
@@ -39,8 +38,8 @@ public class DeptInfoController {
                     "hospitalCode:医院编号,必填<br>")
     @PostMapping("/getDeptInfo")
     @SysLogger("getDeptInfo")
-    public RespDTO<List<DeptInfoDTO>> getDeptInfo(@Valid @RequestBody DeptInfoVO deptInfoVO) {
-        List<DeptInfoDTO> data = deptInfoFacade.getDeptInfo(deptInfoVO);
+    public RespDTO<DeptInfoDTO> getDeptInfo(@Valid @RequestBody DeptInfoVO deptInfoVO) {
+        DeptInfoDTO data = deptInfoFacade.getDeptInfo(deptInfoVO);
         return RespDTO.onSuc(data);
     }
 }

+ 0 - 7
icss-service/src/main/resources/mapper/DeptInfoMapper.xml

@@ -13,11 +13,4 @@
         <result column="name" property="name" />
         <result column="remark" property="remark" />
     </resultMap>
-
-    <select id="getDeptInfos" resultType="com.diagbot.dto.DeptInfoDTO">
-        SELECT a.* FROM `icss_dept_info` a
-        LEFT JOIN tran_hospital_dept b ON a.id = b.dept_id
-        WHERE a.is_deleted = 'N' AND b.is_deleted = 'N'
-        AND b.`code` = #{deptCode} AND b.hospital_code = #{hospitalCode}
-    </select>
 </mapper>