tyt-api-nest/src/devices/dto/create-implant-catalog.dto.ts
EL 0b5640a977 调压任务流程从“发布即指派”改为“发布待接收(PENDING) -> 工程师接收(ACCEPTED) -> 完成(COMPLETED)”。
新增工程师“取消接收”能力,任务可从 ACCEPTED 回退到 PENDING。
发布任务不再要求 engineerId,并增加同设备存在未结束任务时的重复发布拦截。
完成任务新增 completionMaterials 必填校验,仅允许图片/视频凭证,并在完成时落库。
植入物目录新增 isValve,区分阀门与管子;非阀门不维护压力挡位,阀门至少 1 个挡位。
患者设备与任务查询返回新增字段,前端任务页支持接收/取消接收/上传凭证后完成。
增补 Prisma 迁移、接口文档、E2E 用例与夹具修复逻辑。
2026-03-20 06:03:09 +08:00

66 lines
1.7 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import {
ArrayMaxSize,
IsArray,
IsBoolean,
IsOptional,
IsString,
MaxLength,
} from 'class-validator';
import { ToBoolean } from '../../common/transforms/to-boolean.transform.js';
/**
* 植入物目录创建 DTO。
*/
export class CreateImplantCatalogDto {
@ApiProperty({
description: '型号编码',
example: 'CODMAN-HAKIM-120',
})
@IsString({ message: 'modelCode 必须是字符串' })
modelCode!: string;
@ApiProperty({
description: '厂家',
example: 'Codman',
})
@IsString({ message: 'manufacturer 必须是字符串' })
manufacturer!: string;
@ApiProperty({
description: '名称',
example: 'Hakim 可调压阀',
})
@IsString({ message: 'name 必须是字符串' })
name!: string;
@ApiPropertyOptional({
description: '是否为阀门,关闭时表示管子或附件',
example: true,
})
@IsOptional()
@ToBoolean()
@IsBoolean({ message: 'isValve 必须是布尔值' })
isValve?: boolean;
@ApiPropertyOptional({
description: '可调压器械的挡位列表,按字符串挡位标签录入',
type: [String],
example: ['0.5', '1', '1.5'],
})
@IsOptional()
@IsArray({ message: 'pressureLevels 必须是数组' })
@ArrayMaxSize(30, { message: 'pressureLevels 最多 30 项' })
@IsString({ each: true, message: 'pressureLevels 必须为字符串数组' })
pressureLevels?: string[];
@ApiPropertyOptional({
description: '植入物备注',
example: '适用于儿童脑积水病例',
})
@IsOptional()
@IsString({ message: 'notes 必须是字符串' })
@MaxLength(200, { message: 'notes 最长 200 个字符' })
notes?: string;
}