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
12973dd0
Commit
12973dd0
authored
Aug 16, 2024
by
Almouhannad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(B) Update medical related entities
parent
56b44861
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
184 additions
and
12 deletions
+184
-12
Disease.cs
Clinics.Backend/Domain/Entities/Medicals/Diseases/Disease.cs
+25
-1
Hospital.cs
...cs.Backend/Domain/Entities/Medicals/Hospitals/Hospital.cs
+27
-2
MedicalImage.cs
...nd/Domain/Entities/Medicals/MedicalImages/MedicalImage.cs
+26
-2
MedicalTest.cs
...kend/Domain/Entities/Medicals/MedicalTests/MedicalTest.cs
+26
-2
Medicine.cs
...cs.Backend/Domain/Entities/Medicals/Medicines/Medicine.cs
+45
-1
MedicineForm.cs
...ies/Medicals/Medicines/MedicineFormValues/MedicineForm.cs
+33
-2
MedicineForms.cs
...es/Medicals/Medicines/MedicineFormValues/MedicineForms.cs
+2
-2
No files found.
Clinics.Backend/Domain/Entities/Medicals/Diseases/Disease.cs
View file @
12973dd0
using
Domain.Entities.People.Patients.Relations.PatientDiseases
;
using
Domain.Entities.People.Patients.Relations.PatientDiseases
;
using
Domain.Exceptions.InvalidValue
;
using
Domain.Primitives
;
using
Domain.Primitives
;
namespace
Domain.Entities.Medicals.Diseases
;
namespace
Domain.Entities.Medicals.Diseases
;
public
sealed
class
Disease
(
int
id
)
:
Entity
(
id
)
public
sealed
class
Disease
:
Entity
{
{
#
region
Private
ctor
private
Disease
(
int
id
)
:
base
(
id
)
{
}
private
Disease
(
int
id
,
string
name
)
:
base
(
id
)
{
Name
=
name
;
}
#
endregion
#
region
Properties
#
region
Properties
public
string
Name
{
get
;
set
;
}
=
null
!;
public
string
Name
{
get
;
set
;
}
=
null
!;
...
@@ -16,4 +27,17 @@ public sealed class Disease(int id) : Entity(id)
...
@@ -16,4 +27,17 @@ public sealed class Disease(int id) : Entity(id)
#
endregion
#
endregion
#
endregion
#
endregion
#
region
Methods
#
region
Static
factory
public
static
Disease
Create
(
string
name
)
{
if
(
name
is
null
)
throw
new
InvalidValuesDomainException
<
Disease
>();
return
new
Disease
(
0
,
name
);
}
#
endregion
#
endregion
}
}
Clinics.Backend/Domain/Entities/Medicals/Hospitals/Hospital.cs
View file @
12973dd0
using
Domain.Primitives
;
using
Domain.Exceptions.InvalidValue
;
using
Domain.Primitives
;
namespace
Domain.Entities.Medicals.Hospitals
;
namespace
Domain.Entities.Medicals.Hospitals
;
public
sealed
class
Hospital
(
int
id
)
:
Entity
(
id
)
public
sealed
class
Hospital
:
Entity
{
{
#
region
Private
ctor
private
Hospital
(
int
id
)
:
base
(
id
)
{
}
private
Hospital
(
int
id
,
string
name
)
:
base
(
id
)
{
Name
=
name
;
}
#
endregion
#
region
Properties
#
region
Properties
public
string
Name
{
get
;
set
;
}
=
null
!;
public
string
Name
{
get
;
set
;
}
=
null
!;
#
endregion
#
endregion
#
region
Methods
#
region
Static
factory
public
static
Hospital
Create
(
string
name
)
{
if
(
name
is
null
)
throw
new
InvalidValuesDomainException
<
Hospital
>();
return
new
Hospital
(
0
,
name
);
}
#
endregion
#
endregion
}
}
Clinics.Backend/Domain/Entities/Medicals/MedicalImages/MedicalImage.cs
View file @
12973dd0
using
Domain.Primitives
;
using
Domain.Exceptions.InvalidValue
;
using
Domain.Primitives
;
namespace
Domain.Entities.Medicals.MedicalImages
;
namespace
Domain.Entities.Medicals.MedicalImages
;
public
sealed
class
MedicalImage
(
int
id
)
:
Entity
(
id
)
public
sealed
class
MedicalImage
:
Entity
{
{
#
region
Private
ctor
private
MedicalImage
(
int
id
)
:
base
(
id
)
{
}
private
MedicalImage
(
int
id
,
string
name
,
string
?
description
=
null
)
:
base
(
id
)
{
Name
=
name
;
Description
=
description
;
}
#
endregion
#
region
Properties
#
region
Properties
public
string
Name
{
get
;
set
;
}
=
null
!;
public
string
Name
{
get
;
set
;
}
=
null
!;
...
@@ -11,4 +22,17 @@ public sealed class MedicalImage(int id) : Entity(id)
...
@@ -11,4 +22,17 @@ public sealed class MedicalImage(int id) : Entity(id)
public
string
?
Description
{
get
;
set
;
}
public
string
?
Description
{
get
;
set
;
}
#
endregion
#
endregion
#
region
Methods
#
region
Static
factory
public
static
MedicalImage
Create
(
string
name
,
string
?
description
=
null
)
{
if
(
name
is
null
)
throw
new
InvalidValuesDomainException
<
MedicalImage
>();
return
new
MedicalImage
(
0
,
name
,
description
);
}
#
endregion
#
endregion
}
}
Clinics.Backend/Domain/Entities/Medicals/MedicalTests/MedicalTest.cs
View file @
12973dd0
using
Domain.Primitives
;
using
Domain.Exceptions.InvalidValue
;
using
Domain.Primitives
;
namespace
Domain.Entities.Medicals.MedicalTests
;
namespace
Domain.Entities.Medicals.MedicalTests
;
public
sealed
class
MedicalTest
(
int
id
)
:
Entity
(
id
)
public
sealed
class
MedicalTest
:
Entity
{
{
#
region
Private
ctor
private
MedicalTest
(
int
id
)
:
base
(
id
)
{
}
private
MedicalTest
(
int
id
,
string
name
,
string
?
description
=
null
)
:
base
(
id
)
{
Name
=
name
;
Description
=
description
;
}
#
endregion
#
region
Properties
#
region
Properties
public
string
Name
{
get
;
set
;
}
=
null
!;
public
string
Name
{
get
;
set
;
}
=
null
!;
...
@@ -11,4 +22,17 @@ public sealed class MedicalTest(int id) : Entity(id)
...
@@ -11,4 +22,17 @@ public sealed class MedicalTest(int id) : Entity(id)
public
string
?
Description
{
get
;
set
;
}
public
string
?
Description
{
get
;
set
;
}
#
endregion
#
endregion
#
region
Methods
#
region
Static
factory
public
static
MedicalTest
Create
(
string
name
,
string
description
)
{
if
(
name
is
null
)
throw
new
InvalidValuesDomainException
<
MedicalTest
>();
return
new
MedicalTest
(
0
,
name
,
description
);
}
#
endregion
#
endregion
}
}
Clinics.Backend/Domain/Entities/Medicals/Medicines/Medicine.cs
View file @
12973dd0
using
Domain.Entities.Medicals.Medicines.MedicineFormValues
;
using
Domain.Entities.Medicals.Medicines.MedicineFormValues
;
using
Domain.Entities.People.Patients.Relations.PatientMedicines
;
using
Domain.Entities.People.Patients.Relations.PatientMedicines
;
using
Domain.Exceptions.InvalidValue
;
using
Domain.Primitives
;
using
Domain.Primitives
;
namespace
Domain.Entities.Medicals.Medicines
;
namespace
Domain.Entities.Medicals.Medicines
;
// TODO: Convert Dosage to value object
// TODO: Convert Dosage to value object
public
sealed
class
Medicine
(
int
id
)
:
Entity
(
id
)
public
sealed
class
Medicine
:
Entity
{
{
#
region
Private
ctor
private
Medicine
(
int
id
)
:
base
(
id
)
{
}
private
Medicine
(
int
id
,
MedicineForm
medicineForm
,
int
amount
,
string
name
,
decimal
dosage
)
:
base
(
id
)
{
MedicineForm
=
medicineForm
;
Amount
=
amount
;
Name
=
name
;
Dosage
=
dosage
;
}
#
endregion
#
region
Properties
#
region
Properties
public
MedicineForm
MedicineForm
{
get
;
set
;
}
=
null
!;
public
MedicineForm
MedicineForm
{
get
;
set
;
}
=
null
!;
...
@@ -24,4 +39,33 @@ public sealed class Medicine(int id) : Entity(id)
...
@@ -24,4 +39,33 @@ public sealed class Medicine(int id) : Entity(id)
#
endregion
#
endregion
#
endregion
#
endregion
#
region
Methods
#
region
Static
factory
public
static
Medicine
Create
(
string
form
,
int
amount
,
string
name
,
decimal
dosage
)
{
if
(
form
is
null
||
name
is
null
||
amount
<
0
||
dosage
<
0
)
throw
new
InvalidValuesDomainException
<
Medicine
>();
#
region
Check
form
MedicineForm
selectedMedicineForm
;
MedicineForm
tablet
=
MedicineForms
.
Tablet
;
MedicineForm
syrup
=
MedicineForms
.
Syrup
;
if
(
form
==
tablet
.
Name
)
selectedMedicineForm
=
tablet
;
else
if
(
form
==
syrup
.
Name
)
selectedMedicineForm
=
syrup
;
else
throw
new
InvalidValuesDomainException
<
MedicineForm
>();
#
endregion
return
new
Medicine
(
0
,
selectedMedicineForm
,
amount
,
name
,
dosage
);
}
#
endregion
#
endregion
}
}
Clinics.Backend/Domain/Entities/Medicals/Medicines/MedicineFormValues/MedicineForm.cs
View file @
12973dd0
using
Domain.Primitives
;
using
Domain.Exceptions.InvalidValue
;
using
Domain.Primitives
;
namespace
Domain.Entities.Medicals.Medicines.MedicineFormValues
;
namespace
Domain.Entities.Medicals.Medicines.MedicineFormValues
;
public
sealed
class
MedicineForm
(
int
id
)
:
Entity
(
id
)
public
sealed
class
MedicineForm
:
Entity
{
{
#
region
Private
ctor
private
MedicineForm
(
int
id
)
:
base
(
id
)
{
}
private
MedicineForm
(
int
id
,
string
name
)
:
base
(
id
)
{
Name
=
name
;
}
#
endregion
#
region
Properties
#
region
Properties
public
string
Name
{
get
;
set
;
}
=
null
!;
public
string
Name
{
get
;
set
;
}
=
null
!;
#
endregion
#
endregion
#
region
Methods
#
region
Static
factory
public
static
MedicineForm
Create
(
string
name
,
int
?
id
)
{
if
(
name
is
null
)
throw
new
InvalidValuesDomainException
<
MedicineForm
>();
if
(
id
is
not
null
)
{
if
(
id
<
0
)
throw
new
InvalidValuesDomainException
<
MedicineForm
>();
return
new
MedicineForm
(
id
.
Value
,
name
);
}
return
new
MedicineForm
(
0
,
name
);
}
#
endregion
#
endregion
}
}
Clinics.Backend/Domain/Entities/Medicals/Medicines/MedicineFormValues/MedicineForms.cs
View file @
12973dd0
...
@@ -4,9 +4,9 @@ public static class MedicineForms
...
@@ -4,9 +4,9 @@ public static class MedicineForms
{
{
#
region
Constant
id
values
#
region
Constant
id
values
public
static
int
Tablet
=>
1
;
public
static
MedicineForm
Tablet
=>
MedicineForm
.
Create
(
"حبوب"
,
1
)
;
public
static
int
Syrup
=>
2
;
public
static
MedicineForm
Syrup
=>
MedicineForm
.
Create
(
"شراب"
,
2
)
;
#
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