Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
HIAST-Clinics
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
almohanad.hafez
HIAST-Clinics
Commits
56077e5a
Commit
56077e5a
authored
Aug 16, 2024
by
Almouhannad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(B) Update PatientMedicine, PatientDisease entities
parent
4b6e6961
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
3 deletions
+99
-3
Patient.cs
Clinics.Backend/Domain/Entities/People/Patients/Patient.cs
+43
-1
PatientDisease.cs
...ople/Patients/Relations/PatientDiseases/PatientDisease.cs
+26
-1
PatientMedicine.cs
...le/Patients/Relations/PatientMedicines/PatientMedicine.cs
+30
-1
No files found.
Clinics.Backend/Domain/Entities/People/Patients/Patient.cs
View file @
56077e5a
using
Domain.Entities.People.Patients.Relations.PatientDiseases
;
using
Domain.Entities.Medicals.Diseases
;
using
Domain.Entities.Medicals.Medicines
;
using
Domain.Entities.People.Patients.Relations.PatientDiseases
;
using
Domain.Entities.People.Patients.Relations.PatientMedicines
;
using
Domain.Entities.People.Shared
;
using
Domain.Entities.People.Shared.GenderValues
;
...
...
@@ -104,6 +106,46 @@ public sealed class Patient : Entity
}
#
endregion
#
region
Add
medicine
public
void
AddMedicine
(
Medicine
medicine
,
int
number
)
{
PatientMedicine
entry
;
try
{
entry
=
PatientMedicine
.
Create
(
Id
,
medicine
.
Id
,
number
);
}
catch
{
throw
;
}
if
(
Medicines
is
null
)
Medicines
=
[];
Medicines
.
Add
(
entry
);
}
#
endregion
#
region
Add
disease
public
void
AddDisease
(
Disease
disease
)
{
PatientDisease
entry
;
try
{
entry
=
PatientDisease
.
Create
(
Id
,
disease
.
Id
);
}
catch
{
throw
;
}
if
(
Diseases
is
null
)
Diseases
=
[];
Diseases
.
Add
(
entry
);
}
#
endregion
#
endregion
}
Clinics.Backend/Domain/Entities/People/Patients/Relations/PatientDiseases/PatientDisease.cs
View file @
56077e5a
using
Domain.Entities.Medicals.Diseases
;
using
Domain.Exceptions.InvalidValue
;
using
Domain.Primitives
;
namespace
Domain.Entities.People.Patients.Relations.PatientDiseases
;
public
sealed
class
PatientDisease
(
int
id
)
:
Entity
(
id
)
public
sealed
class
PatientDisease
:
Entity
{
#
region
Private
ctor
private
PatientDisease
(
int
id
)
:
base
(
id
)
{
}
private
PatientDisease
(
int
id
,
int
patientId
,
int
diseaseId
)
:
base
(
id
)
{
PatientId
=
patientId
;
DiseaseId
=
diseaseId
;
}
#
endregion
#
region
Properties
...
...
@@ -27,4 +39,17 @@ public sealed class PatientDisease(int id) : Entity(id)
#
endregion
#
endregion
#
region
Methods
#
region
Static
factory
public
static
PatientDisease
Create
(
int
patientId
,
int
diseaseId
)
{
if
(
patientId
<=
0
||
diseaseId
<=
0
)
throw
new
InvalidValuesDomainException
<
PatientDisease
>();
return
new
PatientDisease
(
0
,
patientId
,
diseaseId
);
}
#
endregion
#
endregion
}
Clinics.Backend/Domain/Entities/People/Patients/Relations/PatientMedicines/PatientMedicine.cs
View file @
56077e5a
using
Domain.Entities.Medicals.Medicines
;
using
Domain.Exceptions.InvalidValue
;
using
Domain.Primitives
;
namespace
Domain.Entities.People.Patients.Relations.PatientMedicines
;
public
sealed
class
PatientMedicine
(
int
id
)
:
Entity
(
id
)
public
sealed
class
PatientMedicine
:
Entity
{
#
region
Private
ctor
private
PatientMedicine
(
int
id
)
:
base
(
id
)
{
}
private
PatientMedicine
(
int
id
,
int
patientId
,
int
medicineId
,
int
number
)
:
base
(
id
)
{
PatientId
=
patientId
;
MedicineId
=
medicineId
;
Number
=
number
;
}
#
endregion
#
region
Properties
#
region
Patient
...
...
@@ -28,5 +44,18 @@ public sealed class PatientMedicine(int id) : Entity(id)
#
endregion
#
endregion
#
region
Methods
#
region
Static
factory
public
static
PatientMedicine
Create
(
int
patientId
,
int
medicineId
,
int
number
)
{
if
(
patientId
<=
0
||
medicineId
<=
0
||
number
<=
0
)
throw
new
InvalidValuesDomainException
<
PatientMedicine
>();
return
new
PatientMedicine
(
0
,
patientId
,
medicineId
,
number
);
}
#
endregion
#
endregion
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment