Answer the question
In order to leave comments, you need to log in
What is the best way to organize DB tables and models in Yii2?
Guys such a problem. There are laboratory tests.
Simple and compound (as I separate in my head). Well, for example, ALT, AST .... they require one field for the result .. there are 30 such analyzes. And there are components Complete blood count (KLA form which contains 10 fields erythrocytes monocytes, etc.), Urinalysis (OAM form also contains 10 fields ), blood clotting and I have about five such tables ...
The question is how best to organize the tables for these tests?
Option 1 - each analysis has its own table. Thus, I will have 40 pieces. Each analysis has its own table. Good for reports.
2 Option to create 1 table for simple analyzes and for compound analyzes each has its own table ... the number of tables will be reduced, but the problem remains, that you will have to add a condition for each call ..
, but the number of tables will be used 10 pieces for all laboratory analyses.
Which option to choose please advise?
Answer the question
In order to leave comments, you need to log in
Three tables are enough:
analyze
id | name | type
property
id | type | name
analyze_property_value
id | property_id | analyze_id | value
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question