|
@@ -1,7 +1,10 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.diagbot.client.TranServiceClient;
|
|
|
+import com.diagbot.dto.EMRIntroduceDetailDTO;
|
|
|
import com.diagbot.dto.IntroduceDTO;
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.entity.IntroduceDetail;
|
|
|
import com.diagbot.entity.IntroduceInfo;
|
|
|
import com.diagbot.entity.IntroduceMap;
|
|
@@ -11,13 +14,21 @@ import com.diagbot.enums.QuestionTypeEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.impl.IntroduceInfoServiceImpl;
|
|
|
+import com.diagbot.util.ArrayUtil;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.RespDTOUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.vo.EMRIntroduceVO;
|
|
|
+import com.diagbot.vo.HosCodeVO;
|
|
|
import com.diagbot.vo.IntroduceByQuestionVO;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @Description:
|
|
@@ -32,6 +43,8 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
|
IntroduceDetailFacade introduceDetailFacade;
|
|
|
@Autowired
|
|
|
QuestionFacade questionFacade;
|
|
|
+ @Autowired
|
|
|
+ TranServiceClient tranServiceClient;
|
|
|
|
|
|
/**
|
|
|
* 根据标签id获取提示信息
|
|
@@ -135,4 +148,117 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
|
public IntroduceDTO getRecordById(Long id) {
|
|
|
return getRecordByIdAndPosition(id, null);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取电子病历评级提示信息
|
|
|
+ *
|
|
|
+ * @param emrIntroduceVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<EMRIntroduceDetailDTO> getIntroduceByEMR(EMRIntroduceVO emrIntroduceVO) {
|
|
|
+ //入参处理
|
|
|
+ HosCodeVO hosCodeVO = new HosCodeVO();
|
|
|
+ hosCodeVO.setHosCode(emrIntroduceVO.getHosCode());
|
|
|
+ //公表转换
|
|
|
+ String uniqueName = "";
|
|
|
+ Integer type = emrIntroduceVO.getType();
|
|
|
+ if (type.equals(QuestionTypeEnum.Lis.getKey())) {
|
|
|
+ if (StringUtil.isNotBlank(emrIntroduceVO.getName())) {
|
|
|
+ if (StringUtil.isNotBlank(emrIntroduceVO.getDetailName())) {
|
|
|
+ RespDTO<Map<String, Map<String, String>>> respLisConfigMap = tranServiceClient.getLisConfigByHosCode_NotEmptyItemName(hosCodeVO);
|
|
|
+ if (RespDTOUtil.respIsNG(respLisConfigMap)) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR);
|
|
|
+ }
|
|
|
+ Map<String, Map<String, String>> lisConfigMap = respLisConfigMap.data;
|
|
|
+ uniqueName = lisConfigMap.get(emrIntroduceVO.getName()).get(emrIntroduceVO.getDetailName());
|
|
|
+ } else {
|
|
|
+ RespDTO<Map<String, String>> respLisConfigMap_emptyItemName = tranServiceClient.getLisConfigByHosCode_EmptyItemName(hosCodeVO);
|
|
|
+ if (RespDTOUtil.respIsNG(respLisConfigMap_emptyItemName)) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR);
|
|
|
+ }
|
|
|
+ Map<String, String> lisConfigMap_emptyItemName = respLisConfigMap_emptyItemName.data;
|
|
|
+ uniqueName = lisConfigMap_emptyItemName.get(emrIntroduceVO.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type.equals(QuestionTypeEnum.Pacs.getKey())) {
|
|
|
+ RespDTO<Map<String, String>> respPacsConfigMap = tranServiceClient.getPacsConfigByHosCode(hosCodeVO);
|
|
|
+ if (RespDTOUtil.respIsNG(respPacsConfigMap)) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR);
|
|
|
+ }
|
|
|
+ Map<String, String> pacsConfigMap = respPacsConfigMap.data;
|
|
|
+ uniqueName = pacsConfigMap.get(emrIntroduceVO.getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ //未找到公表映射项目
|
|
|
+ if (uniqueName == null || StringUtil.isBlank(uniqueName)) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "项目未找到");
|
|
|
+ }
|
|
|
+
|
|
|
+ RespDTO<Map<String, String>> respTitleMappingMap = tranServiceClient.getTitleMappingHosCode(hosCodeVO);
|
|
|
+ Map<String, String> titleMappingMap = respTitleMappingMap.data;
|
|
|
+ String[] titles = emrIntroduceVO.getTitles();
|
|
|
+ Map<String, String> titleMapping = new LinkedHashMap<>();
|
|
|
+ List<String> uniqueTitleList = Lists.newLinkedList();
|
|
|
+ if (ArrayUtil.isNotEmpty(titles)) {
|
|
|
+ for (String title : titles) {
|
|
|
+ String uniqueTitle = titleMappingMap.get(title);
|
|
|
+ titleMapping.put(title, uniqueTitle);
|
|
|
+ if (StringUtil.isNotBlank(uniqueTitle)) {
|
|
|
+ uniqueTitleList.add(uniqueTitle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("tag_name", uniqueName)
|
|
|
+ .eq("type", type);
|
|
|
+ QuestionInfo questionInfo = questionFacade.getOne(questionInfoQueryWrapper);
|
|
|
+ if (questionInfo == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "公表标签不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ QueryWrapper<IntroduceMap> introduceMapQueryWrapper = new QueryWrapper<>();
|
|
|
+ introduceMapQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
+ eq("type", type).
|
|
|
+ eq("question_id", questionInfo.getId());
|
|
|
+ IntroduceMap introduceMap = introduceMapFacade.getOne(introduceMapQueryWrapper);
|
|
|
+ if (introduceMap == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息未维护");
|
|
|
+ }
|
|
|
+
|
|
|
+ QueryWrapper<IntroduceDetail> introduceDetailQueryWrapper = new QueryWrapper<>();
|
|
|
+ introduceDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
+ eq("introduce_id", introduceMap.getIntroduceId()).
|
|
|
+ orderByAsc("order_no");
|
|
|
+ //如果标题列表未传,全部返回
|
|
|
+ if (ArrayUtil.isNotEmpty(emrIntroduceVO.getTitles())) {
|
|
|
+ if (ListUtil.isNotEmpty(uniqueTitleList)) {
|
|
|
+ introduceDetailQueryWrapper.in("title", uniqueTitleList);
|
|
|
+ } else {
|
|
|
+ //标题未匹配上,不返回数据,加一个不成立的条件
|
|
|
+ introduceDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.Y.getKey());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<IntroduceDetail> introduceDetailList = introduceDetailFacade.list(introduceDetailQueryWrapper);
|
|
|
+ List<EMRIntroduceDetailDTO> retList = Lists.newLinkedList();
|
|
|
+ if (ArrayUtil.isNotEmpty(emrIntroduceVO.getTitles())) {
|
|
|
+ for (Map.Entry<String, String> entry : titleMapping.entrySet()) {
|
|
|
+ EMRIntroduceDetailDTO detailDTO = new EMRIntroduceDetailDTO();
|
|
|
+ detailDTO.setTitle(entry.getKey());
|
|
|
+ if (StringUtil.isNotBlank(entry.getValue())) {
|
|
|
+ for (IntroduceDetail introduceDetail : introduceDetailList) {
|
|
|
+ if (entry.getValue().equals(introduceDetail.getTitle())) {
|
|
|
+ detailDTO.setText(introduceDetail.getText());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ retList.add(detailDTO);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ retList = BeanUtil.listCopyTo(introduceDetailList, EMRIntroduceDetailDTO.class);
|
|
|
+ }
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
}
|