sql server - Handling multi-select list in database design -
i'm creating clinic management system need store medical history patient. user can select multiple history conditions single patient, however, each clinic has own fixed set of medical history fields.
for example:
clinic 1: diseaseone diseasetwo diseasethree clinic 2: diseasefour diseasefive diseasesize
for patient visit in specific clinic , user should able check 1 or more diseases patient's medical history based on clinic type.
i thought of 2 ways of storing medical history data:
first option:
add fields corresponding clinic patient visit record:
patientclinic1visitrecord: patientclinic1visitrecordid visitdate medhist_diseaseone medhist_diseasetwo medhist_disearthree
and fill each medhist field value "true/false" based on user input.
second option:
have single medicalhistory table holds clinics medical history detail table hold patient's medical history in corresponding visit.
medicalhistory clinicid medicalhistoryfieldid medicalhistoryfieldname medicalhistorypatientclinicvisit visitid medicalhistoryfieldid medicalhistoryfieldvalue
i'm not sure if these approaches practices, third approach better use ?
if interested on diseases person had, storing false / non-existing diseases quite pointless. not knowing details doesn't getting best solution, create this:
person:
personid name address
clinic:
clinicid name address
disease:
diseaseid name
medicalhistory:
historyid (identity, primary key) personid clinicid visitdate (either date or datetime2 field depending need) diseaseid details, notes etc
i created table because assumption people have 1 disease on 1 visit, in case there's several, more rows can added, instead of creating separate table visit, makes queries complex.
if need track situation disease checked result negative, new status field needed history table.
if need limit diseases can entered clinic, you'll need separate table too.
Comments
Post a Comment