Browse Source

命名导入修改

rgb 6 năm trước cách đây
mục cha
commit
605df58c45

+ 84 - 71
knowledgeman-service/src/main/java/com/diagbot/entity/LibraryInfo.java

@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
  * </p>
  *
  * @author gaodm
- * @since 2019-03-26
+ * @since 2019-04-19
  */
 public class LibraryInfo implements Serializable {
 
@@ -25,59 +25,64 @@ public class LibraryInfo implements Serializable {
     private Long id;
 
     /**
-     * 是否删除,N:未删除,Y:删除
+     * 名称
      */
-    private String isDeleted;
+    private String name;
 
     /**
-     * 记录创建时间
+     * 术语类型id
      */
-    private Date gmtCreated;
+    private Long typeId;
 
     /**
-     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     * 类型
      */
-    private Date gmtModified;
+    private String type;
 
     /**
-     * 创建人,0表示无创建人值
+     * 概念id
      */
-    private String creator;
+    private Long conceptId;
 
     /**
-     * 修改人,如果为0则表示纪录未修改
+     * 是否标准词,1:是,0:否
      */
-    private String modifier;
+    private Integer isConcept;
 
     /**
-     * 名称
+     * 术语排序
      */
-    private String name;
+    private Integer orderNo;
 
     /**
-     * 类型
+     * 是否删除,N:未删除,Y:删除
      */
-    private String type;
+    private String isDeleted;
 
     /**
-     * 备注
+     * 创建人,0表示无创建人值
      */
-    private String remark;
+    private String creator;
 
     /**
-     * 概念id
+     * 修改人,如果为0则表示纪录未修改
      */
-    private Long conceptId;
+    private String modifier;
 
     /**
-     * 术语排序
+     * 记录创建时间
      */
-    private Integer orderNo;
+    private Date gmtCreated;
 
     /**
-     * 是否标准词,1:是,0:否
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
      */
-    private Integer isConcept;
+    private Date gmtModified;
+
+    /**
+     * 备注
+     */
+    private String remark;
 
     public Long getId() {
         return id;
@@ -86,26 +91,54 @@ public class LibraryInfo implements Serializable {
     public void setId(Long id) {
         this.id = id;
     }
-    public String getIsDeleted() {
-        return isDeleted;
+    public String getName() {
+        return name;
     }
 
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
+    public void setName(String name) {
+        this.name = name;
     }
-    public Date getGmtCreated() {
-        return gmtCreated;
+    public Long getTypeId() {
+        return typeId;
     }
 
-    public void setGmtCreated(Date gmtCreated) {
-        this.gmtCreated = gmtCreated;
+    public void setTypeId(Long typeId) {
+        this.typeId = typeId;
     }
-    public Date getGmtModified() {
-        return gmtModified;
+    public String getType() {
+        return type;
     }
 
-    public void setGmtModified(Date gmtModified) {
-        this.gmtModified = gmtModified;
+    public void setType(String type) {
+        this.type = type;
+    }
+    public Long getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Long conceptId) {
+        this.conceptId = conceptId;
+    }
+    public Integer getIsConcept() {
+        return isConcept;
+    }
+
+    public void setIsConcept(Integer isConcept) {
+        this.isConcept = isConcept;
+    }
+    public Integer getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(Integer orderNo) {
+        this.orderNo = orderNo;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
     }
     public String getCreator() {
         return creator;
@@ -121,19 +154,19 @@ public class LibraryInfo implements Serializable {
     public void setModifier(String modifier) {
         this.modifier = modifier;
     }
-    public String getName() {
-        return name;
+    public Date getGmtCreated() {
+        return gmtCreated;
     }
 
-    public void setName(String name) {
-        this.name = name;
+    public void setGmtCreated(Date gmtCreated) {
+        this.gmtCreated = gmtCreated;
     }
-    public String getType() {
-        return type;
+    public Date getGmtModified() {
+        return gmtModified;
     }
 
-    public void setType(String type) {
-        this.type = type;
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
     }
     public String getRemark() {
         return remark;
@@ -142,43 +175,23 @@ public class LibraryInfo implements Serializable {
     public void setRemark(String remark) {
         this.remark = remark;
     }
-    public Long getConceptId() {
-        return conceptId;
-    }
-
-    public void setConceptId(Long conceptId) {
-        this.conceptId = conceptId;
-    }
-    public Integer getOrderNo() {
-        return orderNo;
-    }
-
-    public void setOrderNo(Integer orderNo) {
-        this.orderNo = orderNo;
-    }
-    public Integer getIsConcept() {
-        return isConcept;
-    }
-
-    public void setIsConcept(Integer isConcept) {
-        this.isConcept = isConcept;
-    }
 
     @Override
     public String toString() {
         return "LibraryInfo{" +
         "id=" + id +
-        ", isDeleted=" + isDeleted +
-        ", gmtCreated=" + gmtCreated +
-        ", gmtModified=" + gmtModified +
-        ", creator=" + creator +
-        ", modifier=" + modifier +
         ", name=" + name +
+        ", typeId=" + typeId +
         ", type=" + type +
-        ", remark=" + remark +
         ", conceptId=" + conceptId +
-        ", orderNo=" + orderNo +
         ", isConcept=" + isConcept +
+        ", orderNo=" + orderNo +
+        ", isDeleted=" + isDeleted +
+        ", creator=" + creator +
+        ", modifier=" + modifier +
+        ", gmtCreated=" + gmtCreated +
+        ", gmtModified=" + gmtModified +
+        ", remark=" + remark +
         "}";
     }
 }

+ 35 - 2
knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -31,6 +31,7 @@ import com.diagbot.dto.GetAllLisConceptDTO;
 import com.diagbot.dto.GetConceptInfoDetailDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.Concept;
+import com.diagbot.entity.Lexicon;
 import com.diagbot.entity.LibraryDetail;
 import com.diagbot.entity.LibraryInfo;
 import com.diagbot.entity.Medical;
@@ -72,6 +73,8 @@ public class ConceptFacade extends ConceptServiceImpl {
     private LibraryInfoService libraryInfoService;
     @Autowired
     private UserServiceClient userServiceClient;
+    @Autowired
+    private LexiconFacade lexiconFacade;
     
     /**
      * 获取所有化验公表项
@@ -254,6 +257,13 @@ public class ConceptFacade extends ConceptServiceImpl {
     		throw new CommonException(CommonErrorCode.RPC_ERROR,"标准术语只能有一个("+addConceptInfoVO.getName()+")");
     	}
     	
+    	QueryWrapper<Lexicon> lexiconQe = new QueryWrapper<>();
+    	lexiconQe.eq("name", addConceptInfoVO.getType());
+    	Lexicon lexicon = lexiconFacade.getOne(lexiconQe);
+    	if(lexicon==null){
+    		throw new CommonException(CommonErrorCode.RPC_ERROR,"数据有误,该类型信息在数据库中不存在("+addConceptInfoVO.getName()+")");
+    	}
+    	
     	List<LibraryInfo> saveOrUpdateLibraryInfoList = new ArrayList<>();
     	
     	AddConceptInfoDetailVO addConceptInfoDetailVOMain = addConceptInfoDetailVOMainList.get(0);//提交过来的标准术语
@@ -281,6 +291,7 @@ public class ConceptFacade extends ConceptServiceImpl {
 			libraryInfoMain.setGmtModified(now);
 			libraryInfoMain.setModifier(currentUser);
 			libraryInfoMain.setType(addConceptInfoVO.getType());
+			libraryInfoMain.setTypeId(lexicon.getId());
 			libraryinfoFacade.save(libraryInfoMain);
 			concept.setLibId(libraryInfoMain.getId());
 			concept.setGmtCreated(now);
@@ -377,6 +388,7 @@ public class ConceptFacade extends ConceptServiceImpl {
 			i.setId(null);
 			i.setConceptId(conceptId);
 			i.setType(addConceptInfoVO.getType());
+			i.setTypeId(lexicon.getId());
 		}
 		saveOrUpdateLibraryInfoList.add(libraryInfoMain);
 		
@@ -401,6 +413,7 @@ public class ConceptFacade extends ConceptServiceImpl {
         StringBuffer sbf = new StringBuffer();
         InputStream inputStream = null;
         Workbook wb = null;
+        String title_1="",title_2="",title_3="",title_4="";
         try {
             if (!file.isEmpty()) {
                 inputStream = file.getInputStream();
@@ -422,7 +435,14 @@ public class ConceptFacade extends ConceptServiceImpl {
                             String libName, libType, otherNames, remark;
                             for (Row row : sheet) {
                                 count++;
-                                if (count == 1 || row == null) {
+                                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(" ", "");
                                     continue;
                                 }
                                 libName = getValue(row.getCell(0)).trim().replace(" ", "");
@@ -484,11 +504,24 @@ public class ConceptFacade extends ConceptServiceImpl {
             }
         }
         
+        /**********************非规范的excel导入提醒*****************************************/
+        if(title_1.indexOf("标准术语")==-1
+        		||title_2.indexOf("类型")==-1
+        		||title_3.indexOf("术语同义词")==-1
+        		||title_4.indexOf("标准术语说明")==-1){
+        	throw new CommonException(CommonErrorCode.RPC_ERROR,"导入数据不正确,请选择正确数据导入!");
+        }
+        
         /*****************excel文件本身问题提醒************************/
         if(sbf.length()>0){
         	throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
         }
         
+        /****************************导入空文件************************/
+        if(addConceptInfoVOList.size()==0){
+        	throw new CommonException(CommonErrorCode.RPC_ERROR,"导入文件内容不能为空!");
+        }
+        
         /****************excel文件中所有术语存在重复提示---名字和类型一样即重复***********************/
         List<AddConceptInfoDetailVO> addConceptInfoDetailVOList = new ArrayList<>();
         addConceptInfoVOList.forEach(i->{
@@ -504,7 +537,7 @@ public class ConceptFacade extends ConceptServiceImpl {
         	sbf.append("(术语存在重复)");
         	throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
         }
-
+        
         addConceptInfoVOList.forEach(i->{
         	addConceptInfo(i);
         });

+ 19 - 1
knowledgeman-service/src/main/java/com/diagbot/facade/RelationFacade.java

@@ -276,6 +276,7 @@ public class RelationFacade extends RelationServiceImpl {
         StringBuffer sbf = new StringBuffer();
         InputStream inputStream = null;
         Workbook wb = null;
+        String title_1="",title_2="",title_3="",title_4="",title_5="";
         try {
             if (!file.isEmpty()) {
                 inputStream = file.getInputStream();
@@ -297,7 +298,15 @@ public class RelationFacade extends RelationServiceImpl {
                             String startName, startType, endName, endType, relationName;
                             for (Row row : sheet) {
                                 count++;
-                                if (count == 1 || row == null) {
+                                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_5 = getValue(row.getCell(4)).trim().replace(" ", "");
                                     continue;
                                 }
                                 startName = getValue(row.getCell(0)).trim().replace(" ", "");
@@ -343,6 +352,15 @@ public class RelationFacade extends RelationServiceImpl {
             }
         }
         
+        /**********************非规范的excel导入提醒*****************************************/
+        if(title_1.indexOf("关系起点术语名称")==-1
+        		||title_2.indexOf("关系起点术语类型")==-1
+        		||title_3.indexOf("关系终点术语名称")==-1
+        		||title_4.indexOf("关系终点术语类型")==-1
+        		||title_5.indexOf("关系类型名称")==-1){
+        	throw new CommonException(CommonErrorCode.RPC_ERROR,"导入数据不正确,请选择正确数据导入!");
+        }
+        
         /*****************excel文件本身问题提醒************************/
         if(sbf.length()>0){
         	throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());

+ 8 - 7
knowledgeman-service/src/main/resources/mapper/LibraryInfoMapper.xml

@@ -5,17 +5,18 @@
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.diagbot.entity.LibraryInfo">
         <id column="id" property="id" />
-        <result column="is_deleted" property="isDeleted" />
-        <result column="gmt_created" property="gmtCreated" />
-        <result column="gmt_modified" property="gmtModified" />
-        <result column="creator" property="creator" />
-        <result column="modifier" property="modifier" />
         <result column="name" property="name" />
+        <result column="type_id" property="typeId" />
         <result column="type" property="type" />
-        <result column="remark" property="remark" />
         <result column="concept_id" property="conceptId" />
-        <result column="order_no" property="orderNo" />
         <result column="is_concept" property="isConcept" />
+        <result column="order_no" property="orderNo" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="gmt_created" property="gmtCreated" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="remark" property="remark" />
     </resultMap>
 
     <select id="getAllInformation" resultType="com.diagbot.dto.GetAllInformationDTO">