项目初始化
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user