Browse Source

代码使用封装好的方法

gaodm 6 years atrás
parent
commit
cef392c6cd

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

@@ -11,6 +11,7 @@ import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.DeptInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
+import com.diagbot.util.RespDTOUtil;
 import com.diagbot.vo.DeptInfoVO;
 import com.diagbot.vo.HospitalDeptInfoVO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,8 +37,7 @@ public class DeptInfoFacade extends DeptInfoServiceImpl {
         HospitalDeptInfoVO hospitalDeptInfoVO = new HospitalDeptInfoVO();
         BeanUtil.copyProperties(deptInfoVO,hospitalDeptInfoVO);
         RespDTO<HospitalDeptInfoDTO> hospitalDeptInfoDTORespDTO = tranServiceClient.getHospitalDeptInfo(hospitalDeptInfoVO);
-        if (hospitalDeptInfoDTORespDTO == null
-                || !CommonErrorCode.OK.getCode().equals(hospitalDeptInfoDTORespDTO.code)) {
+        if (RespDTOUtil.respIsNG(hospitalDeptInfoDTORespDTO)) {
             throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取科室信息失败");
         }

+ 2 - 2
icss-service/src/main/java/com/diagbot/facade/DoctorInfoFacade.java

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import java.util.List;
 import java.util.Map;
 
+import com.diagbot.util.RespDTOUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -31,8 +32,7 @@ public class DoctorInfoFacade {
      */
     public List<DoctorInfoDTO> getDoctorInfo(DoctorInfoVO doctorInfoVo) {
         RespDTO<List<DoctorInfoDTO>> doctorInfoDTOList = tranServiceClient.getDoctorInfo(doctorInfoVo);
-        if (doctorInfoDTOList == null
-                || !CommonErrorCode.OK.getCode().equals(doctorInfoDTOList.code)) {
+        if (RespDTOUtil.respIsNG(doctorInfoDTOList)) {
             throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取医生信息失败");
         }

+ 2 - 2
icss-service/src/main/java/com/diagbot/facade/HospitalInfoFacade.java

@@ -5,6 +5,7 @@ import com.diagbot.dto.HospitalInfoDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.util.RespDTOUtil;
 import com.diagbot.vo.HospitalInfoVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -30,8 +31,7 @@ public class HospitalInfoFacade {
      */
     public List<HospitalInfoDTO> getHospitalInfo(HospitalInfoVO hospitalInfoVO) {
         RespDTO<List<HospitalInfoDTO>> hospitalInfoDTOList = tranServiceClient.getHospitalInfo(hospitalInfoVO);
-        if (hospitalInfoDTOList == null
-                || !CommonErrorCode.OK.getCode().equals(hospitalInfoDTOList.code)) {
+        if (RespDTOUtil.respIsNG(hospitalInfoDTOList)) {
             throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取医院信息失败");
         }

+ 4 - 5
icss-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java

@@ -11,6 +11,7 @@ import com.diagbot.entity.PatientInfo;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.util.RespDTOUtil;
 import com.diagbot.vo.GetTopPatientInfoVO;
 import com.diagbot.vo.PatientInfoVO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -43,8 +44,7 @@ public class PatientInfoFacade {
      */
     public PatientInfoDTO getPatientInfo(PatientInfoVO patientInfoVO) {
         RespDTO<PatientInfoDTO> patientInfoDTO = tranServiceClient.getPatientInfo(patientInfoVO);
-        if (patientInfoDTO == null
-                || !CommonErrorCode.OK.getCode().equals(patientInfoDTO.code)) {
+        if (RespDTOUtil.respIsNG(patientInfoDTO)) {
             throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取患者信息失败");
         }
@@ -59,7 +59,7 @@ public class PatientInfoFacade {
      */
     public GetTopPatientInfoDTO getTopPatientInfo(@RequestBody GetTopPatientInfoVO getTopPatientInfoVO) {
         RespDTO<GetTopPatientInfoDTO> respDTO = tranServiceClient.getTopPatientInfo(getTopPatientInfoVO);
-        if (respDTO == null || !"0".equals(respDTO.code)) {
+        if (RespDTOUtil.respIsNG(respDTO)) {
             throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "页面顶部病人医生科室信息");
         }
@@ -94,8 +94,7 @@ public class PatientInfoFacade {
      */
     public Map<Long, PatientInfo> patientInfoMapByIds(List<Long> ids) {
         RespDTO<Map<Long, PatientInfo>> retData = tranServiceClient.patientInfoMapByIds(ids);
-        if (retData == null
-                || !CommonErrorCode.OK.getCode().equals(retData.code)) {
+        if (RespDTOUtil.respIsNG(retData)) {
             throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取患者信息失败");
         }

+ 2 - 1
icss-service/src/main/java/com/diagbot/facade/TranFieldInfoFacade.java

@@ -5,6 +5,7 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.TranFieldInfoDTO;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.util.RespDTOUtil;
 import com.diagbot.vo.TranFieldInfoVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -30,7 +31,7 @@ public class TranFieldInfoFacade {
      */
     public List<TranFieldInfoDTO> getInfoByUuid(TranFieldInfoVO info) {
         RespDTO<List<TranFieldInfoDTO>> tranFieldInfoDTOList = tranServiceClient.getInfoByUuid(info);
-        if (tranFieldInfoDTOList == null || !CommonErrorCode.OK.getCode().equals(tranFieldInfoDTOList.code)) {
+        if (RespDTOUtil.respIsNG(tranFieldInfoDTOList)) {
             throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取医生信息失败");
         }

+ 1 - 0
icss-service/src/main/java/com/diagbot/web/CalculateController.java

@@ -24,6 +24,7 @@ import java.util.Map;
 @RestController
 @RequestMapping("/calc")
 @Api(value = "计算相关API", tags = { "2期-计算相关API" })
+@SuppressWarnings("unchecked")
 public class CalculateController {
     @Autowired
     CalculateFacade calculateFacade;