If I have, in my Java code, the following classes:
Patient
:contains instance of anther classes (mentioned bellow)PatientBasicInformation
: contains PatientId, phoneNumber, Name, Gender, Age.PatientImageFinidgns
: contains Date, comments, lesionSize, site, procedure.PatientLabFindings
: contains Date, t1,t2,t3,t4.PatientTreatment
: contains visitNumber, Date, some other data.
Id
is the primary key for Patient
and Date
is very important key in both PatientImageFindings
and PatientLabFindings
. visitNumber
is my primary key in PatientTreatment
.
How could I design these classes in a database. Should I create a table Patient
, which holds only foreign keys of the other classes (like ID
, Date
, VisitNumber
) or should I put PatientId
in the table Patient
as a primary key and as a foreign key in the PatientBasicInformation
table. If so, what would be the primary key in the PatientBasicInformation
table?
I want appreciate a simple and clear answer as I'm a new to databases and I have read a lot of articles, but I still don't get the whole picture.
Best Answer
This is focused on your question and classes as specified. I am not sure that
LabFindings
is properly normalized, those t1,t2,t3.. sound suspicious, but we would need more detailed explanation for that.