【问题标题】:Database structure for a tooth chart牙图的数据库结构
【发布时间】:2014-10-09 10:53:32
【问题描述】:

您好,我不确定这是否是一个可以的问题,但是在这里,我对如何制作我的牙图数据库的数据结构感到很困惑。我首先想到了做一个这样的数据结构

teeth_table 
teeth_id (Primary key)
teeth_1 (These are 32 tooth)
until teeth_32 (These are 32 tooth)
patient_id (Foreign key connected to the patient table)

我的第二个计划是为每颗牙齿制作一个单独的表格(我猜这会花费很多时间?)

tooth01_table
tooth_id
tooth_name
tooth_condition
tooth_recommendation
tooth_treatment
patient_id

我就是这么想的, 我的计划是制作一个表格,当患者从下拉列表中选择一颗牙齿时,它会显示以下内容

牙齿 |条件 |推荐 |治疗

那么你们认为牙齿图表数据库的好设计是什么?

牙齿图是这样的

http://www.mouthandteeth.com/img/FDI-tooth-numbering-system.gif

【问题讨论】:

    标签: database database-design


    【解决方案1】:

    我推荐以下设计:

    CREATE TABLE tooth (
      tooth_code   char(2)     NOT NULL PRIMARY KEY,
      -- teeth don't have real numbers
      -- it is a qudrant number + tooth number combination
      -- therefore char(2)
      tooth_cat   varchar(50) NOT NULL
        CHECK (tooth_cat IN ('incisor','canine','premolar','molar')
      -- though I find this info redundant,
      -- category can be deduced from tooth_code
    );
    
    CREATE TABLE mounth (
      patient_id   int4     NOT NULL,
      tooth_code   char(2)  NOT NULL,
      inspect_dt   timestamp with time zone NOT NULL,
      condition    text,
      suggestion   text,
      treatment    text,
      PRIMARY KEY (patient_id, tooth_code, inspect_dt),
      FOREIGN KEY (patient_id) REFERENCES patient,
      FOREIGN KEY (tooth_code) REFERENCES tooth
    );
    
    1. 你应该有一本包含牙齿代码和周边描述的字典
    2. 每颗牙齿都属于某个患者,因此它们应该始终放在一起
    3. 另外,检查时会出现系统中的条目,因此PK由表mouth的3列组成
    4. 我使用了tooth_code,'cos id 通常表示数值,但我们这里没有实数,虽然它们看起来很像
    5. 我不太喜欢mouth,也许patient_inspections 或类似的会更好。
    6. 英语不是我的母语,因此请在适用的情况下选择更好的名称。

    【讨论】:

      猜你喜欢
      • 2015-06-29
      • 2010-10-30
      • 2011-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-13
      相关资源
      最近更新 更多