Skip to content

Commit 06feb4b

Browse files
committed
feat(INT): nuevo esquema internación estadistica
1 parent 539a069 commit 06feb4b

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import { Schema, model } from 'mongoose';
2+
import { SnomedConcept } from '../schemas/snomed-concept';
3+
import * as OrganizacionSchema from '../../../core/tm/schemas/nombre';
4+
import { AuditPlugin } from '@andes/mongoose-plugin-audit';
5+
import { ProfesionalSubSchema } from '../../../core/tm/schemas/profesional';
6+
import { ObraSocialSchema } from '../../obraSocial/schemas/obraSocial';
7+
import { PacienteSubSchema } from '../../../core-v2/mpi';
8+
import { schema as procQuirurgicosSchema } from '../../../core/tm/schemas/procedimientoQuirurgico';
9+
import { schema as Cie10 } from '../../../core/term/schemas/cie10';
10+
import { model as OcupacionSchema } from '../../../core/tm/schemas/ocupacion';
11+
12+
const InformeIngresoSchema = new Schema({
13+
fechaIngreso: {
14+
type: Date,
15+
required: true
16+
},
17+
origen: {
18+
tipo: String, // Origen hospitalización enumerado?
19+
organizacionOrigen: OrganizacionSchema, // Organización origen - solo para "traslado"
20+
otraOrganizacion: { // solo para "traslado"
21+
type: String,
22+
required: false
23+
},
24+
},
25+
ocupacionHabitual: OcupacionSchema,
26+
situacionLaboral: String,
27+
nivelInstruccion: String,
28+
especialidades: [SnomedConcept],
29+
nroCarpeta: String, // evaluar continuidad de este dato
30+
motivo: String,
31+
32+
profesional: ProfesionalSubSchema,
33+
paseAunidadOrganizativa: String, // verificar si se usa
34+
cobertura: {
35+
tipo: String, // ver que sea enumerado
36+
obraSocial: { // Obra social, ver si corresponde
37+
type: ObraSocialSchema,
38+
required: false
39+
},
40+
}
41+
42+
});
43+
44+
const InformeEgresoSchema = new Schema({
45+
fechaEgreso: Date,
46+
nacimientos: [Schema.Types.Mixed], // ver si se usa
47+
procedimientosQuirurgicos: [
48+
{
49+
procedimiento: {
50+
// revisar no incluye campo nom: que es una concatenacion de nombre y codigo
51+
type: procQuirurgicosSchema, requied: false
52+
},
53+
fecha: Date,
54+
}
55+
],
56+
causaExterna: {
57+
producidaPor: null,
58+
lugar: null,
59+
comoSeProdujo: null
60+
},
61+
diasDeEstada: Number,
62+
tipoEgreso: {
63+
tipo: String, // ver si pasa a un enumerado: alta, traslado, defuncion
64+
OrganizacionDestino: OrganizacionSchema,
65+
otraOrganizacion: { // solo para "traslado" (ex UnidadOrganizativaDestino)
66+
type: String,
67+
required: false
68+
}
69+
},
70+
diagnosticos: {
71+
principal: Cie10, // diagnosticoPrincipal
72+
secundarios: [Cie10], // otrosDiagnosticos
73+
otrasCircunstancias: Cie10,
74+
diasEstadaOtrasCircunstancias: Number,
75+
diasDePermisoDeSalida: Number
76+
}
77+
});
78+
79+
const InternacionEstadoSchema = new Schema({
80+
tipo: {
81+
type: String,
82+
enum: ['anulada', 'ejecucion', 'validada'],
83+
required: true,
84+
},
85+
});
86+
87+
export const InformeEstadisticaSchema = new Schema({
88+
organizacion: {
89+
type: OrganizacionSchema,
90+
required: true
91+
},
92+
unidadOrganizativa: {
93+
type: SnomedConcept,
94+
required: true
95+
},
96+
paciente: PacienteSubSchema,
97+
informeIngreso: {
98+
type: InformeIngresoSchema,
99+
required: true
100+
},
101+
informeEgreso: {
102+
type: InformeEgresoSchema,
103+
required: true
104+
},
105+
periodosCensables: [{ desde: Date, hasta: Date }],
106+
estados: [InternacionEstadoSchema],
107+
estadoActual: InternacionEstadoSchema,
108+
109+
});
110+
111+
InternacionEstadoSchema.plugin(AuditPlugin);
112+
InformeEstadisticaSchema.plugin(AuditPlugin);
113+
InformeIngresoSchema.plugin(AuditPlugin);
114+
InformeEgresoSchema.plugin(AuditPlugin);
115+
116+
export const InformeEstadistica = model('internacionFormEstadistica', InformeEstadisticaSchema, 'internacionFormEstadistica');

0 commit comments

Comments
 (0)