zhoutg 3 rokov pred
rodič
commit
3f34f82dad

+ 134 - 89
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;
@@ -11,9 +12,10 @@ import java.util.Date;
  * 疾病表
  * </p>
  *
- * @author gaodm
- * @since 2021-01-21
+ * @author zhoutg
+ * @since 2022-03-03
  */
+@Data
 public class KlDisease implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -54,100 +56,143 @@ public class KlDisease implements Serializable {
      */
     private Long conceptId;
 
+    /**
+     * 科室概念id
+     */
+    private Long deptId;
+
     /**
      * ICD10编号
      */
     private String icd10Code;
 
+    /**
+     * 国临名称
+     */
+    private String guoname;
+
+    /**
+     * 国临编码
+     */
+    private String guocode;
+
+    /**
+     * 国临拼音
+     */
+    private String guospell;
+
+    /**
+     * 病程
+     */
+    private String course;
+
+    /**
+     * 诱因
+     */
+    private String inducement;
+
+    /**
+     * 饮食禁忌
+     */
+    private String foodProhibition;
+
+    /**
+     * 危险因素
+     */
+    private String hazard;
+
+    /**
+     * 治愈性
+     */
+    private String healing;
+
+    /**
+     * 危害性
+     */
+    private String pernicious;
+
+    /**
+     * 临床分类
+     */
+    private String clinicType;
+
+    /**
+     * 好发地区
+     */
+    private String vulArea;
+
+    /**
+     * 好发人群
+     */
+    private String vulCrowd;
+
+    /**
+     * 发病率
+     */
+    private Double incidence;
+
+    /**
+     * 是否传染(0:否,1:是)
+     */
+    private Integer isInfect;
+
+    /**
+     * 并发症
+     */
+    private String complication;
+
+    /**
+     * 病因
+     */
+    private String pathogeny;
+
+    /**
+     * 疾病分型
+     */
+    private String disType;
+
+    /**
+     * 中西医疾病(0:通用,1:西,2:中)
+     */
+    private Integer chWestern;
+
+    /**
+     * 是否常见病(0:否,1:是)
+     */
+    private Integer isCommonDis;
+
+    /**
+     * 是否遗传(0:否,1:是)
+     */
+    private Integer isHeredity;
+
+    /**
+     * 简称
+     */
+    private String nameSimple;
+
+    /**
+     * 英文简称
+     */
+    private String enNameSimple;
+
+    /**
+     * 英文名称
+     */
+    private String enName;
+
+    /**
+     * 形态学分类代码
+     */
+    private String morphology;
+
+    /**
+     * 肿瘤细胞类型
+     */
+    private String tumorCellType;
+
     /**
      * 备注
      */
     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 String getIcd10Code() {
-        return icd10Code;
-    }
-
-    public void setIcd10Code(String icd10Code) {
-        this.icd10Code = icd10Code;
-    }
-
-    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 +
-                ", icd10Code=" + icd10Code +
-                ", remark=" + remark +
-                "}";
-    }
 }

+ 93 - 0
src/main/java/com/diagbot/facade/KlDiseaseFacade.java

@@ -1,7 +1,30 @@
 package com.diagbot.facade;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.entity.KlConcept;
+import com.diagbot.entity.KlDisease;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.LexiconEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.KlDiseaseService;
 import com.diagbot.service.impl.KlDiseaseServiceImpl;
+import com.diagbot.util.Cn2SpellUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ExtUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.vo.ImportDiseaseCodeVO;
+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.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @Description:
@@ -10,4 +33,74 @@ import org.springframework.stereotype.Component;
  */
 @Component
 public class KlDiseaseFacade extends KlDiseaseServiceImpl {
+
+    @Autowired
+    KlConceptFacade klConceptFacade;
+    @Autowired
+    @Qualifier("klDiseaseServiceImpl")
+    KlDiseaseService klDiseaseService;
+
+    public void importDiseaseIcd(MultipartFile file) {
+        // 获取表格数据
+        Long t0 = System.currentTimeMillis();
+        List<ImportDiseaseCodeVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, 0, ImportDiseaseCodeVO.class);
+        Long t1 = System.currentTimeMillis();
+        System.out.println("读取表格数据:" + (t1 - t0) / 1000.0 + "秒");
+
+        List<KlConcept> conceptList = klConceptFacade.list(new QueryWrapper<KlConcept>().lambda()
+                .eq(KlConcept::getIsDeleted, IsDeleteEnum.N.getKey())
+                .eq(KlConcept::getLibType, LexiconEnum.Disease.getKey())
+        );
+        Map<String, Long> conceptMap = ExtUtil.getKeyValue(conceptList, "libName", "id");
+        conceptList = null;
+        Long t2 = System.currentTimeMillis();
+        System.out.println("读取疾病词库完成:" + (t2 - t1) / 1000.0 + "秒");
+
+        Long t3 = System.currentTimeMillis();
+        List<KlDisease> klDiseaseList = this.list(new QueryWrapper<>());
+        Map<Long, KlDisease> klDiseaseMap = ExtUtil.getKeyObject(klDiseaseList, "conceptId");
+        klDiseaseList = null;
+        Long t4 = System.currentTimeMillis();
+        System.out.println("读取疾病扩展表完成:" + (t4 - t3) / 1000.0 + "秒");
+
+        List<String> errLibName = new ArrayList<>();
+        List<KlDisease> saveOrUpdateKlDisease = new ArrayList<>();
+        Date now = DateUtil.now();
+        for (ImportDiseaseCodeVO bean : data) {
+            Long concepeId = conceptMap.get(bean.getLibName());
+            if (concepeId == null) {
+                errLibName.add(bean.getLibName());
+            } else {
+                KlDisease klDisease = klDiseaseMap.get(concepeId);
+                if (klDisease == null) {
+                    klDisease = new KlDisease();
+                    klDisease.setConceptId(concepeId);
+                }
+                klDisease.setGuoname(bean.getGuoname());
+                klDisease.setGuocode(bean.getGuocode());
+                klDisease.setGmtCreate(now);
+                klDisease.setGmtModified(now);
+                if (StringUtils.isNotBlank(bean.getGuoname())) {
+                    klDisease.setGuospell(Cn2SpellUtil.converterToFirstSpell(bean.getGuoname()));
+                } else {
+                    klDisease.setGuospell("");
+                }
+                saveOrUpdateKlDisease.add(klDisease);
+            }
+        }
+        if (ListUtil.isNotEmpty(errLibName)) {
+            String joinError = StringUtils.join(errLibName);
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准词不存在!" + joinError);
+        }
+
+        System.out.println("开始更新数据...");
+        Long t5 = System.currentTimeMillis();
+        klDiseaseService.saveOrUpdateBatch(saveOrUpdateKlDisease, 1);
+        Long t6 = System.currentTimeMillis();
+        System.out.println("更新数据完成:" + (t6 - t5) / 1000.0 + "秒");
+
+        System.out.println("总计耗时:" + (t6 - t0) / 1000.0 + "秒");
+    }
+
+
 }

+ 1 - 1
src/main/java/com/diagbot/process/PushProcess.java

@@ -390,7 +390,7 @@ public class PushProcess {
      * @return
      */
     public void process(PushDTO pushDTO, PushVO pushVo, WordCrfDTO wordCrfDTO) {
-        // 一般治疗由界面选中诊断diseaseName获取。core服务处理,这里只返回结构体
+        // 一般治疗由界面选中诊断diseaseName获取。cdss服务处理,这里只返回结构体
         Item selectDis = wordCrfDTO.getDiseaseName(); // 选中诊断
         Boolean hasDiseaseNameFlag = hasDiseaseName(selectDis);
         String selectDisName = hasDiseaseNameFlag ? selectDis.getUniqueName() : "";

+ 32 - 0
src/main/java/com/diagbot/vo/ImportDiseaseCodeVO.java

@@ -0,0 +1,32 @@
+package com.diagbot.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 诊断编码导入
+ * </p>
+ *
+ * @author zhaops
+ * @since 2020-07-28
+ */
+@Data
+public class ImportDiseaseCodeVO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Excel(name = "标准词")
+    private String libName;
+    @Excel(name = "医保编码")
+    private String icd10Code;
+    @Excel(name = "国临名称")
+    private String guoname;
+    @Excel(name = "国临编码")
+    private String guocode;
+    // @Excel(name = "国临拼音")
+    // private String guospell;
+
+}

+ 37 - 0
src/main/java/com/diagbot/web/KlDiseaseImportController.java

@@ -0,0 +1,37 @@
+package com.diagbot.web;
+
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.KlDiseaseFacade;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * @author zhoutg
+ * @Description:
+ * @date 2021-03-19 14:52
+ */
+@RestController
+@RequestMapping("/klDiseaseICDImport")
+@Api(tags = { "诊断医保ICD编码和国临编码导入API" })
+@SuppressWarnings("unchecked")
+public class KlDiseaseImportController {
+
+    @Autowired
+    KlDiseaseFacade klDiseaseFacade;
+
+    @ApiOperation(value = "诊断编码导入API[zhoutg]",
+            notes = "")
+    @PostMapping("/importDisease")
+    @Transactional
+    public RespDTO<String> importDiseaseIcd(@RequestParam("file") MultipartFile file) {
+        klDiseaseFacade.importDiseaseIcd(file);
+        return RespDTO.onSuc("ok");
+    }
+}

+ 26 - 0
src/main/resources/mapper/KlDiseaseMapper.xml

@@ -11,7 +11,33 @@
         <result column="creator" property="creator" />
         <result column="modifier" property="modifier" />
         <result column="concept_id" property="conceptId" />
+        <result column="dept_id" property="deptId" />
         <result column="icd10_code" property="icd10Code" />
+        <result column="guoname" property="guoname" />
+        <result column="guocode" property="guocode" />
+        <result column="guospell" property="guospell" />
+        <result column="course" property="course" />
+        <result column="inducement" property="inducement" />
+        <result column="food_prohibition" property="foodProhibition" />
+        <result column="hazard" property="hazard" />
+        <result column="healing" property="healing" />
+        <result column="pernicious" property="pernicious" />
+        <result column="clinic_type" property="clinicType" />
+        <result column="vul_area" property="vulArea" />
+        <result column="vul_crowd" property="vulCrowd" />
+        <result column="incidence" property="incidence" />
+        <result column="is_infect" property="isInfect" />
+        <result column="complication" property="complication" />
+        <result column="pathogeny" property="pathogeny" />
+        <result column="dis_type" property="disType" />
+        <result column="ch_western" property="chWestern" />
+        <result column="is_common_dis" property="isCommonDis" />
+        <result column="is_heredity" property="isHeredity" />
+        <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>