浏览代码

初始化自诊程序项目

zhoutg 5 年之前
父节点
当前提交
592ec28fcc
共有 87 个文件被更改,包括 5269 次插入2 次删除
  1. 2 1
      common/src/main/java/com/diagbot/enums/SysTypeEnum.java
  2. 7 1
      config-server/src/main/resources/shared/gateway-service-dev.yml
  3. 7 0
      config-server/src/main/resources/shared/gateway-service-local.yml
  4. 7 0
      config-server/src/main/resources/shared/gateway-service-pre.yml
  5. 7 0
      config-server/src/main/resources/shared/gateway-service-pro.yml
  6. 7 0
      config-server/src/main/resources/shared/gateway-service-test.yml
  7. 96 0
      config-server/src/main/resources/shared/zzcx-service-dev.yml
  8. 96 0
      config-server/src/main/resources/shared/zzcx-service-local.yml
  9. 96 0
      config-server/src/main/resources/shared/zzcx-service-pre.yml
  10. 96 0
      config-server/src/main/resources/shared/zzcx-service-pro.yml
  11. 96 0
      config-server/src/main/resources/shared/zzcx-service-test.yml
  12. 158 0
      docs/030.20200202自诊程序初始化脚本/init_zzcx.sql
  13. 1 0
      pom.xml
  14. 25 0
      zzcx-service/.gitignore
  15. 189 0
      zzcx-service/pom.xml
  16. 36 0
      zzcx-service/src/main/java/com/diagbot/ZzcxServiceApplication.java
  17. 41 0
      zzcx-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java
  18. 19 0
      zzcx-service/src/main/java/com/diagbot/config/CustomAccessTokenConverter.java
  19. 15 0
      zzcx-service/src/main/java/com/diagbot/config/GlobalMethodSecurityConfigurer.java
  20. 48 0
      zzcx-service/src/main/java/com/diagbot/config/JwtConfigurer.java
  21. 33 0
      zzcx-service/src/main/java/com/diagbot/config/MybatisPlusConfigurer.java
  22. 42 0
      zzcx-service/src/main/java/com/diagbot/config/ResourceServerConfigurer.java
  23. 70 0
      zzcx-service/src/main/java/com/diagbot/config/SwaggerConfigurer.java
  24. 81 0
      zzcx-service/src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java
  25. 29 0
      zzcx-service/src/main/java/com/diagbot/config/security/UrlConfigAttribute.java
  26. 79 0
      zzcx-service/src/main/java/com/diagbot/config/security/UrlFilterSecurityInterceptor.java
  27. 40 0
      zzcx-service/src/main/java/com/diagbot/config/security/UrlMetadataSourceService.java
  28. 38 0
      zzcx-service/src/main/java/com/diagbot/dto/QuestionDTO.java
  29. 24 0
      zzcx-service/src/main/java/com/diagbot/dto/SaveInquiryDTO.java
  30. 67 0
      zzcx-service/src/main/java/com/diagbot/entity/Client.java
  31. 47 0
      zzcx-service/src/main/java/com/diagbot/entity/Constants.java
  32. 169 0
      zzcx-service/src/main/java/com/diagbot/entity/InquiryDetail.java
  33. 281 0
      zzcx-service/src/main/java/com/diagbot/entity/InquiryInfo.java
  34. 53 0
      zzcx-service/src/main/java/com/diagbot/entity/JSONResponseBean.java
  35. 60 0
      zzcx-service/src/main/java/com/diagbot/entity/QuestionDetail.java
  36. 120 0
      zzcx-service/src/main/java/com/diagbot/entity/QuestionInfo.java
  37. 80 0
      zzcx-service/src/main/java/com/diagbot/entity/QuestionMapping.java
  38. 142 0
      zzcx-service/src/main/java/com/diagbot/entity/Request.java
  39. 120 0
      zzcx-service/src/main/java/com/diagbot/entity/Response.java
  40. 29 0
      zzcx-service/src/main/java/com/diagbot/entity/SystemHeader.java
  41. 142 0
      zzcx-service/src/main/java/com/diagbot/entity/User.java
  42. 21 0
      zzcx-service/src/main/java/com/diagbot/entity/wrapper/QuestionInfoWrapper.java
  43. 81 0
      zzcx-service/src/main/java/com/diagbot/exception/CommonExceptionHandler.java
  44. 39 0
      zzcx-service/src/main/java/com/diagbot/exception/ServiceErrorCode.java
  45. 14 0
      zzcx-service/src/main/java/com/diagbot/facade/InquiryDetailFacade.java
  46. 112 0
      zzcx-service/src/main/java/com/diagbot/facade/InquiryInfoFacade.java
  47. 65 0
      zzcx-service/src/main/java/com/diagbot/facade/QuestionDetailFacade.java
  48. 227 0
      zzcx-service/src/main/java/com/diagbot/facade/QuestionFacade.java
  49. 16 0
      zzcx-service/src/main/java/com/diagbot/mapper/InquiryDetailMapper.java
  50. 16 0
      zzcx-service/src/main/java/com/diagbot/mapper/InquiryInfoMapper.java
  51. 16 0
      zzcx-service/src/main/java/com/diagbot/mapper/QuestionDetailMapper.java
  52. 48 0
      zzcx-service/src/main/java/com/diagbot/mapper/QuestionInfoMapper.java
  53. 16 0
      zzcx-service/src/main/java/com/diagbot/mapper/QuestionMappingMapper.java
  54. 23 0
      zzcx-service/src/main/java/com/diagbot/rabbit/MyProcessor.java
  55. 27 0
      zzcx-service/src/main/java/com/diagbot/rabbit/MySender.java
  56. 16 0
      zzcx-service/src/main/java/com/diagbot/service/InquiryDetailService.java
  57. 16 0
      zzcx-service/src/main/java/com/diagbot/service/InquiryInfoService.java
  58. 16 0
      zzcx-service/src/main/java/com/diagbot/service/QuestionDetailService.java
  59. 40 0
      zzcx-service/src/main/java/com/diagbot/service/QuestionInfoService.java
  60. 16 0
      zzcx-service/src/main/java/com/diagbot/service/QuestionMappingService.java
  61. 20 0
      zzcx-service/src/main/java/com/diagbot/service/impl/InquiryDetailServiceImpl.java
  62. 20 0
      zzcx-service/src/main/java/com/diagbot/service/impl/InquiryInfoServiceImpl.java
  63. 20 0
      zzcx-service/src/main/java/com/diagbot/service/impl/QuestionDetailServiceImpl.java
  64. 39 0
      zzcx-service/src/main/java/com/diagbot/service/impl/QuestionInfoServiceImpl.java
  65. 20 0
      zzcx-service/src/main/java/com/diagbot/service/impl/QuestionMappingServiceImpl.java
  66. 95 0
      zzcx-service/src/main/java/com/diagbot/util/AESUtils.java
  67. 71 0
      zzcx-service/src/main/java/com/diagbot/util/Demo.java
  68. 139 0
      zzcx-service/src/main/java/com/diagbot/util/JSONUtils.java
  69. 118 0
      zzcx-service/src/main/java/com/diagbot/util/MessageDigestUtil.java
  70. 118 0
      zzcx-service/src/main/java/com/diagbot/util/OpenApiUtils.java
  71. 126 0
      zzcx-service/src/main/java/com/diagbot/util/SignUtil.java
  72. 19 0
      zzcx-service/src/main/java/com/diagbot/vo/QuestionIds2VO.java
  73. 17 0
      zzcx-service/src/main/java/com/diagbot/vo/QuestionVO.java
  74. 26 0
      zzcx-service/src/main/java/com/diagbot/vo/SaveInquiryDetailVO.java
  75. 104 0
      zzcx-service/src/main/java/com/diagbot/vo/SaveInquiryVO.java
  76. 41 0
      zzcx-service/src/main/java/com/diagbot/web/InquiryInfoController.java
  77. 58 0
      zzcx-service/src/main/java/com/diagbot/web/QuestionInfoController.java
  78. 19 0
      zzcx-service/src/main/resources/bootstrap.yml
  79. 306 0
      zzcx-service/src/main/resources/logback-spring.xml
  80. 19 0
      zzcx-service/src/main/resources/mapper/InquiryDetailMapper.xml
  81. 27 0
      zzcx-service/src/main/resources/mapper/InquiryInfoMapper.xml
  82. 16 0
      zzcx-service/src/main/resources/mapper/QuestionDetailMapper.xml
  83. 83 0
      zzcx-service/src/main/resources/mapper/QuestionInfoMapper.xml
  84. 20 0
      zzcx-service/src/main/resources/mapper/QuestionMappingMapper.xml
  85. 9 0
      zzcx-service/src/main/resources/public.cert
  86. 83 0
      zzcx-service/src/test/java/com/diagbot/CodeGeneration.java
  87. 16 0
      zzcx-service/src/test/java/com/diagbot/ZzcxServiceApplicationTests.java

+ 2 - 1
common/src/main/java/com/diagbot/enums/SysTypeEnum.java

@@ -30,7 +30,8 @@ public enum SysTypeEnum implements KeyedNamed {
     PREC_SERVICE(17, "prec-service"),
     PRECMAN_SERVICE(18, "precman-service"),
     MRQCMAN_SERVICE(19, "mrqcman-service"),
-    ZNWZ_SERVICE(21, "znwz-service");
+    ZNWZ_SERVICE(21, "znwz-service"),
+    ZZCX_SERVICE(22, "zzcx-service");
 
     @Setter
     private int key;

+ 7 - 1
config-server/src/main/resources/shared/gateway-service-dev.yml

@@ -135,7 +135,13 @@ spring:
         filters:
         #        - SwaggerHeaderFilter
         - StripPrefix=2
-
+      - id: zzcx-service
+        uri: lb://zzcx-service
+        predicates:
+        - Path=/api/zzcx/**
+        filters:
+        #        - SwaggerHeaderFilter
+        - StripPrefix=2
 server:
   port: 5050
 

+ 7 - 0
config-server/src/main/resources/shared/gateway-service-local.yml

@@ -139,6 +139,13 @@ spring:
         filters:
         #        - SwaggerHeaderFilter
         - StripPrefix=2
+      - id: zzcx-service
+        uri: lb://zzcx-service
+        predicates:
+        - Path=/api/zzcx/**
+        filters:
+        #        - SwaggerHeaderFilter
+        - StripPrefix=2
 
 server:
   port: 5050

+ 7 - 0
config-server/src/main/resources/shared/gateway-service-pre.yml

@@ -142,6 +142,13 @@ spring:
         filters:
         #        - SwaggerHeaderFilter
         - StripPrefix=2
+      - id: zzcx-service
+        uri: lb://zzcx-service
+        predicates:
+        - Path=/api/zzcx/**
+        filters:
+        #        - SwaggerHeaderFilter
+        - StripPrefix=2
 
 server:
   port: 5050

+ 7 - 0
config-server/src/main/resources/shared/gateway-service-pro.yml

@@ -135,6 +135,13 @@ spring:
         filters:
         #        - SwaggerHeaderFilter
         - StripPrefix=2
+      - id: zzcx-service
+        uri: lb://zzcx-service
+        predicates:
+        - Path=/api/zzcx/**
+        filters:
+        #        - SwaggerHeaderFilter
+        - StripPrefix=2
 
 server:
   port: 5050

+ 7 - 0
config-server/src/main/resources/shared/gateway-service-test.yml

@@ -142,6 +142,13 @@ spring:
         filters:
         #        - SwaggerHeaderFilter
         - StripPrefix=2
+      - id: zzcx-service
+        uri: lb://zzcx-service
+        predicates:
+        - Path=/api/zzcx/**
+        filters:
+        #        - SwaggerHeaderFilter
+        - StripPrefix=2
 
 server:
   port: 5050

+ 96 - 0
config-server/src/main/resources/shared/zzcx-service-dev.yml

@@ -0,0 +1,96 @@
+server:
+  port: 8853
+
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driver-class-name: com.mysql.cj.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.236:3306/sys-zzcx?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: root
+      password: lantone
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: wall,log4j
+      filter:
+        stat:
+          enabled: true
+          mergeSql: true
+          log-slow-sql: true
+          slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+  #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
+  #mq
+  rabbitmq:
+    host: 192.168.2.236
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false

+ 96 - 0
config-server/src/main/resources/shared/zzcx-service-local.yml

@@ -0,0 +1,96 @@
+server:
+  port: 8853
+
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driver-class-name: com.mysql.cj.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.236:3306/sys-zzcx?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: root
+      password: lantone
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: wall,log4j
+      filter:
+        stat:
+          enabled: true
+          mergeSql: true
+          log-slow-sql: true
+          slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+  #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
+  #mq
+  rabbitmq:
+    host: localhost
+    port: 5672
+    username: guest
+    password: guest
+    publisher-confirms: true
+    virtual-host: /
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false

+ 96 - 0
config-server/src/main/resources/shared/zzcx-service-pre.yml

@@ -0,0 +1,96 @@
+server:
+  port: 8853
+
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driver-class-name: com.mysql.cj.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.121:3306/sys-zzcx?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: teamback
+      password: goTulmLeon
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: wall,log4j
+      filter:
+        stat:
+          enabled: true
+          mergeSql: true
+          log-slow-sql: true
+          slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+  #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
+  #mq
+  rabbitmq:
+    host: 192.168.2.121
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false

+ 96 - 0
config-server/src/main/resources/shared/zzcx-service-pro.yml

@@ -0,0 +1,96 @@
+server:
+  port: 8853
+
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driver-class-name: com.mysql.cj.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.122:3306/sys-zzcx?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: root
+      password: lantone
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: wall,log4j
+      filter:
+        stat:
+          enabled: true
+          mergeSql: true
+          log-slow-sql: true
+          slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+  #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
+  #mq
+  rabbitmq:
+    host: 192.168.2.122
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false

+ 96 - 0
config-server/src/main/resources/shared/zzcx-service-test.yml

@@ -0,0 +1,96 @@
+server:
+  port: 8853
+
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driver-class-name: com.mysql.cj.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.241:3306/sys-zzcx?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: root
+      password: lantone
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: wall,log4j
+      filter:
+        stat:
+          enabled: true
+          mergeSql: true
+          log-slow-sql: true
+          slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+  #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
+  #mq
+  rabbitmq:
+    host: 192.168.2.241
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false

+ 158 - 0
docs/030.20200202自诊程序初始化脚本/init_zzcx.sql

@@ -0,0 +1,158 @@
+drop database if exists `sys-zzcx`;
+CREATE DATABASE  `sys-zzcx` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
+use `sys-zzcx`;
+
+/*
+Navicat MySQL Data Transfer
+
+Source Server         : 2.236平台开发环境
+Source Server Version : 50723
+Source Host           : 192.168.2.236:3306
+Source Database       : sys-znwz
+
+Target Server Type    : MYSQL
+Target Server Version : 50723
+File Encoding         : 65001
+
+Date: 2019-07-30 17:12:35
+*/
+
+SET FOREIGN_KEY_CHECKS=0;
+--
+-- -- ----------------------------
+-- -- Table structure for znwz_dictionary_info
+-- -- ----------------------------
+-- DROP TABLE IF EXISTS `znwz_dictionary_info`;
+-- CREATE TABLE `znwz_dictionary_info` (
+--   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+--   `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+--   `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+--   `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+--   `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+--   `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+--   `group_type` bigint(20) NOT NULL DEFAULT '0' COMMENT '分组(值自定义)',
+--   `name` varchar(100) NOT NULL DEFAULT '' COMMENT '内容',
+--   `val` varchar(255) NOT NULL DEFAULT '' COMMENT '值',
+--   `return_type` int(11) NOT NULL DEFAULT '1' COMMENT '返回类型(0: 都返回,1:后台维护返回 2:icss界面返回)',
+--   `order_no` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
+--   `remark` varchar(300) DEFAULT NULL COMMENT '备注',
+--   PRIMARY KEY (`id`)
+-- ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='字典表';
+--
+--
+-- -- ----------------------------
+-- -- Table structure for znwz_question_detail
+-- -- ----------------------------
+-- DROP TABLE IF EXISTS `znwz_question_detail`;
+-- CREATE TABLE `znwz_question_detail` (
+--   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+--   `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+--   `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+--   `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+--   `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+--   `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+--   `question_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'question_id',
+--   `description` varchar(100) NOT NULL DEFAULT '' COMMENT '患者界面描述',
+--   `name` varchar(100) NOT NULL DEFAULT '' COMMENT '名称',
+--   `order_no` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
+--   `exclusion` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:不互斥,1:与其他都互斥',
+--   `remark` varchar(300) DEFAULT NULL COMMENT '备注',
+--   PRIMARY KEY (`id`),
+--   KEY `index_questonid` (`question_id`) USING BTREE
+-- ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='标签明细表';
+--
+--
+-- -- ----------------------------
+-- -- Table structure for znwz_question_info
+-- -- ----------------------------
+-- DROP TABLE IF EXISTS `znwz_question_info`;
+-- CREATE TABLE `znwz_question_info` (
+--   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+--   `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+--   `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+--   `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+--   `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+--   `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+--   `tag_name` varchar(100) NOT NULL DEFAULT '' COMMENT '标签名',
+--   `name` varchar(100) NOT NULL DEFAULT '' COMMENT '内容',
+--   `description` varchar(100) NOT NULL DEFAULT '' COMMENT '患者界面描述,例如:腹泻的描述-拉肚子',
+--   `sex_type` tinyint(11) NOT NULL DEFAULT '3' COMMENT '性别(1:男 2:女 3:通用)',
+--   `age_begin` int(11) NOT NULL DEFAULT '0' COMMENT '最小年龄',
+--   `age_end` int(11) NOT NULL DEFAULT '200' COMMENT '最大年龄',
+--   `tag_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '标签标识(1:单标签 4:组合标签,胸痛  6:组合标签,既往史)',
+--   `control_type` tinyint(4) DEFAULT '0' COMMENT '控件类型(0:无类型,默认值 1:单选 2:多选 3:多行输入,生命体征 4:上传图片 5:文本域,自行服药 6:文本框 7:数字文本框)',
+--   `type` tinyint(4) DEFAULT NULL COMMENT '类型(1:症状 3:其他史 51:诊疗情况 52:补充 )',
+--   `item_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '元素类型(0:主标签,例如主诉现病史-症状标签,1:次标签:主诉现病史-其他标签)\r\n',
+--   `label_prefix` varchar(100) NOT NULL DEFAULT '' COMMENT '前置内容',
+--   `label_suffix` varchar(100) NOT NULL DEFAULT '' COMMENT '后置内容',
+--   `url` varchar(255) NOT NULL DEFAULT '' COMMENT '图片url地址',
+--   `remark` varchar(300) DEFAULT NULL COMMENT '备注',
+--   PRIMARY KEY (`id`),
+--   UNIQUE KEY `tag_name,type` (`tag_name`,`type`,`is_deleted`,`id`) USING BTREE
+-- ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='标签基础表';
+--
+-- -- ----------------------------
+-- -- Table structure for znwz_question_mapping
+-- -- ----------------------------
+-- DROP TABLE IF EXISTS `znwz_question_mapping`;
+-- CREATE TABLE `znwz_question_mapping` (
+--   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+--   `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+--   `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+--   `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+--   `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+--   `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+--   `parent_question` bigint(20) DEFAULT NULL COMMENT '上级question',
+--   `son_question` bigint(20) DEFAULT NULL COMMENT '下级question',
+--   `order_no` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
+--   `exclusion_type` int(11) NOT NULL DEFAULT '0' COMMENT '互斥类型(0:不互斥, 1:互斥 主要用在组合项:例如既往史无殊)',
+--   `remark` varchar(300) DEFAULT NULL COMMENT '备注',
+--   PRIMARY KEY (`id`),
+--   KEY `parent_question` (`parent_question`)
+-- ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='标签映射表';
+
+DROP TABLE IF EXISTS `zzcx_opt_info`;
+CREATE TABLE `zzcx_opt_info` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `ip` varchar(100) NOT NULL DEFAULT '' COMMENT '访问者的IP',
+  `opt_type` varchar(10) DEFAULT NULL COMMENT '操作类型:1 开始,2 结束',
+  `remark` varchar(128) DEFAULT NULL COMMENT '备注',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='操作信息';
+
+DROP TABLE IF EXISTS `zzcx_inquiry_info`;
+CREATE TABLE `zzcx_inquiry_info` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `ip` varchar(100) NOT NULL DEFAULT '' COMMENT '访问者的IP',
+  `diagnosis` varchar(1024) DEFAULT NULL COMMENT '诊断',
+  `remark` varchar(128) DEFAULT NULL COMMENT '备注',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='自诊记录-主表';
+
+DROP TABLE IF EXISTS `zzcx_inquiry_detail`;
+CREATE TABLE `zzcx_inquiry_detail` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `inquiry_id` bigint(20) NOT NULL COMMENT '问诊记录id',
+  `question` varchar(1024) DEFAULT NULL COMMENT '问题',
+  `answer` varchar(1024) DEFAULT NULL COMMENT '答案',
+  `remark` varchar(128) DEFAULT NULL COMMENT '备注',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='自诊记录-明细表';
+
+
+

+ 1 - 0
pom.xml

@@ -35,6 +35,7 @@
         <module>mrqcman-service</module>
         <module>common-biz-client</module>
         <module>znwz-service</module>
+        <module>zzcx-service</module>
     </modules>
 
     <parent>

+ 25 - 0
zzcx-service/.gitignore

@@ -0,0 +1,25 @@
+/target/
+!.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/build/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/

+ 189 - 0
zzcx-service/pom.xml

@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.diagbot</groupId>
+    <artifactId>zzcx-service</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <packaging>jar</packaging>
+
+    <name>zzcx-service</name>
+    <description>zzcx service for Spring Boot</description>
+
+    <parent>
+        <groupId>com.diagbot</groupId>
+        <artifactId>diagbotcloud</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.diagbot</groupId>
+            <artifactId>common</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+        </dependency>
+
+        <!-- 配置-->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-config</artifactId>
+        </dependency>
+
+        <!-- 开启web-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-undertow</artifactId>
+        </dependency>
+
+        <!-- 开启feign-->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+
+        <!-- dashboard -->
+        <!-- actuator-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <!--hystrix-dashboard-->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
+        </dependency>
+        <!--hystrix -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
+        </dependency>
+
+        <!-- zipkin-->
+        <!--<dependency>-->
+            <!--<groupId>org.springframework.cloud</groupId>-->
+            <!--<artifactId>spring-cloud-starter-zipkin</artifactId>-->
+        <!--</dependency>-->
+
+        <!--swagger-->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+        </dependency>
+        <!--database-->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <!--security-->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-oauth2</artifactId>
+        </dependency>
+
+        <!-- mq -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-amqp</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+
+        <dependency>
+            <groupId>net.logstash.logback</groupId>
+            <artifactId>logstash-logback-encoder</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
+        </dependency>
+
+        <!-- mybatis-plus begin -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+        </dependency>
+        <!-- mybatis-plus end -->
+
+        <!-- 阿里巴巴druid数据库连接池 -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+        </dependency>
+
+        <!-- springboot整合mybatis(核心就这一个) -->
+        <!-- 注意顺序,这个一定要放在最下面 -->
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>${mybatis-spring-boot.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+            <!-- 添加docker-maven插件 -->
+            <plugin>
+                <groupId>com.spotify</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+                <configuration>
+                    <imageName>${docker.image.prefix}/${project.artifactId}:${project.version}</imageName>
+                    <forceTags>true</forceTags>
+                    <!--镜像的FROM,使用压缩的小镜像-->
+                    <baseImage>frolvlad/alpine-oraclejre8:slim</baseImage>
+                    <entryPoint>["java", "-jar", "-Xms256m", "-Xmx1024m", "-Duser.timezone=GMT+8", "/${project.build.finalName}.jar"]</entryPoint>
+                    <resources>
+                        <resource>
+                            <targetPath>/</targetPath>
+                            <directory>${project.build.directory}</directory>
+                            <include>${project.build.finalName}.jar</include>
+                        </resource>
+                    </resources>
+                    <serverId>docker-registry</serverId>
+                    <registryUrl>${registryUrl}</registryUrl>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 36 - 0
zzcx-service/src/main/java/com/diagbot/ZzcxServiceApplication.java

@@ -0,0 +1,36 @@
+package com.diagbot;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration;
+import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
+import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
+import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
+import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+import org.springframework.cloud.netflix.hystrix.EnableHystrix;
+import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+/**
+ * @Description: 自诊程序启动文件
+ * @author: gaodm
+ * @time: 2018/8/7 9:26
+ */
+@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
+        JmxAutoConfiguration.class, ThymeleafAutoConfiguration.class })
+@EnableEurekaClient
+@EnableFeignClients({ "com.diagbot.client" })
+@EnableHystrixDashboard
+@EnableHystrix
+@EnableCircuitBreaker
+@RefreshScope
+@ConfigurationPropertiesScan
+public class ZzcxServiceApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(ZzcxServiceApplication.class, args);
+    }
+}

+ 41 - 0
zzcx-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java

@@ -0,0 +1,41 @@
+package com.diagbot.aop;
+
+import com.diagbot.biz.log.entity.SysLog;
+import com.diagbot.enums.SysTypeEnum;
+import com.diagbot.rabbit.MySender;
+import com.diagbot.util.AopUtil;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 日志拦截切面
+ * @author: gaodm
+ * @time: 2018/8/2 13:36
+ */
+@Aspect
+@Component
+@ConditionalOnProperty(prefix = "syslog", value = { "enable" }, havingValue = "true")
+public class SysLoggerAspect {
+    @Autowired
+    private MySender mySender;
+
+    @Pointcut("@annotation(com.diagbot.annotation.SysLogger)")
+    public void loggerPointCut() {
+
+    }
+
+    @Before("loggerPointCut()")
+    public void saveSysLog(JoinPoint joinPoint) {
+        //入参设置
+        SysLog sysLog = AopUtil.sysLoggerAspect(joinPoint, SysTypeEnum.ZZCX_SERVICE.getKey());
+        //保存系统日志
+        mySender.outputLogSend(sysLog);
+    }
+
+}
+

+ 19 - 0
zzcx-service/src/main/java/com/diagbot/config/CustomAccessTokenConverter.java

@@ -0,0 +1,19 @@
+package com.diagbot.config;
+
+import org.springframework.security.oauth2.provider.OAuth2Authentication;
+import org.springframework.security.oauth2.provider.token.DefaultAccessTokenConverter;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+@Component
+public class CustomAccessTokenConverter extends DefaultAccessTokenConverter {
+
+    @Override
+    public OAuth2Authentication extractAuthentication(Map<String, ?> claims) {
+        OAuth2Authentication authentication = super.extractAuthentication(claims);
+        authentication.setDetails(claims);
+        return authentication;
+    }
+
+}

+ 15 - 0
zzcx-service/src/main/java/com/diagbot/config/GlobalMethodSecurityConfigurer.java

@@ -0,0 +1,15 @@
+package com.diagbot.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+
+/**
+ * @Description: 安全配置类
+ * @author: gaodm
+ * @time: 2018/8/2 13:38
+ */
+@Configuration
+@EnableGlobalMethodSecurity(prePostEnabled = true)
+public class GlobalMethodSecurityConfigurer {
+
+}

+ 48 - 0
zzcx-service/src/main/java/com/diagbot/config/JwtConfigurer.java

@@ -0,0 +1,48 @@
+package com.diagbot.config;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+import org.springframework.security.oauth2.provider.token.TokenStore;
+import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
+import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
+import org.springframework.util.FileCopyUtils;
+
+import java.io.IOException;
+
+/**
+ * @Description: JWT配置类
+ * @author: gaodm
+ * @time: 2018/8/2 13:38
+ */
+@Configuration
+public class JwtConfigurer {
+    @Autowired
+    private CustomAccessTokenConverter customAccessTokenConverter;
+
+    @Bean
+    @Qualifier("tokenStore")
+    public TokenStore tokenStore() {
+
+        System.out.println("Created JwtTokenStore");
+        return new JwtTokenStore(jwtTokenEnhancer());
+    }
+
+    @Bean
+    protected JwtAccessTokenConverter jwtTokenEnhancer() {
+        JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
+        Resource resource = new ClassPathResource("public.cert");
+        String publicKey;
+        try {
+            publicKey = new String(FileCopyUtils.copyToByteArray(resource.getInputStream()));
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        converter.setVerifierKey(publicKey);
+        converter.setAccessTokenConverter(customAccessTokenConverter);
+        return converter;
+    }
+}

+ 33 - 0
zzcx-service/src/main/java/com/diagbot/config/MybatisPlusConfigurer.java

@@ -0,0 +1,33 @@
+package com.diagbot.config;
+
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+/**
+ * @Description: MybatisPlus配置类
+ * @author: gaodm
+ * @time: 2018/8/2 13:39
+ */
+@EnableTransactionManagement
+@Configuration
+@MapperScan("com.diagbot.mapper*")//这个注解,作用相当于下面的@Bean MapperScannerConfigurer,2者配置1份即可
+public class MybatisPlusConfigurer {
+
+    /**
+     * mybatis-plus分页插件<br>
+     * 文档:http://mp.baomidou.com<br>
+     */
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
+        // 设置请求的页面大于最大页后操作,true调回到首页,false继续请求,默认false
+        //paginationInterceptor.setOverflow(false);
+        // 设置最大单页限制数量,默认500条,-1不受限制
+        paginationInterceptor.setLimit(500L);
+        return paginationInterceptor;
+    }
+
+}

+ 42 - 0
zzcx-service/src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -0,0 +1,42 @@
+package com.diagbot.config;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
+import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
+import org.springframework.security.oauth2.provider.token.TokenStore;
+
+/**
+ * @Description: 权限资源配置类
+ * @author: gaodm
+ * @time: 2018/8/2 14:21
+ */
+@Configuration
+@EnableResourceServer
+public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
+    Logger log = LoggerFactory.getLogger(ResourceServerConfigurer.class);
+
+    @Override
+    public void configure(HttpSecurity http) throws Exception {
+        http
+                .csrf().disable()
+                .authorizeRequests()
+                .regexMatchers(".*swagger.*", ".*v2.*", ".*webjars.*", "/druid.*", "/actuator.*", "/hystrix.*").permitAll()
+//                .antMatchers("/**").authenticated();
+                .antMatchers("/**").permitAll();
+    }
+
+
+    @Override
+    public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
+        log.info("Configuring ResourceServerSecurityConfigurer ");
+        resources.resourceId("user-service").tokenStore(tokenStore);
+    }
+
+    @Autowired
+    TokenStore tokenStore;
+}

+ 70 - 0
zzcx-service/src/main/java/com/diagbot/config/SwaggerConfigurer.java

@@ -0,0 +1,70 @@
+package com.diagbot.config;
+
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.ParameterBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.schema.ModelRef;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.service.Parameter;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * @Description: Swagger配置类
+ * @author: gaodm
+ * @time: 2018/8/2 14:21
+ */
+@Configuration
+@ConditionalOnProperty(prefix = "swagger", value = { "enable" }, havingValue = "true")
+@EnableSwagger2
+public class SwaggerConfigurer {
+    /**
+     * 全局参数
+     *
+     * @return
+     */
+    private List<Parameter> parameter() {
+        List<Parameter> params = new ArrayList<>();
+        params.add(new ParameterBuilder().name("Authorization")
+                .description("Authorization Bearer token")
+                .modelRef(new ModelRef("string"))
+                .parameterType("header")
+                .required(false).build());
+        return params;
+    }
+
+
+    @Bean
+    public Docket sysApi() {
+        return new Docket(DocumentationType.SWAGGER_2)
+                .apiInfo(apiInfo())
+                .select()
+                .apis(RequestHandlerSelectors.basePackage("com.diagbot.web"))
+                .paths(PathSelectors.any())
+                .build().globalOperationParameters(parameter());
+        //.securitySchemes(newArrayList(oauth()))
+        // .securityContexts(newArrayList(securityContext()));
+    }
+
+    private ApiInfo apiInfo() {
+        return new ApiInfoBuilder()
+                .title(" zzcx-service api ")
+                .description("zzcx-service 微服务")
+                .termsOfServiceUrl("")
+                .contact(new Contact("diagbot","",""))
+                .version("1.0")
+                .build();
+    }
+
+}

+ 81 - 0
zzcx-service/src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -0,0 +1,81 @@
+package com.diagbot.config.security;
+
+import org.springframework.security.access.AccessDecisionManager;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.security.access.ConfigAttribute;
+import org.springframework.security.authentication.InsufficientAuthenticationException;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.web.FilterInvocation;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Collection;
+
+
+/**
+ * @Description: 自定义权限拦截
+ * @author: gaodm
+ * @time: 2018/8/23 13:46
+ */
+@Service
+public class UrlAccessDecisionManager implements AccessDecisionManager {
+    @Override
+    public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException {
+//        HttpServletRequest request = ((FilterInvocation) object).getHttpRequest();
+//        String url, method;
+//        if (matchPermitAllUrl(request)) {
+//            return;
+//        }
+//        if ("anonymousUser".equals(authentication.getPrincipal())) {
+//            throw new AccessDeniedException("no right");
+//        } else {
+//            for (GrantedAuthority ga : authentication.getAuthorities()) {
+//                String[] authority = ga.getAuthority().split(";");
+//                url = authority[0];
+//                method = authority[1];
+//                if (matchers(url, request)) {
+//                    if (method.equals(request.getMethod()) || "ALL".equals(method)) {
+//                        return;
+//                    }
+//                }
+//            }
+//        }
+//        throw new AccessDeniedException("no right");
+    }
+
+
+    @Override
+    public boolean supports(ConfigAttribute attribute) {
+        return true;
+    }
+
+    @Override
+    public boolean supports(Class<?> clazz) {
+        return true;
+    }
+
+    private Boolean matchPermitAllUrl(HttpServletRequest request){
+        if (matchers("/swagger/**", request)
+                || matchers("/v2/**", request)
+                || matchers("/swagger-ui.html/**", request)
+                || matchers("/swagger-resources/**", request)
+                || matchers("/webjars/**", request)
+                || matchers("/druid/**", request)
+                || matchers("/actuator/**", request)
+                || matchers("/hystrix/**", request)
+                || matchers("/", request)) {
+            return true;
+        }
+        return false;
+    }
+
+    private boolean matchers(String url, HttpServletRequest request) {
+        AntPathRequestMatcher matcher = new AntPathRequestMatcher(url);
+        if (matcher.matches(request)) {
+            return true;
+        }
+        return false;
+    }
+}

+ 29 - 0
zzcx-service/src/main/java/com/diagbot/config/security/UrlConfigAttribute.java

@@ -0,0 +1,29 @@
+package com.diagbot.config.security;
+
+import org.springframework.security.access.ConfigAttribute;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @Description: 自定义权限拦截
+ * @author: gaodm
+ * @time: 2018/8/23 13:47
+ */
+public class UrlConfigAttribute implements ConfigAttribute {
+
+    private final HttpServletRequest httpServletRequest;
+
+    public UrlConfigAttribute(HttpServletRequest httpServletRequest) {
+        this.httpServletRequest = httpServletRequest;
+    }
+
+
+    @Override
+    public String getAttribute() {
+        return null;
+    }
+
+    public HttpServletRequest getHttpServletRequest() {
+        return httpServletRequest;
+    }
+}

+ 79 - 0
zzcx-service/src/main/java/com/diagbot/config/security/UrlFilterSecurityInterceptor.java

@@ -0,0 +1,79 @@
+package com.diagbot.config.security;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.SecurityMetadataSource;
+import org.springframework.security.access.intercept.AbstractSecurityInterceptor;
+import org.springframework.security.access.intercept.InterceptorStatusToken;
+import org.springframework.security.web.FilterInvocation;
+import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import java.io.IOException;
+
+/**
+ * @Description: 自定义权限拦截
+ * @author: gaodm
+ * @time: 2018/8/23 13:47
+ */
+@Service
+public class UrlFilterSecurityInterceptor extends AbstractSecurityInterceptor implements Filter {
+
+
+    @Autowired
+    private FilterInvocationSecurityMetadataSource securityMetadataSource;
+
+    @Autowired
+    public void setUrlAccessDecisionManager(UrlAccessDecisionManager urlAccessDecisionManager) {
+        super.setAccessDecisionManager(urlAccessDecisionManager);
+    }
+
+
+    @Override
+    public void init(FilterConfig filterConfig) throws ServletException {
+
+    }
+
+    @Override
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+
+        FilterInvocation fi = new FilterInvocation(request, response, chain);
+        invoke(fi);
+    }
+
+
+    public void invoke(FilterInvocation fi) throws IOException, ServletException {
+        //fi里面有一个被拦截的url
+        //里面调用UrlMetadataSource的getAttributes(Object object)这个方法获取fi对应的所有权限
+        //再调用UrlAccessDecisionManager的decide方法来校验用户的权限是否足够
+        InterceptorStatusToken token = super.beforeInvocation(fi);
+        try {
+            //执行下一个拦截器
+            fi.getChain().doFilter(fi.getRequest(), fi.getResponse());
+        } finally {
+            super.afterInvocation(token, null);
+        }
+    }
+
+
+    @Override
+    public void destroy() {
+
+    }
+
+    @Override
+    public Class<?> getSecureObjectClass() {
+        return FilterInvocation.class;
+
+    }
+
+    @Override
+    public SecurityMetadataSource obtainSecurityMetadataSource() {
+        return this.securityMetadataSource;
+    }
+}

+ 40 - 0
zzcx-service/src/main/java/com/diagbot/config/security/UrlMetadataSourceService.java

@@ -0,0 +1,40 @@
+package com.diagbot.config.security;
+
+import org.springframework.security.access.ConfigAttribute;
+import org.springframework.security.web.FilterInvocation;
+import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @Description: 自定义权限拦截
+ * @author: gaodm
+ * @time: 2018/8/23 13:47
+ */
+@Service
+public class UrlMetadataSourceService implements
+        FilterInvocationSecurityMetadataSource {
+
+    @Override
+    public Collection<ConfigAttribute> getAttributes(Object object) throws IllegalArgumentException {
+        final HttpServletRequest request = ((FilterInvocation) object).getRequest();
+        Set<ConfigAttribute> allAttributes = new HashSet<>();
+        ConfigAttribute configAttribute = new UrlConfigAttribute(request);
+        allAttributes.add(configAttribute);
+        return allAttributes;
+    }
+
+    @Override
+    public Collection<ConfigAttribute> getAllConfigAttributes() {
+        return null;
+    }
+
+    @Override
+    public boolean supports(Class<?> clazz) {
+        return true;
+    }
+}

+ 38 - 0
zzcx-service/src/main/java/com/diagbot/dto/QuestionDTO.java

@@ -0,0 +1,38 @@
+package com.diagbot.dto;
+
+import com.diagbot.entity.QuestionDetail;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description: 返回标签内容
+ * @Author: ztg
+ * @Date: 2018/10/24 16:11
+ */
+@Getter
+@Setter
+public class QuestionDTO {
+
+    private Long id;// id
+    private String name;//内容
+    private String tagName;//标签名称
+    private Integer type;//类型(1:症状 3:其他史 4:查体,5:化验 6:辅检 7:诊断)
+    private Integer controlType; //控件类型
+    private Integer itemType; //元素类型
+    private Integer tagType; //标签标识
+    private String labelPrefix = ""; //前置内容
+    private String labelSuffix = ""; //后置内容
+    private String url;    //图片url地址
+    private String description; // 客户端界面描述
+    private Integer specFlag;//特殊标记(0:没有标记,1:拼接到主诉)
+    private Integer required;//必填(0:不必填,1:必填)
+    private String explains;//详细阐述
+    private Integer exclusionType; //互斥类型
+    private List<QuestionDetail> questionDetailList = new ArrayList<>(); //标签明细表
+    private List<QuestionDTO> questionMapping = new ArrayList<>();     //下级标签
+    private String flag; // 类型标记
+    private String remark;//备注
+}

+ 24 - 0
zzcx-service/src/main/java/com/diagbot/dto/SaveInquiryDTO.java

@@ -0,0 +1,24 @@
+package com.diagbot.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2018/11/19 18:56
+ */
+@ApiModel(value = "问诊记录保存接口出参")
+@Getter
+@Setter
+public class SaveInquiryDTO {
+
+    /**
+     * 纳里返回的url
+     */
+    @ApiModelProperty(value = "纳里返回的url")
+    private String body;
+
+}

+ 67 - 0
zzcx-service/src/main/java/com/diagbot/entity/Client.java

@@ -0,0 +1,67 @@
+
+package com.diagbot.entity;
+
+import com.diagbot.util.AESUtils;
+import com.diagbot.util.JSONUtils;
+import com.diagbot.util.MessageDigestUtil;
+import com.diagbot.util.OpenApiUtils;
+import com.diagbot.util.SignUtil;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.UUID;
+
+/**
+ * Client
+ */
+public class Client {
+
+    private String apiUrl;
+    private String appKey;
+    private String appSecret;
+    private String encodingAesKey;
+
+    public Client(String apiUrl, String appKey, String appSecret, String encodingAesKey) {
+        this.apiUrl = apiUrl;
+        this.appKey = appKey;
+        this.appSecret = appSecret;
+        this.encodingAesKey = encodingAesKey;
+    }
+
+    /**
+     * 发送请求
+     *
+     * @param request request对象
+     * @return Response
+     * @throws Exception
+     */
+    public Response execute(Request request) throws Exception {
+        request.setApiUrl(this.apiUrl);
+        request.setAppKey(this.appKey);
+        request.setAppSecret(this.appSecret);
+        request.setEncodingAesKey(this.encodingAesKey);
+        request.addHeader(SystemHeader.X_CA_KEY, request.getAppKey());
+        request.addHeader(SystemHeader.X_CA_NONCE, UUID.randomUUID().toString());
+        request.addHeader(SystemHeader.X_CA_TIMESTAMP, String.valueOf(System.currentTimeMillis()));
+        String jsonStr = JSONUtils.toString(request.getBodys());
+        String encryptStr;
+        if (StringUtils.isNotEmpty(request.getEncodingAesKey())) {
+            encryptStr = AESUtils.encrypt(jsonStr, request.getEncodingAesKey());
+        } else {
+            encryptStr = jsonStr;
+        }
+        String contentMd5 = MessageDigestUtil.base64AndMD5(encryptStr);
+        request.addHeader(SystemHeader.X_CONTENT_MD5, contentMd5);
+        String signature = SignUtil.sign(request.getAppSecret(), request.getHeaders());
+        request.addHeader(SystemHeader.X_CA_SIGNATURE, signature);
+        request.setStringBody(encryptStr);
+        return OpenApiUtils.post(request);
+    }
+
+    public static void main(String[] args) throws Exception {
+        String body = "[1]";
+        String encryptStr = AESUtils.encrypt(body, "1234567890123456");
+        String contentMd5 = MessageDigestUtil.base64AndMD5(encryptStr.getBytes());
+        System.out.println(contentMd5);
+
+    }
+}

+ 47 - 0
zzcx-service/src/main/java/com/diagbot/entity/Constants.java

@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.diagbot.entity;
+
+/**
+ * 通用常量
+ */
+public class Constants {
+    //签名算法HmacSha256
+    public static final String HMAC_SHA256 = "HmacSHA256";
+    //编码UTF-8
+    public static final String ENCODING = "UTF-8";
+    //UserAgent
+    public static final String USER_AGENT = "demo/aliyun/java";
+    //换行符
+    public static final String LF = "\n";
+    //串联符
+    public static final String SPE1 = ",";
+    //示意符
+    public static final String SPE2 = ":";
+    //连接符
+    public static final String SPE3 = "&";
+    //赋值符
+    public static final String SPE4 = "=";
+    //问号符
+    public static final String SPE5 = "?";
+    //默认请求超时时间,单位毫秒
+    public static final int DEFAULT_TIMEOUT = 1000;
+    //参与签名的系统Header前缀,只有指定前缀的Header才会参与到签名中
+    public static final String CA_HEADER_TO_SIGN_PREFIX_SYSTEM = "X-Ca-";
+}

+ 169 - 0
zzcx-service/src/main/java/com/diagbot/entity/InquiryDetail.java

@@ -0,0 +1,169 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 问诊记录-明细表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-02-01
+ */
+@TableName("zzcx_inquiry_detail")
+public class InquiryDetail implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 问诊记录id
+     */
+    private Long inquiryId;
+
+    /**
+     * 问题
+     */
+    private String question;
+
+    /**
+     * 答案
+     */
+    private String answer;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+
+    public Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+
+    public Long getInquiryId() {
+        return inquiryId;
+    }
+
+    public void setInquiryId(Long inquiryId) {
+        this.inquiryId = inquiryId;
+    }
+
+    public String getQuestion() {
+        return question;
+    }
+
+    public void setQuestion(String question) {
+        this.question = question;
+    }
+
+    public String getAnswer() {
+        return answer;
+    }
+
+    public void setAnswer(String answer) {
+        this.answer = answer;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "InquiryDetail{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", inquiryId=" + inquiryId +
+                ", question=" + question +
+                ", answer=" + answer +
+                ", remark=" + remark +
+                "}";
+    }
+}

+ 281 - 0
zzcx-service/src/main/java/com/diagbot/entity/InquiryInfo.java

@@ -0,0 +1,281 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 问诊记录-主表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-02-02
+ */
+@TableName("zzcx_inquiry_info")
+public class InquiryInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 公众号appid
+     */
+    private String appId;
+
+    /**
+     * 医院名称
+     */
+    private String organName;
+
+    /**
+     * 医生所在科室名称
+     */
+    private String department;
+
+    /**
+     * 医生ID
+     */
+    private String doctorId;
+
+    /**
+     * 医生名称
+     */
+    private String doctorName;
+
+    /**
+     * 用户在纳里的ID
+     */
+    private String mpiId;
+
+    /**
+     * 用户名称
+     */
+    private String patientName;
+
+    /**
+     * 用户年龄
+     */
+    private Integer patientAge;
+
+    /**
+     * 用户性别
+     */
+    private String patientSex;
+
+    /**
+     * 诊断
+     */
+    private String diagnosis;
+
+    /**
+     * 纳里返回的url
+     */
+    private String retUrl;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+
+    public Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
+    public String getDepartment() {
+        return department;
+    }
+
+    public void setDepartment(String department) {
+        this.department = department;
+    }
+
+    public String getDoctorId() {
+        return doctorId;
+    }
+
+    public void setDoctorId(String doctorId) {
+        this.doctorId = doctorId;
+    }
+
+    public String getDoctorName() {
+        return doctorName;
+    }
+
+    public void setDoctorName(String doctorName) {
+        this.doctorName = doctorName;
+    }
+
+    public String getMpiId() {
+        return mpiId;
+    }
+
+    public void setMpiId(String mpiId) {
+        this.mpiId = mpiId;
+    }
+
+    public String getPatientName() {
+        return patientName;
+    }
+
+    public void setPatientName(String patientName) {
+        this.patientName = patientName;
+    }
+
+    public Integer getPatientAge() {
+        return patientAge;
+    }
+
+    public void setPatientAge(Integer patientAge) {
+        this.patientAge = patientAge;
+    }
+
+    public String getPatientSex() {
+        return patientSex;
+    }
+
+    public void setPatientSex(String patientSex) {
+        this.patientSex = patientSex;
+    }
+
+    public String getDiagnosis() {
+        return diagnosis;
+    }
+
+    public void setDiagnosis(String diagnosis) {
+        this.diagnosis = diagnosis;
+    }
+
+    public String getRetUrl() {
+        return retUrl;
+    }
+
+    public void setRetUrl(String retUrl) {
+        this.retUrl = retUrl;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "InquiryInfo{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", appId=" + appId +
+                ", organName=" + organName +
+                ", department=" + department +
+                ", doctorId=" + doctorId +
+                ", doctorName=" + doctorName +
+                ", mpiId=" + mpiId +
+                ", patientName=" + patientName +
+                ", patientAge=" + patientAge +
+                ", patientSex=" + patientSex +
+                ", diagnosis=" + diagnosis +
+                ", retUrl=" + retUrl +
+                ", remark=" + remark +
+                "}";
+    }
+}

+ 53 - 0
zzcx-service/src/main/java/com/diagbot/entity/JSONResponseBean.java

@@ -0,0 +1,53 @@
+package com.diagbot.entity;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class JSONResponseBean {
+	private int code = 200;
+	private String msg;
+	private Object body;
+	private Map<String, Object> properties;
+	
+	public int getCode() {
+		return code;
+	}
+	
+	public void setCode(int code) {
+		this.code = code;
+	}
+	
+	public String getMsg() {
+		return msg;
+	}
+	
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+	
+	public Object getBody() {
+		return body;
+	}
+	
+	public void setBody(Object body) {
+		this.body = body;
+	}
+	
+	public Map<String, Object> getProperties() {
+		return properties;
+	}
+	
+	public Object getProperty(String nm){
+		if(properties == null || properties.isEmpty()){
+			return null;
+		}
+		return properties.get(nm);
+	}
+	
+	public void setProperty(String name, Object val){
+		if(properties == null){
+			properties = new HashMap<>();
+		}
+		properties.put(name, val);
+	}
+}

+ 60 - 0
zzcx-service/src/main/java/com/diagbot/entity/QuestionDetail.java

@@ -0,0 +1,60 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 标签明细表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+@Getter
+@Setter
+@TableName("zzcx_question_detail")
+public class QuestionDetail implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 客户端界面描述
+     */
+    private String description;
+
+    /**
+     * question_id
+     */
+    private Long questionId;
+
+
+    /**
+     * 排序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 特殊类型
+     */
+    private Integer exclusion;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 120 - 0
zzcx-service/src/main/java/com/diagbot/entity/QuestionInfo.java

@@ -0,0 +1,120 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 标签基础表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+@Getter
+@Setter
+@TableName("zzcx_question_info")
+public class QuestionInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 内容
+     */
+    private String name;
+
+    /**
+     * 标签名
+     */
+    private String tagName;
+
+    /**
+     * 性别(1:男 2:女 3:通用)
+     */
+    private Integer sexType;
+
+    /**
+     * 最小年龄
+     */
+    private Integer ageBegin;
+
+    /**
+     * 最大年龄
+     */
+    private Integer ageEnd;
+
+    /**
+     * 类型
+     */
+    private Integer type;
+
+    /**
+     * 控件类型
+     */
+    private Integer controlType;
+
+    /**
+     * 元素类型
+     */
+    private Integer itemType;
+
+    /**
+     * 标签标识
+     */
+    private Integer tagType;
+
+
+    /**
+     * 前置内容
+     */
+    private String labelPrefix;
+
+    /**
+     * 后置内容
+     */
+    private String labelSuffix;
+
+    /**
+     * 客户端界面描述
+     */
+    private String description;
+
+    /**
+     * 图片url地址
+     */
+    private String url;
+
+    /**
+     * 特殊标记(0:没有标记,1:拼接到主诉)
+     */
+    private Integer specFlag;
+
+    /**
+     * 必填(0:不必填,1:必填)
+     */
+    private Integer required;
+
+    /**
+     * 详细阐述
+     */
+    private String explains;
+
+    /**
+     * 类型标记(1:时间类型,2:诱因类型,3:有无类型)
+     */
+    private String flag;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 80 - 0
zzcx-service/src/main/java/com/diagbot/entity/QuestionMapping.java

@@ -0,0 +1,80 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 标签映射表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+@TableName("zzcx_question_mapping")
+public class QuestionMapping implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 上级question
+     */
+    private Long parentQuestion;
+
+    /**
+     * 下级question
+     */
+    private Long sonQuestion;
+
+    /**
+     * 排序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 互斥类型
+     */
+    private Integer exclusionType;
+
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 142 - 0
zzcx-service/src/main/java/com/diagbot/entity/Request.java

@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.diagbot.entity;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Request
+ */
+public class Request {
+
+    public Request() {
+    }
+
+    public Request(String serviceId, String method, List<Object> bodys) {
+        this.appKey = appKey;
+        this.appSecret = appSecret;
+        this.bodys=bodys;
+        headers = new HashMap<>();
+        headers.put(SystemHeader.X_CA_KEY, appKey);
+        headers.put(SystemHeader.X_SERVICE_ID, serviceId);
+        headers.put(SystemHeader.X_SERVICE_METHOD, method);
+    }
+    /**
+     * (必选)服务请求地址
+     */
+    private String apiUrl;
+
+
+
+    /**
+     * (必选)APP KEY
+     */
+    private String appKey;
+
+    /**
+     * (必选)APP密钥
+     */
+    private String appSecret;
+
+    private String encodingAesKey;
+
+
+    /**
+     * (必选) HTTP头
+     */
+    private Map<String, String> headers;
+    
+
+
+    /**
+     * (必选)请求参数
+     */
+    private List<Object> bodys;
+
+    /**
+     * (可选)字符串Body体
+     */
+    private String stringBody;
+
+
+    public String getAppKey() {
+        return appKey;
+    }
+
+    public void setAppKey(String appKey) {
+        this.appKey = appKey;
+    }
+
+    public String getAppSecret() {
+        return appSecret;
+    }
+
+    public void setAppSecret(String appSecret) {
+        this.appSecret = appSecret;
+    }
+
+
+    public Map<String, String> getHeaders() {
+        return headers;
+    }
+
+    public void setHeaders(Map<String, String> headers) {
+        this.headers = headers;
+    }
+
+    public List<Object> getBodys() {
+        return bodys;
+    }
+
+    public void setBodys(List<Object> bodys) {
+        this.bodys = bodys;
+    }
+
+    public String getStringBody() {
+        return stringBody;
+    }
+
+    public void setStringBody(String stringBody) {
+        this.stringBody = stringBody;
+    }
+
+    public String getEncodingAesKey() {
+        return encodingAesKey;
+    }
+
+    public void setEncodingAesKey(String encodingAesKey) {
+        this.encodingAesKey = encodingAesKey;
+    }
+
+    public String getApiUrl() {
+        return apiUrl;
+    }
+
+    public void setApiUrl(String apiUrl) {
+        this.apiUrl = apiUrl;
+    }
+    public void addHeader(String name, String value){
+        if(headers==null){
+            headers = new HashMap<>();
+        }
+        headers.put(name, value);
+    }
+}

+ 120 - 0
zzcx-service/src/main/java/com/diagbot/entity/Response.java

@@ -0,0 +1,120 @@
+package com.diagbot.entity;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Response {
+    /**
+     * http 请求状态码
+     */
+    private int statusCode;
+    private String contentType;
+    /**
+     * 请求唯一 ID,请求一旦进入 API 网关应用后,API 网关就会生成请求 ID 并通过响应头返回给客户端,
+     * 建议客户端与后端服务都记录此请求 ID,可用于问题排查与跟踪。
+     */
+    private String requestId;
+    /**
+     * API网关会将服务端的StringToSign放到HTTP应答的Header中返回到客户端,Key为:X-Ca-Error-Message
+     * 只需要将本地计算的StringToSign与服务端返回的StringToSign进行对比即可找到问题;
+     * 如果服务端与客户端的签名串是一致的,请检查用于签名计算的密钥是否正确;
+     */
+    private String caErrorMsg;
+    /**
+     * 业务接口返回的错误信息
+     */
+    private String errorMessage;
+    private Map<String, String> headers;
+    private String body;
+    private JSONResponseBean jsonResponseBean;
+
+    public boolean isSuccess() {
+        return (200 == statusCode && jsonResponseBean != null && 200 == jsonResponseBean.getCode());
+    }
+
+    public Response() {
+
+    }
+
+    public int getStatusCode() {
+        return statusCode;
+    }
+
+    public void setStatusCode(int statusCode) {
+        this.statusCode = statusCode;
+    }
+
+    public String getContentType() {
+        return contentType;
+    }
+
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
+    }
+
+    public String getRequestId() {
+        return requestId;
+    }
+
+    public void setRequestId(String requestId) {
+        this.requestId = requestId;
+    }
+
+    public String getErrorMessage() {
+        if (jsonResponseBean != null && !"200".equals(jsonResponseBean.getCode())) {
+            return jsonResponseBean.getMsg();
+        }
+        return null;
+    }
+
+    public void setErrorMessage(String errorMessage) {
+        this.errorMessage = errorMessage;
+    }
+
+    public Map<String, String> getHeaders() {
+        return headers;
+    }
+
+    public String getHeader(String key) {
+        if (null != headers) {
+            return headers.get(key);
+        } else {
+            return null;
+        }
+    }
+
+    public void setHeaders(Map<String, String> headers) {
+        this.headers = headers;
+    }
+
+    public void setHeader(String key, String value) {
+        if (null == this.headers) {
+            this.headers = new HashMap<String, String>();
+        }
+        this.headers.put(key, value);
+    }
+
+    public String getBody() {
+        return body;
+    }
+
+    public void setBody(String body) {
+        this.body = body;
+    }
+
+    public JSONResponseBean getJsonResponseBean() {
+        return jsonResponseBean;
+    }
+
+    public void setJsonResponseBean(JSONResponseBean jsonResponseBean) {
+        this.jsonResponseBean = jsonResponseBean;
+    }
+
+    public String getCaErrorMsg() {
+        return caErrorMsg;
+    }
+
+    public void setCaErrorMsg(String caErrorMsg) {
+        this.caErrorMsg = caErrorMsg;
+    }
+}

+ 29 - 0
zzcx-service/src/main/java/com/diagbot/entity/SystemHeader.java

@@ -0,0 +1,29 @@
+
+package com.diagbot.entity;
+
+/**
+ * 系统HTTP头常量
+ */
+public class SystemHeader {
+    //签名Header
+    public static final String X_CA_SIGNATURE = "X-Ca-Signature";
+    //所有参与签名的Header
+    public static final String X_CA_SIGNATURE_HEADERS = "X-Ca-Signature-Headers";
+    //请求时间戳
+    public static final String X_CA_TIMESTAMP = "X-Ca-Timestamp";
+    //请求放重放Nonce,15分钟内保持唯一,建议使用UUID
+    public static final String X_CA_NONCE = "X-Ca-Nonce";
+    //APP KEY
+    public static final String X_CA_KEY = "X-Ca-Key";
+    //服务id
+    public static final String X_SERVICE_ID = "X-Service-Id";
+    //具体method
+    public static final String X_SERVICE_METHOD = "X-Service-Method";
+    //MD5加密的请求体信息
+    public static final String X_CONTENT_MD5 = "X-Content-MD5";
+
+    //MD5加密的请求体信息
+    public static final String X_CA_REQUESTID = "X-Ca-RequestId";
+    //API网关会将服务端的StringToSign放到HTTP应答的Header中返回到客户端,Key为:X-Ca-Error-Message
+    public static final String X_CA_ERROR_MESSAGE = "X-Ca-Error-Message";
+}

+ 142 - 0
zzcx-service/src/main/java/com/diagbot/entity/User.java

@@ -0,0 +1,142 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 系统用户表
+ * </p>
+ *
+ * @author gaodm
+ * @since 2018-08-30
+ */
+@TableName("sys_user")
+public class User implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 用户ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 用户密码
+     */
+    private String password;
+
+    /**
+     * 用户名
+     */
+    private String username;
+
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+
+    public Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    @Override
+    public String toString() {
+        return "User{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", password=" + password +
+                ", username=" + username +
+                "}";
+    }
+}

+ 21 - 0
zzcx-service/src/main/java/com/diagbot/entity/wrapper/QuestionInfoWrapper.java

@@ -0,0 +1,21 @@
+package com.diagbot.entity.wrapper;
+
+import com.diagbot.entity.QuestionInfo;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 标签扩展表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+@Getter
+@Setter
+public class QuestionInfoWrapper extends QuestionInfo {
+    private Long parentQuestion; //父级问题ID
+    private Integer exclusionType; //互斥类型
+
+}

+ 81 - 0
zzcx-service/src/main/java/com/diagbot/exception/CommonExceptionHandler.java

@@ -0,0 +1,81 @@
+package com.diagbot.exception;
+
+import com.diagbot.dto.RespDTO;
+import com.diagbot.util.GsonUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.BindException;
+import org.springframework.validation.FieldError;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * @Description: 错误通用处理
+ * @author: gaodm
+ * @time: 2018/8/2 14:22
+ */
+@ControllerAdvice
+@ResponseBody
+@Slf4j
+public class CommonExceptionHandler {
+
+    @ExceptionHandler(Exception.class)
+    public ResponseEntity<RespDTO> handleException(Exception e) {
+        RespDTO resp = new RespDTO();
+        if (e instanceof BindException) {
+            BindException ex = (BindException) e;
+            Map<String, String> stringMap = new HashMap<>();
+            for (FieldError fieldError : ex.getBindingResult().getFieldErrors()) {
+                stringMap.put(fieldError.getField(), fieldError.getDefaultMessage());
+            }
+            String msg = GsonUtil.toJson(stringMap);
+            log.warn("【参数异常】:{}", msg);
+            resp.code = CommonErrorCode.PARAM_ERROR.getCode();
+            resp.msg = msg;
+            return new ResponseEntity(resp, HttpStatus.OK);
+        }
+        if (e instanceof MethodArgumentNotValidException) {
+            MethodArgumentNotValidException ex = (MethodArgumentNotValidException) e;
+            Map<String, String> stringMap = new HashMap<>();
+            for (FieldError fieldError : ex.getBindingResult().getFieldErrors()) {
+                stringMap.put(fieldError.getField(), fieldError.getDefaultMessage());
+            }
+            String msg = GsonUtil.toJson(stringMap);
+            log.warn("【参数异常】:{}", msg);
+            resp.code = CommonErrorCode.PARAM_ERROR.getCode();
+            resp.msg = msg;
+            return new ResponseEntity(resp, HttpStatus.OK);
+        }
+        if (e instanceof MissingServletRequestParameterException) {
+            MissingServletRequestParameterException ex = (MissingServletRequestParameterException) e;
+            Map<String, String> stringMap = new HashMap<>();
+            stringMap.put(ex.getParameterName(), "不能为null");
+            String msg = GsonUtil.toJson(stringMap);
+            log.warn("【参数异常】:{}", msg);
+            resp.code = CommonErrorCode.PARAM_ERROR.getCode();
+            resp.msg = msg;
+            return new ResponseEntity(resp, HttpStatus.OK);
+        }
+        if (e instanceof CommonException) {
+            CommonException taiChiException = (CommonException) e;
+            resp.code = taiChiException.getCode();
+            resp.msg = e.getMessage();
+            log.error("【业务异常】:{}", e.getMessage());
+            return new ResponseEntity(resp, HttpStatus.OK);
+        }
+        resp.code = CommonErrorCode.FAIL.getCode();
+        resp.msg = e.getMessage();
+        log.error("【系统异常】:{}", e.getMessage());
+        e.printStackTrace();
+        return new ResponseEntity(resp, HttpStatus.OK);
+    }
+
+}

+ 39 - 0
zzcx-service/src/main/java/com/diagbot/exception/ServiceErrorCode.java

@@ -0,0 +1,39 @@
+package com.diagbot.exception;
+
+/**
+ * @Description: 本服务错误码
+ * 系统码(3位) + 等级码(1位) + 4位顺序号
+ * 系统码 通用码 000;用户中心 100; 管理中心 200;
+ * @author: gaodm
+ * @time: 2018/9/10 11:11
+ */
+public enum ServiceErrorCode implements ErrorCode {
+    LOG_IS_NOT_EXIST("90020001", "该日志不存在");
+
+    private String code;
+    private String msg;
+
+
+    ServiceErrorCode(String code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public static ServiceErrorCode codeOf(String code) {
+        for (ServiceErrorCode state : values()) {
+            if (state.getCode() == code) {
+                return state;
+            }
+        }
+        return null;
+    }
+}

+ 14 - 0
zzcx-service/src/main/java/com/diagbot/facade/InquiryDetailFacade.java

@@ -0,0 +1,14 @@
+package com.diagbot.facade;
+
+import com.diagbot.service.impl.InquiryDetailServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2020/2/1 23:34
+ */
+@Component
+public class InquiryDetailFacade extends InquiryDetailServiceImpl {
+
+}

+ 112 - 0
zzcx-service/src/main/java/com/diagbot/facade/InquiryInfoFacade.java

@@ -0,0 +1,112 @@
+package com.diagbot.facade;
+
+import com.diagbot.dto.SaveInquiryDTO;
+import com.diagbot.entity.Client;
+import com.diagbot.entity.InquiryDetail;
+import com.diagbot.entity.InquiryInfo;
+import com.diagbot.entity.JSONResponseBean;
+import com.diagbot.entity.Request;
+import com.diagbot.entity.Response;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.impl.InquiryDetailServiceImpl;
+import com.diagbot.service.impl.InquiryInfoServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.SaveInquiryVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2020/2/1 23:33
+ */
+@Component
+public class InquiryInfoFacade extends InquiryInfoServiceImpl {
+    //    @Autowired
+    //    private InquiryDetailFacade inquiryDetailFacade;
+    @Autowired
+    @Qualifier("inquiryDetailServiceImpl")
+    private InquiryDetailServiceImpl inquiryDetailService;
+
+    public SaveInquiryDTO saveInquiry(SaveInquiryVO saveInquiryVO) {
+        SaveInquiryDTO saveInquiryDTO = new SaveInquiryDTO();
+//        String retUrl = getUrl(saveInquiryVO);
+        Date now = DateUtil.now();
+
+        InquiryInfo inquiryInfo = new InquiryInfo();
+        BeanUtil.copyProperties(saveInquiryVO, inquiryInfo);
+        inquiryInfo.setGmtCreate(now);
+        inquiryInfo.setGmtModified(now);
+//        inquiryInfo.setRetUrl(retUrl);
+        save(inquiryInfo);
+
+        List<InquiryDetail> inquiryDetailList = BeanUtil.listCopyTo(saveInquiryVO.getDetailList(), InquiryDetail.class);
+        inquiryDetailList.forEach(i -> {
+            i.setInquiryId(inquiryInfo.getId());
+            i.setGmtCreate(now);
+            i.setGmtModified(now);
+        });
+        inquiryDetailService.saveBatch(inquiryDetailList);
+
+//        saveInquiryDTO.setBody(retUrl);
+        return saveInquiryDTO;
+    }
+
+//    private String getUrl(SaveInquiryVO saveInquiryVO) {
+//        String retUrl = null;
+//        try {
+//            String encodingAesKey = "";
+//            Client client = new Client(apiUrl, appKey, appSecret, encodingAesKey);
+//            Response response = client.execute(getltcs(saveInquiryVO));
+//            if (response.isSuccess()) {
+//                JSONResponseBean result = response.getJsonResponseBean();
+//                retUrl = result.getBody().toString();
+//            }
+//        } catch (Exception e) {
+//        }
+//        if (StringUtil.isBlank(retUrl)) {
+//            throw new CommonException(CommonErrorCode.RPC_ERROR, "提交失败");
+//        }
+//        return retUrl;
+//    }
+//
+//    private Request getltcs(SaveInquiryVO saveInquiryVO) {
+//        List bodyList = new ArrayList<>();
+//
+//        List<Map<String, Object>> details = new ArrayList<>();
+//        saveInquiryVO.getDetailList().forEach(i -> {
+//            Map<String, Object> detail = new HashMap<>();
+//            detail.put("question", i.getQuestion());
+//            detail.put("answer", i.getAnswer());
+//            details.add(detail);
+//        });
+//
+//        Map<String, Object> body = new HashMap<>();
+//        body.put("details", details);
+//        body.put("doctorId", Integer.parseInt(saveInquiryVO.getDoctorId()));
+//        body.put("mpiId", saveInquiryVO.getMpiId());
+//        body.put("appId", saveInquiryVO.getAppId());
+//        if (saveInquiryVO.getDepartment().equals("全科")){
+//            body.put("diagnosis", saveInquiryVO.getDiagnosis());
+//        }
+//        bodyList.add(body);
+//
+//        //X-Service-Id对应的值
+//        String serviceId = "consult.questionRecordService";
+//        //X-Service-Method对应的值
+//        String method = "saveQuestionRecord";
+//        return new Request(serviceId, method, bodyList);
+//    }
+
+}

+ 65 - 0
zzcx-service/src/main/java/com/diagbot/facade/QuestionDetailFacade.java

@@ -0,0 +1,65 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.entity.QuestionDetail;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.QuestionDetailServiceImpl;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 标签业务层
+ * @author: zhoutg
+ * @time: 2018/8/6 9:11
+ */
+@Component
+public class QuestionDetailFacade extends QuestionDetailServiceImpl {
+
+
+    /**
+     * 根据id获取标签明细
+     *
+     * @param questionId 标签id
+     * @return 标签内容
+     */
+    public List<QuestionDetail> getByQuestionId(Long questionId) {
+        List<QuestionDetail> questionDetailList = new ArrayList<>();
+        if (questionId == null) {
+            return questionDetailList;
+        }
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+        queryWrapper.eq("question_id", questionId);
+        queryWrapper.orderByAsc("order_no");
+        questionDetailList = this.list(queryWrapper);
+        return questionDetailList;
+    }
+
+    /**
+     * 根据id获取标签明细
+     *
+     * @param questionIds 标签ids
+     * @return 标签内容
+     */
+    public Map<Long, List<QuestionDetail>> getByQuestionIds(List<Long> questionIds) {
+        Map<Long, List<QuestionDetail>> map = new LinkedHashMap<>();
+        if (ListUtil.isEmpty(questionIds)) {
+            return map;
+        }
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+        queryWrapper.in("question_id", questionIds);
+        queryWrapper.orderByAsc("question_id", "order_no");
+        List<QuestionDetail> questionDetailList = this.list(queryWrapper);
+        if (ListUtil.isNotEmpty(questionDetailList)) {
+            map = EntityUtil.makeEntityListMap(questionDetailList, "questionId");
+        }
+        return map;
+    }
+}

+ 227 - 0
zzcx-service/src/main/java/com/diagbot/facade/QuestionFacade.java

@@ -0,0 +1,227 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.QuestionDTO;
+import com.diagbot.entity.QuestionDetail;
+import com.diagbot.entity.QuestionInfo;
+import com.diagbot.entity.wrapper.QuestionInfoWrapper;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.QuestionInfoServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.vo.QuestionIds2VO;
+import com.diagbot.vo.QuestionVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: 标签业务层
+ * @author: zhoutg
+ * @time: 2018/8/6 9:11
+ */
+@Component
+public class QuestionFacade extends QuestionInfoServiceImpl {
+
+    @Autowired
+    QuestionDetailFacade questionDetailFacade;
+
+    /**
+     * 根据参数返回标签内容
+     *
+     * @param questionVO 获取标签内容参数
+     * @return 标签内容
+     */
+    public QuestionDTO getById(QuestionVO questionVO) {
+        Map paramMap = new HashMap<>();
+        paramMap.put("sexType", questionVO.getSexType());
+        paramMap.put("age", questionVO.getAge());
+        paramMap.put("id", questionVO.getId());
+        QuestionInfo questionInfo = this.getByParam(paramMap);
+        if (questionInfo == null) { //无数据直接返回,不通过报错的形式返回
+            return new QuestionDTO();
+        }
+        QuestionDTO res = new QuestionDTO();
+        BeanUtil.copyProperties(questionInfo, res);
+
+        if (questionInfo.getTagType().equals(1)) {
+            //获取明细项
+            List<QuestionDetail> questionDetailList = questionDetailFacade.getByQuestionId(questionVO.getId());
+            res.setQuestionDetailList(questionDetailList);
+        }
+
+        //获取子标签
+        List<QuestionInfoWrapper> questionMapping = this.getByQuestionMapping(paramMap);
+        List<QuestionDTO> sonQuestionList = BeanUtil.listCopyTo(questionMapping, QuestionDTO.class);
+        res.setQuestionMapping(sonQuestionList);
+        //获取子标签的明细项
+        if (ListUtil.isNotEmpty(sonQuestionList)) {
+            Map paramMap1 = new HashMap<>();
+            paramMap1.put("sexType", questionVO.getSexType());
+            paramMap1.put("age", questionVO.getAge());
+            List<Long> sonQuestionIds = sonQuestionList.stream()
+                    .map(artist -> artist.getId())
+                    .collect(Collectors.toList());
+            Map<Long, List<QuestionDetail>> sonQuestionMap = questionDetailFacade.getByQuestionIds(sonQuestionIds);
+            paramMap1.put("ids", sonQuestionIds);
+            //获取第二级子标签
+            List<QuestionInfoWrapper> questionMapping1 = this.getByQuestionMapping(paramMap1);
+            Map<Long, List<QuestionInfoWrapper>> qm1 =
+                    EntityUtil.makeEntityListMap(questionMapping1, "parentQuestion");
+            for (QuestionDTO bean : sonQuestionList) {
+                List<QuestionDetail> questionDetailList1 = sonQuestionMap.get(bean.getId());
+                if (ListUtil.isEmpty(questionDetailList1)) {
+                    questionDetailList1 = new ArrayList<>();
+                }
+                bean.setQuestionDetailList(questionDetailList1);
+                List<QuestionDTO> sonQuestionList1 = new ArrayList<>();
+                if (ListUtil.isNotEmpty(qm1.get(bean.getId()))) {
+                    sonQuestionList1 = BeanUtil.listCopyTo(qm1.get(bean.getId()), QuestionDTO.class);
+                }
+                bean.setQuestionMapping(sonQuestionList1);
+
+                List<Long> sonQuestionIds1 = sonQuestionList1.stream()
+                        .map(artist -> artist.getId())
+                        .collect(Collectors.toList());
+                Map<Long, List<QuestionDetail>> sonQuestionMap1 = questionDetailFacade.getByQuestionIds(sonQuestionIds1);
+                for (QuestionDTO questionDTO : sonQuestionList1) {
+                    //获取二级子明细项
+                    List<QuestionDetail> questionDetailList2 = sonQuestionMap1.get(questionDTO.getId());
+                    if (ListUtil.isEmpty(questionDetailList2)) {
+                        questionDetailList2 = new ArrayList<>();
+                    }
+                    questionDTO.setQuestionDetailList(questionDetailList2);
+                }
+
+            }
+        }
+        return res;
+    }
+
+
+    /**
+     * 查询多个id返回标签内容
+     *
+     * @param questionIds2VO 获取标签内容参数
+     * @return 标签内容
+     */
+    public Map<Long, Object> getByIds(QuestionIds2VO questionIds2VO) {
+        Integer sexType = questionIds2VO.getSexType();
+        Integer age = questionIds2VO.getAge();
+        Map<Long, Object> data = new LinkedHashMap<>();
+        if (ListUtil.isEmpty(questionIds2VO.getIds())) {
+            return data;
+        }
+
+        Map paramMap = new HashMap<>();
+        paramMap.put("sexType", sexType);
+        paramMap.put("age", age);
+        paramMap.put("idList", questionIds2VO.getIds());
+
+        List<QuestionInfo> questionInfoList = this.getByParam2(paramMap);
+        List<Long> questionId = questionInfoList.stream().map(r -> r.getId()).collect(Collectors.toList());
+
+        // 获取第一层明细项
+        Map<Long, List<QuestionDetail>> detailMap = getQuestionDetailWithMap(questionInfoList.stream()
+                .filter(r -> r.getTagType() == 1).map(r -> r.getId()).collect(Collectors.toList()));
+
+        // 获取第二层mapping和明细项
+        List<Long> ques2 = new ArrayList<>();
+        Map<Long, List<QuestionInfoWrapper>> mapping2 = getQuestionMappingWithMap(sexType, age, questionId, ques2);
+        Map<Long, List<QuestionDetail>> detailMap2 = getQuestionDetailWithMap(ques2);
+
+        // 获取第三层mapping和明细项
+        List<Long> ques3 = new ArrayList<>();
+        Map<Long, List<QuestionInfoWrapper>> mapping3 = new HashMap<>();
+        Map<Long, List<QuestionDetail>> detailMap3 = new HashMap<>();
+        if (!ListUtil.isEmpty(ques2)) {
+            mapping3 = getQuestionMappingWithMap(sexType, age, ques2, ques3);
+            detailMap3 = getQuestionDetailWithMap(ques3);
+        }
+
+        for (QuestionInfo questionInfo : questionInfoList) {
+            QuestionDTO res = new QuestionDTO();
+            BeanUtil.copyProperties(questionInfo, res);
+            // 设置第一层明细
+            if (detailMap.get(res.getId()) != null) {
+                res.setQuestionDetailList(detailMap.get(res.getId()));
+            }
+
+            // 设置第二层mapping
+            List<QuestionInfoWrapper> w2 = mapping2.get(res.getId());
+            if (ListUtil.isNotEmpty(w2)) {
+                List<QuestionDTO> m2 = BeanUtil.listCopyTo(w2, QuestionDTO.class);
+                res.setQuestionMapping(m2);
+                for (QuestionDTO q2 : m2) {
+                    // 设置第二层明细
+                    if (detailMap2.get(q2.getId()) != null) {
+                        q2.setQuestionDetailList(detailMap2.get(q2.getId()));
+                    }
+                    List<QuestionInfoWrapper> w3 = mapping3.get(q2.getId());
+                    if (ListUtil.isNotEmpty(w3)) {
+                        // 设置第三层mapping
+                        List<QuestionDTO> m3 = BeanUtil.listCopyTo(w3, QuestionDTO.class);
+                        q2.setQuestionMapping(m3);
+                        for (QuestionDTO q3 : m3) {
+                            // 设置第三层明细
+                            if (detailMap3.get(q3.getId()) != null) {
+                                q3.setQuestionDetailList(detailMap3.get(q3.getId()));
+                            }
+                        }
+                    }
+                }
+            }
+            data.put(res.getId(), res);
+        }
+        return data;
+    }
+
+
+    /**
+     * 根据questionIds获取明细
+     *
+     * @param questionIds
+     * @return
+     */
+    public Map<Long, List<QuestionDetail>> getQuestionDetailWithMap(List<Long> questionIds) {
+        if (ListUtil.isEmpty(questionIds)) {
+            return new LinkedHashMap<>();
+        }
+
+        List<QuestionDetail> detailList = questionDetailFacade.list(new QueryWrapper<QuestionDetail>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("question_id", questionIds)
+                .orderByAsc("order_no"));
+        Map<Long, List<QuestionDetail>> detailMap =
+                EntityUtil.makeEntityListMap(detailList, "questionId");
+        return detailMap;
+    }
+
+
+    /**
+     * 获取下级question
+     *
+     * @param sexType 性别
+     * @param age     年龄
+     * @param ids     列表
+     * @return
+     */
+    public Map getQuestionMappingWithMap(Integer sexType, Integer age, List<Long> ids, List<Long> mappIds) {
+        Map paramMap = new HashMap<>();
+        paramMap.put("sexType", sexType);
+        paramMap.put("age", age);
+        paramMap.put("ids", ids);
+        List<QuestionInfoWrapper> questionMapping1 = this.getByQuestionMapping(paramMap);
+        List<Long> list = questionMapping1.stream().map(r -> r.getId()).collect(Collectors.toList());
+        mappIds.addAll(list);
+        return EntityUtil.makeEntityListMap(questionMapping1, "parentQuestion");
+    }
+
+}

+ 16 - 0
zzcx-service/src/main/java/com/diagbot/mapper/InquiryDetailMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.InquiryDetail;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 问诊记录-明细表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-02-01
+ */
+public interface InquiryDetailMapper extends BaseMapper<InquiryDetail> {
+
+}

+ 16 - 0
zzcx-service/src/main/java/com/diagbot/mapper/InquiryInfoMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.InquiryInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 问诊记录-主表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-02-01
+ */
+public interface InquiryInfoMapper extends BaseMapper<InquiryInfo> {
+
+}

+ 16 - 0
zzcx-service/src/main/java/com/diagbot/mapper/QuestionDetailMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.entity.QuestionDetail;
+
+/**
+ * <p>
+ * 标签明细表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+public interface QuestionDetailMapper extends BaseMapper<QuestionDetail> {
+
+}

+ 48 - 0
zzcx-service/src/main/java/com/diagbot/mapper/QuestionInfoMapper.java

@@ -0,0 +1,48 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.entity.QuestionInfo;
+import com.diagbot.entity.wrapper.QuestionInfoWrapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 标签基础表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+public interface QuestionInfoMapper extends BaseMapper<QuestionInfo> {
+
+
+    /**
+     * 根据参数获取标签信息
+     *
+     * @param map 参数
+     * @return
+     */
+    public QuestionInfo getByParam(Map map);
+
+
+    /**
+     * 根据参数获取标签信息
+     *
+     * @param map 参数
+     * @return
+     */
+    public List<QuestionInfo> getByParam2(Map map);
+
+
+    /**
+     * 根据questionMapping获取标签信息
+     *
+     * @param map 参数
+     * @return
+     */
+    public List<QuestionInfoWrapper> getByQuestionMapping(Map map);
+
+
+}

+ 16 - 0
zzcx-service/src/main/java/com/diagbot/mapper/QuestionMappingMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.entity.QuestionMapping;
+
+/**
+ * <p>
+ * 标签映射表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+public interface QuestionMappingMapper extends BaseMapper<QuestionMapping> {
+
+}

+ 23 - 0
zzcx-service/src/main/java/com/diagbot/rabbit/MyProcessor.java

@@ -0,0 +1,23 @@
+package com.diagbot.rabbit;
+
+import org.springframework.cloud.stream.annotation.Input;
+import org.springframework.cloud.stream.annotation.Output;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.SubscribableChannel;
+
+/**
+ * @Description: 自定义Stream发布和消费对象
+ * @author: gaodm
+ * @time: 2018/8/29 13:39
+ */
+public interface MyProcessor {
+
+    String INPUT_LOG = "inputLog";
+    String OUTPUT_LOG = "outputLog";
+
+    @Input(INPUT_LOG)
+    SubscribableChannel inputLog();
+
+    @Output(OUTPUT_LOG)
+    MessageChannel outputLog();
+}

+ 27 - 0
zzcx-service/src/main/java/com/diagbot/rabbit/MySender.java

@@ -0,0 +1,27 @@
+package com.diagbot.rabbit;
+
+import com.diagbot.biz.log.entity.SysLog;
+import com.diagbot.util.GsonUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.integration.support.MessageBuilder;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 发布者
+ * @author: gaodm
+ * @time: 2018/8/29 13:41
+ */
+@Component
+@EnableBinding({ MyProcessor.class })
+public class MySender {
+    @Autowired
+    @Qualifier("outputLog")
+    MessageChannel outputLog;
+
+    public void outputLogSend(SysLog sysLog) {
+        outputLog.send(MessageBuilder.withPayload(GsonUtil.toJson(sysLog)).build());
+    }
+}

+ 16 - 0
zzcx-service/src/main/java/com/diagbot/service/InquiryDetailService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.InquiryDetail;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 问诊记录-明细表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-02-01
+ */
+public interface InquiryDetailService extends IService<InquiryDetail> {
+
+}

+ 16 - 0
zzcx-service/src/main/java/com/diagbot/service/InquiryInfoService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.InquiryInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 问诊记录-主表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-02-01
+ */
+public interface InquiryInfoService extends IService<InquiryInfo> {
+
+}

+ 16 - 0
zzcx-service/src/main/java/com/diagbot/service/QuestionDetailService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.QuestionDetail;
+
+/**
+ * <p>
+ * 标签明细表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+public interface QuestionDetailService extends IService<QuestionDetail> {
+
+}

+ 40 - 0
zzcx-service/src/main/java/com/diagbot/service/QuestionInfoService.java

@@ -0,0 +1,40 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.QuestionInfo;
+import com.diagbot.entity.wrapper.QuestionInfoWrapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 标签基础表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+public interface QuestionInfoService extends IService<QuestionInfo> {
+
+    /**
+     * 根据参数获取标签信息
+     *
+     * @param map 参数
+     * @return
+     */
+    public QuestionInfo getByParam(Map map);
+
+
+    public List<QuestionInfo> getByParam2(Map map);
+
+
+    /**
+     * 根据questionMapping获取标签信息
+     *
+     * @param map 参数
+     * @return
+     */
+    public List<QuestionInfoWrapper> getByQuestionMapping(Map map);
+
+}

+ 16 - 0
zzcx-service/src/main/java/com/diagbot/service/QuestionMappingService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.QuestionMapping;
+
+/**
+ * <p>
+ * 标签映射表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+public interface QuestionMappingService extends IService<QuestionMapping> {
+
+}

+ 20 - 0
zzcx-service/src/main/java/com/diagbot/service/impl/InquiryDetailServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.InquiryDetail;
+import com.diagbot.mapper.InquiryDetailMapper;
+import com.diagbot.service.InquiryDetailService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 问诊记录-明细表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-02-01
+ */
+@Service
+public class InquiryDetailServiceImpl extends ServiceImpl<InquiryDetailMapper, InquiryDetail> implements InquiryDetailService {
+
+}

+ 20 - 0
zzcx-service/src/main/java/com/diagbot/service/impl/InquiryInfoServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.InquiryInfo;
+import com.diagbot.mapper.InquiryInfoMapper;
+import com.diagbot.service.InquiryInfoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 问诊记录-主表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-02-01
+ */
+@Service
+public class InquiryInfoServiceImpl extends ServiceImpl<InquiryInfoMapper, InquiryInfo> implements InquiryInfoService {
+
+}

+ 20 - 0
zzcx-service/src/main/java/com/diagbot/service/impl/QuestionDetailServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.QuestionDetail;
+import com.diagbot.mapper.QuestionDetailMapper;
+import com.diagbot.service.QuestionDetailService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 标签明细表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+@Service
+public class QuestionDetailServiceImpl extends ServiceImpl<QuestionDetailMapper, QuestionDetail> implements QuestionDetailService {
+
+}

+ 39 - 0
zzcx-service/src/main/java/com/diagbot/service/impl/QuestionInfoServiceImpl.java

@@ -0,0 +1,39 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.QuestionInfo;
+import com.diagbot.entity.wrapper.QuestionInfoWrapper;
+import com.diagbot.mapper.QuestionInfoMapper;
+import com.diagbot.service.QuestionInfoService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 标签基础表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+@Service
+public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, QuestionInfo> implements QuestionInfoService {
+
+    @Override
+    public QuestionInfo getByParam(Map map) {
+        return baseMapper.getByParam(map);
+    }
+
+    @Override
+    public List<QuestionInfo> getByParam2(Map map) {
+        return baseMapper.getByParam2(map);
+    }
+
+    @Override
+    public List<QuestionInfoWrapper> getByQuestionMapping(Map map) {
+        return baseMapper.getByQuestionMapping(map);
+    }
+
+}

+ 20 - 0
zzcx-service/src/main/java/com/diagbot/service/impl/QuestionMappingServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.QuestionMapping;
+import com.diagbot.mapper.QuestionMappingMapper;
+import com.diagbot.service.QuestionMappingService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 标签映射表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+@Service
+public class QuestionMappingServiceImpl extends ServiceImpl<QuestionMappingMapper, QuestionMapping> implements QuestionMappingService {
+
+}

+ 95 - 0
zzcx-service/src/main/java/com/diagbot/util/AESUtils.java

@@ -0,0 +1,95 @@
+package com.diagbot.util;
+
+import com.diagbot.entity.Constants;
+import org.apache.commons.codec.binary.Base64;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.Key;
+
+public class AESUtils {
+
+    private static final String KEY_ALGORITHM = "AES";
+    private static final String DEFAULT_CIPHER_ALGORITHM = "AES/ECB/PKCS5Padding";
+
+    public static byte[] initSecretKey() throws Exception {
+        KeyGenerator kg = KeyGenerator.getInstance(KEY_ALGORITHM);
+        kg.init(128);
+        SecretKey secretKey = kg.generateKey();
+
+        return secretKey.getEncoded();
+    }
+
+    public static Key toKey(byte[] key) {
+        return new SecretKeySpec(key, KEY_ALGORITHM);
+    }
+
+    public static String encrypt(String data, String key) throws Exception {
+        return Base64.encodeBase64String(encrypt(data.getBytes(Constants.ENCODING), toKey(key.getBytes()), DEFAULT_CIPHER_ALGORITHM));
+    }
+
+    public static String decrypt(String data, String key) throws Exception {
+        return new String(decrypt(Base64.decodeBase64(data.getBytes(Constants.ENCODING)), toKey(key.getBytes()), DEFAULT_CIPHER_ALGORITHM));
+    }
+
+    public static byte[] encrypt(byte[] data, Key key) throws Exception {
+        return encrypt(data, key, DEFAULT_CIPHER_ALGORITHM);
+    }
+
+    public static byte[] encrypt(byte[] data, byte[] key) throws Exception {
+        return encrypt(data, toKey(key), DEFAULT_CIPHER_ALGORITHM);
+    }
+
+    public static byte[] encrypt(byte[] data, Key key, String cipherAlgorithm) throws Exception {
+        Cipher cipher = Cipher.getInstance(cipherAlgorithm);
+        cipher.init(Cipher.ENCRYPT_MODE, key);
+        return cipher.doFinal(data);
+    }
+
+    public static byte[] decrypt(byte[] data, byte[] key) throws Exception {
+        return decrypt(data, key, DEFAULT_CIPHER_ALGORITHM);
+    }
+
+    public static byte[] decrypt(byte[] data, Key key) throws Exception {
+        return decrypt(data, key, DEFAULT_CIPHER_ALGORITHM);
+    }
+
+    public static byte[] decrypt(byte[] data, byte[] key, String cipherAlgorithm) throws Exception {
+        Key k = toKey(key);
+        return decrypt(data, k, cipherAlgorithm);
+    }
+
+    public static byte[] decrypt(byte[] data, Key key, String cipherAlgorithm) throws Exception {
+        Cipher cipher = Cipher.getInstance(cipherAlgorithm);
+        cipher.init(Cipher.DECRYPT_MODE, key);
+        return cipher.doFinal(data);
+    }
+
+    private static String showByteArray(byte[] data) {
+        if (null == data) {
+            return null;
+        }
+        StringBuilder sb = new StringBuilder("{");
+        for (byte b : data) {
+            sb.append(b).append(",");
+        }
+        sb.deleteCharAt(sb.length() - 1);
+        sb.append("}");
+        return sb.toString();
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        String original = "[1]";
+        String key = "1234567890123456";
+        System.out.println("original: " + original);
+        String encrypt = encrypt(original, key);
+        System.out.println("encrypt: " + encrypt + ", key: " + key);
+        String decrypt = decrypt(encrypt, key);
+        System.out.println("decrypt: " + decrypt);
+
+    }
+
+}

+ 71 - 0
zzcx-service/src/main/java/com/diagbot/util/Demo.java

@@ -0,0 +1,71 @@
+package com.diagbot.util;
+
+import com.diagbot.entity.Client;
+import com.diagbot.entity.JSONResponseBean;
+import com.diagbot.entity.Request;
+import com.diagbot.entity.Response;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Demo {
+
+    public static void main(String[] args) throws Exception {
+        //必填 apiUrl
+        String apiUrl = "http://116.62.170.131:8096/openapi-devtest/gateway";
+        //必填
+        String appKey = "ngari5e34e52511dc394f";
+        //必填
+        String appSecret = "11dc394fc05518c1";
+        //如果开启加密,则必填
+        String encodingAesKey = "";
+        Client client = new Client(apiUrl, appKey, appSecret, encodingAesKey);
+
+        //调用相应的接口请求
+        Response response = client.execute(getltcs());
+//        System.out.println(JSONUtils.toString(response));
+        if (response.isSuccess()) {
+            //接口返回的结果
+            JSONResponseBean result = response.getJsonResponseBean();
+//            System.out.println(JSONUtils.toString(result));
+            System.out.println(result.getBody().toString());
+
+        } else {
+            System.out.println(response.getCaErrorMsg());
+            System.out.println(response.getErrorMessage());
+        }
+
+    }
+
+    public static Request getltcs() {
+        //入参赋值,注意最外层是个json数组
+        List bodyList = new ArrayList<>();
+
+        List<Map<String, Object>> details = new ArrayList<>();
+        Map<String, Object> detail1 = new HashMap<>();
+        detail1.put("question", "问题1");
+        detail1.put("answer", "答案1");
+        Map<String, Object> detail2 = new HashMap<>();
+        detail2.put("question", "问题2");
+        detail2.put("answer", "答案2");
+        details.add(detail1);
+        details.add(detail2);
+
+        Map<String, Object> body = new HashMap<>();
+        body.put("details", details);
+        body.put("doctorId", 1182);
+        body.put("mpiId", "2c90818958b4f5f10158b50289020001");
+        body.put("appId", "wx6a80dd109228fd4b");
+        body.put("diagnosis", "Summary");
+
+        bodyList.add(body);
+
+        //X-Service-Id对应的值
+        String serviceId = "consult.questionRecordService";
+        //X-Service-Method对应的值
+        String method = "saveQuestionRecord";
+        return new Request(serviceId, method, bodyList);
+    }
+}

+ 139 - 0
zzcx-service/src/main/java/com/diagbot/util/JSONUtils.java

@@ -0,0 +1,139 @@
+package com.diagbot.util;
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.text.SimpleDateFormat;
+
+public class JSONUtils {
+	private static ObjectMapper mapper =  new ObjectMapper();
+
+	static{
+		mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+		mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
+		mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
+
+		mapper.configure(SerializationFeature.WRITE_ENUMS_USING_TO_STRING,true);
+		mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+		mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
+		mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+		mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+
+	}
+
+	public static <T> T parse(String value, Class<T> clz){
+
+		if (StringUtils.isEmpty(value)) {
+			return null;
+		}
+		try {
+			return mapper.readValue(value, clz);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	public static <T> T parse(byte[] bytes, Class<T> clz){
+		try {
+			return mapper.readValue(bytes, clz);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+
+	public static <T> T parse(InputStream ins, Class<T> clz){
+		try {
+			return mapper.readValue(ins, clz);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+
+	public static <T> T  parse(Reader reader, Class<T> clz){
+		try {
+			return mapper.readValue(reader, clz);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	@SuppressWarnings("unchecked")
+	public static <T> T update(String value, T object) {
+		try {
+			return (T) mapper.readerForUpdating(object).readValue(value);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	public static String writeValueAsString(Object o){
+		try {
+			return mapper.writeValueAsString(o);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	public static void write(OutputStream outs, Object o){
+		try {
+			mapper.writeValue(outs,o);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+    }
+
+	public static void write(Writer writer, Object o){
+		try {
+			mapper.writeValue(writer,o);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	public static String toString(Object o){
+		try {
+			return mapper.writeValueAsString(o);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	public static String toString(Object o, Class<?> clz){
+		try {
+			return mapper.writerFor(clz).writeValueAsString(o);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	public static byte[] toBytes(Object o){
+		try {
+			return mapper.writeValueAsBytes(o);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+}

+ 118 - 0
zzcx-service/src/main/java/com/diagbot/util/MessageDigestUtil.java

@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.diagbot.util;
+
+import com.diagbot.entity.Constants;
+import org.apache.commons.codec.binary.Base64;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * 消息摘要工具
+ */
+public class MessageDigestUtil {
+    /**
+     * 先进行MD5摘要再进行Base64编码获取摘要字符串
+     *
+     * @param str
+     * @return
+     */
+    public static String base64AndMD5(String str) {
+        if (str == null) {
+            throw new IllegalArgumentException("inStr can not be null");
+        }
+        return base64AndMD5(toBytes(str));
+    }
+
+    /**
+     * 先进行MD5摘要再进行Base64编码获取摘要字符串
+     *
+     * @return
+     */
+    public static String base64AndMD5(byte[] bytes) {
+        if (bytes == null) {
+            throw new IllegalArgumentException("bytes can not be null");
+        }
+        try {
+            final MessageDigest md = MessageDigest.getInstance("MD5");
+            md.reset();
+            md.update(bytes);
+            final Base64 base64 = new Base64();
+            final byte[] enbytes = base64.encode(md.digest());
+            return new String(enbytes);
+        } catch (final NoSuchAlgorithmException e) {
+            throw new IllegalArgumentException("unknown algorithm MD5");
+        }
+    }
+
+    /**
+     * UTF-8编码转换为ISO-9959-1
+     *
+     * @param str
+     * @return
+     */
+    public static String utf8ToIso88591(String str) {
+        if (str == null) {
+            return str;
+        }
+
+        try {
+            return new String(str.getBytes("UTF-8"), "ISO-8859-1");
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * ISO-9959-1编码转换为UTF-8
+     *
+     * @param str
+     * @return
+     */
+    public static String iso88591ToUtf8(String str) {
+        if (str == null) {
+            return str;
+        }
+
+        try {
+            return new String(str.getBytes("ISO-8859-1"), "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * String转换为字节数组
+     *
+     * @param str
+     * @return
+     */
+    private static byte[] toBytes(final String str) {
+        if (str == null) {
+            return null;
+        }
+        try {
+            return str.getBytes(Constants.ENCODING);
+        } catch (final UnsupportedEncodingException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+}

+ 118 - 0
zzcx-service/src/main/java/com/diagbot/util/OpenApiUtils.java

@@ -0,0 +1,118 @@
+package com.diagbot.util;
+
+import com.diagbot.entity.JSONResponseBean;
+import com.diagbot.entity.Request;
+import com.diagbot.entity.Response;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.Header;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.Map;
+
+public class OpenApiUtils {
+    public static Response post(Request request) throws Exception {
+        return convert(doPost(request));
+    }
+
+    /**
+     * post form
+     *
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    private static HttpResponse doPost(Request request)
+            throws Exception {
+        HttpClient httpClient = wrapClient(request.getApiUrl());
+
+        HttpPost httpPost = new HttpPost(request.getApiUrl());
+        for (Map.Entry<String, String> e : request.getHeaders().entrySet()) {
+            httpPost.addHeader(e.getKey(), e.getValue());
+        }
+        if (request.getBodys() != null || StringUtils.isNotEmpty(request.getStringBody())) {
+            if (StringUtils.isNotEmpty(request.getStringBody())) {
+                httpPost.setEntity(new StringEntity(request.getStringBody(), ContentType.APPLICATION_JSON));
+            } else {
+                httpPost.setEntity(new StringEntity(JSONUtils.toString(request.getBodys()), ContentType.APPLICATION_JSON));
+            }
+        }
+        return httpClient.execute(httpPost);
+    }
+
+    private static HttpClient wrapClient(String host) {
+        HttpClient httpClient = new DefaultHttpClient();
+        if (host.startsWith("https://")) {
+            sslClient(httpClient);
+        }
+        return httpClient;
+    }
+
+    private static void sslClient(HttpClient httpClient) {
+        try {
+            SSLContext ctx = SSLContext.getInstance("TLS");
+            X509TrustManager tm = new X509TrustManager() {
+                public X509Certificate[] getAcceptedIssuers() {
+                    return null;
+                }
+
+                public void checkClientTrusted(X509Certificate[] xcs, String str) {
+
+                }
+
+                public void checkServerTrusted(X509Certificate[] xcs, String str) {
+
+                }
+            };
+            ctx.init(null, new TrustManager[] { tm }, null);
+            SSLSocketFactory ssf = new SSLSocketFactory(ctx);
+            ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+            ClientConnectionManager ccm = httpClient.getConnectionManager();
+            SchemeRegistry registry = ccm.getSchemeRegistry();
+            registry.register(new Scheme("https", 443, ssf));
+        } catch (KeyManagementException ex) {
+            throw new RuntimeException(ex);
+        } catch (NoSuchAlgorithmException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private static Response convert(HttpResponse response) throws IOException {
+        Response res = new Response();
+
+        if (null != response) {
+            res.setStatusCode(response.getStatusLine().getStatusCode());
+            for (Header header : response.getAllHeaders()) {
+                res.setHeader(header.getName(), MessageDigestUtil.iso88591ToUtf8(header.getValue()));
+            }
+            res.setContentType(res.getHeader("Content-Type"));
+            res.setRequestId(res.getHeader("X-Ca-Request-Id"));
+            res.setBody(EntityUtils.toString(response.getEntity()));
+            res.setJsonResponseBean(JSONUtils.parse(res.getBody(), JSONResponseBean.class));
+            res.setCaErrorMsg(res.getHeader("X-Ca-Error-Message"));
+
+        } else {
+            //服务器无回应
+            res.setStatusCode(500);
+            res.setErrorMessage("No Response");
+        }
+
+        return res;
+    }
+}

+ 126 - 0
zzcx-service/src/main/java/com/diagbot/util/SignUtil.java

@@ -0,0 +1,126 @@
+
+package com.diagbot.util;
+
+
+import com.diagbot.entity.Constants;
+import com.diagbot.entity.SystemHeader;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.UUID;
+
+/**
+ * 签名工具
+ */
+public class SignUtil {
+    /**
+     * 需要参与签名的请求头
+     */
+    private static final List<String> SIGN_HEADER_LIST = Arrays.asList("X-Service-Id","X-Service-Method","X-Ca-Key",
+            "X-Ca-Nonce","X-Ca-Timestamp","X-Content-MD5");
+    /**
+     * 计算签名
+     *
+     * @param secret APP密钥
+     * @param headers 请求头参数
+     * @return 签名后的字符串
+     */
+    public static String sign(String secret,
+                              Map<String, String> headers) {
+        try {
+            Mac hmacSha256 = Mac.getInstance(Constants.HMAC_SHA256);
+            byte[] keyBytes = secret.getBytes(Constants.ENCODING);
+            hmacSha256.init(new SecretKeySpec(keyBytes, 0, keyBytes.length, Constants.HMAC_SHA256));
+//            String contentMd5 = MessageDigestUtil.base64AndMD5(bodyContent);
+
+            return new String(Base64.encodeBase64(
+                    hmacSha256.doFinal((buildHeaders(headers, SIGN_HEADER_LIST))
+                            .getBytes(Constants.ENCODING))),
+                    Constants.ENCODING);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 构建待签名Http头
+     *
+     * @param headers 请求中所有的Http头
+     * @param signHeaderList 自定义参与签名Header前缀
+     * @return 待签名Http头
+     */
+    public static String buildHeaders(Map<String, String> headers, List<String> signHeaderList) {
+
+    	List<String> sbList=new ArrayList<>();
+    	if (null != signHeaderList) {
+    		Collections.sort(signHeaderList);
+    		if (null != headers) {
+    			Map<String, String> sortMap = new TreeMap<String, String>();
+    			sortMap.putAll(headers);
+    			StringBuilder signHeadersStringBuilder = new StringBuilder();
+    			for (Map.Entry<String, String> header : sortMap.entrySet()) {
+                    if (isHeaderToSign(header.getKey(), signHeaderList)) {
+                        StringBuilder sb = new StringBuilder();
+                    	sb.append(header.getKey().toLowerCase());
+                    	sb.append(Constants.SPE2);
+                        if (!StringUtils.isBlank(header.getValue())) {
+                        	sb.append(header.getValue());
+                        }
+                        sbList.add(sb.toString());
+                        if (0 < signHeadersStringBuilder.length()) {
+                        	signHeadersStringBuilder.append(Constants.SPE1);
+                        }
+                        signHeadersStringBuilder.append(header.getKey().toLowerCase());
+                    }
+                }
+    			headers.put(SystemHeader.X_CA_SIGNATURE_HEADERS, signHeadersStringBuilder.toString());
+    		}
+    	}
+        return StringUtils.join(sbList,Constants.SPE3);
+    }
+
+    /**
+     * Http头是否参与签名 return
+     */
+    private static boolean isHeaderToSign(String headerName, List<String> signHeaderList) {
+        if (StringUtils.isBlank(headerName)) {
+            return false;
+        }
+
+        if (headerName.startsWith(Constants.CA_HEADER_TO_SIGN_PREFIX_SYSTEM)) {
+            return true;
+        }
+
+        if (null != signHeaderList) {
+            for (String signHeaderPrefix : signHeaderList) {
+                if (headerName.equalsIgnoreCase(signHeaderPrefix)) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
+    public static void main(String[] args) {
+        String secret = "1234567890123456";
+        Map<String, String> headers = new HashMap<>();
+        headers.put("X-Service-Id", "eh.organ");
+        headers.put("X-Service-Method", "");
+        headers.put("X-Ca-Key", "hello");
+        headers.put("X-Ca-Timestamp", String.valueOf(System.currentTimeMillis()));
+        headers.put("X-Ca-Nonce", UUID.randomUUID().toString());
+        headers.put(SystemHeader.X_CONTENT_MD5, UUID.randomUUID().toString());
+        System.out.println(sign(secret, headers));
+
+    }
+}

+ 19 - 0
zzcx-service/src/main/java/com/diagbot/vo/QuestionIds2VO.java

@@ -0,0 +1,19 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2018/8/6 10:16
+ */
+@Getter
+@Setter
+public class QuestionIds2VO {
+    private List<Long> ids;
+    private Integer sexType;
+    private Integer age;
+}

+ 17 - 0
zzcx-service/src/main/java/com/diagbot/vo/QuestionVO.java

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

+ 26 - 0
zzcx-service/src/main/java/com/diagbot/vo/SaveInquiryDetailVO.java

@@ -0,0 +1,26 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author rengb
+ * @Description
+ * @time 2018年11月23日下午2:29:43
+ */
+@Getter
+@Setter
+public class SaveInquiryDetailVO {
+
+    /**
+     * 问题
+     */
+    private String question;
+
+    /**
+     * 答案
+     */
+    private String answer;
+
+
+}

+ 104 - 0
zzcx-service/src/main/java/com/diagbot/vo/SaveInquiryVO.java

@@ -0,0 +1,104 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2018/11/19 18:58
+ */
+@ApiModel(value = "问诊记录保存接口传参")
+@Getter
+@Setter
+public class SaveInquiryVO {
+
+    /**
+     * 公众号appid
+     */
+    @ApiModelProperty(value = "公众号appid", required = true)
+    @NotBlank(message = "公众号appid必传")
+    private String appId;
+
+    /**
+     * 医院名称
+     */
+    @ApiModelProperty(value = "医院名称", required = true)
+    @NotBlank(message = "医院名称必传")
+    private String organName;
+
+    /**
+     * 医生所在科室名称
+     */
+    @ApiModelProperty(value = "医生所在科室名称", required = true)
+    @NotBlank(message = "医生所在科室名称必传")
+    private String department;
+
+    /**
+     * 医生ID
+     */
+    @ApiModelProperty(value = "医生ID", required = true)
+    @NotBlank(message = "医生ID必传")
+    private String doctorId;
+
+    /**
+     * 医生名称
+     */
+    @ApiModelProperty(value = "医生名称", required = true)
+    @NotBlank(message = "医生名称必传")
+    private String doctorName;
+
+    /**
+     * 用户ID
+     */
+    @ApiModelProperty(value = "用户ID", required = true)
+    @NotBlank(message = "用户ID必传")
+    private String mpiId;
+
+    /**
+     * 用户名称
+     */
+    @ApiModelProperty(value = "用户名称", required = true)
+    @NotBlank(message = "用户名称必传")
+    private String patientName;
+
+    /**
+     * 用户年龄
+     */
+    @ApiModelProperty(value = "用户年龄", required = true)
+    @NotNull(message = "用户年龄必传")
+    private Integer patientAge;
+
+    /**
+     * 用户性别
+     */
+    @ApiModelProperty(value = "用户性别", required = true)
+    @NotBlank(message = "用户性别必传")
+    private String patientSex;
+
+    /**
+     * 诊断
+     */
+    @ApiModelProperty(value = "诊断", required = true)
+    @NotBlank(message = "诊断必传")
+    private String diagnosis;
+
+
+    /**
+     * 问诊明细
+     */
+    @Valid
+    @ApiModelProperty(value = "问诊明细", required = true)
+    @NotEmpty(message = "问诊明细不能为空")
+    private List<SaveInquiryDetailVO> detailList;
+
+
+}

+ 41 - 0
zzcx-service/src/main/java/com/diagbot/web/InquiryInfoController.java

@@ -0,0 +1,41 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.SaveInquiryDTO;
+import com.diagbot.facade.InquiryInfoFacade;
+import com.diagbot.vo.SaveInquiryVO;
+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;
+
+/**
+ * @author rengb
+ * @since 2018-11-23
+ */
+@RestController
+@RequestMapping("/inquiryInfo")
+@Api(value = "问诊记录API", tags = { "问诊-问诊记录API" })
+@SuppressWarnings("unchecked")
+public class InquiryInfoController {
+
+    @Autowired
+    private InquiryInfoFacade inquiryInfoFacade;
+
+    @ApiOperation(value = "问诊记录保存[by:rengb]")
+    @PostMapping("/saveInquiry")
+    @SysLogger("saveInquiry")
+    @Transactional
+    public RespDTO<SaveInquiryDTO> saveInquiry(@Valid @RequestBody SaveInquiryVO saveInquiryVO) {
+        return RespDTO.onSuc(inquiryInfoFacade.saveInquiry(saveInquiryVO));
+    }
+
+
+}

+ 58 - 0
zzcx-service/src/main/java/com/diagbot/web/QuestionInfoController.java

@@ -0,0 +1,58 @@
+package com.diagbot.web;
+
+
+import com.diagbot.dto.QuestionDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.QuestionFacade;
+import com.diagbot.vo.QuestionIds2VO;
+import com.diagbot.vo.QuestionVO;
+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 java.util.Map;
+
+/**
+ * <p>
+ * 标签基础表 前端控制器
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+@RequestMapping("/zzcx-questionInfo")
+@RestController
+@Api(value = "标签相关API111", tags = { "自测程序-标签相关API" })
+@SuppressWarnings("unchecked")
+public class QuestionInfoController {
+
+    @Autowired
+    QuestionFacade questionFacade;
+
+    @ApiOperation(value = "自诊程序-根据参数返回标签内容[by:zhoutg]",
+            notes = "id: questionId<br>" +
+                    "sexType:性别,1:男,2:女<br>" +
+                    "age:年龄")
+    @PostMapping("/getById")
+    public RespDTO<QuestionDTO> getById(@RequestBody QuestionVO questionVO) {
+        QuestionDTO data = questionFacade.getById(questionVO);
+        return RespDTO.onSuc(data);
+    }
+
+
+    @ApiOperation(value = "智能程序-查询多个id优化[by:zhoutg]",
+            notes = "ids: 多个questionId<br>" +
+                    "sexType:性别,1:男,2:女<br>" +
+                    "age:年龄")
+    @PostMapping("/getByIds")
+    public RespDTO<Map<Long, Object>> getByIds(@RequestBody QuestionIds2VO questionIds2VO) {
+        Map<Long, Object> data = questionFacade.getByIds(questionIds2VO);
+        return RespDTO.onSuc(data);
+    }
+
+
+}

+ 19 - 0
zzcx-service/src/main/resources/bootstrap.yml

@@ -0,0 +1,19 @@
+spring:
+  application:
+    name: zzcx-service
+  cloud:
+    config:
+      #uri: http://${myuri}:8769
+      fail-fast: true
+      discovery:
+        enabled: true
+        serviceId: config-server
+  profiles:
+    active: local
+
+eureka:
+  client:
+    serviceUrl:
+      defaultZone: http://${myuri}:8761/eureka/
+
+myuri: localhost

+ 306 - 0
zzcx-service/src/main/resources/logback-spring.xml

@@ -0,0 +1,306 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <!-- 项目名称 -->
+    <property name="APPDIR" value="zzcx-service"/>
+    <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
+    <property name="LOG_PATH" value="../logs"/>
+
+    <!-- 彩色日志 -->
+    <!-- 彩色日志依赖的渲染类 -->
+    <conversionRule conversionWord="clr"
+                    converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
+    <conversionRule conversionWord="wex"
+                    converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
+    <conversionRule conversionWord="wEx"
+                    converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
+    <!-- 彩色日志格式 -->
+    <!--<property name="CONSOLE_LOG_PATTERN"-->
+    <!--value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(-&#45;&#45;){faint} %clr([%15.15t]){faint} %clr(%logger){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>-->
+    <!--包名输出缩进对齐-->
+    <property name="CONSOLE_LOG_PATTERN"
+              value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
+
+    <!--  日志记录器,日期滚动记录
+            ERROR 级别
+     -->
+    <appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 正在记录的日志文件的路径及文件名 -->
+        <file>${LOG_PATH}/${APPDIR}/${APPDIR}_error.log</file>
+        <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 归档的日志文件的路径,例如今天是1992-11-06日志,当前写的日志文件路径为file节点指定,
+            可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。
+            而1992-11-06的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
+            <fileNamePattern>${LOG_PATH}/${APPDIR}/error/${APPDIR}-error-%d{yyyy-MM-dd}.%i.log
+            </fileNamePattern>
+            <!--  保留日志天数 -->
+            <maxHistory>30</maxHistory>
+            <!-- 除按日志记录之外,还配置了日志文件不能超过10MB,若超过10MB,日志文件会以索引0开始,
+            命名日志文件,例如log-error-1992-11-06.0.log -->
+            <timeBasedFileNamingAndTriggeringPolicy
+                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <!-- 追加方式记录日志 -->
+        <append>true</append>
+        <!-- 日志文件的格式 -->
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%thread] %logger Line:%-3L - %msg%n
+            </pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <!-- 此日志文件记录error级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>error</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+
+    <!-- 日志记录器,日期滚动记录
+            WARN  级别
+     -->
+    <appender name="WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 正在记录的日志文件的路径及文件名 -->
+        <file>${LOG_PATH}/${APPDIR}/${APPDIR}_warn.log</file>
+        <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 归档的日志文件的路径,例如今天1992-11-06日志,当前写的日志文件路径为file节点指定,
+            可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。
+            而1992-11-06的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
+            <fileNamePattern>${LOG_PATH}/${APPDIR}/warn/${APPDIR}-warn-%d{yyyy-MM-dd}.%i.log
+            </fileNamePattern>
+            <!--  保留日志天数 -->
+            <maxHistory>15</maxHistory>
+            <!-- 除按日志记录之外,还配置了日志文件不能超过10MB,若超过10MB,日志文件会以索引0开始,
+            命名日志文件,例如log-warn-1992-11-06.0.log -->
+            <timeBasedFileNamingAndTriggeringPolicy
+                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <!-- 追加方式记录日志 -->
+        <append>true</append>
+        <!-- 日志文件的格式 -->
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%thread] %logger Line:%-3L - %msg%n
+            </pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <!-- 此日志文件只记录warn级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>warn</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+
+    <!-- 日志记录器,日期滚动记录
+            INFO  级别
+    -->
+    <appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 正在记录的日志文件的路径及文件名 -->
+        <file>${LOG_PATH}/${APPDIR}/${APPDIR}_info.log</file>
+        <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 归档的日志文件的路径,例如今天是1992-11-06日志,当前写的日志文件路径为file节点指定,
+            可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。
+            而1992-11-06的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
+            <fileNamePattern>${LOG_PATH}/${APPDIR}/info/${APPDIR}-info-%d{yyyy-MM-dd}.%i.log
+            </fileNamePattern>
+            <!--  保留日志天数 -->
+            <maxHistory>15</maxHistory>
+            <!-- 除按日志记录之外,还配置了日志文件不能超过10MB,若超过10MB,日志文件会以索引0开始,
+            命名日志文件,例如log-info-1992-11-06.0.log -->
+            <timeBasedFileNamingAndTriggeringPolicy
+                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <!-- 追加方式记录日志 -->
+        <append>true</append>
+        <!-- 日志文件的格式 -->
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%thread] %logger Line:%-3L - %msg%n
+            </pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <!-- 此日志文件只记录info级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+
+    <!-- 日志记录器,日期滚动记录
+            DEBUG  级别
+    -->
+    <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 正在记录的日志文件的路径及文件名 -->
+        <file>${LOG_PATH}/${APPDIR}/${APPDIR}_debug.log</file>
+        <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 归档的日志文件的路径,例如今天是1992-11-06日志,当前写的日志文件路径为file节点指定,
+            可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。
+            而1992-11-06的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
+            <fileNamePattern>${LOG_PATH}/${APPDIR}/debug/${APPDIR}-debug-%d{yyyy-MM-dd}.%i.log
+            </fileNamePattern>
+            <!--  保留日志天数 -->
+            <maxHistory>15</maxHistory>
+            <!-- 除按日志记录之外,还配置了日志文件不能超过10MB,若超过10MB,日志文件会以索引0开始,
+            命名日志文件,例如log-debug-1992-11-06.0.log -->
+            <timeBasedFileNamingAndTriggeringPolicy
+                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <!-- 追加方式记录日志 -->
+        <append>true</append>
+        <!-- 日志文件的格式 -->
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%thread] %logger Line:%-3L - %msg%n
+            </pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <!-- 此日志文件只记录debug级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>debug</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!-- ConsoleAppender 控制台输出日志 -->
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!--encoder 默认配置为PatternLayoutEncoder-->
+        <encoder>
+            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
+            <!--<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level -&#45;&#45; [%thread] %logger Line:%-3L - %msg%n</pattern>-->
+            <charset>utf-8</charset>
+        </encoder>
+        <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
+        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+            <level>debug</level>
+        </filter>
+    </appender>
+
+
+    <!--&lt;!&ndash;输出到mysql数据库的appender配置     &ndash;&gt;-->
+    <!--<appender name="db" class="ch.qos.logback.classic.db.DBAppender">-->
+    <!--<connectionSource-->
+    <!--class="ch.qos.logback.core.db.DriverManagerConnectionSource">-->
+    <!--<driverClass>com.mysql.cj.jdbc.Driver</driverClass>-->
+    <!--<url>jdbc:mysql://120.77.222.42:3306/logback_member?characterEncoding=utf8</url>-->
+    <!--<user>root</user>-->
+    <!--<password>a123456789</password>-->
+    <!--</connectionSource>-->
+    <!--</appender>-->
+
+    <!-- FrameworkServlet日志-->
+    <logger name="org.springframework" level="WARN"/>
+
+    <!-- mybatis日志打印-->
+    <logger name="org.apache.ibatis" level="DEBUG"/>
+    <logger name="java.sql" level="DEBUG"/>
+
+    <!--  项目 mapper 路径
+            console控制台显示sql语句:STDOUT.filter.level -> debug级别
+    -->
+    <logger name="com.diagbot.mapper" level="DEBUG"/>
+
+    <appender name="LOGSTASHDEV" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
+        <destination>192.168.2.236:5044</destination>
+        <!-- encoder必须配置,有多种可选 -->
+        <encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
+            <customFields>{"appname":"zzcx-service"}</customFields>
+        </encoder>
+    </appender>
+
+    <appender name="LOGSTASHTEST" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
+        <destination>192.168.2.241:5044</destination>
+        <!-- encoder必须配置,有多种可选 -->
+        <encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
+            <customFields>{"appname":"zzcx-service"}</customFields>
+        </encoder>
+    </appender>
+
+    <appender name="LOGSTASHPRE" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
+        <destination>192.168.2.121:5044</destination>
+        <!-- encoder必须配置,有多种可选 -->
+        <encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
+            <customFields>{"appname":"zzcx-service"}</customFields>
+        </encoder>
+    </appender>
+
+    <appender name="LOGSTASHPRO" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
+        <destination>192.168.2.122:5044</destination>
+        <!-- encoder必须配置,有多种可选 -->
+        <encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
+            <customFields>{"appname":"zzcx-service"}</customFields>
+        </encoder>
+    </appender>
+
+    <!-- 本地环境下的日志配置 -->
+    <springProfile name="local">
+        <root level="INFO">
+            <appender-ref ref="ERROR"/>
+            <appender-ref ref="WARN"/>
+            <appender-ref ref="INFO"/>
+            <appender-ref ref="DEBUG"/>
+            <appender-ref ref="STDOUT"/>
+        </root>
+    </springProfile>
+
+    <!-- 开发环境下的日志配置 -->
+    <springProfile name="dev">
+        <root level="INFO">
+            <appender-ref ref="ERROR"/>
+            <appender-ref ref="WARN"/>
+            <appender-ref ref="INFO"/>
+            <appender-ref ref="DEBUG"/>
+            <appender-ref ref="STDOUT"/>
+            <appender-ref ref="LOGSTASHDEV"/>
+        </root>
+    </springProfile>
+
+    <!-- 测试环境下的日志配置 -->
+    <springProfile name="test">
+        <root level="INFO">
+            <appender-ref ref="ERROR"/>
+            <appender-ref ref="WARN"/>
+            <appender-ref ref="INFO"/>
+            <appender-ref ref="DEBUG"/>
+            <appender-ref ref="STDOUT"/>
+            <appender-ref ref="LOGSTASHTEST"/>
+        </root>
+    </springProfile>
+
+    <!-- 预发布环境下的日志配置 -->
+    <springProfile name="pre">
+        <root level="INFO">
+            <appender-ref ref="ERROR"/>
+            <appender-ref ref="WARN"/>
+            <appender-ref ref="INFO"/>
+            <appender-ref ref="DEBUG"/>
+            <appender-ref ref="STDOUT"/>
+            <appender-ref ref="LOGSTASHPRE"/>
+        </root>
+    </springProfile>
+
+    <!-- 生产环境下的日志配置 -->
+    <springProfile name="pro">
+        <root level="INFO">
+            <appender-ref ref="ERROR"/>
+            <appender-ref ref="WARN"/>
+            <appender-ref ref="INFO"/>
+            <appender-ref ref="DEBUG"/>
+            <appender-ref ref="STDOUT"/>
+            <appender-ref ref="LOGSTASHPRO"/>
+        </root>
+    </springProfile>
+</configuration>

+ 19 - 0
zzcx-service/src/main/resources/mapper/InquiryDetailMapper.xml

@@ -0,0 +1,19 @@
+<?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.InquiryDetailMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.InquiryDetail">
+        <id column="id" property="id" />
+        <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" />
+        <result column="inquiry_id" property="inquiryId" />
+        <result column="question" property="question" />
+        <result column="answer" property="answer" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+</mapper>

+ 27 - 0
zzcx-service/src/main/resources/mapper/InquiryInfoMapper.xml

@@ -0,0 +1,27 @@
+<?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.InquiryInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.InquiryInfo">
+        <id column="id" property="id" />
+        <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" />
+        <result column="app_id" property="appId" />
+        <result column="organ_name" property="organName" />
+        <result column="department" property="department" />
+        <result column="doctor_id" property="doctorId" />
+        <result column="doctor_name" property="doctorName" />
+        <result column="mpi_id" property="mpiId" />
+        <result column="patient_name" property="patientName" />
+        <result column="patient_age" property="patientAge" />
+        <result column="patient_sex" property="patientSex" />
+        <result column="diagnosis" property="diagnosis" />
+        <result column="ret_url" property="retUrl" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+</mapper>

+ 16 - 0
zzcx-service/src/main/resources/mapper/QuestionDetailMapper.xml

@@ -0,0 +1,16 @@
+<?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.QuestionDetailMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.QuestionDetail">
+        <id column="id" property="id" />
+        <result column="name" property="name" />
+        <result column="question_id" property="questionId" />
+        <result column="order_no" property="orderNo" />
+        <result column="description" property="description" />
+        <result column="exclusion" property="exclusion" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+</mapper>

+ 83 - 0
zzcx-service/src/main/resources/mapper/QuestionInfoMapper.xml

@@ -0,0 +1,83 @@
+<?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.QuestionInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.QuestionInfo">
+        <id column="id" property="id" />
+        <result column="name" property="name" />
+        <result column="tag_name" property="tagName" />
+        <result column="sex_type" property="sexType" />
+        <result column="age_begin" property="ageBegin" />
+        <result column="age_end" property="ageEnd" />
+        <result column="type" property="type" />
+        <result column="description" property="description" />
+        <result column="control_type" property="controlType" />
+        <result column="item_type" property="itemType" />
+        <result column="tag_type" property="tagType" />
+        <result column="label_prefix" property="labelPrefix" />
+        <result column="label_suffix" property="labelSuffix" />
+        <result column="url" property="url" />
+        <result column="spec_flag" property="specFlag" />
+        <result column="required" property="required" />
+        <result column="explains" property="explains" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+    <select id="getByParam" parameterType="java.util.Map" resultMap="BaseResultMap">
+        select * from zzcx_question_info  where is_deleted = 'N'
+        and id = #{id}
+        <if test="sexType != null and sexType != 3 and sexType != ''">
+            and sex_type in (3, #{sexType})
+        </if>
+        <if test="age != null and age != ''">
+            <![CDATA[ and age_begin <= #{age} ]]>
+            <![CDATA[ and age_end >= #{age} ]]>
+        </if>
+    </select>
+
+
+    <select id="getByParam2" parameterType="java.util.Map" resultMap="BaseResultMap">
+        select * from zzcx_question_info  where is_deleted = 'N'
+        <if test="idList != null and idList.size > 0">
+            and id in
+            <foreach item="item" collection="idList" open="(" separator="," close=")" >
+                #{item}
+            </foreach>
+        </if>
+        <if test="sexType != null and sexType != 3 and sexType != ''">
+            and sex_type in (3, #{sexType})
+        </if>
+        <if test="age != null and age != ''">
+            <![CDATA[ and age_begin <= #{age} ]]>
+            <![CDATA[ and age_end >= #{age} ]]>
+        </if>
+    </select>
+
+    <select id="getByQuestionMapping" parameterType="java.util.Map" resultType="com.diagbot.entity.wrapper.QuestionInfoWrapper">
+        select t.*, m.parent_question, m.exclusion_type from zzcx_question_info t, zzcx_question_mapping m
+        where t.is_deleted = 'N' and m.is_deleted = 'N' and m.son_question = t.id
+        <if test="id != null">
+            and m.parent_question = #{id}
+        </if>
+        <if test="ids != null and ids.size > 0">
+            <foreach item="myId" collection="ids" open="and(" separator="or" close=")" >
+                m.parent_question = #{myId}
+            </foreach>
+        </if>
+        <if test="sexType != null and sexType != 3 and sexType != ''">
+            and t.sex_type in (3, #{sexType})
+        </if>
+        <if test="age != null">
+            <![CDATA[ and t.age_begin <= #{age} ]]>
+            <![CDATA[ and t.age_end >= #{age} ]]>
+        </if>
+        <if test="id != null">
+            order by m.order_no
+        </if>
+        <if test="ids != null and ids.size > 0">
+            order by m.parent_question, m.order_no
+        </if>
+    </select>
+
+</mapper>

+ 20 - 0
zzcx-service/src/main/resources/mapper/QuestionMappingMapper.xml

@@ -0,0 +1,20 @@
+<?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.QuestionMappingMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.QuestionMapping">
+        <id column="id" property="id" />
+        <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" />
+        <result column="parent_question" property="parentQuestion" />
+        <result column="son_question" property="sonQuestion" />
+        <result column="order_no" property="orderNo" />
+        <result column="exclusion_type" property="exclusionType" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+</mapper>

+ 9 - 0
zzcx-service/src/main/resources/public.cert

@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxXZWH/WgxW9eTT6AmPRo
+GFY3T5V1+F1458dcQFw0EZejjHuGwEeHvxcgl4059Me2B1xXTs3FDXTWQ5z19EtP
+3ITYtnFTo2cxhwxiwqN8ZqFdpq5Uac0mzjlYKcyGp8x6t+Nc2cv3D3Ul2VIbGvbP
+sQOeKvt3WxWwdpQ+q3RXjRUFQGiygSD7yuXHIUpcOsm4ZWDlUkjfwX1q4pjiwFfA
+Mq5xgkzPwolUKnI0NFnom3Th3i4oFXzUg2s6cEj7jL7YU35c2/9kE7WQPbeYhoSi
+XH2OwWgBk/2Ki6+Q0Yq/eAsXSBjp1jqh337vvKBk5ocPG1Imi8uTLIgYQCMwzvg+
+VQIDAQAB
+-----END PUBLIC KEY-----

+ 83 - 0
zzcx-service/src/test/java/com/diagbot/CodeGeneration.java

@@ -0,0 +1,83 @@
+package com.diagbot;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.generator.AutoGenerator;
+import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
+import com.baomidou.mybatisplus.generator.config.GlobalConfig;
+import com.baomidou.mybatisplus.generator.config.PackageConfig;
+import com.baomidou.mybatisplus.generator.config.StrategyConfig;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
+
+/**
+ * @Description: 代码生成器
+ * @author: gaodm
+ * @time: 2018/8/2 10:15
+ */
+public class CodeGeneration {
+
+    /**
+     *
+     * @Title: main
+     * @Description: 生成
+     * @param args
+     */
+    public static void main(String[] args) {
+        AutoGenerator mpg = new AutoGenerator();
+
+        // 全局配置
+        GlobalConfig gc = new GlobalConfig();
+        gc.setOutputDir("E://code//zzcxservice");
+        gc.setFileOverride(true);
+        gc.setActiveRecord(false);// 不需要ActiveRecord特性的请改为false
+        gc.setEnableCache(false);// XML 二级缓存
+        gc.setBaseResultMap(true);// XML ResultMap
+        gc.setBaseColumnList(false);// XML columList
+        gc.setAuthor("zhoutg");// 作者
+
+        // 自定义文件命名,注意 %s 会自动填充表实体属性!
+        gc.setControllerName("%sController");
+        gc.setServiceName("%sService");
+        gc.setServiceImplName("%sServiceImpl");
+        gc.setMapperName("%sMapper");
+        gc.setXmlName("%sMapper");
+        mpg.setGlobalConfig(gc);
+
+        // 数据源配置
+        DataSourceConfig dsc = new DataSourceConfig();
+        dsc.setDbType(DbType.MYSQL);
+        dsc.setDriverName("com.mysql.cj.jdbc.Driver");
+        dsc.setUsername("root");
+        dsc.setPassword("lantone");
+        dsc.setUrl("jdbc:mysql://192.168.2.236:3306/sys-zzcx?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
+        mpg.setDataSource(dsc);
+
+        // 策略配置
+        StrategyConfig strategy = new StrategyConfig();
+        strategy.setTablePrefix(new String[] { "zzcx_" });// 此处可以修改为您的表前缀
+        strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
+        strategy.setInclude(new String[] { "zzcx_inquiry_info","zzcx_inquiry_detail" }); // 需要生成的表
+
+        strategy.setSuperServiceClass(null);
+        strategy.setSuperServiceImplClass(null);
+        strategy.setSuperMapperClass(null);
+
+        mpg.setStrategy(strategy);
+
+        // 包配置
+        PackageConfig pc = new PackageConfig();
+        pc.setParent("com.diagbot");
+        pc.setController("web");
+        pc.setService("service");
+        pc.setServiceImpl("service.impl");
+        pc.setMapper("mapper");
+        pc.setEntity("entity");
+        pc.setXml("resources.mapper");
+        mpg.setPackageInfo(pc);
+
+        // 执行生成
+        mpg.setTemplateEngine(new FreemarkerTemplateEngine());
+        mpg.execute();
+
+    }
+}

+ 16 - 0
zzcx-service/src/test/java/com/diagbot/ZzcxServiceApplicationTests.java

@@ -0,0 +1,16 @@
+package com.diagbot;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class ZzcxServiceApplicationTests {
+
+    @Test
+    public void contextLoads() {
+    }
+
+}