You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
318 lines
28 KiB
JavaScript
318 lines
28 KiB
JavaScript
// Read Excel file and copy the relevant columns to the main table (with proper column types and names)
|
|
//
|
|
// Proper Naming
|
|
/** @typedef {{name: string, province: string, ccaa: string, city: string,}} Client */
|
|
|
|
/** @type { Object.<string, Client> } */
|
|
|
|
/** @type {Object.<string,{ name: string, province: string, ccaa: string, city: string}>} */
|
|
const clientCodeInfo = {
|
|
"AAA": { name: "Hospital Son Espases", province: "Baleares", ccaa: "Islas Baleares", city: "Palma", },
|
|
"BBB": { name: "Hospital Sant Joan Reus", province: "Tarragona", ccaa: "Cataluña", city: "Reus", },
|
|
"CCC": { name: "Hospital Universitario Germans Trías y Pujol", province: "Barcelona", ccaa: "Cataluña", city: "Badalona", },
|
|
"DDD": { name: "Hospital San Camilo", province: "Barcelona", ccaa: "Cataluña", city: "Sant Pere de Ribes", },
|
|
"EEE": { name: "Hospital de Mataró", province: "Barcelona", ccaa: "Cataluña", city: "Mataró", },
|
|
"FFF": { name: "Departamento de Sanidad de Vizcaya", province: "Vizcaya", ccaa: "País Vasco", city: "Bilbao", },
|
|
"GGG": { name: "Hospital Santa Cruz y San Pablo", province: "Barcelona", ccaa: "Cataluña", city: "Barcelona", },
|
|
"III": { name: "Consejería de Sanidad Madrid - Suministro de Medicamentos Extranjeros", province: "Madrid", ccaa: "Madrid", city: "Madrid", },
|
|
"JJJ": { name: "Hospital Santa Caterina", province: "Gerona", ccaa: "Cataluña", city: "Salt", },
|
|
"KKK": { name: "Hospital Universitario Vírgen del Rocío", province: "Sevilla", ccaa: "Andalucía", city: "Sevilla", },
|
|
"70000": { name: "Hospital General Universitario de Elche", province: "Alicante", ccaa: "Comunitat Valenciana", city: "Elche", },
|
|
"70001": { name: "Hospital Universitario de San Juan de Alicante", province: "Alicante", ccaa: "Comunitat Valenciana", city: "Alicante", },
|
|
"70002": { name: "Hospital Universitario de Valme", province: "Sevilla", ccaa: "Andalucía", city: "Sevilla", },
|
|
"70003": { name: "Institut Catala de Salut", province: "Barcelona", ccaa: "Cataluña", city: "Barcelona", },
|
|
"70004": { name: "Servicio Andaluz de Salud", province: "Sevilla", ccaa: "Andalucía", city: "Sevilla", },
|
|
"70005": { name: "Servei Balear de Salut", province: "Baleares", ccaa: "Islas Baleares", city: "Palma", },
|
|
"70006": { name: "Sección Suministro de Medicamentos Extranjeros de Madrid", province: "Madrid", ccaa: "Madrid", city: "Madrid", },
|
|
"70007": { name: "Area de Gestión Almería Norte (Hospital Inmaculada)", province: "Almería", ccaa: "Andalucía", city: "Almería", },
|
|
"70008": { name: "Consejería de Salud de La Rioja", province: "La Rioja", ccaa: "La Rioja", city: "Logroño", },
|
|
"70009": { name: "Servicio Murciano de Salud", province: "Murcia", ccaa: "Murcia", city: "Murcia", },
|
|
"70010": { name: "Servicios Periféricos de Sanidad y Asuntos Sociales Albacete", province: "Albacete", ccaa: "Castilla-La Mancha", city: "Albacete", },
|
|
"70011": { name: "Jefatura Territorial de Sanidad de Pontevedra", province: "Pontevedra", ccaa: "Galicia", city: "Pontevedra", },
|
|
"70012": { name: "Departamento de Sanidad de Guipuzcoa", province: "Guipúzcoa", ccaa: "País Vasco", city: "San Sebastián", },
|
|
"70013": { name: "Hospital Clínico San Carlos", province: "Madrid", ccaa: "Madrid", city: "Madrid", },
|
|
"70014": { name: "Agencia Sanitaria Costa del Sol", province: "Málaga", ccaa: "Andalucía", city: "Marbella", },
|
|
"70015": { name: "Consorcio Hospital General Universitario de Valencia", province: "Valencia", ccaa: "Comunidad Valenciana", city: "Valencia", },
|
|
"70016": { name: "Hospital Luis Alcañiz de Xátiva", province: "Valencia", ccaa: "Comunidad Valenciana", city: "Xàtiva", },
|
|
"70017": { name: "Hospital Materno Infantil Vall d'Hebron", province: "Barcelona", ccaa: "Cataluña", city: "Barcelona", },
|
|
"70018": { name: "Hospital Sant Joan de Reus", province: "Tarragona", ccaa: "Cataluña", city: "Reus", },
|
|
"70019": { name: "Institut d'Assistencia Sanitaria - Hospital Santa Caterina", province: "Gerona", ccaa: "Cataluña", city: "Salt", },
|
|
"70020": { name: "Corporación Sanitaria Parc Tauli", province: "Barcelona", ccaa: "Cataluña", city: "Sabadell", },
|
|
"70021": { name: "Hospital Can Misses", province: "Baleares", ccaa: "Islas Baleares", city: "Ibiza", },
|
|
"70022": { name: "Hospital Universitario Insular de Gran Canaria", province: "Las Palmas", ccaa: "Canarias", city: "Las Palmas de Gran Canaria", },
|
|
"70023": { name: "Delegación Territorial de Salud de Bizkaia", province: "Vizcaya", ccaa: "País Vasco", city: "Bilbao", },
|
|
"70024": { name: "Fundación Sant Hospital - Seo Urgel", province: "Lérida", ccaa: "Cataluña", city: "La Seu d'Urgell", },
|
|
"70025": { name: "Distrito Sanitario Jerez-Costa Norte", province: "Cádiz", ccaa: "Andalucía", city: "Jerez de la Frontera", },
|
|
"70026": { name: "Consorcio Sanitario del Maresme", province: "Barcelona", ccaa: "Cataluña", city: "Mataró", },
|
|
"70027": { name: "Consorcio Sanitario del Garraf", province: "Barcelona", ccaa: "Cataluña", city: "Vilanova i la Geltrú", },
|
|
"70028": { name: "Hospital Son Llatzer", province: "Baleares", ccaa: "Islas Baleares", city: "Palma", },
|
|
"70029": { name: "Consorcio Mar Parc de Salut (Hospital del Mar)", province: "Barcelona", ccaa: "Cataluña", city: "Barcelona", },
|
|
"70030": { name: "Hospital de la Ribera", province: "Valencia", ccaa: "Comunidad Valenciana", city: "Alzira", },
|
|
"70031": { name: "Hospital Severo Ochoa de Leganés", province: "Madrid", ccaa: "Madrid", city: "Leganés", },
|
|
"70032": { name: "Area de Gestión Sanitaria Sur de Granada", province: "Granada", ccaa: "Andalucía", city: "Motril", },
|
|
"70033": { name: "Hospital Universitario de Bellvitge", province: "Barcelona", ccaa: "Cataluña", city: "L'Hospitalet de Llobregat", },
|
|
"70034": { name: "Hospital General Vall d'Hebron", province: "Barcelona", ccaa: "Cataluña", city: "Barcelona", },
|
|
"70035": { name: "Distrito Sanitario de Granada - Metropolitano", province: "Granada", ccaa: "Andalucía", city: "Granada", },
|
|
"70036": { name: "Fundación Hospital Asilo de Granollers", province: "Barcelona", ccaa: "Cataluña", city: "Granollers", },
|
|
"70037": { name: "Hospital General de Requena", province: "Valencia", ccaa: "Comunidad Valenciana", city: "Requena", },
|
|
"70038": { name: "Fundación Asistencial Mutua Terrasa", province: "Barcelona", ccaa: "Cataluña", city: "Terrasa", },
|
|
"70039": { name: "Althaia Xarxa Assistencial Universitaria Manresa", province: "Barcelona", ccaa: "Cataluña", city: "Manresa", },
|
|
"70040": { name: "Hospital Universitario San Cecilio de Granada", province: "Granada", ccaa: "Andalucía", city: "Granada", },
|
|
"70041": { name: "Hospital Universitario La Fé", province: "Valencia", ccaa: "Comunidad Valenciana", city: "Valencia", },
|
|
"70042": { name: "Consorcio Sanitario de Terrasa", province: "Barcelona", ccaa: "Cataluña", city: "Terrasa", },
|
|
"70043": { name: "Delegación Provincial de Sanidad de Orense", province: "Orense", ccaa: "Galicia", city: "Orense", },
|
|
"70044": { name: "Hospital Clínico Universitario Virgen de la Victoria", province: "Málaga", ccaa: "Andalucía", city: "Málaga", },
|
|
"70045": { name: "Plataforma Logística Sanitaria Almería", province: "Almería", ccaa: "Andalucía", city: "Almería", },
|
|
"70046": { name: "Hospital General Universitario de Alicante", province: "Alicante", ccaa: "Comunidad Valenciana", city: "Alicante", },
|
|
"70047": { name: "Fundación de Gestión Sanitaria de L'Hospitalet", province: "Barcelona", ccaa: "Cataluña", city: "L'Hospitalet de Llobregat", },
|
|
"70048": { name: "Hospital Universitario Virgen de la Macarena", province: "Sevilla", ccaa: "Andalucía", city: "Sevilla", },
|
|
"70049": { name: "Hospital Marina Baixa", province: "Alicante", ccaa: "Comunidad Valenciana", city: "Villajoyosa", },
|
|
"70050": { name: "Gerencia de Salud de Área de Ávila", province: "Ávila", ccaa: "Castilla y León", city: "Ávila", },
|
|
"70055": { name: "Consorcio Hospitalario de Vic", province: "Barcelona", ccaa: "Cataluña", city: "Vic", },
|
|
"70060": { name: "Servicio Canario de Salud", province: "Santa Cruz de Tenerife", ccaa: "Canarias", city: "Santa Cruz de Tenerife", },
|
|
"70061": { name: "Distrito Sanitario Costa del Sol - Hospital Costa del Sol", province: "Málaga", ccaa: "Andalucía", city: "Marbella", },
|
|
"70062": { name: "Hospital de Manises de Valencia", province: "Valencia", ccaa: "Comunidad Valenciana", city: "Manises", },
|
|
"70063": { name: "Hospital Clínico de Barcelona", province: "Barcelona", ccaa: "Cataluña", city: "Barcelona", },
|
|
"70064": { name: "Hospital Comarcal de Sant Bernabé", province: "Barcelona", ccaa: "Cataluña", city: "Berga", },
|
|
"70065": { name: "Fundacio Salut Emporda", province: "Gerona", ccaa: "Cataluña", city: "Figueras", },
|
|
"70070": { name: "Hospital Materno Infantil de Málaga", province: "Málaga", ccaa: "Andalucía", city: "Málaga", },
|
|
"70071": { name: "Hospital San Francisco de Borja", province: "Valencia", ccaa: "Comunidad Valenciana", city: "Gandía", },
|
|
"70072": { name: "Hospital Sant Joan de Deu", province: "Barcelona", ccaa: "Cataluña", city: "Esplugues de Llobregat", },
|
|
"70073": { name: "Hospital Universitario Dr. Peset", province: "Valencia", ccaa: "Comunidad Valenciana", city: "Valencia", },
|
|
"70074": { name: "Hospital Vega Baja de Orihuela", province: "Alicante", ccaa: "Comunidad Valenciana", city: "Orihuela", },
|
|
"70075": { name: "Hospital de Denia - Marina Salud", province: "Alicante", ccaa: "Comunidad Valenciana", city: "Denia", },
|
|
"70076": { name: "Hospital Regional Carlos Haya", province: "Málaga", ccaa: "Andalucía", city: "Málaga", },
|
|
"70077": { name: "Hospital de Manacor", province: "Baleares", ccaa: "Islas Baleares", city: "Manacor", },
|
|
"70080": { name: "Delegación Provincial de Salud de Albacete - Hospital General", province: "Albacete", ccaa: "Castilla-La Mancha", city: "Albacete", },
|
|
"70081": { name: "Hospital Universitario Arnau de Vilanova", province: "Lérida", ccaa: "Cataluña", city: "Lérida", },
|
|
"70082": { name: "Osakidetza", province: "Álava", ccaa: "País Vasco", city: "Vitoria-Gasteiz", },
|
|
"70083": { name: "Hospital Mateu Órfila", province: "Baleares", ccaa: "Islas Baleares", city: "Mahón", },
|
|
"70085": { name: "Hospital General Básico de la Axarquía", province: "Málaga", ccaa: "Andalucía", city: "Vélez-Málaga", },
|
|
"70090": { name: "Servicio Territorial de Sanidad y Bienestar Social de Burgos", province: "Burgos", ccaa: "Castilla y León", city: "Burgos", },
|
|
"70091": { name: "Servicio Territorial de Sanidad y Bienestar Social de Valladolid", province: "Valladolid", ccaa: "Castilla y León", city: "Valladolid", },
|
|
"70095": { name: "Hospital General de La Línea", province: "Cádiz", ccaa: "Andalucía", city: "La Línea de la Concepción", },
|
|
"70100": { name: "Hospital Universitario Puerta de Hierro", province: "Madrid", ccaa: "Madrid", city: "Majadahonda", },
|
|
"70101": { name: "Hospital General Universitario de Elda", province: "Alicante", ccaa: "Comunidad Valenciana", city: "Elda", },
|
|
"70102": { name: "Consorci Sanitari Integral de Hospitalet", province: "Barcelona", ccaa: "Cataluña", city: "L'Hospitalet de Llobregat", },
|
|
"70103": { name: "Hospital Universitario Dr. Negrín", province: "Las Palmas", ccaa: "Canarias", city: "Las Palmas de Gran Canaria", },
|
|
"70105": { name: "Hospital de Navarra", province: "Navarra", ccaa: "Navarra", city: "Pamplona", },
|
|
"70106": { name: "Hospital Juan XXIII", province: "Tarragona", ccaa: "Cataluña", city: "Tarragona", },
|
|
"70107": { name: "Hospital Arnau de Vilanova en Lliria", province: "Valencia", ccaa: "Comunidad Valenciana", city: "Valencia", },
|
|
"70110": { name: "Hospital Universitario Central de Asturias", province: "Asturias", ccaa: "Asturias", city: "Oviedo", },
|
|
"70115": { name: "Gerencia de Salud de Área de Valladolid", province: "Valladolid", ccaa: "Castilla y León", city: "Valladolid", },
|
|
"70116": { name: "Consejería de Sanidad Universal y Salud Pública de C. Valenciana", province: "Valencia", ccaa: "Comunidad Valenciana", city: "Valencia", },
|
|
"70120": { name: "Dirección Provincial de Sanidad de Ciudad Real", province: "Ciudad Real", ccaa: "Castilla-La Mancha", city: "Ciudad Real", },
|
|
"70125": { name: "Hospital Txagorritxu de Vitoria", province: "Álava", ccaa: "País Vasco", city: "Vitoria-Gasteiz", },
|
|
"70130": { name: "Hospital Comarcal de Vinaroz", province: "Castellón", ccaa: "Comunidad Valenciana", city: "Vinaroz", },
|
|
"70135": { name: "Distrito Sanitario Metropolitano de Granada", province: "Granada", ccaa: "Andalucía", city: "Granada", },
|
|
"70140": { name: "Hospital General Obispo Polanco", province: "Teruel", ccaa: "Aragón", city: "Teruel", },
|
|
"70141": { name: "Hospital Universitario de Torrevieja (antiguo Torrevieja Salud UTE)", province: "Alicante", ccaa: "Comunidad Valenciana", city: "Torrevieja", },
|
|
"70142": { name: "Hospital General Universitario Gregorio Marañón", province: "Madrid", ccaa: "Madrid", city: "Madrid", },
|
|
"70145": { name: "Hospital Universitario La Paz", province: "Madrid", ccaa: "Madrid", city: "Madrid", },
|
|
"70146": { name: "Dirección Territorial Sanidad de Álava", province: "Álava", ccaa: "País Vasco", city: "Vitoria-Gasteiz", },
|
|
"70147": { name: "SERGAS", province: "La Coruña", ccaa: "Galicia", city: "Santiago de Compostela", },
|
|
"70148": { name: "Hospital General La Mancha-Centro", province: "Ciudad Real", ccaa: "Castilla-La Mancha", city: "Alcázar de San Juán", },
|
|
"70150": { name: "Complejo Universitario Asistencial de Salamanca", province: "Salamanca", ccaa: "Castilla y León", city: "Salamanca", },
|
|
"70151": { name: "Hospital Dos de Mayo", province: "Barcelona", ccaa: "Cataluña", city: "Barcelona", },
|
|
"70155": { name: "Hospital de Basurto", province: "Vizcaya", ccaa: "País Vasco", city: "Bilbao", },
|
|
"70156": { name: "Delegación Provincial de Salud de Toledo", province: "Toledo", ccaa: "Castilla-La Mancha", city: "Toledo", },
|
|
"70160": { name: "Distrito Sanitario Bahía de Cádiz - Lajanda", province: "Cádiz", ccaa: "Andalucía", city: "Cádiz", },
|
|
"70165": { name: "Gerencia del Área de Salud de Plasencia", province: "Cáceres", ccaa: "Extremadura", city: "Plasencia", },
|
|
"70166": { name: "Hospital Infanta Elena de Huelva", province: "Huelva", ccaa: "Andalucía", city: "Huelva", },
|
|
"70170": { name: "Servicio Territorial de Sanidad y Bienestar Social de Soria", province: "Soria", ccaa: "Castilla y León", city: "Soria", },
|
|
"70171": { name: "Gerencia de Asistencia Sanitaria de Soria", province: "Soria", ccaa: "Castilla y León", city: "Soria", },
|
|
"70172": { name: "Gerencia de Salud de Área de Burgos", province: "Burgos", ccaa: "Castilla y León", city: "Burgos", },
|
|
"70175": { name: "Hospital Santa Ana de Motril", province: "Granada", ccaa: "Andalucía", city: "Motril", },
|
|
"70180": { name: "Atención Primaria de Campo de Gibraltar", province: "Cádiz", ccaa: "Andalucía", city: "Algeciras", },
|
|
"70181": { name: "Hospital General de Fuerteventura", province: "Las Palmas", ccaa: "Canarias", city: "Puerto del Rosario", },
|
|
"70182": { name: "Hospital Clínico Universitario de Santiago de Compostela", province: "La Coruña", ccaa: "Galicia", city: "Santiago de Compostela", },
|
|
"70183": { name: "Elche Crevillente Salud", province: "Alicante", ccaa: "Comunidad Valenciana", city: "Elche", },
|
|
"70185": { name: "Hospital Universitario 12 de Octubre", province: "Madrid", ccaa: "Madrid", city: "Madrid", },
|
|
"70186": { name: "Hospital Clínico Universitario de Valencia", province: "Valencia", ccaa: "Comunidad Valenciana", city: "Valencia", },
|
|
"70187": { name: "Hospital San Pablo y Santa Tecla", province: "Tarragona", ccaa: "Cataluña", city: "Tarragona", },
|
|
"70188": { name: "Fundación Sanitaria de Mollet", province: "Barcelona", ccaa: "Cataluña", city: "Mollet del Vallés", },
|
|
"70189": { name: "Plataforma Provincial de Logística Sanitaria de Jaén", province: "Jaén", ccaa: "Andalucía", city: "Jaén", },
|
|
"70190": { name: "Hospital General Universitario Reina Sofía de Murcia", province: "Murcia", ccaa: "Murcia", city: "Murcia", },
|
|
"70195": { name: "Hospital Dr. Josep Trueta", province: "Gerona", ccaa: "Cataluña", city: "Gerona", },
|
|
"70200": { name: "Hospital de Sant Celoni", province: "Barcelona", ccaa: "Cataluña", city: "Sant Celoni", },
|
|
"70201": { name: "Gerencia de Asistencia Sanitaria de Zamora", province: "Zamora", ccaa: "Castilla y León", city: "Zamora", },
|
|
"70202": { name: "Servicio Territorial de Sanidad y Bienestar Social de Zamora", province: "Zamora", ccaa: "Castilla y León", city: "Zamora", },
|
|
"70203": { name: "Hospital La Maternidad y San Ramón", province: "Barcelona", ccaa: "Cataluña", city: "Barcelona", },
|
|
"70204": { name: "Hospital de Baza", province: "Granada", ccaa: "Andalucía", city: "Baza", },
|
|
"70205": { name: "Hospital Clínico Universitario Lozano Blesa", province: "Zaragoza", ccaa: "Aragón", city: "Zaragoza", },
|
|
"70206": { name: "Clínica ORL de Dos Hermanas", province: "Sevilla", ccaa: "Andalucía", city: "Dos Hermanas", },
|
|
"70210": { name: "Corporación de Salut del Maresme", province: "Gerona", ccaa: "Cataluña", city: "Blanes", },
|
|
"70211": { name: "Centro Penitenciario Madrid V - Soto del Real", province: "Madrid", ccaa: "Madrid", city: "Soto del Real", },
|
|
"70212": { name: "Hospital Central de la Defensa de Madrid", province: "Madrid", ccaa: "Madrid", city: "Madrid", },
|
|
"70213": { name: "Distrito Córdoba - Centro Sanitario Carlos Castilla del Pino", province: "Córdoba", ccaa: "Andalucía", city: "Córdoba", },
|
|
"70215": { name: "Hospital General de Ciudad Real", province: "Ciudad Real", ccaa: "Castilla-La Mancha", city: "Ciudad Real", },
|
|
"70220": { name: "Dirección General de Farmacia de Las Palmas", province: "Las Palmas", ccaa: "Canarias", city: "Las Palmas de Gran Canaria", },
|
|
"70225": { name: "Hospital Nuestra Señora de Sonsoles", province: "Ávila", ccaa: "Castilla y León", city: "Ávila", },
|
|
"70230": { name: "Hospital General de Tomelloso", province: "Ciudad Real", ccaa: "Castilla-La Mancha", city: "Tomelloso", },
|
|
"70235": { name: "Hospital Gutiérrez Ortega - Valdepeñas", province: "Ciudad Real", ccaa: "Castilla-La Mancha", city: "Valdepeñas", },
|
|
"70236": { name: "Atención Primaria Dpto. 4 - Sagunto", province: "Valencia", ccaa: "Comunidad Valenciana", city: "Sagunto", },
|
|
"70237": { name: "Distrito Sanitario Málaga Guadalhorce", province: "Málaga", ccaa: "Andalucía", city: "Málaga", },
|
|
"70240": { name: "Hospital Universitario Marqués de Valdecilla", province: "Cantabria", ccaa: "Cantabria", city: "Santander", },
|
|
"70241": { name: "Servicio Integral de Sanidad S.L. (Clínica Juaneda)", province: "Baleares", ccaa: "Islas Baleares", city: "Palma de Mallorca", },
|
|
"70242": { name: "Hospital de Tortosa - Virgen de la Cinta", province: "Tarragona", ccaa: "Cataluña", city: "Tortosa", },
|
|
"70245": { name: "Hospital Municipal de Badalona", province: "Barcelona", ccaa: "Cataluña", city: "Badalona", },
|
|
"70250": { name: "Atención Primaria V - Gijón", province: "Asturias", ccaa: "Asturias", city: "Gijón", },
|
|
"70255": { name: "Servicio Territorial de Sanidad y Bienestar Social de Palencia", province: "Palencia", ccaa: "Castilla y León", city: "Palencia", },
|
|
"70256": { name: "Gerencia de Salud de Área de Palencia", province: "Palencia", ccaa: "Castilla y León", city: "Palencia", },
|
|
"70260": { name: "Hospital Doctor José Molina Orosa", province: "Las Palmas", ccaa: "Canarias", city: "Arrecife", },
|
|
"70261": { name: "Hospital Virgen de la Luz", province: "Cuenca", ccaa: "Castilla-La Mancha", city: "Cuenca", },
|
|
"70262": { name: "Servico Aragónes de Salud", province: "Zaragoza", ccaa: "Aragón", city: "Zaragoza", },
|
|
"70265": { name: "Servicio Navarro de Salud", province: "Navarra", ccaa: "Navarra", city: "Pamplona", },
|
|
"70266": { name: "Atención Primaria IV - Oviedo", province: "Asturias", ccaa: "Asturias", city: "Oviedo", },
|
|
"70267": { name: "Departamento de Economía y Hacienda de la Generalitat de Cataluña", province: "Barcelona", ccaa: "Cataluña", city: "Barcelona", },
|
|
"70268": { name: "Delegación Provincial de Sanidad de Cuenca", province: "Cuenca", ccaa: "Castilla-La Mancha", city: "Cuenca", },
|
|
"70270": { name: "Centro Penitenciario Madrid IV - Navalcarnero", province: "Madrid", ccaa: "Madrid", city: "Navalcarnero", },
|
|
"70271": { name: "Hospital Universitario Fundación Alcorcón", province: "Madrid", ccaa: "Madrid", city: "Alcorcón", },
|
|
"70275": { name: "Centro Penitenciario Castellón II", province: "Castellón", ccaa: "Comunidad Valenciana", city: "Albocácer", },
|
|
"70276": { name: "IDCQ Hospitales y Sanidad S.L.U. - Marbella", province: "Málaga", ccaa: "Andalucía", city: "Marbella", },
|
|
"70277": { name: "Xerencia de Gestión Integral A Coruña", province: "La Coruña", ccaa: "Galicia", city: "La Coruña", },
|
|
"70280": { name: "Hospital Reina Sofía - Tudela", province: "Navarra", ccaa: "Navarra", city: "Tudela", },
|
|
"70285": { name: "Servicio Murciano de Salud - Área Virgen del Castillo", province: "Murcia", ccaa: "Murcia", city: "Yecla", },
|
|
"70290": { name: "Distrito Jaén Norte - Linares", province: "Jaén", ccaa: "Andalucía", city: "Linares", },
|
|
"70291": { name: "Hospital Virgen de Altagracia", province: "Ciudad Real", ccaa: "Castilla-La Mancha", city: "Manzanares", },
|
|
"70295": { name: "Hospital Médico Quirúrgio de Jaén", province: "Jaén", ccaa: "Andalucía", city: "Jaén", },
|
|
"70296": { name: "Hospital San Pedro de Logroño", province: "La Rioja", ccaa: "La Rioja", city: "Logroño", },
|
|
"70297": { name: "Hospital Santiago Apostol de Vitoria", province: "Álava", ccaa: "País Vasco", city: "Vitoria-Gasteiz", },
|
|
"70298": { name: "Hospital Vithas Xanit Internacional de Benalmádena", province: "Málaga", ccaa: "Andalucía", city: "Benalmádena", },
|
|
"70300": { name: "Hospital Rafael Méndez - Lorca", province: "Murcia", ccaa: "Murcia", city: "Lorca", },
|
|
"70305": { name: "Agencia Sanitaria Hospital de Poniente", province: "Almería", ccaa: "Andalucía", city: "El Ejido", },
|
|
"70310": { name: "Gerencia Área de Salud de Cáceres", province: "Cáceres", ccaa: "Extremadura", city: "Cáceres", },
|
|
"70311": { name: "Hospital de Palamós", province: "Gerona", ccaa: "Cataluña", city: "Palamós", },
|
|
"70315": { name: "Hospital Fundación Jiménez Díaz", province: "Madrid", ccaa: "Madrid", city: "Madrid", },
|
|
"70320": { name: "Distrito Sanitario Sierra de Cádiz", province: "Cádiz", ccaa: "Andalucía", city: "Villamartín", },
|
|
"70321": { name: "Hospital Alto Deba", province: "Guipúzcoa", ccaa: "Pais Vasco", city: "Arrasate", },
|
|
"70322": { name: "Dirección Provincial de la Consejería de Asuntos Sociales de Guadalajara", province: "Guadalajara", ccaa: "Castilla-La Mancha", city: "Guadalajara", },
|
|
"70323": { name: "Fundación Hospital d'Olot i la Garrotxa", province: "Gerona", ccaa: "Cataluña", city: "Olot", },
|
|
"70324": { name: "Hospital Nuestra Señora del Prado de Talavera", province: "Toledo", ccaa: "Castilla-La Mancha", city: "Talavera de la Reina", },
|
|
"70330": { name: "Clínica Benidorm", province: "Alicante", ccaa: "Comunidad Valenciana", city: "Benidorm", },
|
|
"70337": { name: "Hospital Público General de Almansa - SESCAM", province: "Albacete", ccaa: "Castilla-La Mancha", city: "Almansa", },
|
|
"70366": { name: "Consejería de Sanidad - Servicios de Farmacia - CVA", province: "Alicante", ccaa: "Comunidad Valenciana", city: "Alcoy", },
|
|
"70375": { name: "Hospital García Orcoyen", province: "Navarra", ccaa: "Navarra", city: "Estella", },
|
|
"70385": { name: "Hospital San Jorge de Huesca", province: "Huesca", ccaa: "Aragón", city: "Huesca", },
|
|
"70395": { name: "Área de Gestión Sanitaria Norte Huelva - Hospital Rio Tinto", province: "Huelva", ccaa: "Andalucía", city: "Riotinto", },
|
|
"70400": { name: "Hospital Infanta Cristina", province: "Madrid", ccaa: "Madrid", city: "Parla", },
|
|
"70415": { name: "Servicio Murciano de Salud", province: "Murcia", ccaa: "Murcia", city: "Murcia", },
|
|
"70436": { name: "Servicio Territorial de Sanidad y Bienestar Social de Ávila", province: "Ávila", ccaa: "Castilla y León", city: "Ávila", },
|
|
"70437": { name: "EST ORG XES INT Vigo", province: "Pontevedra", ccaa: "Galicia", city: "Vigo", },
|
|
"70466": { name: "Instituto Catalán de Oncología", province: "Barcelona", ccaa: "Cataluña", city: "L'Hospitalet de Llobregat", },
|
|
"70480": { name: "Fundación Sanitaria Igualada", province: "Barcelona", ccaa: "Cataluña", city: "Igualada", },
|
|
"70491": { name: "Hospital Infantil Universitario Niño Jesús", province: "Madrid", ccaa: "Madrid", city: "Madrid", },
|
|
"70492": { name: "Servicio Territorial de Sanidad y Bienestar Social de Salamanca", province: "Salamanca", ccaa: "Castilla y León", city: "Salamanca", },
|
|
"70494": { name: "Hospital Sant Joan Despí Moisés Broggi", province: "Barcelona", ccaa: "Cataluña", city: "Sant Joan Despí", },
|
|
"70495": { name: "Hospital Comarcal de Melilla", province: "Melilla", ccaa: "Melilla", city: "Melilla", },
|
|
"70501": { name: "Hospital de la Plana de Vila-Real", province: "Castellón", ccaa: "Comunidad Valenciana", city: "Villareal", },
|
|
"70525": { name: "Hospital Universitario de Fuenlabrada", province: "Madrid", ccaa: "Madrid", city: "Fuenlabrada", },
|
|
"70535": { name: "Consorci Sanitari de l'Alt Penedés i Garraf", province: "Barcelona", ccaa: "Cataluña", city: "Villafranca del Penedés", },
|
|
"70540": { name: "Parc Sanitari Sant Joan de Deu", province: "Barcelona", ccaa: "Cataluña", city: "Sant Boi de Llobregat", },
|
|
"70545": { name: "Hospital de Torrejón", province: "Madrid", ccaa: "Madrid", city: "Torrejón de Ardoz", },
|
|
"70550": { name: "Consorci Sanitari de l'Alt Penedés", province: "Barcelona", ccaa: "Cataluña", city: "Villafranca del Penedés", },
|
|
"70555": { name: "Servicio Territorial de Sanidad y Bienestar Social de León", province: "León", ccaa: "Castilla y León", city: "León", },
|
|
"70560": { name: "Distrito Sanitario de Sevilla - Quiñones", province: "Sevilla", ccaa: "Andalucía", city: "Sevilla", },
|
|
"70561": { name: "IDCSalud Móstoles", province: "Madrid", ccaa: "Madrid", city: "Móstoles", },
|
|
"70565": { name: "EDP Salut Sant Joan de Reus - Baix Camp", province: "Tarragona", ccaa: "Cataluña", city: "Reus", }
|
|
}
|
|
// CONSTANTS
|
|
|
|
const ORIGIN_TABLE_NAME = "raw_data";
|
|
const ORIGIN_VIEW_NAME = "Default View";
|
|
|
|
const TARGET_TABLE_NAME = "Abarax España"
|
|
const TARGET_VIEW_NAME = "Default View";
|
|
|
|
|
|
// Helper functions
|
|
|
|
const cleanTable = (name) => { // Removes all rows from a table
|
|
const table = base.getTableByName(name);
|
|
if (table) {
|
|
const rows = base.getRows(table, "Default View");
|
|
rows.forEach(row => {
|
|
base.deleteRowById(table, row._id)
|
|
})
|
|
|
|
}
|
|
}
|
|
|
|
const ccToName = (code) => { // Normalizes info according to client code
|
|
const clientCode = code.toString();
|
|
if (clientCodeInfo[clientCode]) {
|
|
return {
|
|
name: clientCodeInfo[clientCode].name,
|
|
province: clientCodeInfo[clientCode].province,
|
|
ccaa: clientCodeInfo[clientCode].ccaa,
|
|
city: clientCodeInfo[clientCode].city
|
|
}
|
|
}
|
|
return "newClient";
|
|
}
|
|
|
|
const removeDoubleSpace = (str) => { // Removes double spaces in string
|
|
if (typeof str !== "string") {
|
|
return str;
|
|
}
|
|
return str.replace(/\s\s+/g, ' ');
|
|
}
|
|
|
|
const removeLeadingAndTrailingSpaces = (str) => { // Remove leading and ending spaces in string
|
|
if (typeof str !== "string") {
|
|
return str;
|
|
}
|
|
return str.trim();
|
|
}
|
|
|
|
const materialCodeToDose = (str) => { // Converts material code to a string with the dosage
|
|
if (str === 211354) {
|
|
return "50mg";
|
|
}
|
|
return "100mg";
|
|
}
|
|
|
|
// Activate tables and views
|
|
const originTable = base.getTableByName(ORIGIN_TABLE_NAME);
|
|
const originView = base.getViewByName(originTable, ORIGIN_VIEW_NAME);
|
|
|
|
const targetTable = base.getTableByName(TARGET_TABLE_NAME);
|
|
const targetView = base.getViewByName(targetTable, TARGET_VIEW_NAME);
|
|
|
|
// List of the columns I want to replicate
|
|
const columnsForImport = [
|
|
"Material",
|
|
"Solic.",
|
|
"Present.Concentr.",
|
|
"Nom.Solicitante",
|
|
"Nom Dest.",
|
|
"FechaFact.",
|
|
"Cantidad UMB",
|
|
"Lote-prov.",
|
|
"N.I.F. comunitario",
|
|
"Población Solic.",
|
|
]
|
|
|
|
const dataMatrix = []
|
|
|
|
// Get all rows and create new element with only the selected columns
|
|
const originRows = base.getRows(originTable, originView);
|
|
|
|
originRows.forEach(row => {
|
|
|
|
// Create new element with only the selected columns
|
|
const element = {};
|
|
columnsForImport.forEach(column => {
|
|
element[column] = removeLeadingAndTrailingSpaces(row[column]);
|
|
element[column] = removeDoubleSpace(element[column]);
|
|
});
|
|
|
|
// Material to Abarax
|
|
element["Material"] = materialCodeToDose(element["Material"]);
|
|
|
|
// Add element to dataMatrix
|
|
dataMatrix.push(element);
|
|
})
|
|
|
|
console.log(dataMatrix);
|