feat: 医院后勤管理系统初始提交 - 后端代码 + 完整文档
commit
da8b02b492
@ -0,0 +1,30 @@
|
|||||||
|
# https://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.java]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.xml]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.sql]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
# ============================================================
|
||||||
|
# 医院物业 SaaS 管理后台 — 环境变量配置
|
||||||
|
# 复制本文件为 .env 并修改实际值
|
||||||
|
# ============================================================
|
||||||
|
|
||||||
|
# ---- MariaDB ----
|
||||||
|
DB_PASSWORD=root
|
||||||
|
DB_PORT=3306
|
||||||
|
|
||||||
|
# ---- Redis ----
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
# ---- Application ----
|
||||||
|
APP_PORT=8080
|
||||||
|
|
||||||
|
# ---- JWT ----
|
||||||
|
JWT_SECRET=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
# Compiled class files
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Package files
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# Maven
|
||||||
|
target/
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
.vscode/
|
||||||
|
.settings/
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Env
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
@ -0,0 +1,216 @@
|
|||||||
|
<?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>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>3.2.5</version>
|
||||||
|
<relativePath/>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<groupId>com.hospital</groupId>
|
||||||
|
<artifactId>hospital-mgmt</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<name>hospital-mgmt</name>
|
||||||
|
<description>医院物业SaaS管理后台</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
<mybatis-plus.version>3.5.6</mybatis-plus.version>
|
||||||
|
<jjwt.version>0.12.5</jjwt.version>
|
||||||
|
<shedlock.version>5.12.0</shedlock.version>
|
||||||
|
<hutool.version>5.8.26</hutool.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Spring Boot Starters -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MyBatis-Plus -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||||
|
<version>${mybatis-plus.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MariaDB -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mariadb.jdbc</groupId>
|
||||||
|
<artifactId>mariadb-java-client</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JWT -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt-api</artifactId>
|
||||||
|
<version>${jjwt.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt-impl</artifactId>
|
||||||
|
<version>${jjwt.version}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt-jackson</artifactId>
|
||||||
|
<version>${jjwt.version}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- ShedLock -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.javacrumbs.shedlock</groupId>
|
||||||
|
<artifactId>shedlock-spring</artifactId>
|
||||||
|
<version>${shedlock.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.javacrumbs.shedlock</groupId>
|
||||||
|
<artifactId>shedlock-provider-jdbc-template</artifactId>
|
||||||
|
<version>${shedlock.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Hutool -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>${hutool.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Lombok -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Jackson for JSON -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger / OpenAPI -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
|
<version>2.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Test -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- H2 for testing -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<annotationProcessorPaths>
|
||||||
|
<path>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
|
</path>
|
||||||
|
</annotationProcessorPaths>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jacoco</groupId>
|
||||||
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
|
<version>0.8.12</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>prepare-agent</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>report</id>
|
||||||
|
<phase>test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>report</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<rules>
|
||||||
|
<rule>
|
||||||
|
<element>BUNDLE</element>
|
||||||
|
<limits>
|
||||||
|
<limit>
|
||||||
|
<counter>LINE</counter>
|
||||||
|
<value>COVEREDRATIO</value>
|
||||||
|
<minimum>1.00</minimum>
|
||||||
|
</limit>
|
||||||
|
<limit>
|
||||||
|
<counter>BRANCH</counter>
|
||||||
|
<value>COVEREDRATIO</value>
|
||||||
|
<minimum>1.00</minimum>
|
||||||
|
</limit>
|
||||||
|
</limits>
|
||||||
|
</rule>
|
||||||
|
</rules>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.hospital.mgmt;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableScheduling
|
||||||
|
public class HospitalMgmtApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(HospitalMgmtApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.hospital.mgmt.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface AuditLog {
|
||||||
|
String moduleCode();
|
||||||
|
String moduleName();
|
||||||
|
String operationType();
|
||||||
|
String operationContent() default "";
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package com.hospital.mgmt.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface ReadOnly {
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.hospital.mgmt.common.base;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public abstract class BaseEntity implements Serializable {
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long tenantId;
|
||||||
|
private Long createdBy;
|
||||||
|
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
private Long updatedBy;
|
||||||
|
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
@TableLogic
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
private Integer isSupplement;
|
||||||
|
private String supplementReason;
|
||||||
|
private String supplementRemark;
|
||||||
|
private String supplementAuditStatus;
|
||||||
|
private Long supplementAuditorId;
|
||||||
|
private LocalDateTime supplementAuditTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package com.hospital.mgmt.common.context;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TenantContext {
|
||||||
|
private Long userId;
|
||||||
|
private Long tenantId;
|
||||||
|
private String userType;
|
||||||
|
private Long hospitalId;
|
||||||
|
private Long propertyCompanyId;
|
||||||
|
private Long staffId;
|
||||||
|
|
||||||
|
private static final ThreadLocal<TenantContext> CONTEXT = new ThreadLocal<>();
|
||||||
|
|
||||||
|
public static void set(TenantContext context) {
|
||||||
|
CONTEXT.set(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TenantContext get() {
|
||||||
|
return CONTEXT.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clear() {
|
||||||
|
CONTEXT.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Long getTenantId() {
|
||||||
|
TenantContext ctx = CONTEXT.get();
|
||||||
|
return ctx != null ? ctx.getTenantId() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Long getUserId() {
|
||||||
|
TenantContext ctx = CONTEXT.get();
|
||||||
|
return ctx != null ? ctx.getUserId() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUserType() {
|
||||||
|
TenantContext ctx = CONTEXT.get();
|
||||||
|
return ctx != null ? ctx.getUserType() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSuperAdmin() {
|
||||||
|
return "SUPER_ADMIN".equals(getUserType());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.hospital.mgmt.common.exception;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class BusinessException extends RuntimeException {
|
||||||
|
private final int code;
|
||||||
|
|
||||||
|
public BusinessException(int code, String message) {
|
||||||
|
super(message);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BusinessException(ErrorCode errorCode) {
|
||||||
|
super(errorCode.getMessage());
|
||||||
|
this.code = errorCode.getCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BusinessException(ErrorCode errorCode, String message) {
|
||||||
|
super(message);
|
||||||
|
this.code = errorCode.getCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.hospital.mgmt.common.exception;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum ErrorCode {
|
||||||
|
SUCCESS(0, "成功"),
|
||||||
|
MISSING_PARAM(40001, "缺少必填参数"),
|
||||||
|
INVALID_PARAM(40002, "参数格式错误"),
|
||||||
|
UNAUTHORIZED(40100, "未认证"),
|
||||||
|
INVALID_TOKEN(40101, "Token无效"),
|
||||||
|
NO_PERMISSION(40300, "无功能权限"),
|
||||||
|
NO_DATA_PERMISSION(40301, "无数据权限"),
|
||||||
|
NOT_FOUND(40400, "资源不存在"),
|
||||||
|
STATUS_CONFLICT(40900, "状态冲突"),
|
||||||
|
DATA_EXISTS(40901, "数据已存在"),
|
||||||
|
INTERNAL_ERROR(50000, "服务器内部错误");
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String message;
|
||||||
|
|
||||||
|
ErrorCode(int code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
package com.hospital.mgmt.common.exception;
|
||||||
|
|
||||||
|
import com.hospital.mgmt.common.result.ApiResult;
|
||||||
|
import jakarta.validation.ConstraintViolationException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
|
import org.springframework.validation.BindException;
|
||||||
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestControllerAdvice
|
||||||
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
|
@ExceptionHandler(BusinessException.class)
|
||||||
|
@ResponseStatus(HttpStatus.OK)
|
||||||
|
public ApiResult<Void> handleBusinessException(BusinessException e) {
|
||||||
|
log.warn("Business exception: code={}, message={}", e.getCode(), e.getMessage());
|
||||||
|
return ApiResult.error(e.getCode(), e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||||
|
@ResponseStatus(HttpStatus.OK)
|
||||||
|
public ApiResult<Void> handleValidationException(MethodArgumentNotValidException e) {
|
||||||
|
String message = e.getBindingResult().getFieldErrors().stream()
|
||||||
|
.map(f -> f.getField() + ": " + f.getDefaultMessage())
|
||||||
|
.findFirst()
|
||||||
|
.orElse("参数校验失败");
|
||||||
|
return ApiResult.error(ErrorCode.INVALID_PARAM.getCode(), message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(BindException.class)
|
||||||
|
@ResponseStatus(HttpStatus.OK)
|
||||||
|
public ApiResult<Void> handleBindException(BindException e) {
|
||||||
|
String message = e.getFieldErrors().stream()
|
||||||
|
.map(f -> f.getField() + ": " + f.getDefaultMessage())
|
||||||
|
.findFirst()
|
||||||
|
.orElse("参数绑定失败");
|
||||||
|
return ApiResult.error(ErrorCode.INVALID_PARAM.getCode(), message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(ConstraintViolationException.class)
|
||||||
|
@ResponseStatus(HttpStatus.OK)
|
||||||
|
public ApiResult<Void> handleConstraintViolation(ConstraintViolationException e) {
|
||||||
|
return ApiResult.error(ErrorCode.INVALID_PARAM.getCode(), e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(AccessDeniedException.class)
|
||||||
|
@ResponseStatus(HttpStatus.FORBIDDEN)
|
||||||
|
public ApiResult<Void> handleAccessDenied(AccessDeniedException e) {
|
||||||
|
return ApiResult.error(ErrorCode.NO_PERMISSION.getCode(), ErrorCode.NO_PERMISSION.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(BadCredentialsException.class)
|
||||||
|
@ResponseStatus(HttpStatus.UNAUTHORIZED)
|
||||||
|
public ApiResult<Void> handleBadCredentials(BadCredentialsException e) {
|
||||||
|
return ApiResult.error(ErrorCode.UNAUTHORIZED.getCode(), "用户名或密码错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(Exception.class)
|
||||||
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
|
public ApiResult<Void> handleException(Exception e) {
|
||||||
|
log.error("Unexpected error", e);
|
||||||
|
return ApiResult.error(ErrorCode.INTERNAL_ERROR.getCode(), ErrorCode.INTERNAL_ERROR.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.hospital.mgmt.common.result;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public class ApiResult<T> implements Serializable {
|
||||||
|
private int code;
|
||||||
|
private String message;
|
||||||
|
private T data;
|
||||||
|
private Long timestamp;
|
||||||
|
|
||||||
|
private ApiResult() {}
|
||||||
|
|
||||||
|
public static <T> ApiResult<T> success(T data) {
|
||||||
|
ApiResult<T> result = new ApiResult<>();
|
||||||
|
result.setCode(0);
|
||||||
|
result.setMessage("success");
|
||||||
|
result.setData(data);
|
||||||
|
result.setTimestamp(System.currentTimeMillis());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ApiResult<T> success() {
|
||||||
|
return success(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ApiResult<T> error(int code, String message) {
|
||||||
|
ApiResult<T> result = new ApiResult<>();
|
||||||
|
result.setCode(code);
|
||||||
|
result.setMessage(message);
|
||||||
|
result.setTimestamp(System.currentTimeMillis());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.hospital.mgmt.common.result;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PageResult<T> {
|
||||||
|
private List<T> list;
|
||||||
|
private Pagination pagination;
|
||||||
|
|
||||||
|
public PageResult(List<T> list, int page, int pageSize, long total) {
|
||||||
|
this.list = list;
|
||||||
|
this.pagination = new Pagination(page, pageSize, total);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.hospital.mgmt.common.result;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Pagination implements Serializable {
|
||||||
|
private int page;
|
||||||
|
private int pageSize;
|
||||||
|
private long total;
|
||||||
|
private int totalPages;
|
||||||
|
|
||||||
|
public Pagination(int page, int pageSize, long total) {
|
||||||
|
this.page = page;
|
||||||
|
this.pageSize = pageSize;
|
||||||
|
this.total = total;
|
||||||
|
this.totalPages = (int) Math.ceil((double) total / pageSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.hospital.mgmt.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
||||||
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableAsync
|
||||||
|
public class AsyncConfig implements AsyncConfigurer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Executor getAsyncExecutor() {
|
||||||
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
|
executor.setCorePoolSize(4);
|
||||||
|
executor.setMaxPoolSize(8);
|
||||||
|
executor.setQueueCapacity(1000);
|
||||||
|
executor.setKeepAliveSeconds(60);
|
||||||
|
executor.setThreadNamePrefix("async-");
|
||||||
|
executor.setRejectedExecutionHandler(new java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy());
|
||||||
|
executor.initialize();
|
||||||
|
return executor;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package com.hospital.mgmt.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
|
||||||
|
import com.hospital.mgmt.common.context.TenantContext;
|
||||||
|
import com.hospital.mgmt.security.TenantHandler;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MyBatisPlusConfig implements MetaObjectHandler {
|
||||||
|
|
||||||
|
private final TenantHandler tenantHandler;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
interceptor.addInnerInterceptor(new TenantLineInnerInterceptor(tenantHandler));
|
||||||
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MARIADB));
|
||||||
|
return interceptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertFill(MetaObject metaObject) {
|
||||||
|
this.strictInsertFill(metaObject, "createdAt", LocalDateTime.class, LocalDateTime.now());
|
||||||
|
this.strictInsertFill(metaObject, "updatedAt", LocalDateTime.class, LocalDateTime.now());
|
||||||
|
this.strictInsertFill(metaObject, "tenantId", Long.class, TenantContext.getTenantId());
|
||||||
|
this.strictInsertFill(metaObject, "createdBy", Long.class, TenantContext.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateFill(MetaObject metaObject) {
|
||||||
|
this.strictUpdateFill(metaObject, "updatedAt", LocalDateTime.class, LocalDateTime.now());
|
||||||
|
this.strictUpdateFill(metaObject, "updatedBy", Long.class, TenantContext.getUserId());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.hospital.mgmt.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RedisConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RedisMessageListenerContainer redisMessageListenerContainer(RedisConnectionFactory connectionFactory) {
|
||||||
|
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
||||||
|
container.setConnectionFactory(connectionFactory);
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory connectionFactory) {
|
||||||
|
return new StringRedisTemplate(connectionFactory);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.hospital.mgmt.config;
|
||||||
|
|
||||||
|
import net.javacrumbs.shedlock.core.LockProvider;
|
||||||
|
import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider;
|
||||||
|
import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableSchedulerLock(defaultLockAtLeastFor = "PT1M", defaultLockAtMostFor = "PT30M")
|
||||||
|
public class ShedLockConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public LockProvider lockProvider(DataSource dataSource) {
|
||||||
|
return new JdbcTemplateLockProvider(
|
||||||
|
JdbcTemplateLockProvider.Configuration.builder()
|
||||||
|
.withJdbcTemplate(new JdbcTemplate(dataSource))
|
||||||
|
.withTableName("shedlock")
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.hospital.mgmt.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebMvcConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
registry.addMapping("/**")
|
||||||
|
.allowedOriginPatterns("http://localhost:*")
|
||||||
|
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH")
|
||||||
|
.allowedHeaders("*")
|
||||||
|
.allowCredentials(true)
|
||||||
|
.maxAge(3600);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.hospital.mgmt.modules.attendance.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("attendance_check_point")
|
||||||
|
public class AttendanceCheckPoint extends BaseEntity {
|
||||||
|
private String name;
|
||||||
|
private Long beaconId;
|
||||||
|
private Long hospitalId;
|
||||||
|
private Long campusId;
|
||||||
|
private String location;
|
||||||
|
private String teamIds;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.hospital.mgmt.modules.attendance.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("attendance_record")
|
||||||
|
public class AttendanceRecord extends BaseEntity {
|
||||||
|
private Long staffId;
|
||||||
|
private String staffName;
|
||||||
|
private LocalDate checkDate;
|
||||||
|
private String checkType;
|
||||||
|
private String checkMethod;
|
||||||
|
private LocalDateTime checkTime;
|
||||||
|
private Long checkPointId;
|
||||||
|
private Long beaconId;
|
||||||
|
private String beaconUuid;
|
||||||
|
private BigDecimal distance;
|
||||||
|
private String result;
|
||||||
|
private String abnormalType;
|
||||||
|
private String appealStatus;
|
||||||
|
private String appealReason;
|
||||||
|
private Long appealAuditorId;
|
||||||
|
private String appealAuditRemark;
|
||||||
|
private LocalDateTime appealAuditAt;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.hospital.mgmt.modules.attendance.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("attendance_rule")
|
||||||
|
public class AttendanceRule extends BaseEntity {
|
||||||
|
private String name;
|
||||||
|
private Long teamId;
|
||||||
|
private LocalTime workStartTime;
|
||||||
|
private LocalTime workEndTime;
|
||||||
|
private Integer startBufferMinutes;
|
||||||
|
private Integer endBufferMinutes;
|
||||||
|
private Integer lateThresholdMinutes;
|
||||||
|
private Integer earlyLeaveThresholdMinutes;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.attendance.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.attendance.entity.AttendanceRecord;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AttendanceRecordMapper extends BaseMapper<AttendanceRecord> {}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.hospital.mgmt.modules.audit.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("audit_log")
|
||||||
|
public class AuditLog implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
private Long tenantId;
|
||||||
|
private Long operatorId;
|
||||||
|
private String operatorName;
|
||||||
|
private String operatorIp;
|
||||||
|
private String moduleCode;
|
||||||
|
private String moduleName;
|
||||||
|
private String pageCode;
|
||||||
|
private String pageName;
|
||||||
|
private String actionCode;
|
||||||
|
private String actionName;
|
||||||
|
private String operationType;
|
||||||
|
private String operationContent;
|
||||||
|
private Long businessId;
|
||||||
|
private String businessNo;
|
||||||
|
private String beforeData;
|
||||||
|
private String afterData;
|
||||||
|
private String requestParams;
|
||||||
|
private String responseStatus;
|
||||||
|
private String errorMessage;
|
||||||
|
private LocalDateTime operatedAt;
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.audit.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.audit.entity.AuditLog;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AuditLogMapper extends BaseMapper<AuditLog> {}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
package com.hospital.mgmt.modules.auth.controller;
|
||||||
|
|
||||||
|
import com.hospital.mgmt.common.result.ApiResult;
|
||||||
|
import com.hospital.mgmt.modules.auth.dto.LoginRequest;
|
||||||
|
import com.hospital.mgmt.modules.auth.dto.LoginResponse;
|
||||||
|
import com.hospital.mgmt.modules.auth.dto.RefreshTokenRequest;
|
||||||
|
import com.hospital.mgmt.modules.auth.service.AuthService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Tag(name = "认证管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/auth")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AuthController {
|
||||||
|
|
||||||
|
private final AuthService authService;
|
||||||
|
|
||||||
|
@Operation(summary = "Web端账号登录")
|
||||||
|
@PostMapping("/login")
|
||||||
|
public ApiResult<LoginResponse> login(@Valid @RequestBody LoginRequest request) {
|
||||||
|
return ApiResult.success(authService.login(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "刷新Token")
|
||||||
|
@PostMapping("/refresh")
|
||||||
|
public ApiResult<LoginResponse> refresh(@Valid @RequestBody RefreshTokenRequest request) {
|
||||||
|
return ApiResult.success(authService.refreshToken(request.getRefreshToken()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取当前用户权限集")
|
||||||
|
@GetMapping("/permissions")
|
||||||
|
public ApiResult<Object> getPermissions() {
|
||||||
|
return ApiResult.success(authService.getCurrentUserPermissions());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.hospital.mgmt.modules.auth.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class LoginRequest {
|
||||||
|
@NotBlank(message = "用户名不能为空")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@NotBlank(message = "密码不能为空")
|
||||||
|
private String password;
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.hospital.mgmt.modules.auth.dto;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class LoginResponse {
|
||||||
|
private String accessToken;
|
||||||
|
private String refreshToken;
|
||||||
|
private long expiresIn;
|
||||||
|
private UserInfo user;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public static class UserInfo {
|
||||||
|
private Long id;
|
||||||
|
private String realName;
|
||||||
|
private String phone;
|
||||||
|
private String userType;
|
||||||
|
private String avatarUrl;
|
||||||
|
private Long tenantId;
|
||||||
|
private Long hospitalId;
|
||||||
|
private Long propertyCompanyId;
|
||||||
|
private List<String> permissions;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.hospital.mgmt.modules.auth.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RefreshTokenRequest {
|
||||||
|
@NotBlank(message = "refreshToken不能为空")
|
||||||
|
private String refreshToken;
|
||||||
|
}
|
||||||
@ -0,0 +1,97 @@
|
|||||||
|
package com.hospital.mgmt.modules.auth.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.hospital.mgmt.common.exception.BusinessException;
|
||||||
|
import com.hospital.mgmt.common.exception.ErrorCode;
|
||||||
|
import com.hospital.mgmt.modules.auth.dto.LoginRequest;
|
||||||
|
import com.hospital.mgmt.modules.auth.dto.LoginResponse;
|
||||||
|
import com.hospital.mgmt.modules.permission.entity.User;
|
||||||
|
import com.hospital.mgmt.modules.permission.mapper.UserMapper;
|
||||||
|
import com.hospital.mgmt.security.JwtTokenProvider;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AuthService {
|
||||||
|
|
||||||
|
private final UserMapper userMapper;
|
||||||
|
private final PasswordEncoder passwordEncoder;
|
||||||
|
private final JwtTokenProvider jwtTokenProvider;
|
||||||
|
|
||||||
|
public LoginResponse login(LoginRequest request) {
|
||||||
|
User user = userMapper.selectOne(
|
||||||
|
new LambdaQueryWrapper<User>().eq(User::getUsername, request.getUsername())
|
||||||
|
);
|
||||||
|
if (user == null) {
|
||||||
|
throw new BusinessException(ErrorCode.UNAUTHORIZED, "用户名或密码错误");
|
||||||
|
}
|
||||||
|
if (!passwordEncoder.matches(request.getPassword(), user.getPasswordHash())) {
|
||||||
|
throw new BusinessException(ErrorCode.UNAUTHORIZED, "用户名或密码错误");
|
||||||
|
}
|
||||||
|
if ("DISABLED".equals(user.getStatus())) {
|
||||||
|
throw new BusinessException(ErrorCode.STATUS_CONFLICT, "账号已被禁用");
|
||||||
|
}
|
||||||
|
|
||||||
|
String accessToken = jwtTokenProvider.createAccessToken(
|
||||||
|
user.getId(), user.getTenantId(), user.getUserType(),
|
||||||
|
user.getHospitalId(), user.getPropertyCompanyId(), user.getStaffId()
|
||||||
|
);
|
||||||
|
String refreshToken = jwtTokenProvider.createRefreshToken(user.getId());
|
||||||
|
|
||||||
|
return LoginResponse.builder()
|
||||||
|
.accessToken(accessToken)
|
||||||
|
.refreshToken(refreshToken)
|
||||||
|
.expiresIn(7200)
|
||||||
|
.user(LoginResponse.UserInfo.builder()
|
||||||
|
.id(user.getId())
|
||||||
|
.realName(user.getRealName())
|
||||||
|
.phone(user.getPhone())
|
||||||
|
.userType(user.getUserType())
|
||||||
|
.avatarUrl(user.getAvatarUrl())
|
||||||
|
.tenantId(user.getTenantId())
|
||||||
|
.hospitalId(user.getHospitalId())
|
||||||
|
.propertyCompanyId(user.getPropertyCompanyId())
|
||||||
|
.permissions(new ArrayList<>())
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoginResponse refreshToken(String refreshToken) {
|
||||||
|
if (!jwtTokenProvider.validateToken(refreshToken)) {
|
||||||
|
throw new BusinessException(ErrorCode.INVALID_TOKEN, "refreshToken无效或已过期");
|
||||||
|
}
|
||||||
|
Long userId = jwtTokenProvider.getUserIdFromToken(refreshToken);
|
||||||
|
User user = userMapper.selectById(userId);
|
||||||
|
if (user == null) {
|
||||||
|
throw new BusinessException(ErrorCode.NOT_FOUND, "用户不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
String newAccessToken = jwtTokenProvider.createAccessToken(
|
||||||
|
user.getId(), user.getTenantId(), user.getUserType(),
|
||||||
|
user.getHospitalId(), user.getPropertyCompanyId(), user.getStaffId()
|
||||||
|
);
|
||||||
|
String newRefreshToken = jwtTokenProvider.createRefreshToken(user.getId());
|
||||||
|
|
||||||
|
return LoginResponse.builder()
|
||||||
|
.accessToken(newAccessToken)
|
||||||
|
.refreshToken(newRefreshToken)
|
||||||
|
.expiresIn(7200)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getCurrentUserPermissions() {
|
||||||
|
// TODO: 从缓存或数据库加载完整权限集
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
result.put("permissions", new ArrayList<>());
|
||||||
|
result.put("menus", new ArrayList<>());
|
||||||
|
result.put("dataScope", "SELF");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.hospital.mgmt.modules.bidding.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("bidding_plan")
|
||||||
|
public class BiddingPlan extends BaseEntity {
|
||||||
|
private String planNo;
|
||||||
|
private String title;
|
||||||
|
private String biddingType;
|
||||||
|
private Long hospitalId;
|
||||||
|
private BigDecimal budgetAmount;
|
||||||
|
private LocalDate publishDate;
|
||||||
|
private LocalDate deadlineDate;
|
||||||
|
private LocalDate openBidDate;
|
||||||
|
private String status;
|
||||||
|
private String description;
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.hospital.mgmt.modules.bidding.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("bidding_section")
|
||||||
|
public class BiddingSection extends BaseEntity {
|
||||||
|
private Long planId;
|
||||||
|
private String sectionNo;
|
||||||
|
private String name;
|
||||||
|
private String scope;
|
||||||
|
private String requirements;
|
||||||
|
private BigDecimal budgetAmount;
|
||||||
|
private Long winnerSupplierId;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.hospital.mgmt.modules.bidding.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("bidding_supplier")
|
||||||
|
public class BiddingSupplier extends BaseEntity {
|
||||||
|
private String name;
|
||||||
|
private String unifiedSocialCode;
|
||||||
|
private String contactPerson;
|
||||||
|
private String contactPhone;
|
||||||
|
private String address;
|
||||||
|
private String qualificationStatus;
|
||||||
|
private Integer blacklist;
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.hospital.mgmt.modules.cleaning.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("cleaning_attachment")
|
||||||
|
public class CleaningAttachment extends BaseEntity {
|
||||||
|
private Long taskId;
|
||||||
|
private String fileType;
|
||||||
|
private String fileUrl;
|
||||||
|
private String fileName;
|
||||||
|
private String uploadStage;
|
||||||
|
private LocalDateTime watermarkTime;
|
||||||
|
private String watermarkLocation;
|
||||||
|
private Integer bluetoothConnected;
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.hospital.mgmt.modules.cleaning.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("cleaning_schedule")
|
||||||
|
public class CleaningSchedule extends BaseEntity {
|
||||||
|
private Long areaId;
|
||||||
|
private Long staffId;
|
||||||
|
private LocalDate scheduleDate;
|
||||||
|
private String shiftType;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.hospital.mgmt.modules.cleaning.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("cleaning_task")
|
||||||
|
public class CleaningTask extends BaseEntity {
|
||||||
|
private String taskNo;
|
||||||
|
private Long areaId;
|
||||||
|
private String areaName;
|
||||||
|
private String areaPath;
|
||||||
|
private Long assignedStaffId;
|
||||||
|
private String assignedStaffName;
|
||||||
|
private LocalDate taskDate;
|
||||||
|
private String taskType;
|
||||||
|
private String status;
|
||||||
|
private LocalDateTime checkInTime;
|
||||||
|
private Long checkInBeaconId;
|
||||||
|
private BigDecimal checkInDistance;
|
||||||
|
private String checkType;
|
||||||
|
private LocalDateTime completedAt;
|
||||||
|
private LocalDateTime timeoutAt;
|
||||||
|
private Integer isSpotChecked;
|
||||||
|
private String spotCheckResult;
|
||||||
|
private Long spotCheckerId;
|
||||||
|
private LocalDateTime spotCheckAt;
|
||||||
|
private String spotCheckRemark;
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.cleaning.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.cleaning.entity.CleaningTask;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CleaningTaskMapper extends BaseMapper<CleaningTask> {}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.hospital.mgmt.modules.contract.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("contract")
|
||||||
|
public class Contract extends BaseEntity {
|
||||||
|
private String contractNo;
|
||||||
|
private String title;
|
||||||
|
private String contractType;
|
||||||
|
private Long propertyCompanyId;
|
||||||
|
private Long hospitalId;
|
||||||
|
private Long campusId;
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
private LocalDate startDate;
|
||||||
|
private LocalDate endDate;
|
||||||
|
private String status;
|
||||||
|
private String paymentStatus;
|
||||||
|
private BigDecimal paidAmount;
|
||||||
|
private LocalDate signDate;
|
||||||
|
private String attachmentUrls;
|
||||||
|
private String remark;
|
||||||
|
private Integer warnDaysBefore;
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.hospital.mgmt.modules.contract.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("contract_change")
|
||||||
|
public class ContractChange extends BaseEntity {
|
||||||
|
private Long contractId;
|
||||||
|
private String changeType;
|
||||||
|
private String changeContent;
|
||||||
|
private String beforeData;
|
||||||
|
private String afterData;
|
||||||
|
private Long applicantId;
|
||||||
|
private String auditStatus;
|
||||||
|
private Long auditorId;
|
||||||
|
private String auditRemark;
|
||||||
|
private LocalDateTime auditAt;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.hospital.mgmt.modules.contract.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("contract_payment")
|
||||||
|
public class ContractPayment extends BaseEntity {
|
||||||
|
private Long contractId;
|
||||||
|
private String nodeName;
|
||||||
|
private BigDecimal amount;
|
||||||
|
private LocalDate planDate;
|
||||||
|
private LocalDate actualDate;
|
||||||
|
private String status;
|
||||||
|
private Long confirmerId;
|
||||||
|
private String confirmRemark;
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.contract.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.contract.entity.Contract;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ContractMapper extends BaseMapper<Contract> {}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.hospital.mgmt.modules.device.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("device_beacon")
|
||||||
|
public class DeviceBeacon extends BaseEntity {
|
||||||
|
private String uuid;
|
||||||
|
private Integer major;
|
||||||
|
private Integer minor;
|
||||||
|
private String name;
|
||||||
|
private String macAddress;
|
||||||
|
private Long hospitalId;
|
||||||
|
private Long campusId;
|
||||||
|
private String bindType;
|
||||||
|
private Long bindId;
|
||||||
|
private String location;
|
||||||
|
private BigDecimal latitude;
|
||||||
|
private BigDecimal longitude;
|
||||||
|
private Integer rssiThreshold;
|
||||||
|
private BigDecimal distanceThreshold;
|
||||||
|
private Integer batteryLevel;
|
||||||
|
private Integer batteryWarnThreshold;
|
||||||
|
private LocalDateTime lastHeartbeatAt;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.device.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.device.entity.DeviceBeacon;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DeviceBeaconMapper extends BaseMapper<DeviceBeacon> {}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.hospital.mgmt.modules.evaluation.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("evaluation")
|
||||||
|
public class Evaluation extends BaseEntity {
|
||||||
|
private String moduleType;
|
||||||
|
private Long businessId;
|
||||||
|
private String businessNo;
|
||||||
|
private Integer score;
|
||||||
|
private String content;
|
||||||
|
private Long evaluatorId;
|
||||||
|
private String evaluatorName;
|
||||||
|
private String evaluatorType;
|
||||||
|
private Long targetStaffId;
|
||||||
|
private Long targetTeamId;
|
||||||
|
private String replyContent;
|
||||||
|
private Long replierId;
|
||||||
|
private LocalDateTime repliedAt;
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.hospital.mgmt.modules.evaluation.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("evaluation_config")
|
||||||
|
public class EvaluationConfig extends BaseEntity {
|
||||||
|
private String moduleType;
|
||||||
|
private Integer autoTrigger;
|
||||||
|
private Integer triggerDelayMinutes;
|
||||||
|
private Integer lowScoreThreshold;
|
||||||
|
private String lowScoreNotifyType;
|
||||||
|
private Integer mustReplyHours;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.hospital.mgmt.modules.inspection.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("inspection_abnormal")
|
||||||
|
public class InspectionAbnormal extends BaseEntity {
|
||||||
|
private Long taskId;
|
||||||
|
private Long areaId;
|
||||||
|
private String itemName;
|
||||||
|
private String severity;
|
||||||
|
private String description;
|
||||||
|
private Long repairOrderId;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.hospital.mgmt.modules.inspection.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("inspection_area")
|
||||||
|
public class InspectionArea extends BaseEntity {
|
||||||
|
private String name;
|
||||||
|
private String code;
|
||||||
|
private Long hospitalId;
|
||||||
|
private Long campusId;
|
||||||
|
private Long parentId;
|
||||||
|
private Long beaconId;
|
||||||
|
private Integer sortOrder;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.hospital.mgmt.modules.inspection.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("inspection_attachment")
|
||||||
|
public class InspectionAttachment extends BaseEntity {
|
||||||
|
private Long taskId;
|
||||||
|
private Long abnormalId;
|
||||||
|
private String fileType;
|
||||||
|
private String fileUrl;
|
||||||
|
private String fileName;
|
||||||
|
private String uploadStage;
|
||||||
|
private LocalDateTime watermarkTime;
|
||||||
|
private String watermarkLocation;
|
||||||
|
private Integer bluetoothConnected;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.hospital.mgmt.modules.inspection.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("inspection_plan")
|
||||||
|
public class InspectionPlan extends BaseEntity {
|
||||||
|
private String name;
|
||||||
|
private Long areaId;
|
||||||
|
private String frequency;
|
||||||
|
private String frequencyConfig;
|
||||||
|
private Long teamId;
|
||||||
|
private String staffIds;
|
||||||
|
private String assignRule;
|
||||||
|
private String checkItems;
|
||||||
|
private LocalDate startDate;
|
||||||
|
private LocalDate endDate;
|
||||||
|
private Integer remindBefore;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.hospital.mgmt.modules.inspection.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("inspection_task")
|
||||||
|
public class InspectionTask extends BaseEntity {
|
||||||
|
private Long planId;
|
||||||
|
private String taskNo;
|
||||||
|
private Long areaId;
|
||||||
|
private String areaName;
|
||||||
|
private Long assignedStaffId;
|
||||||
|
private String assignedStaffName;
|
||||||
|
private LocalDate planDate;
|
||||||
|
private LocalTime planTimeStart;
|
||||||
|
private LocalTime planTimeEnd;
|
||||||
|
private String status;
|
||||||
|
private LocalDateTime checkInTime;
|
||||||
|
private Long checkInBeaconId;
|
||||||
|
private BigDecimal checkInLatitude;
|
||||||
|
private BigDecimal checkInLongitude;
|
||||||
|
private BigDecimal checkInDistance;
|
||||||
|
private String checkType;
|
||||||
|
private String checkResult;
|
||||||
|
private Integer abnormalCount;
|
||||||
|
private LocalDateTime completedAt;
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.inspection.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.inspection.entity.InspectionTask;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface InspectionTaskMapper extends BaseMapper<InspectionTask> {}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("org_cleaning_area")
|
||||||
|
public class CleaningArea extends BaseEntity {
|
||||||
|
private Long parentId;
|
||||||
|
private Integer level;
|
||||||
|
private String name;
|
||||||
|
private String code;
|
||||||
|
private Long hospitalId;
|
||||||
|
private Long campusId;
|
||||||
|
private Long responsibleStaffId;
|
||||||
|
private Long beaconId;
|
||||||
|
private Integer sortOrder;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("sys_hospital")
|
||||||
|
public class Hospital extends BaseEntity {
|
||||||
|
private String name;
|
||||||
|
private String address;
|
||||||
|
private String contactPerson;
|
||||||
|
private String contactPhone;
|
||||||
|
private String logoUrl;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sys_hospital_campus")
|
||||||
|
public class HospitalCampus implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
private Long hospitalId;
|
||||||
|
private String name;
|
||||||
|
private String address;
|
||||||
|
private String contactPerson;
|
||||||
|
private String contactPhone;
|
||||||
|
private Integer sortOrder;
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sys_property_company")
|
||||||
|
public class PropertyCompany implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
private String address;
|
||||||
|
private String contactPerson;
|
||||||
|
private String contactPhone;
|
||||||
|
private String licenseNo;
|
||||||
|
private String logoUrl;
|
||||||
|
private String status;
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sys_property_hospital")
|
||||||
|
public class PropertyHospital implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
private Long propertyCompanyId;
|
||||||
|
private Long hospitalId;
|
||||||
|
private String campusIds;
|
||||||
|
private LocalDate startDate;
|
||||||
|
private LocalDate endDate;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("org_staff")
|
||||||
|
public class Staff extends BaseEntity {
|
||||||
|
private String name;
|
||||||
|
private String phone;
|
||||||
|
private String gender;
|
||||||
|
private String avatarUrl;
|
||||||
|
private String employeeNo;
|
||||||
|
private String skills;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("org_staff_team")
|
||||||
|
public class StaffTeam implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
private Long tenantId;
|
||||||
|
private Long staffId;
|
||||||
|
private Long teamId;
|
||||||
|
private Integer isPrimary;
|
||||||
|
private LocalDate joinDate;
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("org_team")
|
||||||
|
public class Team extends BaseEntity {
|
||||||
|
private String name;
|
||||||
|
private String teamType;
|
||||||
|
private Long leaderId;
|
||||||
|
private Long hospitalId;
|
||||||
|
private Long campusId;
|
||||||
|
private String description;
|
||||||
|
private String skills;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.org.entity.HospitalCampus;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface HospitalCampusMapper extends BaseMapper<HospitalCampus> {}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.org.entity.Hospital;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface HospitalMapper extends BaseMapper<Hospital> {}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.org.entity.PropertyCompany;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface PropertyCompanyMapper extends BaseMapper<PropertyCompany> {}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.org.entity.Staff;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface StaffMapper extends BaseMapper<Staff> {}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.org.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.org.entity.Team;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TeamMapper extends BaseMapper<Team> {}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.hospital.mgmt.modules.permission.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sys_permission_config")
|
||||||
|
public class PermissionConfig implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
private Long parentId;
|
||||||
|
private Integer level;
|
||||||
|
private String menuCode;
|
||||||
|
private String menuName;
|
||||||
|
private String pageCode;
|
||||||
|
private String pageName;
|
||||||
|
private String actionCode;
|
||||||
|
private String actionName;
|
||||||
|
private String operationCode;
|
||||||
|
private String operationName;
|
||||||
|
private Integer sortOrder;
|
||||||
|
private String moduleCode;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.hospital.mgmt.modules.permission.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sys_role")
|
||||||
|
public class Role implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
private Long tenantId;
|
||||||
|
private String name;
|
||||||
|
private String code;
|
||||||
|
private String description;
|
||||||
|
private String scope;
|
||||||
|
private Integer isPreset;
|
||||||
|
private String dataScope;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.hospital.mgmt.modules.permission.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sys_role_permission")
|
||||||
|
public class RolePermission implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
private Long roleId;
|
||||||
|
private Long permissionId;
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.hospital.mgmt.modules.permission.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sys_user")
|
||||||
|
public class User implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
private Long tenantId;
|
||||||
|
private String username;
|
||||||
|
private String passwordHash;
|
||||||
|
private String userType;
|
||||||
|
private String realName;
|
||||||
|
private String phone;
|
||||||
|
private String email;
|
||||||
|
private String avatarUrl;
|
||||||
|
private Long hospitalId;
|
||||||
|
private Long propertyCompanyId;
|
||||||
|
private Long staffId;
|
||||||
|
private String wechatOpenid;
|
||||||
|
private String wechatUnionid;
|
||||||
|
private String status;
|
||||||
|
private LocalDateTime lastLoginAt;
|
||||||
|
private String lastLoginIp;
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.hospital.mgmt.modules.permission.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sys_user_permission_override")
|
||||||
|
public class UserPermissionOverride implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
private Long userId;
|
||||||
|
private Long permissionId;
|
||||||
|
private String grantType;
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.hospital.mgmt.modules.permission.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sys_user_role")
|
||||||
|
public class UserRole implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
private Long userId;
|
||||||
|
private Long roleId;
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.permission.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.permission.entity.PermissionConfig;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface PermissionConfigMapper extends BaseMapper<PermissionConfig> {}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.permission.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.permission.entity.Role;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface RoleMapper extends BaseMapper<Role> {}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.permission.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.permission.entity.User;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface UserMapper extends BaseMapper<User> {}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.hospital.mgmt.modules.plugin;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class ConfigDefinition {
|
||||||
|
private String code;
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private String valueType;
|
||||||
|
private Object defaultValue;
|
||||||
|
private List<SelectOption> options;
|
||||||
|
private boolean tenantLevel;
|
||||||
|
private boolean required;
|
||||||
|
private String group;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public static class SelectOption {
|
||||||
|
private String value;
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
public static SelectOption of(String value, String label) {
|
||||||
|
return SelectOption.builder().value(value).label(label).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.hospital.mgmt.modules.plugin;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IModulePlugin {
|
||||||
|
|
||||||
|
ModuleInfo getModuleInfo();
|
||||||
|
|
||||||
|
List<MenuDefinition> getMenuDefinitions();
|
||||||
|
|
||||||
|
List<PermissionDefinition> getPermissionDefinitions();
|
||||||
|
|
||||||
|
default List<RouteDefinition> getRouteDefinitions() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<TableDefinition> getTableDefinitions() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onInitialize(ModuleContext context) {}
|
||||||
|
|
||||||
|
default void onDestroy() {}
|
||||||
|
|
||||||
|
default List<String> getDependencies() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<ConfigDefinition> getConfigDefinitions() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.hospital.mgmt.modules.plugin;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class MenuDefinition {
|
||||||
|
private String code;
|
||||||
|
private String name;
|
||||||
|
private String icon;
|
||||||
|
private String path;
|
||||||
|
private int sortOrder;
|
||||||
|
private boolean visible;
|
||||||
|
private String platform;
|
||||||
|
private List<MenuDefinition> children;
|
||||||
|
private List<String> scopeRestrictions;
|
||||||
|
private String externalLink;
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package com.hospital.mgmt.modules.plugin;
|
||||||
|
|
||||||
|
public interface ModuleContext {
|
||||||
|
Long getTenantId();
|
||||||
|
void subscribe(Class<?> eventType, java.util.function.Consumer<?> listener);
|
||||||
|
void scheduleCron(String cron, Runnable task);
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.hospital.mgmt.modules.plugin;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class ModuleInfo {
|
||||||
|
private String code;
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private String version;
|
||||||
|
private String author;
|
||||||
|
private String icon;
|
||||||
|
private int sortOrder;
|
||||||
|
private boolean builtIn;
|
||||||
|
private boolean defaultEnabled;
|
||||||
|
private ModuleType type;
|
||||||
|
private String platform;
|
||||||
|
private String minSystemVersion;
|
||||||
|
private String homePath;
|
||||||
|
|
||||||
|
public enum ModuleType {
|
||||||
|
CORE, BUSINESS, EXTENSION
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package com.hospital.mgmt.modules.plugin;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class PermissionDefinition {
|
||||||
|
private String menuCode;
|
||||||
|
private String menuName;
|
||||||
|
private List<PagePermission> pages;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public static class PagePermission {
|
||||||
|
private String pageCode;
|
||||||
|
private String pageName;
|
||||||
|
private String pagePath;
|
||||||
|
private List<ActionPermission> actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public static class ActionPermission {
|
||||||
|
private String actionCode;
|
||||||
|
private String actionName;
|
||||||
|
private List<OperationDef> operations;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public static class OperationDef {
|
||||||
|
private String operationCode;
|
||||||
|
private String operationName;
|
||||||
|
private boolean defaultGranted;
|
||||||
|
|
||||||
|
public static OperationDef of(String code, String name, boolean defaultGranted) {
|
||||||
|
return OperationDef.builder()
|
||||||
|
.operationCode(code)
|
||||||
|
.operationName(name)
|
||||||
|
.defaultGranted(defaultGranted)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.hospital.mgmt.modules.plugin;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class RouteDefinition {
|
||||||
|
private String path;
|
||||||
|
private String name;
|
||||||
|
private String component;
|
||||||
|
private RouteMeta meta;
|
||||||
|
private List<RouteDefinition> children;
|
||||||
|
private boolean requiresAuth;
|
||||||
|
private List<String> allowedRoles;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public static class RouteMeta {
|
||||||
|
private String title;
|
||||||
|
private String icon;
|
||||||
|
private boolean keepAlive;
|
||||||
|
private boolean hidden;
|
||||||
|
private List<String> breadcrumb;
|
||||||
|
private List<String> permissions;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.hospital.mgmt.modules.plugin;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class TableDefinition {
|
||||||
|
private String tableName;
|
||||||
|
private String description;
|
||||||
|
private List<ColumnDefinition> columns;
|
||||||
|
private List<IndexDefinition> indexes;
|
||||||
|
private String initialDataSql;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public static class ColumnDefinition {
|
||||||
|
private String name;
|
||||||
|
private String dataType;
|
||||||
|
private boolean nullable;
|
||||||
|
private boolean primaryKey;
|
||||||
|
private String defaultValue;
|
||||||
|
private String comment;
|
||||||
|
private boolean tenantField;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public static class IndexDefinition {
|
||||||
|
private String name;
|
||||||
|
private List<String> columns;
|
||||||
|
private boolean unique;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.hospital.mgmt.modules.plugin.event;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class PermissionChangedEvent {
|
||||||
|
private final Long tenantId;
|
||||||
|
private final LocalDateTime timestamp;
|
||||||
|
|
||||||
|
public PermissionChangedEvent(Long tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
this.timestamp = LocalDateTime.now();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.hospital.mgmt.modules.plugin.listener;
|
||||||
|
|
||||||
|
import com.hospital.mgmt.modules.plugin.event.PermissionChangedEvent;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.event.EventListener;
|
||||||
|
import org.springframework.data.redis.connection.Message;
|
||||||
|
import org.springframework.data.redis.connection.MessageListener;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.data.redis.listener.ChannelTopic;
|
||||||
|
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PermissionChangeListener implements MessageListener {
|
||||||
|
|
||||||
|
private final StringRedisTemplate redisTemplate;
|
||||||
|
private final RedisMessageListenerContainer listenerContainer;
|
||||||
|
private final org.springframework.context.ApplicationEventPublisher eventPublisher;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void subscribe() {
|
||||||
|
listenerContainer.addMessageListener(this, new ChannelTopic("permission:changed"));
|
||||||
|
log.info("Subscribed to Redis channel: permission:changed");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(Message message, byte[] pattern) {
|
||||||
|
String channel = new String(message.getChannel());
|
||||||
|
String body = new String(message.getBody());
|
||||||
|
log.info("Received Redis message on channel: {}, body: {}", channel, body);
|
||||||
|
eventPublisher.publishEvent(new PermissionChangedEvent(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventListener
|
||||||
|
public void onPermissionChanged(PermissionChangedEvent event) {
|
||||||
|
log.info("Permission changed event received, refreshing local permission cache");
|
||||||
|
// TODO: 刷新本地权限缓存
|
||||||
|
}
|
||||||
|
|
||||||
|
public void publishPermissionChange(Long tenantId) {
|
||||||
|
redisTemplate.convertAndSend("permission:changed",
|
||||||
|
String.valueOf(System.currentTimeMillis()));
|
||||||
|
log.info("Published permission change notification");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.hospital.mgmt.modules.repair.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("repair_delay_apply")
|
||||||
|
public class RepairDelayApply extends BaseEntity {
|
||||||
|
private Long orderId;
|
||||||
|
private Long applicantId;
|
||||||
|
private String reason;
|
||||||
|
private LocalDateTime expectedFinishAt;
|
||||||
|
private String auditStatus;
|
||||||
|
private Long auditorId;
|
||||||
|
private String auditRemark;
|
||||||
|
private LocalDateTime auditAt;
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package com.hospital.mgmt.modules.repair.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("repair_order")
|
||||||
|
public class RepairOrder extends BaseEntity {
|
||||||
|
private String orderNo;
|
||||||
|
private Long repairTypeId;
|
||||||
|
private String title;
|
||||||
|
private String description;
|
||||||
|
private String urgency;
|
||||||
|
private String status;
|
||||||
|
private Long hospitalId;
|
||||||
|
private Long campusId;
|
||||||
|
private String location;
|
||||||
|
private String locationDetail;
|
||||||
|
private Long reporterId;
|
||||||
|
private String reporterType;
|
||||||
|
private String reporterName;
|
||||||
|
private String reporterPhone;
|
||||||
|
private Long assignedTeamId;
|
||||||
|
private Long assignedStaffId;
|
||||||
|
private LocalDateTime assignedAt;
|
||||||
|
private LocalDateTime expectedFinishAt;
|
||||||
|
private LocalDateTime actualFinishAt;
|
||||||
|
private LocalDateTime completedAt;
|
||||||
|
private LocalDateTime closedAt;
|
||||||
|
private String closeReason;
|
||||||
|
private Long parentOrderId;
|
||||||
|
private Integer isAssist;
|
||||||
|
private Integer remindCount;
|
||||||
|
private LocalDateTime lastRemindAt;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.hospital.mgmt.modules.repair.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("repair_order_attachment")
|
||||||
|
public class RepairOrderAttachment extends BaseEntity {
|
||||||
|
private Long orderId;
|
||||||
|
private String fileType;
|
||||||
|
private String fileUrl;
|
||||||
|
private String fileName;
|
||||||
|
private Long fileSize;
|
||||||
|
private String uploadStage;
|
||||||
|
private LocalDateTime watermarkTime;
|
||||||
|
private String watermarkLocation;
|
||||||
|
private Integer sortOrder;
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.hospital.mgmt.modules.repair.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("repair_order_log")
|
||||||
|
public class RepairOrderLog extends BaseEntity {
|
||||||
|
private Long orderId;
|
||||||
|
private String fromStatus;
|
||||||
|
private String toStatus;
|
||||||
|
private String action;
|
||||||
|
private Long operatorId;
|
||||||
|
private String operatorName;
|
||||||
|
private String remark;
|
||||||
|
private LocalDateTime operatedAt;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.hospital.mgmt.modules.repair.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("repair_type")
|
||||||
|
public class RepairType extends BaseEntity {
|
||||||
|
private String name;
|
||||||
|
private String code;
|
||||||
|
private Long defaultTeamId;
|
||||||
|
private String iconUrl;
|
||||||
|
private Integer sortOrder;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.hospital.mgmt.modules.repair.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hospital.mgmt.modules.repair.entity.RepairOrder;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface RepairOrderMapper extends BaseMapper<RepairOrder> {}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.hospital.mgmt.modules.system.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.hospital.mgmt.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("sys_bluetooth_policy")
|
||||||
|
public class BluetoothPolicy extends BaseEntity {
|
||||||
|
private Long hospitalId;
|
||||||
|
private Long campusId;
|
||||||
|
private String inspectionCheckIn;
|
||||||
|
private String inspectionPhoto;
|
||||||
|
private String cleaningCheckIn;
|
||||||
|
private String cleaningPhoto;
|
||||||
|
private String attendanceCheck;
|
||||||
|
private String auditStatus;
|
||||||
|
private String auditRemark;
|
||||||
|
private Long auditorId;
|
||||||
|
private java.time.LocalDateTime auditAt;
|
||||||
|
private java.time.LocalDateTime effectiveAt;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.hospital.mgmt.modules.system.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sys_dict_data")
|
||||||
|
public class DictData implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
private Long tenantId;
|
||||||
|
private String typeCode;
|
||||||
|
private String label;
|
||||||
|
private String value;
|
||||||
|
private Integer sortOrder;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue