|
@@ -0,0 +1,58 @@
|
|
|
+package com.diagbot.facade;
|
|
|
+
|
|
|
+import com.diagbot.client.IcssServiceClient;
|
|
|
+import com.diagbot.dto.DeptInfoDTO;
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.entity.QuestionInfo;
|
|
|
+import com.diagbot.entity.QuestionUsual;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
+import com.diagbot.service.impl.QuestionUsualServiceImpl;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.UserUtils;
|
|
|
+import com.diagbot.vo.DeptInfoVO;
|
|
|
+import com.diagbot.vo.QuestionUsualVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:
|
|
|
+ * @author: wangyu
|
|
|
+ * @time: 2018/12/3 17:06
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class QuestionUsualFacade extends QuestionUsualServiceImpl {
|
|
|
+ @Autowired
|
|
|
+ private IcssServiceClient icssServiceClient ;
|
|
|
+
|
|
|
+ public Boolean addQuestionUsual(QuestionUsualVO questionUsualVO) {
|
|
|
+ DeptInfoVO deptInfoVO =new DeptInfoVO();
|
|
|
+ QuestionInfo questionInfo =new QuestionInfo();
|
|
|
+ BeanUtil.copyProperties(questionUsualVO,deptInfoVO);
|
|
|
+ RespDTO<List<DeptInfoDTO>> listRespDTO = icssServiceClient.getDeptInfo(deptInfoVO);
|
|
|
+ if (listRespDTO == null || !"0".equals(listRespDTO.code)) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR,
|
|
|
+ "获取科室信息失败");
|
|
|
+ }
|
|
|
+ questionInfo.setName(questionUsualVO.getQuestionName());
|
|
|
+ RespDTO<QuestionInfo> questionInfoRespDTO = icssServiceClient.getQuestionInfos(questionInfo);
|
|
|
+ if (questionInfoRespDTO == null || !"0".equals(questionInfoRespDTO.code)) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR,
|
|
|
+ "获取标签信息失败");
|
|
|
+ }
|
|
|
+ QuestionUsual questionUsual = new QuestionUsual();
|
|
|
+ questionUsual.setCreator(UserUtils.getCurrentPrincipleID());
|
|
|
+ questionUsual.setGmtCreate(DateUtil.now());
|
|
|
+ questionUsual.setQuestionId(questionInfoRespDTO.data.getId());
|
|
|
+ questionUsual.setDeptId(listRespDTO.data.get(0).getId());
|
|
|
+ Boolean flag = this.save(questionUsual);
|
|
|
+ if(!flag){
|
|
|
+ throw new CommonException(CommonErrorCode.FAIL,
|
|
|
+ "常用症状添加失败");
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+}
|