|
@@ -1,36 +1,11 @@
|
|
|
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.DeptInfoServiceClient;
|
|
|
import com.diagbot.client.UserServiceClient;
|
|
|
-import com.diagbot.dto.GetAllDeptsDTO;
|
|
|
import com.diagbot.dto.GetMedicalInfoDetailDTO;
|
|
|
import com.diagbot.dto.GetMedicalInfoListDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
-import com.diagbot.entity.Bodypart;
|
|
|
import com.diagbot.entity.Concept;
|
|
|
import com.diagbot.entity.LibraryInfo;
|
|
|
import com.diagbot.entity.Medical;
|
|
@@ -44,10 +19,30 @@ import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
import com.diagbot.vo.AddMedicalInfoVO;
|
|
|
-import com.diagbot.vo.GetAllDeptsVO;
|
|
|
import com.diagbot.vo.GetMedicalInfoDetailVO;
|
|
|
import com.diagbot.vo.GetMedicalInfoListVO;
|
|
|
import com.diagbot.vo.RemoveMedicalInfoVO;
|
|
|
+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: 术语临床信息查询业务层
|
|
@@ -66,185 +61,187 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
private MedicalService medicalService;
|
|
|
@Autowired
|
|
|
private UserServiceClient userServiceClient;
|
|
|
- @Autowired
|
|
|
- private DeptInfoServiceClient deptInfoServiceClient;
|
|
|
- @Autowired
|
|
|
- private BodypartFacade bodypartFacade;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 获取医学术语命名列表
|
|
|
+ *
|
|
|
* @param getMedicalInfoListVO
|
|
|
* @return
|
|
|
*/
|
|
|
public IPage<GetMedicalInfoListDTO> getMedicalInfoList(GetMedicalInfoListVO getMedicalInfoListVO) {
|
|
|
- IPage<GetMedicalInfoListDTO> ipage = this.baseMapper.getMedicalInfoList(getMedicalInfoListVO);
|
|
|
- if(ipage.getRecords().size()==0){
|
|
|
- return ipage;
|
|
|
- }
|
|
|
- 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<GetMedicalInfoListDTO> ipage = this.baseMapper.getMedicalInfoList(getMedicalInfoListVO);
|
|
|
+ if (ipage.getRecords().size() == 0) {
|
|
|
+ return ipage;
|
|
|
+ }
|
|
|
+ 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 removeMedicalInfoVO
|
|
|
* @return
|
|
|
*/
|
|
|
public Boolean removeMedicalInfo(RemoveMedicalInfoVO removeMedicalInfoVO) {
|
|
|
- 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());
|
|
|
+ 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);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 获取术语医学属性详情
|
|
|
+ *
|
|
|
* @param getMedicalInfoDetailVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public GetMedicalInfoDetailDTO getMedicalInfoDetail(GetMedicalInfoDetailVO getMedicalInfoDetailVO){
|
|
|
- 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(LexiconTypeEnum.getName(libraryInfo.getTypeId().intValue()));
|
|
|
-
|
|
|
- return getMedicalInfoDetailDTO;
|
|
|
+ public GetMedicalInfoDetailDTO getMedicalInfoDetail(GetMedicalInfoDetailVO getMedicalInfoDetailVO) {
|
|
|
+ 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(LexiconTypeEnum.getName(libraryInfo.getTypeId().intValue()));
|
|
|
+
|
|
|
+ return getMedicalInfoDetailDTO;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 术语医学属性添加或者编辑
|
|
|
+ *
|
|
|
* @param addMedicalInfoVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public Boolean addMedicalInfo(AddMedicalInfoVO addMedicalInfoVO){
|
|
|
- Map<String,Object> ckMap = checkAddMedicalInfoVO(addMedicalInfoVO);
|
|
|
- Object message = ckMap.get("message");
|
|
|
- if(message!=null){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,message.toString());
|
|
|
- }
|
|
|
- return saveOrUpdate((Medical)(ckMap.get("medical")));
|
|
|
+ public Boolean addMedicalInfo(AddMedicalInfoVO addMedicalInfoVO) {
|
|
|
+ Map<String, Object> ckMap = checkAddMedicalInfoVO(addMedicalInfoVO);
|
|
|
+ Object message = ckMap.get("message");
|
|
|
+ if (message != null) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, message.toString());
|
|
|
+ }
|
|
|
+ return saveOrUpdate((Medical) (ckMap.get("medical")));
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 校验即将添加的数据
|
|
|
- * @param addMedicalInfoVO
|
|
|
- * @return 返回map中,包含2个字段:message和medical,message-为空时,表示正常,取medical
|
|
|
- */
|
|
|
- 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());
|
|
|
-
|
|
|
- LibraryInfo libraryInfo = libraryInfoFacade.getOne(libraryInfoQe);
|
|
|
- if(libraryInfo==null){
|
|
|
- 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<>();
|
|
|
- infoNames.add(addMedicalInfoVO.getName());
|
|
|
- infoNames.add(addMedicalInfoVO.getStdName());
|
|
|
- infoNames.add(addMedicalInfoVO.getCateName());
|
|
|
- infoNames.add(addMedicalInfoVO.getGrp());
|
|
|
- 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){
|
|
|
- retMap.put("message", "术语名称不存在");
|
|
|
- return retMap;
|
|
|
- }
|
|
|
- if(libraryInfoListMap.get(addMedicalInfoVO.getStdName()).size()==0){
|
|
|
- retMap.put("message", "术语标准名不存在");
|
|
|
- return retMap;
|
|
|
- }
|
|
|
- if(libraryInfoListMap.get(addMedicalInfoVO.getCateName()).size()==0){
|
|
|
- retMap.put("message", "术语小类名称不存在");
|
|
|
- return retMap;
|
|
|
- }
|
|
|
- if(libraryInfoListMap.get(addMedicalInfoVO.getGrp()).size()==0){
|
|
|
- retMap.put("message", "术语类组不存在");
|
|
|
- return retMap;
|
|
|
- }
|
|
|
-
|
|
|
- QueryWrapper<Bodypart> bodypartQe = new QueryWrapper<>();
|
|
|
- bodypartQe.eq("is_deleted", "N");
|
|
|
- bodypartQe.eq("bodypart", addMedicalInfoVO.getBodypart());
|
|
|
- if(bodypartFacade.list(bodypartQe).size()==0){
|
|
|
- retMap.put("message", "一级部位不存在");
|
|
|
- return retMap;
|
|
|
- }
|
|
|
- bodypartQe.eq("sub_bodypart", addMedicalInfoVO.getSubBodypart());
|
|
|
- if(bodypartFacade.list(bodypartQe).size()==0){
|
|
|
- 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);
|
|
|
-
|
|
|
- retMap.put("medical", medical);
|
|
|
-
|
|
|
- return retMap;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验即将添加的数据
|
|
|
+ *
|
|
|
+ * @param addMedicalInfoVO
|
|
|
+ * @return 返回map中,包含2个字段:message和medical,message-为空时,表示正常,取medical
|
|
|
+ */
|
|
|
+ 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());
|
|
|
+
|
|
|
+ LibraryInfo libraryInfo = libraryInfoFacade.getOne(libraryInfoQe);
|
|
|
+ if (libraryInfo == null) {
|
|
|
+ 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<>();
|
|
|
+ infoNames.add(addMedicalInfoVO.getName());
|
|
|
+ infoNames.add(addMedicalInfoVO.getStdName());
|
|
|
+ infoNames.add(addMedicalInfoVO.getCateName());
|
|
|
+ infoNames.add(addMedicalInfoVO.getGrp());
|
|
|
+ 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) {
|
|
|
+ retMap.put("message", "术语名称不存在");
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ if (libraryInfoListMap.get(addMedicalInfoVO.getStdName()).size() == 0) {
|
|
|
+ retMap.put("message", "术语标准名不存在");
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ if (libraryInfoListMap.get(addMedicalInfoVO.getCateName()).size() == 0) {
|
|
|
+ retMap.put("message", "术语小类名称不存在");
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ if (libraryInfoListMap.get(addMedicalInfoVO.getGrp()).size() == 0) {
|
|
|
+ retMap.put("message", "术语类组不存在");
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ // QueryWrapper<Bodypart> bodypartQe = new QueryWrapper<>();
|
|
|
+ // bodypartQe.eq("is_deleted", "N");
|
|
|
+ // bodypartQe.eq("bodypart", addMedicalInfoVO.getBodypart());
|
|
|
+ // if(bodypartFacade.list(bodypartQe).size()==0){
|
|
|
+ // retMap.put("message", "一级部位不存在");
|
|
|
+ // return retMap;
|
|
|
+ // }
|
|
|
+ // bodypartQe.eq("sub_bodypart", addMedicalInfoVO.getSubBodypart());
|
|
|
+ // if(bodypartFacade.list(bodypartQe).size()==0){
|
|
|
+ // 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);
|
|
|
+
|
|
|
+ retMap.put("medical", medical);
|
|
|
+
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 术语医学属性excel文件导入
|
|
|
+ *
|
|
|
* @param file
|
|
|
* @return
|
|
|
*/
|
|
|
- public Boolean medicalInfoExcelIm(MultipartFile file) {
|
|
|
+ public Boolean medicalInfoExcelIm(MultipartFile file) {
|
|
|
List<AddMedicalInfoVO> addMedicalInfoVOList = new ArrayList<>();
|
|
|
StringBuffer sbf = new StringBuffer();
|
|
|
InputStream inputStream = null;
|
|
@@ -264,7 +261,7 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
wb = new XSSFWorkbook(inputStream);
|
|
|
}
|
|
|
if (wb != null) {
|
|
|
-
|
|
|
+
|
|
|
Sheet sheet = wb.getSheetAt(0);
|
|
|
int count = 0;
|
|
|
String conceptName, conceptType, name, stdName, cateName, grp, gender, minAge, maxAge, bodypart, subBodypart, displayOrder, dept, code, note;
|
|
@@ -289,15 +286,15 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
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)
|
|
|
+ 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(displayOrder)&& StringUtil.isEmpty(dept)
|
|
|
- && StringUtil.isEmpty(code)&& StringUtil.isEmpty(note)
|
|
|
- && StringUtil.isEmpty(conceptType)){
|
|
|
- continue;
|
|
|
+ && StringUtil.isEmpty(displayOrder) && StringUtil.isEmpty(dept)
|
|
|
+ && StringUtil.isEmpty(code) && StringUtil.isEmpty(note)
|
|
|
+ && StringUtil.isEmpty(conceptType)) {
|
|
|
+ continue;
|
|
|
}
|
|
|
if (StringUtil.isEmpty(conceptName) || StringUtil.isEmpty(name)
|
|
|
|| StringUtil.isEmpty(stdName) || StringUtil.isEmpty(cateName)
|
|
@@ -308,12 +305,12 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
sbf.append("第" + count + "行数据不完整;").append("<br/>");
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
- if(!gender.equals("1")&&!gender.equals("2")&&!gender.equals("3")){
|
|
|
- sbf.append("第" + count + "行数据中性别非1、2、3;").append("<br/>");
|
|
|
- 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);
|
|
@@ -328,19 +325,19 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
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;
|
|
|
+ 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;
|
|
|
+ if (minAge_ == null || maxAge_ == null) {
|
|
|
+ sbf.append("第" + count + "行数据中年龄非整数;").append("<br/>");
|
|
|
+ continue;
|
|
|
}
|
|
|
addMedicalInfoVO.setMinAge(minAge_);
|
|
|
- addMedicalInfoVO.setMaxAge(maxAge_);
|
|
|
+ addMedicalInfoVO.setMaxAge(maxAge_);
|
|
|
addMedicalInfoVOList.add(addMedicalInfoVO);
|
|
|
}
|
|
|
} else {
|
|
@@ -366,44 +363,44 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
} 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文件中所有术语概念存在重复提示---术语概念名称和类型一样即重复***********************/
|
|
|
- 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(" ");
|
|
|
- }
|
|
|
+ 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());
|
|
|
+ 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){
|
|
|
- ckMap = checkAddMedicalInfoVO(i);
|
|
|
- message = ckMap.get("message");
|
|
|
- if(message!=null){
|
|
|
- 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());
|
|
|
+ Map<String, Object> ckMap = null;
|
|
|
+ Object message = null;
|
|
|
+ for (AddMedicalInfoVO i : addMedicalInfoVOList) {
|
|
|
+ ckMap = checkAddMedicalInfoVO(i);
|
|
|
+ message = ckMap.get("message");
|
|
|
+ if (message != null) {
|
|
|
+ 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());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return medicalService.saveOrUpdateBatch(saveOrUpdateMedicalList);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@SuppressWarnings("deprecation")
|
|
|
private String getValue(Cell cell) {
|
|
|
try {
|
|
@@ -437,14 +434,4 @@ public class MedicalFacade extends MedicalServiceImpl {
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取术语医学属性所需全部科室
|
|
|
- * @param getAllDeptsVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public List<GetAllDeptsDTO> getAllDepts(GetAllDeptsVO getAllDeptsVO){
|
|
|
- return deptInfoServiceClient.getAllDepts(getAllDeptsVO).data;
|
|
|
- }
|
|
|
-
|
|
|
}
|