|  | @ -1,6 +1,7 @@
 | 
												
													
														
															|  | package com.yihu.wlyy.config;
 |  | package com.yihu.wlyy.config;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import org.springframework.context.annotation.Bean;
 |  | import org.springframework.context.annotation.Bean;
 | 
												
													
														
															|  | 
 |  | import org.springframework.context.annotation.Configuration;
 | 
												
													
														
															|  | import org.springframework.web.context.request.async.DeferredResult;
 |  | import org.springframework.web.context.request.async.DeferredResult;
 | 
												
													
														
															|  | import springfox.documentation.builders.PathSelectors;
 |  | import springfox.documentation.builders.PathSelectors;
 | 
												
													
														
															|  | import springfox.documentation.service.ApiInfo;
 |  | import springfox.documentation.service.ApiInfo;
 | 
												
											
												
													
														
															|  | @ -8,21 +9,28 @@ import springfox.documentation.spi.DocumentationType;
 | 
												
													
														
															|  | import springfox.documentation.spring.web.plugins.Docket;
 |  | import springfox.documentation.spring.web.plugins.Docket;
 | 
												
													
														
															|  | import springfox.documentation.swagger2.annotations.EnableSwagger2;
 |  | import springfox.documentation.swagger2.annotations.EnableSwagger2;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import static com.google.common.base.Predicates.or;
 | 
												
													
														
															|  | 
 |  | import static springfox.documentation.builders.PathSelectors.regex;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | @EnableSwagger2
 |  | @EnableSwagger2
 | 
												
													
														
															|  | 
 |  | @Configuration
 | 
												
													
														
															|  | public class SwaggerConfig {
 |  | public class SwaggerConfig {
 | 
												
													
														
															|  |     private static final String PUBLIC_API = "Default";
 |  |     private static final String PUBLIC_API = "Default";
 | 
												
													
														
															|  | 
 |  |     private static final String Doctor_API = "doctor";
 | 
												
													
														
															|  | 
 |  |     private static final String Patient_API = "patient";
 | 
												
													
														
															|  | 
 |  |     private static final String Other_API = "other";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @Bean
 |  |     @Bean
 | 
												
													
														
															|  |     public Docket publicAPI() {
 |  |     public Docket publicAPI() {
 | 
												
													
														
															|  |         return new Docket(DocumentationType.SWAGGER_2)
 |  |         return new Docket(DocumentationType.SWAGGER_2)
 | 
												
													
														
															|  |                 .groupName(PUBLIC_API)
 |  | 
 | 
												
													
														
															|  | 
 |  |                 .groupName(Doctor_API)
 | 
												
													
														
															|  |                 .genericModelSubstitutes(DeferredResult.class)
 |  |                 .genericModelSubstitutes(DeferredResult.class)
 | 
												
													
														
															|  |                 .useDefaultResponseMessages(false)
 |  |                 .useDefaultResponseMessages(false)
 | 
												
													
														
															|  |                 .forCodeGeneration(true)
 |  |                 .forCodeGeneration(true)
 | 
												
													
														
															|  |                 .pathMapping("/")
 |  |                 .pathMapping("/")
 | 
												
													
														
															|  |                 .select()
 |  |                 .select()
 | 
												
													
														
															|  |                 .paths(PathSelectors.regex("/.*"))
 |  | 
 | 
												
													
														
															|  | 
 |  |                 .paths(PathSelectors.regex("/doctor/.*"))
 | 
												
													
														
															|  |                 .build()
 |  |                 .build()
 | 
												
													
														
															|  |                 .apiInfo(publicApiInfo());
 |  |                 .apiInfo(publicApiInfo());
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
											
												
													
														
															|  | @ -39,4 +47,74 @@ public class SwaggerConfig {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         return apiInfo;
 |  |         return apiInfo;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @Bean
 | 
												
													
														
															|  | 
 |  |     public Docket patientAPI() {
 | 
												
													
														
															|  | 
 |  |         return new Docket(DocumentationType.SWAGGER_2)
 | 
												
													
														
															|  | 
 |  |                 .groupName(Patient_API)
 | 
												
													
														
															|  | 
 |  |                 .genericModelSubstitutes(DeferredResult.class)
 | 
												
													
														
															|  | 
 |  |                 .useDefaultResponseMessages(false)
 | 
												
													
														
															|  | 
 |  |                 .forCodeGeneration(true)
 | 
												
													
														
															|  | 
 |  |                 .pathMapping("/")
 | 
												
													
														
															|  | 
 |  |                 .select()
 | 
												
													
														
															|  | 
 |  |                 .paths(PathSelectors.regex("/patient/.*"))
 | 
												
													
														
															|  | 
 |  |                 .build()
 | 
												
													
														
															|  | 
 |  |                 .apiInfo(patientApiInfo());
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     private ApiInfo patientApiInfo() {
 | 
												
													
														
															|  | 
 |  |         ApiInfo apiInfo = new ApiInfo("三师平台API",
 | 
												
													
														
															|  | 
 |  |                 "向PC端,微信、App等应用提供功能与数据接口。",
 | 
												
													
														
															|  | 
 |  |                 "1.0",
 | 
												
													
														
															|  | 
 |  |                 "No terms of service",
 | 
												
													
														
															|  | 
 |  |                 "admin@jkzl.com",
 | 
												
													
														
															|  | 
 |  |                 "The Apache License, Version 2.0",
 | 
												
													
														
															|  | 
 |  |                 "http://www.apache.org/licenses/LICENSE-2.0.html"
 | 
												
													
														
															|  | 
 |  |         );
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         return apiInfo;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @Bean
 | 
												
													
														
															|  | 
 |  |     public Docket otherAPI() {
 | 
												
													
														
															|  | 
 |  |         return new Docket(DocumentationType.SWAGGER_2)
 | 
												
													
														
															|  | 
 |  |                 .groupName(Other_API)
 | 
												
													
														
															|  | 
 |  |                 .genericModelSubstitutes(DeferredResult.class)
 | 
												
													
														
															|  | 
 |  |                 .useDefaultResponseMessages(false)
 | 
												
													
														
															|  | 
 |  |                 .forCodeGeneration(true)
 | 
												
													
														
															|  | 
 |  |                 .pathMapping("/")
 | 
												
													
														
															|  | 
 |  |                 .select()
 | 
												
													
														
															|  | 
 |  |                 .paths(or(
 | 
												
													
														
															|  | 
 |  |                         regex("/third/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/statistics/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/statistics/province/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/job/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/family_contract/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/hosptail/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/manage_util/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/common/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/hospitals/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/upload/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/weixin/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/wx/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/area/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/login/.*"),
 | 
												
													
														
															|  | 
 |  |                         regex("/qrcode/.*")
 | 
												
													
														
															|  | 
 |  |                 ))
 | 
												
													
														
															|  | 
 |  |                 .build()
 | 
												
													
														
															|  | 
 |  |                 .apiInfo(otherApiInfo());
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     private ApiInfo otherApiInfo() {
 | 
												
													
														
															|  | 
 |  |         ApiInfo apiInfo = new ApiInfo("三师平台API",
 | 
												
													
														
															|  | 
 |  |                 "向PC端,微信、App等应用提供功能与数据接口。",
 | 
												
													
														
															|  | 
 |  |                 "1.0",
 | 
												
													
														
															|  | 
 |  |                 "No terms of service",
 | 
												
													
														
															|  | 
 |  |                 "admin@jkzl.com",
 | 
												
													
														
															|  | 
 |  |                 "The Apache License, Version 2.0",
 | 
												
													
														
															|  | 
 |  |                 "http://www.apache.org/licenses/LICENSE-2.0.html"
 | 
												
													
														
															|  | 
 |  |         );
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         return apiInfo;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | }
 |  | }
 |