|
@@ -4,35 +4,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.diagbot.client.CdssCoreClient;
|
|
|
-import com.diagbot.dto.KlConceptStaticDTO;
|
|
|
-import com.diagbot.dto.RespDTO;
|
|
|
-import com.diagbot.dto.StaticKnowledgeDTO;
|
|
|
-import com.diagbot.dto.StaticKnowledgeHISDTO;
|
|
|
-import com.diagbot.dto.StaticKnowledgeIndexDTO;
|
|
|
-import com.diagbot.dto.StaticKnowledgeIndexPageDTO;
|
|
|
+import com.diagbot.dto.*;
|
|
|
import com.diagbot.entity.SysUser;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
+import com.diagbot.service.MappingConfigService;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.RespDTOUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
-import com.diagbot.vo.ChangeStatusVO;
|
|
|
-import com.diagbot.vo.IdVO;
|
|
|
-import com.diagbot.vo.KlConceptStaticPageVO;
|
|
|
-import com.diagbot.vo.KlConceptStaticVO;
|
|
|
-import com.diagbot.vo.PushJoinVO;
|
|
|
-import com.diagbot.vo.ScaleStaticAllVO;
|
|
|
-import com.diagbot.vo.SearchData;
|
|
|
-import com.diagbot.vo.StaticKnowledgeHISVO;
|
|
|
-import com.diagbot.vo.StaticKnowledgeIndexPageVO;
|
|
|
-import com.diagbot.vo.StaticKnowledgeIndexVO;
|
|
|
-import com.diagbot.vo.StaticKnowledgeVO;
|
|
|
+import com.diagbot.vo.*;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -55,6 +42,9 @@ public class KlConceptStaticFacade {
|
|
|
MrFacade mrFacade;
|
|
|
@Autowired
|
|
|
private AssembleFacade assembleFacade;
|
|
|
+ @Autowired
|
|
|
+ private MappingConfigFacade mappingConfigFacade;
|
|
|
+ private MappingConfigService mappingConfigService;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -65,8 +55,49 @@ public class KlConceptStaticFacade {
|
|
|
*/
|
|
|
public List<StaticKnowledgeIndexDTO> staticKnowledgeIndex(StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
|
|
|
List<StaticKnowledgeIndexDTO> retList = Lists.newLinkedList();
|
|
|
+ List<ClassicCaseIndexDTO> cases = Lists.newLinkedList();
|
|
|
+ RespDTO<List<ClassicCaseIndexDTO>> caseDTO = RespDTO.onSuc(new ArrayList<>(0));
|
|
|
+ RespDTO<List<StaticKnowledgeIndexDTO>> respDTO = RespDTO.onSuc(new ArrayList<>(0));
|
|
|
+
|
|
|
+ if (staticKnowledgeIndexVO.getTypes().contains(0) ||
|
|
|
+ staticKnowledgeIndexVO.getTypes().contains(11) ||
|
|
|
+ staticKnowledgeIndexVO.getTypes().isEmpty()) {
|
|
|
+ caseDTO = cdssCoreClient.classicCaseIndex(staticKnowledgeIndexVO);
|
|
|
+ if (staticKnowledgeIndexVO.getTypes().contains(11) && staticKnowledgeIndexVO.getTypes().size() > 1)
|
|
|
+ staticKnowledgeIndexVO.getTypes().remove(staticKnowledgeIndexVO.getTypes().indexOf(11));
|
|
|
+ }
|
|
|
+ if (!staticKnowledgeIndexVO.getTypes().contains(11))
|
|
|
+ respDTO = cdssCoreClient.staticKnowledgeIndex(staticKnowledgeIndexVO);
|
|
|
+
|
|
|
+ if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
+ retList = respDTO.data;
|
|
|
+ if (RespDTOUtil.respIsOK(caseDTO)) {
|
|
|
+ for (ClassicCaseIndexDTO classicCase : caseDTO.data) {
|
|
|
+ StaticKnowledgeIndexDTO dto = new StaticKnowledgeIndexDTO();
|
|
|
+ BeanUtil.copyProperties(classicCase, dto);
|
|
|
+ retList.add(dto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (staticKnowledgeIndexVO.getHasInfo() != null && staticKnowledgeIndexVO.getHasInfo().equals(1)) {
|
|
|
+ retList = retList.stream().filter(i -> i.getStatus().equals(1)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 经典病例检索
|
|
|
+ *
|
|
|
+ * @param staticKnowledgeIndexVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ClassicCaseIndexDTO> classicCaseIndex(StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
|
|
|
+ List<ClassicCaseIndexDTO> retList = Lists.newLinkedList();
|
|
|
|
|
|
- RespDTO<List<StaticKnowledgeIndexDTO>> respDTO = cdssCoreClient.staticKnowledgeIndex(staticKnowledgeIndexVO);
|
|
|
+ RespDTO<List<ClassicCaseIndexDTO>> respDTO = cdssCoreClient.classicCaseIndex(staticKnowledgeIndexVO);
|
|
|
if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
retList = respDTO.data;
|
|
|
} else {
|
|
@@ -103,7 +134,13 @@ public class KlConceptStaticFacade {
|
|
|
scaleStaticAllVO.setHospitalId(-1L);
|
|
|
}
|
|
|
BeanUtil.copyProperties(staticKnowledgeVO, scaleStaticAllVO);
|
|
|
- RespDTO<StaticKnowledgeDTO> respDTO = cdssCoreClient.getStaticKnowledge(scaleStaticAllVO);
|
|
|
+// RespDTO<StaticKnowledgeDTO> respDTO = cdssCoreClient.getStaticKnowledge(scaleStaticAllVO);
|
|
|
+ RespDTO<StaticKnowledgeDTO> respDTO;
|
|
|
+ if (staticKnowledgeVO.getType().equals(11))
|
|
|
+ respDTO = cdssCoreClient.getClassicCaseInfo(scaleStaticAllVO);
|
|
|
+ else
|
|
|
+ respDTO = cdssCoreClient.getStaticKnowledge(scaleStaticAllVO);
|
|
|
+
|
|
|
if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
StaticKnowledgeDTO staticKnowledgeDTO = respDTO.data;
|
|
|
return staticKnowledgeDTO;
|
|
@@ -203,6 +240,40 @@ public class KlConceptStaticFacade {
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 经典病例分页查询
|
|
|
+ *
|
|
|
+ * @param klClassicCasePageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<KlClassicCaseDTO> getClassicCase(KlClassicCasePageVO klClassicCasePageVO) {
|
|
|
+ Page<KlClassicCaseDTO> page = null;
|
|
|
+ RespDTO<Page<KlClassicCaseDTO>> respDTO = cdssCoreClient.getClassicCase(klClassicCasePageVO);
|
|
|
+ if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
+ page = respDTO.data;
|
|
|
+ } else {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
|
|
|
+ }
|
|
|
+ List<KlClassicCaseDTO> records = page.getRecords();
|
|
|
+ List<String> userIds = records.stream().map(KlClassicCaseDTO::getModifier)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ RespDTO<Map<String, String>> userRespDTO = RespDTO.onSuc(sysUserFacade.getUserInfoByIds(userIds));
|
|
|
+ if (RespDTOUtil.respIsNG(userRespDTO)) {
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+ Map<String, String> userMap = userRespDTO.data;
|
|
|
+ records.forEach(record -> {
|
|
|
+ if (userMap.containsKey(record.getModifier())) {
|
|
|
+ record.setModifier(userMap.get(record.getModifier()));
|
|
|
+ } else {
|
|
|
+ record.setModifier("");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ page.setRecords(records);
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 分页查询
|
|
|
*
|
|
@@ -241,6 +312,47 @@ public class KlConceptStaticFacade {
|
|
|
return success;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 经典病例启用禁用
|
|
|
+ *
|
|
|
+ * @param changeStatusVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean changeCaseStatus(ChangeStatusVO changeStatusVO) {
|
|
|
+ String userId = UserUtils.getCurrentPrincipleID();
|
|
|
+ changeStatusVO.setUserId(Long.valueOf(userId));
|
|
|
+
|
|
|
+ Boolean success = false;
|
|
|
+ RespDTO<Boolean> respDTO = cdssCoreClient.changeCaseStatus(changeStatusVO);
|
|
|
+ if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
+ success = respDTO.data;
|
|
|
+ } else {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
|
|
|
+ }
|
|
|
+ return success;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存病例(新增or修改)
|
|
|
+ *
|
|
|
+ * @param klClassicCaseVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean saveOrUpdateCase(KlClassicCaseVO klClassicCaseVO) {
|
|
|
+ String userId = UserUtils.getCurrentPrincipleID();
|
|
|
+ klClassicCaseVO.setUserId(Long.valueOf(userId));
|
|
|
+
|
|
|
+ Boolean success = false;
|
|
|
+ RespDTO<Boolean> respDTO = cdssCoreClient.saveOrUpdateCase(klClassicCaseVO);
|
|
|
+ if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
+ success = respDTO.data;
|
|
|
+ } else {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
|
|
|
+ }
|
|
|
+ return success;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 启用禁用
|
|
|
*
|
|
@@ -278,6 +390,23 @@ public class KlConceptStaticFacade {
|
|
|
return klConceptStaticDTO;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据经典病例id获取病例信息
|
|
|
+ *
|
|
|
+ * @param idVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public KlClassicCaseDTO getCaseById(IdVO idVO) {
|
|
|
+ KlClassicCaseDTO klClassicCaseDTO = new KlClassicCaseDTO();
|
|
|
+ RespDTO<KlClassicCaseDTO> respDTO = cdssCoreClient.getCaseById(idVO);
|
|
|
+ if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
+ klClassicCaseDTO = respDTO.data;
|
|
|
+ } else {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
|
|
|
+ }
|
|
|
+ return klClassicCaseDTO;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 是否已存在
|
|
|
*
|