diff --git a/.gitignore b/.gitignore
index 9154f4c7..a879ee72 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,26 +1,39 @@
-# ---> Java
-# Compiled class file
-*.class
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
-# Log file
-*.log
+### IntelliJ IDEA ###
+.idea/
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
-# BlueJ files
-*.ctxt
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
-# Package Files #
-*.jar
-*.war
-*.nar
-*.ear
-*.zip
-*.tar.gz
-*.rar
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-replay_pid*
+### VS Code ###
+.vscode/
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 00000000..99788073
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,84 @@
+
+
+
+ 4.0.0
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.3.5.RELEASE
+
+
+ com.supervision
+ virtual-patient
+ 1.0-SNAPSHOT
+ pom
+
+ virtual-patient
+
+
+
+ virtual-patient-common
+ virtual-patient-model
+ virtual-patient-web
+
+
+
+ UTF-8
+ 1.8
+ 1.8
+
+ 2.3.5.RELEASE
+ 1.2.76
+ 3.3.1
+ 1.1.10
+ 5.8.16
+ 3.0.3
+
+
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.20
+ provided
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring.boot.version}
+ pom
+ import
+
+
+
+ cn.hutool
+ hutool-all
+ ${hutool.version}
+
+
+
+
+ com.alibaba
+ druid-spring-boot-starter
+ ${druid.version}
+
+
+
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ ${mybatis-puls-spring-boot.version}
+
+
+
+
+
+
+
+
diff --git a/virtual-patient-common/pom.xml b/virtual-patient-common/pom.xml
new file mode 100644
index 00000000..b9b4926b
--- /dev/null
+++ b/virtual-patient-common/pom.xml
@@ -0,0 +1,64 @@
+
+
+ 4.0.0
+
+ com.supervision
+ virtual-patient
+ 1.0-SNAPSHOT
+
+
+ virtual-patient-common
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+
+ mysql
+ mysql-connector-java
+ 8.0.26
+
+
+
+ com.github.xiaoymin
+ knife4j-spring-boot-starter
+ 2.0.9
+
+
+
+
+
+
\ No newline at end of file
diff --git a/virtual-patient-common/src/main/java/com/supervision/config/JwtInterceptor.java b/virtual-patient-common/src/main/java/com/supervision/config/JwtInterceptor.java
new file mode 100644
index 00000000..25ea6558
--- /dev/null
+++ b/virtual-patient-common/src/main/java/com/supervision/config/JwtInterceptor.java
@@ -0,0 +1,66 @@
+package com.supervision.config;
+
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import cn.hutool.jwt.JWT;
+import cn.hutool.jwt.JWTUtil;
+import com.supervision.domain.UserInfo;
+import com.supervision.exception.BusinessException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Slf4j
+public class JwtInterceptor implements HandlerInterceptor {
+
+ @Override
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+ //请求消息头获取用户ID
+ String token = request.getHeader("token");
+ if (StrUtil.isBlank(token)) {
+ throw new BusinessException("当前用户未登录");
+ }
+ JWT jwt = JWTUtil.parseToken(token);
+ // 校验token是否过期,如果过期了,需要提示过期重新登录
+ checkTokenExpire(jwt);
+ cacheAuth(jwt);
+ return true;
+ }
+
+
+ @Override
+ public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
+ // 请求结束,将用户信息从thread中移除
+ clearAuth();
+ HandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
+ }
+
+ private void checkTokenExpire(JWT jwt) {
+ Object expireTime = jwt.getPayload("expireTime");
+ long l = Long.parseLong(String.valueOf(expireTime));
+ // 校验是否比当前时间大
+ System.out.println(l);
+ long currentTimeMillis = System.currentTimeMillis();
+ if (currentTimeMillis > l) {
+ throw new BusinessException("用户登录已过期,请重新登录");
+ }
+ }
+
+ private void cacheAuth(JWT jwt) {
+ try {
+ JSONObject claimsJson = jwt.getPayload().getClaimsJson();
+ UserInfo userInfo = JSONUtil.toBean(claimsJson, UserInfo.class);
+ ThreadCache.USER.set(userInfo);
+ } catch (Exception e) {
+ log.error("用户信息异常", e);
+ }
+ }
+
+ private void clearAuth() {
+ ThreadCache.USER.remove();
+ }
+}
diff --git a/virtual-patient-common/src/main/java/com/supervision/config/Knife4jConfig.java b/virtual-patient-common/src/main/java/com/supervision/config/Knife4jConfig.java
new file mode 100644
index 00000000..f4274756
--- /dev/null
+++ b/virtual-patient-common/src/main/java/com/supervision/config/Knife4jConfig.java
@@ -0,0 +1,53 @@
+/*
+ * 文 件 名: Knife4jConfig
+ * 版 权:
+ * 描 述: <描述>
+ * 修 改 人: RedName
+ * 修改时间: 2022/8/5
+ * 跟踪单号: <跟踪单号>
+ * 修改单号: <修改单号>
+ * 修改内容: <修改内容>
+ */
+package com.supervision.config;
+
+import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
+import io.swagger.annotations.Api;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
+
+/**
+ * <功能详细描述>
+ *
+ * @author ljt
+ * @version [版本号, 2022/8/5]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+@Configuration
+@EnableSwagger2WebMvc
+public class Knife4jConfig {
+ @Bean(value = "defaultApi2")
+ public Docket defaultApi2() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .apiInfo(this.apiInfo())
+ .useDefaultResponseMessages(false)
+ .select()
+ .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
+ .paths(PathSelectors.any()).build();
+
+ }
+
+ private ApiInfo apiInfo() {
+ return new ApiInfoBuilder().title("API文档").description("API文档").contact(new Contact("", "", ""))
+ .version("1.0.0").build();
+ }
+}
diff --git a/virtual-patient-common/src/main/java/com/supervision/config/MyBatisMetaObjectHandler.java b/virtual-patient-common/src/main/java/com/supervision/config/MyBatisMetaObjectHandler.java
new file mode 100644
index 00000000..e85b88df
--- /dev/null
+++ b/virtual-patient-common/src/main/java/com/supervision/config/MyBatisMetaObjectHandler.java
@@ -0,0 +1,28 @@
+package com.supervision.config;
+
+import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
+import org.apache.ibatis.reflection.MetaObject;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+/**
+ * @author ljt on 2022/08/13.
+ * 创建时间和更新时间自动填充
+ */
+@Component
+public class MyBatisMetaObjectHandler implements MetaObjectHandler {
+ // 使用MP进行添加操作,该方法执行
+ @Override
+ public void insertFill(MetaObject metaObject) {
+ //属性名称,不是字段名称
+ this.setFieldValByName("createTime", new Date(), metaObject);
+ this.setFieldValByName("updateTime", new Date(), metaObject);
+ }
+
+ @Override
+ public void updateFill(MetaObject metaObject) {
+ // 使用MP进行修改操作,该方法执行
+ this.setFieldValByName("updateTime", new Date(), metaObject);
+ }
+}
diff --git a/virtual-patient-common/src/main/java/com/supervision/config/MybatisPlusConfig.java b/virtual-patient-common/src/main/java/com/supervision/config/MybatisPlusConfig.java
new file mode 100644
index 00000000..ec5c1754
--- /dev/null
+++ b/virtual-patient-common/src/main/java/com/supervision/config/MybatisPlusConfig.java
@@ -0,0 +1,32 @@
+/*
+ * 文 件 名: MybatisPlusConfig
+ * 版 权:
+ * 描 述: <描述>
+ * 修 改 人: RedName
+ * 修改时间: 2022/8/9
+ * 跟踪单号: <跟踪单号>
+ * 修改单号: <修改单号>
+ * 修改内容: <修改内容>
+ */
+package com.supervision.config;
+
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * <功能详细描述>
+ *
+ * @author RedName
+ * @version [版本号, 2022/8/9]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+@Configuration
+public class MybatisPlusConfig {
+
+ @Bean
+ public PaginationInterceptor paginationInterceptor() {
+ return new PaginationInterceptor();
+ }
+}
diff --git a/virtual-patient-common/src/main/java/com/supervision/config/ResponseConfig.java b/virtual-patient-common/src/main/java/com/supervision/config/ResponseConfig.java
new file mode 100644
index 00000000..c3207935
--- /dev/null
+++ b/virtual-patient-common/src/main/java/com/supervision/config/ResponseConfig.java
@@ -0,0 +1,102 @@
+package com.supervision.config;
+
+import cn.hutool.json.JSONUtil;
+import com.supervision.domain.GlobalResult;
+import com.supervision.exception.BusinessException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.core.MethodParameter;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.server.ServerHttpRequest;
+import org.springframework.http.server.ServerHttpResponse;
+import org.springframework.lang.Nullable;
+import org.springframework.validation.BindException;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
+
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 统一返回
+ *
+ * @author wb
+ * @date 2022/3/10 13:24
+ */
+@Slf4j
+@RestControllerAdvice(annotations = RestController.class, basePackages = {"com.**.controller"})
+public class ResponseConfig implements ResponseBodyAdvice