Browse Source

开单数据导出

zhoutg 3 years ago
parent
commit
39e42f71f4

+ 4 - 4
doc/008.20210629诊断依据基础表扩展/med_2021.sql

@@ -16,8 +16,8 @@ CREATE TABLE `kl_diagnose_base_relation` (
   KEY `concept_id` (`concept_id`)
 ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='基础规则关联表';
 
-ALTER TABLE `kl_diagnose_base` drop COLUMN `concept_id`;
-ALTER TABLE `kl_diagnose_base` drop COLUMN `status`;
+-- ALTER TABLE `kl_diagnose_base` drop COLUMN `concept_id`;
+-- ALTER TABLE `kl_diagnose_base` drop COLUMN `status`;
 
 drop TABLE if EXISTS kl_regulation_base_relation;
 CREATE TABLE `kl_regulation_base_relation` (
@@ -35,5 +35,5 @@ CREATE TABLE `kl_regulation_base_relation` (
   KEY `concept_id` (`concept_id`)
 ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='通用基础规则关联表';
 
-ALTER TABLE `kl_regulation_base` drop COLUMN `concept_id`;
-ALTER TABLE `kl_regulation_base` drop COLUMN `status`;
+-- ALTER TABLE `kl_regulation_base` drop COLUMN `concept_id`;
+-- ALTER TABLE `kl_regulation_base` drop COLUMN `status`;

+ 39 - 0
src/main/java/com/diagbot/dto/IndicationExportDTO.java

@@ -0,0 +1,39 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 诊断依据导出
+ * </p>
+ *
+ * @author kongwz
+ * @since 2020-07-28
+ */
+@Data
+public class IndicationExportDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Excel(name="开单名称", width = 25, orderNum = "10")
+    private String parName = "";
+    @Excel(name="开单类型", width = 15, orderNum = "20")
+    private String parType = "";
+    @Excel(name="规则名称", width = 25, orderNum = "30")
+    private String baseName = "";
+    @Excel(name="规则类型", width = 15, orderNum = "35")
+    private String baseType;
+    @Excel(name="其他条件", width = 10, orderNum = "40")
+    private String otherType;
+    @Excel(name="最大值", width = 10, orderNum = "50")
+    private String maxValue;
+    @Excel(name="最大值符号", width = 10, orderNum = "60")
+    private String maxOperator;
+    @Excel(name="最小值", width = 10, orderNum = "70")
+    private String minValue;
+    @Excel(name="最小值符号", width = 10, orderNum = "80")
+    private String minOperator;
+}

+ 14 - 0
src/main/java/com/diagbot/facade/KlRuleFacade.java

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.IndicationExportDTO;
 import com.diagbot.dto.KlRuleByIdDTO;
 import com.diagbot.dto.KlRuleByIdParDTO;
 import com.diagbot.dto.KlRuleByIdSubDTO;
@@ -16,6 +17,7 @@ import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.KlRuleServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
+import com.diagbot.util.ExcelUtils;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.KlRuleByIdVO;
@@ -27,6 +29,7 @@ import com.diagbot.vo.KlRuleSatartOrdisaVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -235,4 +238,15 @@ public class KlRuleFacade extends KlRuleServiceImpl {
                 .set("gmt_modified", now);
         return this.update(klRuleUpdate);
     }
+
+    /**
+     * 开单合理性导出
+     *
+     * @return
+     */
+    public void exportIndicationFac(HttpServletResponse response) {
+        List<IndicationExportDTO> indicationExportDTOS = exportIndication();
+        ExcelUtils.exportExcel(indicationExportDTOS, null, "开单合理性", IndicationExportDTO.class, "indication.xlsx",
+                response, 12.8f);
+    }
 }

+ 3 - 0
src/main/java/com/diagbot/mapper/KlRuleMapper.java

@@ -1,6 +1,7 @@
 package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.IndicationExportDTO;
 import com.diagbot.dto.KlRuleByIdDTO;
 import com.diagbot.dto.KlRuleInfoDTO;
 import com.diagbot.dto.RuleDTO;
@@ -26,4 +27,6 @@ public interface KlRuleMapper extends BaseMapper<KlRule> {
     IPage<KlRuleInfoDTO> getKlRuleInfoPage(KlRuleInfoVO klRuleInfoVO);
 
     List<KlRuleByIdDTO> getByIdRuleInfo(KlRuleByIdVO klRuleByIdVO);
+
+    List<IndicationExportDTO> exportIndication();
 }

+ 3 - 4
src/main/java/com/diagbot/service/KlRuleService.java

@@ -1,14 +1,12 @@
 package com.diagbot.service;
 
-import com.baomidou.dynamic.datasource.annotation.DSTransactional;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.IndicationExportDTO;
 import com.diagbot.dto.KlRuleByIdDTO;
 import com.diagbot.dto.KlRuleInfoDTO;
 import com.diagbot.dto.RuleDTO;
 import com.diagbot.entity.KlRule;
-import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.vo.KlRuleByIdVO;
 import com.diagbot.vo.KlRuleInfoVO;
 
@@ -26,4 +24,5 @@ public interface KlRuleService extends IService<KlRule> {
     List<RuleDTO> getAllRule();
     IPage<KlRuleInfoDTO> getKlRuleInfoPages(KlRuleInfoVO klRuleInfoVO);
     List<KlRuleByIdDTO> getByIdRuleInfo(KlRuleByIdVO klRuleByIdVO);
+    List<IndicationExportDTO> exportIndication();
 }

+ 6 - 1
src/main/java/com/diagbot/service/impl/KlRuleServiceImpl.java

@@ -1,8 +1,8 @@
 package com.diagbot.service.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.IndicationExportDTO;
 import com.diagbot.dto.KlRuleByIdDTO;
 import com.diagbot.dto.KlRuleInfoDTO;
 import com.diagbot.dto.RuleDTO;
@@ -38,4 +38,9 @@ public class KlRuleServiceImpl extends ServiceImpl<KlRuleMapper, KlRule> impleme
     public List<KlRuleByIdDTO> getByIdRuleInfo(KlRuleByIdVO klRuleByIdVO) {
         return baseMapper.getByIdRuleInfo(klRuleByIdVO);
     }
+
+    @Override
+    public List<IndicationExportDTO> exportIndication() {
+        return baseMapper.exportIndication();
+    }
 }

+ 33 - 0
src/main/java/com/diagbot/web/KlIndicationImportController.java

@@ -0,0 +1,33 @@
+package com.diagbot.web;
+
+import com.diagbot.facade.KlRuleFacade;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author zhoutg
+ * @Description:
+ * @date 2021-03-19 14:52
+ */
+@RestController
+@RequestMapping("/klIndicationImport")
+@Api(tags = { "开单导出API" })
+@SuppressWarnings("unchecked")
+public class KlIndicationImportController {
+
+    @Autowired
+    KlRuleFacade klRuleFacade;
+
+    @ApiOperation(value = "开单合理性导出API[zhoutg]")
+    @PostMapping("/exportIndication")
+    public void exportDiagnose(HttpServletResponse response) {
+        klRuleFacade.exportIndicationFac(response);
+    }
+
+}

+ 66 - 0
src/main/resources/mapper/KlRuleMapper.xml

@@ -226,4 +226,70 @@
         AND d.lib_type = f.code) sub
         ON sub.subId = ruco.rule_base_id
     </select>
+
+    <select id="exportIndication" resultType="com.diagbot.dto.IndicationExportDTO">
+        SELECT
+            tt1.par_name,
+            tt1.par_type,
+            tt2.lib_name base_name,
+            xx2.NAME base_type,
+            CASE tt1.type
+                when '4' then '过敏原'
+                when '5' then '辅检开单互斥'
+                else '' end other_type,
+            tt1.eq_value,
+            tt1.min_value,
+            tt1.min_operator,
+            tt1.min_unit,
+            tt1.max_value,
+            tt1.max_operator,
+            tt1.max_unit,
+            tt1.rule_id,
+            tt1.description
+        FROM
+            (
+                SELECT
+                    c1.lib_name par_name,
+                    c1.id par_id,
+                    x1.`name` par_type,
+                    t1.id rule_id,
+                    t1.description,
+                    t1.rule_type,
+                    t1.has_sub_cond,
+                    t1.msg,
+                    t3.type,
+                    t3.concept_id base_id,
+                    t3.eq_value,
+                    t3.min_value,
+                    t3.min_operator,
+                    t3.min_unit,
+                    t3.max_value,
+                    t3.max_operator,
+                    t3.max_unit
+                FROM
+                    kl_concept c1,
+                    kl_lexicon x1,
+                    kl_rule t1,
+                    kl_rule_condition t2,
+                    kl_rule_base t3
+                WHERE
+                    c1.is_deleted = 'N'
+                AND t1.is_deleted = 'N'
+                AND t2.is_deleted = 'N'
+                AND t3.is_deleted = 'N'
+                AND c1.`status` = 1
+                AND t1.`status` = 1
+                AND c1.id = t1.concept_id
+                AND t1.id = t2.rule_id
+                AND t2.rule_base_id = t3.id
+                AND t1.rule_type = 1
+                AND x1.`code` = c1.lib_type
+            ) tt1
+        LEFT JOIN kl_concept tt2 ON tt2.is_deleted = 'N'
+        AND tt2.`status` = 1
+        AND tt1.base_id = tt2.id
+        LEFT JOIN kl_lexicon xx2 ON tt2.lib_type = xx2. CODE
+        ORDER BY
+            rule_id
+    </select>
 </mapper>