Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
s7_bekman_i
Homework02
Commits
1c6e0f74
Commit
1c6e0f74
authored
May 17, 2020
by
IevaBekmane
Browse files
First commit
parent
d5b6639c
Pipeline
#1130
failed with stages
Changes
30
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
394 additions
and
351 deletions
+394
-351
.mvn/wrapper/MavenWrapperDownloader.java
.mvn/wrapper/MavenWrapperDownloader.java
+0
-117
.mvn/wrapper/maven-wrapper.jar
.mvn/wrapper/maven-wrapper.jar
+0
-0
.mvn/wrapper/maven-wrapper.properties
.mvn/wrapper/maven-wrapper.properties
+0
-2
pom.xml
pom.xml
+5
-0
src/main/java/lv/venta/demo/controllers/HospitalController.java
...in/java/lv/venta/demo/controllers/HospitalController.java
+81
-49
src/main/java/lv/venta/demo/models/Appointment.java
src/main/java/lv/venta/demo/models/Appointment.java
+15
-7
src/main/java/lv/venta/demo/models/Doctor.java
src/main/java/lv/venta/demo/models/Doctor.java
+45
-60
src/main/java/lv/venta/demo/models/Patient.java
src/main/java/lv/venta/demo/models/Patient.java
+27
-44
src/main/java/lv/venta/demo/models/User.java
src/main/java/lv/venta/demo/models/User.java
+9
-3
src/main/java/lv/venta/demo/repos/IAppointmentRepo.java
src/main/java/lv/venta/demo/repos/IAppointmentRepo.java
+8
-0
src/main/java/lv/venta/demo/repos/IDoctorRepo.java
src/main/java/lv/venta/demo/repos/IDoctorRepo.java
+5
-1
src/main/java/lv/venta/demo/repos/IPatientRepo.java
src/main/java/lv/venta/demo/repos/IPatientRepo.java
+5
-1
src/main/java/lv/venta/demo/repos/IUserRepo.java
src/main/java/lv/venta/demo/repos/IUserRepo.java
+2
-0
src/main/java/lv/venta/demo/services/IHospitalService.java
src/main/java/lv/venta/demo/services/IHospitalService.java
+22
-0
src/main/java/lv/venta/demo/services/IPatientService.java
src/main/java/lv/venta/demo/services/IPatientService.java
+0
-6
src/main/java/lv/venta/demo/services/IUserService.java
src/main/java/lv/venta/demo/services/IUserService.java
+0
-6
src/main/java/lv/venta/demo/services/impl/HospitalServiceImpl.java
...java/lv/venta/demo/services/impl/HospitalServiceImpl.java
+169
-0
src/main/java/lv/venta/demo/services/impl/PatientServiceImpl.java
.../java/lv/venta/demo/services/impl/PatientServiceImpl.java
+0
-34
src/main/java/lv/venta/demo/services/impl/UserServiceImpl.java
...ain/java/lv/venta/demo/services/impl/UserServiceImpl.java
+0
-21
src/main/resources/application.properties
src/main/resources/application.properties
+1
-0
No files found.
.mvn/wrapper/MavenWrapperDownloader.java
deleted
100644 → 0
View file @
d5b6639c
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
java.net.*
;
import
java.io.*
;
import
java.nio.channels.*
;
import
java.util.Properties
;
public
class
MavenWrapperDownloader
{
private
static
final
String
WRAPPER_VERSION
=
"0.5.6"
;
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private
static
final
String
DEFAULT_DOWNLOAD_URL
=
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+
WRAPPER_VERSION
+
"/maven-wrapper-"
+
WRAPPER_VERSION
+
".jar"
;
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private
static
final
String
MAVEN_WRAPPER_PROPERTIES_PATH
=
".mvn/wrapper/maven-wrapper.properties"
;
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private
static
final
String
MAVEN_WRAPPER_JAR_PATH
=
".mvn/wrapper/maven-wrapper.jar"
;
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private
static
final
String
PROPERTY_NAME_WRAPPER_URL
=
"wrapperUrl"
;
public
static
void
main
(
String
args
[])
{
System
.
out
.
println
(
"- Downloader started"
);
File
baseDirectory
=
new
File
(
args
[
0
]);
System
.
out
.
println
(
"- Using base directory: "
+
baseDirectory
.
getAbsolutePath
());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File
mavenWrapperPropertyFile
=
new
File
(
baseDirectory
,
MAVEN_WRAPPER_PROPERTIES_PATH
);
String
url
=
DEFAULT_DOWNLOAD_URL
;
if
(
mavenWrapperPropertyFile
.
exists
())
{
FileInputStream
mavenWrapperPropertyFileInputStream
=
null
;
try
{
mavenWrapperPropertyFileInputStream
=
new
FileInputStream
(
mavenWrapperPropertyFile
);
Properties
mavenWrapperProperties
=
new
Properties
();
mavenWrapperProperties
.
load
(
mavenWrapperPropertyFileInputStream
);
url
=
mavenWrapperProperties
.
getProperty
(
PROPERTY_NAME_WRAPPER_URL
,
url
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"- ERROR loading '"
+
MAVEN_WRAPPER_PROPERTIES_PATH
+
"'"
);
}
finally
{
try
{
if
(
mavenWrapperPropertyFileInputStream
!=
null
)
{
mavenWrapperPropertyFileInputStream
.
close
();
}
}
catch
(
IOException
e
)
{
// Ignore ...
}
}
}
System
.
out
.
println
(
"- Downloading from: "
+
url
);
File
outputFile
=
new
File
(
baseDirectory
.
getAbsolutePath
(),
MAVEN_WRAPPER_JAR_PATH
);
if
(!
outputFile
.
getParentFile
().
exists
())
{
if
(!
outputFile
.
getParentFile
().
mkdirs
())
{
System
.
out
.
println
(
"- ERROR creating output directory '"
+
outputFile
.
getParentFile
().
getAbsolutePath
()
+
"'"
);
}
}
System
.
out
.
println
(
"- Downloading to: "
+
outputFile
.
getAbsolutePath
());
try
{
downloadFileFromURL
(
url
,
outputFile
);
System
.
out
.
println
(
"Done"
);
System
.
exit
(
0
);
}
catch
(
Throwable
e
)
{
System
.
out
.
println
(
"- Error downloading"
);
e
.
printStackTrace
();
System
.
exit
(
1
);
}
}
private
static
void
downloadFileFromURL
(
String
urlString
,
File
destination
)
throws
Exception
{
if
(
System
.
getenv
(
"MVNW_USERNAME"
)
!=
null
&&
System
.
getenv
(
"MVNW_PASSWORD"
)
!=
null
)
{
String
username
=
System
.
getenv
(
"MVNW_USERNAME"
);
char
[]
password
=
System
.
getenv
(
"MVNW_PASSWORD"
).
toCharArray
();
Authenticator
.
setDefault
(
new
Authenticator
()
{
@Override
protected
PasswordAuthentication
getPasswordAuthentication
()
{
return
new
PasswordAuthentication
(
username
,
password
);
}
});
}
URL
website
=
new
URL
(
urlString
);
ReadableByteChannel
rbc
;
rbc
=
Channels
.
newChannel
(
website
.
openStream
());
FileOutputStream
fos
=
new
FileOutputStream
(
destination
);
fos
.
getChannel
().
transferFrom
(
rbc
,
0
,
Long
.
MAX_VALUE
);
fos
.
close
();
rbc
.
close
();
}
}
.mvn/wrapper/maven-wrapper.jar
deleted
100644 → 0
View file @
d5b6639c
File deleted
.mvn/wrapper/maven-wrapper.properties
deleted
100644 → 0
View file @
d5b6639c
distributionUrl
=
https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl
=
https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
pom.xml
View file @
1c6e0f74
...
...
@@ -35,6 +35,11 @@
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-devtools
</artifactId>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
...
...
src/main/java/lv/venta/demo/controllers/HospitalController.java
View file @
1c6e0f74
package
lv.venta.demo.controllers
;
import
javax.validation.Valid
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
lv.venta.demo.models.Appointment
;
import
lv.venta.demo.models.Doctor
;
import
lv.venta.demo.models.Patient
;
import
lv.venta.demo.models.User
;
import
lv.venta.demo.services.impl.HospitalServiceImpl
;
@Controller
@RequestMapping
(
value
=
"/hospital"
)
public
class
HospitalController
{
@Autowired
HospitalServiceImpl
hospitalServiceImpl
;
@GetMapping
(
value
=
"/dummyDataInput"
)
@GetMapping
(
"/main"
)
public
String
main
()
{
return
"main"
;
}
@GetMapping
(
"/dummydatainput"
)
public
String
callInputDataService
()
{
return
""
;
hospitalServiceImpl
.
dataInput
();
return
"
ok
"
;
}
@GetMapping
(
value
=
"/show
A
ll
D
octors"
)
@GetMapping
(
"/show
a
ll
d
octors"
)
public
String
showAllDoctorsInHospital
(
Model
model
)
{
return
""
;
model
.
addAttribute
(
"doctor"
,
hospitalServiceImpl
.
selectAllDoctors
());
return
"
showalldoctors
"
;
}
@GetMapping
(
value
=
"/show
A
ll
P
atients"
)
@GetMapping
(
"/show
a
ll
p
atients"
)
public
String
showAllPatientsInHospital
(
Model
model
)
{
return
""
;
model
.
addAttribute
(
"patient"
,
hospitalServiceImpl
.
selectAllPatients
());
return
"showallpatients"
;
}
@GetMapping
(
"/showallappointments"
)
public
String
showAllAppointmentsInHospital
(
Model
model
)
{
model
.
addAttribute
(
"appointment"
,
hospitalServiceImpl
.
selectAllAppointments
());
return
"showallappointments"
;
}
@GetMapping
(
value
=
"/insert
N
ew
P
atient"
)
@GetMapping
(
"/insert
n
ew
p
atient"
)
public
String
insertNewPatientGet
(
Patient
patient
)
{
return
""
;
return
"insertnewpatient"
;
}
@PostMapping
(
value
=
"/insertNewPatient"
)
public
String
insertNewPatientPost
()
{
return
""
;
@PostMapping
(
"/insertnewpatient"
)
public
String
insertNewPatientPost
(
@Valid
Patient
patient
,
BindingResult
result
)
{
System
.
out
.
println
(
patient
);
if
(
hospitalServiceImpl
.
insertNewPatientByObject
(
patient
))
{
return
"redirect:/showallpatients"
;
}
else
{
return
"insertnewpatient"
;
}
}
@GetMapping
(
value
=
"/insert
N
ew
D
octor"
)
@GetMapping
(
"/insert
n
ew
d
octor"
)
public
String
insertNewDoctorGet
(
Doctor
doctor
)
{
return
""
;
return
"insertnewdoctor"
;
}
@PostMapping
(
value
=
"/insertNewDoctor"
)
public
String
insertNewDoctorPost
()
{
return
""
;
@PostMapping
(
"/insertnewdoctor"
)
public
String
insertNewDoctorPost
(
@Valid
Doctor
doctor
)
{
System
.
out
.
println
(
doctor
);
if
(
hospitalServiceImpl
.
insertNewDoctorByObject
(
doctor
))
{
return
"redirect:/showalldoctors"
;
}
else
{
return
"insertnewdoctor"
;
}
}
@GetMapping
(
value
=
"/autorise"
)
public
String
autoriseGet
()
{
return
""
;
@GetMapping
(
"/authorise"
)
public
String
authoriseGet
(
User
user
)
{
return
"authorise"
;
}
@PostMapping
(
value
=
"/autorise"
)
public
String
autorisePost
()
{
return
""
;
@PostMapping
(
"/authorise"
)
public
String
authorisePost
(
User
user
,
BindingResult
result
)
{
if
(
hospitalServiceImpl
.
authorise
(
user
)
&&
!
result
.
hasErrors
())
{
return
"redirect:/main"
;
}
return
"authorise"
;
}
@GetMapping
(
value
=
"/insert
N
ew
A
ppointment"
)
@GetMapping
(
"/insert
n
ew
a
ppointment"
)
public
String
insertNewAppointmentGet
(
Appointment
app
)
{
return
""
;
return
"insertnewappointment"
;
}
@PostMapping
(
value
=
"/insertNewAppointment"
)
public
String
insertNewAppointmentPost
()
{
return
""
;
@PostMapping
(
"/insertnewappointment"
)
public
String
insertNewAppointmentPost
(
@Valid
Appointment
app
,
BindingResult
result
)
{
System
.
out
.
println
(
app
);
if
(
hospitalServiceImpl
.
insertNewAppointmant
(
app
)
&&
!
result
.
hasErrors
())
{
return
"redirect:/showalldoctors"
;
}
else
{
return
"insertnewappointment"
;
}
}
@GetMapping
(
value
=
"/show
A
ll
A
ppointments
ByP
atient/{id}"
)
public
String
showAllAppointmentsByPatient
(
Model
model
)
{
return
""
;
@GetMapping
(
"/show
a
ll
a
ppointments
byp
atient/{id}"
)
public
String
showAllAppointmentsByPatient
(
Model
model
,
@PathVariable
(
name
=
"id"
)
int
id
)
{
model
.
addAttribute
(
"allapp"
,
hospitalServiceImpl
.
showAllAppointmentsByPatientId
(
id
));
return
"
showallappointmentsbyid
"
;
}
@GetMapping
(
value
=
"/show
A
ll
A
ppointments
ByD
octor/{id}"
)
public
String
showAllAppointmentsByDoctor
(
Model
model
)
{
return
""
;
@GetMapping
(
"/show
a
ll
a
ppointments
byd
octor/{id}"
)
public
String
showAllAppointmentsByDoctor
(
Model
model
,
@PathVariable
(
name
=
"id"
)
int
id
)
{
model
.
addAttribute
(
"alldoc"
,
hospitalServiceImpl
.
showAllAppointmentsByDoctorId
(
id
));
return
"
showallappointmentsbyid
"
;
}
@GetMapping
(
value
=
"/show
A
ll
A
ppointments
ByD
octor
T
oday/{id}"
)
@GetMapping
(
"/show
a
ll
a
ppointments
byd
octor
t
oday/{id}"
)
public
String
showAllAppointmentsByDoctorToday
(
Model
model
)
{
return
""
;
...
...
src/main/java/lv/venta/demo/models/Appointment.java
View file @
1c6e0f74
...
...
@@ -4,14 +4,19 @@ import java.util.Date;
import
javax.persistence.CascadeType
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
javax.validation.constraints.Size
;
import
org.springframework.format.annotation.DateTimeFormat
;
@Entity
@Table
(
name
=
"AppointmentTable"
)
public
class
Appointment
{
@Id
...
...
@@ -19,7 +24,7 @@ public class Appointment {
@Column
(
name
=
"AppointmentID"
)
private
int
appId
;
@DateTimeFormat
(
pattern
=
"
yyyy-MM-dd HH
:mm"
)
//
@DateTimeFormat(pattern = "
dd-MM-yyyy hh
:mm")
@Column
(
name
=
"DateAndTime"
)
private
Date
date
;
...
...
@@ -28,11 +33,11 @@ public class Appointment {
private
String
description
;
@ManyToOne
(
cascade
=
CascadeType
.
ALL
)
@Column
(
name
=
"PatientID"
)
@
Join
Column
(
name
=
"PatientID"
)
private
Patient
patient
;
@ManyToOne
(
cascade
=
CascadeType
.
ALL
)
@Column
(
name
=
"DoctorID"
)
@
Join
Column
(
name
=
"DoctorID"
)
private
Doctor
doctor
;
public
int
getAppId
()
{
...
...
@@ -64,12 +69,15 @@ public class Appointment {
}
public
void
setDoctor
(
Doctor
doctor
)
{
this
.
doctor
=
doctor
;
}
public
Appointment
()
{
}
public
Appointment
(
Date
date
,
String
description
,
Patient
patient
,
Doctor
doctor
)
{
setDate
(
date
)
;
setD
escription
(
description
)
;
setPatient
(
patient
)
;
setDoctor
(
doctor
)
;
this
.
date
=
date
;
this
.
d
escription
=
description
;
this
.
doctor
=
doctor
;
this
.
patient
=
patient
;
}
@Override
public
String
toString
()
{
...
...
src/main/java/lv/venta/demo/models/Doctor.java
View file @
1c6e0f74
package
lv.venta.demo.models
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
javax.persistence.Column
;
...
...
@@ -12,54 +11,51 @@ import javax.persistence.JoinColumn;
import
javax.persistence.OneToMany
;
import
javax.persistence.OneToOne
;
import
javax.persistence.Table
;
import
javax.validation.constraints.Max
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.Pattern
;
import
javax.validation.constraints.Size
;
import
lv.venta.demo.enums.Gender
;
import
lv.venta.demo.enums.Nationality
;
import
lv.venta.demo.enums.Speciality
;
@Entity
@Table
(
name
=
"Docto
r
Table"
)
@Table
(
name
=
"Docto
t
Table"
)
public
class
Doctor
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
@Column
(
name
=
"
D
octorID"
)
p
rivate
int
doctorI
d
;
@Column
(
name
=
"
d
octorID"
)
p
ublic
int
doctorI
D
;
@Column
(
name
=
"
n
ame"
)
@Column
(
name
=
"
N
ame"
)
@Size
(
min
=
3
,
max
=
30
)
@Pattern
(
regexp
=
"[a-zA-Z\\s]+$"
)
p
rivate
String
name
;
p
ublic
String
name
;
@Column
(
name
=
"Surname"
)
@Size
(
min
=
3
,
max
=
30
)
@Pattern
(
regexp
=
"[a-zA-Z\\s]+$"
)
p
rivate
String
surname
;
p
ublic
String
surname
;
@Column
(
name
=
"Identificator"
)
private
int
[]
identificator
;
@Column
(
name
=
"Gender"
)
private
Gender
gender
;
@Column
(
name
=
"Nationality"
)
private
Nationality
nationality
;
@Size
(
min
=
11
,
max
=
11
)
@Pattern
(
regexp
=
"\\d+"
)
@Column
(
name
=
"IdentificationNum"
)
public
String
identificationNum
;
@Column
(
name
=
"Speciality"
)
p
rivate
Speciality
speciality
;
p
ublic
Speciality
speciality
;
@Column
(
name
=
"Office Number"
)
@Size
(
min
=
100
,
max
=
1000
)
private
short
officeNum
;
@Min
(
value
=
100
)
@Max
(
value
=
1000
)
@Column
(
name
=
"OfficeNumber"
)
public
int
officeNum
;
@OneToMany
(
mappedBy
=
"doctor"
)
private
Collection
<
Doctor
>
a
ppointmentsForDoctor
;
private
Collection
<
Appointment
>
allA
ppointmentsForDoctor
;
@OneToOne
@JoinColumn
(
name
=
"UserID"
)
private
User
u
ser
;
private
User
doctorU
ser
;
public
String
getName
()
{
return
name
;
...
...
@@ -73,56 +69,45 @@ public class Doctor {
public
void
setSurname
(
String
surname
)
{
this
.
surname
=
surname
;
}
public
int
[]
getIdentificator
()
{
return
identificator
;
}
public
void
setIdentificator
(
int
[]
identificator
)
{
this
.
identificator
=
identificator
;
public
String
getIdentificationNum
()
{
return
identificationNum
;
}
public
Gender
getGender
(
)
{
return
gender
;
public
void
setIdentificationNum
(
String
identificationNum
)
{
this
.
identificationNum
=
identificationNum
;
}
public
void
setGender
(
Gender
gender
)
{
this
.
gender
=
gender
;
}
public
Nationality
getNationality
()
{
return
nationality
;
public
Speciality
getSpeciality
()
{
return
speciality
;
}
public
void
set
Nationality
(
Nationality
nation
ality
)
{
this
.
nation
ality
=
nation
ality
;
public
void
set
Speciality
(
Speciality
speci
ality
)
{
this
.
speci
ality
=
speci
ality
;
}
public
shor
t
getOfficeNum
()
{
public
in
t
getOfficeNum
()
{
return
officeNum
;
}
public
void
setOfficeNum
(
shor
t
officeNum
)
{
public
void
setOfficeNum
(
in
t
officeNum
)
{
this
.
officeNum
=
officeNum
;
}
public
Speciality
getSpeciality
()
{
return
speciality
;
}
public
void
setSpeciality
(
Speciality
speciality
)
{
this
.
speciality
=
speciality
;
public
int
getDoctorID
()
{
return
doctorID
;
}
public
int
getDoctor
Id
()
{
return
doctor
Id
;
public
User
getDoctor
User
()
{
return
doctor
User
;
}
public
void
setDoctorId
(
int
doctprId
)
{
this
.
doctorId
=
doctprId
;
public
Doctor
(
String
name
,
String
surname
,
String
identificationNum
,
Speciality
speciality
,
int
officeNum
,
User
doctorUser
)
{
this
.
name
=
name
;
this
.
surname
=
surname
;
this
.
identificationNum
=
identificationNum
;
this
.
speciality
=
speciality
;
this
.
officeNum
=
officeNum
;
this
.
doctorUser
=
doctorUser
;
}
public
Doctor
(
String
name
,
String
surname
,
int
[]
identificator
,
Gender
gender
,
Nationality
nationality
,
Speciality
speciality
,
short
officeNum
)
{
setName
(
name
);
setSurname
(
surname
);
setIdentificator
(
identificator
);
setGender
(
gender
);
setNationality
(
nationality
);
setSpeciality
(
speciality
);
setOfficeNum
(
officeNum
);
public
Doctor
()
{
}
@Override
public
String
toString
()
{
return
"Doctor: "
+
name
+
" "
+
surname
+
", Identificator: "
+
Arrays
.
toString
(
identificator
)
+
", Gender: "
+
gender
+
", Nationality: "
+
nationality
+
", Speciality: "
+
speciality
+
", Office Number: "
+
officeNum
+
", ID: "
+
doctorId
;
return
"Doctor: "
+
name
+
", "
+
surname
+
", ID: "
+
doctorID
+
", Identification Number: "
+
identificationNum
+
", Speciality: "
+
speciality
+
", Office Number: "
+
officeNum
+
"|"
;
}
}
src/main/java/lv/venta/demo/models/Patient.java
View file @
1c6e0f74
package
lv.venta.demo.models
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
javax.persistence.Column
;
...
...
@@ -37,8 +36,10 @@ public class Patient {
@Pattern
(
regexp
=
"[a-zA-Z\\s]+$"
)
private
String
surname
;
@Column
(
name
=
"Identificator"
)
private
int
[]
identificator
;
@Size
(
min
=
11
,
max
=
11
)
@Pattern
(
regexp
=
"\\d+"
)
@Column
(
name
=
"IdentificationNum"
)
private
String
identificationNum
;
@Column
(
name
=
"Gender"
)
private
Gender
gender
;
...
...
@@ -46,15 +47,12 @@ public class Patient {
@Column
(
name
=
"Nationality"
)
private
Nationality
nationality
;
@Column
(
name
=
"isHospitalised"
)
private
boolean
isHospitalised
;
@OneToMany
(
mappedBy
=
"patient"
)
private
Collection
<
Appointment
>
appointmentsForPatient
;
@OneToOne
@JoinColumn
(
name
=
"UserID"
)
private
User
u
ser
;
private
User
patientU
ser
;
public
String
getName
()
{
return
name
;
...
...
@@ -68,11 +66,11 @@ public class Patient {
public
void
setSurname
(
String
surname
)
{
this
.
surname
=
surname
;
}
public
int
[]
getIdentificat
or
()
{
return
identificat
or
;
public
String
getIdentificat
ionNum
()
{
return
identificat
ionNum
;
}
public
void
setIdentificat
or
(
int
[]
identificat
or
)
{
this
.
identificat
or
=
identificat
or
;
public
void
setIdentificat
ionNum
(
String
identificat
ionNum
)
{