├── jobs ├── index.ts ├── jobExportFichasSnvsSisa.ts ├── jobMapaDeCamasExport.ts ├── jobEspecialidadExport.ts ├── perfilesJob.ts ├── censoMensualJob.ts ├── vencimientoPrestacion.ts ├── desactivarUsuarios.ts ├── actualizarCarpetasJob.ts ├── vencimientoRecetas.ts ├── jobExportNexosSisa.ts ├── jobLAMP.ts ├── verificaMatriculasGrado.ts ├── perinatalUpdateJob.ts ├── verificaMatriculasPosgrado.ts ├── actualizar-inscriptos-fallecidos.ts ├── roboSenderJob.ts ├── actualizarTurnosMobile.ts ├── actualizarTurnosDelDiaJob.ts ├── recordarTurnosJob.ts ├── recordatorioAgendaJob.ts ├── farmaciasJob.ts ├── pecasConsolidadoJob.ts ├── actualizarAgendasJob.ts ├── actualizarEstadosAgenda.ts ├── exportCovid19.ts ├── manual.ts └── fueraDeAgendaJob.ts ├── .gitattributes ├── .github ├── CODEOWNERS ├── labeler.yml ├── workflows │ ├── labeler.yml │ ├── has_conflic.yml │ ├── build.yml │ └── release.yml └── issue_template.md ├── modules ├── hl7v2 │ ├── index.ts │ ├── hl7v2-config.controller.ts │ └── hl7v2Log.ts ├── pacs │ ├── index.ts │ ├── pacs.logs.ts │ └── pacs-config.controller.ts ├── descargas │ ├── model │ │ ├── template-example.html │ │ ├── barcode.ts │ │ └── html-component.class.ts │ ├── matriculaciones │ │ ├── certificado-etica-footer.ts │ │ ├── certificado-etica-header.ts │ │ └── certificado-etica.ts │ ├── recupero-costo │ │ ├── recupero-costo.interface.ts │ │ └── recupero-costo-header.ts │ ├── informe-turnos │ │ ├── turnos-header.ts │ │ └── informe-turnos.ts │ ├── puco │ │ ├── constancia-puco-header.ts │ │ └── constancia-puco.ts │ ├── laboratorio │ │ ├── laboratorio-footer.ts │ │ ├── laboratorio-header.ts │ │ └── laboratorio.ts │ ├── ficha-epidemiologica │ │ ├── ficha-footer.ts │ │ ├── ficha-header.ts │ │ └── ficha.ts │ ├── com │ │ └── derivacion.ts │ └── informe-rup │ │ └── elementos-rup │ │ ├── autocitado.component.ts │ │ ├── valor-numerico.component.ts │ │ ├── seccion │ │ └── seccionado.component.ts │ │ ├── observaciones.component.ts │ │ └── lugar-nacimiento.componenet.ts ├── insumos │ ├── index.ts │ ├── insumos-schema.ts │ └── insumos.routes.ts ├── recetas │ ├── index.ts │ ├── parametros.schema.ts │ └── recetas.error.ts ├── semaforo │ ├── index.ts │ ├── semaforo.routes.ts │ └── semaforo.schema.ts ├── turnos │ ├── index.ts │ ├── condicionPaciente │ │ ├── index.ts │ │ └── condicionPaciente.schema.ts │ ├── schemas │ │ └── busquedasAgenda.ts │ └── institucion.routes.ts ├── constantes │ ├── index.ts │ ├── constantes.schema.ts │ └── constantes.routes.ts ├── dispositivo │ ├── index.ts │ ├── dispositivo.schema.ts │ └── dispositivo.routes.ts ├── huds │ ├── motivosHuds │ │ ├── index.ts │ │ ├── motivosHuds.schema.ts │ │ └── motivosHuds.routes.ts │ ├── index.ts │ └── export-huds │ │ ├── index.ts │ │ ├── exportHuds.log.ts │ │ ├── hudsFiles.ts │ │ └── exportHuds.schema.ts ├── webhook │ ├── webhooklog │ │ ├── index.ts │ │ ├── webhooklog.schema.ts │ │ └── webhooklog.routes.ts │ ├── index.ts │ ├── logger │ │ └── laboratorioCentralLog.ts │ └── webhook.schema.ts ├── registro-novedades │ ├── index.ts │ ├── images │ │ └── schemas │ │ │ └── imageStore.ts │ └── novedades.schema.ts ├── perinatal │ ├── index.ts │ └── perinatal.log.ts ├── gestor-usuarios │ ├── index.ts │ └── perfil.schema.ts ├── mobileApp │ ├── index.ts │ ├── registroMobile.log.ts │ ├── schemas │ │ ├── device.ts │ │ ├── categoria.ts │ │ ├── recordatorio.ts │ │ └── minuta.ts │ ├── routes │ │ ├── gestion.ts │ │ └── categoria.ts │ ├── sendMessageCache.routes.ts │ ├── pacienteApp.routes.ts │ └── controller │ │ └── PushClientFCM.ts ├── seguimiento-paciente │ ├── index.ts │ └── schemas │ │ └── contacto-estrecho.schema.ts ├── fuentesAutenticas │ └── interfaces.ts ├── personalSalud │ ├── index.ts │ └── personal-salud.schema.ts ├── centroOperativoMedico │ ├── index.ts │ ├── schemas │ │ ├── tipoTraslado.schema.ts │ │ ├── comStore.schema.ts │ │ └── reglasDerivacion.schema.ts │ ├── tipoTraslado.routes.ts │ └── reglasDerivacion.routes.ts ├── facturacionAutomatica │ ├── schemas │ │ └── estadoFacturacion.ts │ └── controller │ │ └── facturacionAutomaticaController.ts ├── obraSocial │ ├── obraSocialLog.ts │ ├── controller │ │ ├── sumar.ts │ │ └── profe.ts │ └── schemas │ │ ├── profe.ts │ │ ├── padronPrepagas.ts │ │ └── sumar.ts ├── carpetas │ ├── schemas │ │ ├── ultimaCarpeta.ts │ │ └── carpetaPaciente.ts │ └── controller │ │ └── carpetaPacienteController.ts ├── rup │ ├── jobs │ │ └── sala-comun.job.ts │ ├── controllers │ │ └── rup.events.log.ts │ ├── schemas │ │ ├── snomed-concept.ts │ │ ├── prestacion-adjuntos.ts │ │ ├── semantic-tag.ts │ │ └── prestacion.solicitud.historial.ts │ ├── laboratorio.log.ts │ ├── routes │ │ └── hudsExtras.ts │ └── internacion │ │ ├── internacion.log.ts │ │ └── index.ts ├── turnero │ └── schemas │ │ └── turno.ts ├── sisa │ └── logger │ │ └── sisaLog.ts ├── vacunas │ ├── inscripcion-vacunas.interface.ts │ ├── schemas │ │ ├── nomivacCategoria.schema.ts │ │ ├── nomivacCondicion.schema.ts │ │ ├── nomivacLote.schema.ts │ │ ├── nomivacLaboratorios.schema.ts │ │ ├── vacunas.ts │ │ ├── nomivacVacuna.schema.ts │ │ └── nomivacEsquema.schema.ts │ ├── nomivacCategoria.route.ts │ ├── nomivacCondicion.route.ts │ ├── nomivacLaboratorio.route.ts │ ├── nomivacVacuna.route.ts │ ├── nomivacLote.route.ts │ ├── routes │ │ └── vacunas-pacientes.routes.ts │ └── nomivacDosis.route.ts ├── version │ └── routes │ │ └── routes.ts ├── forms │ ├── forms-epidemiologia │ │ ├── constantes.ts │ │ ├── forms-history.schema.ts │ │ └── forms-history.routes.ts │ ├── index.ts │ ├── forms-resources │ │ ├── forms-resources-schema.ts │ │ ├── forms-preset-resources-schema.ts │ │ ├── forms-resources-routes.ts │ │ └── forms-preset-resources-routes.ts │ └── forms.routes.ts ├── cda │ ├── controller │ │ ├── class │ │ │ ├── Organization.ts │ │ │ └── interfaces.ts │ │ ├── schema │ │ │ └── CDA.xsd │ │ └── builder │ │ │ ├── BaseBuilder.ts │ │ │ └── OrganizationBuilder.ts │ └── schemas │ │ └── CDAFiles.ts ├── matriculaciones │ ├── controller │ │ ├── matriculaciones.log.ts │ │ └── matriculaciones.ts │ ├── schemas │ │ ├── modalidadesCertificacion.ts │ │ ├── entidadFormadora.ts │ │ ├── matriculacion.ts │ │ ├── numeracionMatriculas.ts │ │ ├── agendaMatriculaciones.ts │ │ ├── turno.ts │ │ └── cambioDni.ts │ └── routes │ │ ├── entidadFormadora.ts │ │ └── modalidadesCertificacion.ts ├── prestamosCarpetas │ └── schemas │ │ └── constantes.ts └── georeferencia │ └── areaPrograma.schema.ts ├── packages ├── drive │ ├── index.ts │ ├── adapters │ │ ├── index.ts │ │ └── IAdapter.interface.ts │ ├── package.json │ ├── middleware │ │ └── multer.ts │ └── file-descriptor │ │ ├── controller.ts │ │ └── schemas.ts └── event-bus │ ├── package.json │ ├── index.d.ts │ └── index.ts ├── templates ├── arancelamiento │ ├── sass │ │ └── variables │ │ │ ├── cromaticas.scss │ │ │ └── formales.scss │ └── img │ │ ├── logo-pdp.png │ │ ├── logo-andes-h.png │ │ ├── logo-adicional.png │ │ ├── logo-adicional-neuquen.png │ │ ├── logo-adicional-sanJuan.png │ │ └── efectores │ │ └── hospital-provincial-neuquen-dr-eduardo-castro-rendon.png ├── rup │ └── informes │ │ ├── sass │ │ └── variables │ │ │ ├── cromaticas.scss │ │ │ └── formales.scss │ │ └── img │ │ ├── logo-pdp.png │ │ ├── logo-pdp-h.png │ │ ├── logo-andes-h.png │ │ ├── firmas │ │ ├── firma-1.jpg │ │ ├── firma-1.png │ │ └── firma-2.png │ │ ├── logo-adicional.png │ │ ├── logo-adicional-neuquen.png │ │ ├── logo-adicional-sanJuan.png │ │ └── efectores │ │ └── hospital-provincial-neuquen-dr-eduardo-castro-rendon.png ├── puco │ ├── img │ │ ├── header-puco.jpg │ │ └── header-sumar.png │ └── constancia.scss ├── matriculaciones │ └── img │ │ ├── sello.png │ │ ├── firma-supervisor.png │ │ ├── header_credencial.png │ │ ├── Logomatriculaciones.png │ │ ├── colores-credencial.png │ │ ├── firma-jefe-registro.png │ │ └── header-matriculaciones.png ├── recupero-costo │ └── img │ │ ├── logo.png │ │ └── logosalud.png ├── ficha-epidemiologica │ ├── img │ │ └── logoEpidemio.png │ └── ficha-epidemiologica.scss ├── emails │ ├── recover-password.html │ └── otp-code.html └── laboratorio │ └── laboratorio.scss ├── shared ├── interfaces │ ├── nombre.interface.ts │ ├── nombreApellido.interface.ts │ ├── ubicacion.interface.ts │ ├── index.ts │ ├── contacto.interface.ts │ ├── constantes.interface.ts │ ├── relacion.interface.ts │ └── direccion.interface.ts └── schemas │ ├── nombreApellido.ts │ ├── index.ts │ ├── ubicacion.ts │ ├── nombre.ts │ └── contacto.ts ├── swagger ├── static │ ├── favicon-16x16.png │ └── favicon-32x32.png └── definitions.yml ├── core-v2 └── mpi │ ├── validacion │ ├── index.ts │ ├── validacion.error.ts │ └── validacion.interfaces.ts │ ├── financiador │ ├── index.ts │ ├── financiador.schema.ts │ └── financiador.interface.ts │ ├── jobs │ ├── updateFotoJob.ts │ ├── mpiCorrectorJob.ts │ ├── chequearRegexJob.ts │ ├── updateFuzzyJob.ts │ ├── updateValidadosJob.ts │ ├── generateTokens.ts │ ├── updateRelacionesPacientesJob.ts │ └── importarNacimientosJob.ts │ ├── paciente │ ├── index.ts │ ├── paciente.error.ts │ └── pacienteFallecimiento.schema.ts │ ├── parentesco │ ├── parentesco.interface.ts │ ├── parentesco.schema.ts │ └── parentesco.routes.ts │ ├── index.ts │ └── pacientes-empadronados │ ├── pacientes-empadronados.schema.ts │ └── pacientes-empadronados.routes.ts ├── core ├── tm │ ├── schemas │ │ ├── pais.ts │ │ ├── pais_model.ts │ │ ├── nombreApellido.ts │ │ ├── provincia_model.ts │ │ ├── nombre.ts │ │ ├── profesion_model.ts │ │ ├── financiador.ts │ │ ├── provincia.ts │ │ ├── especialidad_model.ts │ │ ├── tipoEstablecimiento_model.ts │ │ ├── tipoEstablecimiento.ts │ │ ├── especialidadesFT.ts │ │ ├── barrio.ts │ │ ├── zonaSanitarias.ts │ │ ├── ocupacion.ts │ │ ├── disclaimer.ts │ │ ├── mapeo.ts │ │ ├── edificio.ts │ │ ├── ubicacion.ts │ │ ├── firmaAdmin.ts │ │ ├── firmaProf.ts │ │ ├── imagenes.ts │ │ ├── contacto.ts │ │ ├── unidadOrganizativa.ts │ │ ├── servicio-intermedio.schema.ts │ │ ├── areaAraucania.ts │ │ ├── procedimientoQuirurgico.ts │ │ ├── areaProgramaProvincial.ts │ │ ├── especialidad.ts │ │ ├── localidad.ts │ │ ├── direccion.ts │ │ ├── profesion.ts │ │ ├── eclqueries.schema.ts │ │ ├── grupo-poblacional.schema.ts │ │ └── modulos.schema.ts │ ├── interfaces │ │ ├── IContacto.ts │ │ ├── ITipoEstablecimiento.ts │ │ ├── profesional.interface.ts │ │ ├── interfaceProfesional.ts │ │ ├── ISectores.ts │ │ ├── IDireccion.ts │ │ └── IUbicacion.ts │ ├── areaAraucania.routes.ts │ ├── routes │ │ ├── disclaimer.ts │ │ ├── organizacionCache.ts │ │ ├── tipoEstablecimiento.ts │ │ ├── profesion.ts │ │ ├── especialidadesFT.ts │ │ ├── sms.ts │ │ ├── ocupacion.ts │ │ └── procedimientoQuirurgico.ts │ ├── zonaSanitaria.routes.ts │ ├── areaProgramaProvincial.ts │ ├── eclqueries.routes.ts │ ├── index.ts │ └── modulos.routes.ts ├── log │ ├── system.log.ts │ └── schemas │ │ ├── logJobs.ts │ │ └── logExportaInformacion.ts ├── status │ └── routes │ │ └── status.ts └── term │ └── schemas │ ├── prestacionLegacy.ts │ ├── staticmapping.ts │ ├── mapping.ts │ ├── cie10.ts │ └── configuracionPrestacion.ts ├── auth └── schemas │ ├── app-token.interface.ts │ ├── paciente-token.interface.ts │ ├── token.interface.ts │ ├── user-token.interface.ts │ ├── authApps.ts │ └── permisos-organizaciones.ts ├── .dockerignore ├── docker-compose.yml ├── connect └── fhir │ └── controllers │ └── errorCodes.ts ├── seed.sh ├── apm.ts ├── .gitignore ├── utils ├── loggerJobs.ts ├── geoJson │ └── geoSalud-layers.schema.ts ├── scriptsMongo │ └── createExternalAppsToken.ts ├── requestHandler.ts └── utilCoordenadas.ts ├── jest.config.js ├── scripts ├── EP-167.ts ├── index.ts ├── update-pacientes-ficha.ts ├── MISC-85.ts ├── gdu-22.ts ├── VAC-108.ts ├── core-68.ts ├── tag-vacunas.ts ├── vac-41.ts └── deleteFoto.ts └── Dockerfile /jobs/index.ts: -------------------------------------------------------------------------------- 1 | require('./manual'); 2 | 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=TypeScript -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @andes/testing @andes/code-review -------------------------------------------------------------------------------- /modules/hl7v2/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Hl7v2'; 2 | -------------------------------------------------------------------------------- /modules/pacs/index.ts: -------------------------------------------------------------------------------- 1 | export * from './pacs'; 2 | -------------------------------------------------------------------------------- /packages/drive/index.ts: -------------------------------------------------------------------------------- 1 | export * from './drive'; 2 | -------------------------------------------------------------------------------- /modules/descargas/model/template-example.html: -------------------------------------------------------------------------------- 1 |
{{nombre}}
-------------------------------------------------------------------------------- /modules/insumos/index.ts: -------------------------------------------------------------------------------- 1 | export { InsumosRouter } from './insumos.routes'; 2 | -------------------------------------------------------------------------------- /modules/recetas/index.ts: -------------------------------------------------------------------------------- 1 | export { RecetasRouter } from './recetas.routes'; 2 | -------------------------------------------------------------------------------- /templates/arancelamiento/sass/variables/cromaticas.scss: -------------------------------------------------------------------------------- 1 | $andes-gris: #a7a7a7; -------------------------------------------------------------------------------- /templates/rup/informes/sass/variables/cromaticas.scss: -------------------------------------------------------------------------------- 1 | $andes-gris: #a7a7a7; -------------------------------------------------------------------------------- /modules/semaforo/index.ts: -------------------------------------------------------------------------------- 1 | export { SemaforoRouter } from './semaforo.routes'; 2 | -------------------------------------------------------------------------------- /templates/rup/informes/sass/variables/formales.scss: -------------------------------------------------------------------------------- 1 | $borderBottom: solid 1px black; -------------------------------------------------------------------------------- /modules/turnos/index.ts: -------------------------------------------------------------------------------- 1 | export { InstitucionRouter } from './institucion.routes'; 2 | -------------------------------------------------------------------------------- /templates/arancelamiento/sass/variables/formales.scss: -------------------------------------------------------------------------------- 1 | $borderBottom: solid 1px black; -------------------------------------------------------------------------------- /modules/constantes/index.ts: -------------------------------------------------------------------------------- 1 | export { ConstantesRouter } from './constantes.routes'; 2 | 3 | -------------------------------------------------------------------------------- /modules/dispositivo/index.ts: -------------------------------------------------------------------------------- 1 | export { DispositivoRouter } from './dispositivo.routes'; 2 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | script: 2 | - scripts/* 3 | config: 4 | - config.private.ts.example -------------------------------------------------------------------------------- /modules/huds/motivosHuds/index.ts: -------------------------------------------------------------------------------- 1 | export { MotivosHudsRouter } from './motivosHuds.routes'; 2 | -------------------------------------------------------------------------------- /modules/webhook/webhooklog/index.ts: -------------------------------------------------------------------------------- 1 | export { WebhookLogRouter } from './webhooklog.routes'; 2 | -------------------------------------------------------------------------------- /shared/interfaces/nombre.interface.ts: -------------------------------------------------------------------------------- 1 | export interface INombre { 2 | nombre: String; 3 | } 4 | -------------------------------------------------------------------------------- /modules/webhook/index.ts: -------------------------------------------------------------------------------- 1 | import './webhook'; 2 | export { WebhookRouter } from './webhook.routes'; 3 | -------------------------------------------------------------------------------- /swagger/static/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/swagger/static/favicon-16x16.png -------------------------------------------------------------------------------- /swagger/static/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/swagger/static/favicon-32x32.png -------------------------------------------------------------------------------- /templates/puco/img/header-puco.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/puco/img/header-puco.jpg -------------------------------------------------------------------------------- /core-v2/mpi/validacion/index.ts: -------------------------------------------------------------------------------- 1 | export * from './validacion.controller'; 2 | export * from './validacion.routes'; 3 | -------------------------------------------------------------------------------- /modules/turnos/condicionPaciente/index.ts: -------------------------------------------------------------------------------- 1 | export { CondicionPacienteRouter } from './condicionPaciente.routes'; 2 | -------------------------------------------------------------------------------- /templates/puco/img/header-sumar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/puco/img/header-sumar.png -------------------------------------------------------------------------------- /core-v2/mpi/financiador/index.ts: -------------------------------------------------------------------------------- 1 | export * from './financiador.interface'; 2 | export * from './financiador.schema'; 3 | -------------------------------------------------------------------------------- /modules/registro-novedades/index.ts: -------------------------------------------------------------------------------- 1 | 2 | export { NovedadesRouter } from './../registro-novedades/novedades.routes'; 3 | -------------------------------------------------------------------------------- /templates/matriculaciones/img/sello.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/matriculaciones/img/sello.png -------------------------------------------------------------------------------- /templates/recupero-costo/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/recupero-costo/img/logo.png -------------------------------------------------------------------------------- /templates/rup/informes/img/logo-pdp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/rup/informes/img/logo-pdp.png -------------------------------------------------------------------------------- /templates/arancelamiento/img/logo-pdp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/arancelamiento/img/logo-pdp.png -------------------------------------------------------------------------------- /templates/rup/informes/img/logo-pdp-h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/rup/informes/img/logo-pdp-h.png -------------------------------------------------------------------------------- /templates/recupero-costo/img/logosalud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/recupero-costo/img/logosalud.png -------------------------------------------------------------------------------- /templates/rup/informes/img/logo-andes-h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/rup/informes/img/logo-andes-h.png -------------------------------------------------------------------------------- /swagger/definitions.yml: -------------------------------------------------------------------------------- 1 | tags: 2 | - name: cda 3 | - name: fhir 4 | - name: mpi 5 | description: Indice Maestro de Paciente 6 | -------------------------------------------------------------------------------- /templates/arancelamiento/img/logo-andes-h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/arancelamiento/img/logo-andes-h.png -------------------------------------------------------------------------------- /templates/rup/informes/img/firmas/firma-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/rup/informes/img/firmas/firma-1.jpg -------------------------------------------------------------------------------- /templates/rup/informes/img/firmas/firma-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/rup/informes/img/firmas/firma-1.png -------------------------------------------------------------------------------- /templates/rup/informes/img/firmas/firma-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/rup/informes/img/firmas/firma-2.png -------------------------------------------------------------------------------- /templates/rup/informes/img/logo-adicional.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/rup/informes/img/logo-adicional.png -------------------------------------------------------------------------------- /shared/interfaces/nombreApellido.interface.ts: -------------------------------------------------------------------------------- 1 | export interface INombreApellido { 2 | nombre: String; 3 | apellido: String; 4 | } 5 | -------------------------------------------------------------------------------- /templates/arancelamiento/img/logo-adicional.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/arancelamiento/img/logo-adicional.png -------------------------------------------------------------------------------- /modules/huds/index.ts: -------------------------------------------------------------------------------- 1 | export { HudsAccesosCtr } from './hudsAccesos.controller'; 2 | export { HudsAccesoRouter } from './hudsAccesos.routes'; 3 | -------------------------------------------------------------------------------- /templates/ficha-epidemiologica/img/logoEpidemio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/ficha-epidemiologica/img/logoEpidemio.png -------------------------------------------------------------------------------- /templates/matriculaciones/img/firma-supervisor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/matriculaciones/img/firma-supervisor.png -------------------------------------------------------------------------------- /templates/matriculaciones/img/header_credencial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/matriculaciones/img/header_credencial.png -------------------------------------------------------------------------------- /modules/perinatal/index.ts: -------------------------------------------------------------------------------- 1 | export { CarnetPerinatalRouter } from './carnet-perinatal.routes'; 2 | require('./controller/carnet-perinatal.events'); 3 | -------------------------------------------------------------------------------- /templates/matriculaciones/img/Logomatriculaciones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/matriculaciones/img/Logomatriculaciones.png -------------------------------------------------------------------------------- /templates/matriculaciones/img/colores-credencial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/matriculaciones/img/colores-credencial.png -------------------------------------------------------------------------------- /templates/matriculaciones/img/firma-jefe-registro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/matriculaciones/img/firma-jefe-registro.png -------------------------------------------------------------------------------- /templates/rup/informes/img/logo-adicional-neuquen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/rup/informes/img/logo-adicional-neuquen.png -------------------------------------------------------------------------------- /templates/rup/informes/img/logo-adicional-sanJuan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/rup/informes/img/logo-adicional-sanJuan.png -------------------------------------------------------------------------------- /modules/gestor-usuarios/index.ts: -------------------------------------------------------------------------------- 1 | export { UsuariosRouter } from './usuarios.routes'; 2 | export { PerfilesRouter, PerfilesCtr } from './perfil.routes'; 3 | -------------------------------------------------------------------------------- /templates/arancelamiento/img/logo-adicional-neuquen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/arancelamiento/img/logo-adicional-neuquen.png -------------------------------------------------------------------------------- /templates/arancelamiento/img/logo-adicional-sanJuan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/arancelamiento/img/logo-adicional-sanJuan.png -------------------------------------------------------------------------------- /templates/matriculaciones/img/header-matriculaciones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/matriculaciones/img/header-matriculaciones.png -------------------------------------------------------------------------------- /modules/mobileApp/index.ts: -------------------------------------------------------------------------------- 1 | export { PacienteAppRouter } from './pacienteApp.routes'; 2 | export { SendMessageCacheRouter } from './sendMessageCache.routes'; 3 | -------------------------------------------------------------------------------- /modules/seguimiento-paciente/index.ts: -------------------------------------------------------------------------------- 1 | export { SeguimientoPacienteRouter } from './seguimiento-paciente.route'; 2 | require('./seguimiento-pacientes.events'); 3 | -------------------------------------------------------------------------------- /core-v2/mpi/jobs/updateFotoJob.ts: -------------------------------------------------------------------------------- 1 | import { updateFoto } from './updateFoto'; 2 | 3 | function run(done) { 4 | updateFoto(done); 5 | } 6 | 7 | export = run; 8 | -------------------------------------------------------------------------------- /core-v2/mpi/validacion/validacion.error.ts: -------------------------------------------------------------------------------- 1 | export class ValidacionFailed extends Error { 2 | status = 200; 3 | message = 'ciudadano no encontrado'; 4 | } 5 | -------------------------------------------------------------------------------- /core-v2/mpi/jobs/mpiCorrectorJob.ts: -------------------------------------------------------------------------------- 1 | import { mpiCorrector } from './mpiCorrector'; 2 | 3 | function run(done) { 4 | mpiCorrector(done); 5 | } 6 | 7 | export = run; 8 | -------------------------------------------------------------------------------- /core/tm/schemas/pais.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const paisSchema = new mongoose.Schema({ 4 | nombre: String 5 | }); 6 | export = paisSchema; 7 | -------------------------------------------------------------------------------- /core-v2/mpi/jobs/chequearRegexJob.ts: -------------------------------------------------------------------------------- 1 | import { regexChecker } from './regexChecker'; 2 | 3 | function run(done) { 4 | regexChecker(done); 5 | } 6 | 7 | export = run; 8 | -------------------------------------------------------------------------------- /modules/fuentesAutenticas/interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface RenaperConfig { 2 | url: string; 3 | usuario: string; 4 | password: string; 5 | server: string; 6 | } 7 | -------------------------------------------------------------------------------- /modules/personalSalud/index.ts: -------------------------------------------------------------------------------- 1 | export { PersonalSaludRouter, PersonalSaludCtr } from './personal-salud.routes'; 2 | export { PersonalSalud } from './personal-salud.schema'; 3 | -------------------------------------------------------------------------------- /jobs/jobExportFichasSnvsSisa.ts: -------------------------------------------------------------------------------- 1 | import { exportFichaSNVS } from './exportNexosFichaSisa'; 2 | 3 | function run(done) { 4 | exportFichaSNVS(done); 5 | } 6 | 7 | export = run; 8 | -------------------------------------------------------------------------------- /jobs/jobMapaDeCamasExport.ts: -------------------------------------------------------------------------------- 1 | import { exportInternacion } from './mapaDeCamasExport'; 2 | 3 | function run(done) { 4 | exportInternacion(done); 5 | } 6 | 7 | export = run; 8 | -------------------------------------------------------------------------------- /core-v2/mpi/jobs/updateFuzzyJob.ts: -------------------------------------------------------------------------------- 1 | import { updateFuzzy } from './updateFuzzy'; 2 | 3 | function run(done) { 4 | updateFuzzy(done, ['documento']); 5 | } 6 | 7 | export = run; 8 | -------------------------------------------------------------------------------- /core-v2/mpi/jobs/updateValidadosJob.ts: -------------------------------------------------------------------------------- 1 | import { updateValidados } from './updateValidados'; 2 | 3 | function run(done) { 4 | updateValidados(done); 5 | } 6 | 7 | export = run; 8 | -------------------------------------------------------------------------------- /core-v2/mpi/validacion/validacion.interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface RenaperConfig { 2 | url: string; 3 | usuario: string; 4 | password: string; 5 | server: string; 6 | } 7 | -------------------------------------------------------------------------------- /jobs/jobEspecialidadExport.ts: -------------------------------------------------------------------------------- 1 | import { exportEspecialidad } from './especialidadExport'; 2 | 3 | function run(done) { 4 | exportEspecialidad(done); 5 | } 6 | 7 | export = run; 8 | -------------------------------------------------------------------------------- /core-v2/mpi/jobs/generateTokens.ts: -------------------------------------------------------------------------------- 1 | import { generateTokensPatient } from './updateFuzzy'; 2 | 3 | function run(done) { 4 | generateTokensPatient(done); 5 | } 6 | 7 | export = run; 8 | -------------------------------------------------------------------------------- /core/tm/interfaces/IContacto.ts: -------------------------------------------------------------------------------- 1 | export interface IContacto { 2 | tipo: any; 3 | valor: string; 4 | ranking: number; 5 | activo: boolean; 6 | ultimaActualizacion: Date; 7 | } 8 | -------------------------------------------------------------------------------- /core/tm/schemas/pais_model.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as paisSchema from './pais'; 3 | 4 | const pais = mongoose.model('pais', paisSchema, 'pais'); 5 | export = pais; 6 | -------------------------------------------------------------------------------- /jobs/perfilesJob.ts: -------------------------------------------------------------------------------- 1 | import { actualizarPerfiles } from '../utils/scriptsMongo/actualizarPerfiles'; 2 | 3 | function run(done) { 4 | actualizarPerfiles(done); 5 | } 6 | 7 | export = run; 8 | -------------------------------------------------------------------------------- /shared/schemas/nombreApellido.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const NombreApellidoSchema = new mongoose.Schema({ 4 | nombre: String, 5 | apellido: String 6 | }); 7 | -------------------------------------------------------------------------------- /core/tm/schemas/nombreApellido.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const NombreApellidoSchema = new mongoose.Schema({ 4 | nombre: String, 5 | apellido: String 6 | }); 7 | -------------------------------------------------------------------------------- /core/tm/interfaces/ITipoEstablecimiento.ts: -------------------------------------------------------------------------------- 1 | export interface ITipoEstablecimiento { 2 | nombre: String; 3 | descripcion: String; 4 | clasificacion: String; 5 | idTipoEfector: Number; 6 | } 7 | -------------------------------------------------------------------------------- /jobs/censoMensualJob.ts: -------------------------------------------------------------------------------- 1 | 2 | import { censoMensualJob } from '../modules/rup/internacion/censo.controller'; 3 | 4 | async function run(done) { 5 | censoMensualJob(done); 6 | } 7 | 8 | export = run; 9 | -------------------------------------------------------------------------------- /jobs/vencimientoPrestacion.ts: -------------------------------------------------------------------------------- 1 | import { vencimientoPrestacion } from './../modules/rup/controllers/prestacion'; 2 | async function run(done) { 3 | await vencimientoPrestacion(done); 4 | } 5 | export = run; 6 | -------------------------------------------------------------------------------- /auth/schemas/app-token.interface.ts: -------------------------------------------------------------------------------- 1 | import { Token } from './token.interface'; 2 | 3 | export interface AppToken extends Token { 4 | app: { 5 | id: string; 6 | nombre: string; 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /jobs/desactivarUsuarios.ts: -------------------------------------------------------------------------------- 1 | 2 | import { verificarUltimoLogueo } from './../core/tm/controller/authUser'; 3 | 4 | async function run(done) { 5 | await verificarUltimoLogueo(done); 6 | } 7 | 8 | export = run; 9 | -------------------------------------------------------------------------------- /core-v2/mpi/paciente/index.ts: -------------------------------------------------------------------------------- 1 | export { replaceChars } from './paciente.schema'; 2 | export { PacienteCtr, PacienteRouter } from './paciente.routes'; 3 | export { Paciente, PacienteSubSchema } from './paciente.schema'; 4 | -------------------------------------------------------------------------------- /core-v2/mpi/jobs/updateRelacionesPacientesJob.ts: -------------------------------------------------------------------------------- 1 | import { updateRelacionesPacientes } from './updateRelacionesPacientes'; 2 | 3 | function run(done) { 4 | updateRelacionesPacientes(done); 5 | } 6 | 7 | export = run; 8 | -------------------------------------------------------------------------------- /jobs/actualizarCarpetasJob.ts: -------------------------------------------------------------------------------- 1 | 2 | import * as carpetasCtrl from './../modules/turnos/controller/carpetasController/carpetasController'; 3 | 4 | function run() { 5 | carpetasCtrl.migrar(); 6 | } 7 | 8 | export = run; 9 | -------------------------------------------------------------------------------- /jobs/vencimientoRecetas.ts: -------------------------------------------------------------------------------- 1 | import { actualizarEstadosRecetas } from './../modules/recetas/recetasController'; 2 | 3 | async function run(done) { 4 | await actualizarEstadosRecetas(done); 5 | } 6 | 7 | export = run; 8 | -------------------------------------------------------------------------------- /shared/schemas/index.ts: -------------------------------------------------------------------------------- 1 | export * from '../constantes'; 2 | export * from './contacto'; 3 | export * from './direccion'; 4 | export * from './nombre'; 5 | export * from './nombreApellido'; 6 | export * from './ubicacion'; 7 | -------------------------------------------------------------------------------- /jobs/jobExportNexosSisa.ts: -------------------------------------------------------------------------------- 1 | import { exportSisa } from './exportNexosSisa'; 2 | 3 | function run(done) { 4 | const horas = process.env.HORAS || '4'; 5 | exportSisa(done, parseInt(horas, 10)); 6 | } 7 | 8 | export = run; 9 | -------------------------------------------------------------------------------- /jobs/jobLAMP.ts: -------------------------------------------------------------------------------- 1 | import { importLAMPResults } from './../modules/forms/forms-epidemiologia/controller/forms-epidemiologia.controller'; 2 | 3 | 4 | async function run() { 5 | await importLAMPResults(); 6 | } 7 | export = run; 8 | -------------------------------------------------------------------------------- /jobs/verificaMatriculasGrado.ts: -------------------------------------------------------------------------------- 1 | 2 | import { vencimientoMatriculaGrado } from './../core/tm/controller/profesional'; 3 | 4 | async function run(done) { 5 | await vencimientoMatriculaGrado(done); 6 | } 7 | 8 | export = run; 9 | -------------------------------------------------------------------------------- /templates/rup/informes/img/efectores/hospital-provincial-neuquen-dr-eduardo-castro-rendon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/rup/informes/img/efectores/hospital-provincial-neuquen-dr-eduardo-castro-rendon.png -------------------------------------------------------------------------------- /modules/centroOperativoMedico/index.ts: -------------------------------------------------------------------------------- 1 | export { ReglasDerivacionRouter } from './reglasDerivacion.routes'; 2 | export { DerivacionesRouter } from './derivaciones.routes'; 3 | export { TipoTrasladoRouter } from './tipoTraslado.routes'; 4 | -------------------------------------------------------------------------------- /templates/arancelamiento/img/efectores/hospital-provincial-neuquen-dr-eduardo-castro-rendon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andes/api/HEAD/templates/arancelamiento/img/efectores/hospital-provincial-neuquen-dr-eduardo-castro-rendon.png -------------------------------------------------------------------------------- /core/tm/interfaces/profesional.interface.ts: -------------------------------------------------------------------------------- 1 | export interface IProfesional { 2 | nombre: string; 3 | apellido: string; 4 | documento: string; 5 | fechaNacimiento: Date; 6 | sexo: string; 7 | genero: string; 8 | } 9 | -------------------------------------------------------------------------------- /core/tm/schemas/provincia_model.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as provinciaSchema from './provincia'; 3 | 4 | const provincia = mongoose.model('provincia', provinciaSchema, 'provincia'); 5 | 6 | export = provincia; 7 | -------------------------------------------------------------------------------- /jobs/perinatalUpdateJob.ts: -------------------------------------------------------------------------------- 1 | import { updatePerinatalFechaFinEmbarazo } from './perinatalFechaFinEmbarazo'; 2 | 3 | async function run(done) { 4 | await updatePerinatalFechaFinEmbarazo(); 5 | done(); 6 | } 7 | 8 | export = run; 9 | -------------------------------------------------------------------------------- /jobs/verificaMatriculasPosgrado.ts: -------------------------------------------------------------------------------- 1 | 2 | import { vencimientoMatriculaPosgrado } from './../core/tm/controller/profesional'; 3 | 4 | async function run(done) { 5 | await vencimientoMatriculaPosgrado(done); 6 | } 7 | 8 | export = run; 9 | -------------------------------------------------------------------------------- /packages/drive/adapters/index.ts: -------------------------------------------------------------------------------- 1 | export { FileAdapter } from './FileAdapter'; 2 | export { MongoAdapter } from './MongoAdapter'; 3 | export { SeaweedAdapter } from './SeaweedAdapter'; 4 | export { IAdapter } from './IAdapter.interface'; 5 | -------------------------------------------------------------------------------- /core/tm/schemas/nombre.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const nombreSchema = new mongoose.Schema({ 4 | nombre: { 5 | type: String, 6 | required: false 7 | } 8 | }); 9 | export = nombreSchema; 10 | -------------------------------------------------------------------------------- /core/tm/schemas/profesion_model.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as profesionSchema from './profesion'; 3 | 4 | // Virtuals 5 | 6 | export const profesion = mongoose.model('profesion', profesionSchema, 'profesion'); 7 | 8 | -------------------------------------------------------------------------------- /modules/huds/export-huds/index.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import { ExportHudsRouter } from './exportHuds.routes'; 3 | 4 | export function setup(app: express.Application) { 5 | app.use('/api/modules/huds', ExportHudsRouter); 6 | } 7 | -------------------------------------------------------------------------------- /shared/interfaces/ubicacion.interface.ts: -------------------------------------------------------------------------------- 1 | import { INombre } from './nombre.interface'; 2 | 3 | export interface IUbicacion { 4 | barrio?: INombre; 5 | localidad: INombre; 6 | provincia: INombre; 7 | pais: INombre; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | **/*.log 4 | **/*.js 5 | **/*.map 6 | *.js 7 | **.js 8 | *.map 9 | **.map 10 | 11 | # Dependency directories 12 | node_modules 13 | .vscode 14 | 15 | Dockerfile 16 | .dokerignore 17 | .gitignore 18 | .gitattributes -------------------------------------------------------------------------------- /modules/facturacionAutomatica/schemas/estadoFacturacion.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const schema = new mongoose.Schema(); 4 | schema.add({ 5 | tipo: String, 6 | estado: String, 7 | numeroComprobante: String 8 | }); 9 | -------------------------------------------------------------------------------- /packages/drive/adapters/IAdapter.interface.ts: -------------------------------------------------------------------------------- 1 | export interface IAdapter { 2 | name: string; 3 | write (stream: NodeJS.WriteStream): Promise; 4 | read(uuid: string): Promise; 5 | delete (uuid: string): Promise; 6 | } 7 | -------------------------------------------------------------------------------- /auth/schemas/paciente-token.interface.ts: -------------------------------------------------------------------------------- 1 | import { Token } from './token.interface'; 2 | 3 | export interface PacienteToken extends Token { 4 | usuario: { 5 | nombre: string; 6 | email: string; 7 | }; 8 | pacientes: any[]; 9 | } 10 | -------------------------------------------------------------------------------- /.github/workflows/labeler.yml: -------------------------------------------------------------------------------- 1 | name: "Pull Request Labeler" 2 | on: 3 | - pull_request 4 | 5 | jobs: 6 | triage: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/labeler@v2 10 | with: 11 | repo-token: "${{ secrets.GITHUB_TOKEN }}" -------------------------------------------------------------------------------- /core/tm/interfaces/interfaceProfesional.ts: -------------------------------------------------------------------------------- 1 | export interface IGuiaProfesional { 2 | id: string; 3 | nombre: string; 4 | apellido: string; 5 | sexo: string; 6 | documento: string; 7 | nacionalidad: string; 8 | profesiones: string; 9 | } 10 | -------------------------------------------------------------------------------- /core/tm/schemas/financiador.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const financiadorSchema = new mongoose.Schema({ 4 | nombre: String 5 | }); 6 | const financiador = mongoose.model('financiador', financiadorSchema, 'financiador'); 7 | export = financiador; 8 | -------------------------------------------------------------------------------- /jobs/actualizar-inscriptos-fallecidos.ts: -------------------------------------------------------------------------------- 1 | import { updateInsriptosFallecidos } from '../modules/vacunas/controller/inscripcion.vacunas.controller'; 2 | 3 | async function run(done) { 4 | await updateInsriptosFallecidos(); 5 | done(); 6 | } 7 | 8 | export = run; 9 | -------------------------------------------------------------------------------- /jobs/roboSenderJob.ts: -------------------------------------------------------------------------------- 1 | import * as roboSender from '../utils/roboSender/roboSender'; 2 | 3 | function run(done) { 4 | roboSender.roboSender().then(() => { 5 | done(); 6 | }, () => { 7 | done(); 8 | }); 9 | } 10 | 11 | export = run; 12 | -------------------------------------------------------------------------------- /core/tm/schemas/provincia.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as paisSchema from './pais'; 3 | 4 | const provinciaSchema = new mongoose.Schema({ 5 | nombre: String, 6 | pais: { type: paisSchema } 7 | }); 8 | 9 | export = provinciaSchema; 10 | -------------------------------------------------------------------------------- /modules/mobileApp/registroMobile.log.ts: -------------------------------------------------------------------------------- 1 | import { Connections } from '../../connections'; 2 | import { Logger } from '@andes/log'; 3 | 4 | export const registroMobileLog = new Logger({ connection: Connections.logs, module: 'mobile', type: 'registro', application: 'andes' }); 5 | -------------------------------------------------------------------------------- /core/tm/interfaces/ISectores.ts: -------------------------------------------------------------------------------- 1 | import { ISnomedConcept } from '../../../modules/rup/schemas/snomed-concept'; 2 | 3 | export interface ISectores { 4 | tipoSector: ISnomedConcept; 5 | unidadConcept?: ISnomedConcept; 6 | nombre: String; 7 | hijos?: ISectores[]; 8 | } 9 | -------------------------------------------------------------------------------- /modules/huds/export-huds/exportHuds.log.ts: -------------------------------------------------------------------------------- 1 | import { Connections } from '../../../connections'; 2 | import { Logger } from '@andes/log'; 3 | 4 | export const exportHudsLog = new Logger({ connection: Connections.logs, module: 'exportHuds', type: 'exportHuds', application: 'andes' }); 5 | -------------------------------------------------------------------------------- /modules/obraSocial/obraSocialLog.ts: -------------------------------------------------------------------------------- 1 | import { Connections } from '../../connections'; 2 | import { Logger } from '@andes/log'; 3 | 4 | export const obraSocialLog = new Logger({ connection: Connections.logs, module: 'obraSocial', type: 'puco', application: 'andes', bucketBy: 'h' }); 5 | -------------------------------------------------------------------------------- /auth/schemas/token.interface.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export interface Token { 4 | id: mongoose.Types.ObjectId; 5 | organizacion: any; // schemas/organizacion 6 | permisos: string[]; 7 | account_id: string; 8 | type: string; 9 | } 10 | -------------------------------------------------------------------------------- /core-v2/mpi/paciente/paciente.error.ts: -------------------------------------------------------------------------------- 1 | export class PatientNotFound extends Error { 2 | status = 400; 3 | message = 'paciente no encontrado'; 4 | } 5 | 6 | export class PatientDuplicate extends Error { 7 | status = 400; 8 | message = 'paciente duplicado'; 9 | } 10 | -------------------------------------------------------------------------------- /core/tm/schemas/especialidad_model.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as especialidadSchema from './especialidad'; 3 | 4 | const especialidad_model = mongoose.model('especialidad_model', especialidadSchema, 'especialidad'); 5 | 6 | export = especialidad_model; 7 | 8 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | mongo: 4 | image: mongo:5.0 5 | volumes: 6 | - vmongo:/data/db 7 | ports: 8 | - "27017:27017" 9 | networks: 10 | - backend 11 | volumes: 12 | vmongo: null 13 | networks: 14 | backend: null 15 | -------------------------------------------------------------------------------- /connect/fhir/controllers/errorCodes.ts: -------------------------------------------------------------------------------- 1 | const codes = { 2 | status: { 3 | sucess: '200', 4 | badRequest: '400', 5 | unauthorized: '401', 6 | forbidden: '403', 7 | notFound: '404', 8 | error: '500' 9 | }, 10 | }; 11 | export = codes; 12 | -------------------------------------------------------------------------------- /core-v2/mpi/parentesco/parentesco.interface.ts: -------------------------------------------------------------------------------- 1 | import { Document } from 'mongoose'; 2 | 3 | export interface IParentesco { 4 | nombre: String; 5 | opuesto: String; 6 | esConviviente: Boolean; 7 | } 8 | 9 | export interface IParentescoDoc extends Document, IParentesco { } 10 | -------------------------------------------------------------------------------- /seed.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | wget -q https://github.com/andes/andes-test-integracion/raw/master/docker/andes.gz 4 | docker cp andes.gz andes_dev_mongo_1:/andes.gz 5 | docker exec andes_dev_mongo_1 mongorestore --gzip --archive=/andes.gz 6 | docker exec andes_dev_mongo_1 rm andes.gz 7 | rm andes.gz -------------------------------------------------------------------------------- /core-v2/mpi/jobs/importarNacimientosJob.ts: -------------------------------------------------------------------------------- 1 | import { importarNacimientos, importarDocumentosAsignados } from './nacimientosProcess'; 2 | 3 | async function run(done) { 4 | await importarNacimientos(); 5 | await importarDocumentosAsignados(); 6 | done(); 7 | } 8 | 9 | export = run; 10 | -------------------------------------------------------------------------------- /jobs/actualizarTurnosMobile.ts: -------------------------------------------------------------------------------- 1 | import * as agendaCtrl from './../modules/turnos/controller/agenda'; 2 | 3 | function run(done) { 4 | agendaCtrl.actualizarTurnosMobile().then(() => { 5 | done(); 6 | }).catch(() => { 7 | done(); 8 | }); 9 | } 10 | 11 | export = run; 12 | -------------------------------------------------------------------------------- /modules/perinatal/perinatal.log.ts: -------------------------------------------------------------------------------- 1 | import { Connections } from '../../connections'; 2 | import { Logger } from '@andes/log'; 3 | 4 | export const perinatalFechaFinEmbarazoLog = new Logger({ connection: Connections.logs, module: 'perinatal', type: 'perinatal-fechaFinEmbarazo', application: 'andes' }); 5 | -------------------------------------------------------------------------------- /jobs/actualizarTurnosDelDiaJob.ts: -------------------------------------------------------------------------------- 1 | import * as agendaCtrl from './../modules/turnos/controller/agenda'; 2 | 3 | function run(done) { 4 | agendaCtrl.actualizarTurnosDelDia().then(() => { 5 | done(); 6 | }).catch(() => { 7 | done(); 8 | }); 9 | } 10 | 11 | export = run; 12 | -------------------------------------------------------------------------------- /core/tm/schemas/tipoEstablecimiento_model.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as tipoEstablecimientoSchema from './tipoEstablecimiento'; 3 | 4 | const tipoEstablecimiento = mongoose.model('tipoEstablecimiento', tipoEstablecimientoSchema, 'tipoEstablecimiento'); 5 | export = tipoEstablecimiento; 6 | -------------------------------------------------------------------------------- /core/tm/schemas/tipoEstablecimiento.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const tipoEstablecimientoSchema = new mongoose.Schema({ 4 | nombre: String, 5 | descripcion: String, 6 | clasificacion: String, 7 | idTipoEfector: Number 8 | }); 9 | 10 | export = tipoEstablecimientoSchema; 11 | -------------------------------------------------------------------------------- /jobs/recordarTurnosJob.ts: -------------------------------------------------------------------------------- 1 | import * as recordatorioCtrl from './../modules/mobileApp/controller/RecordatorioController'; 2 | 3 | function run() { 4 | recordatorioCtrl.buscarTurnosARecordar(1).then(() => { 5 | recordatorioCtrl.enviarTurnoRecordatorio(); 6 | }); 7 | } 8 | 9 | export = run; 10 | -------------------------------------------------------------------------------- /jobs/recordatorioAgendaJob.ts: -------------------------------------------------------------------------------- 1 | import * as recordatorioCtrl from './../modules/mobileApp/controller/RecordatorioController'; 2 | 3 | function run() { 4 | recordatorioCtrl.buscarTurnosARecordar(1).then(() => { 5 | recordatorioCtrl.enviarTurnoRecordatorio(); 6 | }); 7 | } 8 | 9 | export = run; 10 | -------------------------------------------------------------------------------- /apm.ts: -------------------------------------------------------------------------------- 1 | export let APM = null; 2 | 3 | export const APMIsActive = process.env.APM_SERVER && process.env.APM_APP_NAME; 4 | 5 | if (APMIsActive) { 6 | APM = require('elastic-apm-node').start({ 7 | serviceName: process.env.APM_APP_NAME, 8 | serverUrl: process.env.APM_SERVER, 9 | }); 10 | } 11 | -------------------------------------------------------------------------------- /shared/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | export * from './constantes.interface'; 2 | export * from './contacto.interface'; 3 | export * from './direccion.interface'; 4 | export * from './nombre.interface'; 5 | export * from './nombreApellido.interface'; 6 | export * from './ubicacion.interface'; 7 | export * from './relacion.interface'; 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Archivos de configuración 2 | config.private.ts 3 | 4 | # Logs 5 | logs 6 | **/*.log 7 | 8 | # Javascript 9 | **/*.js 10 | **/*.map 11 | *.js 12 | **.js 13 | *.map 14 | **.map 15 | 16 | !swagger/static*/*.js 17 | 18 | # Dependency directories 19 | node_modules 20 | typings 21 | typings/* 22 | .vscode 23 | -------------------------------------------------------------------------------- /core/tm/schemas/especialidadesFT.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const especialidadesFTSchema = new mongoose.Schema({ 4 | descripcion: String, 5 | }); 6 | 7 | // Exportar modelo 8 | const model = mongoose.model('especialidadesFT', especialidadesFTSchema, 'especialidadesFT'); 9 | 10 | export = model; 11 | -------------------------------------------------------------------------------- /core/tm/interfaces/IDireccion.ts: -------------------------------------------------------------------------------- 1 | import { IUbicacion } from './IUbicacion'; 2 | 3 | export interface IDireccion { 4 | valor: String; 5 | codigoPostal: String; 6 | ubicacion: IUbicacion; 7 | ranking: Number; 8 | geoReferencia: [Number, Number]; 9 | ultimaActualizacion: Date; 10 | activo: Boolean; 11 | } 12 | -------------------------------------------------------------------------------- /modules/huds/export-huds/hudsFiles.ts: -------------------------------------------------------------------------------- 1 | import { makeFs, readFile as readFileBase } from '../../../core/tm/controller/file-storage'; 2 | 3 | export function getHUDSExportarModel() { 4 | return makeFs('HUDSExportar'); 5 | } 6 | 7 | export function readFile(id): Promise { 8 | return readFileBase(id, 'HUDSExportar'); 9 | } 10 | -------------------------------------------------------------------------------- /modules/obraSocial/controller/sumar.ts: -------------------------------------------------------------------------------- 1 | import { sumar } from '../schemas/sumar'; 2 | 3 | export async function getPacienteSumar(documento) { 4 | const rta: any = await sumar.findOne({ afidni: documento, activo: 'S ' }).exec(); 5 | if (rta) { 6 | return [rta]; 7 | } else { 8 | return []; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /core/tm/schemas/barrio.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as nombreSchema from './nombre'; 3 | 4 | const barrioSchema = new mongoose.Schema({ 5 | nombre: String, 6 | localidad: { type: nombreSchema } 7 | }); 8 | 9 | const barrio = mongoose.model('barrio', barrioSchema, 'barrio'); 10 | 11 | export = barrio; 12 | -------------------------------------------------------------------------------- /modules/carpetas/schemas/ultimaCarpeta.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const ultimaCarpetaSchema = new mongoose.Schema({ 4 | idEfector: String, 5 | ultimaCarpeta: Number 6 | 7 | }); 8 | 9 | const ultimaCarpeta = mongoose.model('ultimaCarpeta', ultimaCarpetaSchema, 'ultimaCarpeta'); 10 | export = ultimaCarpeta; 11 | -------------------------------------------------------------------------------- /core-v2/mpi/parentesco/parentesco.schema.ts: -------------------------------------------------------------------------------- 1 | 2 | import * as mongoose from 'mongoose'; 3 | 4 | export const ParentescoSchema = new mongoose.Schema({ 5 | nombre: String, 6 | opuesto: String, 7 | esConviviente: Boolean 8 | }); 9 | 10 | export const Parentesco = mongoose.model('parentesco', ParentescoSchema, 'parentesco'); 11 | 12 | -------------------------------------------------------------------------------- /shared/schemas/ubicacion.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { NombreSchema } from './nombre'; 3 | 4 | export const UbicacionSchema = new mongoose.Schema({ 5 | barrio: { type: NombreSchema }, 6 | localidad: { type: NombreSchema }, 7 | provincia: { type: NombreSchema }, 8 | pais: { type: NombreSchema } 9 | }); 10 | -------------------------------------------------------------------------------- /core/tm/schemas/zonaSanitarias.ts: -------------------------------------------------------------------------------- 1 | import { Schema, model } from 'mongoose'; 2 | 3 | export const zonaSanitariasSchema = new Schema({ 4 | nombre: String, 5 | configuracion: { 6 | notificaciones: Boolean 7 | } 8 | }); 9 | 10 | 11 | export const ZonaSanitaria = model('zonasSanitarias', zonaSanitariasSchema, 'zonasSanitarias'); 12 | -------------------------------------------------------------------------------- /modules/obraSocial/schemas/profe.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const ProfeSchema = new mongoose.Schema({ 4 | nombre: String, 5 | tipoDocumento: String, 6 | dni: Number, 7 | fechaAlta: Date, 8 | version: Date 9 | }); 10 | 11 | export const Profe: any = mongoose.model('profe', ProfeSchema, 'profe'); 12 | -------------------------------------------------------------------------------- /modules/rup/jobs/sala-comun.job.ts: -------------------------------------------------------------------------------- 1 | import * as moment from 'moment'; 2 | import { createSnapshotSalaComun } from '../internacion/sala-comun/sala-comun-snapshot'; 3 | 4 | async function run(done) { 5 | const fecha = moment().startOf('h').subtract(1, 'h').toDate(); 6 | createSnapshotSalaComun(fecha).then(done); 7 | } 8 | 9 | export = run; 10 | -------------------------------------------------------------------------------- /core/tm/schemas/ocupacion.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const schema = new mongoose.Schema({ 4 | codigo: { 5 | type: String 6 | }, 7 | nombre: { 8 | type: String 9 | } 10 | }); 11 | // export let ocupacionSchema = schema; 12 | export const model = mongoose.model('ocupaciones', schema, 'ocupaciones'); 13 | -------------------------------------------------------------------------------- /core/log/system.log.ts: -------------------------------------------------------------------------------- 1 | import { Logger } from '@andes/log'; 2 | import { Connections } from '../../connections'; 3 | 4 | export const SystemLog = new Logger({ 5 | application: 'andes', 6 | connection: Connections.logs, 7 | module: 'system', 8 | type: 'sistema', 9 | bucketBy: 'h', 10 | bucketSize: 1000, 11 | expiredAt: '2 M' 12 | }); 13 | -------------------------------------------------------------------------------- /core/tm/schemas/disclaimer.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 3 | 4 | const DisclaimerSchema = new mongoose.Schema({ 5 | version: String, 6 | texto: String, 7 | activo: Boolean 8 | }); 9 | export const Disclaimer = mongoose.model('disclaimer', DisclaimerSchema, 'authDisclaimers'); 10 | -------------------------------------------------------------------------------- /core/tm/schemas/mapeo.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const mapeoShema = new mongoose.Schema({ 4 | identificador: String, 5 | codigoOrigen: String, 6 | descripcionOrigen: String, 7 | codigoDestino: String, 8 | descripcionDestino: String 9 | }); 10 | const mapeo = mongoose.model('mapeo', mapeoShema, 'mapeo'); 11 | export = mapeo; 12 | -------------------------------------------------------------------------------- /.github/workflows/has_conflic.yml: -------------------------------------------------------------------------------- 1 | on: 2 | workflow_dispatch: 3 | push: 4 | branches: 5 | - master 6 | jobs: 7 | triage: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: mschilde/auto-label-merge-conflicts@master 11 | with: 12 | CONFLICT_LABEL_NAME: "has_conflicts" 13 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 14 | -------------------------------------------------------------------------------- /modules/pacs/pacs.logs.ts: -------------------------------------------------------------------------------- 1 | import { Connections } from '../../connections'; 2 | import { Logger } from '@andes/log'; 3 | 4 | export const pacsLogs = new Logger({ 5 | connection: Connections.logs, 6 | module: 'pacs', 7 | type: 'pacs-operations', 8 | application: 'andes', 9 | bucketBy: 'd', 10 | bucketSize: 100, 11 | expiredAt: '1 M' 12 | }); 13 | -------------------------------------------------------------------------------- /modules/turnero/schemas/turno.ts: -------------------------------------------------------------------------------- 1 | import { Schema, model } from 'mongoose'; 2 | 3 | export const TurneroSchema = new Schema({ 4 | horaInicio: Date, 5 | horaLlamada: Date, 6 | espacioFisico: Array, 7 | paciente: Array, 8 | profesional: Array, 9 | tipoPrestacion: Array 10 | }); 11 | 12 | export const Turno = model('turno', TurneroSchema, 'turnero'); 13 | -------------------------------------------------------------------------------- /core/tm/schemas/edificio.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as direccionSchema from './direccion'; 3 | import * as contactoSchema from './contacto'; 4 | 5 | const edificioSchema = new mongoose.Schema({ 6 | descripcion: String, 7 | contacto: { type: contactoSchema }, 8 | direccion: { type: direccionSchema } 9 | }); 10 | export = edificioSchema; 11 | -------------------------------------------------------------------------------- /core/tm/schemas/ubicacion.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as nombreSchema from './nombre'; 3 | 4 | const ubicacionSchema = new mongoose.Schema({ 5 | barrio: { type: nombreSchema }, 6 | localidad: { type: nombreSchema }, 7 | provincia: { type: nombreSchema }, 8 | pais: { type: nombreSchema } 9 | }); 10 | 11 | export = ubicacionSchema; 12 | -------------------------------------------------------------------------------- /modules/sisa/logger/sisaLog.ts: -------------------------------------------------------------------------------- 1 | import { Connections } from '../../../connections'; 2 | import { Logger } from '@andes/log'; 3 | 4 | export const sisaLog = new Logger({ 5 | connection: Connections.logs, 6 | type: 'interoperabilidad', 7 | module: 'sisa', 8 | application: 'andes', 9 | bucketBy: 'h', 10 | bucketSize: 100, 11 | expiredAt: '3 M' 12 | }); 13 | -------------------------------------------------------------------------------- /modules/seguimiento-paciente/schemas/contacto-estrecho.schema.ts: -------------------------------------------------------------------------------- 1 | import { Schema } from 'mongoose'; 2 | 3 | export const contactoEstrechoSchema = new Schema( 4 | { 5 | apellidoNombre: String, 6 | dni: String, 7 | telefono: String, 8 | domicilio: String, 9 | fechaUltimoContacto: String, 10 | tipoContacto: Object 11 | }); 12 | 13 | -------------------------------------------------------------------------------- /modules/turnos/schemas/busquedasAgenda.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const busquedasAgendaSchema = new mongoose.Schema({ 4 | idPrestacion: String, 5 | idProfesional: String, 6 | fechaBusqueda: Date 7 | }); 8 | 9 | const busquedasAgenda = mongoose.model('busquedasAgenda', busquedasAgendaSchema, 'busquedasAgenda'); 10 | 11 | export = busquedasAgenda; 12 | -------------------------------------------------------------------------------- /modules/mobileApp/schemas/device.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const DeviceSchema = new mongoose.Schema({ 4 | device_id: String, 5 | device_fcm_token: String, 6 | device_type: String, 7 | app_version: Number, 8 | session_id: String 9 | }, { timestamps: true }); 10 | 11 | export const DeviceModel = mongoose.model('device', DeviceSchema); 12 | -------------------------------------------------------------------------------- /modules/rup/controllers/rup.events.log.ts: -------------------------------------------------------------------------------- 1 | import { Connections } from '../../../connections'; 2 | import { Logger } from '@andes/log'; 3 | 4 | export const rupEventsLog = new Logger({ 5 | connection: Connections.logs, 6 | module: 'rup', 7 | type: 'rup-events', 8 | application: 'andes', 9 | bucketBy: 'd', 10 | bucketSize: 100, 11 | expiredAt: '2 M' 12 | }); 13 | -------------------------------------------------------------------------------- /modules/rup/schemas/snomed-concept.ts: -------------------------------------------------------------------------------- 1 | import { SemanticTag } from './semantic-tag'; 2 | 3 | export interface ISnomedConcept { 4 | conceptId: string; 5 | term: string; 6 | fsn: string; 7 | semanticTag: string; 8 | } 9 | 10 | export const SnomedConcept = { 11 | conceptId: String, 12 | term: String, 13 | fsn: String, 14 | semanticTag: SemanticTag 15 | }; 16 | -------------------------------------------------------------------------------- /modules/vacunas/inscripcion-vacunas.interface.ts: -------------------------------------------------------------------------------- 1 | export interface IVacunasInscripcion { 2 | fechaRegistro: Date; 3 | documento: String; 4 | nombre: String; 5 | apellido: String; 6 | fechaNacimiento: Date; 7 | sexo: String; 8 | grupo: any; 9 | estado: String; 10 | validado: Boolean; 11 | validaciones: [String]; 12 | relacion: String; 13 | } 14 | -------------------------------------------------------------------------------- /modules/webhook/logger/laboratorioCentralLog.ts: -------------------------------------------------------------------------------- 1 | import { Connections } from '../../../connections'; 2 | import { Logger } from '@andes/log'; 3 | 4 | export const laboratorioCentralLog = new Logger({ 5 | connection: Connections.logs, 6 | module: 'laboratorioCentral', 7 | application: 'andes', 8 | bucketBy: 'h', 9 | bucketSize: 100, 10 | expiredAt: '3 M' 11 | }); 12 | -------------------------------------------------------------------------------- /packages/event-bus/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@andes/event-bus", 3 | "version": "0.1.0", 4 | "description": "", 5 | "main": "index.js", 6 | "types": "index.d.ts", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "pattern-emitter": "^1.0.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /modules/rup/laboratorio.log.ts: -------------------------------------------------------------------------------- 1 | import { Connections } from '../../connections'; 2 | import { Logger } from '@andes/log'; 3 | 4 | export const laboratorioLog = new Logger({ 5 | connection: Connections.logs, 6 | module: 'laboratorio', 7 | type: 'laboratorios-SIL2', 8 | application: 'andes', 9 | bucketBy: 'h', 10 | bucketSize: 100, 11 | expiredAt: '3 M' 12 | }); 13 | -------------------------------------------------------------------------------- /modules/version/routes/routes.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import * as config from '../../../config.private'; 3 | const router = express.Router(); 4 | 5 | router.get('/', async (req, res) => { 6 | res.json({ 7 | version: require('../../../package.json').version, 8 | snomed: config.snomed.snowstormBranch 9 | }); 10 | }); 11 | 12 | export = router; 13 | 14 | -------------------------------------------------------------------------------- /modules/forms/forms-epidemiologia/constantes.ts: -------------------------------------------------------------------------------- 1 | export const SECCION_CLASIFICACION = 'Tipo de confirmación y Clasificación Final'; 2 | export const SECCION_OPERACIONES = 'Operaciones'; 3 | export const SECCION_ENFERMEDADES_PREVIAS = 'Enfermedades Previas'; 4 | export const SECCION_CONTACTOS_ESTRECHOS = 'Contactos Estrechos'; 5 | export const SECCION_USUARIO = 'Usuario'; 6 | export const SECCION_MPI = 'Mpi'; 7 | -------------------------------------------------------------------------------- /auth/schemas/user-token.interface.ts: -------------------------------------------------------------------------------- 1 | import { Token } from './token.interface'; 2 | 3 | export interface UserToken extends Token { 4 | usuario: { 5 | id: string; 6 | nombreCompleto: string; 7 | nombre: string; 8 | apellido: string; 9 | username: string; 10 | documento: string; 11 | }; 12 | // roles: string[]; 13 | profesional: any; 14 | } 15 | -------------------------------------------------------------------------------- /core/tm/interfaces/IUbicacion.ts: -------------------------------------------------------------------------------- 1 | export interface IUbicacion { 2 | barrio: { 3 | id: String; 4 | nombre: String; 5 | }; 6 | localidad: { 7 | id: String; 8 | nombre: String; 9 | }; 10 | provincia: { 11 | id: String; 12 | nombre: String; 13 | }; 14 | pais: { 15 | id: String; 16 | nombre: String; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /modules/centroOperativoMedico/schemas/tipoTraslado.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 3 | 4 | export const TipoTrasladoSchema = new mongoose.Schema({ 5 | nombre: String 6 | }); 7 | 8 | TipoTrasladoSchema.plugin(AuditPlugin); 9 | export const TipoTraslado = mongoose.model('tipoTraslado', TipoTrasladoSchema, 'tipoTraslado'); 10 | -------------------------------------------------------------------------------- /utils/loggerJobs.ts: -------------------------------------------------------------------------------- 1 | import { logJobs } from '../core/log/schemas/logJobs'; 2 | 3 | export class LoggerJobs { 4 | 5 | public static log(job, msg, callback?): any { 6 | const newLogJobs = new logJobs({ 7 | job, 8 | error: msg, 9 | createdAt: new Date(), 10 | }); 11 | newLogJobs.save(callback); 12 | return newLogJobs; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /core-v2/mpi/paciente/pacienteFallecimiento.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 3 | 4 | export const FallecimientoManualSchema = new mongoose.Schema({ 5 | fecha: { 6 | type: Date, 7 | required: true 8 | } 9 | }, { _id: false }); // embebido, sin ID propio 10 | 11 | FallecimientoManualSchema.plugin(AuditPlugin); 12 | -------------------------------------------------------------------------------- /auth/schemas/authApps.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const schema = new mongoose.Schema({ 4 | activo: Boolean, 5 | nombre: String, 6 | organizacion: { 7 | type: mongoose.Schema.Types.ObjectId, 8 | ref: 'organizacion' 9 | }, 10 | permisos: [String], 11 | token: String 12 | }); 13 | 14 | export const authApps = mongoose.model('authApps', schema, 'authApps'); 15 | -------------------------------------------------------------------------------- /modules/centroOperativoMedico/schemas/comStore.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | const { createBucket } = require('mongoose-gridfs'); 3 | 4 | export function makeFs() { 5 | const COMFilesSchema = createBucket({ 6 | collectionName: 'COMStore', 7 | bucketName: 'COMStore', 8 | mongooseConnection: mongoose.connection 9 | }); 10 | 11 | return COMFilesSchema; 12 | } 13 | -------------------------------------------------------------------------------- /modules/descargas/matriculaciones/certificado-etica-footer.ts: -------------------------------------------------------------------------------- 1 | import { HTMLComponent } from '../model/html-component.class'; 2 | 3 | export class CertificadoEticaFooter extends HTMLComponent { 4 | template = '

Dirección de Fiscalización Sanitaria | Antártida Argentina y Colón, Edif. CAM 3 | CP (8300) Neuquén | Tel.: 0299 - 4495590/5591

'; 5 | 6 | constructor() { 7 | super(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /modules/cda/controller/class/Organization.ts: -------------------------------------------------------------------------------- 1 | import { IID } from './interfaces'; 2 | 3 | export class Organization { 4 | private _id: IID; 5 | private _name: String; 6 | 7 | id(id: IID = null) { 8 | return id != null ? (this._id = id, this) : this._id; 9 | } 10 | 11 | name(name: String = null) { 12 | return name != null ? (this._name = name, this) : this._name; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /modules/matriculaciones/controller/matriculaciones.log.ts: -------------------------------------------------------------------------------- 1 | import { Connections } from '../../../connections'; 2 | import { Logger } from '@andes/log'; 3 | 4 | export const matriculacionLog = new Logger({ 5 | connection: Connections.logs, 6 | module: 'matriculaciones', 7 | type: 'matriculaciones', 8 | application: 'andes', 9 | bucketBy: 'd', 10 | bucketSize: 100, 11 | expiredAt: '2 M' 12 | }); 13 | -------------------------------------------------------------------------------- /modules/registro-novedades/images/schemas/imageStore.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | const { createBucket } = require('mongoose-gridfs'); 3 | 4 | export function makeFs() { 5 | const CDAFilesSchema = createBucket({ 6 | collectionName: 'ImageStore', 7 | bucketName: 'ImageStore', 8 | mongooseConnection: mongoose.connection 9 | }); 10 | 11 | return CDAFilesSchema; 12 | } 13 | -------------------------------------------------------------------------------- /shared/schemas/nombre.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const NombreSchema = new mongoose.Schema({ 4 | nombre: { 5 | type: String, 6 | required: false 7 | } 8 | }); 9 | 10 | export const NombreSchemaV2 = new mongoose.Schema({ 11 | id: mongoose.Types.ObjectId, 12 | nombre: { 13 | type: String, 14 | required: false 15 | } 16 | }, { _id: false }); 17 | -------------------------------------------------------------------------------- /core-v2/mpi/financiador/financiador.schema.ts: -------------------------------------------------------------------------------- 1 | import { Schema } from 'mongoose'; 2 | 3 | export const FinanciadorSchema = new Schema({ 4 | codigoPuco: Number, 5 | nombre: String, 6 | financiador: String, 7 | id: Schema.Types.ObjectId, 8 | numeroAfiliado: String, 9 | prepaga: Boolean, 10 | idObraSocial: Number, 11 | origen: String, 12 | fechaDeActualizacion: Date, 13 | }, { _id: false }); 14 | -------------------------------------------------------------------------------- /core/tm/areaAraucania.routes.ts: -------------------------------------------------------------------------------- 1 | import { ResourceBase } from '@andes/core'; 2 | import { AreaAraucania } from './schemas/areaAraucania'; 3 | 4 | class AreaAraucaniaResource extends ResourceBase { 5 | Model = AreaAraucania; 6 | resourceName = 'areaAraucania'; 7 | keyId = '_id'; 8 | } 9 | export const AreaAraucaniaCtr = new AreaAraucaniaResource({}); 10 | export const AreaAraucaniaRouter = AreaAraucaniaCtr.makeRoutes(); 11 | -------------------------------------------------------------------------------- /jobs/farmaciasJob.ts: -------------------------------------------------------------------------------- 1 | import * as farmacias from './../modules/mobileApp/controller/FarmaciasTurnosDownloader'; 2 | import * as moment from 'moment'; 3 | 4 | function run(done) { 5 | const start = moment(new Date()).format('YYYY-MM-DD'); 6 | const end = moment(new Date()).add(20, 'days').format('YYYY-MM-DD'); 7 | farmacias.donwloadData(start, end) 8 | .then(done) 9 | .catch(done); 10 | } 11 | 12 | export = run; 13 | -------------------------------------------------------------------------------- /modules/prestamosCarpetas/schemas/constantes.ts: -------------------------------------------------------------------------------- 1 | const constantes = { 2 | EstadosPrestamosCarpeta: { 3 | EnArchivo: 'En archivo', 4 | Prestada: 'Prestada' 5 | }, 6 | EstadoSolicitudCarpeta: { 7 | Pendiente: 'Pendiente', 8 | Aprobada: 'Aprobada' 9 | }, 10 | TipoSolicitud: { 11 | Automatica: 'Automatica', 12 | Manual: 'Manual' 13 | } 14 | }; 15 | export = constantes; 16 | 17 | -------------------------------------------------------------------------------- /core/status/routes/status.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import { Connections } from './../../../connections'; 3 | 4 | const router = express.Router(); 5 | 6 | router.get('/', (req, res, next) => { 7 | res.json({ 8 | API: 'OK', 9 | DB: Connections.main.readyState !== 1 ? 'Error' : 'OK', 10 | PUCO: Connections.puco.readyState !== 1 ? 'Error' : 'OK' 11 | }); 12 | }); 13 | 14 | module.exports = router; 15 | -------------------------------------------------------------------------------- /shared/interfaces/contacto.interface.ts: -------------------------------------------------------------------------------- 1 | import { IContactoEnum } from './constantes.interface'; 2 | import * as moment from 'moment'; 3 | import { Document } from 'mongoose'; 4 | 5 | export interface IContacto { 6 | tipo: IContactoEnum; 7 | valor: String; 8 | ranking: number; 9 | ultimaActualizacion: Date | moment.Moment; 10 | activo: Boolean; 11 | } 12 | 13 | export interface IContactoDoc extends Document, IContacto { } 14 | -------------------------------------------------------------------------------- /core/tm/schemas/firmaAdmin.ts: -------------------------------------------------------------------------------- 1 | 2 | import * as mongoose from 'mongoose'; 3 | const { createBucket } = require('mongoose-gridfs'); 4 | 5 | export function makeFsFirmaAdmin() { 6 | const ProfesionalesFirmaAdminSchema = createBucket({ 7 | bucketName: 'ProfesionalesFirmaAdmin', 8 | collectionName: 'ProfesionalesFirmaAdmin', 9 | connection: mongoose.connection 10 | }); 11 | return ProfesionalesFirmaAdminSchema; 12 | } 13 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | roots: ['./'], 3 | transform: { 4 | '^.+\\.tsx?$': 'ts-jest', 5 | "^.+\\.jsx?$": "babel-jest", 6 | }, 7 | testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$', 8 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], 9 | testEnvironment: 'node', 10 | moduleNameMapper: { 11 | '@andes/unit-test': '/packages/unit-testing/index.ts' 12 | } 13 | } -------------------------------------------------------------------------------- /modules/matriculaciones/schemas/modalidadesCertificacion.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const modalidadesCertificacionSchema = new mongoose.Schema({ 4 | nombre: String, 5 | codigo: Number, 6 | descripcion: String 7 | }); 8 | 9 | // Virtuals 10 | 11 | 12 | const entidadFormadora = mongoose.model('modalidadesCertificacion', modalidadesCertificacionSchema, 'modalidadesCertificacion'); 13 | 14 | export = entidadFormadora; 15 | -------------------------------------------------------------------------------- /core/tm/schemas/firmaProf.ts: -------------------------------------------------------------------------------- 1 | 2 | import * as mongoose from 'mongoose'; 3 | const { createBucket } = require('mongoose-gridfs'); 4 | 5 | export function makeFsFirma() { 6 | const ProfesionalesFirmaSchema = createBucket({ 7 | bucketName: 'ProfesionalesFirma', 8 | collectionName: 'ProfesionalesFirma', 9 | mongooseConnection: mongoose.connection 10 | }); 11 | // obtain a model 12 | return ProfesionalesFirmaSchema; 13 | } 14 | -------------------------------------------------------------------------------- /core/tm/schemas/imagenes.ts: -------------------------------------------------------------------------------- 1 | 2 | import * as mongoose from 'mongoose'; 3 | const { createBucket } = require('mongoose-gridfs'); 4 | 5 | export function makeFs() { 6 | const ProfesionalesFilesSchema = createBucket({ 7 | collectionName: 'ProfesionalesImagenes', 8 | bucketName: 'ProfesionalesImagenes', 9 | mongooseConnection: mongoose.connection 10 | }); 11 | // obtain a model 12 | return ProfesionalesFilesSchema; 13 | } 14 | -------------------------------------------------------------------------------- /modules/georeferencia/areaPrograma.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const AreaProgramaSchema = new mongoose.Schema( 4 | { 5 | nombre: String, 6 | geometry: { 7 | type: { type: String }, 8 | coordinates: [] 9 | }, 10 | sisaOrganizacion: String 11 | } 12 | ); 13 | 14 | export const AreaPrograma = mongoose.model('area-programa', AreaProgramaSchema, 'area-programa'); 15 | -------------------------------------------------------------------------------- /core-v2/mpi/financiador/financiador.interface.ts: -------------------------------------------------------------------------------- 1 | import { Document } from 'mongoose'; 2 | 3 | 4 | export interface IFinanciador { 5 | codigoPuco: Number; 6 | nombre: String; 7 | financiador: String; 8 | numeroAfiliado: String; 9 | prepaga: Boolean; 10 | idObraSocial: Number; 11 | origen: 'PUCO' | 'SUMAR' | 'ANDES'; 12 | fechaDeActualizacion: Date; 13 | } 14 | 15 | export interface IFinanciadorDoc extends Document, IFinanciador { } 16 | -------------------------------------------------------------------------------- /jobs/pecasConsolidadoJob.ts: -------------------------------------------------------------------------------- 1 | import * as pecasCtrl from './../modules/estadistica/pecas/controller/agenda'; 2 | import * as moment from 'moment'; 3 | 4 | function run(done) { 5 | const start = moment(new Date().setHours(0, 0, 0, 0)).subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'); 6 | const end = moment(new Date().setHours(23, 59, 0, 0)).subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'); 7 | pecasCtrl.consultaPecas(done, start, end); 8 | } 9 | export = run; 10 | -------------------------------------------------------------------------------- /modules/matriculaciones/schemas/entidadFormadora.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const entidadFormadoraSchema = new mongoose.Schema({ 4 | codigo: Number, 5 | nombre: String, 6 | provincia: String, 7 | habilitado: Boolean, 8 | codigoSISA: Number 9 | }); 10 | 11 | // Virtuals 12 | 13 | 14 | const entidadFormadora = mongoose.model('entidadFormadora', entidadFormadoraSchema, 'entidadFormadora'); 15 | 16 | export = entidadFormadora; 17 | -------------------------------------------------------------------------------- /core/term/schemas/prestacionLegacy.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const prestacionLegacySchema = new mongoose.Schema({ 4 | idEspecialidad: Number, 5 | nombreEspecialidad: String, 6 | codigo: Number 7 | }); 8 | 9 | prestacionLegacySchema.virtual('nombre').get(function () { 10 | return this.nombreEspecialidad; 11 | }); 12 | 13 | export const prestacionLegacy = mongoose.model('prestacionLegacy', prestacionLegacySchema, 'prestacionLegacy'); 14 | -------------------------------------------------------------------------------- /core/tm/schemas/contacto.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as constantes from '../../../shared/constantes'; 3 | 4 | const schema = new mongoose.Schema({ 5 | tipo: constantes.CONTACTO, 6 | valor: String, 7 | ranking: Number, // Specify preferred order of use (1 = highest) 8 | ultimaActualizacion: Date, 9 | activo: { 10 | type: Boolean, 11 | required: true, 12 | default: true 13 | }, 14 | }); 15 | export = schema; 16 | -------------------------------------------------------------------------------- /core/tm/schemas/unidadOrganizativa.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { SnomedConcept } from '../../../modules/rup/schemas/snomed-concept'; 3 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 4 | 5 | export const schema = new mongoose.Schema({ 6 | fecha: Date, 7 | esPrestamo: Boolean, 8 | unidadOrganizativa: SnomedConcept, 9 | observaciones: String 10 | }); 11 | 12 | // Habilitar plugin de auditoría 13 | schema.plugin(AuditPlugin); 14 | -------------------------------------------------------------------------------- /modules/dispositivo/dispositivo.schema.ts: -------------------------------------------------------------------------------- 1 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 2 | import * as mongoose from 'mongoose'; 3 | 4 | export const DispositivoSchema = new mongoose.Schema({ 5 | nombre: String, 6 | activo: Boolean, 7 | tipo: String, 8 | descripcion: String, 9 | icono: String 10 | }); 11 | 12 | DispositivoSchema.plugin(AuditPlugin); 13 | export const Dispositivo = mongoose.model('dispositivo', DispositivoSchema, 'dispositivo'); 14 | -------------------------------------------------------------------------------- /scripts/EP-167.ts: -------------------------------------------------------------------------------- 1 | import { FormsEpidemiologia } from '../modules/forms/forms-epidemiologia/forms-epidemiologia-schema'; 2 | 3 | async function run(done) { 4 | const fichas = FormsEpidemiologia.find({ active: { $exists: false } }).cursor(); 5 | for await (const ficha of fichas) { 6 | const _id = ficha.id; 7 | const $set = { active: true }; 8 | await FormsEpidemiologia.update({ _id }, { $set }); 9 | } 10 | done(); 11 | } 12 | 13 | export = run; 14 | -------------------------------------------------------------------------------- /templates/emails/recover-password.html: -------------------------------------------------------------------------------- 1 | {{#> layout }} 2 | {{#with usuario}} 3 |
4 | Hola {{nombre}} {{apellido}}
5 |
6 |

7 | Recibiste este mensaje porque solicitaste cambiar tu contraseña. 8 |

9 | {{/with}} 10 |
11 | Para obtener una nueva contraseña, dirigite al formulario de Regeneración de contraseña 12 | {{/layout}} -------------------------------------------------------------------------------- /core/term/schemas/staticmapping.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const schema = new mongoose.Schema({ 4 | conceptId: { 5 | type: String, 6 | required: true, 7 | unique: true, // Unique index 8 | }, 9 | mapTarget: { 10 | type: String, 11 | required: true 12 | } 13 | }); 14 | 15 | schema.index({ conceptId: 1 }); 16 | 17 | export const model = mongoose.model('snomed-cie10-static', schema, 'snomed-cie10-static'); 18 | -------------------------------------------------------------------------------- /modules/matriculaciones/controller/matriculaciones.ts: -------------------------------------------------------------------------------- 1 | import numeracionMatriculas = require('../../../modules/matriculaciones/schemas/numeracionMatriculas'); 2 | 3 | export const query = { 'profesion.nombre': 'Especialidades' }; 4 | 5 | export async function ultimoPosgrado() { 6 | const data: any = await numeracionMatriculas.findOne(query); 7 | let ultimoNumero = 0; 8 | if (data) { 9 | ultimoNumero = data.proximoNumero; 10 | } 11 | return ultimoNumero; 12 | } 13 | -------------------------------------------------------------------------------- /shared/interfaces/constantes.interface.ts: -------------------------------------------------------------------------------- 1 | export type ISexo = 'femenino' | 'masculino' | 'otro'; 2 | export type IEstadoCivil = 'casado' | 'separado' | 'divorciado' | 'viudo' | 'soltero' | 'concubino' | 'otro'; 3 | export type IParentesco = 'progenitor/a' | 'hijo' | 'hermano' | 'tutor'; 4 | export type IEstado = 'temporal' | 'validado' | 'recienNacido' | 'extranjero'; 5 | export type IIdentificacion = 'documentoExtranjero' | 'pasaporte'; 6 | export type IContactoEnum = 'fijo' | 'celular' | 'email'; 7 | -------------------------------------------------------------------------------- /templates/puco/constancia.scss: -------------------------------------------------------------------------------- 1 | html { 2 | display: inline-block; 3 | padding: 0 2rem; 4 | font-family: sans-serif; 5 | margin-top: 0; 6 | } 7 | 8 | body { 9 | margin: 0; 10 | } 11 | 12 | .logoHeader { 13 | width: 100%; 14 | } 15 | 16 | .bordered-section { 17 | border: #000000 2px solid; 18 | border-radius: 40px; 19 | padding: 1.5rem; 20 | line-height: 1.1rem; 21 | font-size: 0.6rem; 22 | } 23 | 24 | .leyenda p { 25 | font-size: 0.7rem; 26 | } -------------------------------------------------------------------------------- /auth/schemas/permisos-organizaciones.ts: -------------------------------------------------------------------------------- 1 | import { Schema, model, Types } from 'mongoose'; 2 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 3 | 4 | 5 | export const PermisosOrganizacionesSchema = new Schema({ 6 | _id: Types.ObjectId, 7 | nombre: String, 8 | permisos: [String], 9 | activo: Boolean, 10 | perfiles: [{ 11 | _id: Types.ObjectId, 12 | nombre: String 13 | }] 14 | }); 15 | PermisosOrganizacionesSchema.plugin(AuditPlugin); 16 | 17 | -------------------------------------------------------------------------------- /core/tm/schemas/servicio-intermedio.schema.ts: -------------------------------------------------------------------------------- 1 | import { SnomedConcept } from '../../../modules/rup/schemas/snomed-concept'; 2 | import { model, Schema } from 'mongoose'; 3 | 4 | export const ServicioIntermedioSchema = new Schema({ 5 | nombre: String, 6 | tipoPrestacion: [SnomedConcept], 7 | concepto: { required: false, type: SnomedConcept } 8 | }); 9 | 10 | export const ServicioIntermedio = model('rup-servicios-intermedio', ServicioIntermedioSchema, 'rup-servicios-intermedio'); 11 | -------------------------------------------------------------------------------- /modules/matriculaciones/schemas/matriculacion.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const matriculacionSchena = new mongoose.Schema({ 4 | turno: { type: mongoose.Schema.Types.ObjectId, ref: 'turno' }, 5 | aprobado: { type: Boolean, default: false }, 6 | supervisor: { type: String, required: false } 7 | }); 8 | 9 | // Virtuals 10 | 11 | 12 | const matriculacion = mongoose.model('matriculacion', matriculacionSchena, 'matriculacion'); 13 | 14 | export = matriculacion; 15 | -------------------------------------------------------------------------------- /shared/interfaces/relacion.interface.ts: -------------------------------------------------------------------------------- 1 | import { Document } from 'mongoose'; 2 | 3 | export interface IRelacion { 4 | relacion: { 5 | id: string; 6 | nombre: string; 7 | opuesto: string; 8 | }; 9 | referencia: string; 10 | nombre: string; 11 | apellido: string; 12 | documento: string; 13 | fechaNacimiento?: Date; 14 | sexo?: string; 15 | foto?: string; 16 | } 17 | 18 | export interface IRelacionDoc extends Document, IRelacion { } 19 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG NODE_VERSION=16-alpine 2 | FROM node:${NODE_VERSION} 3 | 4 | ENV node_env=development 5 | 6 | RUN apk update && apk upgrade && apk add --no-cache git 7 | 8 | WORKDIR /usr/src/api 9 | 10 | COPY package.json package-lock.json ./ 11 | COPY packages ./packages 12 | 13 | RUN MONGOMS_DISABLE_POSTINSTALL=1 npm install 14 | 15 | COPY . . 16 | 17 | RUN cp config.private.ts.example config.private.ts 18 | 19 | RUN npm run tsc 20 | 21 | EXPOSE 3002 22 | 23 | CMD [ "npm", "start" ] 24 | 25 | -------------------------------------------------------------------------------- /modules/turnos/condicionPaciente/condicionPaciente.schema.ts: -------------------------------------------------------------------------------- 1 | import { Schema, model, SchemaTypes } from 'mongoose'; 2 | import { tipoPrestacionSchema } from '../../../core/tm/schemas/tipoPrestacion'; 3 | 4 | export const CondicionPacienteSchema: Schema = new Schema({ 5 | 6 | tipoPrestacion: tipoPrestacionSchema, 7 | rules: SchemaTypes.Mixed, 8 | activo: Boolean 9 | }); 10 | 11 | export const CondicionPaciente = model('condicionesPaciente', CondicionPacienteSchema, 'condicionesPaciente'); 12 | -------------------------------------------------------------------------------- /core/tm/schemas/areaAraucania.ts: -------------------------------------------------------------------------------- 1 | import { model, Schema, SchemaTypes } from 'mongoose'; 2 | 3 | export const areaAraucaniaSchema = new Schema( 4 | { 5 | longitud: Number, 6 | latitud: Number, 7 | nombre: String, 8 | region: String, 9 | comunidad: String, 10 | complejidad: String, 11 | direccion: String, 12 | telefono: String, 13 | }); 14 | 15 | export const AreaAraucania = model('area-araucania', areaAraucaniaSchema, 'area-araucania'); 16 | -------------------------------------------------------------------------------- /modules/cda/controller/schema/CDA.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /modules/descargas/recupero-costo/recupero-costo.interface.ts: -------------------------------------------------------------------------------- 1 | import { IOrganizacion } from '../../../core/tm/interfaces/IOrganizacion'; 2 | 3 | export interface IRecuperoPDF { 4 | fechaActual: string; 5 | efector: IOrganizacion; 6 | efectorCodigoSisa: any; 7 | nombre: string; 8 | dni: string | number; 9 | sexo: string; 10 | edad: string | number; 11 | horaInicio: string; 12 | tipoPrestacion: string; 13 | obraSocial: string; 14 | codigoOs: string | number; 15 | } 16 | -------------------------------------------------------------------------------- /core/tm/schemas/procedimientoQuirurgico.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | 4 | export const schema = new mongoose.Schema({ 5 | codigo: { 6 | type: String, 7 | required: true 8 | }, 9 | nombre: { 10 | type: String, 11 | required: true 12 | }, 13 | capitulo: { 14 | type: String, 15 | required: true 16 | } 17 | }); 18 | 19 | export const model = mongoose.model('procedimientosQuirurgicos', schema, 'procedimientosQuirurgicos'); 20 | -------------------------------------------------------------------------------- /modules/descargas/informe-turnos/turnos-header.ts: -------------------------------------------------------------------------------- 1 | import { HTMLComponent } from '../model/html-component.class'; 2 | import { loadImage } from '../model/informe.class'; 3 | 4 | export class TurnosInformeHeader extends HTMLComponent { 5 | template = ''; 6 | 7 | constructor() { 8 | super(); 9 | this.data = { 10 | logo: loadImage('templates/matriculaciones/img/Logomatriculaciones.png') 11 | }; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /modules/insumos/insumos-schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 3 | 4 | 5 | export const insumoSchema = new mongoose.Schema({ 6 | insumo: String, 7 | tipo: { 8 | type: String, 9 | enum: ['dispositivo', 'nutricion', 'magistral'] 10 | }, 11 | requiereEspecificacion: Boolean 12 | }); 13 | 14 | 15 | insumoSchema.plugin(AuditPlugin); 16 | 17 | export const Insumo = mongoose.model('insumo', insumoSchema, 'insumo'); 18 | -------------------------------------------------------------------------------- /modules/rup/routes/hudsExtras.ts: -------------------------------------------------------------------------------- 1 | import { PacienteCtr } from '../../../core-v2/mpi/paciente/paciente.routes'; 2 | import * as express from 'express'; 3 | import * as vacunasCtr from '../../mobileApp/controller/VacunasController'; 4 | 5 | const router = express.Router(); 6 | 7 | router.get('/huds/vacunas', async (req, res) => { 8 | const paciente = await PacienteCtr.findById(req.query.idPaciente); 9 | const vacunas = await vacunasCtr.getVacunas(paciente); 10 | res.json(vacunas); 11 | }); 12 | 13 | export = router; 14 | -------------------------------------------------------------------------------- /core/term/schemas/mapping.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const SnomedMappingSchema = new mongoose.Schema({ 4 | conceptId: String, 5 | mapGroup: Number, 6 | mapPriority: Number, 7 | mapAdvice: String, 8 | mapTarget: String, 9 | mapRule: [mongoose.Schema.Types.Mixed] 10 | }); 11 | SnomedMappingSchema.index({ 12 | conceptId: 1, 13 | mapGroup: 1, 14 | mapPriority: 1 15 | }); 16 | export const SnomedMapping = mongoose.model('snomed-cie10', SnomedMappingSchema, 'snomed-cie10'); 17 | -------------------------------------------------------------------------------- /core/tm/routes/disclaimer.ts: -------------------------------------------------------------------------------- 1 | 2 | import { MongoQuery, ResourceBase } from '@andes/core'; 3 | import { Disclaimer } from '../schemas/disclaimer'; 4 | 5 | class DisclaimerResource extends ResourceBase { 6 | Model = Disclaimer; 7 | resourceName = 'disclaimer'; 8 | keyId = '_id'; 9 | searchFileds = { 10 | activo: MongoQuery.matchString, 11 | version: MongoQuery.partialString 12 | }; 13 | } 14 | export const DisclaimerCtr = new DisclaimerResource({}); 15 | module.exports = DisclaimerCtr.makeRoutes(); 16 | -------------------------------------------------------------------------------- /modules/descargas/matriculaciones/certificado-etica-header.ts: -------------------------------------------------------------------------------- 1 | import { loadImage } from '../model/informe.class'; 2 | import { HTMLComponent } from '../model/html-component.class'; 3 | 4 | export class CertificadoEticaHeader extends HTMLComponent { 5 | template = ''; 6 | 7 | constructor() { 8 | super(); 9 | 10 | this.data = { 11 | logo: loadImage('templates/matriculaciones/img/header-matriculaciones.png') 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /utils/geoJson/geoSalud-layers.schema.ts: -------------------------------------------------------------------------------- 1 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 2 | import { Schema, model } from 'mongoose'; 3 | 4 | export const GeoSaludLayerSchema = new Schema({ 5 | 6 | nombre: { 7 | type: String, 8 | required: true 9 | }, 10 | 11 | URL: { 12 | type: String, 13 | required: true 14 | } 15 | }); 16 | 17 | GeoSaludLayerSchema.plugin(AuditPlugin); 18 | 19 | export const GeoSaludLayer = model('geoSalud-layers', GeoSaludLayerSchema, 'geoSalud-layers'); 20 | -------------------------------------------------------------------------------- /modules/cda/schemas/CDAFiles.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | const { createBucket } = require('mongoose-gridfs'); 3 | 4 | /** 5 | * No podemos inicializar directamente el schema por un defecto del paquete mongoose-gridfs 6 | */ 7 | 8 | export function makeFs() { 9 | const CDAFilesSchema = createBucket({ 10 | bucketName: 'CDAFiles', 11 | collectionName: 'CDAFiles', 12 | mongooseConnection: mongoose.connection 13 | }); 14 | 15 | // obtain a model 16 | return CDAFilesSchema; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: BUILD AND TEST 2 | on: [push] 3 | jobs: 4 | build: 5 | runs-on: ubuntu-22.04 6 | steps: 7 | - uses: actions/checkout@v4 8 | - name: Use Node.js 9 | uses: actions/setup-node@v4 10 | with: 11 | node-version: '16.x' 12 | - run: npm ci 13 | - run: cp config.private.ts.example config.private.ts 14 | - run: npm run lint 15 | - run: npm run tsc 16 | - run: npm run test 17 | -------------------------------------------------------------------------------- /modules/hl7v2/hl7v2-config.controller.ts: -------------------------------------------------------------------------------- 1 | import { HL7v2Config } from './hl7v2-config.schema'; 2 | import { ObjectId } from '@andes/core'; 3 | 4 | export async function getConfigHl7(organizacionId: ObjectId, conceptId: string, tipoMensaje: string): Promise { 5 | const config = await HL7v2Config.findOne({ 6 | 'organizacion._id': organizacionId, 7 | 'tipoPrestacion.conceptId': conceptId, 8 | tipoMensaje 9 | }); 10 | 11 | if (!config) { 12 | return null; 13 | } 14 | 15 | return config; 16 | } 17 | -------------------------------------------------------------------------------- /modules/obraSocial/schemas/padronPrepagas.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as configPrivate from './../../../config.private'; 3 | import { Connections } from './../../../connections'; 4 | 5 | const padronPrepagasSchema = new mongoose.Schema({ 6 | dni: String, 7 | sexo: String, 8 | idObraSocial: Number, 9 | nombre: String, 10 | numeroAfiliado: String, 11 | idPrepaga: String 12 | }); 13 | 14 | export const padronPrepagas: any = mongoose.model('padronPrepagas', padronPrepagasSchema, 'padronPrepagas'); 15 | -------------------------------------------------------------------------------- /modules/forms/index.ts: -------------------------------------------------------------------------------- 1 | export { FormEpidemiologiaRouter } from './forms-epidemiologia/forms-epidemiologia.routes'; 2 | export { FormHistoryRouter } from './forms-epidemiologia/forms-history.routes'; 3 | export { FormResourcesRouter } from './forms-resources/forms-resources-routes'; 4 | export { FormPresetResourcesRouter } from './forms-resources/forms-preset-resources-routes'; 5 | export { FormRouter } from './forms.routes'; 6 | import './forms-epidemiologia/controller/forms-epidemiologia.controller'; 7 | import './forms-epidemiologia/forms-epidemiologia.events'; 8 | 9 | -------------------------------------------------------------------------------- /modules/semaforo/semaforo.routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { Auth } from '../../auth/auth.class'; 3 | import { Semaforo } from './semaforo.schema'; 4 | 5 | class SemaforoResource extends ResourceBase { 6 | Model = Semaforo; 7 | resourceName = 'semaforo'; 8 | middlewares = [Auth.authenticate()]; 9 | searchFileds = { 10 | name: MongoQuery.equalMatch 11 | }; 12 | } 13 | 14 | export const SemaforoCtr = new SemaforoResource({}); 15 | export const SemaforoRouter = SemaforoCtr.makeRoutes(); 16 | -------------------------------------------------------------------------------- /packages/event-bus/index.d.ts: -------------------------------------------------------------------------------- 1 | export as namespace andes_event_bus; 2 | 3 | export interface EventBus { 4 | /** 5 | * Emite un evento asyncronico 6 | * @param {string} name Nombre del evento a emitir 7 | * @param {any} params Argumentos 8 | */ 9 | emitAsync (name: String, ...params: any[]); 10 | emit (name: String, ...params: any[]); 11 | on (regexp: String | RegExp, callback: (...params: any[]) => void ); 12 | } 13 | 14 | export declare const EventCore: EventBus; 15 | 16 | export declare const EventSocket: EventBus; 17 | -------------------------------------------------------------------------------- /modules/cda/controller/builder/BaseBuilder.ts: -------------------------------------------------------------------------------- 1 | import * as moment from 'moment'; 2 | 3 | export class BaseBuilder { 4 | 5 | public createNode(root, tag, attrs, text = null) { 6 | if (attrs) { 7 | attrs = JSON.parse(JSON.stringify(attrs)); 8 | return root.ele(tag, attrs); 9 | } else if (text) { 10 | return root.ele(tag, {}, text); 11 | } 12 | } 13 | 14 | public fromDate(date) { 15 | const str = moment(date).format('YYYYMMDDhhmmss'); 16 | return str; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /modules/forms/forms-resources/forms-resources-schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const FormResourcesSchema = new mongoose.Schema({ 4 | activo: { 5 | type: Boolean, 6 | default: false 7 | }, 8 | nombre: String, 9 | id: String, 10 | preset: { 11 | type: String, 12 | required: false 13 | }, 14 | type: { 15 | type: String, 16 | default: 'normal' 17 | } 18 | }); 19 | 20 | export const FormResource = mongoose.model('formResources', FormResourcesSchema, 'formResources'); 21 | -------------------------------------------------------------------------------- /jobs/actualizarAgendasJob.ts: -------------------------------------------------------------------------------- 1 | import * as agendaCtrl from './../modules/turnos/controller/agenda'; 2 | import moment = require('moment'); 3 | 4 | function run(done) { 5 | const fechaActualizar = moment(new Date()); 6 | const start = (moment(fechaActualizar).startOf('day').subtract(1, 'days').toDate() as any); 7 | const end = (moment(start).endOf('day').toDate() as any); 8 | Promise.all([ 9 | agendaCtrl.actualizarTiposDeTurno(), 10 | agendaCtrl.actualizarEstadoAgendas(start, end) 11 | ]).then(done).catch(done); 12 | } 13 | 14 | export = run; 15 | -------------------------------------------------------------------------------- /core/tm/schemas/areaProgramaProvincial.ts: -------------------------------------------------------------------------------- 1 | import { model, Schema, SchemaTypes } from 'mongoose'; 2 | 3 | export const AreaProgramaProvincialSchema = new Schema( 4 | { 5 | nombre: String, 6 | codLocalidad: String, 7 | zona: { 8 | id: SchemaTypes.ObjectId, 9 | nombre: String, 10 | }, 11 | areaPrograma: String, 12 | idLocalidad: SchemaTypes.ObjectId 13 | 14 | }); 15 | 16 | export const AreaProgramaProvincial = model('area-programa-provincial', AreaProgramaProvincialSchema, 'area-programa-provincial'); 17 | -------------------------------------------------------------------------------- /modules/vacunas/schemas/nomivacCategoria.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const nomivacCategoriaSchema = new mongoose.Schema({ 4 | id: mongoose.Schema.Types.ObjectId, 5 | codigo: { 6 | type: Number, 7 | required: true 8 | }, 9 | nombre: { 10 | type: String, 11 | required: true 12 | } 13 | }); 14 | 15 | nomivacCategoriaSchema.index({ 16 | codigo: 1 17 | }); 18 | export const nomivacCategoria = mongoose.model('nomivacCategoriasAplicacion', nomivacCategoriaSchema, 'nomivacCategoriasAplicacion'); 19 | -------------------------------------------------------------------------------- /modules/carpetas/schemas/carpetaPaciente.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as nombreSchema from '../../../core/tm/schemas/nombre'; 3 | 4 | const carpetaPacienteSchema = new mongoose.Schema({ 5 | documento: String, 6 | carpetaEfectores: [{ 7 | organizacion: nombreSchema, 8 | idPaciente: String, 9 | nroCarpeta: String 10 | }] 11 | }); 12 | 13 | carpetaPacienteSchema.index({ documento: 1 }); 14 | 15 | const carpetaPaciente = mongoose.model('carpetaPaciente', carpetaPacienteSchema, 'carpetaPaciente'); 16 | export = carpetaPaciente; 17 | -------------------------------------------------------------------------------- /modules/matriculaciones/schemas/numeracionMatriculas.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { ObjSIISASchema } from './../../../core/tm/schemas/siisa'; 3 | 4 | const numeracionMatriculasSchena = new mongoose.Schema({ 5 | profesion: { type: ObjSIISASchema, required: false }, 6 | especialidad: { type: ObjSIISASchema, required: false }, 7 | proximoNumero: { type: Number, required: true } 8 | }); 9 | 10 | const numeracionMatriculas = mongoose.model('numeracionMatriculas', numeracionMatriculasSchena, 'numeracionMatriculas'); 11 | 12 | export = numeracionMatriculas; 13 | -------------------------------------------------------------------------------- /core/tm/schemas/especialidad.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const especialidadSchema = new mongoose.Schema({ 4 | nombre: { 5 | type: String, 6 | required: true 7 | }, 8 | descripcion: String, 9 | complejidad: Number, 10 | disciplina: String, 11 | codigo: { 12 | sisa: { 13 | type: String, 14 | required: true 15 | } 16 | }, 17 | activo: { 18 | type: Boolean, 19 | required: true, 20 | default: true 21 | } 22 | }); 23 | 24 | export = especialidadSchema; 25 | 26 | -------------------------------------------------------------------------------- /modules/descargas/puco/constancia-puco-header.ts: -------------------------------------------------------------------------------- 1 | import { loadImage } from '../model/informe.class'; 2 | import { HTMLComponent } from '../model/html-component.class'; 3 | 4 | export class ConstanciaPucoHeader extends HTMLComponent { 5 | template = ''; 6 | 7 | constructor(tipoFinanciador: String) { 8 | super(); 9 | 10 | this.data = { 11 | logo: loadImage(`templates/puco/img/${(tipoFinanciador === 'Programa SUMAR' ? 'header-sumar.png' : 'header-puco.jpg')}`) 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /shared/schemas/contacto.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { CONTACTO } from '../constantes'; 3 | import { IContactoDoc } from '../interfaces'; 4 | 5 | 6 | export const ContactoSchema = new mongoose.Schema({ 7 | tipo: CONTACTO, 8 | valor: String, 9 | ranking: Number, // Specify preferred order of use (1 = highest) 10 | ultimaActualizacion: Date, 11 | activo: { 12 | type: Boolean, 13 | required: true, 14 | default: true 15 | }, 16 | }); 17 | 18 | export const Contacto = mongoose.model('contacto', ContactoSchema); 19 | -------------------------------------------------------------------------------- /core/tm/schemas/localidad.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as provinciaSchema from './provincia'; 3 | import { zonaSanitariasSchema } from './zonaSanitarias'; 4 | 5 | const localidadSchema = new mongoose.Schema({ 6 | nombre: String, 7 | codLocalidad: String, 8 | departamento: String, 9 | provincia: { type: provinciaSchema }, 10 | zona: zonaSanitariasSchema, 11 | activo: { 12 | type: Boolean, 13 | default: true 14 | }, 15 | }); 16 | const localidad = mongoose.model('localidad', localidadSchema, 'localidad'); 17 | export = localidad; 18 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: RELEASE 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: '30 13 * * 3' 6 | jobs: 7 | release: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v1 11 | - name: Use Node.js 12 | uses: actions/setup-node@v1 13 | with: 14 | node-version: '16.x' 15 | - run: npm ci 16 | - name: Release 17 | env: 18 | GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }} 19 | run: npx semantic-release 20 | -------------------------------------------------------------------------------- /modules/descargas/laboratorio/laboratorio-footer.ts: -------------------------------------------------------------------------------- 1 | import { HTMLComponent } from '../model/html-component.class'; 2 | import * as moment from 'moment'; 3 | 4 | export class LaboratorioFooter extends HTMLComponent { 5 | template = ` 6 |
7 |
Fecha y hora de impresión: {{fecha}}
8 |
Impreso por: {{usuario}}
9 | `; 10 | 11 | constructor(public usuario) { 12 | super(); 13 | this.data = { 14 | fecha: moment().format('DD/MM/YYYY HH:mm:ss'), 15 | usuario 16 | }; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /modules/facturacionAutomatica/controller/facturacionAutomaticaController.ts: -------------------------------------------------------------------------------- 1 | import * as facturacionAutomaticaModel from './../schemas/configFacturacionAutomatica'; 2 | 3 | export async function getConfigFacturacionAutomatica(query) { 4 | const params = {}; 5 | if (query.idPrestacionEjecutada) { 6 | params['prestacionSnomed.conceptId'] = query.idPrestacionEjecutada; 7 | } 8 | 9 | if (query.idPrestacionTurneable) { 10 | params['conceptosTurneables.conceptId'] = query.idPrestacionTurneable; 11 | } 12 | 13 | return await facturacionAutomaticaModel.find(params); 14 | } 15 | -------------------------------------------------------------------------------- /modules/forms/forms-resources/forms-preset-resources-schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const FormPresetResourcesSchema = new mongoose.Schema({ 4 | activo: { 5 | type: Boolean, 6 | default: false 7 | }, 8 | nombre: String, 9 | id: String, 10 | preset: String, 11 | type: { 12 | type: String, 13 | default: 'normal' 14 | }, 15 | fields: [{ type: mongoose.SchemaTypes.Mixed }] 16 | }); 17 | 18 | export const FormPresetResource = mongoose.model('formPresetResources', FormPresetResourcesSchema, 'formPresetResources'); 19 | -------------------------------------------------------------------------------- /jobs/actualizarEstadosAgenda.ts: -------------------------------------------------------------------------------- 1 | import * as agendaCtrl from '../modules/turnos/controller/agenda'; 2 | import moment = require('moment'); 3 | 4 | async function run(done) { 5 | const fechaDesde = moment(new Date(2018, 11, 1)); // mes - 1 6 | const fechaHAsta = moment(new Date(2018, 11, 31)); // mes - 1 7 | 8 | const start = (moment(fechaDesde).startOf('day')).format('YYYY-MM-DD HH:mm:ss'); 9 | const end = (moment(fechaHAsta).endOf('day')).format('YYYY-MM-DD HH:mm:ss'); 10 | agendaCtrl.actualizarEstadoAgendas(start, end).then(done) 11 | .catch(done); 12 | } 13 | 14 | export = run; 15 | -------------------------------------------------------------------------------- /scripts/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Corre una Jobs de forma manual. Corre desde el root del proyecto. 3 | * 4 | * node jobs/manual.js [Js File to run] 5 | */ 6 | 7 | 8 | import { Connections } from '../connections'; 9 | const path = require('path'); 10 | 11 | Connections.initialize(); 12 | const { setupServices } = require('../services'); 13 | setupServices(); 14 | 15 | const done = () => { 16 | process.exit(0); 17 | }; 18 | 19 | const actionName = process.argv[2]; 20 | const fileName = path.join(process.cwd(), 'scripts', actionName + '.js'); 21 | const action = require(fileName); 22 | 23 | action(done); 24 | -------------------------------------------------------------------------------- /modules/mobileApp/schemas/categoria.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const CategoriaSchema = new mongoose.Schema({ 4 | titulo: { 5 | type: String 6 | }, 7 | expresionSnomed: { 8 | type: String 9 | }, 10 | descargaAdjuntos: { 11 | type: Boolean 12 | }, 13 | busquedaPor: { 14 | type: String, 15 | items: { 16 | type: String, 17 | enum: ['registros', 'prestaciones', 'cdas'] 18 | } 19 | } 20 | }); 21 | 22 | export const Categoria = mongoose.model('categorias', CategoriaSchema, 'categorias'); 23 | -------------------------------------------------------------------------------- /core/tm/zonaSanitaria.routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { Auth } from '../../auth/auth.class'; 3 | import { ZonaSanitaria } from './schemas/zonaSanitarias'; 4 | 5 | class ZonasSanitariasResource extends ResourceBase { 6 | Model = ZonaSanitaria; 7 | resourceName = 'zonasSantiarias'; 8 | searchFileds = { 9 | nombre: MongoQuery.partialString, 10 | ids: MongoQuery.inArray.withField('_id') 11 | }; 12 | } 13 | 14 | export const ZonasSanitariasCtr = new ZonasSanitariasResource(); 15 | export const ZonasSanitariasRouter = ZonasSanitariasCtr.makeRoutes(); 16 | -------------------------------------------------------------------------------- /modules/centroOperativoMedico/tipoTraslado.routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { Auth } from '../../auth/auth.class'; 3 | import { TipoTraslado } from './schemas/tipoTraslado.schema'; 4 | 5 | class TipoTrasladoResource extends ResourceBase { 6 | Model = TipoTraslado; 7 | resourceName = 'tipoTraslado'; 8 | middlewares = [Auth.authenticate()]; 9 | searchFileds = { 10 | nombre: MongoQuery.partialString, 11 | }; 12 | } 13 | 14 | export const TipoTrasladoCtr = new TipoTrasladoResource({}); 15 | export const TipoTrasladoRouter = TipoTrasladoCtr.makeRoutes(); 16 | -------------------------------------------------------------------------------- /modules/hl7v2/hl7v2Log.ts: -------------------------------------------------------------------------------- 1 | import { Connections } from '../../connections'; 2 | import { Logger } from '@andes/log'; 3 | 4 | export const adt04Hl7v2Log = new Logger({ 5 | connection: Connections.logs, 6 | module: 'hl7v2', 7 | type: 'adt04', 8 | application: 'andes', 9 | bucketBy: 'h', 10 | bucketSize: 100, 11 | expiredAt: '3 M' 12 | }); 13 | 14 | export const mdmt02Hl7v2Log = new Logger({ 15 | connection: Connections.logs, 16 | module: 'hl7v2', 17 | type: 'mdmt02', 18 | application: 'andes', 19 | bucketBy: 'h', 20 | bucketSize: 100, 21 | expiredAt: '3 M' 22 | }); 23 | -------------------------------------------------------------------------------- /modules/personalSalud/personal-salud.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const PersonalSaludSchema: mongoose.Schema = new mongoose.Schema({ 4 | documento: { 5 | type: String, 6 | required: true 7 | }, 8 | apellido: { 9 | type: String, 10 | required: true 11 | }, 12 | nombre: { 13 | type: String, 14 | required: true 15 | }, 16 | sexo: String, 17 | fechaNacimiento: Date, 18 | ocupacion: String 19 | }); 20 | 21 | export const PersonalSalud = mongoose.model('personalSalud', PersonalSaludSchema, 'personalSalud'); 22 | -------------------------------------------------------------------------------- /modules/registro-novedades/novedades.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { ModuloSchema } from '../../core/tm/schemas/modulos.schema'; 3 | 4 | export const NovedadSchema = new mongoose.Schema({ 5 | id: mongoose.Schema.Types.ObjectId, 6 | fecha: { type: Date, default: Date.now }, 7 | titulo: String, 8 | palabra: String, 9 | descripcion: String, 10 | modulo: { 11 | type: ModuloSchema 12 | }, 13 | imagenes: mongoose.Schema.Types.Mixed, 14 | activa: Boolean 15 | }); 16 | 17 | export const Novedades = mongoose.model('novedades', NovedadSchema, 'novedades'); 18 | -------------------------------------------------------------------------------- /core/tm/schemas/direccion.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as ubicacionSchema from './ubicacion'; 3 | 4 | 5 | const schema = new mongoose.Schema({ 6 | tipo: { 7 | type: String, 8 | required: false 9 | }, 10 | valor: String, 11 | codigoPostal: String, 12 | ubicacion: { type: ubicacionSchema }, 13 | geoReferencia: { 14 | type: [Number] 15 | }, 16 | ranking: Number, 17 | activo: { 18 | type: Boolean, 19 | required: true, 20 | default: true 21 | }, 22 | ultimaActualizacion: Date, 23 | }); 24 | 25 | export = schema; 26 | -------------------------------------------------------------------------------- /core/tm/schemas/profesion.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const profesionSchema = new mongoose.Schema({ 4 | nombre: { type: String, required: true }, 5 | tipoDeFormacion: { type: String, required: true }, 6 | codigo: Number, 7 | profesionCodigoRef: Number, 8 | identificadores: { 9 | type: [{ 10 | entidad: String, 11 | valor: Number 12 | }], 13 | required: true, 14 | default: [] 15 | }, 16 | gestionaColegio: Boolean, 17 | habilitado: Boolean, 18 | profesionColegiada: Boolean 19 | }); 20 | 21 | export = profesionSchema; 22 | -------------------------------------------------------------------------------- /modules/cda/controller/class/interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface IID { 2 | root: String; 3 | extension?: String; 4 | } 5 | 6 | export interface ICode { 7 | code: String; 8 | codeSystem: String; 9 | displayName?: String; 10 | codeSystemName?: String; 11 | } 12 | 13 | export interface IConfidentialityCode { 14 | code: String; 15 | codeSystem: String; 16 | } 17 | 18 | export interface ILanguageCode { 19 | code: String; 20 | // codeSystem: String; 21 | } 22 | 23 | export interface ISetId { 24 | root: String; 25 | } 26 | 27 | export interface ITemplateId { 28 | root: String; 29 | } 30 | -------------------------------------------------------------------------------- /modules/descargas/ficha-epidemiologica/ficha-footer.ts: -------------------------------------------------------------------------------- 1 | import { HTMLComponent } from '../model/html-component.class'; 2 | import * as moment from 'moment'; 3 | 4 | export class FichaEpidemiologicaFooter extends HTMLComponent { 5 | template = ` 6 |
7 |
Fecha y hora de impresión: {{fecha}}
8 |
Impreso por: {{usuario}}
9 | `; 10 | 11 | constructor(public usuario) { 12 | super(); 13 | this.data = { 14 | fecha: moment().format('DD/MM/YYYY HH:mm:ss'), 15 | usuario 16 | }; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /modules/huds/motivosHuds/motivosHuds.schema.ts: -------------------------------------------------------------------------------- 1 | import { Schema, model } from 'mongoose'; 2 | 3 | export const MotivosHudsSchema = new Schema({ 4 | id: Schema.Types.ObjectId, 5 | label: { 6 | type: String, 7 | required: false 8 | }, 9 | key: { 10 | type: String, 11 | required: true 12 | }, 13 | moduloDefault: { 14 | type: [String], 15 | required: false 16 | }, 17 | descripcion: { 18 | type: String, 19 | required: false 20 | } 21 | 22 | }); 23 | 24 | export const MotivosHuds = model('motivosHuds', MotivosHudsSchema, 'motivosHuds'); 25 | -------------------------------------------------------------------------------- /core/tm/areaProgramaProvincial.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { AreaProgramaProvincial } from './schemas/areaProgramaProvincial'; 3 | 4 | class AreaProgramaProvincialResource extends ResourceBase { 5 | Model = AreaProgramaProvincial; 6 | resourceName = 'areaProgramaProvincial'; 7 | searchFileds = { 8 | nombre: MongoQuery.partialString, 9 | idLocalidad: MongoQuery.equalMatch 10 | }; 11 | } 12 | 13 | export const AreaProgramaProvincialCtr = new AreaProgramaProvincialResource(); 14 | export const AreaProgramaProvincialRouter = AreaProgramaProvincialCtr.makeRoutes(); 15 | -------------------------------------------------------------------------------- /modules/cda/controller/builder/OrganizationBuilder.ts: -------------------------------------------------------------------------------- 1 | import * as builder from 'xmlbuilder'; 2 | import { Organization } from '../class/Organization'; 3 | import { BaseBuilder } from './BaseBuilder'; 4 | export class OrganizationBuilder extends BaseBuilder { 5 | 6 | public build(org: Organization) { 7 | const custodian = builder.create('custodian') 8 | .ele('assignedCustodian') 9 | .ele('representedCustodianOrganization'); 10 | this.createNode(custodian, 'id', org.id()); 11 | this.createNode(custodian, 'name', null, org.name()); 12 | 13 | return custodian; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /modules/descargas/laboratorio/laboratorio-header.ts: -------------------------------------------------------------------------------- 1 | import { HTMLComponent } from '../model/html-component.class'; 2 | 3 | export class FarmaciaHeader extends HTMLComponent { 4 | template = ` 5 |
6 | Resultados de Laboratorio 7 |

{{encabezado.data.Laboratorio}}"

8 |
9 |
10 |
11 | `; 12 | 13 | constructor(public encabezado) { 14 | super(); 15 | } 16 | 17 | public async process() { 18 | this.data = { 19 | encabezado: this.encabezado 20 | }; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/drive/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@andes/drive", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "types": "index.d.ts", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "request": "^2.83.0", 14 | "mongoose": "^5.0.14", 15 | "multer": "^1.4.0", 16 | "node-seaweedfs": "^1.4.0", 17 | "gridfs-stream": "^1.1.1", 18 | "@andes/mongoose-plugin-audit": "^1.1.3", 19 | "@andes/api-tool": "^1.0.0" 20 | } 21 | } -------------------------------------------------------------------------------- /modules/forms/forms-epidemiologia/forms-history.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { FormsEpidemiologiaCloneSchema } from './forms-epidemiologia-schema'; 3 | 4 | 5 | const FormsHistorySchema = FormsEpidemiologiaCloneSchema.clone(); 6 | FormsHistorySchema.add({ 7 | createdAt: Date, 8 | createdBy: { nombreCompleto: String, username: String }, 9 | updatedAt: Date, 10 | updatedBy: { nombreCompleto: String, username: String }, 11 | id: mongoose.Types.ObjectId 12 | }); 13 | 14 | export const FormsHistory = mongoose.model('formsEpidemiologiaHistory', FormsHistorySchema, 'formsEpidemiologiaHistory'); 15 | -------------------------------------------------------------------------------- /modules/matriculaciones/schemas/agendaMatriculaciones.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | const agendaMatriculacionesSchema = new mongoose.Schema({ 4 | diasHabilitados: { type: Array, required: true }, 5 | horarioInicioTurnos: { type: String, required: true }, 6 | horarioFinTurnos: { type: String, required: true }, 7 | fechasExcluidas: [Date], 8 | duracionTurno: { type: Number, required: true } 9 | }); 10 | 11 | // Virtuals 12 | 13 | 14 | const agendaMatriculaciones = mongoose.model('agendaMatriculaciones', agendaMatriculacionesSchema, 'agendaMatriculaciones'); 15 | 16 | export = agendaMatriculaciones; 17 | -------------------------------------------------------------------------------- /templates/ficha-epidemiologica/ficha-epidemiologica.scss: -------------------------------------------------------------------------------- 1 | .contenedor-secundario { 2 | display: block; 3 | text-align: center; 4 | font-size: .25cm; 5 | } 6 | 7 | p { 8 | margin: 5px 0; 9 | font-family: Arial, sans-serif; 10 | font-size: .27cm; 11 | } 12 | 13 | .foot { 14 | font-family: Arial, sans-serif; 15 | font-size: 10px; 16 | } 17 | 18 | .logoHeader { 19 | width: 70%; 20 | display: block; 21 | margin: auto; 22 | } 23 | 24 | .texto-centrado { 25 | text-align: center; 26 | font-size: 14px; 27 | align-items: center; 28 | font-weight: bold; 29 | text-decoration: underline; 30 | } -------------------------------------------------------------------------------- /modules/huds/motivosHuds/motivosHuds.routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { MotivosHuds } from './motivosHuds.schema'; 3 | 4 | class MotivosHudsResource extends ResourceBase { 5 | Model = MotivosHuds; 6 | resourceName = 'motivosHuds'; 7 | searchFileds = { 8 | label: MongoQuery.partialString, 9 | key: MongoQuery.partialString, 10 | descripcion: MongoQuery.partialString, 11 | moduloDefault: MongoQuery.partialString 12 | }; 13 | } 14 | export const MotivosHudsCtr = new MotivosHudsResource({}); 15 | export const MotivosHudsRouter = MotivosHudsCtr.makeRoutes(); 16 | -------------------------------------------------------------------------------- /scripts/update-pacientes-ficha.ts: -------------------------------------------------------------------------------- 1 | import { FormsEpidemiologia } from '../modules/forms/forms-epidemiologia/forms-epidemiologia-schema'; 2 | import { Types } from 'mongoose'; 3 | 4 | async function run(done) { 5 | 6 | const fichas: any = await FormsEpidemiologia.find({ 'paciente.id': { $type: 'string' } }); 7 | for await (const ficha of fichas) { 8 | const paciente = ficha.paciente; 9 | paciente.id = new Types.ObjectId(paciente.id); 10 | await FormsEpidemiologia.update( 11 | { _id: ficha.id }, 12 | { $set: { paciente } } 13 | ); 14 | } 15 | done(); 16 | } 17 | 18 | export = run; 19 | -------------------------------------------------------------------------------- /core/tm/routes/organizacionCache.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import * as organizacionCache from '../schemas/organizacionCache'; 3 | 4 | const router = express.Router(); 5 | 6 | router.get('/organizacionesCache', (req, res, next) => { 7 | 8 | const query = organizacionCache.organizacionCache.find({}, { 9 | coordenadasDeMapa: 1, 10 | nombre: 1, 11 | localidad: 1, 12 | domicilio: 1, 13 | telefono: 1 14 | }); 15 | query.exec((err, data) => { 16 | if (err) { 17 | return next(err); 18 | } 19 | res.json(data); 20 | }); 21 | }); 22 | 23 | export = router; 24 | -------------------------------------------------------------------------------- /core/tm/schemas/eclqueries.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { Document, Model } from 'mongoose'; 3 | 4 | export interface ECL { 5 | key: string; 6 | nombre: string; 7 | valor: string; 8 | descripcion: string; 9 | } 10 | 11 | export interface ECLQueriesDocument extends ECL, Document { } 12 | 13 | export const ECLQueriesSchema = new mongoose.Schema({ 14 | key: String, 15 | nombre: String, 16 | valor: String, 17 | descripcion: String 18 | }); 19 | 20 | export const ECLQueries: Model = mongoose.model( 21 | 'ECLQueries', 22 | ECLQueriesSchema, 23 | 'eclqueries' 24 | ); 25 | -------------------------------------------------------------------------------- /modules/recetas/parametros.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export interface RecetaParametros { 4 | key: string; 5 | nombre: string; 6 | value: string; 7 | type: 'text' | 'number'; 8 | observacion: string; 9 | } 10 | 11 | export const RecetasParametrosSchema = new mongoose.Schema({ 12 | key: String, 13 | nombre: String, 14 | value: String, 15 | type: { 16 | type: String, 17 | enum: ['text', 'number'] 18 | }, 19 | observacion: String 20 | }); 21 | 22 | 23 | export const RecetasParametros = mongoose.model('recetasParametros', RecetasParametrosSchema, 'recetasParametros'); 24 | -------------------------------------------------------------------------------- /packages/event-bus/index.ts: -------------------------------------------------------------------------------- 1 | const Emitter = require('pattern-emitter'); 2 | 3 | export class EventBus extends Emitter { 4 | 5 | /** 6 | * Emite un evento de forma asincrónica 7 | * @param {string} event Nombre del evento a emitir 8 | * @param {any} params listado de paramentros relacionados con el evento 9 | */ 10 | 11 | emitAsync (name: String, ...params: any[]); 12 | 13 | emitAsync() { 14 | process.nextTick(() => { 15 | this.emit.apply(this, arguments); 16 | }); 17 | } 18 | 19 | } 20 | 21 | export const EventCore = new EventBus(); 22 | 23 | export const EventSocket = new EventBus(); 24 | -------------------------------------------------------------------------------- /core/tm/eclqueries.routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { Auth } from './../../auth/auth.class'; 3 | import { ECLQueries } from './schemas/eclqueries.schema'; 4 | 5 | class ECLQueriesController extends ResourceBase { 6 | Model = ECLQueries; 7 | resourceName = 'eclqueries'; 8 | middlewares = [Auth.authenticate()]; 9 | routesEnable = ['get', 'search']; 10 | searchFileds = { 11 | key: MongoQuery.partialString, 12 | nombre: MongoQuery.partialString 13 | }; 14 | } 15 | 16 | export const ECLQueriesCtr = new ECLQueriesController({}); 17 | export const ECLQueriesRouter = ECLQueriesCtr.makeRoutes(); 18 | -------------------------------------------------------------------------------- /core-v2/mpi/index.ts: -------------------------------------------------------------------------------- 1 | import { Router } from 'express'; 2 | import { PacienteRouter } from './paciente/paciente.routes'; 3 | import { PacientesEmpadronadosRouter } from './pacientes-empadronados/pacientes-empadronados.routes'; 4 | import { ParentescoRouter } from './parentesco/parentesco.routes'; 5 | import { Routing as RoutingValidacion } from './validacion'; 6 | require('./paciente/paciente.events'); 7 | 8 | 9 | const router = Router(); 10 | router.use(PacienteRouter); 11 | router.use(ParentescoRouter); 12 | router.use(RoutingValidacion); 13 | router.use(PacientesEmpadronadosRouter); 14 | 15 | 16 | export const RoutingMPI = router; 17 | 18 | export * from './paciente'; 19 | -------------------------------------------------------------------------------- /modules/rup/internacion/internacion.log.ts: -------------------------------------------------------------------------------- 1 | import { Connections } from '../../../connections'; 2 | import { Logger } from '@andes/log'; 3 | 4 | export const internacionCamaEstadosLog = new Logger({ 5 | connection: Connections.logs, 6 | module: 'internacion', 7 | type: 'cama-estados', 8 | application: 'andes', 9 | bucketBy: 'd', 10 | bucketSize: 100, 11 | expiredAt: '2 M' 12 | }); 13 | 14 | export const internacionCensosLog = new Logger({ 15 | connection: Connections.logs, 16 | module: 'internacion', 17 | type: 'censos', 18 | application: 'andes', 19 | bucketBy: 'd', 20 | bucketSize: 100, 21 | expiredAt: '2 M' 22 | }); 23 | -------------------------------------------------------------------------------- /modules/forms/forms-epidemiologia/forms-history.routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { FormsHistory } from './forms-history.schema'; 3 | import { Auth } from '../../../auth/auth.class'; 4 | 5 | class FormsHistoryResource extends ResourceBase { 6 | Model = FormsHistory; 7 | resourceName = 'formsHistory'; 8 | middlewares = [Auth.authenticate()]; 9 | searchFileds = { 10 | id: { 11 | field: 'id', 12 | fn: MongoQuery.equalMatch 13 | }, 14 | }; 15 | } 16 | 17 | export const FormHistoryCtr = new FormsHistoryResource(); 18 | export const FormHistoryRouter = FormHistoryCtr.makeRoutes(); 19 | -------------------------------------------------------------------------------- /packages/drive/middleware/multer.ts: -------------------------------------------------------------------------------- 1 | const multer = require('multer'); 2 | 3 | 4 | function AdapterStorage(adapter) { 5 | this.adapter = adapter; 6 | } 7 | 8 | AdapterStorage.prototype._handleFile = function _handleFile(req, file, cb) { 9 | this.adapter.write(file.stream).then(id => { 10 | cb(null, { id, adapter: this.adapter.name, size: file.size }); 11 | }); 12 | }; 13 | 14 | AdapterStorage.prototype._removeFile = function _removeFile(req, file, cb) { 15 | cb(null, true); 16 | }; 17 | 18 | export default (adapter) => { 19 | const fileMulterAdapter = new AdapterStorage(adapter); 20 | return multer({ storage: fileMulterAdapter }); 21 | }; 22 | 23 | -------------------------------------------------------------------------------- /core/log/schemas/logJobs.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const logJobsSchema = new mongoose.Schema({ 4 | job: { 5 | type: String, 6 | enum: [ 7 | 'actualizar agendas', 'actualizar carpetas', 'actualizar turnos del dia', 'cda sips', 'farmacias', 8 | 'integracion andes', 'mpi corrector', 'mpi updater', 'recordar turnos', 9 | 'recordatorio agenda', 'robo sender' 10 | ] 11 | }, 12 | error: mongoose.Schema.Types.Mixed, 13 | createdAt: Date, 14 | createdBy: mongoose.Schema.Types.Mixed 15 | 16 | }); 17 | 18 | export const logJobs = mongoose.model('logJobs', logJobsSchema, 'logJobs'); 19 | -------------------------------------------------------------------------------- /jobs/exportCovid19.ts: -------------------------------------------------------------------------------- 1 | import { exportCovid19 } from '../modules/vacunas/controller/vacunas.controller'; 2 | 3 | async function run(done) { 4 | // Si length=5 entonces vienen dos argumentos (fechaDesde y fechaHasta) 5 | if (process.argv.length === 5) { 6 | const desde = process.argv[3]; 7 | const hasta = process.argv[4]; 8 | await exportCovid19(null, null, desde, hasta); 9 | } else { // Si no es 5 entonces viene 1 solo argumento (horas) o sin argumentos (por defecto una hora) 10 | const horas = process.argv[3] || '1'; 11 | await exportCovid19(horas, null, null, null); 12 | } 13 | done(); 14 | } 15 | 16 | export = run; 17 | 18 | -------------------------------------------------------------------------------- /modules/dispositivo/dispositivo.routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { Auth } from '../../auth/auth.class'; 3 | import { Dispositivo } from './dispositivo.schema'; 4 | 5 | class DispositivoResource extends ResourceBase { 6 | Model = Dispositivo; 7 | resourceName = 'dispositivo'; 8 | middlewares = [Auth.authenticate()]; 9 | searchFileds = { 10 | nombre: MongoQuery.partialString, 11 | tipo: MongoQuery.partialString, 12 | activo: MongoQuery.equalMatch, 13 | }; 14 | } 15 | 16 | export const DispositivoCtr = new DispositivoResource({}); 17 | export const DispositivoRouter = DispositivoCtr.makeRoutes(); 18 | -------------------------------------------------------------------------------- /core/tm/schemas/grupo-poblacional.schema.ts: -------------------------------------------------------------------------------- 1 | import { Schema, model } from 'mongoose'; 2 | 3 | export const GrupoPoblacionalSchema = new Schema({ 4 | id: Schema.Types.ObjectId, 5 | nombre: { 6 | type: String, 7 | required: true 8 | }, 9 | descripcion: { 10 | type: String, 11 | required: true 12 | }, 13 | activo: { 14 | type: Boolean, 15 | default: true 16 | }, 17 | validaciones: Schema.Types.Mixed, 18 | mensajeDefault: Schema.Types.Mixed, 19 | excepciones: Schema.Types.Mixed 20 | 21 | }); 22 | 23 | export const GrupoPoblacional = model('grupo-poblacional', GrupoPoblacionalSchema, 'grupo-poblacional'); 24 | -------------------------------------------------------------------------------- /modules/descargas/model/barcode.ts: -------------------------------------------------------------------------------- 1 | const bwipjs = require('bwip-js'); 2 | 3 | /** 4 | * Genera un código de barras como imagen PNG en base64. 5 | * @param text Texto que será codificado 6 | * @param bcid Tipo de código de barras, por defecto 'code128' 7 | * @returns Cadena base64 para usar como 8 | */ 9 | export async function generateBarcodeBase64(text: string, bcid: string) { 10 | bcid = bcid ? bcid : 'code128'; 11 | const pngBuffer = await bwipjs.toBuffer({ 12 | bcid, 13 | text, 14 | scale: 1, 15 | height: 8, 16 | includetext: true, 17 | }); 18 | 19 | return pngBuffer.toString('base64'); 20 | } 21 | -------------------------------------------------------------------------------- /modules/descargas/puco/constancia-puco.ts: -------------------------------------------------------------------------------- 1 | import { InformePDF, getAssetsURL } from '../model/informe.class'; 2 | import { ConstanciaPucoBody } from './constancia-puco-body'; 3 | import { ConstanciaPucoHeader } from './constancia-puco-header'; 4 | 5 | export class ConstanciaPuco extends InformePDF { 6 | constructor(public req) { 7 | super(); 8 | } 9 | 10 | stylesUrl = [ 11 | getAssetsURL('templates/puco/constancia.scss') 12 | ]; 13 | 14 | public async process() { 15 | this.header = new ConstanciaPucoHeader(this.req.body.financiador); 16 | this.body = new ConstanciaPucoBody(this.req.body); 17 | 18 | await super.process(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /modules/rup/internacion/index.ts: -------------------------------------------------------------------------------- 1 | export { CamasRouter } from './camas.routes'; 2 | export { CensosRouter } from './censo.routes'; 3 | export { EstadosRouter } from './estados.routes'; 4 | export { SalaComunRouter } from './sala-comun/sala-comun.routes'; 5 | export { InternacionRouter } from './internacion.routes'; 6 | export { InternacionResumenRouter } from './resumen/internacion-resumen.routes'; 7 | export { PlanIndicacionesRouter } from './plan-indicaciones/plan-indicaciones.routes'; 8 | export { PlanIndicacionesEventosRouter } from './plan-indicaciones/plan-indicaciones-eventos.routes'; 9 | 10 | import './resumen/internacion-resumen.hook'; 11 | import './plan-indicaciones/plan-indicaciones.hook'; 12 | -------------------------------------------------------------------------------- /modules/mobileApp/routes/gestion.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import { urlDatosGestion } from '../../../config.private'; 3 | const request = require('request'); 4 | 5 | const router = express.Router(); 6 | const urlGestion = urlDatosGestion; 7 | 8 | 9 | router.get('/datosGestion/', (req, res, next) => { 10 | const options = { 11 | method: 'GET', 12 | uri: urlGestion, 13 | body: {}, 14 | json: true, 15 | timeout: 10000, 16 | }; 17 | request(options, (error, response, _body) => { 18 | if (error) { 19 | return next(error); 20 | } 21 | res.json(_body); 22 | }); 23 | 24 | }); 25 | 26 | export = router; 27 | -------------------------------------------------------------------------------- /modules/mobileApp/routes/categoria.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { Categoria } from '../schemas/categoria'; 3 | 4 | class CategoriaResource extends ResourceBase { 5 | Model = Categoria; 6 | resourceName = 'categoria'; 7 | keyId = '_id'; 8 | searchFileds = { 9 | titulo: MongoQuery.partialString, 10 | expresionSnomed: MongoQuery.equalMatch, 11 | busquedaPor: { 12 | field: 'busquedaPor', 13 | fn: (value) => { 14 | return { $in: value }; 15 | } 16 | } 17 | }; 18 | } 19 | export const CategoriaCtr = new CategoriaResource({}); 20 | module.exports = CategoriaCtr.makeRoutes(); 21 | -------------------------------------------------------------------------------- /modules/carpetas/controller/carpetaPacienteController.ts: -------------------------------------------------------------------------------- 1 | import * as carpetaPaciente from '../../carpetas/schemas/carpetaPaciente'; 2 | 3 | export async function buscarCarpeta(req) { 4 | let carpeta; 5 | if (req.params.id) { 6 | carpeta = carpetaPaciente.findById(req.params.id); 7 | } else { 8 | if (req.query.documento && req.query.organizacion) { 9 | carpeta = carpetaPaciente.find({ documento: req.query.documento }); 10 | carpeta.where('carpetaEfectores.organizacion._id').equals(req.query.organizacion); 11 | } else { 12 | return []; 13 | } 14 | } 15 | return await carpeta; 16 | } 17 | 18 | exports.buscarCarpeta = buscarCarpeta; 19 | -------------------------------------------------------------------------------- /jobs/manual.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Corre una Jobs de forma manual. Corre desde el root del proyecto. 3 | * 4 | * node jobs/manual.js [Js File to run] 5 | */ 6 | 7 | 8 | import { AndesDrive } from '@andes/drive/'; 9 | import { Drive } from '../config.private'; 10 | import { Connections } from './../connections'; 11 | 12 | const path = require('path'); 13 | 14 | Connections.initialize(); 15 | AndesDrive.setup(Drive); 16 | 17 | const { setupServices } = require('../services'); 18 | setupServices(); 19 | 20 | const done = () => { 21 | process.exit(0); 22 | }; 23 | 24 | const actionName = process.argv[2]; 25 | require('./../modules/webhook'); 26 | const action = require(path.join('..', actionName)); 27 | 28 | action(done); 29 | -------------------------------------------------------------------------------- /modules/vacunas/schemas/nomivacCondicion.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const nomivacCondicionSchema = new mongoose.Schema({ 4 | id: mongoose.Schema.Types.ObjectId, 5 | codigo: { 6 | type: Number, 7 | required: true 8 | }, 9 | nombre: { 10 | type: String, 11 | required: true 12 | }, 13 | sexo: String, 14 | orden: String, 15 | habilitado: { 16 | type: Boolean, 17 | required: true, 18 | default: false 19 | } 20 | }); 21 | 22 | nomivacCondicionSchema.index({ 23 | codigo: 1 24 | }); 25 | export const nomivacCondicion = mongoose.model('nomivacCondiciones', nomivacCondicionSchema, 'nomivacCondiciones'); 26 | -------------------------------------------------------------------------------- /core/term/schemas/cie10.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const schema = new mongoose.Schema({ 4 | capitulo: String, 5 | grupo: String, 6 | causa: String, 7 | subcausa: String, 8 | codigo: String, 9 | nombre: String, 10 | sinonimo: String, 11 | c2: Boolean, 12 | reporteC2: String, 13 | ficha: String 14 | }); 15 | 16 | /** 17 | * Desacoplo el schema de la colleccion del que se usa como subschema 18 | * Mongoose te crea indices en los subschemas. 19 | * Consumen espacio. 20 | */ 21 | 22 | const Cie10SchemaWithIndex = schema.clone(); 23 | Cie10SchemaWithIndex.index({ codigo: 1 }); 24 | export const model = mongoose.model('cie10', Cie10SchemaWithIndex, 'cie10'); 25 | -------------------------------------------------------------------------------- /modules/insumos/insumos.routes.ts: -------------------------------------------------------------------------------- 1 | import { asyncHandler, Request, Response } from '@andes/api-tool'; 2 | import { MongoQuery, ResourceBase } from '@andes/core'; 3 | import { Auth } from '../../auth/auth.class'; 4 | import { Insumo } from './insumos-schema'; 5 | 6 | class InsumosResource extends ResourceBase { 7 | Model = Insumo; 8 | resourceName = 'insumos'; 9 | middlewares = [Auth.authenticate()]; 10 | searchFileds = { 11 | insumo: MongoQuery.partialString, 12 | tipo: MongoQuery.equalMatch, 13 | requiereEspecificacion: MongoQuery.equalMatch, 14 | }; 15 | } 16 | 17 | 18 | export const InsumosCtr = new InsumosResource({}); 19 | export const InsumosRouter = InsumosCtr.makeRoutes(); 20 | 21 | -------------------------------------------------------------------------------- /modules/recetas/recetas.error.ts: -------------------------------------------------------------------------------- 1 | export class RecetaNotFound extends Error { 2 | status = 400; 3 | message = 'receta no encontrada'; 4 | } 5 | 6 | export class ParamsIncorrect extends Error { 7 | status = 400; 8 | message = 'parámetros incorrectos'; 9 | constructor(motivo?: string) { 10 | super(); 11 | this.message = motivo ? this.message + '. Motivo: ' + motivo : this.message; 12 | } 13 | } 14 | 15 | export class RecetaNotEdit extends Error { 16 | status = 400; 17 | message = 'La receta no se puede modificar'; 18 | constructor(motivo?: string) { 19 | super(); 20 | this.message = motivo ? this.message + '. Motivo: ' + motivo : this.message; 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /modules/webhook/webhooklog/webhooklog.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const WebHookLogSchema = new mongoose.Schema({ 4 | event: String, 5 | url: String, 6 | method: { 7 | type: String, 8 | default: 'POST', 9 | enum: ['POST', 'PUT', 'PATCH', 'GET'] 10 | }, 11 | headers: mongoose.SchemaTypes.Mixed, // for Token AUTH 12 | body: mongoose.SchemaTypes.Mixed, // a projections of data to send 13 | subscriptionId: mongoose.SchemaTypes.ObjectId, 14 | status: Number, 15 | response: mongoose.SchemaTypes.Mixed, 16 | updatedAt: Date 17 | }, { timestamps: true }); 18 | export const WebHookLog = mongoose.model('webhookLog', WebHookLogSchema, 'webhookLog'); 19 | -------------------------------------------------------------------------------- /modules/constantes/constantes.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { Document, Model } from 'mongoose'; 3 | 4 | export interface Constante { 5 | key: string; 6 | nombre: string; 7 | source: string; 8 | type: 'text' | 'number'; 9 | } 10 | 11 | export interface ConstanteDocument extends Constante, Document { } 12 | 13 | export const ConstantesSchema = new mongoose.Schema({ 14 | key: String, 15 | nombre: String, 16 | source: String, 17 | type: { 18 | type: String, 19 | enum: ['text', 'number'] 20 | } 21 | }); 22 | 23 | export const Constantes: Model = mongoose.model( 24 | 'constantes', 25 | ConstantesSchema, 26 | 'constantes' 27 | ); 28 | -------------------------------------------------------------------------------- /modules/descargas/ficha-epidemiologica/ficha-header.ts: -------------------------------------------------------------------------------- 1 | import { HTMLComponent } from '../model/html-component.class'; 2 | import { loadImage } from '../model/informe.class'; 3 | 4 | export class FichaEpidemiologicaHeader extends HTMLComponent { 5 | template = ` 6 | 7 | `; 8 | 9 | constructor(public detalle) { 10 | super(); 11 | } 12 | 13 | public async process() { 14 | this.data = { 15 | tipo: this.detalle.type.name.toUpperCase(), 16 | logos: { 17 | andes: loadImage('templates/ficha-epidemiologica/img/logoEpidemio.png') 18 | }, 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /modules/vacunas/nomivacCategoria.route.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { nomivacCategoria } from './schemas/nomivacCategoria.schema'; 3 | import { Auth } from '../../auth/auth.class'; 4 | 5 | class NomivacCategoriaResource extends ResourceBase { 6 | Model = nomivacCategoria; 7 | resourceName = 'nomivacCategorias'; 8 | middlewares = [Auth.authenticate()]; 9 | searchFileds = { 10 | codigo: MongoQuery.equalMatch, 11 | habilitado: MongoQuery.equalMatch, 12 | nombre: MongoQuery.partialString 13 | }; 14 | } 15 | 16 | export const nomivacCategoriaCtr = new NomivacCategoriaResource({}); 17 | export const nomivacCategoriaRouter = nomivacCategoriaCtr.makeRoutes(); 18 | -------------------------------------------------------------------------------- /modules/vacunas/nomivacCondicion.route.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { nomivacCondicion } from './schemas/nomivacCondicion.schema'; 3 | import { Auth } from '../../auth/auth.class'; 4 | 5 | class NomivacCondicionResource extends ResourceBase { 6 | Model = nomivacCondicion; 7 | resourceName = 'nomivacCondiciones'; 8 | middlewares = [Auth.authenticate()]; 9 | searchFileds = { 10 | codigo: MongoQuery.equalMatch, 11 | habilitado: MongoQuery.equalMatch, 12 | nombre: MongoQuery.partialString 13 | }; 14 | } 15 | 16 | export const nomivacCondicionCtr = new NomivacCondicionResource({}); 17 | export const nomivacCondicionRouter = nomivacCondicionCtr.makeRoutes(); 18 | -------------------------------------------------------------------------------- /modules/matriculaciones/schemas/turno.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 3 | 4 | const turnoSchema = new mongoose.Schema({ 5 | fecha: { type: Date, required: true }, 6 | tipo: { 7 | type: String, 8 | enum: ['matriculacion', 'renovacion'] 9 | }, 10 | notificado: { type: Boolean, default: false }, 11 | sePresento: { type: Boolean, default: false }, 12 | profesional: { type: mongoose.Schema.Types.ObjectId, ref: 'turnoSolicitado' }, 13 | anulado: Boolean 14 | }); 15 | 16 | // Virtuals 17 | 18 | turnoSchema.plugin(AuditPlugin); 19 | const turno = mongoose.model('turnoMatriculaciones', turnoSchema, 'turno'); 20 | 21 | export = turno; 22 | -------------------------------------------------------------------------------- /modules/mobileApp/sendMessageCache.routes.ts: -------------------------------------------------------------------------------- 1 | import { RoboModel } from '../../utils/roboSender/roboSchema'; 2 | import { MongoQuery, ResourceBase } from '@andes/core'; 3 | import { Auth } from '../../auth/auth.class'; 4 | 5 | class SendMessageCacheResource extends ResourceBase { 6 | Model = RoboModel; 7 | resourceName = 'sendMessageCache'; 8 | keyId = '_id'; 9 | middlewares = [Auth.authenticate()]; 10 | searchFileds = { 11 | email: MongoQuery.partialString, 12 | phone: MongoQuery.partialString, 13 | search: ['email', 'phone'] 14 | }; 15 | } 16 | 17 | export const SendMessageCacheCtr = new SendMessageCacheResource({}); 18 | export const SendMessageCacheRouter = SendMessageCacheCtr.makeRoutes(); 19 | -------------------------------------------------------------------------------- /modules/constantes/constantes.routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { Auth } from '../../auth/auth.class'; 3 | import { Constantes } from './constantes.schema'; 4 | 5 | class ConstantesController extends ResourceBase { 6 | Model = Constantes; 7 | resourceName = 'constantes'; 8 | middlewares = [Auth.authenticate()]; 9 | routesEnable = ['get', 'search']; 10 | searchFileds = { 11 | key: MongoQuery.equalMatch, 12 | nombre: MongoQuery.partialString, 13 | source: MongoQuery.equalMatch, 14 | type: MongoQuery.equalMatch 15 | }; 16 | } 17 | 18 | export const ConstantesCtr = new ConstantesController({}); 19 | export const ConstantesRouter = ConstantesCtr.makeRoutes(); 20 | -------------------------------------------------------------------------------- /core/tm/routes/tipoEstablecimiento.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import * as tipoEstablecimiento from '../schemas/tipoEstablecimiento_model'; 3 | 4 | const router = express.Router(); 5 | 6 | router.get('/tiposEstablecimiento/:id*?', (req, res, next) => { 7 | if (req.params.id) { 8 | tipoEstablecimiento.findById(req.params.id, (err, data) => { 9 | if (err) { 10 | return next(err); 11 | } 12 | res.json(data); 13 | }); 14 | } else { 15 | tipoEstablecimiento.find({}, (err, data) => { 16 | if (err) { 17 | return next(err); 18 | } 19 | res.json(data); 20 | }); 21 | } 22 | }); 23 | export = router; 24 | 25 | -------------------------------------------------------------------------------- /modules/centroOperativoMedico/reglasDerivacion.routes.ts: -------------------------------------------------------------------------------- 1 | import { ReglasDerivacion } from './schemas/reglasDerivacion.schema'; 2 | import { MongoQuery, ResourceBase } from '@andes/core'; 3 | import { Auth } from '../../auth/auth.class'; 4 | 5 | class ReglasDerivacionResource extends ResourceBase { 6 | Model = ReglasDerivacion; 7 | resourceName = 'reglasDerivacion'; 8 | middlewares = [Auth.authenticate()]; 9 | searchFileds = { 10 | estadoInicial: MongoQuery.equalMatch, 11 | estadoFinal: MongoQuery.equalMatch, 12 | soloCOM: MongoQuery.equalMatch 13 | }; 14 | } 15 | 16 | export const ReglasDerivacionCtr = new ReglasDerivacionResource({}); 17 | export const ReglasDerivacionRouter = ReglasDerivacionCtr.makeRoutes(); 18 | -------------------------------------------------------------------------------- /modules/gestor-usuarios/perfil.schema.ts: -------------------------------------------------------------------------------- 1 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 2 | import { Schema, model } from 'mongoose'; 3 | 4 | export const PerfilSchema = new Schema({ 5 | 6 | nombre: { 7 | type: String, 8 | required: true 9 | }, 10 | 11 | permisos: { 12 | type: [String], 13 | required: true 14 | }, 15 | 16 | organizacion: { 17 | type: Schema.Types.ObjectId, 18 | ref: 'organizacion', 19 | required: false 20 | }, 21 | 22 | activo: { 23 | type: Boolean, 24 | required: true 25 | } 26 | 27 | }); 28 | 29 | PerfilSchema.plugin(AuditPlugin); 30 | 31 | export const Perfiles = model('authPerfiles', PerfilSchema, 'authPerfiles'); 32 | -------------------------------------------------------------------------------- /modules/vacunas/nomivacLaboratorio.route.ts: -------------------------------------------------------------------------------- 1 | import { Auth } from '../../auth/auth.class'; 2 | import { MongoQuery, ResourceBase } from '@andes/core'; 3 | import { nomivacLaboratorio } from './schemas/nomivacLaboratorios.schema'; 4 | 5 | class NomivacLaboratorioResource extends ResourceBase { 6 | Model = nomivacLaboratorio; 7 | resourceName = 'nomivacLaboratorios'; 8 | middlewares = [Auth.authenticate()]; 9 | searchFileds = { 10 | codigo: MongoQuery.equalMatch, 11 | habilitado: MongoQuery.equalMatch, 12 | nombre: MongoQuery.partialString 13 | }; 14 | } 15 | 16 | export const nomivacLaboratorioCtr = new NomivacLaboratorioResource({}); 17 | export const nomivacLaboratorioRouter = nomivacLaboratorioCtr.makeRoutes(); 18 | -------------------------------------------------------------------------------- /modules/rup/schemas/prestacion-adjuntos.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Schema de archivos adjuntos en una prestación. 3 | * Se usa para sincronizar desde la appMobile 4 | */ 5 | import * as mongoose from 'mongoose'; 6 | 7 | export const schema = new mongoose.Schema({ 8 | paciente: mongoose.Schema.Types.ObjectId, 9 | prestacion: mongoose.Schema.Types.ObjectId, 10 | profesional: mongoose.Schema.Types.ObjectId, 11 | registro: mongoose.Schema.Types.ObjectId, 12 | valor: mongoose.Schema.Types.Mixed, 13 | estado: { 14 | type: String, 15 | enum: ['pending', 'upload', 'sync'] 16 | }, 17 | createdAt: mongoose.Schema.Types.Date 18 | }); 19 | 20 | export const model = mongoose.model('prestacion-adjuntos', schema, 'prestaciones-adjuntos'); 21 | -------------------------------------------------------------------------------- /modules/vacunas/nomivacVacuna.route.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { nomivacVacunas } from './schemas/nomivacVacuna.schema'; 3 | import { Auth } from '../../auth/auth.class'; 4 | 5 | class NomivacVacunaResource extends ResourceBase { 6 | Model = nomivacVacunas; 7 | resourceName = 'nomivacVacunas'; 8 | middlewares = [Auth.authenticate()]; 9 | searchFileds = { 10 | codigo: MongoQuery.equalMatch, 11 | habilitado: MongoQuery.equalMatch, 12 | nombre: MongoQuery.partialString, 13 | calendarioNacional: MongoQuery.equalMatch 14 | }; 15 | } 16 | 17 | export const nomivacVacunaCtr = new NomivacVacunaResource({}); 18 | export const nomivacVacunaRouter = nomivacVacunaCtr.makeRoutes(); 19 | -------------------------------------------------------------------------------- /core-v2/mpi/parentesco/parentesco.routes.ts: -------------------------------------------------------------------------------- 1 | import { Parentesco } from './parentesco.schema'; 2 | import { MongoQuery } from '@andes/core'; 3 | import { ResourceBase } from '@andes/core'; 4 | import { Auth } from '../../../auth/auth.class'; 5 | 6 | class ParentescoResource extends ResourceBase { 7 | Model = Parentesco; 8 | resourceName = 'parentescos'; 9 | middlewares = [Auth.authenticate()]; 10 | routesAuthorization = { 11 | get: Auth.authorize('mpi:paciente:parentesco') 12 | }; 13 | searchFileds = { 14 | nombre: MongoQuery.partialString, 15 | search: ['nombre'] 16 | }; 17 | } 18 | 19 | export const ParentescoCtr = new ParentescoResource({}); 20 | export const ParentescoRouter = ParentescoCtr.makeRoutes(); 21 | 22 | -------------------------------------------------------------------------------- /modules/webhook/webhooklog/webhooklog.routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery } from '@andes/core'; 2 | import { ResourceBase } from '@andes/core'; 3 | import { WebHookLog } from './webhooklog.schema'; 4 | 5 | class WebhookLogResource extends ResourceBase { 6 | Model = WebHookLog; 7 | resourceName = 'log'; 8 | keyId = '_id'; 9 | 10 | searchFileds = { 11 | url: MongoQuery.partialString, 12 | event: MongoQuery.partialString, 13 | fecha: { 14 | field: 'updatedAt', 15 | fn: (value) => (MongoQuery.matchDate(value)) 16 | }, 17 | search: ['url', 'event'] 18 | }; 19 | } 20 | 21 | export const WebhookLogCtr = new WebhookLogResource({}); 22 | 23 | export const WebhookLogRouter = WebhookLogCtr.makeRoutes(); 24 | -------------------------------------------------------------------------------- /utils/scriptsMongo/createExternalAppsToken.ts: -------------------------------------------------------------------------------- 1 | import { authApps } from './../../auth/schemas/authApps'; 2 | import * as AuthClass from './../../auth/auth.class'; 3 | import * as Connections from './../../connections'; 4 | 5 | 6 | Connections.Connections.initialize(); 7 | 8 | createToken(); 9 | 10 | async function createToken() { 11 | const id = process.argv[2]; 12 | const app: any = await authApps.findById(id); 13 | const organizacion = { 14 | id: app.organizacion, 15 | nombre: app.nombre 16 | }; 17 | const permisos = app.permisos; 18 | 19 | const token = AuthClass.Auth.generateAppToken(app, organizacion, permisos); 20 | app.token = token; 21 | app.save().then(() => { 22 | process.exit(); 23 | }); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /modules/descargas/recupero-costo/recupero-costo-header.ts: -------------------------------------------------------------------------------- 1 | import { HTMLComponent } from '../model/html-component.class'; 2 | import { loadImage } from '../model/informe.class'; 3 | 4 | export class RecuperoCostoHeader extends HTMLComponent { 5 | template = ``; 9 | 10 | constructor() { 11 | super(); 12 | 13 | this.data = { 14 | logo: loadImage('templates/recupero-costo/img/logo.png'), 15 | logoSalud: loadImage('templates/recupero-costo/img/logosalud.png') 16 | }; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /utils/requestHandler.ts: -------------------------------------------------------------------------------- 1 | import * as request from 'request'; 2 | /** 3 | * 4 | * 5 | * @export 6 | * @param {*} params ={ 7 | host, 8 | port, 9 | path, 10 | method: 'GET/PUT/POST...', 11 | rejectUnauthorized: boolean 12 | } 13 | * @returns {Promise<[status,body]>} 14 | */ 15 | export function handleHttpRequest(params): Promise { 16 | return new Promise((resolve, reject) => { 17 | request(params, (err, response, body) => { 18 | if (!err) { 19 | const status = response && response.statusCode; 20 | return resolve([status, body]); 21 | } else { 22 | return reject(err); 23 | } 24 | }); 25 | }); 26 | } 27 | -------------------------------------------------------------------------------- /modules/centroOperativoMedico/schemas/reglasDerivacion.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | export const ESTADOS_DERIVACION = ['solicitada', 'habilitada', 'inhabilitada', 'asignada', 'rechazada', 'aceptada', 'finalizada', 'encomendada']; 3 | 4 | export const ReglasDerivacionSchema = new mongoose.Schema({ 5 | id: mongoose.Schema.Types.ObjectId, 6 | estadoInicial: { 7 | type: String, 8 | enum: ESTADOS_DERIVACION 9 | }, 10 | estadoFinal: { 11 | type: String, 12 | enum: ESTADOS_DERIVACION 13 | }, 14 | soloCom: Boolean, 15 | modificaDestino: Boolean, 16 | defineGravedad: Boolean 17 | }); 18 | 19 | export const ReglasDerivacion = mongoose.model('reglasDerivacion', ReglasDerivacionSchema, 'reglasDerivacion'); 20 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | 12 | ### Comportamiento actual 13 | * Resumen del problema. 14 | 15 | ### Resultado esperado 16 | * ¿Que espera que suceda? 17 | 18 | ### Pasos para reproducir el problema 19 | 1. 20 | 2. 21 | 3. 22 | 23 | 24 | 25 | 26 | 31 | -------------------------------------------------------------------------------- /core-v2/mpi/pacientes-empadronados/pacientes-empadronados.schema.ts: -------------------------------------------------------------------------------- 1 | import { model, Schema } from 'mongoose'; 2 | import { ObraSocialSchema } from '../../../modules/obraSocial/schemas/obraSocial'; 3 | 4 | export const PacientesEmpadronadosSchema = new Schema( 5 | { 6 | documento: String, 7 | sexo: String, 8 | genero: String, 9 | nombre: String, 10 | apellido: String, 11 | fechaNacimiento: Date, 12 | fechaEmpadronamiento: Date, 13 | codigoSisaEmpadronamiento: String, 14 | financiador: { type: ObraSocialSchema }, 15 | pais: String, 16 | createdAt: Date 17 | }); 18 | 19 | export const PacientesEmpadronados = model('pacientes-empadronados', PacientesEmpadronadosSchema, 'pacientes-empadronados'); 20 | -------------------------------------------------------------------------------- /modules/mobileApp/schemas/recordatorio.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const recordatorioSchema = new mongoose.Schema({ 4 | idTurno: { 5 | type: mongoose.Schema.Types.ObjectId, 6 | // unique: true 7 | }, 8 | fechaTurno: Date, 9 | paciente: { 10 | nombre: String, 11 | apellido: String, 12 | telefono: String, 13 | }, 14 | dataAgenda: { 15 | _id: false, 16 | profesionalId: mongoose.Schema.Types.ObjectId, 17 | fecha: Date 18 | }, 19 | estadoEnvio: Boolean, 20 | tipoRecordatorio: { 21 | type: String, 22 | enum: ['turno', 'agenda'] 23 | } 24 | }); 25 | 26 | export const recordatorio = mongoose.model('recordatorio', recordatorioSchema, 'recordatorio'); 27 | -------------------------------------------------------------------------------- /core-v2/mpi/pacientes-empadronados/pacientes-empadronados.routes.ts: -------------------------------------------------------------------------------- 1 | 2 | import { MongoQuery, ResourceBase } from '@andes/core'; 3 | import { Auth } from '../../../auth/auth.class'; 4 | import { PacientesEmpadronados } from './pacientes-empadronados.schema'; 5 | 6 | class PacientesEmpadronadosResource extends ResourceBase { 7 | Model = PacientesEmpadronados; 8 | resourceName = 'pacientes-empadronados'; 9 | middlewares = [Auth.authenticate()]; 10 | searchFileds = { 11 | paciente: { 12 | field: 'paciente.id', 13 | fn: MongoQuery.equalMatch 14 | } 15 | }; 16 | } 17 | 18 | export const PacientesEmpadronadosCtr = new PacientesEmpadronadosResource({}); 19 | export const PacientesEmpadronadosRouter = PacientesEmpadronadosCtr.makeRoutes(); 20 | -------------------------------------------------------------------------------- /modules/forms/forms-resources/forms-resources-routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { Auth } from '../../../auth/auth.class'; 3 | import { FormResource } from './forms-resources-schema'; 4 | 5 | class FormResourceResource extends ResourceBase { 6 | Model = FormResource; 7 | resourceName = 'resources'; 8 | middlewares = [Auth.authenticate()]; 9 | searchFileds = { 10 | nombre: MongoQuery.partialString, 11 | activo: MongoQuery.partialString, 12 | id: MongoQuery.equalMatch, 13 | type: MongoQuery.partialString, 14 | search: ['nombre', 'id', 'type'] 15 | }; 16 | } 17 | 18 | export const FormResourceCtr = new FormResourceResource(); 19 | export const FormResourcesRouter = FormResourceCtr.makeRoutes(); 20 | -------------------------------------------------------------------------------- /modules/vacunas/schemas/nomivacLote.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | export const nomivacLoteSchema = new mongoose.Schema({ 3 | id: mongoose.Schema.Types.ObjectId, 4 | codigo: { 5 | type: String, 6 | required: true 7 | }, 8 | habilitado: { 9 | type: Boolean, 10 | required: true, 11 | default: false 12 | }, 13 | descripcion: String, 14 | vacuna: { 15 | _id: { 16 | type: mongoose.Schema.Types.ObjectId, 17 | ref: 'nomivacVacunas' 18 | }, 19 | codigo: Number, 20 | nombre: String 21 | } 22 | }); 23 | nomivacLoteSchema.index({ 24 | codigo: 1 25 | }); 26 | export const nomivacLotes = mongoose.model('nomivacLotes', nomivacLoteSchema, 'nomivacLotes'); 27 | -------------------------------------------------------------------------------- /modules/forms/forms.routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { Forms } from './forms.schema'; 3 | import { Auth } from '../../auth/auth.class'; 4 | class FormsResource extends ResourceBase { 5 | Model = Forms; 6 | resourceName = 'formulario'; 7 | middlewares = [Auth.authenticate()]; 8 | routesAuthorization = {}; 9 | searchFileds = { 10 | name: MongoQuery.partialString, 11 | type: MongoQuery.partialString, 12 | active: MongoQuery.equalMatch, 13 | search: ['name', 'type'], 14 | sections: { 15 | field: 'sections.id', 16 | fn: value => value 17 | } 18 | }; 19 | } 20 | 21 | export const FormCtr = new FormsResource(); 22 | export const FormRouter = FormCtr.makeRoutes(); 23 | -------------------------------------------------------------------------------- /modules/mobileApp/pacienteApp.routes.ts: -------------------------------------------------------------------------------- 1 | 2 | import { PacienteApp } from './schemas/pacienteApp'; 3 | import { MongoQuery, ResourceBase } from '@andes/core'; 4 | import { Auth } from '../../auth/auth.class'; 5 | 6 | class PacienteAppResource extends ResourceBase { 7 | Model = PacienteApp; 8 | resourceName = 'pacienteApp'; 9 | keyId = '_id'; 10 | middlewares = [Auth.authenticate()]; 11 | searchFileds = { 12 | documento: MongoQuery.partialString, 13 | email: MongoQuery.partialString, 14 | sexo: MongoQuery.partialString, 15 | activacionApp: MongoQuery.equalMatch, 16 | search: ['documento', 'email'] 17 | }; 18 | } 19 | 20 | export const PacienteAppCtr = new PacienteAppResource({}); 21 | export const PacienteAppRouter = PacienteAppCtr.makeRoutes(); 22 | -------------------------------------------------------------------------------- /modules/vacunas/schemas/nomivacLaboratorios.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const nomivacLaboratorioSchema = new mongoose.Schema({ 4 | id: mongoose.Schema.Types.ObjectId, 5 | codigo: { 6 | type: Number, 7 | required: true 8 | }, 9 | nombre: { 10 | type: String, 11 | required: true 12 | }, 13 | Pais: String, 14 | RazonSocial: String, 15 | CUIT: String, 16 | Provincia: String, 17 | Localidad: String, 18 | Domicilio: String, 19 | CodigoPostal: String, 20 | TipoTelefono: String, 21 | Telefono: String, 22 | Mail: String, 23 | habilitado: Boolean 24 | }); 25 | 26 | export const nomivacLaboratorio = mongoose.model('nomivacLaboratorios', nomivacLaboratorioSchema, 'nomivacLaboratorios'); 27 | -------------------------------------------------------------------------------- /modules/matriculaciones/schemas/cambioDni.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { ObjSIISASchema } from '../../../core/tm/schemas/siisa'; 3 | 4 | const cambioDniSchema = new mongoose.Schema({ 5 | apellido: { type: String, required: true }, 6 | nombre: { type: String, required: true }, 7 | idProfesional: { type: String, required: false }, 8 | nacionalidad: { type: ObjSIISASchema, required: false }, 9 | dniActual: { type: String, required: true }, 10 | dniNuevo: { type: String, required: true }, 11 | fecha: { type: Date, required: true }, 12 | atendida: { type: Boolean, required: true }, 13 | 14 | }); 15 | 16 | // Virtuals 17 | 18 | 19 | const cambioDni = mongoose.model('solicitudCambioDni', cambioDniSchema, 'solicitudCambioDni'); 20 | 21 | export = cambioDni; 22 | -------------------------------------------------------------------------------- /modules/semaforo/semaforo.schema.ts: -------------------------------------------------------------------------------- 1 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 2 | import * as mongoose from 'mongoose'; 3 | 4 | export const SemaforoSchema = new mongoose.Schema({ 5 | name: String, 6 | options: [ 7 | { 8 | id: Number, 9 | priority: Number, 10 | min: Number, 11 | max: Number, 12 | value: mongoose.Schema.Types.Mixed, 13 | label: String, 14 | color: String, 15 | itemRowStyle: { 16 | border: String, 17 | hover: String, 18 | background: String 19 | } 20 | } 21 | ] 22 | }); 23 | 24 | SemaforoSchema.plugin(AuditPlugin); 25 | export const Semaforo = mongoose.model('semaforo', SemaforoSchema, 'semaforo'); 26 | -------------------------------------------------------------------------------- /jobs/fueraDeAgendaJob.ts: -------------------------------------------------------------------------------- 1 | import * as fueraAgendaCtrl from './../modules/estadistica/pecas/controller/fueraDeAgenda'; 2 | import * as moment from 'moment'; 3 | 4 | function run(done) { 5 | const paramInicio = process.argv[3]; 6 | const paramFin = process.argv[4]; 7 | const start = paramInicio ? 8 | moment(new Date(paramInicio).setHours(0, 0, 0, 0)).format('YYYY-MM-DD HH:mm:ss') : 9 | moment(new Date().setHours(0, 0, 0, 0)).subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'); 10 | const end = paramFin ? 11 | moment(new Date(paramFin).setHours(23, 59, 0, 0)).format('YYYY-MM-DD HH:mm:ss') : 12 | moment(new Date().setHours(23, 59, 0, 0)).subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'); 13 | fueraAgendaCtrl.fueraAgendaPecas(start, end, done); 14 | } 15 | 16 | export = run; 17 | -------------------------------------------------------------------------------- /modules/obraSocial/controller/profe.ts: -------------------------------------------------------------------------------- 1 | import { Profe } from '../schemas/profe'; 2 | 3 | // obtiene las versiones de todos los padrones cargados (PROFE) 4 | export async function obtenerVersiones() { 5 | const versiones = await Profe.distinct('version').exec(); // esta consulta obtiene un arreglo de strings 6 | for (let i = 0; i < versiones.length; i++) { 7 | versiones[i] = { version: versiones[i] }; 8 | } 9 | versiones.sort((a, b) => compare(a.version, b.version)); 10 | return versiones; 11 | } 12 | 13 | // Compara fechas. Junto con el sort ordena los elementos de mayor a menor. 14 | function compare(a, b) { 15 | if (new Date(a) > new Date(b)) { 16 | return -1; 17 | } 18 | if (new Date(a) < new Date(b)) { 19 | return 1; 20 | } 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /modules/webhook/webhook.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const WebHookSchema = new mongoose.Schema({ 4 | nombre: String, 5 | event: String, 6 | url: String, 7 | method: { 8 | type: String, 9 | default: 'POST', 10 | enum: ['POST', 'PUT', 'PATCH', 'GET'] 11 | }, 12 | headers: mongoose.SchemaTypes.Mixed, // for Token AUTH 13 | data: mongoose.SchemaTypes.Mixed, // a projections of data to send 14 | filters: [mongoose.SchemaTypes.Mixed], // posibles filtros filtros 15 | trasform: { 16 | type: String, 17 | required: false 18 | }, 19 | active: Boolean, 20 | rules: mongoose.SchemaTypes.Mixed 21 | }, { timestamps: true }); 22 | 23 | export const WebHook = mongoose.model('webhook', WebHookSchema, 'webhook'); 24 | -------------------------------------------------------------------------------- /core/tm/index.ts: -------------------------------------------------------------------------------- 1 | import { ConceptosTurneablesRouter } from './conceptos-turneables.routes'; 2 | import { ModulosRouter } from './modulos.routes'; 3 | import { GrupoPoblacionalRouter } from './grupo-poblacional.routes'; 4 | import { ZonasSanitariasRouter } from './zonaSanitaria.routes'; 5 | import { ServicionIntermedioRouter } from './servicio-intermedio.routes'; 6 | import { FarmaciasRouter } from './farmacia.routes'; 7 | import { AreaAraucaniaRouter } from './areaAraucania.routes'; 8 | import { ECLQueriesRouter } from './eclqueries.routes'; 9 | 10 | export const Routes = [ 11 | ConceptosTurneablesRouter, 12 | ModulosRouter, 13 | GrupoPoblacionalRouter, 14 | ZonasSanitariasRouter, 15 | ServicionIntermedioRouter, 16 | FarmaciasRouter, 17 | AreaAraucaniaRouter, 18 | ECLQueriesRouter 19 | ]; 20 | -------------------------------------------------------------------------------- /core/tm/routes/profesion.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import { asyncHandler } from '@andes/api-tool'; 3 | import { profesion } from '../schemas/profesion_model'; 4 | 5 | const router = express.Router(); 6 | 7 | router.get('/profesiones/:id', asyncHandler(async (req, res, next) => { 8 | const prof = await profesion.findById(req.params.id); 9 | res.json(prof); 10 | })); 11 | 12 | router.get('/profesiones/', asyncHandler(async (req, res, next) => { 13 | let query: any = {}; 14 | if (req.query) { 15 | query = { 16 | ...req.query, 17 | habilitado: true // Solo trae profesiones habilitadas 18 | }; 19 | } 20 | const profesiones = await profesion.find(query).sort({ codigoSISA: 1 }); 21 | res.json(profesiones); 22 | })); 23 | 24 | export = router; 25 | -------------------------------------------------------------------------------- /shared/interfaces/direccion.interface.ts: -------------------------------------------------------------------------------- 1 | import { IUbicacion } from './ubicacion.interface'; 2 | import { Moment } from 'moment'; 3 | import { Document } from 'mongoose'; 4 | 5 | export interface IDireccion { 6 | tipo: String; 7 | valor: String; 8 | codigoPostal: String; 9 | ubicacion: IUbicacion; 10 | geoReferencia: Number[]; 11 | ranking: Number; 12 | activo: Boolean; 13 | ultimaActualizacion: Date | Moment; 14 | situacionCalle: Boolean; 15 | } 16 | 17 | export interface IDireccionDoc extends Document, IDireccion { 18 | /** 19 | * Determina si todos los campos de la dirección están cargados 20 | */ 21 | isCompleted(): Boolean; 22 | 23 | /** 24 | * Devuelve la dirección formateada (calle, localidad, provincia) 25 | */ 26 | format(): String; 27 | } 28 | -------------------------------------------------------------------------------- /modules/vacunas/nomivacLote.route.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import * as mongoose from 'mongoose'; 3 | import { Auth } from '../../auth/auth.class'; 4 | import { nomivacLotes } from './schemas/nomivacLote.schema'; 5 | 6 | class NomivacLotesResource extends ResourceBase { 7 | Model = nomivacLotes; 8 | resourceName = 'nomivacLotes'; 9 | middlewares = [Auth.authenticate()]; 10 | searchFileds = { 11 | codigo: MongoQuery.equalMatch, 12 | habilitado: MongoQuery.equalMatch, 13 | vacuna: { 14 | field: 'vacuna._id', 15 | fn: (value) => mongoose.Types.ObjectId(value) 16 | }, 17 | }; 18 | } 19 | 20 | export const nomivacLoteCtr = new NomivacLotesResource({}); 21 | export const nomivacLoteRouter = nomivacLoteCtr.makeRoutes(); 22 | -------------------------------------------------------------------------------- /modules/vacunas/schemas/vacunas.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const vacunasSchema = new mongoose.Schema({ 4 | idvacuna: Number, 5 | codigo: String, 6 | vacuna: String, 7 | esquema: String, 8 | condicion: String, 9 | dosis: String, 10 | ordenDosis: Number, 11 | fechaAplicacion: Date, 12 | documento: String, 13 | apellido: String, 14 | nombre: String, 15 | fechaNacimiento: Date, 16 | sexo: { 17 | type: String, 18 | enum: ['masculino', 'femenino'] 19 | }, 20 | codigoEsquema: Number, 21 | codigoCondicion: Number, 22 | efector: String 23 | }); 24 | 25 | vacunasSchema.index({ documento: 1 }); 26 | vacunasSchema.index({ idvacuna: 1 }); 27 | 28 | export const vacunas = mongoose.model('vacunas', vacunasSchema, 'nomivac'); 29 | -------------------------------------------------------------------------------- /modules/descargas/informe-turnos/informe-turnos.ts: -------------------------------------------------------------------------------- 1 | import { InformePDF, getAssetsURL } from '../model/informe.class'; 2 | import { TurnosInformeBody } from './turno-body'; 3 | import { TurnosInformeHeader } from './turnos-header'; 4 | import * as moment from 'moment'; 5 | 6 | export class InformeTurnos extends InformePDF { 7 | constructor(public req) { 8 | super(); 9 | } 10 | 11 | stylesUrl = [ 12 | getAssetsURL('templates/matriculaciones/informe-turno.scss') 13 | ]; 14 | 15 | public async process() { 16 | const fecha = moment(this.req.body.fecha).format('DD/MM/YYYY'); 17 | const turnos = this.req.body.turnos; 18 | this.header = new TurnosInformeHeader(); 19 | this.body = new TurnosInformeBody(turnos,fecha); 20 | await super.process(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/log/schemas/logExportaInformacion.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const informacionExportadaSchema = new mongoose.Schema({ 4 | fecha: { 5 | type: Date 6 | }, 7 | sistema: String, 8 | key: String, 9 | idPrestacion: mongoose.Schema.Types.ObjectId, 10 | idPaciente: mongoose.Schema.Types.ObjectId, 11 | info_enviada: { type: mongoose.Schema.Types.Mixed }, 12 | resultado: { type: mongoose.Schema.Types.Mixed } 13 | }); 14 | 15 | informacionExportadaSchema.index({ fecha: 1, sistema: 1, key: 1 }); 16 | informacionExportadaSchema.index({ fecha: 1, idPaciente: 1 }); 17 | informacionExportadaSchema.index({ idPrestacion: 1 }); 18 | 19 | export const InformacionExportada = mongoose.model('nomivacInformacionExportada', informacionExportadaSchema, 'nomivacInformacionExportada'); 20 | -------------------------------------------------------------------------------- /modules/matriculaciones/routes/entidadFormadora.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import * as entidadFormadora from '../schemas/entidadFormadora'; 3 | 4 | const router = express.Router(); 5 | 6 | router.get('/entidadesFormadoras/:id*?', (req, res, next) => { 7 | 8 | if (req.params.id) { 9 | entidadFormadora.findById(req.params.id, (err, data) => { 10 | if (err) { 11 | return next(err); 12 | } 13 | 14 | res.json(data); 15 | }); 16 | 17 | } else { 18 | 19 | entidadFormadora.find({ habilitado: true }).sort({ codigoSISA: 1 }).exec((error, data) => { 20 | if (error) { 21 | return next(error); 22 | } 23 | 24 | res.json(data); 25 | }); 26 | } 27 | 28 | }); 29 | 30 | 31 | export = router; 32 | -------------------------------------------------------------------------------- /modules/matriculaciones/routes/modalidadesCertificacion.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import * as modalidadesCertificacion from '../schemas/modalidadesCertificacion'; 3 | 4 | const router = express.Router(); 5 | 6 | router.get('/modalidadesCertificacion/:id*?', (req, res, next) => { 7 | 8 | if (req.params.id) { 9 | modalidadesCertificacion.findById(req.params.id, (err, data) => { 10 | if (err) { 11 | return next(err); 12 | } 13 | 14 | res.json(data); 15 | }); 16 | 17 | } else { 18 | 19 | modalidadesCertificacion.find().exec((error, data) => { 20 | if (error) { 21 | return next(error); 22 | } 23 | 24 | res.json(data); 25 | }); 26 | } 27 | 28 | }); 29 | 30 | 31 | export = router; 32 | -------------------------------------------------------------------------------- /scripts/MISC-85.ts: -------------------------------------------------------------------------------- 1 | import { Codificacion } from '../modules/rup/schemas/codificacion'; 2 | import { Prestacion } from '../modules/rup/schemas/prestacion'; 3 | 4 | 5 | async function run(done) { 6 | const codificaciones = Codificacion.find({ estadoFacturacion: { $exists: true } }).cursor({ batchSize: 100 }); 7 | let i = 0; 8 | for await (const codificacion of codificaciones) { 9 | i++; 10 | // eslint-disable-next-line no-console 11 | if (i % 100 === 0) { console.log(i); } 12 | 13 | if (codificacion.estadoFacturacion) { 14 | await Prestacion.updateOne( 15 | { _id: codificacion.idPrestacion }, 16 | { $set: { estadoFacturacion: codificacion.estadoFacturacion } } 17 | ); 18 | } 19 | 20 | } 21 | done(); 22 | } 23 | 24 | export = run; 25 | -------------------------------------------------------------------------------- /modules/descargas/matriculaciones/certificado-etica.ts: -------------------------------------------------------------------------------- 1 | import { InformePDF, getAssetsURL } from '../model/informe.class'; 2 | import { CertificadoEticaHeader } from './certificado-etica-header'; 3 | import { CertificadoEticaBody } from './certificado-etica-body'; 4 | import { CertificadoEticaFooter } from './certificado-etica-footer'; 5 | 6 | export class CertificadoEtica extends InformePDF { 7 | constructor(public req) { 8 | super(); 9 | } 10 | 11 | stylesUrl = [ 12 | getAssetsURL('templates/matriculaciones/certificado-etica.scss') 13 | ]; 14 | 15 | public async process() { 16 | this.header = new CertificadoEticaHeader(); 17 | this.body = new CertificadoEticaBody(this.req.body); 18 | this.footer = new CertificadoEticaFooter(); 19 | 20 | await super.process(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /modules/forms/forms-resources/forms-preset-resources-routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { Auth } from '../../../auth/auth.class'; 3 | import { FormPresetResource } from './forms-preset-resources-schema'; 4 | 5 | class FormPresetResourceResource extends ResourceBase { 6 | Model = FormPresetResource; 7 | resourceName = 'preset-resources'; 8 | middlewares = [Auth.authenticate()]; 9 | searchFileds = { 10 | nombre: MongoQuery.partialString, 11 | activo: MongoQuery.partialString, 12 | id: MongoQuery.equalMatch, 13 | type: MongoQuery.partialString, 14 | search: ['nombre', 'id', 'type'] 15 | }; 16 | } 17 | 18 | export const FormPresetResourceCtr = new FormPresetResourceResource(); 19 | export const FormPresetResourcesRouter = FormPresetResourceCtr.makeRoutes(); 20 | -------------------------------------------------------------------------------- /modules/vacunas/routes/vacunas-pacientes.routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { Auth } from '../../../auth/auth.class'; 3 | import { VacunasPacientes } from '../schemas/vacunas-pacientes.schema'; 4 | 5 | class VacunasPacientesResource extends ResourceBase { 6 | Model = VacunasPacientes; 7 | middlewares = [Auth.authenticate()]; 8 | resourceName = 'vacunas-pacientes'; 9 | searchFileds = { 10 | paciente: { 11 | field: 'paciente.id', 12 | fn: MongoQuery.equalMatch 13 | }, 14 | vacuna: { 15 | field: 'aplicaciones.vacuna.id', 16 | fn: MongoQuery.equalMatch 17 | } 18 | }; 19 | } 20 | 21 | export const VacunasPacientesCtr = new VacunasPacientesResource(); 22 | export const VacunasPacientesRouter = VacunasPacientesCtr.makeRoutes(); 23 | -------------------------------------------------------------------------------- /modules/descargas/com/derivacion.ts: -------------------------------------------------------------------------------- 1 | import { DerivacionBody } from './derivacion-body'; 2 | import { DerivacionHeader } from './derivacion-header'; 3 | import { InformePDF, getAssetsURL } from '../model/informe.class'; 4 | import { Auth } from '../../../auth/auth.class'; 5 | 6 | export class Derivacion extends InformePDF { 7 | constructor(public req) { 8 | super(); 9 | } 10 | 11 | stylesUrl = [ 12 | getAssetsURL('templates/com/comprobante.scss') 13 | ]; 14 | 15 | public async process() { 16 | this.header = new DerivacionHeader(); 17 | 18 | const { derivacionId, historial } = this.req.body; 19 | const organizacionId = historial ? Auth.getOrganization(this.req) : null; 20 | this.body = new DerivacionBody({ derivacionId, historial, organizacionId }); 21 | await super.process(); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /modules/descargas/laboratorio/laboratorio.ts: -------------------------------------------------------------------------------- 1 | import { InformePDF, getAssetsURL } from '../model/informe.class'; 2 | import { FarmaciaBody } from './laboratorio-body'; 3 | import { FarmaciaHeader } from './laboratorio-header'; 4 | import { LaboratorioFooter } from './laboratorio-footer'; 5 | 6 | export class Laboratorio extends InformePDF { 7 | constructor(private encabezado, private detalle, private paciente, private usuario) { 8 | super(); 9 | } 10 | 11 | stylesUrl = [ 12 | getAssetsURL('templates/laboratorio/laboratorio.scss') 13 | ]; 14 | 15 | public async process() { 16 | this.header = new FarmaciaHeader(this.encabezado); 17 | this.body = new FarmaciaBody(this.encabezado, this.paciente, this.detalle); 18 | this.footer = new LaboratorioFooter(this.usuario); 19 | 20 | await super.process(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /modules/vacunas/schemas/nomivacVacuna.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const nomivacVacunaSchema = new mongoose.Schema({ 4 | id: mongoose.Schema.Types.ObjectId, 5 | codigo: { 6 | type: Number, 7 | required: true 8 | }, 9 | nombre: { 10 | type: String, 11 | required: true 12 | }, 13 | calendarioNacional: String, 14 | codigoNomencladorNacer: String, 15 | vigenciaDesde: Date, 16 | vigenciaHasta: Date, 17 | orden: String, 18 | habilitado: { 19 | type: Boolean, 20 | required: true, 21 | default: false 22 | }, 23 | codigoSUMAR: String, 24 | snomed_conceptId: String 25 | }); 26 | 27 | nomivacVacunaSchema.index({ 28 | codigo: 1 29 | }); 30 | export const nomivacVacunas = mongoose.model('nomivacVacunas', nomivacVacunaSchema, 'nomivacVacunas'); 31 | -------------------------------------------------------------------------------- /scripts/gdu-22.ts: -------------------------------------------------------------------------------- 1 | 2 | import { AuthUsers } from '../auth/schemas/authUsers'; 3 | 4 | async function run(done) { 5 | const permiso = 'usuarios:*'; 6 | const permisosUsuarios = ['usuarios:read', 7 | 'usuarios:write', 8 | 'usuarios:perfiles', 9 | ]; 10 | const usuarios = AuthUsers.find({ 'organizaciones.permisos': permiso }).cursor({ batchSize: 200 }); 11 | 12 | let usuario; 13 | while (usuario = await usuarios.next()) { 14 | usuario.organizaciones 15 | .filter(o => o.permisos.includes(permiso)) 16 | .forEach(o => o.permisos = [...o.permisos.filter(p => p !== permiso), ...permisosUsuarios]); 17 | 18 | await AuthUsers.update({ _id: usuario._id }, { $set: { organizaciones: usuario.organizaciones } }); 19 | } 20 | done(); 21 | } 22 | 23 | export = run; 24 | -------------------------------------------------------------------------------- /core/tm/modulos.routes.ts: -------------------------------------------------------------------------------- 1 | 2 | import { MongoQuery, ResourceBase } from '@andes/core'; 3 | import { Modulos } from './schemas/modulos.schema'; 4 | 5 | class ModuloResource extends ResourceBase { 6 | Model = Modulos; 7 | resourceName = 'modulos'; 8 | searchFileds = { 9 | search: ['nombre'], 10 | nombre: MongoQuery.partialString, 11 | descripcion: MongoQuery.partialString, 12 | color: MongoQuery.partialString, 13 | subtitulo: MongoQuery.partialString, 14 | activo: MongoQuery.equalMatch, 15 | orden: MongoQuery.equalMatch, 16 | permisos: { 17 | field: 'permisos', 18 | fn: (value) => { 19 | return { $in: value }; 20 | } 21 | } 22 | }; 23 | } 24 | export const ModulosCtr = new ModuloResource({}); 25 | export const ModulosRouter = ModulosCtr.makeRoutes(); 26 | -------------------------------------------------------------------------------- /utils/utilCoordenadas.ts: -------------------------------------------------------------------------------- 1 | // Aplica applyHaversine para calcular distancia entre dos puntos 2 | export function getDistanceBetweenPoints(start, end, units) { 3 | const earthRadius = { 4 | miles: 3958.8, 5 | km: 6371 6 | }; 7 | 8 | const R = earthRadius[units || 'km']; 9 | const lat1 = start.lat; 10 | const lon1 = start.lng; 11 | const lat2 = end.lat; 12 | const lon2 = end.lng; 13 | 14 | const dLat = toRad((lat2 - lat1)); 15 | const dLon = toRad((lon2 - lon1)); 16 | const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + 17 | Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * 18 | Math.sin(dLon / 2) * 19 | Math.sin(dLon / 2); 20 | const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); 21 | const d = R * c; 22 | return d; 23 | } 24 | 25 | function toRad(x) { 26 | return x * Math.PI / 180; 27 | } 28 | -------------------------------------------------------------------------------- /modules/rup/schemas/semantic-tag.ts: -------------------------------------------------------------------------------- 1 | export const SemanticTag = { 2 | type: String, 3 | enum: [ 4 | 'objeto físico', 5 | 'estructura corporal', 6 | 'espécimen', 7 | 'hallazgo', 8 | 'sustancia', 9 | 'concepto especial', 10 | 'medio ambiente / localización', 11 | 'metadato', 12 | 'contexto social', 13 | 'entidad observable', 14 | 'procedimiento', 15 | 'calificador', 16 | 'fuerza física', 17 | 'escala de estadificación', 18 | 'elemento de registro', 19 | 'producto', 20 | 'evento', 21 | 'organismo', 22 | 'situación', 23 | 'trastorno', 24 | 'régimen/tratamiento', 25 | 'medio ambiente', 26 | 'medicamento clínico', 27 | 'fármaco de uso clínico', 28 | 'persona', 29 | 'plan' 30 | ] 31 | }; 32 | -------------------------------------------------------------------------------- /modules/turnos/institucion.routes.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import { IInstitucion, Institucion } from './institucion.schema'; 3 | 4 | class InstitucionResource extends ResourceBase { 5 | Model = Institucion; 6 | resourceName = 'institucion'; 7 | searchFileds = { 8 | nombre: MongoQuery.partialString, 9 | tipo: MongoQuery.partialString, 10 | activo: MongoQuery.equalMatch, 11 | contacto: { 12 | field: 'contacto.valor', 13 | fn: MongoQuery.partialString 14 | }, 15 | direccion: { 16 | field: 'direccion.valor', 17 | fn: MongoQuery.partialString 18 | }, 19 | search: ['nombre'] 20 | }; 21 | } 22 | 23 | export const InstitucionCtr = new InstitucionResource({}); 24 | export const InstitucionRouter = InstitucionCtr.makeRoutes(); 25 | -------------------------------------------------------------------------------- /core/tm/routes/especialidadesFT.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import * as especialidad from '../schemas/especialidadesFT'; 3 | import * as mongoose from 'mongoose'; 4 | 5 | const router = express.Router(); 6 | 7 | router.get('/especialidadFT/:id?', (req, res, next) => { 8 | 9 | if (mongoose.Types.ObjectId.isValid(req.params.id)) { 10 | 11 | especialidad.findById(req.params.id, (err, data) => { 12 | if (err) { 13 | return next(err); 14 | } 15 | res.json(data); 16 | }); 17 | } else { 18 | const query = especialidad.find({}); 19 | 20 | query.sort({ descripcion: 1 }); 21 | 22 | query.exec((err, data) => { 23 | if (err) { 24 | return next(err); 25 | } 26 | res.json(data); 27 | }); 28 | } 29 | }); 30 | 31 | export = router; 32 | -------------------------------------------------------------------------------- /modules/descargas/ficha-epidemiologica/ficha.ts: -------------------------------------------------------------------------------- 1 | import { InformePDF, getAssetsURL } from '../model/informe.class'; 2 | import { FichaEpidemiologicaBody } from './ficha-body'; 3 | import { FichaEpidemiologicaFooter } from './ficha-footer'; 4 | import { FichaEpidemiologicaHeader } from './ficha-header'; 5 | 6 | export class FichaEpidemiologica extends InformePDF { 7 | constructor(private detalle, private usuario, private ficha) { 8 | super(); 9 | } 10 | 11 | stylesUrl = [ 12 | getAssetsURL('templates/ficha-epidemiologica/ficha-epidemiologica.scss') 13 | ]; 14 | 15 | public async process() { 16 | this.header = new FichaEpidemiologicaHeader(this.detalle); 17 | this.body = new FichaEpidemiologicaBody(this.detalle, this.ficha); 18 | this.footer = new FichaEpidemiologicaFooter(this.usuario); 19 | 20 | await super.process(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /scripts/VAC-108.ts: -------------------------------------------------------------------------------- 1 | import { sincronizarVacunas } from '../modules/vacunas/controller/vacunas.events'; 2 | import { VacunasPacientes } from '../modules/vacunas/schemas/vacunas-pacientes.schema'; 3 | 4 | async function run(done) { 5 | const from = new Date('2021-02-01T00:00:00.000-03:00'); 6 | const vacunasPacientes: any = VacunasPacientes.aggregate([ 7 | { $match: { 'aplicaciones.fechaAplicacion': { $gte: from } } }, 8 | { $group: { _id: '$paciente.id', count: { $sum: 1 } } }, 9 | { $match: { _id: { $ne: null }, count: { $gt: 1 } } }, 10 | { $project: { pacienteId: '$_id' } } 11 | ]).cursor({ batchSize: 100 }); 12 | 13 | for await (const pacienteId of vacunasPacientes) { 14 | await VacunasPacientes.remove({ 'paciente.id': pacienteId._id }); 15 | await sincronizarVacunas(pacienteId._id); 16 | } 17 | done(); 18 | } 19 | 20 | export = run; 21 | -------------------------------------------------------------------------------- /templates/emails/otp-code.html: -------------------------------------------------------------------------------- 1 | {{#> layout }} 2 | {{#with usuario}} 3 |
4 | Hola {{nombre}} {{apellido}} 5 |
6 |
7 |

Recibiste este mensaje porque solicitaste cambiar tu contraseña.

8 | {{/with}} 9 |
10 |

11 | Tu código de verificación es: 12 |

13 |
14 | {{otpCode}} 15 |
16 |
17 |

18 | Este código expirará en 1 hora. Por favor, ingresa este código en el 19 | formulario para continuar. 20 |

21 | {{/layout}} 22 | -------------------------------------------------------------------------------- /packages/drive/file-descriptor/controller.ts: -------------------------------------------------------------------------------- 1 | import { FileDescriptorModel } from './schemas'; 2 | import { Auth } from '../../../auth/auth.class'; 3 | 4 | export class FileDescriptor { 5 | public static async create(data, req) { 6 | // [TODO] Add some validation 7 | const fd = new FileDescriptorModel(data); 8 | Auth.audit(fd, req); 9 | return fd.save(); 10 | } 11 | 12 | public static async update(uuid, data, req) { 13 | const fd = await this.find(uuid); 14 | fd.real_id = data.real_id; 15 | fd.adapter = data.adapter; 16 | Auth.audit(fd, req); 17 | return fd.save(); 18 | } 19 | 20 | public static async delete(uuid) { 21 | const fd = await this.find(uuid); 22 | return fd.remove(); 23 | } 24 | 25 | public static async find(id) { 26 | return await FileDescriptorModel.findById(id); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/term/schemas/configuracionPrestacion.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const configuracionPrestacionSchema = new mongoose.Schema({ 4 | snomed: { 5 | conceptId: String, 6 | term: String, 7 | fsn: String, 8 | semanticTag: String, 9 | }, 10 | loinc: { 11 | code: String, 12 | codeSystem: String, 13 | codeSystemName: String, 14 | displayName: String 15 | }, 16 | idServicio: Number, 17 | organizaciones: [{ 18 | _id: { 19 | type: mongoose.Schema.Types.ObjectId, 20 | ref: 'organizacion' 21 | }, 22 | codigo: Number, // Codigo de la prestación (va a servir para vincular las prestaciones que tengan distinto ID) 23 | }] 24 | }); 25 | 26 | export const configuracionPrestacionModel = mongoose.model('configuracionPrestacion', configuracionPrestacionSchema, 'configuracionPrestacion'); 27 | -------------------------------------------------------------------------------- /modules/mobileApp/schemas/minuta.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 3 | export const MinutaSchema = new mongoose.Schema({ 4 | idMinuta: { 5 | type: String 6 | }, 7 | fecha: { 8 | type: Date 9 | }, 10 | quienRegistra: { 11 | type: String, 12 | required: true 13 | }, 14 | participantes: { 15 | type: String 16 | }, 17 | temas: { 18 | type: String 19 | }, 20 | conclusiones: { 21 | type: String 22 | }, 23 | pendientes: { 24 | type: String 25 | }, 26 | fechaProxima: { 27 | type: Date 28 | }, 29 | lugarProxima: { 30 | type: String 31 | }, 32 | origen: { 33 | type: String 34 | } 35 | }); 36 | 37 | MinutaSchema.plugin(AuditPlugin); 38 | export const Minuta = mongoose.model('minuta', MinutaSchema, 'minuta'); 39 | -------------------------------------------------------------------------------- /modules/huds/export-huds/exportHuds.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | // [TODO] Interfaces 4 | 5 | export const ExportHudsSchema = new mongoose.Schema({ 6 | fechaDesde: Date, 7 | fechaHasta: Date, 8 | pacienteId: mongoose.Schema.Types.ObjectId, 9 | pacienteNombre: String, 10 | tipoPrestacion: String, 11 | idHudsFiles: mongoose.Schema.Types.ObjectId, 12 | user: Object, 13 | prestaciones: [mongoose.Schema.Types.ObjectId], // Para el pedido desde el buscador de turnos y prestaciones 14 | createdAt: Date, 15 | updatedAt: Date, 16 | expiredAt: Date, 17 | status: { 18 | type: String, 19 | enum: ['pending', 'success', 'error', 'canceled', 'completed'], 20 | required: true, 21 | default: 'pending' 22 | }, 23 | excluye: [String] 24 | }); 25 | 26 | export const ExportHudsModel = mongoose.model('exportHuds', ExportHudsSchema, 'exportHuds'); 27 | -------------------------------------------------------------------------------- /modules/rup/schemas/prestacion.solicitud.historial.ts: -------------------------------------------------------------------------------- 1 | import { tipoPrestacionSchema } from './../../../core/tm/schemas/tipoPrestacion'; 2 | import { ProfesionalBaseSchema } from './../../../core/tm/schemas/profesional'; 3 | import * as mongoose from 'mongoose'; 4 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 5 | 6 | export const PrestacionSolicitudHistorialschema = new mongoose.Schema({ 7 | accion: String, 8 | descripcion: String, 9 | fechaDeNotificacion: Date, 10 | profesional: ProfesionalBaseSchema, 11 | tipoPrestacion: tipoPrestacionSchema, 12 | turno: mongoose.Schema.Types.ObjectId, 13 | organizacion: { 14 | id: mongoose.Schema.Types.ObjectId, 15 | nombre: String 16 | }, 17 | observaciones: String, 18 | idTurnoSuspendido: mongoose.Schema.Types.ObjectId 19 | }); 20 | 21 | // Habilitar plugin de auditoría 22 | PrestacionSolicitudHistorialschema.plugin(AuditPlugin); 23 | -------------------------------------------------------------------------------- /packages/drive/file-descriptor/schemas.ts: -------------------------------------------------------------------------------- 1 | import { Types, Model, model, Document, Schema } from 'mongoose'; 2 | import { AuditPlugin } from '@andes/mongoose-plugin-audit'; 3 | 4 | export interface IFileDescriptor { 5 | adapter?: string; 6 | real_id?: string; 7 | mimetype: string; 8 | originalname: string; 9 | extension: string; 10 | origin?: string; 11 | size?: number; 12 | } 13 | 14 | export interface FileDescriptorDocument extends Document, IFileDescriptor { } 15 | 16 | export const FileDescriptorSchema: Schema = new Schema({ 17 | adapter: String, 18 | real_id: String, 19 | mimetype: String, 20 | extension: String, 21 | originalname: String, 22 | origin: String, 23 | size: Number 24 | }); 25 | 26 | FileDescriptorSchema.plugin(AuditPlugin); 27 | export const FileDescriptorModel: Model = model('AndesDriveMetadata', FileDescriptorSchema, 'AndesDriveMetadata'); 28 | -------------------------------------------------------------------------------- /core/tm/routes/sms.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import { EventCore } from '@andes/event-bus'; 3 | import { sendSms, SmsOptions } from '../../../utils/roboSender/sendSms'; 4 | 5 | const router = express.Router(); 6 | 7 | router.get('/sms', async (req, res, next) => { 8 | const smsOptions: SmsOptions = { 9 | telefono: req.query.telefono, 10 | mensaje: req.query.mensaje 11 | }; 12 | try { 13 | const resultado = await sendSms(smsOptions); 14 | return res.json(resultado); 15 | } catch (error) { 16 | return res.json('1'); 17 | } 18 | }); 19 | 20 | router.post('/notificacion', async (req, res, next) => { 21 | try { 22 | const body = req.body.params; 23 | EventCore.emitAsync(body.evento, body.dto); 24 | return res.json({ resultado: 1 }); 25 | } catch (error) { 26 | return res.json({ resultado: 0 }); 27 | } 28 | }); 29 | 30 | export = router; 31 | -------------------------------------------------------------------------------- /modules/descargas/informe-rup/elementos-rup/autocitado.component.ts: -------------------------------------------------------------------------------- 1 | import { HTMLComponent } from '../../model/html-component.class'; 2 | 3 | export class AutocitadoComponent extends HTMLComponent { 4 | template = ` 5 |
6 |

7 | {{ registro.concepto.term }}: 8 |

9 |
10 |
11 |

Motivo: {{{ valor.motivo }}}

12 |
13 | 14 | `; 15 | constructor(private prestacion, private registro, private params, private depth) { 16 | super(); 17 | } 18 | 19 | async process() { 20 | const datos = this.registro.valor.solicitudPrestacion; 21 | this.data = { 22 | registro: this.registro, 23 | valor: { 24 | motivo: datos.motivo 25 | } 26 | }; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /modules/descargas/informe-rup/elementos-rup/valor-numerico.component.ts: -------------------------------------------------------------------------------- 1 | import { HTMLComponent } from '../../model/html-component.class'; 2 | 3 | export class ValorNumericoComponent extends HTMLComponent { 4 | template = ` 5 |
6 |

7 | {{ registro.concepto.term }} 8 | {{#if registro.esDiagnosticoPrincipal}}(PROCEDIMIENTO / DIAGNÓSTICO PRINCIPAL){{/if}}: 9 | 10 | {{{ registro.valor }}}{{unidad}} 11 | 12 |

13 |
14 | 15 | `; 16 | constructor(private prestacion, private registro, private params, private depth) { 17 | super(); 18 | } 19 | 20 | async process() { 21 | this.data = { 22 | registro: this.registro, 23 | unidad: this.params?.unit 24 | }; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /scripts/core-68.ts: -------------------------------------------------------------------------------- 1 | import { Profesional } from '../core/tm/schemas/profesional'; 2 | 3 | async function run(done) { 4 | let i = 0; 5 | const profesionales = Profesional.find({}).cursor({ batchSize: 100 }); 6 | for await (const profesional of profesionales) { 7 | try { 8 | profesional._createTokens(); 9 | if (i % 100 === 0) { 10 | // eslint-disable-next-line no-console 11 | console.log(i++); 12 | } 13 | await Profesional.update( 14 | { _id: profesional.id }, 15 | { 16 | $set: { 17 | tokens: profesional.tokens 18 | } 19 | } 20 | ); 21 | } catch (e) { 22 | // eslint-disable-next-line no-console 23 | console.error(profesional.id, e); 24 | } 25 | 26 | } 27 | 28 | done(); 29 | } 30 | 31 | export = run; 32 | -------------------------------------------------------------------------------- /core/tm/routes/ocupacion.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import * as ocupacion from '../schemas/ocupacion'; 3 | 4 | import { defaultLimit, maxLimit } from './../../../config'; 5 | 6 | const router = express.Router(); 7 | 8 | router.get('/ocupacion', (req, res, next) => { 9 | 10 | const conditions = {}; 11 | conditions['$or'] = []; 12 | conditions['$or'].push({ codigo: RegExp('^' + req.query.nombre + '$', 'i') }); 13 | conditions['$or'].push({ nombre: RegExp('^.*' + req.query.nombre + '.*$', 'i') }); 14 | const query = ocupacion.model.find(conditions); 15 | const skip = parseInt(req.query.skip || 0, 10); 16 | const limit = Math.min(parseInt(req.query.limit || defaultLimit, 15), maxLimit); 17 | query.skip(skip); 18 | query.limit(limit); 19 | query.exec((err, data) => { 20 | if (err) { 21 | return next(err); 22 | } 23 | res.json(data); 24 | }); 25 | }); 26 | 27 | export = router; 28 | -------------------------------------------------------------------------------- /modules/vacunas/schemas/nomivacEsquema.schema.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | 3 | export const nomivacEsquemaSchema = new mongoose.Schema({ 4 | id: mongoose.Schema.Types.ObjectId, 5 | codigo: { 6 | type: Number, 7 | required: true 8 | }, 9 | nombre: { 10 | type: String, 11 | required: true 12 | }, 13 | vacuna: { 14 | _id: mongoose.Schema.Types.ObjectId, 15 | codigo: Number, 16 | nombre: String, 17 | snomed_conceptId: String 18 | }, 19 | condicion: { 20 | _id: mongoose.Schema.Types.ObjectId, 21 | codigo: Number, 22 | nombre: String 23 | }, 24 | regular: String, 25 | embarazo: String, 26 | habilitado: Boolean 27 | }); 28 | 29 | nomivacEsquemaSchema.index({ 30 | 'vacuna._id': 1, 31 | 'condicion._id': 1 32 | }); 33 | export const nomivacEsquema = mongoose.model('nomivacEsquemas', nomivacEsquemaSchema, 'nomivacEsquemas'); 34 | -------------------------------------------------------------------------------- /core/tm/schemas/modulos.schema.ts: -------------------------------------------------------------------------------- 1 | import { Schema, model } from 'mongoose'; 2 | 3 | export const ModuloSchema = new Schema({ 4 | id: Schema.Types.ObjectId, 5 | nombre: { 6 | type: String, 7 | required: true 8 | }, 9 | descripcion: { 10 | type: String, 11 | required: true 12 | }, 13 | subtitulo: String, 14 | icono: String, 15 | linkAcceso: String, 16 | color: String, 17 | permisos: [String], 18 | activo: { 19 | type: Boolean, 20 | default: true 21 | }, 22 | orden: Number, 23 | submodulos: [ 24 | { 25 | activo: { type: Boolean, default: true }, 26 | nombre: String, 27 | linkAcceso: String, 28 | color: String, 29 | icono: String, 30 | orden: Number, 31 | permisos: [String] 32 | } 33 | ] 34 | 35 | }); 36 | 37 | export const Modulos = model('modulos', ModuloSchema, 'modulos'); 38 | -------------------------------------------------------------------------------- /modules/descargas/model/html-component.class.ts: -------------------------------------------------------------------------------- 1 | import * as fs from 'fs'; 2 | import * as handlebars from 'handlebars'; 3 | import * as path from 'path'; 4 | 5 | 6 | export abstract class HTMLComponent { 7 | public template: string; 8 | public templateUrl: string; 9 | 10 | public data: { [key: string]: any }; 11 | 12 | 13 | async render() { 14 | await this.process(); 15 | const templateHTML = this.getTemplate(); 16 | const template = handlebars.compile(templateHTML); 17 | const html = template(this.data); 18 | return html; 19 | } 20 | 21 | private getTemplate() { 22 | if (this.template) { 23 | return this.template; 24 | } else if (this.templateUrl) { 25 | return fs.readFileSync(path.join(__dirname, this.templateUrl), 'utf8'); 26 | } else { 27 | throw new Error('no template'); 28 | } 29 | } 30 | 31 | public async process() { } 32 | } 33 | -------------------------------------------------------------------------------- /modules/obraSocial/schemas/sumar.ts: -------------------------------------------------------------------------------- 1 | import * as mongoose from 'mongoose'; 2 | import * as configPrivate from './../../../config.private'; 3 | import { Connections } from './../../../connections'; 4 | 5 | const sumarSchema = new mongoose.Schema({ 6 | id_smiafiliados: Number, 7 | clavebeneficiario: String, 8 | afiapellido: String, 9 | afinombre: String, 10 | afitipodoc: String, 11 | aficlasedoc: String, 12 | afidni: String, 13 | afisexo: String, 14 | afidomdepartamento: String, 15 | afidomlocalidad: String, 16 | afitipocategoria: Number, 17 | afifechanac: Date, 18 | activo: String, 19 | cuieefectorasignado: String, 20 | cuielugaratencionhabitual: String, 21 | motivobaja: Number, 22 | mensajebaja: String, 23 | fechainscripcion: Date, 24 | fechacarga: Date, 25 | usuariocarga: String, 26 | embarazoactual: String 27 | }); 28 | 29 | export const sumar: any = mongoose.model('sumar', sumarSchema, 'sumar'); 30 | -------------------------------------------------------------------------------- /scripts/tag-vacunas.ts: -------------------------------------------------------------------------------- 1 | import { Prestacion } from './../modules/rup/schemas/prestacion'; 2 | 3 | async function run(done) { 4 | const parametros = { 5 | 'ejecucion.fecha': { $gt: new Date('2020-12-27T00:00:00.000-03:00') }, 6 | 'estadoActual.tipo': 'validada', 7 | 'ejecucion.registros.concepto.conceptId': '840534001', 8 | 'tags.vacunasCovid': { $exists: false } 9 | }; 10 | 11 | const prestaciones = Prestacion.find(parametros).cursor({ batchSize: 100 }); 12 | let i = 0; 13 | for await (const prestacion of prestaciones) { 14 | i++; 15 | // eslint-disable-next-line no-console 16 | if (i % 100 === 0) { console.log(i); } 17 | 18 | const $set: any = { 19 | tags: { vacunasCovid: true }, 20 | }; 21 | await Prestacion.update( 22 | { _id: prestacion.id }, 23 | { $set } 24 | ); 25 | 26 | } 27 | done(); 28 | } 29 | 30 | export = run; 31 | 32 | -------------------------------------------------------------------------------- /modules/descargas/informe-rup/elementos-rup/seccion/seccionado.component.ts: -------------------------------------------------------------------------------- 1 | import { HTMLComponent } from '../../../model/html-component.class'; 2 | import { registroToHTML } from '../../utils/registro-to-html'; 3 | 4 | export class SeccionadoComponent extends HTMLComponent { 5 | template = ` 6 |
7 | {{#each registros}} 8 | {{{this}}} 9 | {{/each}} 10 |
11 | 12 | `; 13 | constructor(private prestacion, private registro, private params, private depth) { 14 | super(); 15 | } 16 | 17 | async process() { 18 | const ps = this.registro.registros.map(registro => { 19 | return registroToHTML(this.prestacion, registro, this.depth + 1); 20 | }); 21 | const registros = await Promise.all(ps); 22 | 23 | this.data = { 24 | registro: this.registro, 25 | registros, 26 | showTitle: this.depth === 0 27 | }; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /modules/descargas/informe-rup/elementos-rup/observaciones.component.ts: -------------------------------------------------------------------------------- 1 | import { HTMLComponent } from '../../model/html-component.class'; 2 | 3 | export class ObservacionesComponent extends HTMLComponent { 4 | template = ` 5 |
6 |

7 | {{ registro.concepto.term }} 8 | {{#if registro.esDiagnosticoPrincipal}}(PROCEDIMIENTO / DIAGNÓSTICO PRINCIPAL){{/if}} 9 | {{#if registro.valor}}: 10 | 11 | {{{ valor }}} 12 | 13 | {{/if}} 14 |

15 |
16 | `; 17 | constructor(private prestacion, private registro, private params, private depth) { 18 | super(); 19 | } 20 | 21 | async process() { 22 | this.data = { 23 | registro: this.registro, 24 | valor: this.registro.valor 25 | }; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /modules/pacs/pacs-config.controller.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ObjectId, ResourceBase } from '@andes/core'; 2 | import { Auth } from '../../auth/auth.class'; 3 | import { IPacsConfig, PacsConfig } from './pacs-config.schema'; 4 | 5 | export class PacsConfigCtr extends ResourceBase { 6 | Model = PacsConfig; 7 | resourceName = 'pacs-config'; 8 | middlewares = [Auth.authenticate()]; 9 | searchFileds = { 10 | organizacion: MongoQuery.equalMatch.withField('organizacion.id'), 11 | tipoPrestacion: MongoQuery.equalMatch.withField('tipoPrestacion.conceptId') 12 | }; 13 | 14 | async getConfig(organizacion: ObjectId, tipoPrestacion: string): Promise { 15 | const config = await this.findOne({ 16 | organizacion, 17 | tipoPrestacion 18 | }); 19 | return config; 20 | } 21 | } 22 | 23 | export const PacsConfigController = new PacsConfigCtr(); 24 | export const PacsConfigRoutes = PacsConfigController.makeRoutes(); 25 | -------------------------------------------------------------------------------- /modules/descargas/informe-rup/elementos-rup/lugar-nacimiento.componenet.ts: -------------------------------------------------------------------------------- 1 | import { HTMLComponent } from '../../model/html-component.class'; 2 | 3 | export class LugarDeNacimientoComponent extends HTMLComponent { 4 | template = ` 5 |
6 |

7 | {{ titulo }}: 8 | 9 | {{{ valor }}} 10 | 11 |

12 |
13 | 14 | `; 15 | constructor(private prestacion, private registro, private params, private depth) { 16 | super(); 17 | } 18 | 19 | async process() { 20 | this.data = { 21 | titulo: this.registro.concepto.term, 22 | registro: this.registro, 23 | valor: this.getValor() 24 | }; 25 | } 26 | 27 | getValor() { 28 | const valor = this.registro.valor?.nombre || this.registro.valor; 29 | return valor; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /modules/mobileApp/controller/PushClientFCM.ts: -------------------------------------------------------------------------------- 1 | import { services } from '../../../services'; 2 | export interface IPushNotification { 3 | title?: 'Andes Salud' | string; 4 | body: string; 5 | extraData?: any; 6 | } 7 | 8 | export function sendPushNotification(devices, notification: IPushNotification): any { 9 | 10 | const servicio = 'push-notifications-default'; 11 | 12 | for (const device of devices) { 13 | if (device.device_fcm_token) { 14 | const payload = { 15 | title: notification.title || 'Andes Salud', 16 | body: notification.body, 17 | extraData: notification.extraData, 18 | to: device.device_fcm_token, 19 | priority: 'high', 20 | restricted_package_name: '', 21 | time_to_live: 0, 22 | }; 23 | 24 | // Enviar push con llamada HTTP 25 | services.get(servicio).exec(payload); 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /scripts/vac-41.ts: -------------------------------------------------------------------------------- 1 | import { InscripcionVacuna } from '../modules/vacunas/schemas/inscripcion-vacunas.schema'; 2 | 3 | async function run(done) { 4 | let i = 0; 5 | const inscripciones = InscripcionVacuna.find({}).cursor({ batchSize: 100 }); 6 | for await (const inscripcion of inscripciones) { 7 | try { 8 | inscripcion._createTokens(); 9 | if (i % 100 === 0) { 10 | // eslint-disable-next-line no-console 11 | console.log(i++); 12 | } 13 | await InscripcionVacuna.update( 14 | { _id: inscripcion.id }, 15 | { 16 | $set: { 17 | tokens: inscripcion.tokens 18 | } 19 | } 20 | ); 21 | } catch (e) { 22 | // eslint-disable-next-line no-console 23 | console.error(inscripcion.id, e); 24 | } 25 | 26 | } 27 | 28 | done(); 29 | } 30 | 31 | export = run; 32 | -------------------------------------------------------------------------------- /modules/vacunas/nomivacDosis.route.ts: -------------------------------------------------------------------------------- 1 | import { MongoQuery, ResourceBase } from '@andes/core'; 2 | import * as mongoose from 'mongoose'; 3 | import { nomivacDosis } from './schemas/nomivacDosis.schema'; 4 | import { Auth } from '../../auth/auth.class'; 5 | 6 | class NomivacDosisResource extends ResourceBase { 7 | Model = nomivacDosis; 8 | resourceName = 'nomivacDosis'; 9 | middlewares = [Auth.authenticate()]; 10 | searchFileds = { 11 | codigo: MongoQuery.equalMatch, 12 | habilitado: MongoQuery.equalMatch, 13 | nombre: MongoQuery.partialString, 14 | vacuna: { 15 | field: 'vacuna._id', 16 | fn: (value) => mongoose.Types.ObjectId(value) 17 | }, 18 | esquema: { 19 | field: 'esquema._id', 20 | fn: (value) => mongoose.Types.ObjectId(value) 21 | } 22 | }; 23 | } 24 | 25 | export const nomivacDosisCtr = new NomivacDosisResource({}); 26 | export const nomivacDosisRouter = nomivacDosisCtr.makeRoutes(); 27 | -------------------------------------------------------------------------------- /core/tm/routes/procedimientoQuirurgico.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import * as procedimientosQuirurgicos from '../schemas/procedimientoQuirurgico'; 3 | const router = express.Router(); 4 | import { defaultLimit, maxLimit } from './../../../config'; 5 | 6 | router.get('/procemientosQuirurgicos', (req, res, next) => { 7 | const conditions = {}; 8 | conditions['$or'] = []; 9 | conditions['$or'].push({ codigo: RegExp('^' + req.query.nombre + '$', 'i') }); 10 | conditions['$or'].push({ nombre: RegExp('^.*' + req.query.nombre + '.*$', 'i') }); 11 | const query = procedimientosQuirurgicos.model.find(conditions); 12 | const skip = parseInt(req.query.skip || 0, 10); 13 | const limit = Math.min(parseInt(req.query.limit || defaultLimit, 15), maxLimit); 14 | query.skip(skip); 15 | query.limit(limit); 16 | query.exec((err, data) => { 17 | if (err) { 18 | return next(err); 19 | } 20 | res.json(data); 21 | }); 22 | }); 23 | export = router; 24 | -------------------------------------------------------------------------------- /scripts/deleteFoto.ts: -------------------------------------------------------------------------------- 1 | 2 | import { Paciente, PacienteCtr } from '../core-v2/mpi/paciente'; 3 | import { userScheduler } from '../config.private'; 4 | 5 | 6 | // Borra el campo 'foto' de los pacientes 7 | async function run(done) { 8 | const cursor = Paciente.find({ $and: [{ 'relaciones.foto': { $exists: true } }, { 'relaciones.foto': /data:image/ }] }).cursor({ batchSize: 100 }); 9 | const updatePatient = async (pac) => { 10 | try { 11 | const data = { relaciones: pac.relaciones.toObject() }; 12 | data.relaciones.forEach(rel => { 13 | if (rel.foto !== undefined) { 14 | delete rel.foto; 15 | } 16 | }); 17 | await PacienteCtr.update(pac, data, userScheduler as any); 18 | } catch (error) { 19 | return; 20 | } 21 | }; 22 | 23 | await cursor.eachAsync(async (pac: any) => { 24 | await updatePatient(pac); 25 | }); 26 | done(); 27 | } 28 | 29 | export = run; 30 | -------------------------------------------------------------------------------- /templates/laboratorio/laboratorio.scss: -------------------------------------------------------------------------------- 1 | .contenedor-secundario { 2 | display: block; 3 | text-align: center; 4 | font-size: .25cm; 5 | } 6 | 7 | .tabla-header { 8 | border-color: black; 9 | border-collapse: collapse; 10 | font-size: .25cm; 11 | } 12 | 13 | td { 14 | text-align: left; 15 | } 16 | 17 | .tabla-header { 18 | border-color: black; 19 | border-collapse: collapse; 20 | font-size: .20cm; 21 | } 22 | 23 | .tituloGeneral { 24 | text-align: left; 25 | margin-top: 20px; 26 | font-size: .25cm; 27 | } 28 | 29 | .tituloSecundario { 30 | text-align: left; 31 | margin-top: 8px; 32 | font-size: .25cm; 33 | } 34 | 35 | .tituloTabla { 36 | text-align: left; 37 | margin-top: 8px; 38 | margin-left: 20px; 39 | font-size: .25cm; 40 | } 41 | 42 | body { 43 | padding-left: 0.5cm; 44 | padding-right: 0.5cm; 45 | font-family: Arial, sans-serif; 46 | } 47 | 48 | .foot { 49 | font-family: Arial, sans-serif; 50 | font-size: 10px; 51 | } --------------------------------------------------------------------------------