2011-10-06 48 views
0

考慮開放醫療情況,下面的部分數據模型及其相應的保險單一對多的關係:數據建模:沒有唯一標識符

**Cases** 
CaseId (PK) 
PatientId (FK) 
CaseNote 
... 

**CaseInsuranceProfiles** 
CaseId (PK)(FK) 
InsuranceId (PK)(FK) 
InsuranceType {Primary, Secondary, Tertiary} (PK)(FK) 
EffectiveDate 

**Insurances** 
InsuranceId (PK) 
InsuranceName 
InsuranceAddress 
InsuranceCity 
... 

不幸的是,這種模式提出了一個問題。它不允許案件在每種保險和保險類型的實例中有重複記錄。例如,如果有關案件有兩項來自保險A的主要保險單(一些州允許)。我精化模型的下面,以努力恢復正常的數據並提供CaseInsuranceProfiles表不是複合鍵的唯一標識符:

**Cases** 
CaseId (PK) 
PatientId (FK) 
CaseNote 
... 

**CaseInsuranceProfiles** 
InsuranceProfileId (PK) 
CaseId (FK) 
InsuranceId (FK) 
InsuranceType {Primary, Secondary, Tertiary} 
EffectiveDate 

**Insurances** 
InsuranceId (PK) 
InsuranceName 
InsuranceAddress 
InsuranceCity 
... 

然而,這種模式提出了一種新的模式,即我的代理鍵(InsuranceProfileId)仍然沒有唯一標識每條記錄。任何人都可以建議對數據模型進行更改,以便我能夠正確識別每條記錄嗎?
注:我知道,我可以創建類似表:

**CaseInsuranceProfiles** 
InsuranceProfileId (PK) 
CaseId (FK) 
InsuranceId (FK) 
PrimaryInsurance 
SecondaryInsurance 
TertiaryInsurance 
EffectiveDate 

不過,這並沒有讓我考慮多個主,二級或三級保險。此外,我的目標是確定每個案例的保險概況,換句話說,我希望能夠使用一個密鑰來顯示特定案例的所有保險。提前致謝!

+0

如果從保險一兩個主要的保險政策,你怎麼告訴他們分開?保單號碼?紙張的顏色? –

+0

保單號碼最容易使用。謝謝! – TelJanini

回答

2

怎麼樣:

**CaseInsuranceProfiles** 
InsuranceProfileId (PK) 
CaseId (FK0)(AK) 
InsuranceId (FK1)(AK) 
InsurancePolicyId (FK1)(AK) 
CaseEffectiveDate 

**InsurancePolicies** 
InsuranceId (PK)(FK) 
InsurancePolicyId (PK) 
InsuranceType {Primary, Secondary, Tertiary} 
0

從商業角度來看,我想知道每種保險的優先級,即,哪項政策首先支付。我會添加一個優先級字段,並使您的密鑰的一部分。