瀏覽代碼

诊断模板接口优化,父级要把所有子集的诊断模板查询出来

matianxiang 1 月之前
父節點
當前提交
9488f5cf1a

+ 5 - 0
eitc-patient-base/src/main/java/com/eitc/patient/mapper/DiagnosisTypeMapper.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.eitc.patient.domain.DiagnosisType;
5 5
 import org.apache.ibatis.annotations.Mapper;
6 6
 
7
+import java.util.List;
8
+
7 9
 /**
8 10
  * DiagnosisTypeMapper
9 11
  *
@@ -12,4 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
12 14
  */
13 15
 @Mapper
14 16
 public interface DiagnosisTypeMapper extends BaseMapper<DiagnosisType> {
17
+
18
+
19
+    List<DiagnosisType> selectChildrenListById(String diagnosisTypeId);
15 20
 }

+ 2 - 0
eitc-patient-base/src/main/java/com/eitc/patient/service/IDiagnosisTypeService.java

@@ -65,4 +65,6 @@ public interface IDiagnosisTypeService extends IService<DiagnosisType> {
65 65
      * @throws IllegalArgumentException 如果诊断类型ID为空或存在子类型,则抛出此异常
66 66
      */
67 67
     void checkAddDiagnosisType(String diagnosisTypeId);
68
+
69
+    List<DiagnosisType> selectChildrenListById(String diagnosisTypeId);
68 70
 }

+ 5 - 0
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/DiagnosisTypeServiceImpl.java

@@ -168,4 +168,9 @@ public class DiagnosisTypeServiceImpl extends ServiceImpl<DiagnosisTypeMapper, D
168 168
         }
169 169
     }
170 170
 
171
+    @Override
172
+    public List<DiagnosisType> selectChildrenListById(String diagnosisTypeId) {
173
+        return this.baseMapper.selectChildrenListById(diagnosisTypeId);
174
+    }
175
+
171 176
 }

+ 15 - 0
eitc-patient-base/src/main/resources/mapper/patient/DiagnosisTypeMapper.xml

@@ -3,4 +3,19 @@
3 3
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 4
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.eitc.patient.mapper.DiagnosisTypeMapper">
6
+    <select id="selectChildrenListById" resultType="com.eitc.patient.domain.DiagnosisType">
7
+        select
8
+            parent_id,
9
+            ancestors,
10
+            diagnosis_name,
11
+            diagnosis_name_pinyin_first_letter,
12
+            diagnosis_name_pinyin,
13
+            id,
14
+            create_date,
15
+            create_user,
16
+            update_date,
17
+            update_user
18
+            from erm_diagnosis_type
19
+            where is_del = 0 and find_in_set(#{diagnosisTypeId}, ancestors)
20
+    </select>
6 21
 </mapper>

+ 17 - 2
eitc-patient-pc/src/main/java/com/eitc/patient/controller/DiagnosisTypeTemplateController.java

@@ -10,8 +10,10 @@ import com.eitc.common.core.page.TableDataInfo;
10 10
 import com.eitc.common.enums.BusinessType;
11 11
 import com.eitc.common.utils.bean.BeanUtils;
12 12
 import com.eitc.common.utils.poi.ExcelUtil;
13
+import com.eitc.patient.domain.DiagnosisType;
13 14
 import com.eitc.patient.domain.DiagnosisTypeTemplate;
14 15
 import com.eitc.patient.excel.DiagnosisTypeTemplateExcel;
16
+import com.eitc.patient.service.IDiagnosisTypeService;
15 17
 import com.eitc.patient.service.IDiagnosisTypeTemplateService;
16 18
 import com.eitc.patient.vo.DiagnosisTypeTemplateSaveVO;
17 19
 import com.eitc.patient.vo.DiagnosisTypeTemplateVO;
@@ -35,8 +37,10 @@ import javax.validation.Valid;
35 37
 import java.io.IOException;
36 38
 import java.util.ArrayList;
37 39
 import java.util.Arrays;
40
+import java.util.HashSet;
38 41
 import java.util.List;
39 42
 import java.util.Objects;
43
+import java.util.Set;
40 44
 import java.util.stream.Collectors;
41 45
 
42 46
 /**
@@ -52,6 +56,8 @@ public class DiagnosisTypeTemplateController extends BaseController {
52 56
 
53 57
     @Resource
54 58
     private IDiagnosisTypeTemplateService diagnosisTypeTemplateService;
59
+    @Resource
60
+    private IDiagnosisTypeService diagnosisTypeService;
55 61
 
56 62
 
57 63
     /**
@@ -60,10 +66,19 @@ public class DiagnosisTypeTemplateController extends BaseController {
60 66
     @GetMapping("/page")
61 67
     @ApiOperation("查询诊断分类模板")
62 68
     public TableDataInfo page(DiagnosisTypeTemplate diagnosisTypeTemplate) {
69
+        Set<String> ids = new HashSet<>();
70
+        if (Objects.nonNull(diagnosisTypeTemplate.getDiagnosisTypeId())) {
71
+            ids.add(diagnosisTypeTemplate.getDiagnosisTypeId());
72
+            List<DiagnosisType> list = diagnosisTypeService.selectChildrenListById(diagnosisTypeTemplate.getDiagnosisTypeId());
73
+            Set<String> collect = list.stream().map(DiagnosisType::getId).collect(Collectors.toSet());
74
+            if (CollectionUtils.isNotEmpty(collect)) {
75
+                ids.addAll(collect);
76
+            }
77
+        }
78
+
63 79
         startPage();
64 80
         LambdaQueryWrapper<DiagnosisTypeTemplate> eq = Wrappers.<DiagnosisTypeTemplate>lambdaQuery()
65
-                .like(Objects.nonNull(diagnosisTypeTemplate.getDiagnosisTypeId()),
66
-                        DiagnosisTypeTemplate::getDiagnosisTypeId, diagnosisTypeTemplate.getDiagnosisTypeId())
81
+                .in(CollectionUtils.isNotEmpty(ids), DiagnosisTypeTemplate::getDiagnosisTypeId, ids)
67 82
                 .orderByDesc(DiagnosisTypeTemplate::getCreateDate);
68 83
         List<DiagnosisTypeTemplate> list = diagnosisTypeTemplateService.list(eq);
69 84
         List<DiagnosisTypeTemplateVO> voList = new ArrayList<>();

+ 32 - 32
sql/初始化脚本.sql

@@ -35195,38 +35195,38 @@ CREATE TABLE `erm_diagnosis_type_order_doctor`  (
35195 35195
 -- Table structure for erm_diagnosis_type_template
35196 35196
 -- ----------------------------
35197 35197
 DROP TABLE IF EXISTS `erm_diagnosis_type_template`;
35198
-CREATE TABLE `erm_diagnosis_type_template`  (
35199
-                                              `id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
35200
-                                              `is_del` int NOT NULL DEFAULT 0 COMMENT '删除标识:0正常,1已删除',
35201
-                                              `create_date` datetime NOT NULL COMMENT '创建时间',
35202
-                                              `create_user` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人',
35203
-                                              `update_date` datetime NULL DEFAULT NULL COMMENT '更新时间',
35204
-                                              `update_user` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
35205
-                                              `tenant_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
35206
-                                              `diagnosis_type_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '诊断分类id',
35207
-                                              `template_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模板名称',
35208
-                                              `name_pinyin_first_letter` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '诊断名称首拼',
35209
-                                              `name_pinyin` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '诊断名称拼音',
35210
-                                              `template_desc` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模板描述',
35211
-                                              `diagnosis_manage_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '诊断管理id',
35212
-                                              `diagnosis_manage_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '诊断管理名称',
35213
-                                              `apply_dept` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '适用科室',
35214
-                                              `visit_type` int NULL DEFAULT NULL COMMENT '就诊类型(1初诊,2复诊)',
35215
-                                              `enable_status` int NULL DEFAULT 1 COMMENT '启用状态(1启用,0未启用)',
35216
-                                              `chief_complaint_content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '主诉内容',
35217
-                                              `chief_complaint_option` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '主诉选项',
35218
-                                              `present_illness_content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '现病史内容',
35219
-                                              `present_illness_option` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '现病史选项',
35220
-                                              `inspect_content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检查内容',
35221
-                                              `inspect_option` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检查选项',
35222
-                                              `treatment_planning_content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '治疗计划内容',
35223
-                                              `treatment_planning_option` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '治疗计划选项',
35224
-                                              `dispose_content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '处置内容',
35225
-                                              `dispose_option` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '处置选项',
35226
-                                              `note_content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '便签内容',
35227
-                                              `note_option` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '便签选项',
35228
-                                              PRIMARY KEY (`id`) USING BTREE
35229
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '诊断分类模板' ROW_FORMAT = DYNAMIC;
35198
+CREATE TABLE `erm_diagnosis_type_template` (
35199
+  `id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
35200
+  `is_del` int NOT NULL DEFAULT '0' COMMENT '删除标识:0正常,1已删除',
35201
+  `create_date` datetime NOT NULL COMMENT '创建时间',
35202
+  `create_user` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人',
35203
+  `update_date` datetime DEFAULT NULL COMMENT '更新时间',
35204
+  `update_user` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '更新人',
35205
+  `tenant_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '000000' COMMENT '租户ID',
35206
+  `diagnosis_type_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '诊断分类id',
35207
+  `template_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '模板名称',
35208
+  `name_pinyin_first_letter` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '诊断名称首拼',
35209
+  `name_pinyin` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '诊断名称拼音',
35210
+  `template_desc` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '模板描述',
35211
+  `diagnosis_manage_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '诊断管理id',
35212
+  `diagnosis_manage_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '诊断管理名称',
35213
+  `apply_dept` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '适用科室',
35214
+  `visit_type` int DEFAULT NULL COMMENT '就诊类型(1初诊,2复诊)',
35215
+  `enable_status` int DEFAULT '1' COMMENT '启用状态(1启用,0未启用)',
35216
+  `chief_complaint_content` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '主诉内容',
35217
+  `chief_complaint_option` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '主诉选项',
35218
+  `present_illness_content` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '现病史内容',
35219
+  `present_illness_option` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '现病史选项',
35220
+  `inspect_content` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '检查内容',
35221
+  `inspect_option` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '检查选项',
35222
+  `treatment_planning_content` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '治疗计划内容',
35223
+  `treatment_planning_option` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '治疗计划选项',
35224
+  `dispose_content` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '处置内容',
35225
+  `dispose_option` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '处置选项',
35226
+  `note_content` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '便签内容',
35227
+  `note_option` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '便签选项',
35228
+  PRIMARY KEY (`id`) USING BTREE
35229
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='诊断分类模板';
35230 35230
 
35231 35231
 -- ----------------------------
35232 35232
 -- Records of erm_diagnosis_type_template