Pārlūkot izejas kodu

Merge branch 'develop' into dev/mix20200401_icss6.0

gaodm 5 gadi atpakaļ
vecāks
revīzija
5b773c323b
61 mainītis faili ar 3034 papildinājumiem un 11 dzēšanām
  1. 5 1
      config-server/src/main/resources/shared/ltkg-service-dev.yml
  2. 5 1
      config-server/src/main/resources/shared/ltkg-service-local.yml
  3. 5 1
      config-server/src/main/resources/shared/ltkg-service-pre.yml
  4. 5 1
      config-server/src/main/resources/shared/ltkg-service-pro.yml
  5. 5 1
      config-server/src/main/resources/shared/ltkg-service-test.yml
  6. 15 0
      config-server/src/main/resources/shared/mrman-service-dev.yml
  7. 15 0
      config-server/src/main/resources/shared/mrman-service-local.yml
  8. 15 0
      config-server/src/main/resources/shared/mrman-service-pre.yml
  9. 15 0
      config-server/src/main/resources/shared/mrman-service-pro.yml
  10. 15 0
      config-server/src/main/resources/shared/mrman-service-test.yml
  11. 4 0
      docs/035.20200514运行质控1.0.0/init_qc.sql
  12. 1074 0
      docs/035.20200514运行质控1.0.0/init_sys-user.sql
  13. 20 0
      ltkg-service/src/main/java/com/diagbot/client/QAServiceClient.java
  14. 24 0
      ltkg-service/src/main/java/com/diagbot/client/hystrix/QAServiceHystrix.java
  15. 16 0
      ltkg-service/src/main/java/com/diagbot/dto/QADTO.java
  16. 28 0
      ltkg-service/src/main/java/com/diagbot/facade/QAFacade.java
  17. 15 0
      ltkg-service/src/main/java/com/diagbot/vo/QAVO.java
  18. 35 0
      ltkg-service/src/main/java/com/diagbot/web/QAController.java
  19. 1 1
      ltkg-service/src/main/resources/mapper/KgMapper.xml
  20. 11 0
      mrman-service/pom.xml
  21. 169 0
      mrman-service/src/main/java/com/diagbot/config/RedisConfigurer.java
  22. 38 0
      mrman-service/src/main/java/com/diagbot/dto/QcCasesEntrySimpleDTO.java
  23. 25 0
      mrman-service/src/main/java/com/diagbot/dto/QcTypeDTO.java
  24. 66 0
      mrman-service/src/main/java/com/diagbot/dto/QcTypePageDTO.java
  25. 69 0
      mrman-service/src/main/java/com/diagbot/entity/QcType.java
  26. 69 0
      mrman-service/src/main/java/com/diagbot/entity/QcTypeCasesEntry.java
  27. 23 0
      mrman-service/src/main/java/com/diagbot/facade/CacheFacade.java
  28. 14 1
      mrman-service/src/main/java/com/diagbot/facade/QcCacesEntryFacade.java
  29. 6 0
      mrman-service/src/main/java/com/diagbot/facade/QcModuleInfoFacade.java
  30. 7 0
      mrman-service/src/main/java/com/diagbot/facade/QcQuestionFacade.java
  31. 21 0
      mrman-service/src/main/java/com/diagbot/facade/QcTypeCasesEntryFacade.java
  32. 252 0
      mrman-service/src/main/java/com/diagbot/facade/QcTypeFacade.java
  33. 7 0
      mrman-service/src/main/java/com/diagbot/mapper/QcCasesEntryMapper.java
  34. 21 0
      mrman-service/src/main/java/com/diagbot/mapper/QcTypeCasesEntryMapper.java
  35. 26 0
      mrman-service/src/main/java/com/diagbot/mapper/QcTypeMapper.java
  36. 7 0
      mrman-service/src/main/java/com/diagbot/service/QcCasesEntryService.java
  37. 21 0
      mrman-service/src/main/java/com/diagbot/service/QcTypeCasesEntryService.java
  38. 20 0
      mrman-service/src/main/java/com/diagbot/service/QcTypeService.java
  39. 13 0
      mrman-service/src/main/java/com/diagbot/service/impl/QcCasesEntryServiceImpl.java
  40. 28 0
      mrman-service/src/main/java/com/diagbot/service/impl/QcTypeCasesEntryServiceImpl.java
  41. 27 0
      mrman-service/src/main/java/com/diagbot/service/impl/QcTypeServiceImpl.java
  42. 19 0
      mrman-service/src/main/java/com/diagbot/vo/DeleteQcTypeVO.java
  43. 16 0
      mrman-service/src/main/java/com/diagbot/vo/QcEntryHospitalVO.java
  44. 15 0
      mrman-service/src/main/java/com/diagbot/vo/QcTypeCasesEntryVO.java
  45. 22 0
      mrman-service/src/main/java/com/diagbot/vo/QcTypeIndexVO.java
  46. 20 0
      mrman-service/src/main/java/com/diagbot/vo/QcTypePageVO.java
  47. 24 0
      mrman-service/src/main/java/com/diagbot/vo/QcTypeSaveVO.java
  48. 16 0
      mrman-service/src/main/java/com/diagbot/vo/QcTypeVO.java
  49. 7 1
      mrman-service/src/main/java/com/diagbot/vo/QuestionPageVO.java
  50. 39 0
      mrman-service/src/main/java/com/diagbot/web/CacheController.java
  51. 11 1
      mrman-service/src/main/java/com/diagbot/web/QcQuestionInfoController.java
  52. 110 0
      mrman-service/src/main/java/com/diagbot/web/QcTypeController.java
  53. 42 0
      mrman-service/src/main/resources/mapper/QcCasesEntryMapper.xml
  54. 0 1
      mrman-service/src/main/resources/mapper/QcQuestionInfoMapper.xml
  55. 58 0
      mrman-service/src/main/resources/mapper/QcTypeCasesEntryMapper.xml
  56. 30 0
      mrman-service/src/main/resources/mapper/QcTypeMapper.xml
  57. 1 1
      mrman-service/src/test/java/com/diagbot/CodeGeneration.java
  58. 59 0
      prec-service/src/main/java/com/diagbot/facade/PrecEncryptFacade.java
  59. 222 0
      prec-service/src/main/java/com/diagbot/util/AESCipher.java
  60. 20 0
      prec-service/src/main/java/com/diagbot/vo/PrecMapVO.java
  61. 46 0
      prec-service/src/main/java/com/diagbot/web/PrecEncryptController.java

+ 5 - 1
config-server/src/main/resources/shared/ltkg-service-dev.yml

@@ -91,4 +91,8 @@ mybatis-plus:
 
 nlprel:
   server:
-    address: http://192.168.3.150:3456
+    address: http://192.168.3.150:3456
+
+qa:
+  server:
+    address: http://192.168.3.150:9999

+ 5 - 1
config-server/src/main/resources/shared/ltkg-service-local.yml

@@ -91,4 +91,8 @@ mybatis-plus:
 
 nlprel:
   server:
-    address: http://192.168.3.150:3456
+    address: http://192.168.3.150:3456
+
+qa:
+  server:
+    address: http://192.168.3.150:9999

+ 5 - 1
config-server/src/main/resources/shared/ltkg-service-pre.yml

@@ -91,4 +91,8 @@ mybatis-plus:
 
 nlprel:
   server:
-    address: http://192.168.3.150:3456
+    address: http://192.168.3.150:3456
+
+qa:
+  server:
+    address: http://192.168.3.150:9999

+ 5 - 1
config-server/src/main/resources/shared/ltkg-service-pro.yml

@@ -91,4 +91,8 @@ mybatis-plus:
 
 nlprel:
   server:
-    address: http://192.168.3.150:3456
+    address: http://192.168.3.150:3456
+
+qa:
+  server:
+    address: http://192.168.3.150:9999

+ 5 - 1
config-server/src/main/resources/shared/ltkg-service-test.yml

@@ -91,4 +91,8 @@ mybatis-plus:
 
 nlprel:
   server:
-    address: http://192.168.3.150:3456
+    address: http://192.168.3.150:3456
+
+qa:
+  server:
+    address: http://192.168.3.150:9999

+ 15 - 0
config-server/src/main/resources/shared/mrman-service-dev.yml

@@ -82,6 +82,21 @@ spring:
     publisher-confirms: true
     virtual-host: /
 
+  #redis
+  redis:
+    database:
+      cache: 8 # cache索引
+    host: 192.168.2.236  #Redis服务器地址
+    port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
+    password: lantone # Redis服务器连接密码(默认为空)
+    lettuce:
+      pool:
+        max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
+        max-idle: 5 # 连接池中的最大空闲连接
+        max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
+        min-idle: 0 # 连接池中的最小空闲连接
+    timeout: 20000 # 连接超时时间(毫秒)
+
 #mybatis
 mybatis-plus:
   mapper-locations: classpath:/mapper/*Mapper.xml

+ 15 - 0
config-server/src/main/resources/shared/mrman-service-local.yml

@@ -82,6 +82,21 @@ spring:
     publisher-confirms: true
     virtual-host: /
 
+  #redis
+  redis:
+    database:
+      cache: 8 # cache索引
+    host: 192.168.2.236  #Redis服务器地址
+    port: 6378 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
+    password: lantone # Redis服务器连接密码(默认为空)
+    lettuce:
+      pool:
+        max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
+        max-idle: 5 # 连接池中的最大空闲连接
+        max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
+        min-idle: 0 # 连接池中的最小空闲连接
+    timeout: 20000 # 连接超时时间(毫秒)
+
 #mybatis
 mybatis-plus:
   mapper-locations: classpath:/mapper/*Mapper.xml

+ 15 - 0
config-server/src/main/resources/shared/mrman-service-pre.yml

@@ -82,6 +82,21 @@ spring:
     publisher-confirms: true
     virtual-host: /
 
+  #redis
+  redis:
+    database:
+      cache: 8 # cache索引
+    host: 192.168.2.121  #Redis服务器地址
+    port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
+    password: lantone # Redis服务器连接密码(默认为空)
+    lettuce:
+      pool:
+        max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
+        max-idle: 5 # 连接池中的最大空闲连接
+        max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
+        min-idle: 0 # 连接池中的最小空闲连接
+    timeout: 20000 # 连接超时时间(毫秒)
+
 #mybatis
 mybatis-plus:
   mapper-locations: classpath:/mapper/*Mapper.xml

+ 15 - 0
config-server/src/main/resources/shared/mrman-service-pro.yml

@@ -82,6 +82,21 @@ spring:
     publisher-confirms: true
     virtual-host: /
 
+  #redis
+  redis:
+    database:
+      cache: 8 # cache索引
+    host: 192.168.2.122  #Redis服务器地址
+    port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
+    password: lantone # Redis服务器连接密码(默认为空)
+    lettuce:
+      pool:
+        max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
+        max-idle: 5 # 连接池中的最大空闲连接
+        max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
+        min-idle: 0 # 连接池中的最小空闲连接
+    timeout: 20000 # 连接超时时间(毫秒)
+
 #mybatis
 mybatis-plus:
   mapper-locations: classpath:/mapper/*Mapper.xml

+ 15 - 0
config-server/src/main/resources/shared/mrman-service-test.yml

@@ -83,6 +83,21 @@ spring:
     publisher-confirms: true
     virtual-host: /
 
+  #redis
+  redis:
+    database:
+      cache: 8 # cache索引
+    host: 192.168.2.241  #Redis服务器地址
+    port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
+    password: lantone # Redis服务器连接密码(默认为空)
+    lettuce:
+      pool:
+        max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
+        max-idle: 5 # 连接池中的最大空闲连接
+        max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
+        min-idle: 0 # 连接池中的最小空闲连接
+    timeout: 20000 # 连接超时时间(毫秒)
+
 #mybatis
 mybatis-plus:
   mapper-locations: classpath:/mapper/*Mapper.xml

+ 4 - 0
docs/035.20200514运行质控1.0.0/init_qc.sql

@@ -0,0 +1,4 @@
+use `qc`;
+
+alter table qc_type_cases_entry add index `case_entry_id` (`case_entry_id`);
+alter table qc_type_cases_entry add index `type_id` (`type_id`);

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1074 - 0
docs/035.20200514运行质控1.0.0/init_sys-user.sql


+ 20 - 0
ltkg-service/src/main/java/com/diagbot/client/QAServiceClient.java

@@ -0,0 +1,20 @@
+package com.diagbot.client;
+
+import com.diagbot.client.hystrix.QAServiceHystrix;
+import com.diagbot.dto.QADTO;
+import com.diagbot.vo.QAVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * @Description: 知识图谱问答服务
+ * @Author:zhaops
+ * @time: 2020/5/25 11:19
+ */
+@FeignClient(name = "QA", url = "${qa.server.address}", fallback = QAServiceHystrix.class)
+public interface QAServiceClient {
+
+    @PostMapping(value = "/api/chat_bot")
+    QADTO charBot(@RequestBody QAVO qavo);
+}

+ 24 - 0
ltkg-service/src/main/java/com/diagbot/client/hystrix/QAServiceHystrix.java

@@ -0,0 +1,24 @@
+package com.diagbot.client.hystrix;
+
+import com.diagbot.client.QAServiceClient;
+import com.diagbot.dto.QADTO;
+import com.diagbot.vo.QAVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * @Description: 知识图谱问答服务
+ * @Author:zhaops
+ * @time: 2020/5/25 11:19
+ */
+@Component
+@Slf4j
+public class QAServiceHystrix implements QAServiceClient {
+
+    @Override
+    public QADTO charBot(@RequestBody QAVO qavo) {
+        log.error("【hystrix】调用{}异常", "charBot");
+        return null;
+    }
+}

+ 16 - 0
ltkg-service/src/main/java/com/diagbot/dto/QADTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/5/25 11:24
+ */
+@Getter
+@Setter
+public class QADTO {
+    private Boolean status;
+    private String answer;
+}

+ 28 - 0
ltkg-service/src/main/java/com/diagbot/facade/QAFacade.java

@@ -0,0 +1,28 @@
+package com.diagbot.facade;
+
+import com.diagbot.client.QAServiceClient;
+import com.diagbot.dto.QADTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.vo.QAVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/5/25 11:23
+ */
+@Component
+public class QAFacade {
+    @Autowired
+    private QAServiceClient qaServiceClient;
+
+    public QADTO charBot(QAVO qavo) {
+        QADTO qadto = qaServiceClient.charBot(qavo);
+        if (qadto == null || qadto.getStatus() == false) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "调用问答服务失败");
+        }
+        return qadto;
+    }
+}

+ 15 - 0
ltkg-service/src/main/java/com/diagbot/vo/QAVO.java

@@ -0,0 +1,15 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/5/25 11:24
+ */
+@Getter
+@Setter
+public class QAVO {
+    private String question;
+}

+ 35 - 0
ltkg-service/src/main/java/com/diagbot/web/QAController.java

@@ -0,0 +1,35 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.QADTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.QAFacade;
+import com.diagbot.vo.QAVO;
+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.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/5/25 11:35
+ */
+@RestController
+@RequestMapping("/qa")
+@Api(value = "知识库问答相关API", tags = { "知识库问答相关API" })
+@SuppressWarnings("unchecked")
+public class QAController {
+    @Autowired
+    private QAFacade qaFacade;
+
+    @ApiOperation(value = "知识库问答[zhaops]", notes = "")
+    @PostMapping("/charBot")
+    @SysLogger("charBot")
+    public RespDTO<QADTO> charBot(@RequestBody QAVO qavo) {
+        return RespDTO.onSuc(qaFacade.charBot(qavo));
+    }
+}

+ 1 - 1
ltkg-service/src/main/resources/mapper/KgMapper.xml

@@ -38,7 +38,7 @@
     <select id="getGraph" parameterType='com.diagbot.vo.KgQueryVO' resultMap="GraphResultMap">
         MATCH (n:${labelName})-[r]->(m)
         where n.name = #{inputStr}
-        OPTIONAL MATCH p=(m)-[]->(o) where head(Labels(m)) in ["diagnose","symptom"]
+        OPTIONAL MATCH p=(m)-[]->(o) where head(Labels(m)) in ["疾病","症状","药品通用名"]
         RETURN head(Labels(n)) as sLabel,n.name as sName,Type (r) as rType, head(Labels(m)) as eLabel,m.name as eName, count(p) as pCount
         ORDER BY rType
         LIMIT 100

+ 11 - 0
mrman-service/pom.xml

@@ -169,6 +169,17 @@
             <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
         </dependency>
 
+        <!--redis设置-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <!-- 必须加上,jedis依赖此  -->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 169 - 0
mrman-service/src/main/java/com/diagbot/config/RedisConfigurer.java

@@ -0,0 +1,169 @@
+package com.diagbot.config;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cache.CacheManager;
+import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.cache.interceptor.KeyGenerator;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.data.redis.cache.RedisCacheConfiguration;
+import org.springframework.data.redis.cache.RedisCacheManager;
+import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
+import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration;
+import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
+import org.springframework.data.redis.connection.lettuce.LettucePoolingClientConfiguration;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.RedisSerializationContext;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+import java.time.Duration;
+
+@Configuration
+@EnableCaching
+@Slf4j
+public class RedisConfigurer extends CachingConfigurerSupport {
+
+    @Value("${spring.redis.database.cache}")
+    private String databaseCache;
+    @Value("${spring.redis.host}")
+    private String host;
+    @Value("${spring.redis.password}")
+    private String password;
+    @Value("${spring.redis.port}")
+    private int port;
+    @Value("${spring.redis.timeout}")
+    private int timeout;
+    @Value("${spring.redis.lettuce.pool.max-active}")
+    private int maxActive;
+    @Value("${spring.redis.lettuce.pool.max-idle}")
+    private int maxIdle;
+    @Value("${spring.redis.lettuce.pool.max-wait}")
+    private long maxWaitMillis;
+    @Value("${spring.redis.lettuce.pool.min-idle}")
+    private int minIdle;
+
+    @Autowired
+    @Qualifier("factoryForCache")
+    private LettuceConnectionFactory lettuceConnectionFactory;
+
+    @Bean
+    public GenericObjectPoolConfig getRedisConfig() {
+        GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
+        poolConfig.setMaxTotal(maxActive);
+        poolConfig.setMaxIdle(maxIdle);
+        poolConfig.setMaxWaitMillis(maxWaitMillis);
+        poolConfig.setMinIdle(minIdle);
+        return poolConfig;
+    }
+
+    @Bean
+    @Override
+    public CacheManager cacheManager() {
+        RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig()
+                // 设置 key为string序列化
+                .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer()))
+                // 设置value为json序列化
+                .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(getSerializer()))
+                // 不缓存空值
+                .disableCachingNullValues();
+        RedisCacheManager cacheManager = RedisCacheManager.builder(lettuceConnectionFactory)
+                .cacheDefaults(redisCacheConfiguration)
+                .transactionAware()
+                .build();
+        cacheManager.afterPropertiesSet();
+        log.info("RedisCacheManager config success");
+        return cacheManager;
+    }
+
+    @Bean(name = "springSessionDefaultRedisSerializer")
+    public GenericJackson2JsonRedisSerializer getGenericJackson2JsonRedisSerializer() {
+        return new GenericJackson2JsonRedisSerializer();
+    }
+
+    /**
+     * 缓存使用的redis
+     *
+     * @return
+     */
+    @Bean("factoryForCache")
+    @Primary
+    public LettuceConnectionFactory redisConnectionFactory() {
+        return getRedisConnectionFactory(Integer.valueOf(databaseCache));
+    }
+
+    @Bean
+    public RedisTemplate<String, Object> redisTemplate() {
+        return getRedisTemplate(lettuceConnectionFactory);
+    }
+
+    private Jackson2JsonRedisSerializer getSerializer() {
+        Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
+        ObjectMapper om = new ObjectMapper();
+        om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+        om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+        jackson2JsonRedisSerializer.setObjectMapper(om);
+        return jackson2JsonRedisSerializer;
+    }
+
+    @Bean
+    @Override
+    public KeyGenerator keyGenerator() {
+        //  设置自动key的生成规则,配置spring boot的注解,进行方法级别的缓存
+        // 使用:进行分割,可以很多显示出层级关系
+        // 这里其实就是new了一个KeyGenerator对象
+        return (target, method, params) -> {
+            StringBuilder sb = new StringBuilder();
+            sb.append(target.getClass().getName());
+            sb.append(":");
+            sb.append(method.getName());
+            for (Object obj : params) {
+                sb.append(":" + String.valueOf(obj));
+            }
+            String rsToUse = String.valueOf(sb);
+            log.info("自动生成Redis Key -> [{}]", rsToUse);
+            return rsToUse;
+        };
+    }
+
+    private LettuceConnectionFactory getRedisConnectionFactory(Integer database) {
+        RedisStandaloneConfiguration connection = new RedisStandaloneConfiguration();
+        connection.setHostName(host);
+        connection.setPort(port);
+        connection.setPassword(password);
+        connection.setDatabase(database);
+        GenericObjectPoolConfig poolConfig = getRedisConfig();
+        LettuceClientConfiguration builder = LettucePoolingClientConfiguration.builder()
+                .commandTimeout(Duration.ofMillis(timeout))
+                .poolConfig(poolConfig)
+                .shutdownTimeout(Duration.ZERO)
+                .build();
+        LettuceConnectionFactory factory = new LettuceConnectionFactory(connection, builder);
+        return factory;
+    }
+
+    private RedisTemplate<String, Object> getRedisTemplate(LettuceConnectionFactory factory) {
+        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
+        redisTemplate.setConnectionFactory(factory);
+
+        // value值的序列化
+        redisTemplate.setValueSerializer(getSerializer());
+        redisTemplate.setHashValueSerializer(getSerializer());
+        // key的序列化采用StringRedisSerializer
+        redisTemplate.setKeySerializer(new StringRedisSerializer());
+        redisTemplate.setHashKeySerializer(new StringRedisSerializer());
+        redisTemplate.afterPropertiesSet();
+        return redisTemplate;
+    }
+}
+ 

+ 38 - 0
mrman-service/src/main/java/com/diagbot/dto/QcCasesEntrySimpleDTO.java

@@ -0,0 +1,38 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author zhoutg
+ * @Description:
+ * @date 2020-04-27 10:09
+ */
+@Setter
+@Getter
+public class QcCasesEntrySimpleDTO {
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 条目
+     */
+    private String name;
+
+    /**
+     * 0-未启用 1-启用
+     */
+    private String isUsed;
+
+    /**
+     * modeName
+     */
+    private String modeName;
+
+    /**
+     * 是否勾选
+     */
+    private Integer sel;
+}

+ 25 - 0
mrman-service/src/main/java/com/diagbot/dto/QcTypeDTO.java

@@ -0,0 +1,25 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author: ztg
+ * @Date: 2018/10/24 16:11
+ */
+@Getter
+@Setter
+public class QcTypeDTO {
+    // 主键
+    private Long id;
+    // 医院ID
+    private Long hospitalId;
+    // 质控类型名称
+    private String name;
+    // 质控类型和质控条目对应关系
+    private Map<String, List<QcCasesEntrySimpleDTO>> entryMap;
+}

+ 66 - 0
mrman-service/src/main/java/com/diagbot/dto/QcTypePageDTO.java

@@ -0,0 +1,66 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 质控类型标准
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-05-14
+ */
+@Data
+public class QcTypePageDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 医院ID
+     */
+    private Long hospitalId;
+
+    /**
+     * 质控类型名称
+     */
+    private String name;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+}

+ 69 - 0
mrman-service/src/main/java/com/diagbot/entity/QcType.java

@@ -0,0 +1,69 @@
+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;
+
+/**
+ * <p>
+ * 质控类型标准
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-05-14
+ */
+@Data
+public class QcType implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 医院ID
+     */
+    private Long hospitalId;
+
+    /**
+     * 质控类型名称
+     */
+    private String name;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+}

+ 69 - 0
mrman-service/src/main/java/com/diagbot/entity/QcTypeCasesEntry.java

@@ -0,0 +1,69 @@
+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;
+
+/**
+ * <p>
+ * 质控类型和质控条目关联表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-05-14
+ */
+@Data
+public class QcTypeCasesEntry implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 质控类型ID
+     */
+    private Long typeId;
+
+    /**
+     * 条目数据ID
+     */
+    private Long caseEntryId;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+}

+ 23 - 0
mrman-service/src/main/java/com/diagbot/facade/CacheFacade.java

@@ -0,0 +1,23 @@
+package com.diagbot.facade;
+
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2018/11/23 11:37
+ */
+@Component
+public class CacheFacade {
+
+    /**
+     * 清除缓存信息
+     *
+     * @return
+     */
+    @CacheEvict(value = "cache",  allEntries = true)
+    public void clear() {
+
+    }
+}

+ 14 - 1
mrman-service/src/main/java/com/diagbot/facade/QcCacesEntryFacade.java

@@ -6,16 +6,19 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.GetUpdateInfoDTO;
 import com.diagbot.dto.GetUpdateInfoDetialDTO;
 import com.diagbot.dto.QcCasesEntryAllDTO;
+import com.diagbot.dto.QcCasesEntrySimpleDTO;
 import com.diagbot.dto.QcHospitalInfoAllDTO;
 import com.diagbot.entity.CasesEntryHospital;
 import com.diagbot.entity.QcCasesEntry;
 import com.diagbot.entity.QcQuestionEntry;
+import com.diagbot.entity.QcTypeCasesEntry;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.service.impl.QcCasesEntryServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.vo.GetUpdateInfoVO;
 import com.diagbot.vo.QcCasesEntryAllVO;
 import com.diagbot.vo.QcCasesEntryIndexVO;
+import com.diagbot.vo.QcEntryHospitalVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -39,6 +42,8 @@ public class QcCacesEntryFacade extends QcCasesEntryServiceImpl {
     private BasHospitalInfoFacade qcHospitalInfoFacade;
     @Autowired
     QcQuestionEntryFacade qcQuestionEntryFacade;
+    @Autowired
+    QcTypeCasesEntryFacade qcTypeCasesEntryFacade;
 
     /**
      * 分页获取病例条目
@@ -117,8 +122,16 @@ public class QcCacesEntryFacade extends QcCasesEntryServiceImpl {
         qcQuescQuestionInfoUpdate
                 .eq("cases_entry_id",getUpdateInfoVO.getId());
         qcQuestionEntryFacade.remove(qcQuescQuestionInfoUpdate);
-
+        //删除质控类型
+        UpdateWrapper<QcTypeCasesEntry> qcTypeCasesEntryUpdateWrapper = new UpdateWrapper<>();
+        qcTypeCasesEntryUpdateWrapper
+                .eq("case_entry_id",getUpdateInfoVO.getId());
+        qcTypeCasesEntryFacade.remove(qcTypeCasesEntryUpdateWrapper);
         return res;
 
     }
+
+    public List<QcCasesEntrySimpleDTO> getEntryByHospitalFac(QcEntryHospitalVO qcEntryHospitalVO) {
+        return this.getEntryByHospital(qcEntryHospitalVO);
+    }
 }

+ 6 - 0
mrman-service/src/main/java/com/diagbot/facade/QcModuleInfoFacade.java

@@ -49,6 +49,8 @@ public class QcModuleInfoFacade extends QcModuleInfoServiceImpl {
     DictionaryFacade dictionaryFacade;
     @Autowired
     QcQuestionFacade qcQuestionFacade;
+    @Autowired
+    CacheFacade cacheFacade;
 
     /**
      * 根据id删除标签模板
@@ -68,6 +70,8 @@ public class QcModuleInfoFacade extends QcModuleInfoServiceImpl {
         this.deleteByIds(paramMap);
         //删除明细表
         qcModuleDetailFacade.deleteByModuleIdFac(paramMap);
+        // 清除缓存
+        cacheFacade.clear();
         return true;
     }
 
@@ -120,6 +124,8 @@ public class QcModuleInfoFacade extends QcModuleInfoServiceImpl {
             BeanUtil.copyProperties(addModulInfoVO, updateModuleInfoVO);
             bac = this.updateModuleInfo(updateModuleInfoVO);
         }
+
+        cacheFacade.clear();
         return bac;
     }
 

+ 7 - 0
mrman-service/src/main/java/com/diagbot/facade/QcQuestionFacade.java

@@ -75,6 +75,8 @@ public class QcQuestionFacade extends QcQuestionInfoServiceImpl {
     @Autowired
     @Qualifier("qcQuestionEntryServiceImpl")
     QcQuestionEntryService questionEntryService;
+    @Autowired
+    CacheFacade cacheFacade;
 
     /**
      * 标签保存
@@ -90,6 +92,8 @@ public class QcQuestionFacade extends QcQuestionInfoServiceImpl {
         saveQuestionMapping(questionWrapper, param);
         // 保存标签和条目映射表
         saveQuestionEntry(questionWrapper.getQuesCasesEntryVOList(), param);
+        // 清除缓存
+        cacheFacade.clear();
     }
 
     /**
@@ -318,6 +322,9 @@ public class QcQuestionFacade extends QcQuestionInfoServiceImpl {
             //删除映射关系
             qcQuestionMappingFacade.deleteByIdsFac(paramMap);
         }
+
+        // 清除缓存
+        cacheFacade.clear();
         return true;
     }
 

+ 21 - 0
mrman-service/src/main/java/com/diagbot/facade/QcTypeCasesEntryFacade.java

@@ -0,0 +1,21 @@
+package com.diagbot.facade;
+
+import com.diagbot.dto.QcCasesEntrySimpleDTO;
+import com.diagbot.service.impl.QcTypeCasesEntryServiceImpl;
+import com.diagbot.vo.QcTypeVO;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @author zhoutg
+ * @Description:
+ * @date 2020-03-10 16:32
+ */
+@Component
+public class QcTypeCasesEntryFacade extends QcTypeCasesEntryServiceImpl {
+
+    public List<QcCasesEntrySimpleDTO> getByTypeIdFac(QcTypeVO qcTypeVO) {
+        return this.getByTypeId(qcTypeVO);
+    }
+}

+ 252 - 0
mrman-service/src/main/java/com/diagbot/facade/QcTypeFacade.java

@@ -0,0 +1,252 @@
+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.client.UserServiceClient;
+import com.diagbot.dto.QcCasesEntrySimpleDTO;
+import com.diagbot.dto.QcTypeDTO;
+import com.diagbot.dto.QcTypePageDTO;
+import com.diagbot.entity.CommonParam;
+import com.diagbot.entity.QcType;
+import com.diagbot.entity.QcTypeCasesEntry;
+import com.diagbot.enums.InsertOrUpdateEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.QcTypeCasesEntryService;
+import com.diagbot.service.impl.QcTypeServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.UserUtils;
+import com.diagbot.vo.DeleteQcTypeVO;
+import com.diagbot.vo.QcEntryHospitalVO;
+import com.diagbot.vo.QcTypeCasesEntryVO;
+import com.diagbot.vo.QcTypeIndexVO;
+import com.diagbot.vo.QcTypePageVO;
+import com.diagbot.vo.QcTypeSaveVO;
+import com.diagbot.vo.QcTypeVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2018/11/23 11:37
+ */
+@Component
+public class QcTypeFacade extends QcTypeServiceImpl {
+
+
+    @Autowired
+    @Qualifier("qcTypeCasesEntryServiceImpl")
+    QcTypeCasesEntryService qcTypeCasesEntryService;
+    @Autowired
+    UserServiceClient userServiceClient;
+    @Autowired
+    QcCacesEntryFacade qcCacesEntryFacade;
+    @Autowired
+    QcTypeCasesEntryFacade qcTypeCasesEntryFacade;
+
+    /**
+     * 保存
+     *
+     * @param qcTypeSaveVO
+     */
+    public void saveOrUpdate(QcTypeSaveVO qcTypeSaveVO) {
+        CommonParam param = initCommonParam();
+        // 保存主表
+        saveQcType(qcTypeSaveVO, param);
+        // 保存质控类型和质控条目映射关系
+        saveQcTypeCasesEntry(qcTypeSaveVO, param);
+    }
+
+    /**
+     * 初始化参数
+     *
+     * @return
+     */
+    public CommonParam initCommonParam() {
+        CommonParam param = new CommonParam();
+        String person = UserUtils.getCurrentPrincipleID();
+        param.setNow(DateUtil.now());
+        param.setPerson(person);
+        param.setInsertOrUpdate(InsertOrUpdateEnum.Insert.getKey());
+        return param;
+    }
+
+    /**
+     * 保存映射关系
+     *
+     * @param qcTypeSaveVO
+     * @param param
+     */
+    public void saveQcTypeCasesEntry(QcTypeSaveVO qcTypeSaveVO, CommonParam param) {
+        Date now = param.getNow();
+        String person = param.getPerson();
+        // 先删除原明细(物理删除)
+        qcTypeCasesEntryService.remove(new QueryWrapper<QcTypeCasesEntry>()
+            .eq("type_id", qcTypeSaveVO.getId())
+        );
+        // 再插入新明细
+        List<QcTypeCasesEntryVO> qcTypeCasesEntryVOList = qcTypeSaveVO.getQcTypeCasesEntryVOList();
+        if (ListUtil.isNotEmpty(qcTypeCasesEntryVOList)) {
+            List<QcTypeCasesEntry> saveQcTypeCasesEntry = new ArrayList<>();
+            for (QcTypeCasesEntryVO mapping : qcTypeCasesEntryVOList) {
+                QcTypeCasesEntry bean = new QcTypeCasesEntry();
+                bean.setCaseEntryId(mapping.getCaseEntryId());
+                bean.setCreator(person);
+                bean.setGmtCreate(now);
+                bean.setModifier(person);
+                bean.setGmtModified(now);
+                bean.setTypeId(qcTypeSaveVO.getId());
+                saveQcTypeCasesEntry.add(bean);
+            }
+            qcTypeCasesEntryService.saveBatch(saveQcTypeCasesEntry);
+        }
+    }
+
+    /**
+     * 保存主表
+     *
+     * @param qcTypeSaveVO
+     * @param param
+     */
+    public void saveQcType(QcTypeSaveVO qcTypeSaveVO, CommonParam param) {
+        QcType qcType = new QcType();
+        Long id = qcTypeSaveVO.getId();
+
+        // 保存主表
+        if (qcTypeSaveVO.getId() != null) {
+            qcType = this.getOne(new QueryWrapper<QcType>()
+                    .eq("id", id)
+                    .eq("is_deleted", IsDeleteEnum.N.getKey()), false);
+            if (qcType == null) { //校验
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前质控类型不存在【id=" + id + "】");
+            }
+        }
+        BeanUtil.copyProperties(qcTypeSaveVO, qcType);
+        List<QcType> qcTypeList = this.list(new QueryWrapper<QcType>()
+                .eq("name", qcTypeSaveVO.getName())
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", qcTypeSaveVO.getHospitalId())
+                .ne("id", id == null ? -1 : id));
+        // 质控类型hospitalId、name唯一
+        if (ListUtil.isNotEmpty(qcTypeList)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "质控类型已存在");
+        }
+        if (InsertOrUpdateEnum.Insert.getKey() == param.getInsertOrUpdate()) {
+            qcType.setCreator(param.getPerson()); //创建人
+            qcType.setGmtCreate(param.getNow());//创建时间
+        }
+        qcType.setGmtModified(param.getNow());//修改时间
+        qcType.setModifier(param.getPerson());//修改人
+        this.saveOrUpdate(qcType);
+        qcTypeSaveVO.setId(qcType.getId());
+    }
+
+    /**
+     * 标签列表
+     *
+     * @param qcTypePageVO
+     * @return
+     */
+    public IPage<QcTypePageDTO> getListFac(QcTypePageVO qcTypePageVO) {
+        IPage<QcTypePageDTO> res = this.getList(qcTypePageVO);
+//        if (res.getTotal() <= 0) {
+//            return res;
+//        }
+//        List<String> personIds = res.getRecords().stream().map(row -> row.getModifier()).collect(Collectors.toList());
+//        RespDTO<Map<String, String>> mapRespDTO = userServiceClient.getUserInfoByIds(personIds);
+//        if (mapRespDTO == null || !CommonErrorCode.OK.getCode().equals(mapRespDTO.code)) {
+//            throw new CommonException(CommonErrorCode.RPC_ERROR, "获取操作人失败");
+//        }
+//        for (QuestionPageDTO bean : res.getRecords()) {
+//            bean.setModifier(mapRespDTO.data.get(bean.getModifier()));
+//        }
+        return res;
+    }
+
+    /**
+     * 新增时质控条目分组信息
+     *
+     * @param qcEntryHospitalVO
+     * @return
+     */
+    public Map<String, List<QcCasesEntrySimpleDTO>> getEntryByHospital(@RequestBody QcEntryHospitalVO qcEntryHospitalVO) {
+        List<QcCasesEntrySimpleDTO> qcCasesEntrySimpleDTOList = qcCacesEntryFacade.getEntryByHospitalFac(qcEntryHospitalVO);
+        return EntityUtil.makeEntityListMap(qcCasesEntrySimpleDTOList, "modeName");
+    }
+
+    /**
+     * 检索
+     *
+     * @param qcTypeIndexVO
+     * @return
+     */
+    public List<QcCasesEntrySimpleDTO> indexFac(QcTypeIndexVO qcTypeIndexVO) {
+        List<QcCasesEntrySimpleDTO> res = qcCacesEntryFacade.index(qcTypeIndexVO);
+        return res;
+    }
+
+    /**
+     * 根据参数返回质控类型内容
+     *
+     * @param qcTypeVO 获取质控类型内容参数
+     * @return 标签内容
+     */
+    public QcTypeDTO getById(QcTypeVO qcTypeVO) {
+        QcTypeDTO qcTypeDTO = new QcTypeDTO();
+        QcType qcType = this.getOne(new QueryWrapper<QcType>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("id", qcTypeVO.getId()), false
+        );
+        if (qcType == null) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "当前质控类型不存在或已删除【id=" + qcTypeVO.getId() + "】");
+        }
+        BeanUtil.copyProperties(qcType, qcTypeDTO);
+        List<QcCasesEntrySimpleDTO> list = qcTypeCasesEntryFacade.getByTypeIdFac(qcTypeVO);
+        Map<String, List<QcCasesEntrySimpleDTO>> entryMap = EntityUtil.makeEntityListMap(list, "modeName");
+        qcTypeDTO.setEntryMap(entryMap);
+        return qcTypeDTO;
+    }
+
+    /**
+     * 根据id删除质控类型
+     *
+     * @param deleteQcTypeVO
+     * @return
+     */
+    public Boolean deleteByIdsFac(DeleteQcTypeVO deleteQcTypeVO) {
+        Date now = DateUtil.now();
+        String person = UserUtils.getCurrentPrincipleID();
+        // 更新主表
+        this.update(new UpdateWrapper<QcType>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("id", deleteQcTypeVO.getIds())
+                .set("is_deleted", IsDeleteEnum.Y.getKey())
+                .set("gmt_modified", now)
+                .set("modifier", person)
+        );
+
+        // 删除明细表
+        qcTypeCasesEntryService.removeByIds(deleteQcTypeVO.getIds());
+        if (ListUtil.isNotEmpty(deleteQcTypeVO.getIds())) {
+            qcTypeCasesEntryService.remove(new QueryWrapper<QcTypeCasesEntry>()
+                    .in("type_id", deleteQcTypeVO.getIds())
+            );
+        }
+        return true;
+    }
+
+}

+ 7 - 0
mrman-service/src/main/java/com/diagbot/mapper/QcCasesEntryMapper.java

@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.QcCasesEntryAllDTO;
 import com.diagbot.dto.QcCasesEntryDTO;
+import com.diagbot.dto.QcCasesEntrySimpleDTO;
 import com.diagbot.entity.QcCasesEntry;
 import com.diagbot.vo.QcCasesEntryAllVO;
 import com.diagbot.vo.QcCasesEntryIndexVO;
+import com.diagbot.vo.QcEntryHospitalVO;
+import com.diagbot.vo.QcTypeIndexVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -34,4 +37,8 @@ public interface QcCasesEntryMapper extends BaseMapper<QcCasesEntry> {
     List<QcCasesEntryDTO> getByCasesEntryId( @Param("ids") List<Long> ids);
 
     List<QcCasesEntryDTO> getQcCasesEntryAll();
+
+    public List<QcCasesEntrySimpleDTO> index(QcTypeIndexVO qcTypeIndexVO);
+
+    public List<QcCasesEntrySimpleDTO> getEntryByHospital(QcEntryHospitalVO qcEntryHospitalVO);
 }

+ 21 - 0
mrman-service/src/main/java/com/diagbot/mapper/QcTypeCasesEntryMapper.java

@@ -0,0 +1,21 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.dto.QcCasesEntrySimpleDTO;
+import com.diagbot.entity.QcTypeCasesEntry;
+import com.diagbot.vo.QcTypeVO;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 质控类型和质控条目关联表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-05-14
+ */
+public interface QcTypeCasesEntryMapper extends BaseMapper<QcTypeCasesEntry> {
+
+    public List<QcCasesEntrySimpleDTO> getByTypeId(QcTypeVO qcTypeVO);
+}

+ 26 - 0
mrman-service/src/main/java/com/diagbot/mapper/QcTypeMapper.java

@@ -0,0 +1,26 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.QcTypePageDTO;
+import com.diagbot.entity.QcType;
+import com.diagbot.vo.QcTypePageVO;
+
+/**
+ * <p>
+ * 质控类型标准 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-05-14
+ */
+public interface QcTypeMapper extends BaseMapper<QcType> {
+
+    /**
+     * 获取标签列表
+     *
+     * @param qcTypePageVO
+     * @return
+     */
+    IPage<QcTypePageDTO> getList(QcTypePageVO qcTypePageVO);
+}

+ 7 - 0
mrman-service/src/main/java/com/diagbot/service/QcCasesEntryService.java

@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.dto.QcCasesEntryAllDTO;
 import com.diagbot.dto.QcCasesEntryDTO;
+import com.diagbot.dto.QcCasesEntrySimpleDTO;
 import com.diagbot.entity.QcCasesEntry;
 import com.diagbot.vo.QcCasesEntryAllVO;
 import com.diagbot.vo.QcCasesEntryIndexVO;
+import com.diagbot.vo.QcEntryHospitalVO;
+import com.diagbot.vo.QcTypeIndexVO;
 
 import java.util.List;
 
@@ -34,4 +37,8 @@ public interface QcCasesEntryService extends IService<QcCasesEntry> {
     List<QcCasesEntryDTO> getByCasesEntryId(List<Long> ids);
 
     List<QcCasesEntryDTO> getQcCasesEntryAll();
+
+    public List<QcCasesEntrySimpleDTO> index(QcTypeIndexVO qcTypeIndexVO);
+
+    public List<QcCasesEntrySimpleDTO> getEntryByHospital(QcEntryHospitalVO qcEntryHospitalVO);
 }

+ 21 - 0
mrman-service/src/main/java/com/diagbot/service/QcTypeCasesEntryService.java

@@ -0,0 +1,21 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.QcCasesEntrySimpleDTO;
+import com.diagbot.entity.QcTypeCasesEntry;
+import com.diagbot.vo.QcTypeVO;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 质控类型和质控条目关联表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-05-14
+ */
+public interface QcTypeCasesEntryService extends IService<QcTypeCasesEntry> {
+
+    public List<QcCasesEntrySimpleDTO> getByTypeId(QcTypeVO qcTypeVO);
+}

+ 20 - 0
mrman-service/src/main/java/com/diagbot/service/QcTypeService.java

@@ -0,0 +1,20 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.QcTypePageDTO;
+import com.diagbot.entity.QcType;
+import com.diagbot.vo.QcTypePageVO;
+
+/**
+ * <p>
+ * 质控类型标准 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-05-14
+ */
+public interface QcTypeService extends IService<QcType> {
+
+    IPage<QcTypePageDTO> getList(QcTypePageVO qcTypePageVO);
+}

+ 13 - 0
mrman-service/src/main/java/com/diagbot/service/impl/QcCasesEntryServiceImpl.java

@@ -4,11 +4,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.QcCasesEntryAllDTO;
 import com.diagbot.dto.QcCasesEntryDTO;
+import com.diagbot.dto.QcCasesEntrySimpleDTO;
 import com.diagbot.entity.QcCasesEntry;
 import com.diagbot.mapper.QcCasesEntryMapper;
 import com.diagbot.service.QcCasesEntryService;
 import com.diagbot.vo.QcCasesEntryAllVO;
 import com.diagbot.vo.QcCasesEntryIndexVO;
+import com.diagbot.vo.QcEntryHospitalVO;
+import com.diagbot.vo.QcTypeIndexVO;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -43,4 +46,14 @@ public class QcCasesEntryServiceImpl extends ServiceImpl<QcCasesEntryMapper, QcC
     public List<QcCasesEntryDTO> getQcCasesEntryAll() {
         return baseMapper.getQcCasesEntryAll();
     }
+
+    @Override
+    public List<QcCasesEntrySimpleDTO> index(QcTypeIndexVO qcTypeIndexVO) {
+        return baseMapper.index(qcTypeIndexVO);
+    }
+
+    @Override
+    public List<QcCasesEntrySimpleDTO> getEntryByHospital(QcEntryHospitalVO qcEntryHospitalVO) {
+        return baseMapper.getEntryByHospital(qcEntryHospitalVO);
+    }
 }

+ 28 - 0
mrman-service/src/main/java/com/diagbot/service/impl/QcTypeCasesEntryServiceImpl.java

@@ -0,0 +1,28 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.dto.QcCasesEntrySimpleDTO;
+import com.diagbot.entity.QcTypeCasesEntry;
+import com.diagbot.mapper.QcTypeCasesEntryMapper;
+import com.diagbot.service.QcTypeCasesEntryService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.QcTypeVO;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 质控类型和质控条目关联表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-05-14
+ */
+@Service
+public class QcTypeCasesEntryServiceImpl extends ServiceImpl<QcTypeCasesEntryMapper, QcTypeCasesEntry> implements QcTypeCasesEntryService {
+
+    @Override
+    public List<QcCasesEntrySimpleDTO> getByTypeId(QcTypeVO qcTypeVO) {
+        return baseMapper.getByTypeId(qcTypeVO);
+    }
+}

+ 27 - 0
mrman-service/src/main/java/com/diagbot/service/impl/QcTypeServiceImpl.java

@@ -0,0 +1,27 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.QcTypePageDTO;
+import com.diagbot.entity.QcType;
+import com.diagbot.mapper.QcTypeMapper;
+import com.diagbot.service.QcTypeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.QcTypePageVO;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 质控类型标准 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-05-14
+ */
+@Service
+public class QcTypeServiceImpl extends ServiceImpl<QcTypeMapper, QcType> implements QcTypeService {
+
+    @Override
+    public IPage<QcTypePageDTO> getList(QcTypePageVO qcTypePageVO) {
+        return baseMapper.getList(qcTypePageVO);
+    }
+}

+ 19 - 0
mrman-service/src/main/java/com/diagbot/vo/DeleteQcTypeVO.java

@@ -0,0 +1,19 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotEmpty;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: ztg
+ * @time: 2019/1/28 15:45
+ */
+@Getter
+@Setter
+public class DeleteQcTypeVO {
+    @NotEmpty(message = "ids不能为空")
+    private List<Long> ids;
+}

+ 16 - 0
mrman-service/src/main/java/com/diagbot/vo/QcEntryHospitalVO.java

@@ -0,0 +1,16 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2018/11/29 15:09
+ */
+@Getter
+@Setter
+public class QcEntryHospitalVO {
+    // 医院id
+    private Long hospitalId;
+}

+ 15 - 0
mrman-service/src/main/java/com/diagbot/vo/QcTypeCasesEntryVO.java

@@ -0,0 +1,15 @@
+package com.diagbot.vo;
+
+import lombok.Data;
+
+/**
+ * @Description:
+ * @Author: ztg
+ * @Date: 2018/10/24 16:11
+ */
+@Data
+public class QcTypeCasesEntryVO {
+
+    // 质控条目id
+    private Long caseEntryId;
+}

+ 22 - 0
mrman-service/src/main/java/com/diagbot/vo/QcTypeIndexVO.java

@@ -0,0 +1,22 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2018/11/29 15:09
+ */
+@Getter
+@Setter
+public class QcTypeIndexVO {
+    // 界面输入
+    private String input;
+    // 医院id
+    private Long hospitalId;
+    // 过滤caseEntryId
+    private List<Long> notIds;
+}

+ 20 - 0
mrman-service/src/main/java/com/diagbot/vo/QcTypePageVO.java

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 质控类型列表入参
+ * @Author: ztg
+ * @Date: 2018/12/13 10:07
+ */
+@Getter
+@Setter
+public class QcTypePageVO extends Page {
+
+    // 名称
+    private String name;
+    // 医院id
+    private Long hospitalId;
+}

+ 24 - 0
mrman-service/src/main/java/com/diagbot/vo/QcTypeSaveVO.java

@@ -0,0 +1,24 @@
+package com.diagbot.vo;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description: 质控类型保存入参
+ * @Author: ztg
+ * @Date: 2018/10/24 16:11
+ */
+@Data
+public class QcTypeSaveVO {
+
+    // 主键
+    private Long id;
+    // 医院ID
+    private Long hospitalId;
+    // 质控类型名称
+    private String name;
+    // 质控类型和质控条目关联信息
+    private List<QcTypeCasesEntryVO> qcTypeCasesEntryVOList = new ArrayList<>();
+}

+ 16 - 0
mrman-service/src/main/java/com/diagbot/vo/QcTypeVO.java

@@ -0,0 +1,16 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2018/8/6 10:16
+ */
+@Getter
+@Setter
+public class QcTypeVO {
+    private Long id;
+    private Long hospitalId;
+}

+ 7 - 1
mrman-service/src/main/java/com/diagbot/vo/QuestionPageVO.java

@@ -15,10 +15,16 @@ import java.util.List;
 @Setter
 public class QuestionPageVO extends Page {
 
+    // 备注名称
     private String tagName;
+    // 标签标识(1:单标签 4:组合标签)
     private List<Integer> tagTypeList;
+    // 控件类型,暂无用
     private List<Integer> controlTypeList;
-    private String name;//界面名称
+    // 显示名称
+    private String name;
+    // 医院ID
     private Long hospitalId;
+    // 模块id
     private Long modeId;
 }

+ 39 - 0
mrman-service/src/main/java/com/diagbot/web/CacheController.java

@@ -0,0 +1,39 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.CacheFacade;
+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;
+
+/**
+ * <p>
+ * 缓存 前端控制器
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-25
+ */
+@RequestMapping("/cache")
+@RestController
+@SuppressWarnings("unchecked")
+@Api(value = "缓存API", tags = { "缓存API" })
+public class CacheController {
+
+
+    @Autowired
+    CacheFacade cacheFacade;
+
+    @ApiOperation(value = "清除缓存[by:zhoutg]",
+            notes = "")
+    @PostMapping("/clear")
+    @SysLogger("clear")
+    public RespDTO<Boolean> clear() {
+        cacheFacade.clear();
+        return RespDTO.onSuc(true);
+    }
+}

+ 11 - 1
mrman-service/src/main/java/com/diagbot/web/QcQuestionInfoController.java

@@ -55,7 +55,16 @@ public class QcQuestionInfoController {
 
 
     @ApiOperation(value = "标签分页列表[by:zhoutg]",
-            notes = "")
+            notes = "// 备注名称\n" +
+                    " String tagName;\n" +
+                    "// 标签标识(1:单标签 4:组合标签)\n" +
+                    " List<Integer> tagTypeList;\n" +
+                    "// 显示名称\n" +
+                    " String name;\n" +
+                    "// 医院ID\n" +
+                    " Long hospitalId;\n" +
+                    "// 模块id\n" +
+                    " Long modeId;")
     @PostMapping("/page")
     @SysLogger("page")
     public RespDTO<IPage<QuestionPageDTO>> list(@RequestBody QuestionPageVO questionPageVO) {
@@ -103,6 +112,7 @@ public class QcQuestionInfoController {
     @ApiOperation(value = "查询多个id返回标签内容[by:zhoutg]",
             notes = "ids: 多个questionId<br>")
     @PostMapping("/getByIds")
+    @SysLogger("getByIds")
     public RespDTO<Map<Long, QuestionDTO>> getByIds(@RequestBody QuestionIdsVO questionIdsVO) {
         Map<Long, QuestionDTO> data = qcQuestionFacade.getByIds(questionIdsVO);
         return RespDTO.onSuc(data);

+ 110 - 0
mrman-service/src/main/java/com/diagbot/web/QcTypeController.java

@@ -0,0 +1,110 @@
+package com.diagbot.web;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.QcCasesEntrySimpleDTO;
+import com.diagbot.dto.QcTypeDTO;
+import com.diagbot.dto.QcTypePageDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.QcQuestionInfo;
+import com.diagbot.facade.QcTypeFacade;
+import com.diagbot.vo.DeleteQcTypeVO;
+import com.diagbot.vo.QcEntryHospitalVO;
+import com.diagbot.vo.QcTypeIndexVO;
+import com.diagbot.vo.QcTypePageVO;
+import com.diagbot.vo.QcTypeSaveVO;
+import com.diagbot.vo.QcTypeVO;
+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.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 质控类型标准 前端控制器
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-05-14
+ */
+@RestController
+@RequestMapping("/qc/qcType")
+@SuppressWarnings("unchecked")
+@Api(value = "质控类型相关API", tags = { "质控类型相关API" })
+public class QcTypeController {
+
+    @Autowired
+    QcTypeFacade qcTypeFacade;
+
+    @ApiOperation(value = "新增或更新[by:zhoutg]",
+            notes = "")
+    @PostMapping("/saveOrUpdate")
+    @SysLogger("saveOrUpdate")
+    @Transactional
+    public RespDTO<Boolean> saveOrUpdate(@RequestBody QcTypeSaveVO qcTypeSaveVO) {
+        qcTypeFacade.saveOrUpdate(qcTypeSaveVO);
+        return RespDTO.onSuc(true);
+    }
+
+    @ApiOperation(value = "分页列表[by:zhoutg]",
+            notes = "    // 名称\n" +
+                    "     String name;\n" +
+                    "    // 医院id\n" +
+                    "     Long hospitalId;")
+    @PostMapping("/page")
+    @SysLogger("page")
+    public RespDTO<IPage<QcTypePageDTO>> list(@RequestBody QcTypePageVO qcTypePageVO) {
+        IPage<QcTypePageDTO> data = qcTypeFacade.getListFac(qcTypePageVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "新增时质控条目分组信息[by:zhoutg]",
+            notes = "")
+    @PostMapping("/getEntryByHospital")
+    @SysLogger("getEntryByHospital")
+    public RespDTO<Map<String, List<QcCasesEntrySimpleDTO>>> getEntryByHospital(@RequestBody QcEntryHospitalVO qcEntryHospitalVO) {
+        Map<String, List<QcCasesEntrySimpleDTO>> data = qcTypeFacade.getEntryByHospital(qcEntryHospitalVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "质控条目检索[by:zhoutg]",
+            notes = "    // 界面输入\n" +
+                    "     String input;\n" +
+                    "    // 医院id\n" +
+                    "     Long hospitalId;\n" +
+                    "    // 过滤caseEntryId\n" +
+                    "     List<Long> notIds;")
+    @PostMapping("/index")
+    @SysLogger("index")
+    public RespDTO<List<QcQuestionInfo>> index(@RequestBody QcTypeIndexVO qcTypeIndexVO) {
+        List<QcCasesEntrySimpleDTO> data = qcTypeFacade.indexFac(qcTypeIndexVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "删除[by:zhoutg]",
+            notes = "")
+    @PostMapping("/delete")
+    @SysLogger("delete")
+    @Transactional
+    public RespDTO<Boolean> delete(@Valid @RequestBody DeleteQcTypeVO deleteQcTypeVO) {
+        qcTypeFacade.deleteByIdsFac(deleteQcTypeVO);
+        return RespDTO.onSuc(true);
+    }
+
+    @ApiOperation(value = "根据id返回内容[by:zhoutg]",
+            notes = "id: qcTypeId<br>" )
+    @PostMapping("/getById")
+    @SysLogger("getById")
+    public RespDTO<QcTypeDTO> getById(@RequestBody QcTypeVO qcTypeVO) {
+        QcTypeDTO data = qcTypeFacade.getById(qcTypeVO);
+        return RespDTO.onSuc(data);
+    }
+}

+ 42 - 0
mrman-service/src/main/resources/mapper/QcCasesEntryMapper.xml

@@ -103,4 +103,46 @@
         WHERE a.is_deleted = 'N'
         ORDER BY a.cases_id,a.id
     </select>
+
+    <select id="index" resultType="com.diagbot.dto.QcCasesEntrySimpleDTO">
+        SELECT distinct t3.msg name, t2.id
+        FROM
+            qc_cases_entry t2,
+            qc_cases_entry_hospital t3
+        where t2.is_deleted = 'N'
+            and t3.is_deleted = 'N'
+            and t2.id = t3.cases_entry_id
+            and t3.is_used = 1
+        <if test="hospitalId != null">
+            and t3.hospital_id = #{hospitalId}
+        </if>
+        <if test="input != null and input != ''">
+            and t2.name like concat('%', #{input}, '%')
+        </if>
+        <if test="notIds != null and notIds.size > 0">
+            and t2.id not in
+            <foreach item="item" collection="notIds" open="(" separator="," close=")" >
+                #{item}
+            </foreach>
+        </if>
+        order by t2.order_no
+    </select>
+    
+    <select id="getEntryByHospital" resultType="com.diagbot.dto.QcCasesEntrySimpleDTO">
+        SELECT
+            t1.`name`, t1.id, t3.`name` mode_name, t2.is_used, 1 as sel
+        FROM
+            qc_cases_entry t1,
+            qc_cases_entry_hospital t2,
+            qc_mode t3
+        WHERE
+            t1.is_deleted = 'N'
+        AND t2.is_deleted = 'N'
+        AND t3.is_deleted = 'N'
+        AND t1.id = t2.cases_entry_id
+        AND t2.is_used = 1
+        AND t1.mode_id = t3.id
+        AND t2.hospital_id = #{hospitalId}
+        ORDER BY t3.order_no,t1.order_no
+    </select>
 </mapper>

+ 0 - 1
mrman-service/src/main/resources/mapper/QcQuestionInfoMapper.xml

@@ -110,7 +110,6 @@
             </foreach>
         </if>
         order by a.gmt_modified desc
-
     </select>
 
     <select id="getParent"  resultMap="BaseResultMap">

+ 58 - 0
mrman-service/src/main/resources/mapper/QcTypeCasesEntryMapper.xml

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.QcTypeCasesEntryMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.QcTypeCasesEntry">
+        <id column="id" property="id" />
+        <result column="type_id" property="typeId" />
+        <result column="case_entry_id" property="caseEntryId" />
+        <result column="remark" property="remark" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+    </resultMap>
+
+    <select id="getByTypeId" resultType="com.diagbot.dto.QcCasesEntrySimpleDTO">
+        SELECT
+            a1.*,IF (a2.case_entry_id IS NULL,NULL,1) sel
+        FROM
+            (
+                SELECT
+                    t1.`name`,
+                    t1.id,
+                    t3.`name` mode_name,
+                    t2.is_used,
+                    t3.order_no mode_order,
+                    t1.order_no
+                FROM
+                    qc_cases_entry t1,
+                    qc_cases_entry_hospital t2,
+                    qc_mode t3
+                WHERE
+                    t1.is_deleted = 'N'
+                AND t2.is_deleted = 'N'
+                AND t3.is_deleted = 'N'
+                AND t1.id = t2.cases_entry_id
+                AND t1.mode_id = t3.id
+                AND t2.hospital_id = #{hospitalId}
+            ) a1
+        LEFT JOIN (
+            SELECT
+                q2.case_entry_id
+            FROM
+                qc_type q1,
+                qc_type_cases_entry q2
+            WHERE
+                q1.is_deleted = 'N'
+            AND q2.is_deleted = 'N'
+            AND q1.id = q2.type_id
+            AND q1.hospital_id = #{hospitalId}
+            AND q1.id = #{id}
+        ) a2 ON a1.id = a2.case_entry_id
+        ORDER BY a1.mode_order, a1.order_no
+    </select>
+
+</mapper>

+ 30 - 0
mrman-service/src/main/resources/mapper/QcTypeMapper.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.QcTypeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.QcType">
+        <id column="id" property="id" />
+        <result column="hospital_id" property="hospitalId" />
+        <result column="name" property="name" />
+        <result column="remark" property="remark" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+    </resultMap>
+
+    <!--分页-->
+    <select id="getList" resultType="com.diagbot.dto.QcTypePageDTO">
+        SELECT a.* FROM `qc_type` a
+        WHERE a.is_deleted = 'N'
+        <if test="hospitalId != null">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="name != null and name != ''">
+            AND UPPER(a.name) like concat ('%', UPPER(trim(#{name})), '%')
+        </if>
+        order by a.gmt_modified desc
+    </select>
+</mapper>

+ 1 - 1
mrman-service/src/test/java/com/diagbot/CodeGeneration.java

@@ -56,7 +56,7 @@ public class CodeGeneration {
         StrategyConfig strategy = new StrategyConfig();
 //        strategy.setTablePrefix(new String[] { "icss_" });// 此处可以修改为您的表前缀
          strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-        strategy.setInclude(new String[] { "qc_question_entry" }); // 需要生成的表
+        strategy.setInclude(new String[] { "qc_type", "qc_type_cases_entry" }); // 需要生成的表
 
         strategy.setSuperServiceClass(null);
         strategy.setSuperServiceImplClass(null);

+ 59 - 0
prec-service/src/main/java/com/diagbot/facade/PrecEncryptFacade.java

@@ -0,0 +1,59 @@
+package com.diagbot.facade;
+
+import com.diagbot.util.AESCipher;
+import com.diagbot.vo.PrecMapVO;
+import org.springframework.stereotype.Component;
+
+import java.text.ParseException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-05-11 15:08
+ */
+@Component
+public class PrecEncryptFacade {
+    private static final String IV_STRING = "z76rxggpnykxeyb1";
+
+
+    public PrecMapVO getEncryption(PrecMapVO precMapVO) {
+        //patientInfo  patientName
+        Map<String,String> map = precMapVO.getMap();
+        Map<String,String> mapNew =new HashMap<String, String>();
+        try {
+            for(String key : map.keySet()){
+                String value = map.get(key);
+                String aesEncrypValue = AESCipher.aesEncryptString(value,IV_STRING);
+                mapNew.put(key,aesEncrypValue);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        PrecMapVO data = new PrecMapVO();
+        data.setMap(mapNew);
+        return data;
+    }
+
+    public PrecMapVO getDecode(PrecMapVO precVO) {
+        //patientInfo  patientName
+        Map<String,String> map = precVO.getMap();
+        Map<String,String> mapNew =new HashMap<String, String>();
+        try {
+            for(String key : map.keySet()){
+                String value = map.get(key);
+                String aesEncrypValue = AESCipher.aesDecryptString(value,IV_STRING);
+                mapNew.put(key,aesEncrypValue);
+
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        PrecMapVO data = new PrecMapVO();
+        data.setMap(mapNew);
+        return data;
+    }
+}

+ 222 - 0
prec-service/src/main/java/com/diagbot/util/AESCipher.java

@@ -0,0 +1,222 @@
+package com.diagbot.util;
+
+import sun.misc.BASE64Decoder;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.text.ParseException;
+
+/**
+ * AES加密(指定一个初始化向量:IV_STRING,的加密方式)
+ *
+ * @author Administrator
+ */
+public class AESCipher {
+
+    private static final String IV_STRING = "z76rxggpnykxeyb1";
+
+    /**
+     * 加密
+     *
+     * @param content 加密内容
+     * @param key     加密秘钥
+     * @return
+     */
+    public static String aesEncryptString(String content, String key)
+            throws InvalidKeyException, NoSuchAlgorithmException,
+            NoSuchPaddingException, InvalidAlgorithmParameterException,
+            IllegalBlockSizeException, BadPaddingException,
+            UnsupportedEncodingException {
+        byte[] contentBytes = content.getBytes("UTF-8");
+        byte[] keyBytes = key.getBytes("UTF-8");
+        //加密,得到byte数组
+        byte[] encryptedBytes = aesEncryptBytes(contentBytes, keyBytes);
+        //将加密结果byte数组转换成16进制字符串
+        String hex = byte2HexStr(encryptedBytes);
+
+        return hex;
+    }
+
+    /**
+     * 解密
+     *
+     * @param content 解密内容
+     * @param key     解密秘钥
+     * @return
+     */
+    public static String aesDecryptString(String content, String key)
+            throws Exception {
+        byte[] decryptFrom = parseHexStr2Byte(content);
+        byte[] keyBytes = key.getBytes("UTF-8");
+        //解密,得到byte数组
+        byte[] decryptedBytes = aesDecryptBytes(decryptFrom, keyBytes);
+        //将解密结果byte数组转换成字符串
+        return new String(decryptedBytes, "UTF-8");
+    }
+
+    /**
+     * 将byte数组转换成16进制字符串
+     *
+     * @param b
+     * @return
+     */
+    public static String byte2HexStr(byte[] b) {
+        String stmp = "";
+        StringBuilder sb = new StringBuilder("");
+        for (int n = 0; n < b.length; n++) {
+            stmp = Integer.toHexString(b[n] & 0xFF);
+            sb.append(stmp.length() == 1 ? "0" + stmp : stmp);
+        }
+        return sb.toString().toUpperCase().trim();
+    }
+
+    public static String ebotongDecrypto(String str) {
+        BASE64Decoder base64decoder = new BASE64Decoder();
+        try {
+            byte[] encodeByte = base64decoder.decodeBuffer(str);
+            return new String(encodeByte);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return str;
+    }
+
+    /**
+     * 将16进制字符串转换成byte数组
+     *
+     * @param hexStr
+     * @return
+     */
+    public static byte[] parseHexStr2Byte(String hexStr) {
+        if (hexStr.length() < 1) {
+            return null;
+        }
+        byte[] result = new byte[hexStr.length() / 2];
+        for (int i = 0; i < hexStr.length() / 2; i++) {
+            int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);
+            int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2),
+                    16);
+            result[i] = ((byte) (high * 16 + low));
+        }
+        return result;
+    }
+
+    /**
+     * 加密,得到byte数组
+     *
+     * @param contentBytes 加密内容的byte数组
+     * @param keyBytes     加密秘钥的byte数组
+     * @return
+     */
+    public static byte[] aesEncryptBytes(byte[] contentBytes, byte[] keyBytes)
+            throws NoSuchAlgorithmException, NoSuchPaddingException,
+            InvalidKeyException, InvalidAlgorithmParameterException,
+            IllegalBlockSizeException, BadPaddingException,
+            UnsupportedEncodingException {
+        return cipherOperation(contentBytes, keyBytes, Cipher.ENCRYPT_MODE);
+    }
+
+    /**
+     * 解密,得到byte数组
+     *
+     * @param contentBytes 解密内容的byte数组
+     * @param keyBytes     解密秘钥的byte数组
+     * @return
+     */
+    public static byte[] aesDecryptBytes(byte[] contentBytes, byte[] keyBytes)
+            throws NoSuchAlgorithmException, NoSuchPaddingException,
+            InvalidKeyException, InvalidAlgorithmParameterException,
+            IllegalBlockSizeException, BadPaddingException,
+            UnsupportedEncodingException {
+        return cipherOperation(contentBytes, keyBytes, Cipher.DECRYPT_MODE);
+    }
+
+    /**
+     * 加密/解密(指定一个初始化向量:IV_STRING)
+     *
+     * @param contentBytes 内容的byte数组
+     * @param keyBytes     秘钥的byte数组
+     * @param mode         加密:Cipher.ENCRYPT_MODE / 解密:Cipher.DECRYPT_MODE
+     * @return
+     */
+    private static byte[] cipherOperation(byte[] contentBytes, byte[] keyBytes,
+                                          int mode) throws UnsupportedEncodingException,
+            NoSuchAlgorithmException, NoSuchPaddingException,
+            InvalidKeyException, InvalidAlgorithmParameterException,
+            IllegalBlockSizeException, BadPaddingException {
+        SecretKeySpec secretKey = new SecretKeySpec(keyBytes, "AES");
+
+        byte[] initParam = IV_STRING.getBytes("UTF-8");
+        IvParameterSpec ivParameterSpec = new IvParameterSpec(initParam);
+
+        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
+        cipher.init(mode, secretKey, ivParameterSpec);
+
+        return cipher.doFinal(contentBytes);
+    }
+
+    public static void main(String[] args) throws ParseException {
+        //        String time = "2018-03-29 13:09:43";
+        //        String serial = "000000ECC4BE0564";
+        //        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        //        Date date = formatter.parse(time);
+        //        long times = date.getTime();
+        //        String subSerial = serial.substring(serial.length() - 8, serial.length());
+        //        String stimes = String.valueOf(times);
+        //        String subtimes = stimes.substring(stimes.length() - 8, stimes.length());
+        //        String keys = subSerial + subtimes;
+        //        System.out.println("【subSerial】="+subSerial);
+        //        System.out.println("【stimes】="+stimes);
+        //        System.out.println("【times】="+times);
+        //        System.out.println("【subtimes】="+subtimes);
+        //        System.out.println("【keys】=" + keys);
+        //        String money = String.valueOf(100);
+        //        System.out.println("【money】=" + money);
+        //
+        //        String en = null;
+        //        try
+        //        {
+        //            en = aesEncryptString(money, keys);
+        //        }
+        //        catch (Exception e)
+        //        {
+        //            e.printStackTrace();
+        //        }
+        //        String de = null;
+        //        try
+        //        {
+        //            de = aesDecryptString(en, keys);
+        //        }
+        //        catch (Exception e)
+        //        {
+        //            e.printStackTrace();
+        //        }
+        //        System.out.println("加密前金额:"+de);
+        //        System.out.println("加密后金额:"+en);
+        String content = "test";
+        String en = "";
+        String de = "";
+        try {
+            en = aesEncryptString(content, IV_STRING);
+            System.out.println(en);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        try {
+            de = aesDecryptString(en, IV_STRING);
+            System.out.println(de);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 20 - 0
prec-service/src/main/java/com/diagbot/vo/PrecMapVO.java

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-05-11 14:47
+ */
+@Setter
+@Getter
+public class PrecMapVO {
+    //请求数据
+    private  Map<String,String> map;
+}

+ 46 - 0
prec-service/src/main/java/com/diagbot/web/PrecEncryptController.java

@@ -0,0 +1,46 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.PrecEncryptFacade;
+import com.diagbot.vo.PrecMapVO;
+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.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-05-11 14:44
+ */
+@RestController
+@RequestMapping("/prec")
+@Api(value = "预问诊请求API[by:wangfeng]", tags = { "预问诊请求API" })
+@SuppressWarnings("unchecked")
+public class PrecEncryptController {
+
+    @Autowired
+    private PrecEncryptFacade precEncryptFacade;
+
+    @ApiOperation(value = "请求参数加密:[by:wangfeng]",
+            notes = "Map<String ,String> map")
+    @PostMapping("/getEncryption")
+    @SysLogger("getEncryption")
+    public RespDTO<PrecMapVO> getEncryption(@RequestBody PrecMapVO precMapVO) {
+        return RespDTO.onSuc(precEncryptFacade.getEncryption(precMapVO));
+    }
+
+    @ApiOperation(value = "请求参数解密 :[by:wangfeng]",
+            notes = "Map<String ,String> map")
+    @PostMapping("/getDecode")
+    @SysLogger("getDecode")
+    public RespDTO<PrecMapVO> getDecode(@RequestBody @Valid PrecMapVO precVO) {
+        return RespDTO.onSuc(precEncryptFacade.getDecode(precVO));
+    }
+}