Bläddra i källkod

导入添加记录信息

zhoutg 3 år sedan
förälder
incheckning
91d37a958f

+ 1 - 1
doc/018.20210824诊断依据导出/med2021_init.sql

@@ -10,7 +10,7 @@ CREATE TABLE `kl_diagnose_record` (
       `type` varchar(255) NOT NULL DEFAULT '' COMMENT '类型',
       `code` varchar(255) NOT NULL DEFAULT '' COMMENT '序号',
       `rule` varchar(1024) NOT NULL DEFAULT '' COMMENT '规则',
-      `desc` varchar(255) NOT NULL DEFAULT '' COMMENT '描述',
+      `description` varchar(255) NOT NULL DEFAULT '' COMMENT '描述',
       `eq_value` varchar(255) NOT NULL DEFAULT '' COMMENT '等于',
       `max_value` varchar(255) NOT NULL DEFAULT '' COMMENT '最大值',
       `max_operator` varchar(255) NOT NULL DEFAULT '' COMMENT '最大值符号',

+ 1 - 1
src/main/java/com/diagbot/dto/KlDiagnoseRecordDTO.java

@@ -42,7 +42,7 @@ public class KlDiagnoseRecordDTO implements Serializable {
     /**
      * 描述
      */
-    private String desc;
+    private String description;
 
     /**
      * 等于

+ 1 - 1
src/main/java/com/diagbot/entity/KlDiagnoseRecord.java

@@ -74,7 +74,7 @@ public class KlDiagnoseRecord implements Serializable {
     /**
      * 描述
      */
-    private String desc;
+    private String description;
 
     /**
      * 等于

+ 10 - 1
src/main/java/com/diagbot/facade/KlDiagnoseImportFacade.java

@@ -39,7 +39,6 @@ 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.IOException;
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
@@ -472,6 +471,16 @@ public class KlDiagnoseImportFacade {
 
                 //  保存记录表和记录明细表
                 List<KlDiagnoseRecordDTO> recordList = importDiagnoseResVO.getRecordList();
+                List<KlDiagnoseRecord> klDiagnoseRecordList = klDiagnoseRecordService.list(new QueryWrapper<KlDiagnoseRecord>()
+                        .eq("diagnose_id", klDiagnoseSaveVO.getId()));
+                if (ListUtil.isNotEmpty(klDiagnoseRecordList)) {
+                    List<Long> recordIdList = klDiagnoseRecordList.stream().map(r -> r.getId()).collect(Collectors.toList());
+                    // 先删除记录明细表
+                    klDiagnoseRecordDetailService.remove(new QueryWrapper<KlDiagnoseRecordDetail>()
+                            .in("diagnose_record_id", recordIdList));
+                    // 再删除记录表
+                    klDiagnoseRecordService.remove(new QueryWrapper<KlDiagnoseRecord>().in("id", recordIdList));
+                }
                 for (KlDiagnoseRecordDTO klDiagnoseRecordDTO : recordList) {
                     // 保存记录表
                     KlDiagnoseRecord klDiagnoseRecord = new KlDiagnoseRecord();

+ 1 - 1
src/main/resources/mapper/KlDiagnoseRecordMapper.xml

@@ -14,7 +14,7 @@
         <result column="type" property="type" />
         <result column="code" property="code" />
         <result column="rule" property="rule" />
-        <result column="desc" property="desc" />
+        <result column="desc" property="description" />
         <result column="eq_operator" property="eqValue" />
         <result column="max_value" property="maxValue" />
         <result column="max_operator" property="maxOperator" />