@@ -3,37 +3,37 @@ import { FtpFuncion } from '../../api/core/tm/schemas/ftpFuncion';
33import { FtpGrupoFarmacologico } from '../../api/core/tm/schemas/ftpGrupoFarmacologico' ;
44import { FormularioTerapeutico } from '../../api/core/tm/schemas/formularioTerapeutico' ;
55
6- const baseFarmacias = '../api/scripts/baseFarmacia .json' ;
6+ const baseFarmacologico = '../api/scripts/baseFarmacologico .json' ;
77const fsp = require ( 'fs/promises' ) ;
88
99
1010async function run ( done ) {
1111 try {
1212
13- const dataFarmacia = await fsp . readFile ( baseFarmacias , { encoding : 'utf8' } ) ;
13+ const dataFarmacia = await fsp . readFile ( baseFarmacologico , { encoding : 'utf8' } ) ;
1414 const dataFarmaciaArray = JSON . parse ( dataFarmacia ) as any [ ] ;
1515
1616 for ( const item of dataFarmaciaArray ) {
17- let sistema = await FtpSistema . findOne ( { nombre : item . sistema } ) ;
18- if ( ! sistema ) {
19- sistema = await FtpSistema . create ( { nombre : item . sistema } ) ;
17+ let ftpSistema = await FtpSistema . findOne ( { nombre : item . sistema } ) ;
18+ if ( ! ftpSistema ) {
19+ ftpSistema = await FtpSistema . create ( { nombre : item . sistema } ) ;
2020 }
2121
22- let funcion = await FtpFuncion . findOne ( { nombre : item . funcion } ) ;
23- if ( ! funcion ) {
24- funcion = await FtpFuncion . create ( { nombre : item . funcion } ) ;
22+ let ftpFuncion = await FtpFuncion . findOne ( { nombre : item . funcion } ) ;
23+ if ( ! ftpFuncion ) {
24+ ftpFuncion = await FtpFuncion . create ( { nombre : item . funcion } ) ;
2525 }
2626
27- let grupo = await FtpGrupoFarmacologico . findOne ( { nombre : item . grupoFarmacologico } ) ;
28- if ( ! grupo ) {
29- grupo = await FtpGrupoFarmacologico . create ( { nombre : item . grupoFarmacologico } ) ;
27+ let ftpGrupoFarmacologico = await FtpGrupoFarmacologico . findOne ( { nombre : item . grupoFarmacologico } ) ;
28+ if ( ! ftpGrupoFarmacologico ) {
29+ ftpGrupoFarmacologico = await FtpGrupoFarmacologico . create ( { nombre : item . grupoFarmacologico } ) ;
3030 }
3131
3232 // Crear el formulario terapéutico
3333 await FormularioTerapeutico . create ( {
34- sistema : sistema . toObject ( ) ,
35- funcion : funcion . toObject ( ) ,
36- grupoFarmacologico : grupo . toObject ( ) . nombre ? grupo . toObject ( ) : null ,
34+ ftpSistema : ftpSistema . toObject ( ) ,
35+ ftpFuncion : ftpFuncion . toObject ( ) ,
36+ ftpGrupoFarmacologico : ftpGrupoFarmacologico . toObject ( ) . nombre ? ftpGrupoFarmacologico . toObject ( ) : null ,
3737 nivelComplejidad : item . nivelComplejidad ,
3838 especialidad : item . especialidad ,
3939 requisitos : item . requisitos ,
0 commit comments