How xdmdcp/hospital works
Project type and purpose
• This is a full-stack, RESTful appointment and registration management system for hospitals.
• The backend is a Spring Boot + MyBatis Java service (“hospital” repo) providing REST APIs; frontends include a WeChat/Alipay/H5 mini-app and a web admin portal (in separate repos).
File structure
• Top-level:
• pom.xml – Maven build definition.
• src/main/java – application source code under cn.yujian95.hospital.
• src/main/resources – configuration: application.yml, MyBatis XML mappers, SQL, Redis settings.
• doc/ – demo screenshots and deployment instructions.
• Within java/…/hospital:
• common/api, common/security – API result wrappers, error codes, RESTful auth handlers, JWT support.
• component – external integrations (Ali SMS, Qiniu file storage, WeChat messages, web logging).
• config – Spring configurations (security, MyBatis, Swagger).
• controller – REST controllers (HospitalClinicController, UserBasicInfoController, VisitAppointmentController, etc.).
• service & service/impl – business logic interfaces and implementations (e.g. IVisitAppointmentService → VisitAppointmentServiceImpl).
• mapper & mapper/dao – MyBatis mappers and custom DAOs.
• entity – database entities (e.g. VisitPlan, PowerAccount) and Example classes for queries.
• dto & dto/param – data transfer and parameter objects for request/response.
• Patterns: Layered MVC (Controller → Service → Mapper → Database), JWT-based stateless security, MyBatis Generator for codegen, Redis for caching, external service adapters.
Extract insights from README
• Purpose: “simple hospital appointment registration management system”.
• Tech stack:
• Spring Boot + MyBatis (RESTful API)
• Spring Security + JWT (role-based dynamic permissions)
• MyBatis Generator, Swagger/Knife4j (API docs)
• Redis (2nd-level cache)
• Aliyun SMS, Qiniu Cloud Storage
Components
a. Main components
• Clients: Mini-app (WeChat/Alipay/H5), Web Admin portal
• API Layer: Spring Boot REST Controllers
• Security Layer: Spring Security + JWT filters (authentication entry point, access denied handler, dynamic security filter)
• Business Layer: Service interfaces and implementations
• Data Access Layer: MyBatis mappers & DAOs, MyBatis Generator config
• Database: MySQL (hospital.sql schema)
• Cache: Redis for hot data, session/permissions caching
• External Services:
– Aliyun SMS (AliSendSmsComponent)
– Qiniu Cloud Storage (QiniuComponent)
• Documentation: Swagger/Knife4j UI
b. Relationships & data flows
1. User interacts with Mini-app or Web UI
2. Requests → Spring Boot REST endpoints
3. JWT filter validates token; SecurityConfig routes by roles & dynamic metadata
4. Controller invokes Service layer
5. Service uses Mapper/DAO to read/write MySQL; optionally reads/writes Redis cache
6. Service calls external components for SMS or file storage
7. Response wrapped in CommonResult/CommonPage and returned to client
c. Architectural patterns
• Layered (Presentation → Business → Persistence)
• JWT-stateless authentication with dynamic permission checks
• MyBatis Generator for automating entity & SQL mapping
• Cache-Aside with Redis (service checks cache → if miss, DB → populate cache)
d. Key technologies & libraries
• Spring Boot, Spring Web, Spring Security, Spring Data Redis
• MyBatis, MyBatis Generator
• JWT (custom JwtTokenUtil, JwtAuthenticationTokenFilter)
• RedisTemplate (RedisServiceImpl)
• Lombok
• Knife4j/Swagger for API docs
• Aliyun SMS SDK, Qiniu Storage SDK
Final advice
• Every major module: security, logging, API docs, SMS/file storage, caching.
• Dynamic permission enforcement by showing the SecurityFilter chain before Controllers.
• Flows: Client → JWT Auth → Controller → Service → Mapper → DB/Redis → back to Client.
• With technology names (Spring Boot, MyBatis, Redis, Qiniu, Aliyun SMS).