## 帳號權限
```mermaid
erDiagram
U_Identity_Data{
string ID_idno PK
string ID_name
string ID_note
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
U_Identity_Data || -- |{ U_Identity_Function : have
U_Identity_Function{
string ID_idno PK
string SF_idno FK
uniqueidentifier UP_user
dateime UP_time
string UP_from
}
S_System_Function || -- |{ U_Identity_Function : refer_to
U_User_Data{
uniqueidentifier UD_grid PK
string UD_acct
string UD_pswd
string UD_name
string UD_sex
string UD_unit
string UD_title
string UD_mail
string UD_tell
string UD_call
string UD_code "雙因子qrcode"
string OS_guid FK "D_Organization_Subunit"
string UD_mode "0:未開通,1:已開通,2:已啟用,3:已過期,4:已停用"
uniqueidentifier AD_user
datetime AD_time
string AD_from
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
U_User_Data || --|{ U_User_Password: have
U_User_Identity{
uniqueidentifier UD_guid pk
string ID_idno pk
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
U_User_Identity }| -- || U_Identity_Data: refer_to
U_User_Identity }| -- || U_User_Data: refer_to
U_User_Password{
uniqueidentifier UD_guid pk
datetime UP_time pk
string UD_pswd
}
D_Organization_Data || -- || D_Organization_Type : refer_to
D_Organization_Data {
string OT_idno
uniqueidentifier OD_guid
string OD_name
}
D_Organization_Data || -- |{ D_Organization_Subunit : have
D_Organization_Data || -- |{ U_User_Data : belongs
D_Organization_Subunit {
uniqueidentifier OD_guid PK "FK"
string OS_name
}
D_Organization_Subunit || -- |{ U_User_Data : belongs
```
## 單位
```mermaid
erDiagram
D_Organization_Data || -- || D_Organization_Type : refer_to
D_Organization_Data {
string OT_idno
uniqueidentifier OD_guid
string OD_name
string OD_tidno
string OD_lidno
string OD_bidno
string OD_post
string OD_addr
string SH_head
string SH_idno
int SH_class
int SH_teach
uniqueidentifier AU_user
string CP_name
string CP_sex
string CP_tell
string CP_fax
string CP_mail
string OD_note
string OD_mode
uniqueidentifier AD_user
datetime AD_time
string AD_from
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
D_Organization_Data || -- || D_Hire_Agent : refer_to
D_Hire_Agent || -- || D_Organization_Data : entrust_to
D_Hire_Agent{
int HA_idno PK
uniqueidentifier HA_client
uniqueidentifier HA_agent
datetime HA_sdate
datetime HA_edate
string HA_contract
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
D_Organization_Data || -- |{ D_Organization_Subunit : have
D_Organization_Subunit {
uniqueidentifier OD_guid "FK"
string OS_guid PK
string OS_name
}
D_Organization_Group {
string OG_idno pk
string OG_name
string OG_name
}
D_Organization_Group || --|{ D_Organization_Cross : refer_to
D_Organization_Cross {
string OG_idno
string OT_idno
}
D_Organization_Type || --|{ D_Organization_Cross : refer_to
D_Organization_Type {
string OT_idno PK
string OT_name
string OT_type
string OT_kind
string OT_stage
string OT_main
string OT_mode
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
```
## 審核流程
```mermaid
erDiagram
D_Preset_Process || -- || D_Preset_OverdueDays : limited_by
D_Preset_Process || -- |{ D_Preset_File : limited_by
D_Preset_Process || -- |{ D_Preset_Level : have
D_Preset_Process || -- || D_Organization_Type : refer_to
D_Preset_Process {
string OT_idno PK "D_Organization_Type"
string PP_idno "FK"
string PP_name
string PP_kind
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
D_Preset_Level || -- || D_Organization_Type : refer_to
D_Preset_Level{
string PP_idno PK "FK"
string OT_idno PK "FK"
int PL_order
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
D_Preset_OverdueDays {
string PP_idno PK
string CI_type PK
string PO_kind
int PO_notify
int PO_return
string PO_note
string PO_mode
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
D_Preset_File {
string PP_idno PK "FK"
string CI_type PK
string PF_code PK
string PF_type
string PF_name
string PF_note
string PF_must
string PF_mode
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
D_Preset_Scope {
uniqueidentifier UD_guid PK "FK"
string PP_idno PK "FK"
uniqueidentifier AD_user
datetime AD_time
string AD_from
}
D_Preset_Scope || --|{ U_User_Data : allowed
D_Preset_Scope || --|{ D_Preset_Process : refer_to
D_Preset_Scope
{
uniqueidentifier UD_guid PK "FK"
string PP_idno PK "FK"
datetime AD_time
string AD_from
}
```
## 聘僱申請
```mermaid
erDiagram
D_Employee_Source
D_Employee_Change
D_Employee_Source || -- |{ D_Employee_Change :D_Employee_Change
D_Employee_Source || -- |{ D_Employee_Data :aggregate
D_Employee_Data {
uniqueidentifier ED_guid PK "FK"
uniqueidentifier OD_guid PK "FK"
string OS_name PK
}
D_Case_Application {
string CA_idno PK
uniqueidentifier ED_guid FK
uniqueidentifier OS_guid FK
int CT_idno FK
string CA_staffing
string CA_introduce
string CA_joint
uniqueidentifier CA_mainhire FK
string CA_language
string CA_mainunit
string PP_idno FK
string CA_mode
uniqueidentifier CI_guid FK
date CA_sdate
date CA_edate
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
D_Case_Application || -- |{ D_Case_Information : have
D_Case_Application || -- || D_Employee_Data : sync_when_create_and_finished
D_Case_Application || -- || D_Organization_Subunit : refer_to
D_Case_Information {
string CA_idno FK
uniqueidentifier CI_guid PK
uniqueidentifier BF_guid FK
string CI_idno
string CI_type
string CI_consent
uniqueidentifier ND_guid
string ED_surname
string ED_givename
date ED_birth
string ED_sex
string ED_passport
date ED_passexpiry
string ED_mugshot
string ED_education
string ED_eduagree
string ED_eduname
string CI_introduce
string CI_major
string CI_structure
date CI_startdate
date CI_enddate
date RP_startdate
date RP_enddate
string CI_jobtitle
string CI_jobtype
string CI_jobother
string CI_workplace
string CI_payroll
int CI_salary
string CI_process
string CI_reason
string CI_note
string PP_idno
date CI_notify
date CI_return
string CI_officialNo
date CI_officialdate
date CI_approvaldate
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
D_Case_Information || -- |{ D_Case_RequiredFiles : need_to_review
D_Case_RequiredFiles{
uniqueidentifier CF_guid PK
uniqueidentifier CI_guid
string CF_name
string CF_must
string CF_filename
string CF_nowpath
int CF_nowsize
string CF_prepath
string CF_pretype
int CF_presize
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
D_Case_Information || -- |{ D_Case_Process : historical_records
D_Case_Process {
uniqueidentifier CP_guid PK
uniqueidentifier CI_guid FK
string CP_action
string CP_type
string CP_site
uniqueidentifier AD_user
datetime AD_time
string AD_from
}
D_Case_Process || -- |{ D_Case_Explanation : problems
D_Case_Explanation {
uniqueidentifier CP_guid PK
string CE_item PK
string CE_note
}
D_Case_RequiredFiles || -- |{ D_Case_FileReview : refer_to
D_Case_FileReview || -- || D_Case_Process : refer_to
D_Case_FileReview {
uniqueidentifier CF_guid PK
uniqueidentifier CP_guid PK
string CF_check
string CF_memo
}
```
### 聘僱管理
情境一:建立聘僱申請
角色:聘僱單位
動作:送出申請
限制:送出申請且審核單位進行收件後,聘僱單位除補件情況外不得修改聘僱申請資料。
```mermaid
flowchart LR
subgraph data flow
subgraph Employment["Case Application Process"]
direction TB
D_Case_Application -- create by new,rehire,modify,disuse --> D_Case_Information
end
subgraph Employee["Employee data Maintenance"]
direction TB
Employee_Master -- "create new row when master data changed" --> Employee_History
end
Employee_Data -- "merge into and update"--> Employee_Master
Case_Process --move to next --> Employment
Employment -- submit application --> Case_Process
D_Case_Information -- update data if Employee data changed--> D_Case_Information
Employee_Data -- pull and copy when create new case--> D_Case_Information
end
```
備註:
* D_Case_Application資料表,主要儲存案件編號、涉及到案件審核流程欄位、可能涉及員額欄位。一筆D_Case_Application資料,會對應D_Case_Information一筆新聘/續聘申請(不含撤銷、退件、取消)資料、N筆變更申請資料或一筆廢止申請資料(不含撤銷、退件、取消),故D_Case_Information可用來查詢受僱者申請歷程。
* new:新增
* rehire:續聘
* modify:變更
* disuse:廢止
情境二:審核單位要求聘僱單位補件
角色:審核單位
動作:補件
```mermaid
flowchart LR
subgraph data flow
subgraph Employment["Case Application Process"]
direction TB
D_Case_Application -- create by new,rehire,modify,disuse --> D_Case_Information
end
Case_Process --move to the application unit --> Employment
Employment -- return --> Case_Process
D_Case_Information -- update data if Employee data changed--> D_Case_Information
end
```
情境三:聘僱單位補件
角色:聘僱單位
動作:完成補件
```mermaid
flowchart LR
subgraph data flow
subgraph Employment["Case Application Process"]
direction TB
D_Case_Application -- create by new,rehire,modify,disuse --> D_Case_Information
end
Case_Process --move to the first reviewing unit --> Employment
Employment -- submit application after completing the required documents --> Case_Process
D_Case_Information -- update data if Employee data changed--> D_Case_Information
end
```
備註:
* 聘僱單位完成補件送出後,會重新由第一個審核單位進行審核
情境四:審核聘僱申請
角色:審核單位
動作:核可
限制:僅最終審核單位核定時,進行教師比對並提示
```mermaid
flowchart LR
subgraph data flow
subgraph Employment["Case Application Process"]
direction TB
D_Case_Application -- create by new,rehire,modify,disuse --> D_Case_Information
end
subgraph Employee["Employee data Maintenance"]
direction TB
Employee_Master -- "create new row when master data changed" --> Employee_History
end
Case_Process -- move to next --> Employment
Employment -- review and confirm--> Case_Process
Employee_Data -- pull and copy when create new case--> D_Case_Information
D_Case_Information -- update data when case approved at final step--> Employee_Data
Employee_Data -- "merge into and update"--> Employee_Master
D_Case_Information -- update data if Employee data changed when through every steps--> D_Case_Information
end
```
備註:
* 考量最終審核單位可能會有判斷錯誤的情況,故設計提供歸戶功能讓最終審核單位可以自行維護Employee_Master資料。
### 教師管理
角色: 聘僱單位、私立就業服務機構
情境:建立教師資料
動作:新增、修改
限制:教師無任何聘僱申請資料才可進行修改
```mermaid
flowchart LR
subgraph data flow
subgraph Employee["Employee data Maintenance"]
direction TB
Employee_Master -- "create new row when master data changed" --> Employee_History
end
Employee_Data -- "build relation after created"--> Employee_Master
end
```
備註:
* 考量同一受僱者在同一個聘僱單位可能會有多筆案件申請資料,但對於聘僱單位而言,其受僱者就是一位,故在聘僱單位在查詢受僱者資料時,系統設計每位受僱者只出現最後一筆核准後之資料。
### 歸戶管理
角色: 高教司、技職司、國際司、國教署國中小組、國教署高中職組
情境:管理教師歸戶
動作:合併、重新設定、修改
限制:
```mermaid
flowchart LR
subgraph data flow
subgraph Employee["Employee data Maintenance"]
direction TB
Employee_Master -- "create new row when master data changed" --> Employee_History
end
Employee_Master -- "merge or reset relation when data owners changed data"--> Employee_Data
Employee_Data -- "update Master data when review unit updated data"--> Employee_Master
end
```
## 教師資料
### v1
```mermaid
erDiagram
D_Employee_Source {
uniqueidentifier ES_guid PK
uniqueidentifier ND_guid
string ES_passport
string ES_surname
string ES_givenname
string ES_cname
date ES_birthday
string ES_sex
uniqueidentifier AD_user
datetime AD_time
string AD_from
}
D_Employee_Source || -- |{ D_Employee_Data : aggregate
D_Employee_Data {
uniqueidentifier ED_guid PK "FK"
uniqueidentifier OD_guid PK "FK"
string OS_name PK
uniqueidentifier ND_guid
string Ed_surname
string ED_givenname
string ED_cname
string ED_birth
string ED_sex
string ED_mail
string ED_password
datetime ED_passexpiry
string ED_education
string ED_eduagree
string ED_photo
string ED_mode
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
D_Employee_Source || --|{ D_Employee_Change : have
D_Employee_Change {
uniqueidentifier EC_guid PK
uniqueidentifier ES_guid FK
uniqueidentifier ND_guid
string EC_passport
string EC_surname
string EC_givenname
string EC_name
datetime EC_birthday
string EC_sex
uniqueidentifier AD_user
datetime AD_time
string AD_from
}
```
### v2
```mermaid
flowchart LR
subgraph system1["ASP.NET Webform"]
direction LR
D_Case_Application --> D_Case_Information
D_Case_Information --> D_Employee_Data
end
D_Employee_Data -- "upsert" --> core.employee.data
D_Employee_Data -- "upsert" --> core.employee.contract
subgraph api["instructor api"]
direction LR
core.instructor
core.employee.data
core.employee.contract
end
core.employee.data -- "upsert compare similiarity" --> core.instructor
```
core.instructors(完整生命週期,狀態,追蹤)
core.employee.data(副本,最小必要重覆)
core.employee.contracts(副本,最小必要重覆)
新增/變更
1. D_Employee_Data發生資料變更且儲存後,呼叫instructor.api執行upsert employee與contracts
2. 進行instructors資料比較,尋找符合主檔資料進行upsert
2-1 照片
2-2. 模糊條件比較
2-3. 多重判斷
3. instructor狀態變更為pending,等待教育部確認
4. employee 更新instructor,version
確認
1. 確認 instructor 各version資料何者為正確且最新,確認後state為approved,並將該version資料新增至instructors,version為目前該instructors version+1
```mermaid
erDiagram
instructors {
uniqueidentifier id pk
int version
string surname
string givenname
datetime birth
string sex
string email
string photo
string state
date CreatedAt
date UpdatedAt
uniqueidentifier ApprovedBy
}
instructors || --|{ instructors_trx : historical
instructors_trx {
uniqueidentifier trx_id pk
uniqueidentifier instructor_id "uk"
int version "uk"
string surname
string givenname
datetime birth
string sex
string email
string photo
string trx_mode
string trx_date
uniqueidentifier trx_user
}
instructors || --|{ Institution_employees : have
Institution_employees {
uniqueidentifier employee_id
int version
uniqueidentifier instructor_id
uniqueidentifier institution_id
uniqueidentifier nation_id
string passport_number
date passport_expiry
string education
string verified_by_gov
string reason_for_noncompliance
date CreatedAt
date UpdatedAt
date CreatedBy
}
Institution_employees || --|{ Institution_employees_trx : historical
Institution_employees_trx {
uniqueidentifier employee_trx_id
uniqueidentifier employee_id
int version
uniqueidentifier instructor_id
uniqueidentifier institution_id
uniqueidentifier nation_id
string passport_number
date passport_expiry
string education
string verified_by_gov
string reason_for_noncompliance
string trx_mode
string trx_date
uniqueidentifier trx_user
}
Institution_employees || --|{ employee_contracts : have
employee_contracts {
uniqueidentifier id pk
int version
uniqueidentifier employee_id
string position "專任,兼任"
string is_certified "編制內/編制外"
date start_date
date end_date
string jobtitle
string location
string payment_type
decimal salary
string internal_review_process
string state
}
employee_contracts || --|{ employee_contracts_trx : historical
employee_contracts_trx {
uniqueidentifier trx_id pk
uniqueidentifier contract_id "uk"
int version "uk"
uniqueidentifier instructor_id
string position "專任,兼任"
string is_certified "編制內/編制外"
date start_date
date end_date
string jobtitle
string location
string payment_type
decimal salary
string internal_review_process
string state
string trx_mode
string trx_date
uniqueidentifier trx_user
}
```
## 系統基本設定
```mermaid
erDiagram
S_System_Setting {
string SS_idno PK
string SS_name
string SM_ipv4
string SM_host
string SM_port
string SM_user
string SM_pswd
string ST_host
string ST_port
string ST_user
string ST_pswd
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
S_System_Setting || -- |{ S_System_Project : have
S_System_Project {
string SS_idno FK
string SP_idno PK
int SP_order
string SP_name
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
S_System_Project || -- |{ S_System_Function : have
S_System_Function {
string SF_idno FK
string SP_idno PK
int SF_order
string SF_name
string SF_link
string SF_icon
datetime SF_stime
datetime SF_etime
string SF_note
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
```
```mermaid
erDiagram
B_Country_Data{
int CT_idno PK
string CT_cname
string CT_ename
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
B_National_Data{
uniqueidentifier ND_idno PK
string ND_area
string ND_scode
string ND_ename
string ND_cname
string ND_note
string ND_mode
uniqueidentifier UP_user
datetime UP_time
string UP_from
}
B_Option_Data{
string OP_idno PK
string OP_kind
string OP_name
int OP_order
string OP_note
string UP_user
datetime UP_time
string UP_from
}
B_Postal_Code {
string PC_idno PK
string PC_city
string PC_town
}
B_Work_Day {
datetime WD_idno PK
string WD_kind
string WD_name
}
```
## knowed reports
- 外籍教師聘僱許可統計表-依月份
- 外籍教師聘僱許可統計表-依國籍
- 外籍教師聘僱許可統計表-依縣市
- 申請核可案件清單-專科以上
- 申請核可案件清單-專科以下
## issue
T: 老師
C: 振漳
S: 嘉揚
### 1 身分可以使用完整的function或不能使用function,這樣的解析度是否足夠
**C:** 未來有特殊狀況,再加一個資料表用於負面表列
**T:** 一個使用者可以有多個身分嗎?
**C:** 可以
### 2 如何知道使用者何時扮演什麼身分
**C:** 會利用不同的功能(function)去區分使用者
### 3 U_User_Data -- D_Preset_Scope -- D_Preset_Process 這是什麼意思? 參考審核流程erd
**C:**
這裡主要是設定審查者帳號,在審核流程資料裡,他要負責那些單位類型。
如:高教司負責單位類型有二個流程
1.公立一般學校大學-非語文中心
2.私立一般學校大學-非語文中心
若A帳號只設定1.公立一般學校大學時-非語文中心,2.私立一般學校大學-非語文中心案件到該A帳號單位時,A不會收到通知信也看不到該筆資料
若A帳號同時設定1.公立一般學校大學-非語文中心及2.私立一般學校大學-非語文中心...則所有大學非語文中心案A都會收到通知信,也看的到資料
### 4 請說明D_Preset_Process,D_Organization_Type,D_Preset_Level ?
**C:**
每個要聘僱的單位類別,可能會有不同的流程
所以會有D_Preset_Process
每個流程要跑的審核關卡會不同
所以會有D_Preset_Level 如:私立僑民學校高中,要跑的關卡有(1)初審小組(2)國際司

- [如何維護受僱者主要基本資料(D_Employee_Source)](/6vInKd_lSBGmHLlb2NG8GQ)
受僱者主要編號-->為總歸戶的受僱者基本資料的編號
受僱者編號-->各聘僱單位下的受僱者基本資料編號
子單位編號-->因各聘僱單位會有子帳號聘僱教師,例如大專校院之子帳號可能會是院、系、所、中心…,而各院、系、所、中心應不能看見其他單位聘僱資料,只能看到自己聘的教師。所以若聘僱單位有要建立子帳號時需先建立子單位
### 5 請說明D_Employee_Data的受僱者主要編號(ES_guid),受僱者編號(ED_guid),子單位編號(OS_guid)欄位
### 6 D_Employee_Source這張表如何填入
**C:** 照 如何維護受僱者主要基本資料.pdf
**T:** 感覺 D_Employee_Source 是一個不容易維護的 master data,是否了解一下 master data management 的作法?
**T:** D_Employee_Source 是否要有 version 也是一個問題
### 7 請說明D_Employee_Change
**C:** 此表主要是受僱者主要基本資料若有異動時,存修改前的資料,以利確認被異動歷程
**T:** 是針對 D_Employee_Source 的變動嗎?會用來回溯歷史資料嗎?
**C:** 目前想到是用來查詢歷史變更過程(version)用而已,在統計上或許有可能會需要回溯歷史資料,但那統計報表使用人確要那樣做
**T:** 所以要先問,資料的統計分析與應用系統的設計是緊密相關的
### 8 請說明D_Case_Information
**C:** 在新聘或續聘時會先建立案件編號在D_Case_Application,D_Case_Information是用於對應D_Case_Application新聘、續聘、變更、廢止的相關申請資料。
**T:** 教師資料在許多資料表都有出現,有點弄不清楚作用為何?
### 9 案件的完整變動,例如核可、變更、廢止、有存在資料庫裡面嗎?
**C:** 主要會在D_Case_Process記錄,但因教育部之撤銷並不用跑審核流程,以及廢止是在廢止申請核可後才去變案件的資料,所以撤銷及廢止是存在D_Case_Application
**T:** 可以有一份說明文件嗎?針對類似資料散在各張資料表,何時改哪張資料表的說明文件
### 10 master data management
**S:** 1、D_Employee_Source 是 master data,也就是所謂的 golden copy,不過資料庫裡還有許多份的類似資料,這些資料的目的是什麼?
2、上述資料的管理,是 data governance 的問題,目前似乎還不夠簡潔、明確
3、master data management 不只是技術的問題,作法必須取得部裡的同意
1.至少進行一次初步分類,識別業務資料中那些是master data, transactional data, reference data,目前已知可能的分類:
使用者(master data)
聘僱申請(master data)
聘僱申請流程(master data)
聘僱申請履歷(transactional data)
教師含佐證文件、合約(master data)
聘僱單位(master data或reference data),視是否要做到處理學校變革(長期趨勢)
2.master data 要做到單一事實來源(single source of truth),盡量使系統在維持一致性容易
3.以現有統計報表分析目前資料庫架構是否能滿足,規劃那些master data需要有transactional data,將表格分為current(系統使用)與historical(報表使用)
4.business metadata,technical metadata,referecnce metadata ,and more, etc
**T:** 我目前比較關心的 master data,其實只有教師資料,另外是教師資料的哪些屬性應該納入 master data 進行管理
以下的資料我目前覺得不必特別以 master data 進行管理:
1、使用者:使用者資料的建立與維護應該檢附核章後表單(對嗎?)
2、聘僱申請:一個聘雇申請只會對到一個聘雇單位,權責較清楚
3、聘僱申請流程:應該收到系統的規範,或許不會出大問題
4、教師含佐證文件、合約:這就是前面所提的,哪些屬性應該納入 master data 進行管理
5、聘僱單位:應該會受到法規管制,變動時應該提出佐證資料,不過這是 slowly changing dimension
至於「聘僱申請履歷」(我稱為聘雇申請歷程),似乎目前還看不出具體的作法
其他部分再麻煩各位多費心