我们这里有一个半结构化数据的示例,处理这种情况的一种方法是使用 XML 数据类型字段ExamDetails
。你可以有:
<root>
<ExamName></ExamName>
<ExamResult></ExamResult>
<FreeText></FreeText>
</root>
并非所有元素都必须出现在每条记录中。您将使用您的 DB XML 功能来查询该字段。所有的市长 DB(MS SQl Server、Oracle、DB2)都可以存储和查询 XML。
更多注意事项:
我将至少有三个表格:Patient、Doctor、Exam
TABLE Patient (ID (PK), Name, other patient details...)
TABLE Doctor (ID (PK), Name, other doctor details...)
TABLE Exam (ID (PK), PatientID (FK), DoctorID (FK), Date, ExamDetails XML, more here...)
如果医生和患者碰巧都是人(与兽医诊所或房屋检查相反),您可以将表格 Person 和子类型 Patient 和 Doctor 表格添加到 Person 表格 - 这样很容易让医生在诊所也是病人。例如:
TABLE Person (ID (PK), FirstName, LastName, Phone, Address, other details common to people...)
TABLE Patient (PersonID (PK, FK), ...specific patient details only)
TABLE Doctor (PersonID (PK, FK), ...specific doctor details only)
TABLE Exam (ID (PK), PatientID (FK), DoctorID (FK), Date, ExamDetails XML, more here...)
因为 Patient 和 Doctor 是人员类型,所以 PersonID 应该与 Person 表中的 ID 相同。
