|
@@ -1,30 +1,10 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
-import java.io.InputStream;
|
|
|
-import java.text.DecimalFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import org.apache.commons.lang.time.DateFormatUtils;
|
|
|
-import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
|
|
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
-import org.apache.poi.ss.usermodel.Cell;
|
|
|
-import org.apache.poi.ss.usermodel.Row;
|
|
|
-import org.apache.poi.ss.usermodel.Sheet;
|
|
|
-import org.apache.poi.ss.usermodel.Workbook;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
-
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.diagbot.client.UserServiceClient;
|
|
|
+import com.diagbot.dto.ConceptBaseDTO;
|
|
|
+import com.diagbot.dto.ConceptRes;
|
|
|
import com.diagbot.dto.GetAllConceptDTO;
|
|
|
import com.diagbot.dto.GetAllInformationDTO;
|
|
|
import com.diagbot.dto.GetAllLisConceptDTO;
|
|
@@ -34,21 +14,50 @@ import com.diagbot.entity.Concept;
|
|
|
import com.diagbot.entity.Lexicon;
|
|
|
import com.diagbot.entity.LibraryInfo;
|
|
|
import com.diagbot.entity.Medical;
|
|
|
+import com.diagbot.entity.wrapper.ConceptWrapper;
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.enums.LexiconRSTypeEnum;
|
|
|
+import com.diagbot.enums.LexiconTypeEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.LibraryInfoService;
|
|
|
import com.diagbot.service.impl.ConceptServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.IntegerUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
import com.diagbot.vo.AddConceptInfoDetailVO;
|
|
|
import com.diagbot.vo.AddConceptInfoVO;
|
|
|
+import com.diagbot.vo.ConceptSearchVO;
|
|
|
+import com.diagbot.vo.ConceptTypeVO;
|
|
|
import com.diagbot.vo.GetAllConceptVO;
|
|
|
import com.diagbot.vo.GetAllInformationVO;
|
|
|
import com.diagbot.vo.GetAllLisConceptVO;
|
|
|
import com.diagbot.vo.GetConceptInfoDetailVO;
|
|
|
import com.diagbot.vo.RemoveConceptInfoVO;
|
|
|
+import org.apache.commons.lang.time.DateFormatUtils;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
+import org.apache.poi.ss.usermodel.Cell;
|
|
|
+import org.apache.poi.ss.usermodel.Row;
|
|
|
+import org.apache.poi.ss.usermodel.Sheet;
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import java.io.InputStream;
|
|
|
+import java.text.DecimalFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Description: 术语查询业务层
|
|
@@ -60,12 +69,12 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
|
|
|
@Autowired
|
|
|
private LibraryInfoFacade libraryinfoFacade;
|
|
|
-// @Autowired
|
|
|
-// private LibraryDetailFacade libraryDetailFacade;
|
|
|
+ // @Autowired
|
|
|
+ // private LibraryDetailFacade libraryDetailFacade;
|
|
|
@Autowired
|
|
|
private MedicalFacade medicalFacade;
|
|
|
-// @Autowired
|
|
|
-// private RelationFacade relationFacade;
|
|
|
+ // @Autowired
|
|
|
+ // private RelationFacade relationFacade;
|
|
|
@Autowired
|
|
|
@Qualifier("libraryInfoServiceImpl")
|
|
|
private LibraryInfoService libraryInfoService;
|
|
@@ -73,92 +82,96 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
private UserServiceClient userServiceClient;
|
|
|
@Autowired
|
|
|
private LexiconFacade lexiconFacade;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 获取所有化验公表项
|
|
|
+ *
|
|
|
* @param getAllLisConceptVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<GetAllLisConceptDTO> getAllLisConcept(GetAllLisConceptVO getAllLisConceptVO){
|
|
|
- return this.baseMapper.getAllLisConcept(getAllLisConceptVO);
|
|
|
+ public List<GetAllLisConceptDTO> getAllLisConcept(GetAllLisConceptVO getAllLisConceptVO) {
|
|
|
+ return this.baseMapper.getAllLisConcept(getAllLisConceptVO);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 获取所有医学术语命名
|
|
|
+ *
|
|
|
* @param getAllConceptVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<GetAllConceptDTO> getAllConcept(GetAllConceptVO getAllConceptVO){
|
|
|
- QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<LibraryInfo>();
|
|
|
- libraryInfoQe.eq("is_deleted", "N");
|
|
|
- if(getAllConceptVO.getIsConcept()!=null){
|
|
|
- libraryInfoQe.eq("is_concept", getAllConceptVO.getIsConcept());
|
|
|
- }
|
|
|
- if(StringUtil.isNotBlank(getAllConceptVO.getName())){
|
|
|
- libraryInfoQe.like("name", getAllConceptVO.getName());
|
|
|
- }
|
|
|
- List<LibraryInfo> libraryInfoList = libraryinfoFacade.list(libraryInfoQe);
|
|
|
-
|
|
|
- //过滤掉非概念术语
|
|
|
- if(getAllConceptVO.getIsConcept()!=null&&getAllConceptVO.getIsConcept()==1){
|
|
|
- QueryWrapper<Concept> conceptQe = new QueryWrapper<>();
|
|
|
- conceptQe.eq("is_deleted", "N");
|
|
|
- conceptQe.in("id", libraryInfoList.stream().map(i->i.getConceptId()).distinct().collect(Collectors.toList()));
|
|
|
- Map<Long,Concept> conceptMap = list(conceptQe).stream().collect(Collectors.toMap(Concept::getId, i->i));
|
|
|
- libraryInfoList.forEach(i->{
|
|
|
- if(conceptMap.get(i.getConceptId())==null||conceptMap.get(i.getConceptId()).getLibId().intValue()!=i.getId().intValue()){
|
|
|
- i.setIsDeleted("Y");
|
|
|
- }
|
|
|
- });
|
|
|
- libraryInfoList = libraryInfoList.stream().filter(i->i.getIsDeleted().equals("N")).collect(Collectors.toList());
|
|
|
- }
|
|
|
-
|
|
|
- //添加过术语医学属性的过滤掉
|
|
|
- if(getAllConceptVO.getIsMedical()!=null&&getAllConceptVO.getIsMedical()==1){
|
|
|
- QueryWrapper<Medical> medicalQe = new QueryWrapper<>();
|
|
|
- medicalQe.eq("is_deleted", "N");
|
|
|
- medicalQe.in("concept_id", libraryInfoList.stream().map(i->i.getConceptId()).collect(Collectors.toList()));
|
|
|
- Map<Long,Medical> medicalMap =medicalFacade.list(medicalQe).stream().collect(Collectors.toMap(Medical::getConceptId, i->i));
|
|
|
- libraryInfoList = libraryInfoList.stream().filter(i->{
|
|
|
- if(medicalMap.get(i.getConceptId())==null){
|
|
|
- return true;
|
|
|
- }else{
|
|
|
- return false;
|
|
|
- }
|
|
|
- }).collect(Collectors.toList());
|
|
|
- }
|
|
|
-
|
|
|
- List<GetAllConceptDTO> getAllConceptDTOList = BeanUtil.listCopyTo(libraryInfoList, GetAllConceptDTO.class);
|
|
|
- getAllConceptDTOList.forEach(i->{
|
|
|
- i.setNameAndType(i.getName()+"("+i.getType()+")");
|
|
|
- });
|
|
|
-
|
|
|
- return getAllConceptDTOList;
|
|
|
+ public List<GetAllConceptDTO> getAllConcept(GetAllConceptVO getAllConceptVO) {
|
|
|
+ QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<LibraryInfo>();
|
|
|
+ libraryInfoQe.eq("is_deleted", "N");
|
|
|
+ if (getAllConceptVO.getIsConcept() != null) {
|
|
|
+ libraryInfoQe.eq("is_concept", getAllConceptVO.getIsConcept());
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(getAllConceptVO.getName())) {
|
|
|
+ libraryInfoQe.like("name", getAllConceptVO.getName());
|
|
|
+ }
|
|
|
+ List<LibraryInfo> libraryInfoList = libraryinfoFacade.list(libraryInfoQe);
|
|
|
+
|
|
|
+ //过滤掉非概念术语
|
|
|
+ if (getAllConceptVO.getIsConcept() != null && getAllConceptVO.getIsConcept() == 1) {
|
|
|
+ QueryWrapper<Concept> conceptQe = new QueryWrapper<>();
|
|
|
+ conceptQe.eq("is_deleted", "N");
|
|
|
+ conceptQe.in("id", libraryInfoList.stream().map(i -> i.getConceptId()).distinct().collect(Collectors.toList()));
|
|
|
+ Map<Long, Concept> conceptMap = list(conceptQe).stream().collect(Collectors.toMap(Concept::getId, i -> i));
|
|
|
+ libraryInfoList.forEach(i -> {
|
|
|
+ if (conceptMap.get(i.getConceptId()) == null || conceptMap.get(i.getConceptId()).getLibId().intValue() != i.getId().intValue()) {
|
|
|
+ i.setIsDeleted("Y");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ libraryInfoList = libraryInfoList.stream().filter(i -> i.getIsDeleted().equals("N")).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加过术语医学属性的过滤掉
|
|
|
+ if (getAllConceptVO.getIsMedical() != null && getAllConceptVO.getIsMedical() == 1) {
|
|
|
+ QueryWrapper<Medical> medicalQe = new QueryWrapper<>();
|
|
|
+ medicalQe.eq("is_deleted", "N");
|
|
|
+ medicalQe.in("concept_id", libraryInfoList.stream().map(i -> i.getConceptId()).collect(Collectors.toList()));
|
|
|
+ Map<Long, Medical> medicalMap = medicalFacade.list(medicalQe).stream().collect(Collectors.toMap(Medical::getConceptId, i -> i));
|
|
|
+ libraryInfoList = libraryInfoList.stream().filter(i -> {
|
|
|
+ if (medicalMap.get(i.getConceptId()) == null) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<GetAllConceptDTO> getAllConceptDTOList = BeanUtil.listCopyTo(libraryInfoList, GetAllConceptDTO.class);
|
|
|
+ getAllConceptDTOList.forEach(i -> {
|
|
|
+ i.setNameAndType(i.getName() + "(" + i.getType() + ")");
|
|
|
+ });
|
|
|
+
|
|
|
+ return getAllConceptDTOList;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 获取医学术语命名列表
|
|
|
+ *
|
|
|
* @param getAllInformationVO
|
|
|
* @return
|
|
|
*/
|
|
|
public IPage<GetAllInformationDTO> getAllInformation(GetAllInformationVO getAllInformationVO) {
|
|
|
- IPage<GetAllInformationDTO> ipage = libraryinfoFacade.getAllInformation(getAllInformationVO);
|
|
|
- if(ipage.getRecords().size()>0){
|
|
|
- List<String> ids = ipage.getRecords().stream().map(i->i.getOperName()).distinct().collect(Collectors.toList());
|
|
|
- RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
|
|
|
- if (respDTO == null || !CommonErrorCode.OK.getCode().equals(respDTO.code)) {
|
|
|
+ IPage<GetAllInformationDTO> ipage = libraryinfoFacade.getAllInformation(getAllInformationVO);
|
|
|
+ if (ipage.getRecords().size() > 0) {
|
|
|
+ List<String> ids = ipage.getRecords().stream().map(i -> i.getOperName()).distinct().collect(Collectors.toList());
|
|
|
+ RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
|
|
|
+ if (respDTO == null || !CommonErrorCode.OK.getCode().equals(respDTO.code)) {
|
|
|
throw new CommonException(CommonErrorCode.RPC_ERROR,
|
|
|
"获取用户信息失败");
|
|
|
}
|
|
|
- ipage.getRecords().forEach(i->{
|
|
|
- i.setOperName(respDTO.data.get(i.getOperName()));
|
|
|
- });
|
|
|
- }
|
|
|
+ ipage.getRecords().forEach(i -> {
|
|
|
+ i.setOperName(respDTO.data.get(i.getOperName()));
|
|
|
+ });
|
|
|
+ }
|
|
|
return ipage;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 医学术语命名删除或者恢复
|
|
|
+ *
|
|
|
* @param removeConceptInfoVO
|
|
|
* @return
|
|
|
*/
|
|
@@ -189,9 +202,9 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
if(sbf.length()>0){
|
|
|
throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
|
|
|
}*/
|
|
|
-
|
|
|
- String currentUser = UserUtils.getCurrentPrincipleID();
|
|
|
- Date now = DateUtil.now();
|
|
|
+
|
|
|
+ String currentUser = UserUtils.getCurrentPrincipleID();
|
|
|
+ Date now = DateUtil.now();
|
|
|
|
|
|
/*QueryWrapper<LibraryInfo> libraryInfoQe1 = new QueryWrapper<>();
|
|
|
libraryInfoQe1.eq("concept_id", removeConceptInfoVO.getConceptId());
|
|
@@ -212,203 +225,206 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
concept.setModifier(currentUser);
|
|
|
concept.setGmtModified(now);
|
|
|
this.updateById(concept);*/
|
|
|
-
|
|
|
- Concept concept = this.getById(removeConceptInfoVO.getConceptId());
|
|
|
- if(concept==null){
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS);
|
|
|
- }
|
|
|
- if(concept.getIsDeleted().equals(removeConceptInfoVO.getIsDeleted())){
|
|
|
- if(removeConceptInfoVO.getIsDeleted().equals("Y")){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,"该数据已删除!");
|
|
|
- }
|
|
|
- if(removeConceptInfoVO.getIsDeleted().equals("N")){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,"该数据已恢复!");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- concept.setIsDeleted(removeConceptInfoVO.getIsDeleted());
|
|
|
- concept.setModifier(currentUser);
|
|
|
- concept.setGmtModified(now);
|
|
|
- this.updateById(concept);
|
|
|
-
|
|
|
+
|
|
|
+ Concept concept = this.getById(removeConceptInfoVO.getConceptId());
|
|
|
+ if (concept == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS);
|
|
|
+ }
|
|
|
+ if (concept.getIsDeleted().equals(removeConceptInfoVO.getIsDeleted())) {
|
|
|
+ if (removeConceptInfoVO.getIsDeleted().equals("Y")) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, "该数据已删除!");
|
|
|
+ }
|
|
|
+ if (removeConceptInfoVO.getIsDeleted().equals("N")) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, "该数据已恢复!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ concept.setIsDeleted(removeConceptInfoVO.getIsDeleted());
|
|
|
+ concept.setModifier(currentUser);
|
|
|
+ concept.setGmtModified(now);
|
|
|
+ this.updateById(concept);
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 获取医学术语命名详情
|
|
|
+ *
|
|
|
* @param getConceptInfoDetailVO
|
|
|
* @return libName-标准术语,otherNames-同义词
|
|
|
*/
|
|
|
- public Map<String,List<GetConceptInfoDetailDTO>> getConceptInfoDetail(GetConceptInfoDetailVO getConceptInfoDetailVO){
|
|
|
- QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<LibraryInfo>();
|
|
|
- libraryInfoQe.eq("concept_id", getConceptInfoDetailVO.getConceptId());
|
|
|
- List<LibraryInfo> libraryInfoList = libraryinfoFacade.list(libraryInfoQe);
|
|
|
-
|
|
|
- Map<String,List<GetConceptInfoDetailDTO>> retMap = new HashMap<>();
|
|
|
- retMap.put("otherNames", BeanUtil.listCopyTo(libraryInfoList.stream().filter(i->i.getIsConcept()==null||i.getIsConcept()==0).collect(Collectors.toList()), GetConceptInfoDetailDTO.class));
|
|
|
- retMap.put("libName", BeanUtil.listCopyTo(libraryInfoList.stream().filter(i->i.getIsConcept()!=null&&i.getIsConcept()==1).collect(Collectors.toList()), GetConceptInfoDetailDTO.class));
|
|
|
-
|
|
|
- return retMap;
|
|
|
+ public Map<String, List<GetConceptInfoDetailDTO>> getConceptInfoDetail(GetConceptInfoDetailVO getConceptInfoDetailVO) {
|
|
|
+ QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<LibraryInfo>();
|
|
|
+ libraryInfoQe.eq("concept_id", getConceptInfoDetailVO.getConceptId());
|
|
|
+ List<LibraryInfo> libraryInfoList = libraryinfoFacade.list(libraryInfoQe);
|
|
|
+
|
|
|
+ Map<String, List<GetConceptInfoDetailDTO>> retMap = new HashMap<>();
|
|
|
+ retMap.put("otherNames", BeanUtil.listCopyTo(libraryInfoList.stream().filter(i -> i.getIsConcept() == null || i.getIsConcept() == 0).collect(Collectors.toList()), GetConceptInfoDetailDTO.class));
|
|
|
+ retMap.put("libName", BeanUtil.listCopyTo(libraryInfoList.stream().filter(i -> i.getIsConcept() != null && i.getIsConcept() == 1).collect(Collectors.toList()), GetConceptInfoDetailDTO.class));
|
|
|
+
|
|
|
+ return retMap;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 医学术语命名添加或者编辑
|
|
|
+ *
|
|
|
* @param addConceptInfoVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public Boolean addConceptInfo(AddConceptInfoVO addConceptInfoVO){
|
|
|
- String lineNumStr = "";
|
|
|
- if(addConceptInfoVO.getLineNum()!=null){
|
|
|
- lineNumStr = "第"+addConceptInfoVO.getLineNum()+"行";
|
|
|
- }
|
|
|
-
|
|
|
- String regEx="[0-9]+|[`~·!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]+";
|
|
|
- for(AddConceptInfoDetailVO i : addConceptInfoVO.getDetailList()){
|
|
|
- if(i.getName().matches(regEx)){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,lineNumStr+"无法输入纯数字或者纯字符,请输入正确数据!");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(addConceptInfoVO.getDetailList().stream().distinct().count()!=addConceptInfoVO.getDetailList().size()){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,lineNumStr+"存在重复数据!");
|
|
|
- }
|
|
|
-
|
|
|
- List<AddConceptInfoDetailVO> addConceptInfoDetailVOMainList = addConceptInfoVO.getDetailList().stream().filter(i->i.getIsConcept()==1).collect(Collectors.toList());
|
|
|
- if(addConceptInfoDetailVOMainList.size()==0){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,lineNumStr+"无标准术语!");
|
|
|
- }
|
|
|
- if(addConceptInfoDetailVOMainList.size()>1){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,lineNumStr+"标准术语只能有一个!");
|
|
|
- }
|
|
|
-
|
|
|
- QueryWrapper<Lexicon> lexiconQe = new QueryWrapper<>();
|
|
|
- lexiconQe.eq("name", addConceptInfoVO.getType());
|
|
|
- Lexicon lexicon = lexiconFacade.getOne(lexiconQe);
|
|
|
- if(lexicon==null){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,lineNumStr+"数据有误,该类型信息在数据库中不存在!");
|
|
|
- }
|
|
|
-
|
|
|
- List<LibraryInfo> saveOrUpdateLibraryInfoList = new ArrayList<>();
|
|
|
-
|
|
|
- AddConceptInfoDetailVO addConceptInfoDetailVOMain = addConceptInfoDetailVOMainList.get(0);//提交过来的标准术语
|
|
|
-
|
|
|
- //查询当前添加的术语是否已经在数据库中
|
|
|
- QueryWrapper<LibraryInfo> libraryInfoQe1 = new QueryWrapper<>();
|
|
|
- libraryInfoQe1.eq("type", addConceptInfoVO.getType());
|
|
|
- libraryInfoQe1.in("name", addConceptInfoVO.getDetailList().stream().map(i->i.getName()).collect(Collectors.toList()));
|
|
|
- List<LibraryInfo> libraryInfoList = libraryinfoFacade.list(libraryInfoQe1);
|
|
|
-
|
|
|
- String currentUser = UserUtils.getCurrentPrincipleID();
|
|
|
- Date now = DateUtil.now();
|
|
|
-
|
|
|
- Map<String,LibraryInfo> libraryInfoMap = libraryInfoList.stream().collect(Collectors.toMap(LibraryInfo::getName, i->i));
|
|
|
- LibraryInfo libraryInfoMain = libraryInfoMap.get(addConceptInfoDetailVOMain.getName());
|
|
|
- Concept concept = new Concept();
|
|
|
- Long conceptId = null;
|
|
|
- if(libraryInfoMain==null){
|
|
|
- libraryInfoMain = new LibraryInfo();
|
|
|
- BeanUtil.copyProperties(addConceptInfoDetailVOMain, libraryInfoMain);
|
|
|
- libraryInfoMain.setGmtCreate(now);
|
|
|
- libraryInfoMain.setCreator(currentUser);
|
|
|
- libraryInfoMain.setType(addConceptInfoVO.getType());
|
|
|
- libraryInfoMain.setTypeId(lexicon.getId());
|
|
|
- libraryinfoFacade.save(libraryInfoMain);
|
|
|
- concept.setLibId(libraryInfoMain.getId());
|
|
|
- concept.setGmtCreate(now);
|
|
|
- concept.setCreator(currentUser);
|
|
|
- concept.setId(addConceptInfoVO.getConceptId());
|
|
|
- saveOrUpdate(concept);
|
|
|
- conceptId = concept.getId();
|
|
|
- }else{
|
|
|
- conceptId = libraryInfoMain.getConceptId();
|
|
|
- int ckConceptId = conceptId.intValue();
|
|
|
- concept = getById(conceptId);
|
|
|
-
|
|
|
- //如果标准词之前作为同义词被其他占用的情况
|
|
|
- if(libraryInfoMain.getIsConcept()==1){
|
|
|
- //新增操作时,已经建立的标准词提示
|
|
|
- if(addConceptInfoVO.getLineNum()==null&&addConceptInfoVO.getConceptId()==null){
|
|
|
- if(concept.getIsDeleted().equals("N")){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,"该数据已经建立!");
|
|
|
- }else{
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,"该数据已经建立且处于已删除状态,可前往列表中恢复该条数据!");
|
|
|
- }
|
|
|
- }
|
|
|
- }else if(addConceptInfoVO.getLineNum()==null&&addConceptInfoVO.getConceptId()==null&&concept!=null
|
|
|
- ||libraryInfoList.stream().filter(i->i.getConceptId().intValue()==ckConceptId).count()==1){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,lineNumStr+"标准术语已作为同义词被占用!");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //先删除概念下的同义词,后续再插入
|
|
|
- QueryWrapper<LibraryInfo> libraryInfoQe2 = new QueryWrapper<>();
|
|
|
- libraryInfoQe2.eq("concept_id", conceptId);
|
|
|
- libraryInfoQe2.ne("id", libraryInfoMain.getId());
|
|
|
- libraryinfoFacade.remove(libraryInfoQe2);
|
|
|
-
|
|
|
- StringBuffer sbf = new StringBuffer();
|
|
|
- for(AddConceptInfoDetailVO i:addConceptInfoVO.getDetailList()){
|
|
|
- if(i.getIsConcept()==1){
|
|
|
- continue;
|
|
|
- }
|
|
|
- LibraryInfo libraryInfo = libraryInfoMap.get(i.getName());
|
|
|
- if(libraryInfo==null){
|
|
|
- libraryInfo = new LibraryInfo();
|
|
|
- libraryInfo.setGmtCreate(now);
|
|
|
- libraryInfo.setCreator(currentUser);
|
|
|
- }else if(libraryInfo.getConceptId().intValue()!=conceptId.intValue()){
|
|
|
- sbf.append(i.getName()).append(" ");
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- libraryInfo.setGmtModified(now);
|
|
|
- libraryInfo.setModifier(currentUser);
|
|
|
- libraryInfo.setName(i.getName());
|
|
|
- libraryInfo.setIsConcept(0);
|
|
|
- libraryInfo.setRemark(i.getRemark());
|
|
|
- saveOrUpdateLibraryInfoList.add(libraryInfo);
|
|
|
- }
|
|
|
-
|
|
|
- if(sbf.length()>0){
|
|
|
- sbf.append("已被占用");
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
|
|
|
- }
|
|
|
-
|
|
|
- for(LibraryInfo i : saveOrUpdateLibraryInfoList){
|
|
|
- i.setId(null);
|
|
|
- i.setConceptId(conceptId);
|
|
|
- i.setType(addConceptInfoVO.getType());
|
|
|
- i.setTypeId(lexicon.getId());
|
|
|
- }
|
|
|
- libraryInfoMain.setIsConcept(1);
|
|
|
- libraryInfoMain.setRemark(addConceptInfoDetailVOMain.getRemark());
|
|
|
- libraryInfoMain.setConceptId(conceptId);
|
|
|
- libraryInfoMain.setGmtModified(now);
|
|
|
- libraryInfoMain.setModifier(currentUser);
|
|
|
- saveOrUpdateLibraryInfoList.add(libraryInfoMain);
|
|
|
-
|
|
|
- libraryInfoService.saveOrUpdateBatch(saveOrUpdateLibraryInfoList);
|
|
|
-
|
|
|
- concept.setId(conceptId);
|
|
|
- concept.setLibId(libraryInfoMain.getId());
|
|
|
- concept.setGmtModified(now);
|
|
|
- concept.setModifier(currentUser);
|
|
|
- updateById(concept);
|
|
|
-
|
|
|
- return true;
|
|
|
+ public Boolean addConceptInfo(AddConceptInfoVO addConceptInfoVO) {
|
|
|
+ String lineNumStr = "";
|
|
|
+ if (addConceptInfoVO.getLineNum() != null) {
|
|
|
+ lineNumStr = "第" + addConceptInfoVO.getLineNum() + "行";
|
|
|
+ }
|
|
|
+
|
|
|
+ String regEx = "[0-9]+|[`~·!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]+";
|
|
|
+ for (AddConceptInfoDetailVO i : addConceptInfoVO.getDetailList()) {
|
|
|
+ if (i.getName().matches(regEx)) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "无法输入纯数字或者纯字符,请输入正确数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (addConceptInfoVO.getDetailList().stream().distinct().count() != addConceptInfoVO.getDetailList().size()) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "存在重复数据!");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<AddConceptInfoDetailVO> addConceptInfoDetailVOMainList = addConceptInfoVO.getDetailList().stream().filter(i -> i.getIsConcept() == 1).collect(Collectors.toList());
|
|
|
+ if (addConceptInfoDetailVOMainList.size() == 0) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "无标准术语!");
|
|
|
+ }
|
|
|
+ if (addConceptInfoDetailVOMainList.size() > 1) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "标准术语只能有一个!");
|
|
|
+ }
|
|
|
+
|
|
|
+ QueryWrapper<Lexicon> lexiconQe = new QueryWrapper<>();
|
|
|
+ lexiconQe.eq("name", addConceptInfoVO.getType());
|
|
|
+ Lexicon lexicon = lexiconFacade.getOne(lexiconQe);
|
|
|
+ if (lexicon == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "数据有误,该类型信息在数据库中不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<LibraryInfo> saveOrUpdateLibraryInfoList = new ArrayList<>();
|
|
|
+
|
|
|
+ AddConceptInfoDetailVO addConceptInfoDetailVOMain = addConceptInfoDetailVOMainList.get(0);//提交过来的标准术语
|
|
|
+
|
|
|
+ //查询当前添加的术语是否已经在数据库中
|
|
|
+ QueryWrapper<LibraryInfo> libraryInfoQe1 = new QueryWrapper<>();
|
|
|
+ libraryInfoQe1.eq("type", addConceptInfoVO.getType());
|
|
|
+ libraryInfoQe1.in("name", addConceptInfoVO.getDetailList().stream().map(i -> i.getName()).collect(Collectors.toList()));
|
|
|
+ List<LibraryInfo> libraryInfoList = libraryinfoFacade.list(libraryInfoQe1);
|
|
|
+
|
|
|
+ String currentUser = UserUtils.getCurrentPrincipleID();
|
|
|
+ Date now = DateUtil.now();
|
|
|
+
|
|
|
+ Map<String, LibraryInfo> libraryInfoMap = libraryInfoList.stream().collect(Collectors.toMap(LibraryInfo::getName, i -> i));
|
|
|
+ LibraryInfo libraryInfoMain = libraryInfoMap.get(addConceptInfoDetailVOMain.getName());
|
|
|
+ Concept concept = new Concept();
|
|
|
+ Long conceptId = null;
|
|
|
+ if (libraryInfoMain == null) {
|
|
|
+ libraryInfoMain = new LibraryInfo();
|
|
|
+ BeanUtil.copyProperties(addConceptInfoDetailVOMain, libraryInfoMain);
|
|
|
+ libraryInfoMain.setGmtCreate(now);
|
|
|
+ libraryInfoMain.setCreator(currentUser);
|
|
|
+ libraryInfoMain.setType(addConceptInfoVO.getType());
|
|
|
+ libraryInfoMain.setTypeId(lexicon.getId());
|
|
|
+ libraryinfoFacade.save(libraryInfoMain);
|
|
|
+ concept.setLibId(libraryInfoMain.getId());
|
|
|
+ concept.setGmtCreate(now);
|
|
|
+ concept.setCreator(currentUser);
|
|
|
+ concept.setId(addConceptInfoVO.getConceptId());
|
|
|
+ saveOrUpdate(concept);
|
|
|
+ conceptId = concept.getId();
|
|
|
+ } else {
|
|
|
+ conceptId = libraryInfoMain.getConceptId();
|
|
|
+ int ckConceptId = conceptId.intValue();
|
|
|
+ concept = getById(conceptId);
|
|
|
+
|
|
|
+ //如果标准词之前作为同义词被其他占用的情况
|
|
|
+ if (libraryInfoMain.getIsConcept() == 1) {
|
|
|
+ //新增操作时,已经建立的标准词提示
|
|
|
+ if (addConceptInfoVO.getLineNum() == null && addConceptInfoVO.getConceptId() == null) {
|
|
|
+ if (concept.getIsDeleted().equals("N")) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, "该数据已经建立!");
|
|
|
+ } else {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, "该数据已经建立且处于已删除状态,可前往列表中恢复该条数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (addConceptInfoVO.getLineNum() == null && addConceptInfoVO.getConceptId() == null && concept != null
|
|
|
+ || libraryInfoList.stream().filter(i -> i.getConceptId().intValue() == ckConceptId).count() == 1) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "标准术语已作为同义词被占用!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //先删除概念下的同义词,后续再插入
|
|
|
+ QueryWrapper<LibraryInfo> libraryInfoQe2 = new QueryWrapper<>();
|
|
|
+ libraryInfoQe2.eq("concept_id", conceptId);
|
|
|
+ libraryInfoQe2.ne("id", libraryInfoMain.getId());
|
|
|
+ libraryinfoFacade.remove(libraryInfoQe2);
|
|
|
+
|
|
|
+ StringBuffer sbf = new StringBuffer();
|
|
|
+ for (AddConceptInfoDetailVO i : addConceptInfoVO.getDetailList()) {
|
|
|
+ if (i.getIsConcept() == 1) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ LibraryInfo libraryInfo = libraryInfoMap.get(i.getName());
|
|
|
+ if (libraryInfo == null) {
|
|
|
+ libraryInfo = new LibraryInfo();
|
|
|
+ libraryInfo.setGmtCreate(now);
|
|
|
+ libraryInfo.setCreator(currentUser);
|
|
|
+ } else if (libraryInfo.getConceptId().intValue() != conceptId.intValue()) {
|
|
|
+ sbf.append(i.getName()).append(" ");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ libraryInfo.setGmtModified(now);
|
|
|
+ libraryInfo.setModifier(currentUser);
|
|
|
+ libraryInfo.setName(i.getName());
|
|
|
+ libraryInfo.setIsConcept(0);
|
|
|
+ libraryInfo.setRemark(i.getRemark());
|
|
|
+ saveOrUpdateLibraryInfoList.add(libraryInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sbf.length() > 0) {
|
|
|
+ sbf.append("已被占用");
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, sbf.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ for (LibraryInfo i : saveOrUpdateLibraryInfoList) {
|
|
|
+ i.setId(null);
|
|
|
+ i.setConceptId(conceptId);
|
|
|
+ i.setType(addConceptInfoVO.getType());
|
|
|
+ i.setTypeId(lexicon.getId());
|
|
|
+ }
|
|
|
+ libraryInfoMain.setIsConcept(1);
|
|
|
+ libraryInfoMain.setRemark(addConceptInfoDetailVOMain.getRemark());
|
|
|
+ libraryInfoMain.setConceptId(conceptId);
|
|
|
+ libraryInfoMain.setGmtModified(now);
|
|
|
+ libraryInfoMain.setModifier(currentUser);
|
|
|
+ saveOrUpdateLibraryInfoList.add(libraryInfoMain);
|
|
|
+
|
|
|
+ libraryInfoService.saveOrUpdateBatch(saveOrUpdateLibraryInfoList);
|
|
|
+
|
|
|
+ concept.setId(conceptId);
|
|
|
+ concept.setLibId(libraryInfoMain.getId());
|
|
|
+ concept.setGmtModified(now);
|
|
|
+ concept.setModifier(currentUser);
|
|
|
+ updateById(concept);
|
|
|
+
|
|
|
+ return true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 医学术语命名excel文件导入
|
|
|
+ *
|
|
|
* @param file
|
|
|
* @return
|
|
|
*/
|
|
|
- public Boolean conceptInfoExcelIm(MultipartFile file) {
|
|
|
+ public Boolean conceptInfoExcelIm(MultipartFile file) {
|
|
|
List<AddConceptInfoVO> addConceptInfoVOList = new ArrayList<>();
|
|
|
StringBuffer sbf = new StringBuffer();
|
|
|
InputStream inputStream = null;
|
|
|
Workbook wb = null;
|
|
|
- String title_1="",title_2="",title_3="",title_4="";
|
|
|
+ String title_1 = "", title_2 = "", title_3 = "", title_4 = "";
|
|
|
try {
|
|
|
if (!file.isEmpty()) {
|
|
|
inputStream = file.getInputStream();
|
|
@@ -424,67 +440,67 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
wb = new XSSFWorkbook(inputStream);
|
|
|
}
|
|
|
if (wb != null) {
|
|
|
-
|
|
|
+
|
|
|
Sheet sheet = wb.getSheetAt(0);
|
|
|
int count = 0;
|
|
|
String libName, libType, otherNames, remark;
|
|
|
- String regEx="[0-9]+|[`~·!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]+";
|
|
|
+ String regEx = "[0-9]+|[`~·!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]+";
|
|
|
for (Row row : sheet) {
|
|
|
count++;
|
|
|
- if(row == null){
|
|
|
- continue;
|
|
|
+ if (row == null) {
|
|
|
+ continue;
|
|
|
}
|
|
|
if (count == 1) {
|
|
|
- title_1 = getValue(row.getCell(0)).trim().replace(" ", "");
|
|
|
- title_2 = getValue(row.getCell(1)).trim().replace(" ", "");
|
|
|
- title_3 = getValue(row.getCell(2)).trim().replace(" ", "");
|
|
|
- title_4 = getValue(row.getCell(3)).trim().replace(" ", "");
|
|
|
+ title_1 = getValue(row.getCell(0)).trim().replace(" ", "");
|
|
|
+ title_2 = getValue(row.getCell(1)).trim().replace(" ", "");
|
|
|
+ title_3 = getValue(row.getCell(2)).trim().replace(" ", "");
|
|
|
+ title_4 = getValue(row.getCell(3)).trim().replace(" ", "");
|
|
|
continue;
|
|
|
}
|
|
|
libName = getValue(row.getCell(0)).trim().replace(" ", "");
|
|
|
libType = getValue(row.getCell(1)).trim().replace(" ", "");
|
|
|
otherNames = getValue(row.getCell(2)).trim().replace(" ", "");
|
|
|
remark = getValue(row.getCell(3)).trim().replace(" ", "");
|
|
|
- if(StringUtil.isEmpty(libName) && StringUtil.isEmpty(libType)
|
|
|
- && StringUtil.isEmpty(otherNames) && StringUtil.isEmpty(remark)){
|
|
|
- continue;
|
|
|
+ if (StringUtil.isEmpty(libName) && StringUtil.isEmpty(libType)
|
|
|
+ && StringUtil.isEmpty(otherNames) && StringUtil.isEmpty(remark)) {
|
|
|
+ continue;
|
|
|
}
|
|
|
if (StringUtil.isEmpty(libName) || StringUtil.isEmpty(libType) || StringUtil.isEmpty(otherNames)) {
|
|
|
sbf.append("第" + count + "行数据不完整;").append("<br/>");
|
|
|
continue;
|
|
|
}
|
|
|
- if(StringUtil.isNotEmpty(remark)&&remark.length()>120){
|
|
|
- sbf.append("第" + count + "行导入错误,说明最大可输入120个字;").append("<br/>");
|
|
|
- continue;
|
|
|
+ if (StringUtil.isNotEmpty(remark) && remark.length() > 120) {
|
|
|
+ sbf.append("第" + count + "行导入错误,说明最大可输入120个字;").append("<br/>");
|
|
|
+ continue;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
AddConceptInfoVO addConceptInfoVO = new AddConceptInfoVO();
|
|
|
addConceptInfoVO.setLineNum(count);
|
|
|
addConceptInfoVO.setName(libName);
|
|
|
addConceptInfoVO.setType(libType);
|
|
|
List<AddConceptInfoDetailVO> detailList = new ArrayList<>();
|
|
|
- for(String nm:otherNames.split(",")){
|
|
|
- if(StringUtil.isBlank(nm)){
|
|
|
- continue;
|
|
|
- }
|
|
|
- if(nm.matches(regEx)){
|
|
|
- sbf.append("第" + count + "行无法导入,导入数据无法为纯数字或纯特殊字符;").append("<br/>");
|
|
|
- break;
|
|
|
- }
|
|
|
- if(nm.length()>30){
|
|
|
- sbf.append("第" + count + "行导入错误,标准词和同义词最大字数不可超过30个字;").append("<br/>");
|
|
|
+ for (String nm : otherNames.split(",")) {
|
|
|
+ if (StringUtil.isBlank(nm)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (nm.matches(regEx)) {
|
|
|
+ sbf.append("第" + count + "行无法导入,导入数据无法为纯数字或纯特殊字符;").append("<br/>");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (nm.length() > 30) {
|
|
|
+ sbf.append("第" + count + "行导入错误,标准词和同义词最大字数不可超过30个字;").append("<br/>");
|
|
|
break;
|
|
|
- }
|
|
|
- AddConceptInfoDetailVO addConceptInfoDetailVO = new AddConceptInfoDetailVO();
|
|
|
- addConceptInfoDetailVO.setName(nm);
|
|
|
- addConceptInfoDetailVO.setType(libType);
|
|
|
- if(libName.equals(nm)){
|
|
|
- addConceptInfoDetailVO.setIsConcept(1);
|
|
|
- addConceptInfoDetailVO.setRemark(remark);
|
|
|
- }else{
|
|
|
- addConceptInfoDetailVO.setIsConcept(0);
|
|
|
- }
|
|
|
- detailList.add(addConceptInfoDetailVO);
|
|
|
+ }
|
|
|
+ AddConceptInfoDetailVO addConceptInfoDetailVO = new AddConceptInfoDetailVO();
|
|
|
+ addConceptInfoDetailVO.setName(nm);
|
|
|
+ addConceptInfoDetailVO.setType(libType);
|
|
|
+ if (libName.equals(nm)) {
|
|
|
+ addConceptInfoDetailVO.setIsConcept(1);
|
|
|
+ addConceptInfoDetailVO.setRemark(remark);
|
|
|
+ } else {
|
|
|
+ addConceptInfoDetailVO.setIsConcept(0);
|
|
|
+ }
|
|
|
+ detailList.add(addConceptInfoDetailVO);
|
|
|
}
|
|
|
addConceptInfoVO.setDetailList(detailList);
|
|
|
addConceptInfoVOList.add(addConceptInfoVO);
|
|
@@ -512,48 +528,48 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/*****************excel文件本身问题提醒************************/
|
|
|
- if(sbf.length()>0){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
|
|
|
+ if (sbf.length() > 0) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, sbf.toString());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**********************非规范的excel导入提醒*****************************************/
|
|
|
- if(title_1.indexOf("标准术语")==-1
|
|
|
- ||title_2.indexOf("类型")==-1
|
|
|
- ||title_3.indexOf("术语同义词")==-1
|
|
|
- ||title_4.indexOf("标准术语说明")==-1){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,"导入数据不正确,请选择正确数据导入!");
|
|
|
+ if (title_1.indexOf("标准术语") == -1
|
|
|
+ || title_2.indexOf("类型") == -1
|
|
|
+ || title_3.indexOf("术语同义词") == -1
|
|
|
+ || title_4.indexOf("标准术语说明") == -1) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, "导入数据不正确,请选择正确数据导入!");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/****************************导入空文件************************/
|
|
|
- if(addConceptInfoVOList.size()==0){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,"导入数据不能为空!");
|
|
|
+ if (addConceptInfoVOList.size() == 0) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, "导入数据不能为空!");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/****************excel文件中所有术语存在重复提示---名字和类型一样即重复***********************/
|
|
|
List<AddConceptInfoDetailVO> addConceptInfoDetailVOList = new ArrayList<>();
|
|
|
- addConceptInfoVOList.forEach(i->{
|
|
|
- addConceptInfoDetailVOList.addAll(i.getDetailList());
|
|
|
+ addConceptInfoVOList.forEach(i -> {
|
|
|
+ addConceptInfoDetailVOList.addAll(i.getDetailList());
|
|
|
});
|
|
|
- Map<String,List<AddConceptInfoDetailVO>> addConceptInfoDetailVOListMap = addConceptInfoDetailVOList.stream().collect(Collectors.groupingBy(AddConceptInfoDetailVO::getName));
|
|
|
- for(String key : addConceptInfoDetailVOListMap.keySet()){
|
|
|
- if(addConceptInfoDetailVOListMap.get(key).size()>1&&addConceptInfoDetailVOListMap.get(key).stream().map(i->i.getType()).distinct().count()==1){
|
|
|
- sbf.append(key).append(" ");
|
|
|
- }
|
|
|
+ Map<String, List<AddConceptInfoDetailVO>> addConceptInfoDetailVOListMap = addConceptInfoDetailVOList.stream().collect(Collectors.groupingBy(AddConceptInfoDetailVO::getName));
|
|
|
+ for (String key : addConceptInfoDetailVOListMap.keySet()) {
|
|
|
+ if (addConceptInfoDetailVOListMap.get(key).size() > 1 && addConceptInfoDetailVOListMap.get(key).stream().map(i -> i.getType()).distinct().count() == 1) {
|
|
|
+ sbf.append(key).append(" ");
|
|
|
+ }
|
|
|
}
|
|
|
- if(sbf.length()>0){
|
|
|
- sbf.append("数据重复,请修改导入数据!");
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
|
|
|
+ if (sbf.length() > 0) {
|
|
|
+ sbf.append("数据重复,请修改导入数据!");
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, sbf.toString());
|
|
|
}
|
|
|
-
|
|
|
- addConceptInfoVOList.forEach(i->{
|
|
|
- addConceptInfo(i);
|
|
|
+
|
|
|
+ addConceptInfoVOList.forEach(i -> {
|
|
|
+ addConceptInfo(i);
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@SuppressWarnings("deprecation")
|
|
|
private String getValue(Cell cell) {
|
|
|
try {
|
|
@@ -587,5 +603,117 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据概念Id列表获取概念列表Map
|
|
|
+ *
|
|
|
+ * @param conceptSearchVO 搜索参数
|
|
|
+ * @return 术语id和术语 Map
|
|
|
+ */
|
|
|
+ public Map<Long, String> getConceptMap(ConceptSearchVO conceptSearchVO) {
|
|
|
+ //入参验证
|
|
|
+ if (ListUtil.isEmpty(conceptSearchVO.getConceptIds())) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "术语列表不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取结构
|
|
|
+ List<Concept> concepts
|
|
|
+ = this.getListByIds(conceptSearchVO.getConceptIds());
|
|
|
+
|
|
|
+ //出参封装
|
|
|
+ Map<Long, String> map = new HashMap<>();
|
|
|
+ if (ListUtil.isNotEmpty(concepts)) {
|
|
|
+ map = concepts.stream().collect(Collectors.toMap(r -> r.getId(), r -> r.getLibName()));
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据概念Id列表获取概念列表
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Concept> getListByIds(List<Long> ids) {
|
|
|
+ QueryWrapper<Concept> conceptQueryWrapper = new QueryWrapper<>();
|
|
|
+ conceptQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("id", ids);
|
|
|
+ List<Concept> list = this.list(conceptQueryWrapper);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据类型获取术语列表(科室、辅检、慢病)
|
|
|
+ *
|
|
|
+ * @param conceptTypeVO 类型
|
|
|
+ * @return 术语列表
|
|
|
+ */
|
|
|
+ public List<ConceptBaseDTO> getConceptListByType(ConceptTypeVO conceptTypeVO) {
|
|
|
+ if(null == conceptTypeVO
|
|
|
+ || IntegerUtil.isNull(conceptTypeVO.getType())){
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "类型不能为空");
|
|
|
+ }
|
|
|
+ List<ConceptBaseDTO> res = ListUtil.newArrayList();
|
|
|
+ switch (conceptTypeVO.getType()) {
|
|
|
+ case 1:
|
|
|
+ res = getConceptByType(LexiconTypeEnum.DEPARTMENT.getKey());
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ res = getConceptByType(LexiconTypeEnum.PACS_PACKAGE.getKey());
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ res = getConceptChronic();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "类型超出范围以外");
|
|
|
+ }
|
|
|
+
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取慢病列表
|
|
|
+ *
|
|
|
+ * @return 慢病列表
|
|
|
+ */
|
|
|
+ private List<ConceptBaseDTO> getConceptChronic() {
|
|
|
+ ConceptWrapper conceptWrapper = new ConceptWrapper();
|
|
|
+ conceptWrapper.setStartType(LexiconTypeEnum.DIAGNOSIS.getKey());
|
|
|
+ conceptWrapper.setRelationType(LexiconRSTypeEnum.BELONG_TO.getKey());
|
|
|
+ conceptWrapper.setEndName("慢病");
|
|
|
+ List<ConceptRes> list = this.getConcept(conceptWrapper);
|
|
|
+ List<ConceptBaseDTO> res = ListUtil.newArrayList();
|
|
|
+ if (ListUtil.isNotEmpty(list)) {
|
|
|
+ for (ConceptRes concept : list) {
|
|
|
+ ConceptBaseDTO conceptBaseDTO = new ConceptBaseDTO();
|
|
|
+ conceptBaseDTO.setConceptId(concept.getStartId());
|
|
|
+ conceptBaseDTO.setName(concept.getStartName());
|
|
|
+ res.add(conceptBaseDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据类型获取术语列表(科室、辅检)
|
|
|
+ *
|
|
|
+ * @param libType
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<ConceptBaseDTO> getConceptByType(Integer libType) {
|
|
|
+ QueryWrapper<Concept> conceptQueryWrapper = new QueryWrapper<>();
|
|
|
+ conceptQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("lib_Type", libType);
|
|
|
+ List<Concept> list = this.list(conceptQueryWrapper);
|
|
|
+ List<ConceptBaseDTO> res = ListUtil.newArrayList();
|
|
|
+ if (ListUtil.isNotEmpty(list)) {
|
|
|
+ for (Concept concept : list) {
|
|
|
+ ConceptBaseDTO conceptBaseDTO = new ConceptBaseDTO();
|
|
|
+ conceptBaseDTO.setConceptId(concept.getId());
|
|
|
+ conceptBaseDTO.setName(concept.getLibName());
|
|
|
+ res.add(conceptBaseDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|