# TOBE 공통 ERD

```mermaid
erDiagram
    tb_cd_grp["tb_cd_grp<br/>(코드 그룹 마스터)"] {
        string grp_cd PK
        string grp_nm
    }
    tb_cd["tb_cd<br/>(공통 코드 마스터)"] {
        string grp_cd PK
        string cd_val PK
    }
    tb_org["tb_org<br/>(기관 마스터)"] {
        string org_cd PK
    }
    tb_dept["tb_dept<br/>(부서 마스터)"] {
        string dept_cd PK
        string org_cd FK
        string upr_dept_cd FK
    }
    tb_emp["tb_emp<br/>(직원 마스터)"] {
        string emp_no PK
        string org_cd FK
        string dept_cd FK
    }
    tb_pt["tb_pt<br/>(환자 마스터)"] {
        string pt_no PK
        string org_cd FK
    }
    tb_pt_cntc["tb_pt_cntc<br/>(환자 연락처)"] {
        string pt_no PK
        int cntc_seq PK
    }
    tb_insr_pyr["tb_insr_pyr<br/>(보험자 마스터)"] {
        string pyr_cd PK
    }
    tb_pt_insr["tb_pt_insr<br/>(환자 보험)"] {
        string pt_no PK
        string pyr_cd PK
        date eff_st_dt PK
    }
    tb_wd["tb_wd<br/>(병동 마스터)"] {
        string wd_cd PK
        string org_cd FK
        string dept_cd FK
    }
    tb_room["tb_room<br/>(병실 마스터)"] {
        string room_cd PK
        string wd_cd FK
        string dept_cd FK
    }

    tb_cd_grp ||--o{ tb_cd : has
    tb_org ||--o{ tb_dept : has
    tb_dept ||--o{ tb_dept : parent
    tb_org ||--o{ tb_emp : has
    tb_dept ||--o{ tb_emp : belongs
    tb_org ||--o{ tb_pt : has
    tb_pt ||--o{ tb_pt_cntc : has
    tb_insr_pyr ||--o{ tb_pt_insr : covers
    tb_pt ||--o{ tb_pt_insr : has
    tb_org ||--o{ tb_wd : has
    tb_dept ||--o{ tb_wd : belongs
    tb_wd ||--o{ tb_room : has
    tb_dept ||--o{ tb_room : belongs
```
