feat/role-check: wip
This commit is contained in:
+36
-24
@@ -2,35 +2,47 @@ export const systemCode = 'system'
|
||||
|
||||
export const rehabInstCode = 'rehab'
|
||||
export const rehabUnitCode = 'rehab'
|
||||
export const chemoUnitCode = 'chemo'
|
||||
|
||||
export const headPosCode = 'head' // head position
|
||||
export const respPosCode = 'resp' // responsible position, verificator
|
||||
// Object keys are faster than array
|
||||
export const infraPositions: Record<string, boolean> = {
|
||||
'head': true,
|
||||
'resp': true,
|
||||
'doc': true,
|
||||
'nur':true
|
||||
}
|
||||
export type InfraPositionCode = keyof typeof infraPositions
|
||||
|
||||
export type UnitLevel =
|
||||
'inst' | // installation
|
||||
'unit' | // unit / poly
|
||||
'spec' | // specialist
|
||||
'subspec' // subspecialist
|
||||
export const servicePositioons: Record<string, boolean> = {
|
||||
'none': true,
|
||||
'reg': true,
|
||||
'scr': true,
|
||||
'med': true,
|
||||
}
|
||||
export type ServicePositionCode = keyof typeof servicePositioons
|
||||
|
||||
export const medicalRoles = [
|
||||
'emp|doc', // doctor
|
||||
'emp|nur', // nurse
|
||||
'emp|miw', // midwife
|
||||
'emp|thr', // therapist
|
||||
'emp|nut', // nutritionist
|
||||
'emp|pha', // pharmacy
|
||||
'emp|lab' // laborant
|
||||
]
|
||||
export const medicalRoles: Record<string, boolean> = {
|
||||
'emp|doc': true, // doctor
|
||||
'emp|nur': true, // nurse
|
||||
'emp|miw': true, // midwife
|
||||
'emp|thr': true, // therapist
|
||||
'emp|nut': true, // nutritionist
|
||||
'emp|pha': true, // pharmacy
|
||||
'emp|lab': true // laborant
|
||||
}
|
||||
export type MedicalRoleCode = keyof typeof medicalRoles
|
||||
|
||||
export const serviceRoles = [
|
||||
'emp|reg',
|
||||
export const serviceRoles: Record<string, boolean> = {
|
||||
'emp|reg': true,
|
||||
'emp|scr': true,
|
||||
...medicalRoles,
|
||||
]
|
||||
|
||||
export function genSpecHeadCode(unit_level: UnitLevel, unit_code: string): string {
|
||||
return `${unit_level}|${unit_code}|${headPosCode}`
|
||||
}
|
||||
export type ServiceRoleCode = keyof typeof serviceRoles
|
||||
|
||||
export function genUnitRespCode(unit_level: UnitLevel, unit_code: string): string {
|
||||
return `${unit_level}|${unit_code}|${respPosCode}`
|
||||
export const unitLevels: Record<string, boolean> = {
|
||||
'inst': true, // installation
|
||||
'unit': true, // unit / poly
|
||||
'spec': true, // specialist
|
||||
'subspec': true, // subspecialist
|
||||
}
|
||||
export type UnitLevel = keyof typeof unitLevels
|
||||
|
||||
Reference in New Issue
Block a user