test
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
server:
|
||||
port: 8081
|
||||
address: 0.0.0.0
|
||||
servlet:
|
||||
context-path: /api
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: pet-hospital
|
||||
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/pet_hospital_dev?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: qq5211314
|
||||
hikari:
|
||||
maximum-pool-size: 20
|
||||
minimum-idle: 10
|
||||
connection-timeout: 30000
|
||||
idle-timeout: 600000
|
||||
max-lifetime: 1800000
|
||||
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: update
|
||||
show-sql: true
|
||||
|
||||
sql:
|
||||
init:
|
||||
mode: never
|
||||
schema-locations: classpath*:schema.sql
|
||||
data-locations: classpath*:data.sql
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: auto
|
||||
logic-delete-field: deleted
|
||||
logic-delete-value: 1
|
||||
logic-not-delete-value: 0
|
||||
mapper-locations: classpath*:mapper/**/*.xml
|
||||
ddl-auto: create-drop
|
||||
|
||||
# JWT配置
|
||||
jwt:
|
||||
secret: petHospitalSecretKey2024GuanPengFeiGraduateDesign
|
||||
expiration: 86400000 # 24小时
|
||||
|
||||
# 文件上传配置
|
||||
file:
|
||||
upload-path: /tmp/pet-hospital/uploads/
|
||||
max-size: 10MB
|
||||
@@ -1,39 +0,0 @@
|
||||
server:
|
||||
port: 8080
|
||||
servlet:
|
||||
context-path: /api
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
application:
|
||||
name: pet-hospital
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: auto
|
||||
logic-delete-field: deleted
|
||||
logic-delete-value: 1
|
||||
logic-not-delete-value: 0
|
||||
mapper-locations: classpath*:mapper/**/*.xml
|
||||
|
||||
# 数据库配置
|
||||
database:
|
||||
type: mysql
|
||||
|
||||
# JWT配置
|
||||
jwt:
|
||||
secret: pet-hospital-secret-key-2024-guanpengfei-graduate-design
|
||||
expiration: 86400000 # 24小时
|
||||
|
||||
# 文件上传配置
|
||||
file:
|
||||
upload-path: /tmp/pet-hospital/uploads/
|
||||
max-size: 10MB
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,17 +0,0 @@
|
||||
-- 插入初始管理员用户
|
||||
INSERT INTO `user` (username, password, phone, email, role, status) VALUES ('admin', '$2a$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', '13800138000', 'admin@example.com', 'ADMIN', 1);
|
||||
|
||||
-- 插入初始医生用户
|
||||
INSERT INTO `user` (username, password, phone, email, role, status) VALUES ('doctor', '$2a$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', '13700137000', 'doctor@example.com', 'DOCTOR', 1);
|
||||
|
||||
-- 插入初始顾客用户
|
||||
INSERT INTO `user` (username, password, phone, email, role, status) VALUES ('customer', '$2a$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', '13900139000', 'customer@example.com', 'CUSTOMER', 1);
|
||||
|
||||
-- 插入示例宠物
|
||||
INSERT INTO pet (name, species, breed, gender, birthday, owner_id) VALUES ('小白', '狗', '金毛', 'MALE', '2023-01-01', 3);
|
||||
|
||||
-- 插入示例医生
|
||||
INSERT INTO doctor (name, department, title, phone, email, status) VALUES ('张医生', '内科', '主治医师', '13600136000', 'zhang@hospital.com', 1);
|
||||
|
||||
-- 插入示例药品
|
||||
INSERT INTO drug (name, category, manufacturer, specification, unit_price, stock_quantity, unit, status) VALUES ('阿莫西林', '抗生素', '制药厂A', '0.25g*24粒', 25.50, 100, '盒', 1);
|
||||
@@ -1,291 +0,0 @@
|
||||
-- 如果表不存在则创建表,如果存在则添加缺失的列
|
||||
|
||||
-- 检查并创建appointment表或添加缺失列
|
||||
CREATE TABLE IF NOT EXISTS appointment (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
customer_id BIGINT NOT NULL,
|
||||
pet_id BIGINT NOT NULL,
|
||||
doctor_id BIGINT,
|
||||
department VARCHAR(50),
|
||||
appointment_date DATE,
|
||||
time_slot VARCHAR(20), -- 添加这个缺失的列
|
||||
status VARCHAR(20) DEFAULT 'PENDING',
|
||||
remark TEXT,
|
||||
cancel_time TIMESTAMP NULL,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建visit表
|
||||
CREATE TABLE IF NOT EXISTS visit (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
appointment_id BIGINT,
|
||||
customer_id BIGINT NOT NULL,
|
||||
pet_id BIGINT NOT NULL,
|
||||
doctor_id BIGINT NOT NULL,
|
||||
symptoms TEXT,
|
||||
diagnosis TEXT,
|
||||
treatment_plan TEXT,
|
||||
status VARCHAR(20) DEFAULT 'PENDING',
|
||||
total_amount DECIMAL(10,2),
|
||||
payment_status VARCHAR(20) DEFAULT 'UNPAID',
|
||||
payment_method VARCHAR(20),
|
||||
payment_time TIMESTAMP NULL,
|
||||
start_time TIMESTAMP,
|
||||
end_time TIMESTAMP,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建prescription表
|
||||
CREATE TABLE IF NOT EXISTS prescription (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
visit_id BIGINT,
|
||||
doctor_id BIGINT,
|
||||
customer_id BIGINT,
|
||||
total_amount DECIMAL(10,2),
|
||||
status VARCHAR(20) DEFAULT 'DRAFT',
|
||||
remark TEXT,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建prescription_item表
|
||||
CREATE TABLE IF NOT EXISTS prescription_item (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
prescription_id BIGINT NOT NULL,
|
||||
drug_id BIGINT NOT NULL,
|
||||
drug_name VARCHAR(100),
|
||||
specification VARCHAR(100),
|
||||
quantity INT NOT NULL,
|
||||
usage_desc VARCHAR(200),
|
||||
days INT,
|
||||
unit_price DECIMAL(10,2),
|
||||
subtotal DECIMAL(10,2),
|
||||
dosage VARCHAR(100),
|
||||
frequency VARCHAR(50),
|
||||
duration VARCHAR(50),
|
||||
usage_instructions TEXT,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建order_info表
|
||||
CREATE TABLE IF NOT EXISTS order_info (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
visit_id BIGINT,
|
||||
customer_id BIGINT NOT NULL,
|
||||
amount DECIMAL(10,2),
|
||||
status VARCHAR(20) DEFAULT 'UNPAID',
|
||||
payment_method VARCHAR(20),
|
||||
payment_time TIMESTAMP NULL,
|
||||
remark TEXT,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建drug表
|
||||
CREATE TABLE IF NOT EXISTS drug (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(100) NOT NULL,
|
||||
category VARCHAR(50),
|
||||
manufacturer VARCHAR(100),
|
||||
specification VARCHAR(100),
|
||||
unit_price DECIMAL(10,2),
|
||||
stock_quantity INT DEFAULT 0,
|
||||
stock INT DEFAULT 0,
|
||||
alert_threshold INT,
|
||||
purchase_price DECIMAL(10,2),
|
||||
sale_price DECIMAL(10,2),
|
||||
approval_number VARCHAR(100),
|
||||
expiry_date TIMESTAMP NULL,
|
||||
unit VARCHAR(20),
|
||||
status INT DEFAULT 1,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建pet表
|
||||
CREATE TABLE IF NOT EXISTS pet (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
owner_id BIGINT NOT NULL,
|
||||
name VARCHAR(50) NOT NULL,
|
||||
species VARCHAR(50),
|
||||
breed VARCHAR(100),
|
||||
gender VARCHAR(10), -- 修改为VARCHAR以支持MALE/FEMALE
|
||||
birthday DATE, -- 添加birthday字段
|
||||
age INT, -- 添加age字段
|
||||
weight DOUBLE, -- 添加weight字段
|
||||
photo VARCHAR(255), -- 添加photo字段
|
||||
remark TEXT, -- 添加remark字段
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 为已存在的pet表添加age列
|
||||
ALTER TABLE pet ADD COLUMN IF NOT EXISTS age INT AFTER birthday;
|
||||
|
||||
-- 检查并创建doctor表
|
||||
CREATE TABLE IF NOT EXISTS doctor (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(50) NOT NULL,
|
||||
department VARCHAR(50),
|
||||
title VARCHAR(50),
|
||||
phone VARCHAR(20),
|
||||
email VARCHAR(100),
|
||||
avatar VARCHAR(255),
|
||||
status INT DEFAULT 1,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建user表
|
||||
CREATE TABLE IF NOT EXISTS `user` (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
username VARCHAR(50) NOT NULL UNIQUE,
|
||||
phone VARCHAR(20),
|
||||
email VARCHAR(100),
|
||||
password VARCHAR(255) NOT NULL,
|
||||
role VARCHAR(20) DEFAULT 'CUSTOMER',
|
||||
status INT DEFAULT 1,
|
||||
avatar VARCHAR(255),
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建medical_record表
|
||||
CREATE TABLE IF NOT EXISTS medical_record (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
visit_id BIGINT NOT NULL,
|
||||
chief_complaint TEXT,
|
||||
present_illness TEXT,
|
||||
physical_examination TEXT,
|
||||
examination_results TEXT,
|
||||
diagnosis TEXT,
|
||||
treatment_plan TEXT,
|
||||
advice TEXT,
|
||||
status VARCHAR(20),
|
||||
record_type VARCHAR(50), -- CHECKUP体检, DIAGNOSIS诊断, TREATMENT治疗
|
||||
content TEXT,
|
||||
attachment_urls TEXT,
|
||||
doctor_id BIGINT,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建message表
|
||||
CREATE TABLE IF NOT EXISTS message (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id BIGINT,
|
||||
user_name VARCHAR(100),
|
||||
contact VARCHAR(100),
|
||||
title VARCHAR(200),
|
||||
sender_id BIGINT,
|
||||
receiver_id BIGINT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
type VARCHAR(20) DEFAULT 'NOTICE', -- NOTICE通知, CHAT聊天
|
||||
status VARCHAR(20) DEFAULT 'UNREAD', -- UNREAD未读, READ已读
|
||||
reply TEXT,
|
||||
reply_time TIMESTAMP NULL,
|
||||
reply_user_id BIGINT,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建notice表
|
||||
CREATE TABLE IF NOT EXISTS notice (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
title VARCHAR(200) NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
is_top INT DEFAULT 0,
|
||||
publisher_id BIGINT NOT NULL,
|
||||
publish_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
status INT DEFAULT 1,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建report表
|
||||
CREATE TABLE IF NOT EXISTS report (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
visit_id BIGINT,
|
||||
pet_id BIGINT,
|
||||
type VARCHAR(50),
|
||||
title VARCHAR(200),
|
||||
summary TEXT,
|
||||
attachment_url VARCHAR(255),
|
||||
doctor_id BIGINT,
|
||||
report_type VARCHAR(50) DEFAULT 'DIAGNOSIS', -- REVENUE收入, CUSTOMER客户, PET宠物, DRUG药品, DIAGNOSIS检查报告
|
||||
report_data JSON,
|
||||
period_start DATE,
|
||||
period_end DATE,
|
||||
generated_by BIGINT,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 为已存在的report表修改report_type默认值
|
||||
ALTER TABLE report MODIFY COLUMN report_type VARCHAR(50) DEFAULT 'DIAGNOSIS';
|
||||
|
||||
-- 检查并创建stock_in表
|
||||
CREATE TABLE IF NOT EXISTS stock_in (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
drug_id BIGINT NOT NULL,
|
||||
quantity INT NOT NULL,
|
||||
unit_price DECIMAL(10,2),
|
||||
supplier VARCHAR(100),
|
||||
operator_id BIGINT,
|
||||
stock_in_time TIMESTAMP NULL,
|
||||
remark TEXT,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建stock_out表
|
||||
CREATE TABLE IF NOT EXISTS stock_out (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
drug_id BIGINT NOT NULL,
|
||||
prescription_id BIGINT,
|
||||
quantity INT NOT NULL,
|
||||
unit_price DECIMAL(10,2),
|
||||
purpose VARCHAR(100), -- 用途:销售、损耗等
|
||||
operator_id BIGINT,
|
||||
stock_out_time TIMESTAMP NULL,
|
||||
remark TEXT,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
|
||||
-- 检查并创建vaccine_record表
|
||||
CREATE TABLE IF NOT EXISTS vaccine_record (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
pet_id BIGINT NOT NULL,
|
||||
type VARCHAR(20), -- VACCINE疫苗, DEWORMING驱虫
|
||||
item_name VARCHAR(100),
|
||||
execute_date DATE,
|
||||
next_reminder_date DATE,
|
||||
vaccine_name VARCHAR(100) NOT NULL,
|
||||
dose_number INT,
|
||||
injection_date DATE,
|
||||
next_appointment_date DATE,
|
||||
doctor_id BIGINT,
|
||||
remark TEXT,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted INT DEFAULT 0
|
||||
);
|
||||
Reference in New Issue
Block a user