@startuml !theme plain skinparam backgroundColor #FFFFFF skinparam classAttributeIconSize 0 skinparam linetype ortho package "com.gpf.pethospital.entity" { class User { - Long id - String username - String phone - String email - String password - String role - Integer status - String avatar - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class Appointment { - Long id - Long userId - Long petId - Long doctorId - LocalDateTime appointmentTime - String reason - String status - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class Pet { - Long id - Long ownerId - String name - String species - String breed - String gender - LocalDate birthDate - String medicalHistory - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class Drug { - Long id - String name - String category - String manufacturer - String description - BigDecimal price - Integer stock - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class MedicalRecord { - Long id - Long appointmentId - Long doctorId - Long petId - String symptoms - String diagnosis - String treatment - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class Prescription { - Long id - Long medicalRecordId - String description - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class PrescriptionItem { - Long id - Long prescriptionId - Long drugId - Integer quantity - String usage - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class Visit { - Long id - Long appointmentId - Long doctorId - Long petId - String chiefComplaint - String physicalExamination - String diagnosis - String treatmentPlan - LocalDateTime visitTime - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class VaccineRecord { - Long id - Long petId - Long vaccineId - String vaccineName - LocalDate vaccinationDate - LocalDate nextDueDate - String administeredBy - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class Order { - Long id - Long userId - String orderNo - String status - BigDecimal totalAmount - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class StockIn { - Long id - Long drugId - Integer quantity - BigDecimal unitPrice - String supplier - String operator - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class StockOut { - Long id - Long drugId - Integer quantity - String purpose - String operator - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class Message { - Long id - Long senderId - Long receiverId - String title - String content - String status - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class Notice { - Long id - String title - String content - String publisher - LocalDateTime publishTime - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } class Report { - Long id - String reportType - String title - String content - LocalDate reportDate - String generatedBy - LocalDateTime createTime - LocalDateTime updateTime - Integer deleted } } package "com.gpf.pethospital.mapper" { interface BaseMapper { + insert(T entity): int + deleteById(Serializable id): int + updateById(T entity): int + selectById(Serializable id): T + selectList(Wrapper queryWrapper): List } interface UserMapper { } interface AppointmentMapper { } interface PetMapper { } interface DrugMapper { } interface MedicalRecordMapper { } interface PrescriptionMapper { } interface PrescriptionItemMapper { } interface VisitMapper { } interface VaccineRecordMapper { } interface OrderMapper { } interface StockInMapper { } interface StockOutMapper { } interface MessageMapper { } interface NoticeMapper { } interface ReportMapper { } } package "com.gpf.pethospital.service" { interface IService { + save(T entity): boolean + removeById(Serializable id): boolean + updateById(T entity): boolean + getById(Serializable id): T + list(): List + page(IPage page, Wrapper queryWrapper): IPage } interface UserService { + register(User user): boolean + login(String username, String password): AuthUser } interface AppointmentService { + book(Appointment appointment): boolean + cancel(Long id): boolean + getByUserId(Long userId): List } interface PetService { + getPetsByOwnerId(Long ownerId): List + updatePet(Pet pet): boolean } interface DrugService { + getLowStockDrugs(): List + updateStock(Long drugId, Integer quantity): boolean } interface MedicalRecordService { + createRecord(MedicalRecord record): boolean + getRecordsByPetId(Long petId): List } interface PrescriptionService { + createPrescription(Prescription prescription): boolean + getPrescriptionsByRecordId(Long recordId): List } interface PrescriptionItemService { + addItems(Long prescriptionId, List items): boolean } interface VisitService { + createVisit(Visit visit): boolean + getVisitsByAppointmentId(Long appointmentId): Visit } interface VaccineRecordService { + addVaccineRecord(VaccineRecord record): boolean + getVaccineRecordsByPetId(Long petId): List } interface OrderService { + createOrder(Order order): boolean + updateOrderStatus(Long orderId, String status): boolean } interface StockInService { + addStock(StockIn stockIn): boolean } interface StockOutService { + consumeStock(StockOut stockOut): boolean } interface MessageService { + sendMessage(Message message): boolean + getMessagesByUserId(Long userId): List } interface NoticeService { + publishNotice(Notice notice): boolean + getPublishedNotices(): List } interface ReportService { + generateReport(String type, LocalDate startDate, LocalDate endDate): Report + getReportsByType(String type): List } } package "com.gpf.pethospital.service.impl" { class UserServiceImpl { } class AppointmentServiceImpl { } class PetServiceImpl { } class DrugServiceImpl { } class MedicalRecordServiceImpl { } class PrescriptionServiceImpl { } class PrescriptionItemServiceImpl { } class VisitServiceImpl { } class VaccineRecordServiceImpl { } class OrderServiceImpl { } class StockInServiceImpl { } class StockOutServiceImpl { } class MessageServiceImpl { } class NoticeServiceImpl { } class ReportServiceImpl { } } package "com.gpf.pethospital.controller" { class UserController { - UserService userService - PasswordEncoder passwordEncoder + me(): ApiResponse + updateMe(User payload): ApiResponse + list(long page, long size, String role): ApiResponse + create(User user): ApiResponse + updateStatus(Long id, Integer status): ApiResponse + resetPassword(Long id, String newPassword): ApiResponse + stats(): ApiResponse } class AppointmentController { - AppointmentService appointmentService + book(Appointment appointment): ApiResponse + cancel(Long id): ApiResponse + list(Long userId, String status): ApiResponse } class PetController { - PetService petService + listByOwner(Long ownerId): ApiResponse + create(Pet pet): ApiResponse + update(Pet pet): ApiResponse } class DrugController { - DrugService drugService + list(String category, String keyword): ApiResponse + create(Drug drug): ApiResponse + update(Drug drug): ApiResponse } class MedicalRecordController { - MedicalRecordService medicalRecordService + create(MedicalRecord record): ApiResponse + getByPet(Long petId): ApiResponse } class PrescriptionController { - PrescriptionService prescriptionService + create(Prescription prescription): ApiResponse + getByRecord(Long recordId): ApiResponse } class PrescriptionItemController { - PrescriptionItemService prescriptionItemService + addItems(Long prescriptionId, List items): ApiResponse } class VaccineRecordController { - VaccineRecordService vaccineRecordService + addRecord(VaccineRecord record): ApiResponse + getByPet(Long petId): ApiResponse } class OrderController { - OrderService orderService + create(Order order): ApiResponse + updateStatus(Long orderId, String status): ApiResponse } class StockInController { - StockInService stockInService + addStock(StockIn stockIn): ApiResponse } class StockOutController { - StockOutService stockOutService + consume(StockOut stockOut): ApiResponse } class MessageController { - MessageService messageService + send(Message message): ApiResponse + listByUser(Long userId): ApiResponse } class NoticeController { - NoticeService noticeService + publish(Notice notice): ApiResponse + list(): ApiResponse } class ReportController { - ReportService reportService + generate(String type, LocalDate startDate, LocalDate endDate): ApiResponse + list(String type): ApiResponse } class AuthController { - UserService userService - JwtTokenUtil jwtTokenUtil + register(User user): ApiResponse + login(UserLoginDto loginDto): ApiResponse } } package "com.gpf.pethospital.config" { class SecurityConfig { } class WebConfig { } class MybatisPlusConfig { } } package "com.gpf.pethospital.common" { class ApiResponse { - Integer code - String message - Object data + success(Object data): ApiResponse + error(Integer code, String message): ApiResponse } } ' 关系映射 User ||--o{ Appointment : "makes" User ||--o{ Pet : "owns" User ||--o{ MedicalRecord : "creates" User ||--o{ Message : "sends/receives" User ||--o{ Order : "places" Pet ||--o{ Appointment : "has" Pet ||--o{ MedicalRecord : "has" Pet ||--o{ VaccineRecord : "has" Pet ||--o{ Visit : "has" Appointment ||--|| MedicalRecord : "generates" Appointment ||--|| Visit : "generates" Drug }o--o{ PrescriptionItem : "included in" Prescription ||--o{ PrescriptionItem : "contains" MedicalRecord ||--o{ Prescription : "has" MedicalRecord ||--o{ Visit : "has" StockIn ||--|| Drug : "affects" StockOut ||--|| Drug : "affects" Order ||--o{ PrescriptionItem : "contains" User ||--o{ VaccineRecord : "administers" @enduml