项目初始化
This commit is contained in:
33
.gitignore
vendored
Normal file
33
.gitignore
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
30
Elliott/dataManager.log
Normal file
30
Elliott/dataManager.log
Normal file
File diff suppressed because one or more lines are too long
0
Elliott/dataManager_error.log
Normal file
0
Elliott/dataManager_error.log
Normal file
BIN
libs/ojdbc6.jar
Normal file
BIN
libs/ojdbc6.jar
Normal file
Binary file not shown.
158
pom.xml
Normal file
158
pom.xml
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.joju</groupId>
|
||||||
|
<artifactId>datamanager</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>datamanager</name>
|
||||||
|
<description>datamanager</description>
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<spring-boot.version>2.6.13</spring-boot.version>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
|
<!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
|
||||||
|
<!-- <scope>provided</scope>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>javax.servlet</groupId>-->
|
||||||
|
<!-- <artifactId>javax.servlet-api</artifactId>-->
|
||||||
|
<!-- <version>3.1.0</version>-->
|
||||||
|
<!-- <scope>provided</scope>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
|
||||||
|
<!-- <artifactId>mybatis-spring-boot-starter</artifactId>-->
|
||||||
|
<!-- <version>2.2.2</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-all -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.8.20</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/io.swagger/swagger-annotations -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<version>1.5.22</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
<version>2.0.1.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.5.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>8.0.28</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>1.2.8</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
<version>3.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.microsoft.sqlserver</groupId>
|
||||||
|
<artifactId>mssql-jdbc</artifactId>
|
||||||
|
<version>9.4.1.jre8</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/commons-dbutils/commons-dbutils -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-dbutils</groupId>
|
||||||
|
<artifactId>commons-dbutils</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
<!-- <configuration>-->
|
||||||
|
<!-- <mainClass>com.joju.datamanager.DatamanagerApplication</mainClass>-->
|
||||||
|
<!-- <skip>true</skip>-->
|
||||||
|
<!-- </configuration>-->
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.joju.datamanager;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
|
||||||
|
@SpringBootApplication()
|
||||||
|
//@ServletComponentScan
|
||||||
|
public class DatamanagerApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
SpringApplication.run(DatamanagerApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
13
src/main/java/com/joju/datamanager/ServletInitializer.java
Normal file
13
src/main/java/com/joju/datamanager/ServletInitializer.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.joju.datamanager;
|
||||||
|
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
|
||||||
|
public class ServletInitializer extends SpringBootServletInitializer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
|
return application.sources(DatamanagerApplication.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.joju.datamanager.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/27
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.METHOD})
|
||||||
|
@Documented
|
||||||
|
public @interface EleganceLog {
|
||||||
|
/**
|
||||||
|
* 日志描述信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String description() default "";
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.joju.datamanager.common.annotation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/25
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
|
||||||
|
@Target({ElementType.METHOD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface ResultAnnotation {
|
||||||
|
boolean required() default true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
package com.joju.datamanager.common.elegancelog;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.joju.datamanager.common.annotation.EleganceLog;
|
||||||
|
import org.aspectj.lang.JoinPoint;
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.annotation.*;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/27
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
public class EleganceLogAspect {
|
||||||
|
|
||||||
|
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(EleganceLogAspect.class);
|
||||||
|
/**
|
||||||
|
* 换行符
|
||||||
|
*/
|
||||||
|
private static final String LINE_SEPARATOR = System.lineSeparator();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 以自定义 @WebLog 注解为切点
|
||||||
|
*/
|
||||||
|
@Pointcut("@annotation(com.joju.datamanager.common.annotation.EleganceLog)")
|
||||||
|
public void EleganceLog() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在切点之前织入
|
||||||
|
*
|
||||||
|
* @param joinPoint
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
@Before("EleganceLog()")
|
||||||
|
public void doBefore(JoinPoint joinPoint) throws Throwable {
|
||||||
|
// 开始打印请求日志
|
||||||
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||||
|
HttpServletRequest request = attributes.getRequest();
|
||||||
|
|
||||||
|
// 获取 @WebLog 注解的描述信息
|
||||||
|
String methodDescription = getAspectLogDescription(joinPoint);
|
||||||
|
|
||||||
|
// 打印请求相关参数
|
||||||
|
logger.info("========================================== Start ==========================================");
|
||||||
|
// 打印请求 url
|
||||||
|
logger.info("URL : {}", request.getRequestURL().toString());
|
||||||
|
// 打印描述信息
|
||||||
|
logger.info("Description : {}", methodDescription);
|
||||||
|
// 打印 Http method
|
||||||
|
logger.info("HTTP Method : {}", request.getMethod());
|
||||||
|
// 打印调用 controller 的全路径以及执行方法
|
||||||
|
logger.info("Class Method : {}.{}", joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName());
|
||||||
|
// 打印请求的 IP
|
||||||
|
logger.info("IP : {}", request.getRemoteAddr());
|
||||||
|
// 打印请求入参
|
||||||
|
if (methodDescription.equals("loginUserInfo") || methodDescription.equals("quitUserInfo")) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
logger.info("Request Args : {}", JSONUtil.toJsonStr(joinPoint.getArgs()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 环绕
|
||||||
|
*
|
||||||
|
* @param proceedingJoinPoint
|
||||||
|
* @return
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
@Around("EleganceLog()")
|
||||||
|
public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
Object result = proceedingJoinPoint.proceed();
|
||||||
|
// 打印出参
|
||||||
|
|
||||||
|
logger.info("Response Args : {}", JSONUtil.toJsonStr(result));
|
||||||
|
// 执行耗时
|
||||||
|
logger.info("Time-Consuming : {} ms", System.currentTimeMillis() - startTime);
|
||||||
|
logger.info("=========================================== End ===========================================" + LINE_SEPARATOR);
|
||||||
|
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在切点之后织入
|
||||||
|
*
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
// @After("EleganceLog()")
|
||||||
|
// public void doAfter() throws Throwable {
|
||||||
|
// // 接口结束后换行,方便分割查看
|
||||||
|
// logger.info("=========================================== End ===========================================" + LINE_SEPARATOR);
|
||||||
|
// }
|
||||||
|
// @AfterReturning("EleganceLog()")
|
||||||
|
// public void afterRunning() throws Throwable {
|
||||||
|
// // 接口结束后换行,方便分割查看
|
||||||
|
// logger.info("=========================================== End ===========================================" + LINE_SEPARATOR);
|
||||||
|
// }
|
||||||
|
@AfterThrowing("EleganceLog()")
|
||||||
|
public void afterThrowing() {
|
||||||
|
// System.out.println("异常出现之后...afterThrowing");
|
||||||
|
logger.info("=========================================== Exception Start===========================================" + LINE_SEPARATOR);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取切面注解的描述
|
||||||
|
*
|
||||||
|
* @param joinPoint 切点
|
||||||
|
* @return 描述信息
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public String getAspectLogDescription(JoinPoint joinPoint)
|
||||||
|
throws Exception {
|
||||||
|
String targetName = joinPoint.getTarget().getClass().getName();
|
||||||
|
String methodName = joinPoint.getSignature().getName();
|
||||||
|
Object[] arguments = joinPoint.getArgs();
|
||||||
|
Class targetClass = Class.forName(targetName);
|
||||||
|
Method[] methods = targetClass.getMethods();
|
||||||
|
StringBuilder description = new StringBuilder("");
|
||||||
|
for (Method method : methods) {
|
||||||
|
if (method.getName().equals(methodName)) {
|
||||||
|
Class[] clazzs = method.getParameterTypes();
|
||||||
|
if (clazzs.length == arguments.length) {
|
||||||
|
description.append(method.getAnnotation(EleganceLog.class).description());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return description.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.joju.datamanager.common.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/27
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public interface BaseErrorInfoInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误码
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getResultCode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误描述
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getResultMsg();
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.joju.datamanager.common.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/27
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public enum ExceptionEnum implements BaseErrorInfoInterface {
|
||||||
|
// 数据操作错误定义
|
||||||
|
SUCCESS("2000", "成功!"),
|
||||||
|
BODY_NOT_MATCH("4000", "请求的数据格式不符!"),
|
||||||
|
SIGNATURE_NOT_MATCH("4001", "请求的数字签名不匹配!"),
|
||||||
|
NOT_FOUND("4004", "未找到该资源!"),
|
||||||
|
INTERNAL_SERVER_ERROR("5000", "服务器内部错误!"),
|
||||||
|
SERVER_BUSY("5003", "服务器正忙,请稍后再试!");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误码
|
||||||
|
*/
|
||||||
|
private final String resultCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误描述
|
||||||
|
*/
|
||||||
|
private final String resultMsg;
|
||||||
|
|
||||||
|
ExceptionEnum(String resultCode, String resultMsg) {
|
||||||
|
this.resultCode = resultCode;
|
||||||
|
this.resultMsg = resultMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getResultCode() {
|
||||||
|
return resultCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getResultMsg() {
|
||||||
|
return resultMsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.joju.datamanager.common.exception;
|
||||||
|
|
||||||
|
import com.joju.datamanager.common.result.Result;
|
||||||
|
import com.joju.datamanager.common.result.ResultEnum;
|
||||||
|
import com.joju.datamanager.common.result.ResultUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/27
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@ControllerAdvice
|
||||||
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理自定义的业务异常
|
||||||
|
*
|
||||||
|
* @param req
|
||||||
|
* @param e
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(value = SeMException.class)
|
||||||
|
@ResponseBody
|
||||||
|
public Result bizExceptionHandler(HttpServletRequest req, SeMException e) {
|
||||||
|
logger.error("发生业务异常!原因是:{}", e.getErrorMsg());
|
||||||
|
// return ResultUtil.error(e.getErrorCode(), e.getErrorMsg());
|
||||||
|
return ResultUtil.failure(e.getErrorMsg(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理空指针的异常
|
||||||
|
*
|
||||||
|
* @param req
|
||||||
|
* @param e
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(value = NullPointerException.class)
|
||||||
|
@ResponseBody
|
||||||
|
public Result exceptionHandler(HttpServletRequest req, NullPointerException e) {
|
||||||
|
logger.error("发生空指针异常!原因是:", e);
|
||||||
|
// return ResultResponse.error(ExceptionEnum.BODY_NOT_MATCH);
|
||||||
|
return ResultUtil.failure(ResultEnum.NULL_POINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理其他异常
|
||||||
|
*
|
||||||
|
* @param req
|
||||||
|
* @param e
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(value = Exception.class)
|
||||||
|
@ResponseBody
|
||||||
|
public Result exceptionHandler(HttpServletRequest req, Exception e) {
|
||||||
|
logger.error("未知异常!原因是:", e);
|
||||||
|
return ResultUtil.failure(ResultEnum.SERVICE_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.joju.datamanager.common.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/27
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public class SeMException extends RuntimeException {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误码
|
||||||
|
*/
|
||||||
|
protected String errorCode;
|
||||||
|
/**
|
||||||
|
* 错误信息
|
||||||
|
*/
|
||||||
|
protected String errorMsg;
|
||||||
|
|
||||||
|
public SeMException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeMException(BaseErrorInfoInterface errorInfoInterface) {
|
||||||
|
super(errorInfoInterface.getResultCode());
|
||||||
|
this.errorCode = errorInfoInterface.getResultCode();
|
||||||
|
this.errorMsg = errorInfoInterface.getResultMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeMException(BaseErrorInfoInterface errorInfoInterface, Throwable cause) {
|
||||||
|
super(errorInfoInterface.getResultCode(), cause);
|
||||||
|
this.errorCode = errorInfoInterface.getResultCode();
|
||||||
|
this.errorMsg = errorInfoInterface.getResultMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeMException(String errorMsg) {
|
||||||
|
super(errorMsg);
|
||||||
|
this.errorMsg = errorMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeMException(String errorCode, String errorMsg) {
|
||||||
|
super(errorCode);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.errorMsg = errorMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeMException(String errorCode, String errorMsg, Throwable cause) {
|
||||||
|
super(errorCode, cause);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.errorMsg = errorMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getErrorCode() {
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorCode(String errorCode) {
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getErrorMsg() {
|
||||||
|
return errorMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorMsg(String errorMsg) {
|
||||||
|
this.errorMsg = errorMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Throwable fillInStackTrace() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
43
src/main/java/com/joju/datamanager/common/result/Result.java
Normal file
43
src/main/java/com/joju/datamanager/common/result/Result.java
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package com.joju.datamanager.common.result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/25
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述:
|
||||||
|
*
|
||||||
|
* @author panxg
|
||||||
|
* @date 2020年11月28日 11:56
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value = "Result对象", description = "Result对象")
|
||||||
|
public class Result<T> implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "返回状态")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "返回状态码")
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "返回描述")
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "返回数据")
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.joju.datamanager.common.result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/25
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public class ResultConstant {
|
||||||
|
|
||||||
|
|
||||||
|
public static final Integer RESULT_STATUS_SUCCESS = 1;
|
||||||
|
public static final Integer RESULT_STATUS_FAILURE = -1;
|
||||||
|
|
||||||
|
public static final Integer RESULT_CODE_DEFAULT = 200;
|
||||||
|
public static final Integer RESULT_CODE_FAILURE = -200;
|
||||||
|
|
||||||
|
public static final String RESULT_MSG_SUCCESS = "操作成功";
|
||||||
|
public static final String RESULT_MSG_FAILURE = "操作失败";
|
||||||
|
|
||||||
|
}
|
||||||
102
src/main/java/com/joju/datamanager/common/result/ResultEnum.java
Normal file
102
src/main/java/com/joju/datamanager/common/result/ResultEnum.java
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
package com.joju.datamanager.common.result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/25
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public enum ResultEnum {
|
||||||
|
|
||||||
|
|
||||||
|
LOGIN_OUT_SUCCESS(1, 200, "退出成功!"),
|
||||||
|
LOGIN_IN_SUCCESS(1, 200, "登录成功!"),
|
||||||
|
|
||||||
|
AUTHORITY_FAILURE(-1, 200, "权限不足!"),
|
||||||
|
|
||||||
|
LOGIN_FAILURE_200401(-1, 200401, "登录失败!"),
|
||||||
|
LOGIN_FAILURE_200402(-1, 200402, "登录信息已过期!"),
|
||||||
|
LOGIN_FAILURE_200403(-1, 200403, "未登录,请先登录!"),
|
||||||
|
|
||||||
|
OPERATE_SUCCESS(1, 200, "操作成功!"),
|
||||||
|
OPERATE_FAILURE(-1, 200, "操作失败!"),
|
||||||
|
|
||||||
|
QUERY_SUCCESS(1, 200, "查询成功!"),
|
||||||
|
QUERY_FAILURE(-1, 200, "查询失败!"),
|
||||||
|
|
||||||
|
DELETE_SUCCESS(1, 200, "删除成功!"),
|
||||||
|
DELETE_FAILURE(-1, 200, "删除失败!"),
|
||||||
|
|
||||||
|
INSERT_SUCCESS(1, 200, "新增成功!"),
|
||||||
|
INSERT_FAILURE(-1, 200, "新增失败!"),
|
||||||
|
|
||||||
|
UPDATE_SUCCESS(1, 200, "修改成功!"),
|
||||||
|
UPDATE_FAILURE(-1, 200, "修改失败!"),
|
||||||
|
|
||||||
|
SQL_FAILURE(-1, 200, "数据库异常!"),
|
||||||
|
|
||||||
|
HTTP_FAILURE(-1, 200, "请求异常!"),
|
||||||
|
|
||||||
|
SERVICE_FAILURE(-1, 200, "服务器异常!"),
|
||||||
|
NULL_POINT(-1, 200, "服务器内部空指针!"),
|
||||||
|
|
||||||
|
PARAM_ERROR(-1,200,"请求参数有误"),
|
||||||
|
|
||||||
|
WX_PAY_EXCEPTION(-1,200,"微信异常"),
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
ResultEnum(Integer status, Integer code, String msg) {
|
||||||
|
this.status = status;
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
ResultEnum( Integer code, String msg) {
|
||||||
|
this.status = 0;
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultEnum setStatus(Integer status) {
|
||||||
|
this.status = status;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultEnum setCode(Integer code) {
|
||||||
|
this.code = code;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultEnum setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.joju.datamanager.common.result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/25
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import com.joju.datamanager.common.annotation.ResultAnnotation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.core.MethodParameter;
|
||||||
|
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.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述:
|
||||||
|
* 使用 @ControllerAdvice & ResponseBodyAdvice
|
||||||
|
* 拦截Controller方法默认返回参数,统一处理返回值/响应体
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@ControllerAdvice
|
||||||
|
public class ResultResponseBodyAdviceImpl implements ResponseBodyAdvice<Object> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supports(@NotNull MethodParameter returnType, @NotNull Class<? extends HttpMessageConverter<?>> converterType) {
|
||||||
|
|
||||||
|
/*支持所有方法*/
|
||||||
|
ResultAnnotation methodAnnotation = returnType.getMethodAnnotation(ResultAnnotation.class);
|
||||||
|
if (methodAnnotation != null) {
|
||||||
|
return methodAnnotation.required();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object beforeBodyWrite(Object body,
|
||||||
|
@NotNull MethodParameter returnType,
|
||||||
|
@NotNull MediaType selectedContentType,
|
||||||
|
@NotNull Class<? extends HttpMessageConverter<?>> selectedConverterType,
|
||||||
|
@NotNull ServerHttpRequest request,
|
||||||
|
@NotNull ServerHttpResponse response) {
|
||||||
|
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("ResultResponseBodyAdviceImpl.beforeBodyWrite:{}", body);
|
||||||
|
}
|
||||||
|
if (body instanceof Result) {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
return ResultUtil.successData(body);
|
||||||
|
}
|
||||||
|
}
|
||||||
154
src/main/java/com/joju/datamanager/common/result/ResultUtil.java
Normal file
154
src/main/java/com/joju/datamanager/common/result/ResultUtil.java
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
package com.joju.datamanager.common.result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/25
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class ResultUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 成功
|
||||||
|
* @Param @return @exception
|
||||||
|
* @Author panxg
|
||||||
|
* @Date 2020/11/28 12:28
|
||||||
|
**/
|
||||||
|
public static <T> Result<T> success() {
|
||||||
|
return ResultUtil.getResultSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> success(ResultEnum resultEnum) {
|
||||||
|
return ResultUtil.getResult(resultEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> success(ResultEnum resultEnum,T data) {
|
||||||
|
Result<T> result = ResultUtil.getResult(resultEnum);
|
||||||
|
result.setData(data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> successMsg(String msg) {
|
||||||
|
Result<T> resultSuccess = ResultUtil.getResultSuccess();
|
||||||
|
resultSuccess.setMsg(msg);
|
||||||
|
return resultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> successData(T data) {
|
||||||
|
Result<T> resultSuccess = ResultUtil.getResultSuccess();
|
||||||
|
resultSuccess.setData(data);
|
||||||
|
return resultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> success(String msg, T data) {
|
||||||
|
Result<T> resultSuccess = ResultUtil.getResultSuccess();
|
||||||
|
resultSuccess.setData(data);
|
||||||
|
resultSuccess.setMsg(msg);
|
||||||
|
return resultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 失败
|
||||||
|
* @Param @return @exception
|
||||||
|
* @Author panxg
|
||||||
|
* @Date 2020/11/28 12:27
|
||||||
|
**/
|
||||||
|
public static <T> Result<T> failure() {
|
||||||
|
return ResultUtil.getResultFailure();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> failure(ResultEnum resultEnum) {
|
||||||
|
return ResultUtil.getResult(resultEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> failure(ResultEnum resultEnum,T data) {
|
||||||
|
Result<T> result = ResultUtil.getResult(resultEnum);
|
||||||
|
result.setData(data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> failureMsg(String msg) {
|
||||||
|
return ResultUtil.getResultFailure(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> failureData(T data) {
|
||||||
|
Result<T> resultFailure = ResultUtil.getResultFailure();
|
||||||
|
resultFailure.setData(data);
|
||||||
|
return resultFailure;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> failure(String msg, T data) {
|
||||||
|
Result<T> resultFailure = ResultUtil.getResultFailure();
|
||||||
|
resultFailure.setData(data);
|
||||||
|
resultFailure.setMsg(msg);
|
||||||
|
return resultFailure;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 获取成功默认返回实体
|
||||||
|
* @Param @return @exception
|
||||||
|
* @Author panxg
|
||||||
|
* @Date 2020/11/28 12:27
|
||||||
|
**/
|
||||||
|
public static <T> Result<T> getResultSuccess() {
|
||||||
|
Result<T> result = new Result<>();
|
||||||
|
result.setStatus(ResultConstant.RESULT_STATUS_SUCCESS);
|
||||||
|
result.setMsg(ResultConstant.RESULT_MSG_SUCCESS);
|
||||||
|
result.setCode(ResultConstant.RESULT_CODE_DEFAULT);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 获取失败默认返回实体
|
||||||
|
* @Param @return @exception
|
||||||
|
* @Author panxg
|
||||||
|
* @Date 2020/11/28 12:27
|
||||||
|
**/
|
||||||
|
public static <T> Result<T> getResultFailure(String... msg) {
|
||||||
|
Result<T> result = new Result<>();
|
||||||
|
result.setStatus(ResultConstant.RESULT_STATUS_FAILURE);
|
||||||
|
if (ArrayUtil.isEmpty(msg)) {
|
||||||
|
result.setMsg(ResultConstant.RESULT_MSG_FAILURE);
|
||||||
|
}else{
|
||||||
|
result.setMsg(msg[0]);
|
||||||
|
}
|
||||||
|
result.setCode(ResultConstant.RESULT_CODE_DEFAULT);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 获取默认返回实体
|
||||||
|
* @Param @return @exception
|
||||||
|
* @Author panxg
|
||||||
|
* @Date 2020/11/28 12:27
|
||||||
|
**/
|
||||||
|
public static <T> Result<T> getResult() {
|
||||||
|
Result<T> result = new Result<>();
|
||||||
|
result.setStatus(ResultConstant.RESULT_STATUS_SUCCESS);
|
||||||
|
result.setMsg(ResultConstant.RESULT_MSG_SUCCESS);
|
||||||
|
result.setCode(ResultConstant.RESULT_CODE_DEFAULT);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 获取枚举入参返回实体
|
||||||
|
* @Param @return @exception
|
||||||
|
* @Author panxg
|
||||||
|
* @Date 2020/11/28 12:27
|
||||||
|
**/
|
||||||
|
public static <T> Result<T> getResult(ResultEnum resultEnum) {
|
||||||
|
Result<T> result = new Result<>();
|
||||||
|
result.setStatus(resultEnum.getStatus());
|
||||||
|
result.setMsg(resultEnum.getMsg());
|
||||||
|
result.setCode(resultEnum.getCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.joju.datamanager.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.joju.datamanager.common.annotation.EleganceLog;
|
||||||
|
import com.joju.datamanager.common.result.Result;
|
||||||
|
import com.joju.datamanager.common.result.ResultUtil;
|
||||||
|
import com.joju.datamanager.model.medicalprescription.MedicalPrescription;
|
||||||
|
import com.joju.datamanager.model.viewmodel.PatientList;
|
||||||
|
import com.joju.datamanager.service.HisViewSearchService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: his视图获取
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-15 17:44
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/hisViewSearch")
|
||||||
|
public class HisViewSearchController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
HisViewSearchService hisViewSearchService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* his手术管理视图
|
||||||
|
*
|
||||||
|
* @param hzxm
|
||||||
|
* @param blh
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getSurgicalViewData")
|
||||||
|
@EleganceLog(description = "his手术管理视图")
|
||||||
|
public Result getSurgicalViewData(String hzxm, String blh) {
|
||||||
|
List<Map<String, Object>> maps = hisViewSearchService.getSurgicalView(hzxm, blh);
|
||||||
|
if (!CollUtil.isEmpty(maps)) {//有数据
|
||||||
|
return ResultUtil.successData(maps);
|
||||||
|
}
|
||||||
|
return ResultUtil.failureMsg("未获取到数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* his历史就诊记录查询
|
||||||
|
*
|
||||||
|
* @param patient_name
|
||||||
|
* @param idcard
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getHistoricalVisits")
|
||||||
|
@EleganceLog(description = "his历史就诊记录查询")
|
||||||
|
public Result getHistoricalVisits(String patient_name, String idcard) {
|
||||||
|
List<PatientList> historicalVisits = hisViewSearchService.getHistoricalVisits(patient_name, idcard);
|
||||||
|
|
||||||
|
if (!CollUtil.isEmpty(historicalVisits)) {//有数据
|
||||||
|
return ResultUtil.successData(historicalVisits);
|
||||||
|
}
|
||||||
|
return ResultUtil.failureMsg("未获取到数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getMedicalPrescription")
|
||||||
|
@EleganceLog(description = "获取今天的遗嘱开单信息!")
|
||||||
|
public Result getMedicalPrescription() {
|
||||||
|
List<MedicalPrescription> medicalPrescriptions = hisViewSearchService.getMedicalPrescription();
|
||||||
|
|
||||||
|
if (!CollUtil.isEmpty(medicalPrescriptions)) {
|
||||||
|
return ResultUtil.successData(medicalPrescriptions);
|
||||||
|
}
|
||||||
|
return ResultUtil.failureMsg("获取失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.joju.datamanager.controller;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.joju.datamanager.common.annotation.EleganceLog;
|
||||||
|
import com.joju.datamanager.common.result.Result;
|
||||||
|
import com.joju.datamanager.common.result.ResultUtil;
|
||||||
|
import com.joju.datamanager.model.guidance.IntelligentGuidanceCategory;
|
||||||
|
import com.joju.datamanager.model.guidance.IntelligentGuidanceQuestions;
|
||||||
|
import com.joju.datamanager.service.IntelligentGuidanceCategoryService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 智能导诊
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-21 14:00
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/IntelligentGuidance")
|
||||||
|
public class IntelligentGuidanceController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IntelligentGuidanceCategoryService intelligentGuidanceCategoryService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/testGuidance")
|
||||||
|
public Result testInterface() {
|
||||||
|
return ResultUtil.successData("ok");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getSymptom")
|
||||||
|
@EleganceLog(description = "导诊根据身体部位获取症状")
|
||||||
|
public Result getSymptomByBodyAreaType(String bodyAreaType) {
|
||||||
|
|
||||||
|
List<IntelligentGuidanceCategory> intelligentGuidanceCategoryList = intelligentGuidanceCategoryService.getSymptomByBodyAreaType(bodyAreaType);
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, List<IntelligentGuidanceCategory>> listMap = intelligentGuidanceCategoryList.stream().collect(Collectors.groupingBy(IntelligentGuidanceCategory::getBodyArea));
|
||||||
|
String bodyArea = listMap.keySet().iterator().next();
|
||||||
|
JSONObject result = JSONUtil.createObj().put("bodyArea", bodyArea).put("categoryList", intelligentGuidanceCategoryList);
|
||||||
|
JSONUtil.toJsonStr(result);
|
||||||
|
return ResultUtil.successData(JSONUtil.toJsonStr(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getQuestions")
|
||||||
|
@EleganceLog(description = "导诊获取症状对应的子问题")
|
||||||
|
public Result getQuestionsByChildId(String childId) {
|
||||||
|
|
||||||
|
List<IntelligentGuidanceQuestions> intelligentGuidanceQuestionsList = intelligentGuidanceCategoryService.getQuestionsByChildId(childId);
|
||||||
|
|
||||||
|
List<IntelligentGuidanceQuestions> intelligentGuidanceQuestions = intelligentGuidanceQuestionsList.stream().sorted(Comparator.comparing(IntelligentGuidanceQuestions::getSortId)).collect(Collectors.toList());
|
||||||
|
return ResultUtil.successData(intelligentGuidanceQuestions);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getAllBodyArea")
|
||||||
|
@EleganceLog(description = "导诊获取身体区域划分")
|
||||||
|
public Result getAllBodyArea() {
|
||||||
|
|
||||||
|
List<IntelligentGuidanceCategory> list = intelligentGuidanceCategoryService.getAllBodyArea();
|
||||||
|
return ResultUtil.successData(list);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.joju.datamanager.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.joju.datamanager.common.annotation.EleganceLog;
|
||||||
|
import com.joju.datamanager.common.result.Result;
|
||||||
|
import com.joju.datamanager.common.result.ResultUtil;
|
||||||
|
import com.joju.datamanager.model.callnumber.CallNumbers;
|
||||||
|
import com.joju.datamanager.service.CallNumbersService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 排队叫号接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-27 19:00
|
||||||
|
**/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/callNumbers")
|
||||||
|
public class LineUpToCallNumbersController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CallNumbersService callNumbersService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getCallNumberByIdentity")
|
||||||
|
@EleganceLog(description = "排队叫号获取线上数据")
|
||||||
|
public Result getCallNumberByIdentity(String identity) {
|
||||||
|
|
||||||
|
List<CallNumbers> callNumbersList = callNumbersService.getCallNumberByIdentity(identity);
|
||||||
|
if (!CollUtil.isEmpty(callNumbersList)) {
|
||||||
|
return ResultUtil.successData(callNumbersList);
|
||||||
|
}
|
||||||
|
return ResultUtil.failureMsg("获取失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getCallNumber")
|
||||||
|
@EleganceLog(description = "排队叫号获取本地测试数据")
|
||||||
|
public Result getCallNumber(String identity) {
|
||||||
|
List<CallNumbers> list = callNumbersService.list(new QueryWrapper<CallNumbers>().eq("Card_no", identity).ne("adiagnostic_status", "已就诊"));
|
||||||
|
if (!CollUtil.isEmpty(list)) {
|
||||||
|
return ResultUtil.successData(list);
|
||||||
|
}
|
||||||
|
return ResultUtil.failureMsg("获取失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.joju.datamanager.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.joju.datamanager.common.annotation.EleganceLog;
|
||||||
|
import com.joju.datamanager.common.result.Result;
|
||||||
|
import com.joju.datamanager.common.result.ResultUtil;
|
||||||
|
import com.joju.datamanager.model.medicalprescription.MedicalPrescription;
|
||||||
|
import com.joju.datamanager.service.MedicalPrescriptionService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 医嘱开单接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-02 19:11
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/MedicalPrescription")
|
||||||
|
public class MedicalPrescriptionController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MedicalPrescriptionService medicalPrescriptionService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getLocalMedicalPrescription")
|
||||||
|
@EleganceLog(description = "获取本地的医嘱开单信息")
|
||||||
|
public Result getLocalMedicalPrescription() {
|
||||||
|
String today = DateUtil.today();
|
||||||
|
String todayString = today + "00:00:00";
|
||||||
|
DateTime tomorrow = DateUtil.tomorrow();
|
||||||
|
String s = DateUtil.formatDate(tomorrow);
|
||||||
|
String tomorrowString = s + "00:00:00";
|
||||||
|
|
||||||
|
List<MedicalPrescription> medicalPrescriptions = medicalPrescriptionService.list(new QueryWrapper<MedicalPrescription>().between("lrrq", todayString, tomorrowString));
|
||||||
|
|
||||||
|
if (!CollUtil.isEmpty(medicalPrescriptions)) {
|
||||||
|
return ResultUtil.successData(medicalPrescriptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultUtil.failureMsg("获取失败!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.joju.datamanager.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.joju.datamanager.common.annotation.EleganceLog;
|
||||||
|
import com.joju.datamanager.common.result.Result;
|
||||||
|
import com.joju.datamanager.common.result.ResultUtil;
|
||||||
|
import com.joju.datamanager.model.order.Order;
|
||||||
|
import com.joju.datamanager.model.order.OrderVo;
|
||||||
|
import com.joju.datamanager.service.OrderService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 患者预约记录接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-27 18:52
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value = "/order")
|
||||||
|
@Slf4j
|
||||||
|
public class OrderController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
OrderService orderService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预约到今天的挂号订单信息
|
||||||
|
*
|
||||||
|
* @param yyrq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/getOrderByDate")
|
||||||
|
@EleganceLog(description = "根据日期获取预约订单")
|
||||||
|
public Result getOrderByDate(String yyrq) {
|
||||||
|
List<Order> orders = orderService.list(new QueryWrapper<Order>().eq("yyrq", yyrq).eq("status", "0"));
|
||||||
|
if (!CollUtil.isEmpty(orders)) {
|
||||||
|
return ResultUtil.successData(orders);
|
||||||
|
}
|
||||||
|
return ResultUtil.failureMsg("获取失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getOrderByDateAndDist")
|
||||||
|
@EleganceLog(description = "根据日期获取预约订单以及关联的人员信息")
|
||||||
|
public Result getOrderByDateAndDist(String yyrq) {
|
||||||
|
//查到当日就诊的所有订单以及患者信息,根据真实姓名去重
|
||||||
|
List<OrderVo> orderVos = orderService.getOrderByDateAndDist(yyrq);
|
||||||
|
if (!CollUtil.isEmpty(orderVos)) {
|
||||||
|
return ResultUtil.successData(orderVos);
|
||||||
|
}
|
||||||
|
return ResultUtil.failureMsg("获取失败");
|
||||||
|
}
|
||||||
|
@PostMapping("/insertMissedAppoints")
|
||||||
|
@EleganceLog(description = "批量插入爽约记录")
|
||||||
|
public Result insertMissedApponits(@RequestBody List<OrderVo> orderVos) {
|
||||||
|
Integer i = orderService.insertMissedAppoints(orderVos);
|
||||||
|
if (i > 0) {
|
||||||
|
return ResultUtil.success();
|
||||||
|
}
|
||||||
|
return ResultUtil.failureMsg("插入失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.joju.datamanager.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.joju.datamanager.common.annotation.EleganceLog;
|
||||||
|
import com.joju.datamanager.common.result.Result;
|
||||||
|
import com.joju.datamanager.common.result.ResultUtil;
|
||||||
|
import com.joju.datamanager.model.viewmodel.PatientList;
|
||||||
|
import com.joju.datamanager.service.PatientListService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 历史就诊测试用接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-28 17:14
|
||||||
|
**/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/patientList")
|
||||||
|
public class PatientListController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
PatientListService patientListService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getPatientListByNameAndIdCard")
|
||||||
|
@EleganceLog(description = "获取历史就诊记录的本地测试数据")
|
||||||
|
public Result getPatientListByNameAndIdCard(String patientName, String idCard) {
|
||||||
|
|
||||||
|
List<PatientList> list = patientListService.list(new QueryWrapper<PatientList>().eq("patient_name", patientName).eq("idcard", idCard).orderBy(true, false, "register_date"));
|
||||||
|
if (!CollUtil.isEmpty(list)) {
|
||||||
|
return ResultUtil.successData(list);
|
||||||
|
}
|
||||||
|
return ResultUtil.failureMsg("获取失败");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.joju.datamanager.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.joju.datamanager.common.annotation.EleganceLog;
|
||||||
|
import com.joju.datamanager.common.result.Result;
|
||||||
|
import com.joju.datamanager.common.result.ResultUtil;
|
||||||
|
import com.joju.datamanager.service.TriageCallingService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 分诊叫号接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-29 16:15
|
||||||
|
**/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/triageCalling")
|
||||||
|
public class TriageCallingController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TriageCallingService triageCallingService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getTriageCallingByDate")
|
||||||
|
@EleganceLog(description = "分诊叫号获取患者叫号记录")
|
||||||
|
public Result getTriageCallingByDate() {
|
||||||
|
List<String> triageCallings = triageCallingService.getTriageCallingByDate();
|
||||||
|
|
||||||
|
if (!CollUtil.isEmpty(triageCallings)) {
|
||||||
|
return ResultUtil.successData(triageCallings);
|
||||||
|
}
|
||||||
|
return ResultUtil.failureMsg("获取失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.joju.datamanager.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.joju.datamanager.common.annotation.EleganceLog;
|
||||||
|
import com.joju.datamanager.common.result.Result;
|
||||||
|
import com.joju.datamanager.common.result.ResultUtil;
|
||||||
|
import com.joju.datamanager.model.user.User;
|
||||||
|
import com.joju.datamanager.service.UserService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 微信用户信息管理
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-06 18:09
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/user")
|
||||||
|
@Slf4j
|
||||||
|
public class UserController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@GetMapping("/getUserData")
|
||||||
|
@EleganceLog(description = "测试接口")
|
||||||
|
public Result getData() {
|
||||||
|
|
||||||
|
return ResultUtil.successData("ok");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getOpenidByUserCard")
|
||||||
|
@EleganceLog(description = "获取用户卡号绑定的openid")
|
||||||
|
public Result getOpenidByUserCard(String card) {
|
||||||
|
|
||||||
|
List<User> userCardAndRelateList = userService.getOpenidByUserCard(card);
|
||||||
|
|
||||||
|
if (!CollUtil.isEmpty(userCardAndRelateList)) {
|
||||||
|
return ResultUtil.successData(userCardAndRelateList);
|
||||||
|
}
|
||||||
|
return ResultUtil.failureMsg("获取失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.joju.datamanager.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.joju.datamanager.model.callnumber.CallNumbers;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 排队叫号Mapper
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-29 10:33
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface CallNumbersMapper extends BaseMapper<CallNumbers> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.joju.datamanager.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.joju.datamanager.model.guidance.IntelligentGuidanceCategory;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 身体部位mapper
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-21 18:14
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface IntelligentGuidanceCategoryMapper extends BaseMapper<IntelligentGuidanceCategory> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.joju.datamanager.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.joju.datamanager.model.guidance.IntelligentGuidanceQuestions;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 智能导诊问题mapper
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-25 11:07
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface IntelligentGuidanceQuestionsMapper extends BaseMapper<IntelligentGuidanceQuestions> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.joju.datamanager.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.joju.datamanager.model.medicalprescription.MedicalPrescription;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 医嘱开单Mapper
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-02 19:14
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface MedicalPrescriptionMapper extends BaseMapper<MedicalPrescription> {
|
||||||
|
|
||||||
|
}
|
||||||
22
src/main/java/com/joju/datamanager/mapper/OrderMapper.java
Normal file
22
src/main/java/com/joju/datamanager/mapper/OrderMapper.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package com.joju.datamanager.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.joju.datamanager.model.order.Order;
|
||||||
|
import com.joju.datamanager.model.order.OrderVo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 患者预约记录mapper
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-27 18:55
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface OrderMapper extends BaseMapper<Order> {
|
||||||
|
|
||||||
|
|
||||||
|
List<OrderVo> getOrderByDateAndDist(String yyrq);
|
||||||
|
|
||||||
|
Integer insertMissedAppoints(List<OrderVo> orderVos);
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.joju.datamanager.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.joju.datamanager.model.viewmodel.PatientList;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 历史记录测试业务mapper
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-28 17:49
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface PatientListMapper extends BaseMapper<PatientList> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
15
src/main/java/com/joju/datamanager/mapper/UserMapper.java
Normal file
15
src/main/java/com/joju/datamanager/mapper/UserMapper.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package com.joju.datamanager.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.joju.datamanager.model.user.User;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 用户表mapper
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-07 10:34
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface UserMapper extends BaseMapper<User> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.joju.datamanager.model.callnumber;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.lang.model.element.NestingKind;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 排队叫号实体类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-27 19:07
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("call_numbers")
|
||||||
|
public class CallNumbers {
|
||||||
|
/**
|
||||||
|
* 叫号序号排队
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String CallNo;
|
||||||
|
/**
|
||||||
|
* 排队号
|
||||||
|
*/
|
||||||
|
private String DiagnosticNO;
|
||||||
|
/**
|
||||||
|
* 科室名称
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String KESHIMC;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医生名称
|
||||||
|
*/
|
||||||
|
private String DoctorName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 患者名称
|
||||||
|
*/
|
||||||
|
private String PatientName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 就诊科室
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String RoomNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排队状态
|
||||||
|
*/
|
||||||
|
@TableField(value = "adiagnostic_status")
|
||||||
|
private String ADiagnosticStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前叫号序号
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String MinCallNo;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.joju.datamanager.model.guidance;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 身体部位分类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-21 18:09
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@TableName("intelligent_guidance_category")
|
||||||
|
public class IntelligentGuidanceCategory {
|
||||||
|
|
||||||
|
private String bodyArea;
|
||||||
|
|
||||||
|
private String bodyAreaType;
|
||||||
|
|
||||||
|
private String symptom;
|
||||||
|
|
||||||
|
private String childId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.joju.datamanager.model.guidance;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 智能导诊问题实体类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-25 11:03
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@TableName("intelligent_guidance_questions")
|
||||||
|
public class IntelligentGuidanceQuestions {
|
||||||
|
|
||||||
|
|
||||||
|
private Integer sortId;
|
||||||
|
private String parentId;
|
||||||
|
private String question;
|
||||||
|
private String departmentName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.joju.datamanager.model.medicalprescription;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 遗嘱开单实体类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-02 16:52
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class MedicalPrescription {
|
||||||
|
|
||||||
|
private String cfxh;
|
||||||
|
private String cardno;
|
||||||
|
private String hzxm;
|
||||||
|
private String ksmc;
|
||||||
|
private String ysmc;
|
||||||
|
private String fymx;
|
||||||
|
private String ypsl;
|
||||||
|
private String ypdj;
|
||||||
|
private String je;
|
||||||
|
private String lrrq;
|
||||||
|
}
|
||||||
27
src/main/java/com/joju/datamanager/model/order/Order.java
Normal file
27
src/main/java/com/joju/datamanager/model/order/Order.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package com.joju.datamanager.model.order;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 病人预约记录表
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-27 18:49
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class Order {
|
||||||
|
|
||||||
|
private String order_id;
|
||||||
|
private String cardno;
|
||||||
|
private String patientId;
|
||||||
|
private String ksmc;
|
||||||
|
private String ksdm;
|
||||||
|
private String yyrq;
|
||||||
|
private String yyhx;
|
||||||
|
private String xh;
|
||||||
|
private String sjd;
|
||||||
|
private String status;
|
||||||
|
private String createTime;
|
||||||
|
private String createDate;
|
||||||
|
|
||||||
|
}
|
||||||
21
src/main/java/com/joju/datamanager/model/order/OrderVo.java
Normal file
21
src/main/java/com/joju/datamanager/model/order/OrderVo.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.joju.datamanager.model.order;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 预约订单连表查询结果集
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-01 18:06
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OrderVo {
|
||||||
|
|
||||||
|
private String cardno;
|
||||||
|
private String patientId;
|
||||||
|
private String ksmc;
|
||||||
|
private String yyrq;
|
||||||
|
|
||||||
|
private String trueName;
|
||||||
|
private String idCard;
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.joju.datamanager.model.triagecalling;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.PriorityQueue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 分诊叫号实体类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-29 16:40
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class TriageCalling {
|
||||||
|
|
||||||
|
|
||||||
|
// private String ID
|
||||||
|
private String CallNo;
|
||||||
|
private String DiagnosticNO;
|
||||||
|
private String CalDiagnosticDaylNo;
|
||||||
|
private String DiagnosticOrderTime;
|
||||||
|
private String KESHIMC;
|
||||||
|
private String KESHIDM;
|
||||||
|
private String DoctorName;
|
||||||
|
private String DoctorID;
|
||||||
|
private String PatientName;
|
||||||
|
private String CardNo;
|
||||||
|
private String OrderTime;
|
||||||
|
private String DiagnosticStatus;
|
||||||
|
private String DiagnosticType;
|
||||||
|
private String DiagnosticOrderType;
|
||||||
|
private String SkipNum;
|
||||||
|
private String RoomNo;
|
||||||
|
private String RoomName;
|
||||||
|
private String ZHENGJIANHM;
|
||||||
|
private String ZHENGJIANHM_QT;
|
||||||
|
private String GUAHAOBC;
|
||||||
|
private String FENYUANDM;
|
||||||
|
private String PriorityQueue;
|
||||||
|
private String PriorityQueueType;
|
||||||
|
private String BloodPressue;
|
||||||
|
private String Weight;
|
||||||
|
private String UrgentTeam;
|
||||||
|
private String CallTime;
|
||||||
|
private String ItemsInfo;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.joju.datamanager.model.triagecalling;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 分诊叫号结果实体集
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-29 17:26
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class TriageCallingResultVo {
|
||||||
|
private String PatientName;
|
||||||
|
|
||||||
|
}
|
||||||
29
src/main/java/com/joju/datamanager/model/user/User.java
Normal file
29
src/main/java/com/joju/datamanager/model/user/User.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package com.joju.datamanager.model.user;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 用户实体类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-07 10:28
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
@TableName("wx_user_patient")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class User {
|
||||||
|
private Integer id;
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
private String medical_card;
|
||||||
|
private String type;
|
||||||
|
private String relate;
|
||||||
|
private String create_time;
|
||||||
|
private String create_date;
|
||||||
|
|
||||||
|
}
|
||||||
11
src/main/java/com/joju/datamanager/model/user/UserVo.java
Normal file
11
src/main/java/com/joju/datamanager/model/user/UserVo.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.joju.datamanager.model.user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 用户结果类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-07 10:27
|
||||||
|
**/
|
||||||
|
|
||||||
|
public class UserVo {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.joju.datamanager.model.viewmodel;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 患者历史就诊记录
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-27 12:49
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@TableName("v_patient_list")
|
||||||
|
public class PatientList {
|
||||||
|
|
||||||
|
|
||||||
|
private String patientNo;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String patientName;
|
||||||
|
|
||||||
|
private String idcard;
|
||||||
|
|
||||||
|
private String gender;
|
||||||
|
|
||||||
|
private String birthday;
|
||||||
|
|
||||||
|
private String registerDate;
|
||||||
|
|
||||||
|
private String OutpatientDate;
|
||||||
|
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
private String doctorCode;
|
||||||
|
|
||||||
|
private String doctorName;
|
||||||
|
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
private String classNo;
|
||||||
|
|
||||||
|
private String icdCode;
|
||||||
|
|
||||||
|
private String icdName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.joju.datamanager.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.joju.datamanager.model.callnumber.CallNumbers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 排队叫号业务接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-27 19:01
|
||||||
|
**/
|
||||||
|
public interface CallNumbersService extends IService<CallNumbers> {
|
||||||
|
|
||||||
|
|
||||||
|
List<CallNumbers> getCallNumberByIdentity(String identity);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.joju.datamanager.service;
|
||||||
|
|
||||||
|
import com.joju.datamanager.model.medicalprescription.MedicalPrescription;
|
||||||
|
import com.joju.datamanager.model.viewmodel.PatientList;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 手术管理接口服务
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-15 17:45
|
||||||
|
**/
|
||||||
|
public interface HisViewSearchService {
|
||||||
|
public List<Map<String, Object>> getSurgicalView(String hzxm, String blh);
|
||||||
|
|
||||||
|
|
||||||
|
List<PatientList> getHistoricalVisits(String patientName, String idcard);
|
||||||
|
|
||||||
|
List<MedicalPrescription> getMedicalPrescription();
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.joju.datamanager.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.joju.datamanager.model.guidance.IntelligentGuidanceCategory;
|
||||||
|
import com.joju.datamanager.model.guidance.IntelligentGuidanceQuestions;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 身体部位分类接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-21 18:11
|
||||||
|
**/
|
||||||
|
public interface IntelligentGuidanceCategoryService extends IService<IntelligentGuidanceCategory> {
|
||||||
|
|
||||||
|
List<IntelligentGuidanceCategory> getSymptomByBodyAreaType(String bodyAreaType);
|
||||||
|
|
||||||
|
List<IntelligentGuidanceQuestions> getQuestionsByChildId(String childId);
|
||||||
|
|
||||||
|
List<IntelligentGuidanceCategory> getAllBodyArea();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.joju.datamanager.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.joju.datamanager.model.medicalprescription.MedicalPrescription;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 医嘱开单业务接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-02 19:12
|
||||||
|
**/
|
||||||
|
public interface MedicalPrescriptionService extends IService<MedicalPrescription> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
22
src/main/java/com/joju/datamanager/service/OrderService.java
Normal file
22
src/main/java/com/joju/datamanager/service/OrderService.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package com.joju.datamanager.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.joju.datamanager.model.order.Order;
|
||||||
|
import com.joju.datamanager.model.order.OrderVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 患者预约记录业务接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-27 18:53
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
public interface OrderService extends IService<Order> {
|
||||||
|
|
||||||
|
|
||||||
|
List<OrderVo> getOrderByDateAndDist(String yyrq);
|
||||||
|
|
||||||
|
Integer insertMissedAppoints(List<OrderVo> orderVos);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.joju.datamanager.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.joju.datamanager.model.viewmodel.PatientList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 历史记录测试业务
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-28 17:47
|
||||||
|
**/
|
||||||
|
public interface PatientListService extends IService<PatientList> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.joju.datamanager.service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 分诊叫号接口业务
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-29 16:22
|
||||||
|
**/
|
||||||
|
public interface TriageCallingService {
|
||||||
|
|
||||||
|
|
||||||
|
List<String> getTriageCallingByDate();
|
||||||
|
|
||||||
|
}
|
||||||
17
src/main/java/com/joju/datamanager/service/UserService.java
Normal file
17
src/main/java/com/joju/datamanager/service/UserService.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.joju.datamanager.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.joju.datamanager.model.user.User;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 用户业务接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-07 10:31
|
||||||
|
**/
|
||||||
|
public interface UserService extends IService<User> {
|
||||||
|
|
||||||
|
|
||||||
|
List<User> getOpenidByUserCard(String card);
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.joju.datamanager.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONArray;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.joju.datamanager.mapper.CallNumbersMapper;
|
||||||
|
import com.joju.datamanager.model.callnumber.CallNumbers;
|
||||||
|
import com.joju.datamanager.service.CallNumbersService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 排队叫号实现类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-27 19:02
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class CallNumbersServiceImpl extends ServiceImpl<CallNumbersMapper, CallNumbers> implements CallNumbersService {
|
||||||
|
|
||||||
|
private static final String DATA_GET_URL = "http://168.168.0.37:5053";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CallNumbers> getCallNumberByIdentity(String identity) {
|
||||||
|
|
||||||
|
List<CallNumbers> callNumbers = null;
|
||||||
|
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("CardNo", identity);
|
||||||
|
String result = HttpUtil.get(DATA_GET_URL + "/HospitalCallApi/GetPatientWaitinfo", paramMap);
|
||||||
|
|
||||||
|
JSONObject resultJson = JSONUtil.parseObj(result);
|
||||||
|
if (Convert.toStr(resultJson.get("State")).equals("True")) {//响应成功
|
||||||
|
Object resData = resultJson.get("Result");
|
||||||
|
JSONObject ResultJson = JSONUtil.parseObj(resData);
|
||||||
|
Object ds = ResultJson.get("ds");
|
||||||
|
|
||||||
|
JSONArray resDataJsonArray = JSONUtil.parseArray(ds);
|
||||||
|
log.info("resDataJsonArray is :" + resDataJsonArray);
|
||||||
|
|
||||||
|
|
||||||
|
callNumbers = JSONUtil.toList(resDataJsonArray, CallNumbers.class);
|
||||||
|
|
||||||
|
callNumbers = callNumbers.stream().filter(c -> c.getADiagnosticStatus().equals("候诊")).collect(Collectors.toList());
|
||||||
|
|
||||||
|
}
|
||||||
|
return callNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
package com.joju.datamanager.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.db.handler.BeanListHandler;
|
||||||
|
import com.joju.datamanager.model.medicalprescription.MedicalPrescription;
|
||||||
|
import com.joju.datamanager.model.viewmodel.PatientList;
|
||||||
|
import com.joju.datamanager.service.HisViewSearchService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 手术管理服务接口实体类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-15 17:45
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class HisViewSearchServiceImpl implements HisViewSearchService {
|
||||||
|
|
||||||
|
//查看手术视图 HIS_SSXXCX
|
||||||
|
|
||||||
|
public List<Map<String, Object>> getSurgicalView(String hzxm, String blh) {
|
||||||
|
log.info("拼接数据");
|
||||||
|
// String URL = "jdbc:sqlserver:thin:@//168.168.0.10:1433/THIS4";
|
||||||
|
String URL = "jdbc:sqlserver://168.168.0.10:1433;databaseName=THIS4";
|
||||||
|
String USER = "joju";
|
||||||
|
String PASSWORD = "Joju@123";
|
||||||
|
List<Map<String, Object>> list = null;
|
||||||
|
// 1.加载驱动程序
|
||||||
|
try {
|
||||||
|
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
|
||||||
|
// 2.获得数据库链接
|
||||||
|
log.info("开始链接数据库");
|
||||||
|
Connection conn = DriverManager.getConnection(URL, USER, PASSWORD);
|
||||||
|
log.info("打印链接状态:" + conn);
|
||||||
|
// 3.通过数据库的连接操作数据库,实现增删改查(使用Statement类)
|
||||||
|
// String inHosnum = "811134";
|
||||||
|
String sql = "select * from HIS_SSXXCX where hzxm ='" + hzxm + "' and blh = '" + blh + "' ";
|
||||||
|
log.info("打印sql" + sql);
|
||||||
|
Statement statement = conn.createStatement();
|
||||||
|
ResultSet rs = statement.executeQuery(sql);
|
||||||
|
log.info("返回结果是:" + rs);
|
||||||
|
// 4.处理数据库的返回结果(使用ResultSet类)
|
||||||
|
while (rs.next()) {
|
||||||
|
log.info("开始处理数据");
|
||||||
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
// log.info("打印itemType" + rs.getString("ItemType"));
|
||||||
|
map.put("blh", rs.getString("blh"));
|
||||||
|
map.put("hzxm", rs.getString("hzxm"));
|
||||||
|
map.put("ssmc", rs.getString("ssmc"));
|
||||||
|
map.put("sqrq", rs.getString("sqrq"));
|
||||||
|
map.put("aprq", rs.getString("aprq"));
|
||||||
|
map.put("kssj", rs.getString("kssj"));
|
||||||
|
map.put("jssj", rs.getString("jssj"));
|
||||||
|
map.put("zt", rs.getString("zt"));
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
log.info("list is " + list);
|
||||||
|
// 关闭资源【多谢指正】
|
||||||
|
rs.close();
|
||||||
|
statement.close();
|
||||||
|
conn.close();
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//查看历史就诊视图 v_patient_list
|
||||||
|
public List<PatientList> getHistoricalVisits(String patient_name, String idcard) {
|
||||||
|
log.info("拼接数据");
|
||||||
|
// String URL = "jdbc:sqlserver:thin:@//168.168.0.10:1433/THIS4";
|
||||||
|
String URL = "jdbc:sqlserver://168.168.0.10:1433;databaseName=THIS4";
|
||||||
|
String USER = "joju";
|
||||||
|
String PASSWORD = "Joju@123";
|
||||||
|
List<PatientList> patientLists = null;
|
||||||
|
// 1.加载驱动程序
|
||||||
|
try {
|
||||||
|
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
|
||||||
|
// 2.获得数据库链接
|
||||||
|
log.info("开始链接数据库");
|
||||||
|
Connection conn = DriverManager.getConnection(URL, USER, PASSWORD);
|
||||||
|
log.info("打印链接状态:" + conn);
|
||||||
|
// 3.通过数据库的连接操作数据库,实现增删改查(使用Statement类)
|
||||||
|
// String inHosnum = "811134";
|
||||||
|
String sql = "select * from v_patient_list where patient_name ='" + patient_name + "' and idcard = '" + idcard + "' " + "order by register_date DESC";
|
||||||
|
log.info("打印sql" + sql);
|
||||||
|
Statement statement = conn.createStatement();
|
||||||
|
ResultSet rs = statement.executeQuery(sql);
|
||||||
|
log.info("返回结果是:" + rs);
|
||||||
|
|
||||||
|
BeanListHandler<PatientList> patientListBeanListHandler = new BeanListHandler<>(PatientList.class);
|
||||||
|
|
||||||
|
patientLists = patientListBeanListHandler.handle(rs);
|
||||||
|
|
||||||
|
log.info("list is " + patientLists);
|
||||||
|
// 关闭资源【多谢指正】
|
||||||
|
rs.close();
|
||||||
|
statement.close();
|
||||||
|
conn.close();
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return patientLists;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MedicalPrescription> getMedicalPrescription() {
|
||||||
|
log.info("拼接数据");
|
||||||
|
// String URL = "jdbc:sqlserver:thin:@//168.168.0.10:1433/THIS4";
|
||||||
|
String URL = "jdbc:sqlserver://168.168.0.10:1433;databaseName=THIS4";
|
||||||
|
String USER = "joju";
|
||||||
|
String PASSWORD = "Joju@123";
|
||||||
|
List<MedicalPrescription> medicalPrescriptions = null;
|
||||||
|
// 1.加载驱动程序
|
||||||
|
try {
|
||||||
|
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
|
||||||
|
// 2.获得数据库链接
|
||||||
|
log.info("开始链接数据库");
|
||||||
|
Connection conn = DriverManager.getConnection(URL, USER, PASSWORD);
|
||||||
|
log.info("打印链接状态:" + conn);
|
||||||
|
// 3.通过数据库的连接操作数据库,实现增删改查(使用Statement类)
|
||||||
|
String today = DateUtil.today();
|
||||||
|
String todayString = today + "00:00:00";
|
||||||
|
DateTime tomorrow = DateUtil.tomorrow();
|
||||||
|
String s = DateUtil.formatDate(tomorrow);
|
||||||
|
String tomorrowString = s + "00:00:00";
|
||||||
|
// SELECT * FROM HIS_WJFHZCFXX WHERE lrrq BETWEEN '2024-04-02 00:00:00' AND '2024-04-03 00:00:00 '
|
||||||
|
String sql = " SELECT * FROM HIS_WJFHZCFXX WHERE lrrq BETWEEN '" + todayString + "' AND '" + tomorrowString + "'";
|
||||||
|
log.info("打印sql" + sql);
|
||||||
|
Statement statement = conn.createStatement();
|
||||||
|
ResultSet rs = statement.executeQuery(sql);
|
||||||
|
log.info("返回结果是:" + rs);
|
||||||
|
|
||||||
|
BeanListHandler<MedicalPrescription> medicalPrescriptionBeanListHandler = new BeanListHandler<>(MedicalPrescription.class);
|
||||||
|
medicalPrescriptions = medicalPrescriptionBeanListHandler.handle(rs);
|
||||||
|
|
||||||
|
log.info("list is " + medicalPrescriptions);
|
||||||
|
// 关闭资源【多谢指正】
|
||||||
|
rs.close();
|
||||||
|
statement.close();
|
||||||
|
conn.close();
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return medicalPrescriptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.joju.datamanager.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.joju.datamanager.mapper.IntelligentGuidanceCategoryMapper;
|
||||||
|
import com.joju.datamanager.mapper.IntelligentGuidanceQuestionsMapper;
|
||||||
|
import com.joju.datamanager.model.guidance.IntelligentGuidanceCategory;
|
||||||
|
import com.joju.datamanager.model.guidance.IntelligentGuidanceQuestions;
|
||||||
|
import com.joju.datamanager.service.IntelligentGuidanceCategoryService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 身体部位分类实现类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-21 18:11
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class IntelligentGuidanceCategoryServiceImpl extends ServiceImpl<IntelligentGuidanceCategoryMapper, IntelligentGuidanceCategory> implements IntelligentGuidanceCategoryService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IntelligentGuidanceCategoryMapper intelligentGuidanceCategoryMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IntelligentGuidanceQuestionsMapper intelligentGuidanceQuestionsMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IntelligentGuidanceCategory> getSymptomByBodyAreaType(String bodyAreaType) {
|
||||||
|
return intelligentGuidanceCategoryMapper.selectList(new QueryWrapper<IntelligentGuidanceCategory>().eq("body_area_type", bodyAreaType));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IntelligentGuidanceQuestions> getQuestionsByChildId(String childId) {
|
||||||
|
|
||||||
|
return intelligentGuidanceQuestionsMapper.selectList(new QueryWrapper<IntelligentGuidanceQuestions>().eq("parent_id", childId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IntelligentGuidanceCategory> getAllBodyArea() {
|
||||||
|
|
||||||
|
return intelligentGuidanceCategoryMapper.selectList(new QueryWrapper<IntelligentGuidanceCategory>().select("DISTINCT body_area,body_area_type"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.joju.datamanager.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.joju.datamanager.mapper.MedicalPrescriptionMapper;
|
||||||
|
import com.joju.datamanager.model.medicalprescription.MedicalPrescription;
|
||||||
|
import com.joju.datamanager.service.MedicalPrescriptionService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 医嘱开单业务实现类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-02 19:13
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class MedicalPrescriptionServiceImpl extends ServiceImpl<MedicalPrescriptionMapper, MedicalPrescription> implements MedicalPrescriptionService {
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.joju.datamanager.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.joju.datamanager.mapper.OrderMapper;
|
||||||
|
import com.joju.datamanager.model.order.Order;
|
||||||
|
import com.joju.datamanager.model.order.OrderVo;
|
||||||
|
import com.joju.datamanager.service.OrderService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 患者预约记录业务接口实现类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-27 18:54
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
OrderMapper orderMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OrderVo> getOrderByDateAndDist(String yyrq) {
|
||||||
|
|
||||||
|
return orderMapper.getOrderByDateAndDist(yyrq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer insertMissedAppoints(List<OrderVo> orderVos) {
|
||||||
|
return orderMapper.insertMissedAppoints(orderVos);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.joju.datamanager.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.joju.datamanager.mapper.PatientListMapper;
|
||||||
|
import com.joju.datamanager.model.viewmodel.PatientList;
|
||||||
|
import com.joju.datamanager.service.PatientListService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 历史记录测试业务
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-28 17:48
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class PatientListServiceImpl extends ServiceImpl<PatientListMapper, PatientList> implements PatientListService {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.joju.datamanager.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.joju.datamanager.service.TriageCallingService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 分诊叫号业务实现类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-29 16:22
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class TriageCallingServiceImpl implements TriageCallingService {
|
||||||
|
|
||||||
|
private static final String DATA_GET_URL = "http://168.168.0.37:5053";
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getTriageCallingByDate() {
|
||||||
|
List<String> patients = null;
|
||||||
|
String result = HttpUtil.get(DATA_GET_URL + "/HospitalCallApi/GetDailyPatientName?a=n");
|
||||||
|
JSONObject resultJson = JSONUtil.parseObj(result);
|
||||||
|
if (Convert.toStr(resultJson.get("State")).equals("True")) {//响应成功
|
||||||
|
Object resData = resultJson.get("Result");//字符串
|
||||||
|
String str = Convert.toStr(resData);
|
||||||
|
String[] split = str.split(",");
|
||||||
|
patients = Arrays.asList(split);
|
||||||
|
}
|
||||||
|
return patients;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.joju.datamanager.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.joju.datamanager.mapper.UserMapper;
|
||||||
|
import com.joju.datamanager.model.user.User;
|
||||||
|
import com.joju.datamanager.service.UserService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 用户业务实现类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-03-07 10:32
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserMapper userMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<User> getOpenidByUserCard(String card) {
|
||||||
|
|
||||||
|
List<User> users = userMapper.selectList(new QueryWrapper<User>().eq("medical_card", card).select("openid","relate"));
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
}
|
||||||
51
src/main/resources/application.yml
Normal file
51
src/main/resources/application.yml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
server:
|
||||||
|
port: 8083
|
||||||
|
servlet:
|
||||||
|
context-path: /dataManager
|
||||||
|
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://localhost:3306/hrs?zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||||
|
username: root
|
||||||
|
password: fybjy_1234
|
||||||
|
# password: 123456
|
||||||
|
druid:
|
||||||
|
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
initial-size: 5
|
||||||
|
min-idle: 5
|
||||||
|
max-active: 20
|
||||||
|
max-wait: 60000
|
||||||
|
time-between-eviction-runs-millis: 60000
|
||||||
|
min-evictable-idle-time-millis: 300000
|
||||||
|
validation-query: SELECT 1 FROM DUAL
|
||||||
|
test-while-idle: true
|
||||||
|
test-on-borrow: true
|
||||||
|
test-on-return: true
|
||||||
|
pool-prepared-statements: true
|
||||||
|
max-pool-prepared-statement-per-connection-size: 20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# mybatis-plus相关配置
|
||||||
|
|
||||||
|
mybatis-plus:
|
||||||
|
# xml扫描,多个目录用逗号或者分号分隔(告诉 Mapper 所对应的 XML 文件位置)
|
||||||
|
mapper-locations: classpath:mapper/*.xml
|
||||||
|
# 以下配置均有默认值,可以不设置
|
||||||
|
global-config:
|
||||||
|
db-config:
|
||||||
|
#主键类型 AUTO:"数据库ID自增" INPUT:"用户输入ID",ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
|
||||||
|
id-type: auto
|
||||||
|
#字段策略 IGNORED:"忽略判断" NOT_NULL:"非 NULL 判断") NOT_EMPTY:"非空判断"
|
||||||
|
field-strategy: NOT_EMPTY
|
||||||
|
#数据库类型
|
||||||
|
db-type: MYSQL
|
||||||
|
configuration:
|
||||||
|
# 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射
|
||||||
|
map-underscore-to-camel-case: true
|
||||||
|
# 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段
|
||||||
|
call-setters-on-nulls: true
|
||||||
|
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
|
||||||
133
src/main/resources/logback.xml
Normal file
133
src/main/resources/logback.xml
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration debug="true">
|
||||||
|
|
||||||
|
<!-- appender是configuration的子节点,是负责写日志的组件。 -->
|
||||||
|
<!-- ConsoleAppender:把日志输出到控制台 -->
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<!-- 默认情况下,每个日志事件都会立即刷新到基础输出流。 这种默认方法更安全,因为如果应用程序在没有正确关闭appender的情况下退出,则日志事件不会丢失。
|
||||||
|
但是,为了显着增加日志记录吞吐量,您可能希望将immediateFlush属性设置为false -->
|
||||||
|
<!--<immediateFlush>true</immediateFlush>-->
|
||||||
|
<encoder>
|
||||||
|
<!-- %37():如果字符没有37个字符长度,则左侧用空格补齐 -->
|
||||||
|
<!-- %-37():如果字符没有37个字符长度,则右侧用空格补齐 -->
|
||||||
|
<!-- %15.15():如果记录的线程字符长度小于15(第一个)则用空格在左侧补齐,如果字符长度大于15(第二个),则从开头开始截断多余的字符 -->
|
||||||
|
<!-- %-40.40():如果记录的logger字符长度小于40(第一个)则用空格在右侧补齐,如果字符长度大于40(第二个),则从开头开始截断多余的字符 -->
|
||||||
|
<!-- %msg:日志打印详情 -->
|
||||||
|
<!-- %n:换行符 -->
|
||||||
|
<!-- %highlight():转换说明符以粗体红色显示其级别为ERROR的事件,红色为WARN,BLUE为INFO,以及其他级别的默认颜色。 -->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) --- [%15.15(%thread)] %cyan(%-40.40(%logger{40}))
|
||||||
|
: %msg%n
|
||||||
|
</pattern>
|
||||||
|
<!-- 控制台也要使用UTF-8,不要使用GBK,否则会中文乱码 -->
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- info 日志-->
|
||||||
|
<!-- RollingFileAppender:滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 -->
|
||||||
|
<!-- 以下的大概意思是:1.先按日期存日志,日期变了,将前一天的日志文件名重命名为XXX%日期%索引,新的日志仍然是project_info.log -->
|
||||||
|
<!-- 2.如果日期没有发生变化,但是当前日志的文件大小超过10MB时,对当前日志进行分割 重命名-->
|
||||||
|
<appender name="info_log" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<!--日志文件路径和名称-->
|
||||||
|
<File>Elliott/dataManager.log</File>
|
||||||
|
<!--是否追加到文件末尾,默认为true-->
|
||||||
|
<append>true</append>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<level>ERROR</level>
|
||||||
|
<onMatch>DENY</onMatch><!-- 如果命中ERROR就禁止这条日志 -->
|
||||||
|
<onMismatch>ACCEPT</onMismatch><!-- 如果没有命中就使用这条规则 -->
|
||||||
|
</filter>
|
||||||
|
<!--有两个与RollingFileAppender交互的重要子组件。 第一个RollingFileAppender子组件,即RollingPolicy:负责执行翻转所需的操作。
|
||||||
|
RollingFileAppender的第二个子组件,即TriggeringPolicy:将确定是否以及何时发生翻转。 因此,RollingPolicy负责什么和TriggeringPolicy负责什么时候.
|
||||||
|
作为任何用途,RollingFileAppender必须同时设置RollingPolicy和TriggeringPolicy,但是,如果其RollingPolicy也实现了TriggeringPolicy接口,则只需要显式指定前者。-->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件的名字会根据fileNamePattern的值,每隔一段时间改变一次 -->
|
||||||
|
<!-- 文件名:logs/project_info.2017-12-05.0.log -->
|
||||||
|
<!-- 注意:SizeAndTimeBasedRollingPolicy中 %i和%d令牌都是强制性的,必须存在,要不会报错 -->
|
||||||
|
<fileNamePattern>Elliott/dataManager.%d.%i.log</fileNamePattern>
|
||||||
|
<!-- 每产生一个日志文件,该日志文件的保存期限为30天, ps:maxHistory的单位是根据fileNamePattern中的翻转策略自动推算出来的,例如上面选用了yyyy-MM-dd,则单位为天
|
||||||
|
如果上面选用了yyyy-MM,则单位为月,另外上面的单位默认为yyyy-MM-dd-->
|
||||||
|
<maxHistory>30</maxHistory>
|
||||||
|
<!-- 每个日志文件到10mb的时候开始切分,最多保留30天,但最大到20GB,哪怕没到30天也要删除多余的日志 -->
|
||||||
|
<totalSizeCap>20GB</totalSizeCap>
|
||||||
|
<!-- maxFileSize:这是活动文件的大小,默认值是10MB,测试时可改成5KB看效果 -->
|
||||||
|
<maxFileSize>10MB</maxFileSize>
|
||||||
|
</rollingPolicy>
|
||||||
|
<!--编码器-->
|
||||||
|
<encoder>
|
||||||
|
<!-- pattern节点,用来设置日志的输入格式 ps:日志文件中没有设置颜色,否则颜色部分会有ESC[0:39em等乱码-->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%15.15(%thread)] %-40.40(%logger{40}) : %msg%n</pattern>
|
||||||
|
<!-- 记录日志的编码:此处设置字符集 - -->
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- error 日志-->
|
||||||
|
<!-- RollingFileAppender:滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 -->
|
||||||
|
<!-- 以下的大概意思是:1.先按日期存日志,日期变了,将前一天的日志文件名重命名为XXX%日期%索引,新的日志仍然是project_error.log -->
|
||||||
|
<!-- 2.如果日期没有发生变化,但是当前日志的文件大小超过10MB时,对当前日志进行分割 重命名-->
|
||||||
|
<appender name="error_log" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<!--日志文件路径和名称-->
|
||||||
|
<File>Elliott/dataManager_error.log</File>
|
||||||
|
<!--是否追加到文件末尾,默认为true-->
|
||||||
|
<append>true</append>
|
||||||
|
<!-- ThresholdFilter过滤低于指定阈值的事件。 对于等于或高于阈值的事件,ThresholdFilter将在调用其decision()方法时响应NEUTRAL。 但是,将拒绝级别低于阈值的事件 -->
|
||||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
|
<level>ERROR</level><!-- 低于ERROR级别的日志(debug,info)将被拒绝,等于或者高于ERROR的级别将相应NEUTRAL -->
|
||||||
|
</filter>
|
||||||
|
<!--有两个与RollingFileAppender交互的重要子组件。 第一个RollingFileAppender子组件,即RollingPolicy:负责执行翻转所需的操作。
|
||||||
|
RollingFileAppender的第二个子组件,即TriggeringPolicy:将确定是否以及何时发生翻转。 因此,RollingPolicy负责什么和TriggeringPolicy负责什么时候.
|
||||||
|
作为任何用途,RollingFileAppender必须同时设置RollingPolicy和TriggeringPolicy,但是,如果其RollingPolicy也实现了TriggeringPolicy接口,则只需要显式指定前者。-->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!-- 活动文件的名字会根据fileNamePattern的值,每隔一段时间改变一次 -->
|
||||||
|
<!-- 文件名:logs/project_error.2017-12-05.0.log -->
|
||||||
|
<!-- 注意:SizeAndTimeBasedRollingPolicy中 %i和%d令牌都是强制性的,必须存在,要不会报错 -->
|
||||||
|
<fileNamePattern>Elliott/dataManager_error.%d.%i.log</fileNamePattern>
|
||||||
|
<!-- 每产生一个日志文件,该日志文件的保存期限为30天, ps:maxHistory的单位是根据fileNamePattern中的翻转策略自动推算出来的,例如上面选用了yyyy-MM-dd,则单位为天
|
||||||
|
如果上面选用了yyyy-MM,则单位为月,另外上面的单位默认为yyyy-MM-dd-->
|
||||||
|
<maxHistory>30</maxHistory>
|
||||||
|
<!-- 每个日志文件到10mb的时候开始切分,最多保留30天,但最大到20GB,哪怕没到30天也要删除多余的日志 -->
|
||||||
|
<totalSizeCap>20GB</totalSizeCap>
|
||||||
|
<!-- maxFileSize:这是活动文件的大小,默认值是10MB,测试时可改成5KB看效果 -->
|
||||||
|
<maxFileSize>10MB</maxFileSize>
|
||||||
|
</rollingPolicy>
|
||||||
|
<!--编码器-->
|
||||||
|
<encoder>
|
||||||
|
<!-- pattern节点,用来设置日志的输入格式 ps:日志文件中没有设置颜色,否则颜色部分会有ESC[0:39em等乱码-->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%15.15(%thread)] %-40.40(%logger{40}) : %msg%n</pattern>
|
||||||
|
<!-- 记录日志的编码:此处设置字符集 - -->
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!--给定记录器的每个启用的日志记录请求都将转发到该记录器中的所有appender以及层次结构中较高的appender(不用在意level值)。
|
||||||
|
换句话说,appender是从记录器层次结构中附加地继承的。
|
||||||
|
例如,如果将控制台appender添加到根记录器,则所有启用的日志记录请求将至少在控制台上打印。
|
||||||
|
如果另外将文件追加器添加到记录器(例如L),则对L和L'子项启用的记录请求将打印在文件和控制台上。
|
||||||
|
通过将记录器的additivity标志设置为false,可以覆盖此默认行为,以便不再添加appender累积-->
|
||||||
|
<!-- configuration中最多允许一个root,别的logger如果没有设置级别则从父级别root继承 -->
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
|
||||||
|
<!-- 级别依次为【从高到低】:FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
|
||||||
|
<logger name="com.joju.datamanager" level="INFO">
|
||||||
|
<appender-ref ref="info_log"/>
|
||||||
|
<appender-ref ref="error_log"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<!-- 利用logback输入mybatis的sql日志,
|
||||||
|
注意:如果不加 additivity="false" 则此logger会将输出转发到自身以及祖先的logger中,就会出现日志文件中sql重复打印-->
|
||||||
|
<logger name="com.joju.datamanager.mapper" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="info_log"/>
|
||||||
|
<appender-ref ref="error_log"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<!-- additivity=false代表禁止默认累计的行为,即com.atomikos中的日志只会记录到日志文件中,不会输出层次级别更高的任何appender-->
|
||||||
|
<logger name="com.atomikos" level="INFO" additivity="false">
|
||||||
|
<appender-ref ref="info_log"/>
|
||||||
|
<appender-ref ref="error_log"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
41
src/main/resources/mapper/OrderMapper.xml
Normal file
41
src/main/resources/mapper/OrderMapper.xml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?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">
|
||||||
|
<!--
|
||||||
|
namespace绑定了与之对应的接口,值是该接口的全限定名;这个参数有且只有一个
|
||||||
|
-->
|
||||||
|
<mapper namespace="com.joju.datamanager.mapper.OrderMapper">
|
||||||
|
|
||||||
|
<select id="getOrderByDateAndDist" resultType="com.joju.datamanager.model.order.OrderVo">
|
||||||
|
|
||||||
|
SELECT DISTINCT p.true_name,
|
||||||
|
o.cardno,
|
||||||
|
o.patient_id,
|
||||||
|
o.ksmc,
|
||||||
|
o.yyrq,
|
||||||
|
p.id_card
|
||||||
|
FROM `order` o
|
||||||
|
INNER JOIN patient p ON o.cardno = p.medical_card
|
||||||
|
WHERE o.`status` = '0'
|
||||||
|
AND o.yyrq = #{yyrq}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="insertMissedAppoints" parameterType="java.util.List">
|
||||||
|
|
||||||
|
|
||||||
|
insert into missed_appointment_record ( cardno
|
||||||
|
, patient_id
|
||||||
|
, ksmc
|
||||||
|
, yyrq
|
||||||
|
, true_name
|
||||||
|
, id_card
|
||||||
|
)
|
||||||
|
values
|
||||||
|
<foreach collection="list" item="item" index="index" separator=",">
|
||||||
|
(#{item.cardno},#{item.patientId},#{item.ksmc},#{item.yyrq},#{item.trueName},#{item.idCard})
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.joju.datamanager;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class DatamanagerApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user