2014-10-09 65 views
0

你好,我不确定这是否是一个好问题,但在这里,我很困惑我将如何使我的牙图数据库的数据结构。我有做的数据结构是这样齿形图的数据库结构

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

回答

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. 你应该用牙齿代码和surronding字典说明
  2. 每个齿属于一些病人,因此它们一定要同时
  3. 也,在系统入口的检查过程中出现,因此PK由3个栏为表mouth
  4. 我用tooth_code,“因为id通常是指数值,但我们在这里没有实际的数字,尽管它们看起来一样
  5. 我不太喜欢mouth,也许patient_inspections或类似的会更好的匹配。
  6. 英语不是我的母语,所以在适用的地方选择更好的名字。
+0

这看起来更好,谢谢你的帮助。 – piece 2014-10-09 11:45:27