Explorar o código

Merge branch 'debug' of http://192.168.2.236:10080/gaodm/diagbotcloud into debug

zhaops %!s(int64=4) %!d(string=hai) anos
pai
achega
ee5e920614

+ 10 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlDiseaseDTO.java

@@ -139,6 +139,16 @@ public class KlDiseaseDTO implements Serializable {
      */
     private String remark;
 
+    /**
+     * 肿瘤细胞类型
+     */
+    private String tumorCellType;
+
+    /**
+     * 形态学分类代码
+     */
+    private String morphology;
+
     // 科室列表
     private List<KlConceptSimDTO> deptList = Lists.newLinkedList();
 

+ 5 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlSymptomDTO.java

@@ -24,6 +24,11 @@ public class KlSymptomDTO implements Serializable {
      */
     private Long conceptId;
 
+    /**
+     * 阳性症状(0:否,1:是)
+     */
+    private Integer isPositive;
+
     /**
      * 英文名称
      */

+ 19 - 0
cdssman-service/src/main/java/com/diagbot/entity/Ex.java

@@ -0,0 +1,19 @@
+package com.diagbot.entity;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @time: 2021/5/21 13:49
+ */
+@Target(value = { ElementType.TYPE, ElementType.FIELD })
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Ex {
+    public String name();
+}

+ 12 - 247
cdssman-service/src/main/java/com/diagbot/entity/KlDisease.java

@@ -2,6 +2,7 @@ package com.diagbot.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -14,6 +15,7 @@ import java.util.Date;
  * @author zhoutg
  * @since 2021-05-11
  */
+@Data
 public class KlDisease implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -164,255 +166,18 @@ public class KlDisease implements Serializable {
      */
     private String enName;
 
+    /**
+     * 肿瘤细胞类型
+     */
+    private String tumorCellType;
+
+    /**
+     * 形态学分类代码
+     */
+    private String morphology;
+
     /**
      * 备注
      */
     private String remark;
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-    public Date getGmtCreate() {
-        return gmtCreate;
-    }
-
-    public void setGmtCreate(Date gmtCreate) {
-        this.gmtCreate = gmtCreate;
-    }
-    public Date getGmtModified() {
-        return gmtModified;
-    }
-
-    public void setGmtModified(Date gmtModified) {
-        this.gmtModified = gmtModified;
-    }
-    public String getCreator() {
-        return creator;
-    }
-
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
-    public String getModifier() {
-        return modifier;
-    }
-
-    public void setModifier(String modifier) {
-        this.modifier = modifier;
-    }
-    public Long getConceptId() {
-        return conceptId;
-    }
-
-    public void setConceptId(Long conceptId) {
-        this.conceptId = conceptId;
-    }
-    public Long getDeptId() {
-        return deptId;
-    }
-
-    public void setDeptId(Long deptId) {
-        this.deptId = deptId;
-    }
-    public String getIcd10Code() {
-        return icd10Code;
-    }
-
-    public void setIcd10Code(String icd10Code) {
-        this.icd10Code = icd10Code;
-    }
-    public String getCourse() {
-        return course;
-    }
-
-    public void setCourse(String course) {
-        this.course = course;
-    }
-    public String getInducement() {
-        return inducement;
-    }
-
-    public void setInducement(String inducement) {
-        this.inducement = inducement;
-    }
-    public String getFoodProhibition() {
-        return foodProhibition;
-    }
-
-    public void setFoodProhibition(String foodProhibition) {
-        this.foodProhibition = foodProhibition;
-    }
-    public String getHazard() {
-        return hazard;
-    }
-
-    public void setHazard(String hazard) {
-        this.hazard = hazard;
-    }
-    public String getHealing() {
-        return healing;
-    }
-
-    public void setHealing(String healing) {
-        this.healing = healing;
-    }
-    public String getPernicious() {
-        return pernicious;
-    }
-
-    public void setPernicious(String pernicious) {
-        this.pernicious = pernicious;
-    }
-    public String getClinicType() {
-        return clinicType;
-    }
-
-    public void setClinicType(String clinicType) {
-        this.clinicType = clinicType;
-    }
-    public String getVulArea() {
-        return vulArea;
-    }
-
-    public void setVulArea(String vulArea) {
-        this.vulArea = vulArea;
-    }
-    public String getVulCrowd() {
-        return vulCrowd;
-    }
-
-    public void setVulCrowd(String vulCrowd) {
-        this.vulCrowd = vulCrowd;
-    }
-    public Double getIncidence() {
-        return incidence;
-    }
-
-    public void setIncidence(Double incidence) {
-        this.incidence = incidence;
-    }
-    public Integer getIsInfect() {
-        return isInfect;
-    }
-
-    public void setIsInfect(Integer isInfect) {
-        this.isInfect = isInfect;
-    }
-    public String getComplication() {
-        return complication;
-    }
-
-    public void setComplication(String complication) {
-        this.complication = complication;
-    }
-    public String getPathogeny() {
-        return pathogeny;
-    }
-
-    public void setPathogeny(String pathogeny) {
-        this.pathogeny = pathogeny;
-    }
-    public String getDisType() {
-        return disType;
-    }
-
-    public void setDisType(String disType) {
-        this.disType = disType;
-    }
-    public Integer getChWestern() {
-        return chWestern;
-    }
-
-    public void setChWestern(Integer chWestern) {
-        this.chWestern = chWestern;
-    }
-    public Integer getIsCommonDis() {
-        return isCommonDis;
-    }
-
-    public void setIsCommonDis(Integer isCommonDis) {
-        this.isCommonDis = isCommonDis;
-    }
-    public Integer getIsHeredity() {
-        return isHeredity;
-    }
-
-    public void setIsHeredity(Integer isHeredity) {
-        this.isHeredity = isHeredity;
-    }
-    public String getNameSimple() {
-        return nameSimple;
-    }
-
-    public void setNameSimple(String nameSimple) {
-        this.nameSimple = nameSimple;
-    }
-    public String getEnNameSimple() {
-        return enNameSimple;
-    }
-
-    public void setEnNameSimple(String enNameSimple) {
-        this.enNameSimple = enNameSimple;
-    }
-    public String getEnName() {
-        return enName;
-    }
-
-    public void setEnName(String enName) {
-        this.enName = enName;
-    }
-    public String getRemark() {
-        return remark;
-    }
-
-    public void setRemark(String remark) {
-        this.remark = remark;
-    }
-
-    @Override
-    public String toString() {
-        return "KlDisease{" +
-            "id=" + id +
-            ", isDeleted=" + isDeleted +
-            ", gmtCreate=" + gmtCreate +
-            ", gmtModified=" + gmtModified +
-            ", creator=" + creator +
-            ", modifier=" + modifier +
-            ", conceptId=" + conceptId +
-            ", deptId=" + deptId +
-            ", icd10Code=" + icd10Code +
-            ", course=" + course +
-            ", inducement=" + inducement +
-            ", foodProhibition=" + foodProhibition +
-            ", hazard=" + hazard +
-            ", healing=" + healing +
-            ", pernicious=" + pernicious +
-            ", clinicType=" + clinicType +
-            ", vulArea=" + vulArea +
-            ", vulCrowd=" + vulCrowd +
-            ", incidence=" + incidence +
-            ", isInfect=" + isInfect +
-            ", complication=" + complication +
-            ", pathogeny=" + pathogeny +
-            ", disType=" + disType +
-            ", chWestern=" + chWestern +
-            ", isCommonDis=" + isCommonDis +
-            ", isHeredity=" + isHeredity +
-            ", nameSimple=" + nameSimple +
-            ", enNameSimple=" + enNameSimple +
-            ", enName=" + enName +
-            ", remark=" + remark +
-        "}";
-    }
 }

+ 2 - 2
cdssman-service/src/main/java/com/diagbot/enums/LexiconEnum.java

@@ -54,8 +54,8 @@ public enum LexiconEnum implements KeyedNamed {
     LisClassNode(408,"实验室检查类别根节点"),
     PacsClassNode(409,"辅助检查类别根节点"),
     Age(410,"年龄"),
-    DisSysType(411,"疾病系统分类"),
-    Nature(412,"性质");
+    DisSysType(307,"疾病系统分类"),
+    Nature(126,"性质");
 
 
     @Setter

+ 2 - 2
cdssman-service/src/main/java/com/diagbot/enums/RelationLibTypeEnum.java

@@ -23,9 +23,9 @@ public enum RelationLibTypeEnum implements KeyedNamed {
     disNurse(510,"123"),
     relationDept(511,"115"),
     relationPart(512,"122"),
-    relationSystem(513,"411"),
+    relationSystem(513,"307"),
     relationAccSymptom(514,"103"),
-    relationNature(515,"412");
+    relationNature(515,"126");
 
 
     @Setter

+ 82 - 12
cdssman-service/src/main/java/com/diagbot/facade/KlDrugRegisterFacade.java

@@ -5,32 +5,38 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.KlConceptSimDTO;
 import com.diagbot.dto.KlDrugRegisterDTO;
 import com.diagbot.entity.CommonParam;
+import com.diagbot.entity.KlConcept;
 import com.diagbot.entity.KlDrugMapping;
 import com.diagbot.entity.KlDrugRegister;
 import com.diagbot.enums.InsertOrUpdateEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.service.KlDrugMappingService;
 import com.diagbot.service.KlDrugRegisterService;
 import com.diagbot.service.impl.KlDrugRegisterServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
-import com.diagbot.util.ExcelUtils;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.KlDrugMappingGetVO;
 import com.diagbot.vo.KlDrugRegisterDelVO;
 import com.diagbot.vo.KlDrugRegisterGetVO;
-import com.diagbot.vo.KlDrugRegisterImportExVO;
 import com.diagbot.vo.KlDrugRegisterPageVO;
 import com.diagbot.vo.KlDrugRegisterSaveVO;
+import com.diagbot.vo.KlDrugRegisterTestVO;
 import com.diagbot.vo.KlDrugSearchVO;
+import com.google.common.collect.Lists;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.commons.lang3.StringUtils;
 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.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @author zhoutg
@@ -41,7 +47,8 @@ import java.util.List;
 public class KlDrugRegisterFacade extends KlDrugRegisterServiceImpl {
 
     @Autowired
-    KlDrugMappingFacade klDrugMappingFacade;
+    @Qualifier("klDrugMappingServiceImpl")
+    KlDrugMappingService klDrugMappingService;
     @Autowired
     KlConceptFacade klConceptFacade;
     @Autowired
@@ -85,7 +92,7 @@ public class KlDrugRegisterFacade extends KlDrugRegisterServiceImpl {
         this.saveOrUpdate(klDrugRegister);
 
         // 保存药品通用名和注册名映射关系
-        klDrugMappingFacade.remove(new QueryWrapper<KlDrugMapping>()
+        klDrugMappingService.remove(new QueryWrapper<KlDrugMapping>()
                 .eq("register_id", klDrugRegister.getId()));
 
         // 保存药品通用名和注册药品的关联
@@ -97,7 +104,7 @@ public class KlDrugRegisterFacade extends KlDrugRegisterServiceImpl {
             klDrugMapping.setModifier(param.getPerson());
             klDrugMapping.setGmtModified(param.getNow());
             klDrugMapping.setGmtCreate(param.getNow());
-            klDrugMappingFacade.save(klDrugMapping);
+            klDrugMappingService.save(klDrugMapping);
         }
     }
 
@@ -133,7 +140,7 @@ public class KlDrugRegisterFacade extends KlDrugRegisterServiceImpl {
      * @return
      */
     public void deleteByIdFac(KlDrugRegisterDelVO klDrugRegisterDelVO) {
-        List<KlDrugMapping> klDrugMappingList = klDrugMappingFacade.list(new QueryWrapper<KlDrugMapping>()
+        List<KlDrugMapping> klDrugMappingList = klDrugMappingService.list(new QueryWrapper<KlDrugMapping>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("register_id", klDrugRegisterDelVO.getId()));
         if (ListUtil.isNotEmpty(klDrugMappingList)) {
@@ -147,7 +154,7 @@ public class KlDrugRegisterFacade extends KlDrugRegisterServiceImpl {
             //         throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "已关联药品通用名:" + errMsg);
             //     }
             // }
-            klDrugMappingFacade.remove(new QueryWrapper<KlDrugMapping>().in("register_id", klDrugRegisterDelVO.getId()));
+            klDrugMappingService.remove(new QueryWrapper<KlDrugMapping>().in("register_id", klDrugRegisterDelVO.getId()));
         }
         this.remove(new QueryWrapper<KlDrugRegister>().eq("id", klDrugRegisterDelVO.getId()));
     }
@@ -193,11 +200,74 @@ public class KlDrugRegisterFacade extends KlDrugRegisterServiceImpl {
      * 注册药品导入
      *
      * @param file
+     * @return
      */
-    public void importRegister(MultipartFile file) {
-        List<KlDrugRegisterImportExVO> data = ExcelUtils.importExcel(file, 0, 1, KlDrugRegisterImportExVO.class);
-        List<KlDrugRegister> drugRegisterList = BeanUtil.listCopyTo(data, KlDrugRegister.class);
-        // TODO 校验通用名,删除原注册名称、映射关系
-        klDrugRegisterService.saveBatch(drugRegisterList);
+    public Map importRegister(MultipartFile file) {
+        Map res = new LinkedMap();
+        Long t1 = System.currentTimeMillis();
+        List<KlDrugRegisterTestVO> list = XLSXCovertCSVReader.readData(file, "注册药品",
+                30, KlDrugRegisterTestVO.class);
+        // List<KlDrugRegisterTestVO> list = ExcelBigUtil.readData(file, null, 0, KlDrugRegisterTestVO.class);
+        Long t2 = System.currentTimeMillis();
+        res.put("读取sheet耗时:", (t2 - t1) / 1000.0 + "秒");
+        try {
+            List<KlConcept> klConceptList = klConceptFacade.list(new QueryWrapper<KlConcept>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey()).eq("lib_type", 101));
+            Map<String, Long> druMap = klConceptList.stream().collect(Collectors.toMap(k -> k.getLibName(), v -> v.getId(), (r1, r2) -> (r2)));
+            List<String> errMsg = Lists.newArrayList();
+            List<KlDrugRegister> drugRegisterList = Lists.newLinkedList();
+            int i = 2;
+            for (KlDrugRegisterTestVO  klDrugRegisterTestVO : list) {
+                KlDrugRegister klDrugRegister = new KlDrugRegister();
+                BeanUtil.copyProperties(klDrugRegisterTestVO, klDrugRegister);
+                String drugName = klDrugRegisterTestVO.getDrugName();
+                klDrugRegister.setRemark(drugName);
+                drugRegisterList.add(klDrugRegister);
+                if (druMap.get(drugName) == null) {
+                    errMsg.add(drugName);
+                }
+                // if (StringUtil.isBlank(drugName)) {
+                //     errMsg.add(String.format("第%s行药品通用名为空", i));
+                // } else if (druMap.get(drugName) == null) {
+                //     errMsg.add(String.format("第%s行【%s】不是标准词", i, drugName));
+                // }
+                i++;
+            }
+            if (ListUtil.isNotEmpty(errMsg)) {
+                errMsg = errMsg.stream().distinct().collect(Collectors.toList());
+                for (String s : errMsg) {
+                    System.out.println(s);
+                }
+                res.put("错误", StringUtils.join(errMsg, ";"));
+                return res;
+            }
+            this.remove(new QueryWrapper<KlDrugRegister>()); // 删除主表
+            Long t3 = System.currentTimeMillis();
+            klDrugRegisterService.saveBatch(drugRegisterList);
+            Long t4 = System.currentTimeMillis();
+            res.put("保存DrugRegister表耗时:", (t4 - t3) / 1000.0 + "秒");
+
+            List<KlDrugMapping> klDrugMappingList = ListUtil.newArrayList();
+            for (KlDrugRegister klDrugRegister : drugRegisterList) {
+                KlDrugMapping klDrugMapping = new KlDrugMapping();
+                klDrugMapping.setRegisterId(klDrugRegister.getId());
+                klDrugMapping.setDrugConcept(druMap.get(klDrugRegister.getRemark()));
+                klDrugMappingList.add(klDrugMapping);
+            }
+            klDrugMappingService.remove(new QueryWrapper<KlDrugMapping>());
+            Long t5 = System.currentTimeMillis();
+            klDrugMappingService.saveBatch(klDrugMappingList);
+            Long t6 = System.currentTimeMillis();
+            res.put("保存mapping表耗时:", (t6 - t5) / 1000.0 + "秒");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Long end = System.currentTimeMillis();
+        res.put("总耗时:", (end - t1) / 1000.0 + "秒");
+        return res;
+    }
+
+    public static void main(String[] args) {
+
     }
 }

+ 646 - 0
cdssman-service/src/main/java/com/diagbot/facade/XLSXCovertCSVReader.java

@@ -0,0 +1,646 @@
+package com.diagbot.facade;
+
+import com.diagbot.entity.Ex;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.ReflectUtil;
+import com.diagbot.util.StringUtil;
+import com.google.common.collect.Lists;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
+import org.apache.poi.openxml4j.opc.OPCPackage;
+import org.apache.poi.openxml4j.opc.PackageAccess;
+import org.apache.poi.ss.usermodel.BuiltinFormats;
+import org.apache.poi.ss.usermodel.DataFormatter;
+import org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable;
+import org.apache.poi.xssf.eventusermodel.XSSFReader;
+import org.apache.poi.xssf.model.StylesTable;
+import org.apache.poi.xssf.usermodel.XSSFCellStyle;
+import org.apache.poi.xssf.usermodel.XSSFRichTextString;
+import org.springframework.web.multipart.MultipartFile;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @time: 2021/5/19 16:34
+ */
+public class XLSXCovertCSVReader {
+    /**
+     * The type of the data value is indicated by an attribute on the cell. The
+     * value is usually in a "v" element within the cell.
+     */
+    enum xssfDataType {
+        BOOL, ERROR, FORMULA, INLINESTR, SSTINDEX, NUMBER,
+    }
+
+    /**
+     * 使用xssf_sax_API处理Excel,请参考: http://poi.apache.org/spreadsheet/how-to.html#xssf_sax_api
+     * <p/>
+     * Also see Standard ECMA-376, 1st edition, part 4, pages 1928ff, at
+     * http://www.ecma-international.org/publications/standards/Ecma-376.htm
+     * <p/>
+     * A web-friendly version is http://openiso.org/Ecma/376/Part4
+     */
+    class MyXSSFSheetHandler extends DefaultHandler {
+
+        /**
+         * Table with styles
+         */
+        private StylesTable stylesTable;
+
+        /**
+         * Table with unique strings
+         */
+        private ReadOnlySharedStringsTable sharedStringsTable;
+
+        /**
+         * Destination for data
+         */
+        private final PrintStream output;
+
+        /**
+         * Number of columns to read starting with leftmost
+         */
+        private final int minColumnCount;
+
+        // Set when V start element is seen
+        private boolean vIsOpen;
+
+        // Set when cell start element is seen;
+        // used when cell close element is seen.
+        private xssfDataType nextDataType;
+
+        // Used to format numeric cell values.
+        private short formatIndex;
+        private String formatString;
+        private final DataFormatter formatter;
+
+        private int thisColumn = -1;
+        // The last column printed to the output stream
+        private int lastColumnNumber = -1;
+
+        // Gathers characters as they are seen.
+        private StringBuffer value;
+        private String[] record;
+        private List<String[]> rows = new ArrayList<String[]>();
+        private boolean isCellNull = false;
+
+        /**
+         * Accepts objects needed while parsing.
+         *
+         * @param styles
+         *            Table of styles
+         * @param strings
+         *            Table of shared strings
+         * @param cols
+         *            Minimum number of columns to show
+         * @param target
+         *            Sink for output
+         */
+        public MyXSSFSheetHandler(StylesTable styles,
+                                  ReadOnlySharedStringsTable strings, int cols, PrintStream target) {
+            this.stylesTable = styles;
+            this.sharedStringsTable = strings;
+            this.minColumnCount = cols;
+            this.output = target;
+            this.value = new StringBuffer();
+            this.nextDataType = xssfDataType.NUMBER;
+            this.formatter = new DataFormatter();
+            record = new String[this.minColumnCount];
+            rows.clear();// 每次读取都清空行集合
+        }
+
+        /*
+         * (non-Javadoc)
+         *
+         * @see
+         * org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String,
+         * java.lang.String, java.lang.String, org.xml.sax.Attributes)
+         */
+        public void startElement(String uri, String localName, String name,
+                                 Attributes attributes) throws SAXException {
+
+            if ("inlineStr".equals(name) || "v".equals(name)) {
+                vIsOpen = true;
+                // Clear contents cache
+                value.setLength(0);
+            }
+            // c => cell
+            else if ("c".equals(name)) {
+                // Get the cell reference
+                String r = attributes.getValue("r");
+                int firstDigit = -1;
+                for (int c = 0; c < r.length(); ++c) {
+                    if (Character.isDigit(r.charAt(c))) {
+                        firstDigit = c;
+                        break;
+                    }
+                }
+                thisColumn = nameToColumn(r.substring(0, firstDigit));
+
+                // Set up defaults.
+                this.nextDataType = xssfDataType.NUMBER;
+                this.formatIndex = -1;
+                this.formatString = null;
+                String cellType = attributes.getValue("t");
+                String cellStyleStr = attributes.getValue("s");
+                if ("b".equals(cellType))
+                    nextDataType = xssfDataType.BOOL;
+                else if ("e".equals(cellType))
+                    nextDataType = xssfDataType.ERROR;
+                else if ("inlineStr".equals(cellType))
+                    nextDataType = xssfDataType.INLINESTR;
+                else if ("s".equals(cellType))
+                    nextDataType = xssfDataType.SSTINDEX;
+                else if ("str".equals(cellType))
+                    nextDataType = xssfDataType.FORMULA;
+                else if (cellStyleStr != null) {
+                    // It's a number, but almost certainly one
+                    // with a special style or format
+                    int styleIndex = Integer.parseInt(cellStyleStr);
+                    XSSFCellStyle style = stylesTable.getStyleAt(styleIndex);
+                    this.formatIndex = style.getDataFormat();
+                    this.formatString = style.getDataFormatString();
+                    if (this.formatString == null)
+                        this.formatString = BuiltinFormats
+                                .getBuiltinFormat(this.formatIndex);
+                }
+            }
+
+        }
+
+        /*
+         * (non-Javadoc)
+         *
+         * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String,
+         * java.lang.String, java.lang.String)
+         */
+        public void endElement(String uri, String localName, String name)
+                throws SAXException {
+
+            String thisStr = null;
+
+            // v => contents of a cell
+            if ("v".equals(name)) {
+                // Process the value contents as required.
+                // Do now, as characters() may be called more than once
+                switch (nextDataType) {
+
+                    case BOOL:
+                        char first = value.charAt(0);
+                        thisStr = first == '0' ? "FALSE" : "TRUE";
+                        break;
+
+                    case ERROR:
+                        thisStr = "\"ERROR:" + value.toString() + '"';
+                        break;
+
+                    case FORMULA:
+                        // A formula could result in a string value,
+                        // so always add double-quote characters.
+                        thisStr = '"' + value.toString() + '"';
+                        break;
+
+                    case INLINESTR:
+                        // TODO: have seen an example of this, so it's untested.
+                        XSSFRichTextString rtsi = new XSSFRichTextString(
+                                value.toString());
+                        thisStr = '"' + rtsi.toString() + '"';
+                        break;
+
+                    case SSTINDEX:
+                        String sstIndex = value.toString();
+                        try {
+                            int idx = Integer.parseInt(sstIndex);
+                            XSSFRichTextString rtss = new XSSFRichTextString(
+                                    sharedStringsTable.getEntryAt(idx));
+                            thisStr = '"' + rtss.toString() + '"';
+                        } catch (NumberFormatException ex) {
+                            output.println("Failed to parse SST index '" + sstIndex
+                                    + "': " + ex.toString());
+                        }
+                        break;
+
+                    case NUMBER:
+                        String n = value.toString();
+                        // 判断是否是日期格式
+                        if (HSSFDateUtil.isADateFormat(this.formatIndex, n)) {
+                            Double d = Double.parseDouble(n);
+                            Date date=HSSFDateUtil.getJavaDate(d);
+                            thisStr=formateDateToString(date);
+                        } else if (this.formatString != null)
+                            thisStr = formatter.formatRawCellContents(
+                                    Double.parseDouble(n), this.formatIndex,
+                                    this.formatString);
+                        else
+                            thisStr = n;
+                        break;
+
+                    default:
+                        thisStr = "(TODO: Unexpected type: " + nextDataType + ")";
+                        break;
+                }
+
+                // Output after we've seen the string contents
+                // Emit commas for any fields that were missing on this row
+                if (lastColumnNumber == -1) {
+                    lastColumnNumber = 0;
+                }
+                //判断单元格的值是否为空
+                if (thisStr == null || "".equals(isCellNull)) {
+                    isCellNull = true;// 设置单元格是否为空值
+                }
+                record[thisColumn] = thisStr;
+                // Update column
+                if (thisColumn > -1)
+                    lastColumnNumber = thisColumn;
+
+            } else if ("row".equals(name)) {
+
+                // Print out any missing commas if needed
+                if (minColumns > 0) {
+                    // Columns are 0 based
+                    if (lastColumnNumber == -1) {
+                        lastColumnNumber = 0;
+                    }
+                    if (isCellNull == false && record[0] != null
+                            && record[1] != null)// 判断是否空行
+                    {
+                        rows.add(record.clone());
+                        isCellNull = false;
+                        for (int i = 0; i < record.length; i++) {
+                            record[i] = null;
+                        }
+                    }
+                }
+                lastColumnNumber = -1;
+            }
+
+        }
+
+        public List<String[]> getRows() {
+            return rows;
+        }
+
+        public void setRows(List<String[]> rows) {
+            this.rows = rows;
+        }
+
+        /**
+         * Captures characters only if a suitable element is open. Originally
+         * was just "v"; extended for inlineStr also.
+         */
+        public void characters(char[] ch, int start, int length)
+                throws SAXException {
+            if (vIsOpen)
+                value.append(ch, start, length);
+        }
+
+        /**
+         * Converts an Excel column name like "C" to a zero-based index.
+         *
+         * @param name
+         * @return Index corresponding to the specified name
+         */
+        private int nameToColumn(String name) {
+            int column = -1;
+            for (int i = 0; i < name.length(); ++i) {
+                int c = name.charAt(i);
+                column = (column + 1) * 26 + c - 'A';
+            }
+            return column;
+        }
+
+        private String formateDateToString(Date date) {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//格式化日期
+            return sdf.format(date);
+
+        }
+
+    }
+
+    // /
+
+    private OPCPackage xlsxPackage;
+    private int minColumns;
+    private PrintStream output;
+    private String sheetName;
+
+    /**
+     * Creates a new XLSX -> CSV converter
+     *
+     * @param pkg
+     *            The XLSX package to process
+     * @param output
+     *            The PrintStream to output the CSV to
+     * @param minColumns
+     *            The minimum number of columns to output, or -1 for no minimum
+     */
+    public XLSXCovertCSVReader(OPCPackage pkg, PrintStream output,
+                               String sheetName, int minColumns) {
+        this.xlsxPackage = pkg;
+        this.output = output;
+        this.minColumns = minColumns;
+        this.sheetName = sheetName;
+    }
+
+    /**
+     * Parses and shows the content of one sheet using the specified styles and
+     * shared-strings tables.
+     *
+     * @param styles
+     * @param strings
+     * @param sheetInputStream
+     */
+    public List<String[]> processSheet(StylesTable styles,
+                                       ReadOnlySharedStringsTable strings, InputStream sheetInputStream)
+            throws IOException, ParserConfigurationException, SAXException {
+
+        InputSource sheetSource = new InputSource(sheetInputStream);
+        SAXParserFactory saxFactory = SAXParserFactory.newInstance();
+        SAXParser saxParser = saxFactory.newSAXParser();
+        XMLReader sheetParser = saxParser.getXMLReader();
+        MyXSSFSheetHandler handler = new MyXSSFSheetHandler(styles, strings,
+                this.minColumns, this.output);
+        sheetParser.setContentHandler(handler);
+        sheetParser.parse(sheetSource);
+        return handler.getRows();
+    }
+
+    /**
+     * 初始化这个处理程序 将
+     *
+     * @throws IOException
+     * @throws OpenXML4JException
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     */
+    public List<String[]> process() throws IOException, OpenXML4JException,
+            ParserConfigurationException, SAXException {
+
+        ReadOnlySharedStringsTable strings = new ReadOnlySharedStringsTable(
+                this.xlsxPackage);
+        XSSFReader xssfReader = new XSSFReader(this.xlsxPackage);
+        List<String[]> list = null;
+        StylesTable styles = xssfReader.getStylesTable();
+        XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator) xssfReader
+                .getSheetsData();
+        int index = 0;
+        while (iter.hasNext()) {
+            InputStream stream = iter.next();
+            String sheetNameTemp = iter.getSheetName();
+            if (this.sheetName.equals(sheetNameTemp)) {
+                list = processSheet(styles, strings, stream);
+                stream.close();
+                ++index;
+            }
+        }
+        if (ListUtil.isNotEmpty(list)) {
+            for (String[] arr : list) {
+                for (int i = 0; i < arr.length; i++) {
+                    arr[i] = getObject(arr[i]);
+                }
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 读取Excel
+     *
+     * @param path
+     *            文件路径
+     * @param sheetName
+     *            sheet名称
+     * @param minColumns
+     *            列总数
+     * @return
+     * @throws SAXException
+     * @throws ParserConfigurationException
+     * @throws OpenXML4JException
+     * @throws IOException
+     */
+    private static List<String[]> readerExcel(String path, String sheetName,
+                                              int minColumns) throws IOException, OpenXML4JException,
+            ParserConfigurationException, SAXException {
+        OPCPackage p = OPCPackage.open(path, PackageAccess.READ);
+        XLSXCovertCSVReader xlsx2csv = new XLSXCovertCSVReader(p, System.out,
+                sheetName, minColumns);
+        List<String[]> list = xlsx2csv.process();
+        p.close();
+        return list;
+    }
+
+    /**
+     * 读取Excel
+     *
+     * @param inputStream
+     * @param sheetName
+     * @param minColumns
+     * @return
+     * @throws IOException
+     * @throws OpenXML4JException
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     */
+    private static List<String[]> readerExcel(InputStream inputStream, String sheetName,
+                                             int minColumns) throws IOException, OpenXML4JException,
+            ParserConfigurationException, SAXException {
+        OPCPackage p = OPCPackage.open(inputStream);
+        XLSXCovertCSVReader xlsx2csv = new XLSXCovertCSVReader(p, System.out,
+                sheetName, minColumns);
+        List<String[]> list = xlsx2csv.process();
+        p.close();
+        return list;
+    }
+
+    /**
+     * 去除前后的""
+     *
+     * @param s
+     * @return
+     */
+    public static String getObject(String s) {
+        if (StringUtil.isBlank(s)) {
+            return s;
+        }
+        if (s.startsWith("\"") && s.endsWith("\"")) {
+            s = s.substring(1, s.length() -1);
+        }
+        return s;
+    }
+
+    /**
+     * 读取数据
+     *
+     * @param path
+     * @param sheetName
+     * @param colNum
+     * @param c
+     * @return
+     */
+    public static <T> List<T> readData(String path, String sheetName, int colNum, Class<T> c) {
+        List<T> list = Lists.newArrayList();
+        try {
+            List<String[]> stringList = XLSXCovertCSVReader.readerExcel(path, sheetName, colNum);
+            return dealData(stringList, c);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    /**
+     * 读取数据
+     *
+     * @param file
+     * @param sheetName
+     * @param colNum
+     * @param c
+     * @return
+     */
+    public static <T> List<T> readData(MultipartFile file, String sheetName, int colNum, Class<T> c) {
+        List<T> list = Lists.newArrayList();
+        try {
+            List<String[]> stringList = XLSXCovertCSVReader.readerExcel(file.getInputStream(), sheetName, colNum);
+            return dealData(stringList, c);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    /**
+     * 数据处理
+     *
+     * @param list
+     * @param c
+     * @param <T>
+     * @return
+     */
+    public static <T> List<T> dealData(List<String[]> list, Class<T> c) {
+        List<T> res = Lists.newArrayList();
+        try {
+            // 标题
+            String[] titleRow = list.get(0);
+            Map<Integer, String> colMap = new LinkedMap();
+            for (int i = 0; i < titleRow.length; i++) {
+                if (StringUtil.isBlank(titleRow[i])) {
+                    break;
+                }
+                colMap.put(i, titleRow[i]);
+            }
+            // System.out.println(colMap);
+
+            // 字段映射
+            Field[] fields = c.getDeclaredFields();
+            // 属性和表格列对应
+            Map<String, Map<String, String>> classMap = new LinkedHashMap();
+            for (Field field : fields) {
+                if (field.isAnnotationPresent(Ex.class)) {
+                    Ex annotation = field.getAnnotation(Ex.class);
+                    Map<String, String> propertyMap = new LinkedHashMap<>();
+                    propertyMap.put("field", field.getName());
+                    propertyMap.put("convertType", field.getGenericType().toString());
+                    classMap.put(annotation.name(), propertyMap);
+                }
+                field.getClass();
+            }
+            // System.out.println(classMap);
+
+            // 有效数据读取
+            int rowNum = 1;
+            for (String[] row : list) {
+                if (rowNum++ == 1) {
+                    continue;
+                }
+                T obj = c.newInstance();
+                for (int i = 0; i < row.length; i++) {
+                    if (classMap.get(colMap.get(i)) == null) {
+                        continue;
+                    }
+                    String property = classMap.get(colMap.get(i)).get("field");
+                    String convertType = classMap.get(colMap.get(i)).get("convertType");
+                    // System.out.println(property + ":" + row[i]);
+                    if (StringUtil.isNotBlank(property)) {
+                        Object value = convertValue(row[i], convertType);
+                        if (value != null) {
+                            ReflectUtil.setFieldValue(obj, property, value);
+                        }
+                    }
+                }
+                res.add(obj);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return res;
+    }
+
+    /**
+     * 根据反射转成不同的类型
+     *
+     * @param object
+     * @param convertType
+     * @return
+     */
+    public static Object convertValue(String object, String convertType) {
+        Object res = null;
+        if (object == null) {
+            return null;
+        }
+        try {
+            switch (convertType) {
+                case "class java.lang.Integer":
+                case "int":
+                    res = Integer.parseInt(object);
+                    break;
+                case "class java.lang.Long":
+                case "long":
+                    res = Long.parseLong(object);
+                    break;
+                case "class java.lang.Float":
+                case "float":
+                    res = Float.parseFloat(object);
+                    break;
+                case "class java.lang.Double":
+                case "double":
+                    res = Double.parseDouble(object);
+                    break;
+                case "class java.lang.Boolean":
+                case "boolean":
+                    res = Boolean.parseBoolean(object);
+                    break;
+                case "class java.lang.String":
+                    res = object;
+                    break;
+                default:
+                    res = object;
+                    break;
+            }
+        } catch (Exception e) {
+            // e.printStackTrace();
+            return null;
+        }
+        return res;
+    }
+}

+ 293 - 0
cdssman-service/src/main/java/com/diagbot/util/ExcelBigUtil.java

@@ -0,0 +1,293 @@
+package com.diagbot.util;
+
+import com.diagbot.entity.Ex;
+import com.diagbot.vo.KlDrugRegisterTestVO;
+import com.google.common.collect.Lists;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellType;
+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.web.multipart.MultipartFile;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @time: 2021/5/24 19:58
+ */
+public class ExcelBigUtil {
+
+    /**
+     * 读取数据
+     *
+     * @param file
+     * @param sheetName
+     * @param titleNo 标题所在行
+     * @param c
+     * @param <T>
+     * @return
+     */
+    public static <T> List<T> readData(MultipartFile file, String sheetName, int titleNo, Class<T> c) {
+        List<T> list = Lists.newArrayList();
+        try {
+            Sheet sheet = getSheet(file, sheetName);
+            List<String[]> stringList = getListData(sheet, titleNo);
+            return dealData(stringList, c);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    /**
+     * 读取数据
+     *
+     * @param path
+     * @param sheetName
+     * @param titleNo
+     * @param c
+     * @param <T>
+     * @return
+     */
+    public static <T> List<T> readData(String path, String sheetName, int titleNo, Class<T> c) {
+        List<T> list = Lists.newArrayList();
+        try {
+            Sheet sheet = getSheet(path, sheetName);
+            List<String[]> stringList = getListData(sheet, titleNo);
+            return dealData(stringList, c);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    /**
+     * 获取Sheet
+     *
+     * @param filePath
+     * @param sheetName
+     * @return
+     */
+    private static Sheet getSheet(String filePath, String sheetName) {
+        Sheet sheet = null;
+        FileInputStream fileInputStream = null;
+        try {
+            fileInputStream = new FileInputStream(filePath);
+            XSSFWorkbook sheets = new XSSFWorkbook(fileInputStream);
+            if (StringUtil.isBlank(sheetName)) {
+                sheet = sheets.getSheetAt(0);
+            } else {
+                sheet = sheets.getSheet(sheetName);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return sheet;
+    }
+
+    /**
+     * 获取Sheet
+     *
+     * @param file
+     * @param sheetName
+     * @return
+     */
+    private static Sheet getSheet(MultipartFile file, String sheetName) {
+        Sheet sheet = null;
+        try {
+            // XSSFWorkbook sheets = new XSSFWorkbook(file.getInputStream());
+            Workbook workbook = getWorkBook(file);
+            //获取sheet
+            if (StringUtil.isBlank(sheetName)) {
+                sheet = workbook.getSheetAt(0);
+            } else {
+                sheet = workbook.getSheet(sheetName);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return sheet;
+    }
+
+    /**
+     * 得到Workbook对象
+     * @param file
+     * @return
+     * @throws IOException
+     */
+    public static Workbook getWorkBook(MultipartFile file) throws IOException {
+        //这样写  excel 能兼容03和07
+        InputStream is = file.getInputStream();
+        Workbook hssfWorkbook = null;
+        try {
+            hssfWorkbook = new HSSFWorkbook(is);
+        } catch (Exception ex) {
+            is =file.getInputStream();
+            hssfWorkbook = new XSSFWorkbook(is);
+        }
+        return hssfWorkbook;
+    }
+
+    /**
+     * 将sheet数据放入List
+     *
+     * @param sheet
+     * @param title
+     * @return
+     */
+    private static List<String[]> getListData(Sheet sheet, Integer title) {
+        List<String[]> list = new ArrayList<>();
+        int colLength = sheet.getRow(title).getLastCellNum();
+        for (int j = title; j <= sheet.getLastRowNum(); j++) {
+            Row row = sheet.getRow(j);
+            if (row != null) { // 空行数据
+                String[] str = new String[colLength];
+                for (int i = 0; i < colLength; i++) {
+                    Cell cell = row.getCell(i);
+                    if (cell == null) {
+                        str[i] = null;
+                    } else {
+                        cell.setCellType(CellType.STRING);
+                        str[i] = cell.toString();
+                    }
+                }
+                list.add(str);
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 数据处理
+     *
+     * @param list
+     * @param c
+     * @param <T>
+     * @return
+     */
+    public static <T> List<T> dealData(List<String[]> list, Class<T> c) {
+        List<T> res = Lists.newArrayList();
+        try {
+            // 标题
+            String[] titleRow = list.get(0);
+            Map<Integer, String> colMap = new LinkedMap();
+            for (int i = 0; i < titleRow.length; i++) {
+                if (StringUtil.isBlank(titleRow[i])) {
+                    break;
+                }
+                colMap.put(i, titleRow[i]);
+            }
+            // System.out.println(colMap);
+
+            // 字段映射
+            Field[] fields = c.getDeclaredFields();
+            // 属性和表格列对应
+            Map<String, Map<String, String>> classMap = new LinkedHashMap();
+            for (Field field : fields) {
+                if (field.isAnnotationPresent(Ex.class)) {
+                    Ex annotation = field.getAnnotation(Ex.class);
+                    Map<String, String> propertyMap = new LinkedHashMap<>();
+                    propertyMap.put("field", field.getName());
+                    propertyMap.put("convertType", field.getGenericType().toString());
+                    classMap.put(annotation.name(), propertyMap);
+                }
+                field.getClass();
+            }
+            // System.out.println(classMap);
+
+            // 有效数据读取
+            int rowNum = 1;
+            for (String[] row : list) {
+                if (rowNum++ == 1) {
+                    continue;
+                }
+                T obj = c.newInstance();
+                for (int i = 0; i < row.length; i++) {
+                    if (classMap.get(colMap.get(i)) == null) {
+                        continue;
+                    }
+                    String property = classMap.get(colMap.get(i)).get("field");
+                    String convertType = classMap.get(colMap.get(i)).get("convertType");
+                    // System.out.println(property + ":" + row[i]);
+                    if (StringUtil.isNotBlank(property)) {
+                        Object value = convertValue(row[i], convertType);
+                        if (value != null) {
+                            ReflectUtil.setFieldValue(obj, property, value);
+                        }
+                    }
+                }
+                res.add(obj);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return res;
+    }
+
+    /**
+     * 根据反射转成不同的类型
+     *
+     * @param object
+     * @param convertType
+     * @return
+     */
+    public static Object convertValue(String object, String convertType) {
+        Object res = null;
+        if (object == null) {
+            return null;
+        }
+        try {
+            switch (convertType) {
+                case "class java.lang.Integer":
+                case "int":
+                    res = Integer.parseInt(object);
+                    break;
+                case "class java.lang.Long":
+                case "long":
+                    res = Long.parseLong(object);
+                    break;
+                case "class java.lang.Float":
+                case "float":
+                    res = Float.parseFloat(object);
+                    break;
+                case "class java.lang.Double":
+                case "double":
+                    res = Double.parseDouble(object);
+                    break;
+                case "class java.lang.Boolean":
+                case "boolean":
+                    res = Boolean.parseBoolean(object);
+                    break;
+                case "class java.lang.String":
+                    res = object;
+                    break;
+                default:
+                    res = object;
+                    break;
+            }
+        } catch (Exception e) {
+            // e.printStackTrace();
+            return null;
+        }
+        return res;
+    }
+
+    public static void main(String[] args) {
+        String path = "D:\\newSVN\\2020新版CDSS\\05.其他资料\\数据\\其他数据\\【注册药品导入模板】 - 副本.xlsx";
+        List<KlDrugRegisterTestVO> klDrugRegisterTestVOList = readData(path, null, 0, KlDrugRegisterTestVO.class);
+        System.out.println(klDrugRegisterTestVOList);
+    }
+}
+

+ 127 - 0
cdssman-service/src/main/java/com/diagbot/util/ReflectUtil.java

@@ -0,0 +1,127 @@
+package com.diagbot.util;
+
+import com.google.common.collect.Lists;
+
+import java.lang.reflect.Field;
+import java.util.List;
+
+/**
+ * @description: 反射工具类
+ * @author: zhoutg
+ * @date: 2021/4/27 13:29
+ */
+public class ReflectUtil {
+
+    /**
+     * 获取属性对应的值,以list形式返回
+     *
+     * @param list
+     * @param propertyName
+     * @param <T>
+     * @param <V>
+     * @return
+     */
+    public static <T, V> List<V> getPropertyList(List<T> list, String propertyName) {
+        List<V> res = Lists.newArrayList();
+        if (ListUtil.isEmpty(list)) {
+            return res;
+        }
+        for (T t : list) {
+            try {
+                V val = getProperty(t, propertyName);
+                if (val != null) {
+                    // 字符串类型不为空判断
+                    if (StringUtil.isNotBlank(String.valueOf(val))) {
+                        res.add(val);
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return res;
+    }
+
+    /**
+     * 获取属性对应的值,以list形式返回——重载
+     *
+     * @param list
+     * @param <T>
+     * @return
+     */
+    public static <T> List<String> getPropertyList(List<T> list) {
+        return getPropertyList(list, "name");
+    }
+
+    /**
+     * 循环向上转型, 获取对象的 DeclaredField
+     *
+     * @param object    : 子类对象
+     * @param fieldName : 父类中的属性名
+     * @return 父类中的属性对象
+     */
+    public static Field getDeclaredField(Object object, String fieldName) {
+        Field field = null;
+        Class<?> clazz = object.getClass();
+        for (; clazz != Object.class; clazz = clazz.getSuperclass()) {
+            try {
+                field = clazz.getDeclaredField(fieldName);
+                return field;
+            } catch (Exception e) {
+                //这里甚么都不要做!并且这里的异常必须这样写,不能抛出去。
+                //如果这里的异常打印或者往外抛,则就不会执行clazz = clazz.getSuperclass(),最后就不会进入到父类中了
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 获取对象的属性值,直接使用getDeclaredFields()方法只能获取当前类声明的字段,需要递归向上获取
+     *
+     * @param object    : 子类对象
+     * @param fieldName : 父类中的属性名
+     * @return : 父类中的属性值
+     */
+    public static <T> T getProperty(Object object, String fieldName) {
+        try {
+            //根据 对象和属性名通过反射获取Field对象
+            Field field = getDeclaredField(object, fieldName);
+            // 容错处理
+            if (field == null) {
+                return null;
+            }
+            //抑制Java对其的检查
+            field.setAccessible(true);
+            //获取 object 中 field 所代表的属性值
+            return (T) field.get(object);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 对象赋值
+     *
+     * @param object
+     * @param property
+     * @param value
+     */
+    public static void setFieldValue(Object object, String property, Object value){
+        //根据 对象和属性名通过反射 调用上面的方法获取 Field对象
+        Field field = getDeclaredField(object, property) ;
+        //抑制Java对其的检查
+        field.setAccessible(true) ;
+        try {
+            field.set(object, value);
+        } catch (IllegalArgumentException e) {
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void main(String[] args) {
+
+    }
+}

+ 18 - 0
cdssman-service/src/main/java/com/diagbot/vo/ImportVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Data;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2020/8/24 17:23
+ */
+@Data
+public class ImportVO {
+
+    // sheet名称
+    private String sheetName;
+    // 列数量
+    private Integer colNum  = 0;
+
+}

+ 10 - 0
cdssman-service/src/main/java/com/diagbot/vo/KlDiseaseVO.java

@@ -125,6 +125,16 @@ public class KlDiseaseVO implements Serializable {
      */
     private String enName;
 
+    /**
+     * 肿瘤细胞类型
+     */
+    private String tumorCellType;
+
+    /**
+     * 形态学分类代码
+     */
+    private String morphology;
+
     /**
      * 备注
      */

+ 5 - 0
cdssman-service/src/main/java/com/diagbot/vo/KlDrugRegisterPageVO.java

@@ -91,4 +91,9 @@ public class KlDrugRegisterPageVO extends Page {
      */
     private String commonName;
 
+    /**
+     * 药品类别
+     */
+    private String drugType;
+
 }

+ 71 - 0
cdssman-service/src/main/java/com/diagbot/vo/KlDrugRegisterTestVO.java

@@ -0,0 +1,71 @@
+package com.diagbot.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.diagbot.entity.Ex;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 药品注册表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+@Data
+public class KlDrugRegisterTestVO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Ex(name="药品代码")
+    @Excel(name="药品代码")
+    private String drugCode;
+
+    @Ex(name="注册名称")
+    private String name;
+
+    @Ex(name="英文名称")
+    private String enName;
+
+    @Ex(name="商品名称")
+    private String tradeName;
+
+    @Ex(name="注册剂型")
+    private String form;
+
+    @Ex(name="注册规格")
+    private String specification;
+
+    @Ex(name="最小包装数量")
+    @Excel(name="最小包装数量")
+    private String minPackQuantity;
+
+    @Ex(name="最小包装单位")
+    private String minPackUnit;
+
+    @Ex(name="药品企业")
+    private String company;
+
+    @Ex(name="批准文号")
+    private String approval;
+
+    @Ex(name="药品本位码")
+    private String standardCode;
+
+    @Ex(name="甲乙类")
+    @Excel(name="甲乙类")
+    private String insuranceType;
+
+    @Ex(name="医保备注")
+    @Excel(name="医保备注")
+    private String insuranceRemrk;
+
+    @Ex(name="药品类别")
+    private String drugType;
+
+    @Ex(name="药品通用名")
+    private String drugName;
+
+}

+ 9 - 4
cdssman-service/src/main/java/com/diagbot/web/KlConceptController.java

@@ -53,6 +53,7 @@ public class KlConceptController {
     public RespDTO<KlConceptAllDTO> getConceptInfoAll(@RequestBody @Valid KlConceptAllVO klConceptAllVO) {
         return RespDTO.onSuc(klConceptFacade.getConceptAlls(klConceptAllVO));
     }
+
     @ApiOperation(value = "新增和修改基础术语详情[by:wangfeng]",
             notes = "conceptId:术语Id\n" +
                     "libId:libId\n" +
@@ -89,6 +90,8 @@ public class KlConceptController {
                     "enNameSimple:英文简称\n" +
                     "enName:英文名称\n" +
                     "remark:备注\n" +
+                    "tumorCellType:肿瘤细胞类型\n" +
+                    "morphology:形态学分类代码\n" +
                     "deptList:科室列表\n" +
                     "partList:部位列表\n" +
                     "systemTypeList:疾病系统分类列表\n" +
@@ -99,6 +102,7 @@ public class KlConceptController {
 
                     "<br>" +
                     "【klSymptomVO:症状扩展信息】\n" +
+                    "isPositive:阳性症状(0:否,1:是)\n" +
                     "enName:英文名称\n" +
                     "definition:定义\n" +
                     "chWestern:中西医症状(0:通用,1:西,2:中)\n" +
@@ -111,16 +115,16 @@ public class KlConceptController {
                     "commonExplain:通俗解释\n" +
                     "remark:备注\n" +
                     "deptList:科室列表\n" +
-                    "partList:发病部位\n" +
-                    "conSymptomList:常见伴随症状\n" +
-                    "natureList:性质\n" +
+                    "partList:发病部位列表\n" +
+                    "conSymptomList:常见伴随症状列表\n" +
+                    "natureList:性质列表\n" +
 
                     "<br>" +
                     "【klLisVO:化验扩展信息】\n" +
                     "conceptId:术语概念id\n" +
                     "minValue:最小值\n" +
                     "maxValue:最大值\n" +
-                    "type:最大值\n" +
+                    "type:类型(0:范围内;1:范围外)\n" +
                     "unit:单位概念id\n" +
                     "checkSpecimen:检查标本\n" +
                     "checkMethod:检查方法\n" +
@@ -166,6 +170,7 @@ public class KlConceptController {
     public RespDTO<Boolean> saveConceptInfos(@RequestBody @Valid KlConceptSaveVO klConceptSaveVO) {
         return RespDTO.onSuc(klConceptFacade.saveConceptInfo(klConceptSaveVO));
     }
+
     @ApiOperation(value = "删除同义词[by:wangfeng]")
     @PostMapping("/clearConceptInfo")
     @SysLogger("clearConceptInfo")

+ 5 - 3
cdssman-service/src/main/java/com/diagbot/web/KlDrugRegisterController.java

@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -110,8 +111,9 @@ public class KlDrugRegisterController {
     @ApiOperation(value = "注册药品导入[by:zhoutg]",
             notes = "")
     @PostMapping("/importRegister")
-    public RespDTO<Boolean> importRegister(@RequestParam("file") MultipartFile file) {
-        klDrugRegisterFacade.importRegister(file);
-        return RespDTO.onSuc(true);
+    @DSTransactional
+    public RespDTO<Map> importRegister(@RequestParam("file") MultipartFile file) {
+        Map data = klDrugRegisterFacade.importRegister(file);
+        return RespDTO.onSuc(data);
     }
 }

+ 2 - 0
cdssman-service/src/main/resources/mapper/KlDiseaseMapper.xml

@@ -33,6 +33,8 @@
         <result column="name_simple" property="nameSimple" />
         <result column="en_name_simple" property="enNameSimple" />
         <result column="en_name" property="enName" />
+        <result column="morphology" property="morphology" />
+        <result column="tumor_cell_type" property="tumorCellType" />
         <result column="remark" property="remark" />
     </resultMap>
 

+ 2 - 4
docs/041.20210511知识库扩展/knowledgeExt_init.sql

@@ -4,16 +4,14 @@ INSERT INTO `cdss`.`sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt
 
 use `med_2021`;
 
-INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('45', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '疾病系统分类', '411', '0', '0', '0', '');
-INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('46', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '性质', '412', '0', '0', '0', '');
-
 INSERT INTO `kl_lexicon_relationship` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `remark`) VALUES ('12', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '关联科室', '511', '');
 INSERT INTO `kl_lexicon_relationship` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `remark`) VALUES ('13', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '关联部位', '512', '');
 INSERT INTO `kl_lexicon_relationship` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `remark`) VALUES ('14', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '关联系统分类', '513', '');
 INSERT INTO `kl_lexicon_relationship` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `remark`) VALUES ('15', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '关联伴随症状', '514', '');
 INSERT INTO `kl_lexicon_relationship` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `remark`) VALUES ('16', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '关联性质', '515', '');
 
-
+ALTER TABLE `kl_disease` add COLUMN `tumor_cell_type` varchar(255) not null DEFAULT '' COMMENT '肿瘤细胞类型' AFTER `icd10_code`;
+ALTER TABLE `kl_disease` add COLUMN `morphology` varchar(255) not null DEFAULT '' COMMENT '形态学分类代码' AFTER `icd10_code`;
 ALTER TABLE `kl_disease` add COLUMN `en_name` varchar(255) not null DEFAULT '' COMMENT '英文名称' AFTER `icd10_code`;
 ALTER TABLE `kl_disease` add COLUMN `en_name_simple` varchar(255) not null DEFAULT '' COMMENT '英文简称' AFTER `icd10_code`;
 ALTER TABLE `kl_disease` add COLUMN `name_simple` varchar(255) not null DEFAULT '' COMMENT '简称' AFTER `icd10_code`;