tychat-contracts 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/patients/create-patient.dto.d.ts +3 -0
- package/dist/patients/create-patient.dto.d.ts.map +1 -1
- package/dist/patients/create-patient.dto.js +28 -0
- package/dist/patients/index.d.ts +1 -0
- package/dist/patients/index.d.ts.map +1 -1
- package/dist/patients/index.js +1 -0
- package/dist/patients/patient-procedure.dto.d.ts +8 -0
- package/dist/patients/patient-procedure.dto.d.ts.map +1 -0
- package/dist/patients/patient-procedure.dto.js +68 -0
- package/package.json +2 -1
- package/src/patients/create-patient.dto.ts +27 -9
- package/src/patients/index.ts +1 -0
- package/src/patients/patient-procedure.dto.ts +54 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PatientProcedureDto } from './patient-procedure.dto';
|
|
1
2
|
export declare class CreatePatientDto {
|
|
2
3
|
name: string;
|
|
3
4
|
cpf: string;
|
|
@@ -5,5 +6,7 @@ export declare class CreatePatientDto {
|
|
|
5
6
|
hasDisability: boolean;
|
|
6
7
|
disabilityDescription?: string | null;
|
|
7
8
|
initialObservation?: string | null;
|
|
9
|
+
observation?: string | null;
|
|
10
|
+
procedures?: PatientProcedureDto[];
|
|
8
11
|
}
|
|
9
12
|
//# sourceMappingURL=create-patient.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-patient.dto.d.ts","sourceRoot":"","sources":["../../src/patients/create-patient.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-patient.dto.d.ts","sourceRoot":"","sources":["../../src/patients/create-patient.dto.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,qBAAa,gBAAgB;IAS3B,IAAI,EAAE,MAAM,CAAC;IAUb,GAAG,EAAE,MAAM,CAAC;IAOZ,SAAS,EAAE,MAAM,CAAC;IAOlB,aAAa,EAAE,OAAO,CAAC;IAWvB,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAUtC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAYnC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAW5B,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACpC"}
|
|
@@ -12,6 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.CreatePatientDto = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
|
+
const class_transformer_1 = require("class-transformer");
|
|
16
|
+
const class_transformer_2 = require("class-transformer");
|
|
17
|
+
const patient_procedure_dto_1 = require("./patient-procedure.dto");
|
|
15
18
|
class CreatePatientDto {
|
|
16
19
|
name;
|
|
17
20
|
cpf;
|
|
@@ -19,6 +22,8 @@ class CreatePatientDto {
|
|
|
19
22
|
hasDisability;
|
|
20
23
|
disabilityDescription;
|
|
21
24
|
initialObservation;
|
|
25
|
+
observation;
|
|
26
|
+
procedures;
|
|
22
27
|
}
|
|
23
28
|
exports.CreatePatientDto = CreatePatientDto;
|
|
24
29
|
__decorate([
|
|
@@ -81,3 +86,26 @@ __decorate([
|
|
|
81
86
|
(0, class_validator_1.MaxLength)(2000),
|
|
82
87
|
__metadata("design:type", Object)
|
|
83
88
|
], CreatePatientDto.prototype, "initialObservation", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
91
|
+
description: 'Nova observação do paciente (cria uma entrada de histórico de observações)',
|
|
92
|
+
example: 'Paciente tem alergia a penicilina',
|
|
93
|
+
maxLength: 2000,
|
|
94
|
+
}),
|
|
95
|
+
(0, class_validator_1.IsString)(),
|
|
96
|
+
(0, class_validator_1.IsOptional)(),
|
|
97
|
+
(0, class_validator_1.MaxLength)(2000),
|
|
98
|
+
(0, class_transformer_1.Transform)(({ value, obj }) => value ?? obj.notes ?? obj.observation),
|
|
99
|
+
__metadata("design:type", Object)
|
|
100
|
+
], CreatePatientDto.prototype, "observation", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
103
|
+
description: 'Lista de procedimentos que o paciente irá realizar ou realizou',
|
|
104
|
+
type: () => [patient_procedure_dto_1.PatientProcedureDto],
|
|
105
|
+
}),
|
|
106
|
+
(0, class_validator_1.IsArray)(),
|
|
107
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
108
|
+
(0, class_transformer_2.Type)(() => patient_procedure_dto_1.PatientProcedureDto),
|
|
109
|
+
(0, class_validator_1.IsOptional)(),
|
|
110
|
+
__metadata("design:type", Array)
|
|
111
|
+
], CreatePatientDto.prototype, "procedures", void 0);
|
package/dist/patients/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/patients/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/patients/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC"}
|
package/dist/patients/index.js
CHANGED
|
@@ -18,3 +18,4 @@ __exportStar(require("./create-patient.dto"), exports);
|
|
|
18
18
|
__exportStar(require("./update-patient.dto"), exports);
|
|
19
19
|
__exportStar(require("./patient-history-entry.dto"), exports);
|
|
20
20
|
__exportStar(require("./list-patients-query.dto"), exports);
|
|
21
|
+
__exportStar(require("./patient-procedure.dto"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patient-procedure.dto.d.ts","sourceRoot":"","sources":["../../src/patients/patient-procedure.dto.ts"],"names":[],"mappings":"AAWA,qBAAa,mBAAmB;IAM9B,WAAW,EAAE,MAAM,CAAC;IAUpB,IAAI,EAAE,MAAM,CAAC;IAOb,KAAK,EAAE,MAAM,CAAC;IAOd,QAAQ,EAAE,OAAO,CAAC;IAUlB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PatientProcedureDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
class PatientProcedureDto {
|
|
16
|
+
procedureId;
|
|
17
|
+
name;
|
|
18
|
+
value;
|
|
19
|
+
finished;
|
|
20
|
+
observation;
|
|
21
|
+
}
|
|
22
|
+
exports.PatientProcedureDto = PatientProcedureDto;
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, swagger_1.ApiProperty)({
|
|
25
|
+
description: 'ID do procedimento base (UUID)',
|
|
26
|
+
example: '5e8f9e3b-3b9a-4d9a-9f4b-2a1c1b9e9f1a',
|
|
27
|
+
}),
|
|
28
|
+
(0, class_validator_1.IsUUID)('4'),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], PatientProcedureDto.prototype, "procedureId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, swagger_1.ApiProperty)({
|
|
33
|
+
description: 'Nome do procedimento que o paciente irá realizar ou realizou',
|
|
34
|
+
example: 'Consulta clínica',
|
|
35
|
+
maxLength: 255,
|
|
36
|
+
}),
|
|
37
|
+
(0, class_validator_1.IsString)(),
|
|
38
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
39
|
+
(0, class_validator_1.MaxLength)(255),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], PatientProcedureDto.prototype, "name", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, swagger_1.ApiProperty)({
|
|
44
|
+
description: 'Valor monetário do procedimento',
|
|
45
|
+
example: 150.5,
|
|
46
|
+
}),
|
|
47
|
+
(0, class_validator_1.IsNumber)({ maxDecimalPlaces: 2 }),
|
|
48
|
+
__metadata("design:type", Number)
|
|
49
|
+
], PatientProcedureDto.prototype, "value", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, swagger_1.ApiProperty)({
|
|
52
|
+
description: 'Indica se o procedimento já foi finalizado',
|
|
53
|
+
example: false,
|
|
54
|
+
}),
|
|
55
|
+
(0, class_validator_1.IsBoolean)(),
|
|
56
|
+
__metadata("design:type", Boolean)
|
|
57
|
+
], PatientProcedureDto.prototype, "finished", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
60
|
+
description: 'Observação adicional sobre o procedimento',
|
|
61
|
+
example: 'Paciente chegou em jejum',
|
|
62
|
+
maxLength: 2000,
|
|
63
|
+
}),
|
|
64
|
+
(0, class_validator_1.IsString)(),
|
|
65
|
+
(0, class_validator_1.IsOptional)(),
|
|
66
|
+
(0, class_validator_1.MaxLength)(2000),
|
|
67
|
+
__metadata("design:type", Object)
|
|
68
|
+
], PatientProcedureDto.prototype, "observation", void 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tychat-contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "DTOs compartilhados com class-validator (API e microserviços)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"prepublishOnly": "npm run build"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"class-transformer": "^0.5.1",
|
|
13
14
|
"class-validator": "^0.14.1",
|
|
14
15
|
"reflect-metadata": "*"
|
|
15
16
|
},
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
IsOptional,
|
|
7
|
-
IsString,
|
|
8
|
-
Length,
|
|
9
|
-
MaxLength,
|
|
10
|
-
} from 'class-validator';
|
|
2
|
+
import { IsBoolean, IsDateString, IsNotEmpty, IsOptional, IsString, Length, MaxLength, ValidateNested, IsArray } from 'class-validator';
|
|
3
|
+
import { Transform } from 'class-transformer';
|
|
4
|
+
import { Type } from 'class-transformer';
|
|
5
|
+
import { PatientProcedureDto } from './patient-procedure.dto';
|
|
11
6
|
|
|
12
7
|
export class CreatePatientDto {
|
|
13
8
|
@ApiProperty({
|
|
@@ -64,5 +59,28 @@ export class CreatePatientDto {
|
|
|
64
59
|
@IsOptional()
|
|
65
60
|
@MaxLength(2000)
|
|
66
61
|
initialObservation?: string | null;
|
|
62
|
+
|
|
63
|
+
@ApiPropertyOptional({
|
|
64
|
+
description:
|
|
65
|
+
'Nova observação do paciente (cria uma entrada de histórico de observações)',
|
|
66
|
+
example: 'Paciente tem alergia a penicilina',
|
|
67
|
+
maxLength: 2000,
|
|
68
|
+
})
|
|
69
|
+
@IsString()
|
|
70
|
+
@IsOptional()
|
|
71
|
+
@MaxLength(2000)
|
|
72
|
+
@Transform(({ value, obj }) => value ?? obj.notes ?? obj.observation)
|
|
73
|
+
observation?: string | null;
|
|
74
|
+
|
|
75
|
+
@ApiPropertyOptional({
|
|
76
|
+
description:
|
|
77
|
+
'Lista de procedimentos que o paciente irá realizar ou realizou',
|
|
78
|
+
type: () => [PatientProcedureDto],
|
|
79
|
+
})
|
|
80
|
+
@IsArray()
|
|
81
|
+
@ValidateNested({ each: true })
|
|
82
|
+
@Type(() => PatientProcedureDto)
|
|
83
|
+
@IsOptional()
|
|
84
|
+
procedures?: PatientProcedureDto[];
|
|
67
85
|
}
|
|
68
86
|
|
package/src/patients/index.ts
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import {
|
|
3
|
+
IsBoolean,
|
|
4
|
+
IsNotEmpty,
|
|
5
|
+
IsNumber,
|
|
6
|
+
IsOptional,
|
|
7
|
+
IsString,
|
|
8
|
+
IsUUID,
|
|
9
|
+
MaxLength,
|
|
10
|
+
} from 'class-validator';
|
|
11
|
+
|
|
12
|
+
export class PatientProcedureDto {
|
|
13
|
+
@ApiProperty({
|
|
14
|
+
description: 'ID do procedimento base (UUID)',
|
|
15
|
+
example: '5e8f9e3b-3b9a-4d9a-9f4b-2a1c1b9e9f1a',
|
|
16
|
+
})
|
|
17
|
+
@IsUUID('4')
|
|
18
|
+
procedureId: string;
|
|
19
|
+
|
|
20
|
+
@ApiProperty({
|
|
21
|
+
description: 'Nome do procedimento que o paciente irá realizar ou realizou',
|
|
22
|
+
example: 'Consulta clínica',
|
|
23
|
+
maxLength: 255,
|
|
24
|
+
})
|
|
25
|
+
@IsString()
|
|
26
|
+
@IsNotEmpty()
|
|
27
|
+
@MaxLength(255)
|
|
28
|
+
name: string;
|
|
29
|
+
|
|
30
|
+
@ApiProperty({
|
|
31
|
+
description: 'Valor monetário do procedimento',
|
|
32
|
+
example: 150.5,
|
|
33
|
+
})
|
|
34
|
+
@IsNumber({ maxDecimalPlaces: 2 })
|
|
35
|
+
value: number;
|
|
36
|
+
|
|
37
|
+
@ApiProperty({
|
|
38
|
+
description: 'Indica se o procedimento já foi finalizado',
|
|
39
|
+
example: false,
|
|
40
|
+
})
|
|
41
|
+
@IsBoolean()
|
|
42
|
+
finished: boolean;
|
|
43
|
+
|
|
44
|
+
@ApiPropertyOptional({
|
|
45
|
+
description: 'Observação adicional sobre o procedimento',
|
|
46
|
+
example: 'Paciente chegou em jejum',
|
|
47
|
+
maxLength: 2000,
|
|
48
|
+
})
|
|
49
|
+
@IsString()
|
|
50
|
+
@IsOptional()
|
|
51
|
+
@MaxLength(2000)
|
|
52
|
+
observation?: string | null;
|
|
53
|
+
}
|
|
54
|
+
|