# Qwen Code Context for HIS (Hospital Information System) ## Project Overview This is a comprehensive Hospital Information System (HIS) called OpenHIS, built with a Java Spring Boot backend and Vue 3 frontend. The system is designed to manage hospital operations including patient management, appointments, clinical workflows, billing, and administrative tasks. ### Technology Stack **Backend:** - Java 17 - Spring Boot 2.5.15 - PostgreSQL (recommended v16.2) - Redis - MyBatis-Plus 3.5.5 for ORM - Druid 1.2.27 for database connection pooling - Flowable 6.8.0 for workflow management - LiteFlow 2.12.4.1 for business rule orchestration - Swagger 3.0.0 for API documentation - JWT 0.9.1 for authentication **Frontend:** - Vue 3 with Composition API - Vite 5.0.4 as build tool - Element Plus 2.12.0 as UI component library - Pinia 2.2.0 for state management - Axios 0.27.2 for HTTP requests - Sass for styling ## Repository Structure ``` . ├── openhis-server-new/ # Backend multi-module Maven project │ ├── openhis-application/ # Main application module with startup class │ ├── openhis-domain/ # Business domain modules (administration, clinical, financial, etc.) │ ├── openhis-common/ # Shared utilities and common code │ ├── core-admin/ # Core administration module │ ├── core-framework/ # Framework configuration and security │ ├── core-system/ # System management module │ ├── core-quartz/ # Scheduled tasks │ ├── core-generator/ # Code generation utilities │ ├── core-common/ # Core utilities │ └── core-flowable/ # Workflow engine integration ├── openhis-ui-vue3/ # Vue 3 frontend │ ├── src/ │ │ ├── api/ # API service layer │ │ ├── components/ # Reusable components │ │ ├── router/ # Vue Router configuration │ │ ├── store/ # Pinia state management │ │ ├── utils/ # Utility functions │ │ └── views/ # Page components │ └── vite/ # Vite plugins configuration ├── sql/ # Database scripts ├── 发版记录/ # Release records └── 迁移记录-DB变更记录/ # Database migration records ``` ## Building and Running ### Backend Setup 1. **Prerequisites:** - JDK 17 (required) - PostgreSQL v16.2 (required) - Redis (stable version) 2. **Database Setup:** - Import the database initialization script using Navicat 16 or later - Script location: `sql/20251224init脚本(使用Navicat Premium 17导入).sql` - Configure database connection in `application.yml` or `application-dev.yml` 3. **Build and Run:** ```bash cd openhis-server-new mvn clean package -DskipTests cd openhis-application mvn spring-boot:run ``` Or run directly from IDE by executing `OpenHisApplication.java` ### Frontend Setup 1. **Prerequisites:** - Node.js v16.15 (recommended) 2. **Installation and Run:** ```bash cd openhis-ui-vue3 npm install npm run dev ``` 3. **Access the application:** - Frontend: http://localhost:81 - Backend API: http://localhost:18080/openhis - Swagger UI: http://localhost:18080/openhis/swagger-ui/index.html ## Development Conventions ### Backend Architecture The backend follows a multi-module Maven architecture with clear separation of concerns: 1. **openhis-application**: Entry point with `OpenHisApplication.java` - Scans `com.core` and `com.openhis` packages - Configured to run on port 18080 with context path `/openhis` 2. **openhis-domain**: Business domain modules organized by medical functionality: - `administration`: Administrative functions - `appointmentmanage`: Appointment management - `check`: Medical examination/checkup - `clinical`: Clinical workflows - `crosssystem`: Cross-system integration - `document`: Document management - `financial`: Financial/billing - `lab`: Laboratory operations - `medication`: Medication management - `triageandqueuemanage`: Patient triage and queue management - `yb`, `ybcatalog`, `ybelep`: Insurance (Yi Bao) integration - `workflow`: Workflow management 3. **Core Modules** (com.core package): - `core-system`: User, role, menu, and permission management - `core-framework`: Security, exception handling, and framework configurations - `core-common`: Shared utilities and base classes - `core-quartz`: Scheduled task management - `core-generator`: Code generation tools - `core-flowable`: Workflow engine integration - `core-admin`: Administrative functions ### Frontend Architecture The frontend uses Vue 3 with composition API and modern tooling: 1. **State Management:** Pinia for global state with modules for app, dict, permission, settings, tagsView, and user 2. **Routing:** Vue Router 4.3.0 with public routes and dynamic permission-based routes 3. **API Integration:** Axios with request/response interceptors and API services organized by module 4. **Component Architecture:** Element Plus as UI framework with custom components in `src/components/` ## Key Configuration Files ### Backend Configuration - Main config: `openhis-server-new/openhis-application/src/main/resources/application.yml` - Environment-specific: `application-dev.yml`, `application-test.yml`, `application-prd.yml` - Database connection settings, Redis configuration, server settings, and MyBatis-Plus configuration ### Frontend Configuration - Environment files: `.env.*` in `openhis-ui-vue3/` - Vite configuration: `vite.config.js` - Main entry: `src/main.js` - Router: `src/router/index.js` ## Common Development Tasks ### Adding a New Backend Feature 1. Create domain entity in appropriate module under `openhis-domain/[module]/domain/` 2. Create mapper interface in `openhis-domain/[module]/mapper/` 3. Create service interface and implementation in `openhis-domain/[module]/service/` 4. Create controller in `openhis-application/src/main/java/com/openhis/web/[module]/` 5. Test endpoints via Swagger UI ### Adding a New Frontend Page 1. Create Vue component in `openhis-ui-vue3/src/views/[module]/` 2. Add API service methods in `openhis-ui-vue3/src/api/` 3. Add route to `openhis-ui-vue3/src/router/index.js` 4. Add Pinia store module if state management needed ## Important Notes - The system uses logical deletion with a `validFlag` field (1 = active, 0 = deleted) - JWT tokens are stored in the `Authorization` header - The system supports WebView environments with C# accessor integration - File uploads are configured with max 10MB per file and 20MB total request size - Password lockout occurs after 5 failed attempts with a 10-minute lock time - The system includes a code generator accessible via `/tool/gen` route - Printing functionality is implemented using the hiprint plugin