wad-lab 1.0.9 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/bin/index.js +13 -5
  2. package/package.json +1 -1
  3. package/templates/servlet-session-tracking/WEB-INF/LoginServlet.java +46 -0
  4. package/templates/servlet-session-tracking/WEB-INF/LogoutServlet.java +39 -0
  5. package/templates/servlet-session-tracking/WEB-INF/ProfileServlet.java +83 -0
  6. package/templates/servlet-session-tracking/WEB-INF/classes/LoginServlet.class +0 -0
  7. package/templates/servlet-session-tracking/WEB-INF/classes/LogoutServlet.class +0 -0
  8. package/templates/servlet-session-tracking/WEB-INF/classes/ProfileServlet.class +0 -0
  9. package/templates/servlet-session-tracking/WEB-INF/web.xml +38 -0
  10. package/templates/servlet-session-tracking/index.html +36 -0
  11. package/templates/springboot-hospital-api/.mvn/wrapper/maven-wrapper.properties +3 -0
  12. package/templates/springboot-hospital-api/mvnw +295 -0
  13. package/templates/springboot-hospital-api/mvnw.cmd +189 -0
  14. package/templates/springboot-hospital-api/pom.xml +41 -0
  15. package/templates/springboot-hospital-api/src/main/java/com/example/hospital/HospitalApplication.java +12 -0
  16. package/templates/springboot-hospital-api/src/main/java/com/example/hospital/controller/HospitalController.java +50 -0
  17. package/templates/springboot-hospital-api/src/main/java/com/example/hospital/model/Appointment.java +95 -0
  18. package/templates/springboot-hospital-api/src/main/java/com/example/hospital/repository/AppointmentRepository.java +15 -0
  19. package/templates/springboot-hospital-api/src/main/java/com/example/hospital/service/HospitalService.java +54 -0
  20. package/templates/springboot-hospital-api/src/main/resources/application.properties +3 -0
  21. package/templates/springboot-hospital-api/src/test/java/com/example/hospital/HospitalApplicationTests.java +12 -0
  22. package/templates/springboot-library-api/.mvn/wrapper/maven-wrapper.properties +3 -0
  23. package/templates/springboot-library-api/mvnw +295 -0
  24. package/templates/springboot-library-api/mvnw.cmd +189 -0
  25. package/templates/springboot-library-api/pom.xml +42 -0
  26. package/templates/springboot-library-api/src/main/java/com/example/library/LibraryApplication.java +12 -0
  27. package/templates/springboot-library-api/src/main/java/com/example/library/controller/LibraryController.java +51 -0
  28. package/templates/springboot-library-api/src/main/java/com/example/library/model/Book.java +76 -0
  29. package/templates/springboot-library-api/src/main/java/com/example/library/model/CategoryAnalytics.java +41 -0
  30. package/templates/springboot-library-api/src/main/java/com/example/library/repository/BookRepository.java +13 -0
  31. package/templates/springboot-library-api/src/main/java/com/example/library/service/LibraryService.java +60 -0
  32. package/templates/springboot-library-api/src/main/resources/application.properties +3 -0
  33. package/templates/vue-game-rps/index.html +12 -0
  34. package/templates/vue-game-rps/package.json +19 -0
  35. package/templates/vue-game-rps/src/App.vue +125 -0
  36. package/templates/vue-game-rps/src/main.js +5 -0
  37. package/templates/vue-game-rps/src/stores/rpsStore.js +43 -0
  38. package/templates/vue-game-rps/vite.config.js +6 -0
  39. package/templates/vue-game-tictactoe/index.html +12 -0
  40. package/templates/vue-game-tictactoe/package.json +19 -0
  41. package/templates/vue-game-tictactoe/src/App.vue +105 -0
  42. package/templates/vue-game-tictactoe/src/main.js +5 -0
  43. package/templates/vue-game-tictactoe/src/stores/tictactoeStore.js +61 -0
  44. package/templates/vue-game-tictactoe/vite.config.js +6 -0
  45. package/templates/vue-game-whackamole/index.html +12 -0
  46. package/templates/vue-game-whackamole/package.json +19 -0
  47. package/templates/vue-game-whackamole/src/App.vue +104 -0
  48. package/templates/vue-game-whackamole/src/main.js +7 -0
  49. package/templates/vue-game-whackamole/src/stores/moleStore.js +71 -0
  50. package/templates/vue-game-whackamole/vite.config.js +6 -0
  51. package/templates/vue-hospital-portal/index.html +12 -0
  52. package/templates/vue-hospital-portal/package.json +20 -0
  53. package/templates/vue-hospital-portal/src/App.vue +107 -0
  54. package/templates/vue-hospital-portal/src/main.js +9 -0
  55. package/templates/vue-hospital-portal/src/router/index.js +17 -0
  56. package/templates/vue-hospital-portal/src/stores/hospitalStore.js +91 -0
  57. package/templates/vue-hospital-portal/src/views/HospitalBillingView.vue +271 -0
  58. package/templates/vue-hospital-portal/src/views/OPDRegistrationView.vue +453 -0
  59. package/templates/vue-hospital-portal/src/views/PatientListView.vue +315 -0
  60. package/templates/vue-hospital-portal/vite.config.js +6 -0
  61. package/templates/vue-library-system/index.html +12 -0
  62. package/templates/vue-library-system/package.json +20 -0
  63. package/templates/vue-library-system/src/App.vue +91 -0
  64. package/templates/vue-library-system/src/main.js +9 -0
  65. package/templates/vue-library-system/src/router/index.js +29 -0
  66. package/templates/vue-library-system/src/stores/libraryStore.js +87 -0
  67. package/templates/vue-library-system/src/views/BookCatalogView.vue +432 -0
  68. package/templates/vue-library-system/src/views/LoanManagerView.vue +296 -0
  69. package/templates/vue-library-system/src/views/MembershipView.vue +269 -0
  70. package/templates/vue-library-system/vite.config.js +6 -0
@@ -0,0 +1,189 @@
1
+ <# : batch portion
2
+ @REM ----------------------------------------------------------------------------
3
+ @REM Licensed to the Apache Software Foundation (ASF) under one
4
+ @REM or more contributor license agreements. See the NOTICE file
5
+ @REM distributed with this work for additional information
6
+ @REM regarding copyright ownership. The ASF licenses this file
7
+ @REM to you under the Apache License, Version 2.0 (the
8
+ @REM "License"); you may not use this file except in compliance
9
+ @REM with the License. You may obtain a copy of the License at
10
+ @REM
11
+ @REM http://www.apache.org/licenses/LICENSE-2.0
12
+ @REM
13
+ @REM Unless required by applicable law or agreed to in writing,
14
+ @REM software distributed under the License is distributed on an
15
+ @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ @REM KIND, either express or implied. See the License for the
17
+ @REM specific language governing permissions and limitations
18
+ @REM under the License.
19
+ @REM ----------------------------------------------------------------------------
20
+
21
+ @REM ----------------------------------------------------------------------------
22
+ @REM Apache Maven Wrapper startup batch script, version 3.3.4
23
+ @REM
24
+ @REM Optional ENV vars
25
+ @REM MVNW_REPOURL - repo url base for downloading maven distribution
26
+ @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
27
+ @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
28
+ @REM ----------------------------------------------------------------------------
29
+
30
+ @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
31
+ @SET __MVNW_CMD__=
32
+ @SET __MVNW_ERROR__=
33
+ @SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
34
+ @SET PSModulePath=
35
+ @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
36
+ IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
37
+ )
38
+ @SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
39
+ @SET __MVNW_PSMODULEP_SAVE=
40
+ @SET __MVNW_ARG0_NAME__=
41
+ @SET MVNW_USERNAME=
42
+ @SET MVNW_PASSWORD=
43
+ @IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*)
44
+ @echo Cannot start maven from wrapper >&2 && exit /b 1
45
+ @GOTO :EOF
46
+ : end batch / begin powershell #>
47
+
48
+ $ErrorActionPreference = "Stop"
49
+ if ($env:MVNW_VERBOSE -eq "true") {
50
+ $VerbosePreference = "Continue"
51
+ }
52
+
53
+ # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
54
+ $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
55
+ if (!$distributionUrl) {
56
+ Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
57
+ }
58
+
59
+ switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
60
+ "maven-mvnd-*" {
61
+ $USE_MVND = $true
62
+ $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
63
+ $MVN_CMD = "mvnd.cmd"
64
+ break
65
+ }
66
+ default {
67
+ $USE_MVND = $false
68
+ $MVN_CMD = $script -replace '^mvnw','mvn'
69
+ break
70
+ }
71
+ }
72
+
73
+ # apply MVNW_REPOURL and calculate MAVEN_HOME
74
+ # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
75
+ if ($env:MVNW_REPOURL) {
76
+ $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" }
77
+ $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')"
78
+ }
79
+ $distributionUrlName = $distributionUrl -replace '^.*/',''
80
+ $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
81
+
82
+ $MAVEN_M2_PATH = "$HOME/.m2"
83
+ if ($env:MAVEN_USER_HOME) {
84
+ $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME"
85
+ }
86
+
87
+ if (-not (Test-Path -Path $MAVEN_M2_PATH)) {
88
+ New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null
89
+ }
90
+
91
+ $MAVEN_WRAPPER_DISTS = $null
92
+ if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) {
93
+ $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists"
94
+ } else {
95
+ $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists"
96
+ }
97
+
98
+ $MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain"
99
+ $MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
100
+ $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
101
+
102
+ if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
103
+ Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
104
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
105
+ exit $?
106
+ }
107
+
108
+ if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
109
+ Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
110
+ }
111
+
112
+ # prepare tmp dir
113
+ $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
114
+ $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
115
+ $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
116
+ trap {
117
+ if ($TMP_DOWNLOAD_DIR.Exists) {
118
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
119
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
120
+ }
121
+ }
122
+
123
+ New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
124
+
125
+ # Download and Install Apache Maven
126
+ Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
127
+ Write-Verbose "Downloading from: $distributionUrl"
128
+ Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
129
+
130
+ $webclient = New-Object System.Net.WebClient
131
+ if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
132
+ $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
133
+ }
134
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
135
+ $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
136
+
137
+ # If specified, validate the SHA-256 sum of the Maven distribution zip file
138
+ $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
139
+ if ($distributionSha256Sum) {
140
+ if ($USE_MVND) {
141
+ Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
142
+ }
143
+ Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
144
+ if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
145
+ Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
146
+ }
147
+ }
148
+
149
+ # unzip and move
150
+ Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
151
+
152
+ # Find the actual extracted directory name (handles snapshots where filename != directory name)
153
+ $actualDistributionDir = ""
154
+
155
+ # First try the expected directory name (for regular distributions)
156
+ $expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain"
157
+ $expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD"
158
+ if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) {
159
+ $actualDistributionDir = $distributionUrlNameMain
160
+ }
161
+
162
+ # If not found, search for any directory with the Maven executable (for snapshots)
163
+ if (!$actualDistributionDir) {
164
+ Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object {
165
+ $testPath = Join-Path $_.FullName "bin/$MVN_CMD"
166
+ if (Test-Path -Path $testPath -PathType Leaf) {
167
+ $actualDistributionDir = $_.Name
168
+ }
169
+ }
170
+ }
171
+
172
+ if (!$actualDistributionDir) {
173
+ Write-Error "Could not find Maven distribution directory in extracted archive"
174
+ }
175
+
176
+ Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir"
177
+ Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null
178
+ try {
179
+ Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
180
+ } catch {
181
+ if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
182
+ Write-Error "fail to move MAVEN_HOME"
183
+ }
184
+ } finally {
185
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
186
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
187
+ }
188
+
189
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
@@ -0,0 +1,41 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4
+ <modelVersion>4.0.0</modelVersion>
5
+ <parent>
6
+ <groupId>org.springframework.boot</groupId>
7
+ <artifactId>spring-boot-starter-parent</artifactId>
8
+ <version>3.3.4</version>
9
+ <relativePath/>
10
+ </parent>
11
+ <groupId>com.example</groupId>
12
+ <artifactId>springboot-hospital-api</artifactId>
13
+ <version>0.0.1-SNAPSHOT</version>
14
+ <name>springboot-hospital-api</name>
15
+ <properties>
16
+ <java.version>17</java.version>
17
+ </properties>
18
+ <dependencies>
19
+ <dependency>
20
+ <groupId>org.springframework.boot</groupId>
21
+ <artifactId>spring-boot-starter-web</artifactId>
22
+ </dependency>
23
+ <dependency>
24
+ <groupId>org.springframework.boot</groupId>
25
+ <artifactId>spring-boot-starter-data-mongodb</artifactId>
26
+ </dependency>
27
+ <dependency>
28
+ <groupId>org.springframework.boot</groupId>
29
+ <artifactId>spring-boot-starter-test</artifactId>
30
+ <scope>test</scope>
31
+ </dependency>
32
+ </dependencies>
33
+ <build>
34
+ <plugins>
35
+ <plugin>
36
+ <groupId>org.springframework.boot</groupId>
37
+ <artifactId>spring-boot-maven-plugin</artifactId>
38
+ </plugin>
39
+ </plugins>
40
+ </build>
41
+ </project>
@@ -0,0 +1,12 @@
1
+ package com.example.hospital;
2
+
3
+ import org.springframework.boot.SpringApplication;
4
+ import org.springframework.boot.autoconfigure.SpringBootApplication;
5
+
6
+ @SpringBootApplication
7
+ public class HospitalApplication {
8
+
9
+ public static void main(String[] args) {
10
+ SpringApplication.run(HospitalApplication.class, args);
11
+ }
12
+ }
@@ -0,0 +1,50 @@
1
+ package com.example.hospital.controller;
2
+
3
+ import com.example.hospital.model.Appointment;
4
+ import com.example.hospital.service.HospitalService;
5
+ import org.springframework.beans.factory.annotation.Autowired;
6
+ import org.springframework.web.bind.annotation.*;
7
+
8
+ import java.util.List;
9
+
10
+ @RestController
11
+ @RequestMapping("/api/appointments")
12
+ @CrossOrigin(origins = "*")
13
+ public class HospitalController {
14
+
15
+ @Autowired
16
+ private HospitalService hospitalService;
17
+
18
+ @GetMapping
19
+ public List<Appointment> getAllAppointments(
20
+ @RequestParam(required = false) String doctorName,
21
+ @RequestParam(required = false) String status) {
22
+ if (doctorName != null && !doctorName.trim().isEmpty()) {
23
+ return hospitalService.getAppointmentsByDoctorName(doctorName);
24
+ }
25
+ if (status != null && !status.trim().isEmpty()) {
26
+ return hospitalService.getAppointmentsByStatus(status);
27
+ }
28
+ return hospitalService.getAllAppointments();
29
+ }
30
+
31
+ @GetMapping("/{id}")
32
+ public Appointment getAppointmentById(@PathVariable String id) {
33
+ return hospitalService.getAppointmentById(id);
34
+ }
35
+
36
+ @PostMapping
37
+ public Appointment bookAppointment(@RequestBody Appointment appointment) {
38
+ return hospitalService.bookAppointment(appointment);
39
+ }
40
+
41
+ @PutMapping("/{id}/status")
42
+ public Appointment updateStatus(@PathVariable String id, @RequestParam String status) {
43
+ return hospitalService.updateStatus(id, status);
44
+ }
45
+
46
+ @DeleteMapping("/{id}")
47
+ public void cancelAppointment(@PathVariable String id) {
48
+ hospitalService.cancelAppointment(id);
49
+ }
50
+ }
@@ -0,0 +1,95 @@
1
+ package com.example.hospital.model;
2
+
3
+ import org.springframework.data.annotation.Id;
4
+ import org.springframework.data.mongodb.core.mapping.Document;
5
+
6
+ @Document(collection = "appointments")
7
+ public class Appointment {
8
+
9
+ @Id
10
+ private String id;
11
+ private String patientName;
12
+ private String doctorName;
13
+ private String department;
14
+ private String appointmentDate;
15
+ private String status;
16
+ private double consultationFee;
17
+
18
+ public Appointment() {
19
+ }
20
+
21
+ public Appointment(String patientName, String doctorName, String department, String appointmentDate, String status, double consultationFee) {
22
+ this.patientName = patientName;
23
+ this.doctorName = doctorName;
24
+ this.department = department;
25
+ this.appointmentDate = appointmentDate;
26
+ this.status = status;
27
+ this.consultationFee = consultationFee;
28
+ }
29
+
30
+ public Appointment(String id, String patientName, String doctorName, String department, String appointmentDate, String status, double consultationFee) {
31
+ this.id = id;
32
+ this.patientName = patientName;
33
+ this.doctorName = doctorName;
34
+ this.department = department;
35
+ this.appointmentDate = appointmentDate;
36
+ this.status = status;
37
+ this.consultationFee = consultationFee;
38
+ }
39
+
40
+ public String getId() {
41
+ return id;
42
+ }
43
+
44
+ public void setId(String id) {
45
+ this.id = id;
46
+ }
47
+
48
+ public String getPatientName() {
49
+ return patientName;
50
+ }
51
+
52
+ public void setPatientName(String patientName) {
53
+ this.patientName = patientName;
54
+ }
55
+
56
+ public String getDoctorName() {
57
+ return doctorName;
58
+ }
59
+
60
+ public void setDoctorName(String doctorName) {
61
+ this.doctorName = doctorName;
62
+ }
63
+
64
+ public String getDepartment() {
65
+ return department;
66
+ }
67
+
68
+ public void setDepartment(String department) {
69
+ this.department = department;
70
+ }
71
+
72
+ public String getAppointmentDate() {
73
+ return appointmentDate;
74
+ }
75
+
76
+ public void setAppointmentDate(String appointmentDate) {
77
+ this.appointmentDate = appointmentDate;
78
+ }
79
+
80
+ public String getStatus() {
81
+ return status;
82
+ }
83
+
84
+ public void setStatus(String status) {
85
+ this.status = status;
86
+ }
87
+
88
+ public double getConsultationFee() {
89
+ return consultationFee;
90
+ }
91
+
92
+ public void setConsultationFee(double consultationFee) {
93
+ this.consultationFee = consultationFee;
94
+ }
95
+ }
@@ -0,0 +1,15 @@
1
+ package com.example.hospital.repository;
2
+
3
+ import com.example.hospital.model.Appointment;
4
+ import org.springframework.data.mongodb.repository.MongoRepository;
5
+ import org.springframework.stereotype.Repository;
6
+
7
+ import java.util.List;
8
+
9
+ @Repository
10
+ public interface AppointmentRepository extends MongoRepository<Appointment, String> {
11
+
12
+ List<Appointment> findByDoctorName(String doctorName);
13
+
14
+ List<Appointment> findByStatus(String status);
15
+ }
@@ -0,0 +1,54 @@
1
+ package com.example.hospital.service;
2
+
3
+ import com.example.hospital.model.Appointment;
4
+ import com.example.hospital.repository.AppointmentRepository;
5
+ import org.springframework.beans.factory.annotation.Autowired;
6
+ import org.springframework.stereotype.Service;
7
+
8
+ import java.util.List;
9
+
10
+ @Service
11
+ public class HospitalService {
12
+
13
+ @Autowired
14
+ private AppointmentRepository appointmentRepository;
15
+
16
+ public List<Appointment> getAllAppointments() {
17
+ return appointmentRepository.findAll();
18
+ }
19
+
20
+ public Appointment getAppointmentById(String id) {
21
+ return appointmentRepository.findById(id).orElse(null);
22
+ }
23
+
24
+ public Appointment bookAppointment(Appointment appointment) {
25
+ if (appointment.getId() != null && appointment.getId().trim().isEmpty()) {
26
+ appointment.setId(null);
27
+ }
28
+ if (appointment.getStatus() == null || appointment.getStatus().trim().isEmpty()) {
29
+ appointment.setStatus("PENDING");
30
+ }
31
+ return appointmentRepository.save(appointment);
32
+ }
33
+
34
+ public Appointment updateStatus(String id, String status) {
35
+ Appointment appointment = appointmentRepository.findById(id).orElse(null);
36
+ if (appointment != null) {
37
+ appointment.setStatus(status);
38
+ return appointmentRepository.save(appointment);
39
+ }
40
+ return null;
41
+ }
42
+
43
+ public void cancelAppointment(String id) {
44
+ appointmentRepository.deleteById(id);
45
+ }
46
+
47
+ public List<Appointment> getAppointmentsByDoctorName(String doctorName) {
48
+ return appointmentRepository.findByDoctorName(doctorName);
49
+ }
50
+
51
+ public List<Appointment> getAppointmentsByStatus(String status) {
52
+ return appointmentRepository.findByStatus(status);
53
+ }
54
+ }
@@ -0,0 +1,3 @@
1
+ spring.data.mongodb.uri=mongodb://localhost:27017/hospital_db
2
+ spring.data.mongodb.database=hospital_db
3
+ server.port=8080
@@ -0,0 +1,12 @@
1
+ package com.example.hospital;
2
+
3
+ import org.junit.jupiter.api.Test;
4
+ import org.springframework.boot.test.context.SpringBootTest;
5
+
6
+ @SpringBootTest
7
+ class HospitalApplicationTests {
8
+
9
+ @Test
10
+ void contextLoads() {
11
+ }
12
+ }
@@ -0,0 +1,3 @@
1
+ wrapperVersion=3.3.4
2
+ distributionType=only-script
3
+ distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.10.0/apache-maven-3.10.0-bin.zip