|
@@ -4,6 +4,7 @@ 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;
|
|
@@ -17,29 +18,31 @@ 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.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.diagbot.dto.ConceptDTO;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.diagbot.client.UserServiceClient;
|
|
|
import com.diagbot.dto.GetMedicalInfoDetailDTO;
|
|
|
-import com.diagbot.dto.TypeDTO;
|
|
|
+import com.diagbot.dto.GetMedicalInfoListDTO;
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.entity.Concept;
|
|
|
import com.diagbot.entity.LibraryInfo;
|
|
|
import com.diagbot.entity.Medical;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
+import com.diagbot.service.MedicalService;
|
|
|
import com.diagbot.service.impl.MedicalServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
-import com.diagbot.vo.AddConceptInfoDetailVO;
|
|
|
-import com.diagbot.vo.AddConceptInfoVO;
|
|
|
+import com.diagbot.util.UserUtils;
|
|
|
import com.diagbot.vo.AddMedicalInfoVO;
|
|
|
-import com.diagbot.vo.AmendTermVo;
|
|
|
import com.diagbot.vo.GetMedicalInfoDetailVO;
|
|
|
+import com.diagbot.vo.GetMedicalInfoListVO;
|
|
|
import com.diagbot.vo.RemoveMedicalInfoVO;
|
|
|
-import com.diagbot.vo.TermVo;
|
|
|
-import com.diagbot.vo.TypeVo;
|
|
|
|
|
|
/**
|
|
|
* @Description: 术语临床信息查询业务层
|
|
@@ -53,6 +56,30 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
private ConceptFacade conceptFacade;
|
|
|
@Autowired
|
|
|
private LibraryInfoFacade libraryInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("medicalServiceImpl")
|
|
|
+ private MedicalService medicalService;
|
|
|
+ @Autowired
|
|
|
+ private UserServiceClient userServiceClient;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取医学术语命名列表
|
|
|
+ * @param getMedicalInfoListVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<GetMedicalInfoListDTO> getMedicalInfoList(GetMedicalInfoListVO getMedicalInfoListVO) {
|
|
|
+ IPage<GetMedicalInfoListDTO> ipage = this.baseMapper.getMedicalInfoList(getMedicalInfoListVO);
|
|
|
+ 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()));
|
|
|
+ });
|
|
|
+ return ipage;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 医学术语命名删除
|
|
@@ -60,10 +87,15 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public Boolean removeMedicalInfo(RemoveMedicalInfoVO removeMedicalInfoVO) {
|
|
|
- QueryWrapper<Medical> medicalQe = new QueryWrapper<Medical>();
|
|
|
- medicalQe.eq("concept_id", removeMedicalInfoVO.getConceptId());
|
|
|
- remove(medicalQe);
|
|
|
- return true;
|
|
|
+ Medical medical = this.getById(removeMedicalInfoVO.getMedicalId());
|
|
|
+ if(medical==null||medical.getIsDeleted().equals("Y")){
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS);
|
|
|
+ }
|
|
|
+
|
|
|
+ medical.setIsDeleted("Y");
|
|
|
+ medical.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
+ medical.setGmtModified(DateUtil.now());
|
|
|
+ return updateById(medical);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -72,16 +104,25 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public GetMedicalInfoDetailDTO getMedicalInfoDetail(GetMedicalInfoDetailVO getMedicalInfoDetailVO){
|
|
|
- QueryWrapper<Medical> medicalQe = new QueryWrapper<Medical>();
|
|
|
- medicalQe.eq("concept_id", getMedicalInfoDetailVO.getConceptId());
|
|
|
- medicalQe.eq("is_deleted", "N");
|
|
|
- Medical medical = getOne(medicalQe);
|
|
|
- if(medical==null){
|
|
|
- return null;
|
|
|
+ Medical medical = this.getById(getMedicalInfoDetailVO.getMedicalId());
|
|
|
+ if(medical==null||medical.getIsDeleted().equals("Y")){
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS);
|
|
|
}
|
|
|
|
|
|
+ QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<LibraryInfo>();
|
|
|
+ libraryInfoQe.eq("is_deleted", "N");
|
|
|
+ libraryInfoQe.eq("is_concept", "1");
|
|
|
+ libraryInfoQe.eq("concept_id", medical.getConceptId());
|
|
|
+ LibraryInfo libraryInfo = libraryInfoFacade.getOne(libraryInfoQe);
|
|
|
+ if(libraryInfo==null){
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR,"术语医学属性所属概念不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
GetMedicalInfoDetailDTO getMedicalInfoDetailDTO = new GetMedicalInfoDetailDTO();
|
|
|
BeanUtil.copyProperties(medical, getMedicalInfoDetailDTO);
|
|
|
+ getMedicalInfoDetailDTO.setConceptName(libraryInfo.getName());
|
|
|
+ getMedicalInfoDetailDTO.setConceptType(libraryInfo.getType());
|
|
|
+
|
|
|
return getMedicalInfoDetailDTO;
|
|
|
}
|
|
|
|
|
@@ -91,30 +132,38 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public Boolean addMedicalInfo(AddMedicalInfoVO addMedicalInfoVO){
|
|
|
- String message = checkAddMedicalInfoVO(addMedicalInfoVO);
|
|
|
+ Map<String,Object> ckMap = checkAddMedicalInfoVO(addMedicalInfoVO);
|
|
|
+ Object message = ckMap.get("message");
|
|
|
if(message!=null){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,message);
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR,message.toString());
|
|
|
}
|
|
|
- Medical medical = new Medical();
|
|
|
- BeanUtil.copyProperties(addMedicalInfoVO, medical);
|
|
|
- save(medical);
|
|
|
- return true;
|
|
|
+ return saveOrUpdate((Medical)(ckMap.get("medical")));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 校验即将添加的数据
|
|
|
* @param addMedicalInfoVO
|
|
|
- * @return
|
|
|
+ * @return 返回map中,包含2个字段:message和medical,message-为空时,表示正常,取medical
|
|
|
*/
|
|
|
- private String checkAddMedicalInfoVO(AddMedicalInfoVO addMedicalInfoVO){
|
|
|
+ private Map<String,Object> checkAddMedicalInfoVO(AddMedicalInfoVO addMedicalInfoVO){
|
|
|
+ Map<String,Object> retMap = new HashMap<>();
|
|
|
+
|
|
|
QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<LibraryInfo>();
|
|
|
libraryInfoQe.eq("is_deleted", "N");
|
|
|
+ libraryInfoQe.eq("is_concept", "1");
|
|
|
libraryInfoQe.eq("name", addMedicalInfoVO.getConceptName());
|
|
|
libraryInfoQe.eq("type", addMedicalInfoVO.getConceptType());
|
|
|
- libraryInfoQe.eq("is_concept", "1");
|
|
|
+
|
|
|
LibraryInfo libraryInfo = libraryInfoFacade.getOne(libraryInfoQe);
|
|
|
if(libraryInfo==null){
|
|
|
- return "概念不存在";
|
|
|
+ retMap.put("message", "术语概念名称不存在");
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ Concept concept = conceptFacade.getById(libraryInfo.getConceptId());
|
|
|
+ if(concept==null||concept.getIsDeleted().equals("Y")){
|
|
|
+ retMap.put("message", "术语概念名称不存在");
|
|
|
+ return retMap;
|
|
|
}
|
|
|
|
|
|
List<String> infoNames = new ArrayList<>();
|
|
@@ -125,21 +174,44 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
QueryWrapper<LibraryInfo> libraryInfoQe1 = new QueryWrapper<LibraryInfo>();
|
|
|
libraryInfoQe1.in("name", infoNames);
|
|
|
libraryInfoQe1.eq("is_concept", "1");
|
|
|
+ libraryInfoQe1.eq("is_deleted", "N");
|
|
|
Map<String,List<LibraryInfo>> libraryInfoListMap = libraryInfoFacade.list(libraryInfoQe1).stream().collect(Collectors.groupingBy(LibraryInfo::getName));
|
|
|
if(libraryInfoListMap.get(addMedicalInfoVO.getName()).size()==0){
|
|
|
- return "术语名称不存在";
|
|
|
+ retMap.put("message", "术语名称不存在");
|
|
|
+ return retMap;
|
|
|
}
|
|
|
if(libraryInfoListMap.get(addMedicalInfoVO.getStdName()).size()==0){
|
|
|
- return "术语标准名不存在";
|
|
|
+ retMap.put("message", "术语标准名不存在");
|
|
|
+ return retMap;
|
|
|
}
|
|
|
if(libraryInfoListMap.get(addMedicalInfoVO.getCateName()).size()==0){
|
|
|
- return "术语小类名称不存在";
|
|
|
+ retMap.put("message", "术语小类名称不存在");
|
|
|
+ return retMap;
|
|
|
}
|
|
|
if(libraryInfoListMap.get(addMedicalInfoVO.getGrp()).size()==0){
|
|
|
- return "术语类组不存在";
|
|
|
+ retMap.put("message", "术语类组不存在");
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ String currentUser = UserUtils.getCurrentPrincipleID();
|
|
|
+ Date now = DateUtil.now();
|
|
|
+ QueryWrapper<Medical> medicalQe = new QueryWrapper<>();
|
|
|
+ medicalQe.eq("concept_id", libraryInfo.getConceptId());
|
|
|
+ Medical medical = this.getOne(medicalQe);
|
|
|
+ if(medical==null){
|
|
|
+ medical = new Medical();
|
|
|
+ medical.setCreator(currentUser);
|
|
|
+ medical.setGmtCreated(now);
|
|
|
}
|
|
|
+ medical.setIsDeleted("N");
|
|
|
+ medical.setModifier(currentUser);
|
|
|
+ medical.setGmtModified(now);
|
|
|
+ medical.setConceptId(libraryInfo.getConceptId());
|
|
|
+ BeanUtil.copyProperties(addMedicalInfoVO, medical);
|
|
|
|
|
|
- return null;
|
|
|
+ retMap.put("medical", medical);
|
|
|
+
|
|
|
+ return retMap;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -147,7 +219,6 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
* @param file
|
|
|
* @return
|
|
|
*/
|
|
|
- @SuppressWarnings("unchecked")
|
|
|
public Boolean medicalInfoExcelIm(MultipartFile file) {
|
|
|
List<AddMedicalInfoVO> addMedicalInfoVOList = new ArrayList<>();
|
|
|
StringBuffer sbf = new StringBuffer();
|
|
@@ -171,7 +242,8 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
|
|
|
Sheet sheet = wb.getSheetAt(0);
|
|
|
int count = 0;
|
|
|
- String conceptName, conceptType, name, stdName, cateName, grp, gender, minAge, maxAge, bodypart, subBodypart, dept, code, note;
|
|
|
+ String conceptName, conceptType, name, stdName, cateName, grp, gender, minAge, maxAge, bodypart, subBodypart, displayOrder, dept, code, note;
|
|
|
+ Integer minAge_, maxAge_;
|
|
|
for (Row row : sheet) {
|
|
|
count++;
|
|
|
if (count == 1 || row == null) {
|
|
@@ -179,8 +251,8 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
}
|
|
|
conceptName = getValue(row.getCell(0)).trim().replace(" ", "");
|
|
|
conceptType = getValue(row.getCell(1)).trim().replace(" ", "");
|
|
|
- name = getValue(row.getCell(1)).trim().replace(" ", "");
|
|
|
- stdName = getValue(row.getCell(2)).trim().replace(" ", "");
|
|
|
+ name = getValue(row.getCell(2)).trim().replace(" ", "");
|
|
|
+ stdName = getValue(row.getCell(3)).trim().replace(" ", "");
|
|
|
cateName = getValue(row.getCell(4)).trim().replace(" ", "");
|
|
|
grp = getValue(row.getCell(5)).trim().replace(" ", "");
|
|
|
gender = getValue(row.getCell(6)).trim().replace(" ", "");
|
|
@@ -188,16 +260,18 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
maxAge = getValue(row.getCell(8)).trim().replace(" ", "");
|
|
|
bodypart = getValue(row.getCell(9)).trim().replace(" ", "");
|
|
|
subBodypart = getValue(row.getCell(10)).trim().replace(" ", "");
|
|
|
- dept = getValue(row.getCell(11)).trim().replace(" ", "");
|
|
|
- code = getValue(row.getCell(12)).trim().replace(" ", "");
|
|
|
- note = getValue(row.getCell(13)).trim().replace(" ", "");
|
|
|
+ displayOrder = getValue(row.getCell(11)).trim().replace(" ", "");
|
|
|
+ dept = getValue(row.getCell(12)).trim().replace(" ", "");
|
|
|
+ code = getValue(row.getCell(13)).trim().replace(" ", "");
|
|
|
+ note = getValue(row.getCell(14)).trim().replace(" ", "");
|
|
|
if(StringUtil.isEmpty(conceptName) && StringUtil.isEmpty(name)
|
|
|
&& StringUtil.isEmpty(stdName) && StringUtil.isEmpty(cateName)
|
|
|
&& StringUtil.isEmpty(grp) && StringUtil.isEmpty(gender)
|
|
|
&& StringUtil.isEmpty(minAge) && StringUtil.isEmpty(maxAge)
|
|
|
&& StringUtil.isEmpty(bodypart) && StringUtil.isEmpty(subBodypart)
|
|
|
- && StringUtil.isEmpty(dept) && StringUtil.isEmpty(code)
|
|
|
- && StringUtil.isEmpty(note) && StringUtil.isEmpty(conceptType)){
|
|
|
+ && StringUtil.isEmpty(displayOrder)&& StringUtil.isEmpty(dept)
|
|
|
+ && StringUtil.isEmpty(code)&& StringUtil.isEmpty(note)
|
|
|
+ && StringUtil.isEmpty(conceptType)){
|
|
|
continue;
|
|
|
}
|
|
|
if (StringUtil.isEmpty(conceptName) || StringUtil.isEmpty(name)
|
|
@@ -210,6 +284,11 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
+ if(!gender.equals("1")&&!gender.equals("2")&&!gender.equals("3")){
|
|
|
+ sbf.append("第" + count + "行数据中性别非1、2、3;").append("<br/>");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
AddMedicalInfoVO addMedicalInfoVO = new AddMedicalInfoVO();
|
|
|
addMedicalInfoVO.setConceptName(conceptName);
|
|
|
addMedicalInfoVO.setConceptType(conceptType);
|
|
@@ -220,9 +299,23 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
addMedicalInfoVO.setGender(gender);
|
|
|
addMedicalInfoVO.setBodypart(bodypart);
|
|
|
addMedicalInfoVO.setSubBodypart(subBodypart);
|
|
|
+ addMedicalInfoVO.setBodypart(displayOrder);
|
|
|
addMedicalInfoVO.setDept(dept);
|
|
|
addMedicalInfoVO.setCode(code);
|
|
|
addMedicalInfoVO.setNote(note);
|
|
|
+ try{
|
|
|
+ minAge_ = Integer.parseInt(minAge);
|
|
|
+ maxAge_ = Integer.parseInt(maxAge);
|
|
|
+ }catch(Exception e){
|
|
|
+ minAge_ = null;
|
|
|
+ maxAge_ = null;
|
|
|
+ }
|
|
|
+ if(minAge_==null||maxAge_==null){
|
|
|
+ sbf.append("第" + count + "行数据中年龄非整数;").append("<br/>");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ addMedicalInfoVO.setMinAge(minAge_);
|
|
|
+ addMedicalInfoVO.setMaxAge(maxAge_);
|
|
|
addMedicalInfoVOList.add(addMedicalInfoVO);
|
|
|
}
|
|
|
} else {
|
|
@@ -249,24 +342,41 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /*****************excel文件本身问题提醒************************/
|
|
|
if(sbf.length()>0){
|
|
|
throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
|
|
|
}
|
|
|
|
|
|
- String message = null;
|
|
|
+ /****************excel文件中所有术语概念存在重复提示---术语概念名称和类型一样即重复***********************/
|
|
|
+ Map<String,List<AddMedicalInfoVO>> addMedicalInfoVOListMap = addMedicalInfoVOList.stream().collect(Collectors.groupingBy(AddMedicalInfoVO::getConceptName));
|
|
|
+ for(String key : addMedicalInfoVOListMap.keySet()){
|
|
|
+ if(addMedicalInfoVOListMap.get(key).size()>1&&addMedicalInfoVOListMap.get(key).stream().map(i->i.getConceptType()).distinct().count()==1){
|
|
|
+ sbf.append(key).append(" ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(sbf.length()>0){
|
|
|
+ sbf.append("(术语概念名称存在重复)");
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**************校验每一组数据,同时组装*************************/
|
|
|
+ List<Medical> saveOrUpdateMedicalList = new ArrayList<>();
|
|
|
+ Map<String,Object> ckMap = null;
|
|
|
+ Object message = null;
|
|
|
for(AddMedicalInfoVO i : addMedicalInfoVOList){
|
|
|
- message = checkAddMedicalInfoVO(i);
|
|
|
+ ckMap = checkAddMedicalInfoVO(i);
|
|
|
+ message = ckMap.get("message");
|
|
|
if(message!=null){
|
|
|
- sbf.append(message).append("(").append(i.getConceptName()).append(")").append("<br/>");
|
|
|
+ sbf.append(message.toString()).append("(").append(i.getConceptName()).append(")").append("<br/>");
|
|
|
+ }else{
|
|
|
+ saveOrUpdateMedicalList.add((Medical)(ckMap.get("medical")));
|
|
|
}
|
|
|
}
|
|
|
if(sbf.length()>0){
|
|
|
throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
|
|
|
}
|
|
|
|
|
|
- BeanUtil.listCopyTo(addMedicalInfoVOList, Medical.class);
|
|
|
-
|
|
|
- return true;
|
|
|
+ return medicalService.saveOrUpdateBatch(saveOrUpdateMedicalList);
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("deprecation")
|
|
@@ -303,162 +413,4 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取术语医学知识
|
|
|
- *
|
|
|
- * @param termVo
|
|
|
- * @result ConceptDTO
|
|
|
- */
|
|
|
- public ConceptDTO getMedicalInfo(@RequestBody TermVo termVo) {
|
|
|
- List<LibraryInfo> libraryInfos;
|
|
|
- LibraryInfo libraryInfo;
|
|
|
- List<Medical> medicals;
|
|
|
-
|
|
|
- ConceptDTO conceptDTO = conceptFacade.getConcept(termVo);
|
|
|
-
|
|
|
- if (conceptDTO != null) {
|
|
|
- // 获取与医学术语的基本信息
|
|
|
- QueryWrapper<LibraryInfo> query = new QueryWrapper<>();
|
|
|
- query.eq("concept_id", conceptDTO.getId());
|
|
|
- query.eq("is_concept", 1);
|
|
|
- libraryInfos = libraryInfoFacade.list(query);
|
|
|
-
|
|
|
- if (libraryInfos != null) {
|
|
|
- libraryInfo = libraryInfos.get(0);
|
|
|
- conceptDTO.setName(libraryInfo.getName());
|
|
|
-
|
|
|
- // 获取与术语相关的医学知识
|
|
|
- QueryWrapper<Medical> querymed = new QueryWrapper<>();
|
|
|
- querymed.eq("concept_id", conceptDTO.getId());
|
|
|
-
|
|
|
- medicals = list(querymed);
|
|
|
-
|
|
|
- if (medicals != null) {
|
|
|
- conceptDTO.setMedicalInfo(medicals);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return conceptDTO;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 更新或添加术语医学信息
|
|
|
- *
|
|
|
- * @param amendTermVo
|
|
|
- * @return ConceptDTO
|
|
|
- */
|
|
|
- public ConceptDTO upsertMedicalInfo(AmendTermVo amendTermVo) {
|
|
|
- ConceptDTO conceptDTO = new ConceptDTO();
|
|
|
-
|
|
|
-// Map<String, Object> map;
|
|
|
- Medical medical;
|
|
|
- List<Medical> medicals;
|
|
|
-
|
|
|
- conceptDTO.setName(amendTermVo.getNewterm());
|
|
|
- QueryWrapper<LibraryInfo> query = new QueryWrapper<>();
|
|
|
- query.eq("name", amendTermVo.getNewterm());
|
|
|
- query.eq("type", amendTermVo.getNewtype());
|
|
|
- LibraryInfo libraryInfo = libraryInfoFacade.getOne(query);
|
|
|
-
|
|
|
- if (amendTermVo.getMedicalInfo() != null && libraryInfo != null) {
|
|
|
-
|
|
|
- conceptDTO.setLibId(libraryInfo.getId().intValue());
|
|
|
- conceptDTO.setId(libraryInfo.getConceptId());
|
|
|
- conceptDTO.setMedicalInfo(new ArrayList<>());
|
|
|
-
|
|
|
- for (int i=0; i<amendTermVo.getMedicalInfo().size(); i++) {
|
|
|
- medical = amendTermVo.getMedicalInfo().get(i);
|
|
|
-// medical = amendTermVo.getMedicalInfo();
|
|
|
-
|
|
|
-// map = new HashMap<>();
|
|
|
-// map.put("name", amendTermVo.getNewterm());
|
|
|
-// medicals = getMedicalInfo(map);
|
|
|
-
|
|
|
- QueryWrapper<Medical> medquery = new QueryWrapper<>();
|
|
|
- medquery.eq("name", amendTermVo.getNewterm());
|
|
|
- medicals = list(medquery);
|
|
|
-
|
|
|
- if (medicals.size() > 0) {
|
|
|
- Medical exist_medical = medicals.get(0);
|
|
|
- medical.setId(exist_medical.getId());
|
|
|
- }
|
|
|
- else {
|
|
|
- medical.setConceptId(libraryInfo.getConceptId());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- this.saveOrUpdate(medical);
|
|
|
-
|
|
|
-// amendTermVo.setMedicalInfo(medical);
|
|
|
-// amendTermVo.getMedicalInfo().set(i, medical);
|
|
|
- conceptDTO.getMedicalInfo().add(medical);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return conceptDTO;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取术语类型信息
|
|
|
- *
|
|
|
- * @param type
|
|
|
- * @return TypeDTO
|
|
|
- */
|
|
|
- public TypeDTO getTypeInfo(String type) {
|
|
|
- TypeDTO typeDTO = null;
|
|
|
- TypeVo typeVo = new TypeVo();
|
|
|
-
|
|
|
- try {
|
|
|
- typeVo.setType(type);
|
|
|
- List<TypeDTO> typelist = getTypeId(typeVo);
|
|
|
-
|
|
|
- if (typelist.size() > 0) {
|
|
|
- typeDTO = getTypeId(typeVo).get(0);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex) {
|
|
|
- ex.printStackTrace();
|
|
|
- }
|
|
|
- finally {
|
|
|
- return typeDTO;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 清空医学术语信息表
|
|
|
- *
|
|
|
- */
|
|
|
- public void deleteMedical() {
|
|
|
- truncateMedical();
|
|
|
- }
|
|
|
}
|