208 lines
5.2 KiB
TypeScript
208 lines
5.2 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||
import { IsDateString, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||
import { PageQuery } from '../common/page.dto.js';
|
||
|
||
/**
|
||
* 人员(staff)DTO。字段字典以 shared/data-model 为准,本期只落地 C0 骨架字段。
|
||
* - 不含 tenantCode/createdBy/createdAt/updatedAt/deletedAt(系统字段,服务端注入);
|
||
* - id_card_no 本期存明文(加密机制由后续安全 change 统一落地,见 staff.service.ts TODO)。
|
||
*/
|
||
export class CreateStaffDto {
|
||
@ApiPropertyOptional({ description: '关联账号 user.id(可空,1:1;院长/质控/管理员无 staff 记录)' })
|
||
@IsOptional()
|
||
@IsString()
|
||
userId?: string;
|
||
|
||
@ApiProperty({ description: '姓名' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
name!: string;
|
||
|
||
@ApiProperty({ description: '身份证号(本期明文)' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
idCardNo!: string;
|
||
|
||
@ApiPropertyOptional({ description: '工号(预留)' })
|
||
@IsOptional()
|
||
@IsString()
|
||
personCode?: string;
|
||
|
||
@ApiProperty({ description: '手机号' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
phone!: string;
|
||
|
||
@ApiProperty({ description: '岗位类型:nurse / nurse_medical / manager' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
jobType!: string;
|
||
|
||
@ApiProperty({ description: '用工类型' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
workType!: string;
|
||
|
||
@ApiPropertyOptional({ description: '入职日期(YYYY-MM-DD)' })
|
||
@IsOptional()
|
||
@IsDateString()
|
||
entryDate?: string;
|
||
|
||
@ApiPropertyOptional({ description: '离职日期(YYYY-MM-DD)' })
|
||
@IsOptional()
|
||
@IsDateString()
|
||
leaveDate?: string;
|
||
|
||
@ApiProperty({ description: '在职状态' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
employStatus!: string;
|
||
|
||
@ApiPropertyOptional({ description: '证书类型' })
|
||
@IsOptional()
|
||
@IsString()
|
||
certType?: string;
|
||
|
||
@ApiPropertyOptional({ description: '证书编号' })
|
||
@IsOptional()
|
||
@IsString()
|
||
certNo?: string;
|
||
|
||
@ApiPropertyOptional({ description: '证书等级' })
|
||
@IsOptional()
|
||
@IsString()
|
||
certLevel?: string;
|
||
|
||
@ApiPropertyOptional({ description: '证书有效期(YYYY-MM-DD)' })
|
||
@IsOptional()
|
||
@IsDateString()
|
||
certExpire?: string;
|
||
|
||
@ApiPropertyOptional({ description: '证书状态' })
|
||
@IsOptional()
|
||
@IsString()
|
||
certStatus?: string;
|
||
|
||
@ApiPropertyOptional({ description: '证书核验链接(预留)' })
|
||
@IsOptional()
|
||
@IsString()
|
||
certVerifyUrl?: string;
|
||
|
||
@ApiPropertyOptional({ description: '归属组长 staff.id' })
|
||
@IsOptional()
|
||
@IsString()
|
||
groupLeaderId?: string;
|
||
}
|
||
|
||
/** 更新人员信息:全部 optional;`userId` 允许改绑账号(service 层校验唯一)。 */
|
||
export class UpdateStaffDto {
|
||
@ApiPropertyOptional({ description: '关联账号 user.id(可空,改绑需唯一)' })
|
||
@IsOptional()
|
||
@IsString()
|
||
userId?: string;
|
||
|
||
@ApiPropertyOptional({ description: '姓名' })
|
||
@IsOptional()
|
||
@IsString()
|
||
name?: string;
|
||
|
||
@ApiPropertyOptional({ description: '身份证号(本期明文)' })
|
||
@IsOptional()
|
||
@IsString()
|
||
idCardNo?: string;
|
||
|
||
@ApiPropertyOptional({ description: '工号(预留)' })
|
||
@IsOptional()
|
||
@IsString()
|
||
personCode?: string;
|
||
|
||
@ApiPropertyOptional({ description: '手机号' })
|
||
@IsOptional()
|
||
@IsString()
|
||
phone?: string;
|
||
|
||
@ApiPropertyOptional({ description: '岗位类型' })
|
||
@IsOptional()
|
||
@IsString()
|
||
jobType?: string;
|
||
|
||
@ApiPropertyOptional({ description: '用工类型' })
|
||
@IsOptional()
|
||
@IsString()
|
||
workType?: string;
|
||
|
||
@ApiPropertyOptional({ description: '入职日期(YYYY-MM-DD)' })
|
||
@IsOptional()
|
||
@IsDateString()
|
||
entryDate?: string;
|
||
|
||
@ApiPropertyOptional({ description: '离职日期(YYYY-MM-DD)' })
|
||
@IsOptional()
|
||
@IsDateString()
|
||
leaveDate?: string;
|
||
|
||
@ApiPropertyOptional({ description: '在职状态' })
|
||
@IsOptional()
|
||
@IsString()
|
||
employStatus?: string;
|
||
|
||
@ApiPropertyOptional({ description: '证书类型' })
|
||
@IsOptional()
|
||
@IsString()
|
||
certType?: string;
|
||
|
||
@ApiPropertyOptional({ description: '证书编号' })
|
||
@IsOptional()
|
||
@IsString()
|
||
certNo?: string;
|
||
|
||
@ApiPropertyOptional({ description: '证书等级' })
|
||
@IsOptional()
|
||
@IsString()
|
||
certLevel?: string;
|
||
|
||
@ApiPropertyOptional({ description: '证书有效期(YYYY-MM-DD)' })
|
||
@IsOptional()
|
||
@IsDateString()
|
||
certExpire?: string;
|
||
|
||
@ApiPropertyOptional({ description: '证书状态' })
|
||
@IsOptional()
|
||
@IsString()
|
||
certStatus?: string;
|
||
|
||
@ApiPropertyOptional({ description: '证书核验链接(预留)' })
|
||
@IsOptional()
|
||
@IsString()
|
||
certVerifyUrl?: string;
|
||
|
||
@ApiPropertyOptional({ description: '归属组长 staff.id' })
|
||
@IsOptional()
|
||
@IsString()
|
||
groupLeaderId?: string;
|
||
}
|
||
|
||
export class ListStaffQuery extends PageQuery {
|
||
@ApiPropertyOptional({ description: '姓名(模糊)' })
|
||
@IsOptional()
|
||
@IsString()
|
||
name?: string;
|
||
|
||
@ApiPropertyOptional({ description: '岗位类型' })
|
||
@IsOptional()
|
||
@IsString()
|
||
jobType?: string;
|
||
|
||
@ApiPropertyOptional({ description: '在职状态' })
|
||
@IsOptional()
|
||
@IsString()
|
||
employStatus?: string;
|
||
}
|
||
|
||
/** 指定归属组长;传 null 解除归属。 */
|
||
export class AssignGroupDto {
|
||
@ApiPropertyOptional({ description: '归属组长 staff.id(传 null 解除归属)', nullable: true })
|
||
@IsOptional()
|
||
groupLeaderId?: string | null;
|
||
}
|