MurciaSalud
Atención Usuarios de los Servicio Sanitarios
An error occurred while processing the template.
The following has evaluated to null or missing: ==> smsObjectInstancer.getAssetEntryCategory(idCategoria) [in template "20101#20128#7792777" at line 8, column 22] ---- Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign categoria = smsObjectInstance... [in template "20101#20128#7792777" at line 8, column 1] ----
1<#assign httpRequest = portalUtil.getOriginalServletRequest(portalUtil.getHttpServletRequest(renderRequest)) />
2<#if httpRequest.getParameter("id_tipo_inf")?has_content && httpRequest.getParameter("id_tipo_inf") != "todos">
3 <#assign idTipoInf = httpRequest.getParameter("id_tipo_inf")?string>
4<#else>
5 <#assign idTipoInf = "8013482">
6</#if>
7<#assign idCategoria = idTipoInf>
8<#assign categoria = smsObjectInstancer.getAssetEntryCategory(idCategoria)>
9<#assign vocabularyIdAnhos = smsListasEsperaConfigurationServiceApi.getAnyoListasEsperaVocabularyId()>
10<#assign vocabularyIdMeses = smsListasEsperaConfigurationServiceApi.getMesListasEsperaVocabularyId()>
11<#assign vocabularyIdCentrosAsistenciales = smsListasEsperaConfigurationServiceApi.getCentroHospitalarioPre2016VocabularyId()>
12<#assign vocabularyIdServicios = smsListasEsperaConfigurationServiceApi.getTipoListasEsperaPre2016VocabularyId()>
13<#assign actionValue = "">
14<#if !httpRequest.getParameter("but_buscar")?has_content>
15 <body>
16 <form action="${actionValue}" method="get" name="formulario" class="mb-4">
17 <fieldset class="border site-type-border-color rounded border-primary px-4 py-2 mb-3">
18 <legend class="site-type-color pl-3 col-11 col-sm-6 col-md-3 font-weight-bold text-primary">Buscar por ${categoria.getName()}</legend>
19 <p class="site-type-color text-primary">Debe seleccionar un valor para cada uno de los campos</p>
20 <div class="form-group row mb-3">
21 <label for="hospitales" class="col-md-4 col-form-label">Centro Asistencial</label>
22 <div class="col-md-8">
23 <div class="d-md-flex justify-content-between">
24 <button type="button" class="site-type-background-color border-0 btn btn-primary my-1 mr-2" onclick="resetSelect('hospitales')">Restablecer</button>
25 <select name="centros" id="hospitales" class="form-control bg-light my-1"></select>
26 </div>
27 </div>
28 </div>
29
30 <div class="form-group row mb-3">
31 <label for="anhos" class="col-md-4 col-form-label">Año</label>
32 <div class="col-md-8">
33 <div class="d-md-flex justify-content-between">
34 <button type="button" class="site-type-background-color border-0 btn btn-primary my-1 mr-2" onclick="resetSelect('anhos')">Restablecer</button>
35 <select name="anhos" id="anhos" class="bg-light form-control my-1"></select>
36 </div>
37 </div>
38 </div>
39
40 <div class="form-group row mb-3">
41 <label for="meses" class="col-md-4 col-form-label">Mes</label>
42 <div class="col-md-8">
43 <div class="d-md-flex justify-content-between">
44 <button type="button" class="site-type-background-color border-0 btn btn-primary my-1 mr-2" onclick="resetSelect('meses')">Restablecer</button>
45 <select name="meses" id="meses" class="bg-light form-control my-1"></select>
46 </div>
47 </div>
48 </div>
49
50 <div class="form-group row mb-3">
51 <label for="servicios" class="col-md-4 col-form-label">${categoria.getName()}</label>
52 <div class="col-md-8">
53 <div class="d-md-flex justify-content-between">
54 <button type="button" class="site-type-background-color border-0 btn btn-primary my-1 mr-2" onclick="resetSelect('servicios')">Restablecer</button>
55 <select name="servicios" id="servicios" class="bg-light form-control my-1"></select>
56 </div>
57 </div>
58 </div>
59 </fieldset>
60 <input type="hidden" name="id_tipo_inf" id="id_tipo_inf" value="${idTipoInf}">
61 <input type="submit" name="but_buscar" id="but_buscar_original" value="Buscar" disabled class="site-type-background-color border-0 btn btn-primary">
62 <button type="submit" name="but_buscar" id="but_buscar_especial" value="todos" style="display: none" class="site-type-background-color border-0 btn btn-primary">Buscar</button>
63 <input type="reset" name="reset" value="Borrar" class="site-type-color border-0 btn btn-link text-primary">
64 </form>
65
66 </body>
67</#if>
68
69<#if httpRequest.getParameter("but_buscar")?has_content && (httpRequest.getParameter("but_buscar")) == "Buscar">
70 <#assign actionValue = themeDisplay.getURLCurrent()>
71 <#assign centrosId = httpRequest.getParameter("centros")?string>
72 <#assign anhosId = httpRequest.getParameter("anhos")?string>
73 <#assign mesId = httpRequest.getParameter("meses")?string>
74 <#assign servicioId = httpRequest.getParameter("servicios")?string>
75 <#assign categoryIds = [centrosId, anhosId, mesId, servicioId]>
76 <#assign categories = []>
77 <#list categoryIds as categoryId>
78 <#if smsObjectInstancer.getAssetEntryCategory(categoryId)?has_content>
79 <#assign assetCategory = smsObjectInstancer.getAssetEntryCategory(categoryId)>
80 </#if>
81 <#if assetCategory?has_content>
82 <#assign categories += [assetCategory]>
83 </#if>
84 </#list>
85
86 <#assign journalArticles = smsListasEsperaSearchServiceApi.getListasEsperaPre2016(categories)>
87 <button onclick="window.history.back()" class="border-0 btn site-type-background-color btn-primary">Volver a la búsqueda</button>
88 <#list journalArticles as curEntry>
89 <@liferay_journal["journal-article"]
90 articleId=curEntry.getArticleId()
91 groupId=curEntry.getGroupId()
92 />
93 </#list>
94</#if>
95<#-- AQUÍ GESTIONAMOS LAS CATEGORIAS Y LAS PASAMOS A LOS ID REQUERIDOS PARA LA NUEVA QUERY -->
96<#if httpRequest.getParameter("but_buscar")?has_content && httpRequest.getParameter("but_buscar") == "todos" >
97
98 <#assign assetCatPropValueCentro = 0>
99 <#assign assetCatPropValueMes = 0>
100 <#assign assetCatPropValueTipoInfo = 0>
101
102 <#assign centrosId = getterUtil.getLong(httpRequest.getParameter("centros")?string, 0)>
103 <#if smsObjectInstancer.getAssetCategoryProperty(centrosId, "id")?has_content>
104 <#assign assetCatPropCentros= smsObjectInstancer.getAssetCategoryProperty(centrosId, "id")>
105 <#assign assetCatPropValueCentro = getterUtil.getLong(assetCatPropCentros.getValue(), 0)>
106 </#if>
107
108 <#assign anhosId = httpRequest.getParameter("anhos")?string>
109 <#assign assetCatAnho= smsObjectInstancer.getAssetEntryCategory(anhosId)>
110 <#assign anhosCategoryNameLong = getterUtil.getLong(assetCatAnho.getTitle(locale), 0)>
111
112 <#assign mesId = getterUtil.getLong(httpRequest.getParameter("meses")?string, 0)>
113 <#if smsObjectInstancer.getAssetCategoryProperty(mesId, "id")?has_content>
114 <#assign assetCatPropMes = smsObjectInstancer.getAssetCategoryProperty(mesId, "id")>
115 <#assign assetCatPropValueMes = getterUtil.getLong(assetCatPropMes.getValue(), 0)>
116 </#if>
117
118 <#assign tipoInfoId = getterUtil.getLong(httpRequest.getParameter("id_tipo_inf")?string, 0)>
119 <#if smsObjectInstancer.getAssetCategoryProperty(tipoInfoId, "id")?has_content>
120 <#assign assetCatPropTipoInfo= smsObjectInstancer.getAssetCategoryProperty(tipoInfoId, "id")>
121 <#assign assetCatPropValueTipoInfo = getterUtil.getLong(assetCatPropTipoInfo.getValue(), 0)>
122 </#if>
123
124 <#--AQUI MÉTODO DEL BACK -->
125 <#assign cadenaJSONResultSet = smsListasEsperaSearchServiceApi.getResultadosConjuntos(assetCatPropValueCentro, anhosCategoryNameLong, assetCatPropValueMes, assetCatPropValueTipoInfo)>
126 <#assign jsonArray = cadenaJSONResultSet?eval>
127 <#assign questions = {}>
128 <#assign cabeceras = []>
129 <#assign lista = []>
130 <#assign ids = []>
131 <#assign poblacion = "">
132 <#assign hospital = "">
133 <#assign tipoDeLista = "">
134 <#assign meses = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]>
135 <#assign valorFormateado = 0>
136
137 <#-- Obtenemos el tipo de lista para ponerla en el título-->
138 <#if (assetCatPropValueTipoInfo == 1)>
139 <#assign tipoDeLista = "Listas de espera quirúrgicas por especialidades">
140 <#elseif (assetCatPropValueTipoInfo == 2)>
141 <#assign tipoDeLista = "Listas de espera quirúrgicas por procesos">
142 <#elseif (assetCatPropValueTipoInfo == 3)>
143 <#assign tipoDeLista = "Listas de espera por pruebas técnicas">
144 <#elseif (assetCatPropValueTipoInfo == 4)>
145 <#assign tipoDeLista = "Listas de espera por consultas">
146 </#if>
147
148 <#list jsonArray as json>
149 <#if !(ids?seq_contains(json.ID))>
150 <#assign ids = ids + [json.ID]>
151 <#assign questions = {"Nombre" : json.NOMBRE, "Header" : json.CABECERA, "Id" : json.ID}>
152 <#assign lista = lista + [questions]>
153 </#if>
154 <#if !(cabeceras?seq_contains(json.CABECERA))>
155 <#assign cabeceras = cabeceras + [json.CABECERA]>
156 </#if>
157 <#assign poblacion = json.POBLACION>
158 <#assign hospital = json.HOSPITAL>
159 </#list>
160
161 <h3 class="text-center font-weight-bolder my-5">${tipoDeLista}. ${hospital}</h3>
162 <div class="d-flex flex-row flex-wrap justify-content-between align-items-center">
163 <div class="col-md-6 d-flex flex-row justify-content-start align-items-start">
164 <button onclick="window.history.back()" class="border-0 btn site-type-background-color btn-primary">Volver a la búsqueda</button>
165 </div>
166 <div class="col-md-6 d-flex flex-row justify-content-end align-items-start">
167 <a href="/definiciones-de-los-indicadores" target="_blank" class="border-0 btn site-type-background-color btn-primary">Definiciones de los indicadores</a>
168 </div>
169 </div>
170
171 <h4 class="text-center font-weight-bolder mt-5 mb-0">Datos correspondientes a ${meses[assetCatPropValueMes - 1]} del ${anhosCategoryNameLong} </h4>
172 <p class="text-center mb-5">${poblacion}</p>
173
174 <#list cabeceras as cabecerasItem>
175 <h5 class="mt-5">${cabecerasItem}</h5>
176 <hr>
177 <div class ="d-flex flex-wrap flex-row justify-content-center align-items-start mb-3">
178 <#list lista as item>
179 <#if cabecerasItem == item.Header>
180 <div class="col-md-4 p-2 d-flex flex-row justify-content-center align-items-center">
181 <table class="site-type-border-color border-bottom mb-3">
182 <caption class="site-type-color font-weight-bold" style="min-height: 96px;">${item.Nombre}</caption>
183 <#list jsonArray as json>
184
185 <#if json.NOMBRE == item.Nombre && json.CABECERA == cabecerasItem && json.ID == item.Id>
186
187 <tr class="p-2">
188 <th class="p-2 font-weight-bold text-center text-white site-type-background-color">${json.DESCRIPCION}</th>
189
190
191 <td class="p-2">
192
193 <#assign valorFormateado = smsFreemarkerUtils.formatearDecimales(json.VALOR?string, 4)/>
194 ${valorFormateado}
195
196 </td>
197 </tr>
198 </#if>
199 </#list>
200 </table>
201 </div>
202 </#if>
203 </#list>
204 </div>
205 </#list>
206 <p class="text-right font-weight-bold my-3">${poblacion}</p>
207 <p class="text-right"><a href="/web/atencion-usuarios-de-servicios-sanitario/definiciones-de-los-indicadores" target="_blank" class="site-type-color">Definiciones de los indicadores</a></p>
208
209</#if>
210
211<script>
212 //SE LLAMA A LA REST AL INICIO DE LA PAGINA
213 $(function(){
214 makeRestCall([]);
215
216 //VALIDAR FORMULARIO OPCION TODOS OS SERVICIOS
217 const selector = document.querySelector("#servicios");
218 const buscarOriginal = document.querySelector("#but_buscar_original");
219 const buscarEspecial = document.querySelector("#but_buscar_especial");
220
221 function handleSelectorChange() {
222 if (selector.value === "todos") {
223 buscarOriginal.style.display = "none";
224 buscarEspecial.style.display = "inline-block";
225 }
226 }
227
228 selector.addEventListener("change", handleSelectorChange);
229
230 // Invoca manualmente el evento change
231 handleSelectorChange();
232 });
233
234 //FUNCION DE LA REST
235 function makeRestCall(arrayCategorias) {
236 var idsCategorias = arrayCategorias.filter(function(value) {
237 return value !== "";
238 });
239 var idLenguaje = "${themeDisplay.getLocale().toLanguageTag()?replace("-","_")}";
240 var typeParentCategoryId = ${categoria.getCategoryId()};
241 var requestURL = "${themeDisplay.getPortalURL()}/o/listas/espera/opcionesPRE2016";
242
243 var requestObj = {
244 "categoryIds": idsCategorias,
245 "languageId": idLenguaje,
246 "typeParentCategoryId": typeParentCategoryId
247 };
248
249 $.ajax({
250 headers: {
251 'Accept': 'application/json',
252 'Content-Type': 'application/json'
253 },
254 type: 'POST',
255 url: requestURL,
256 data: JSON.stringify(requestObj),
257 dataType: 'json',
258 success: function(data) {
259 fillSelectWithOptions("anhos", data[${vocabularyIdAnhos}]);
260 fillSelectWithOptions("meses", data[${vocabularyIdMeses}]);
261 fillSelectWithOptions("hospitales", data[${vocabularyIdCentrosAsistenciales}]);
262 fillSelectWithOptions("servicios", data[${vocabularyIdServicios}]);
263 },
264 })
265 .fail(function(xhr, textStatus, errorThrown) {
266 console.error(xhr);
267 console.error(textStatus);
268 console.error(errorThrown);
269 });
270 };
271
272 //TRAE UNA LISTA CON LOS VALORES DE LOS SELECT
273 function obtenerValoresSelect() {
274 var selects = document.querySelectorAll("select");
275 var valores = [];
276 selects.forEach(function(select) {
277 var valorSeleccionado = select.value || "";
278 valores.push(valorSeleccionado);
279 });
280
281 return valores;
282 };
283
284 //FUNCION DE BOTON PARA RESETEAR EL SELECT CORRESPONDIENTE
285 function resetSelect(selectId) {
286 var select = document.getElementById(selectId);
287 select.value = "";
288 makeRestCall(obtenerValoresSelect());
289 enableDisableSearchButton();
290 };
291
292 //LLAMA A LA REST CUANDO SE ACTUALIZA UN SELECT
293 var selects = document.querySelectorAll("select");
294 selects.forEach(function(select) {
295
296 select.addEventListener("change", function() {
297 var selectedValue = select.value;
298 if (select.value !== "todos") {
299 makeRestCall(obtenerValoresSelect());
300 enableDisableSearchButton();
301 }
302 });
303
304 });
305
306 //RELLENA LOS SELECTS
307 function fillSelectWithOptions(selectId, options) {
308 var select = document.getElementById(selectId);
309 var selectedValue = select.value;
310 if (selectId == "servicios") {
311 select.innerHTML = '<option value="">-- Elija una opción --</option>'+'<option value="todos">-- Todos los valores --</option>';
312 } else{
313 select.innerHTML = '<option value="">-- Elija una opción --</option>';
314 }
315
316 for (var key in options) {
317 if (options.hasOwnProperty(key)) {
318 var option = document.createElement("option");
319 option.value = key;
320 option.text = options[key];
321 select.appendChild(option);
322 }
323 }
324
325 if (selectedValue in options) {
326 select.value = selectedValue;
327 }
328 };
329
330 //ACTIVA O DESACTIVA EL BOTON DE BUSCAR
331 function enableDisableSearchButton() {
332 var allSelected = true;
333 selects.forEach(function (select) {
334 if (select.value === "") {
335 allSelected = false;
336 return;
337 }
338 });
339
340 var searchButton = document.querySelector("input[name=but_buscar]");
341 searchButton.disabled = !allSelected;
342 };
343
344 //FUNCION DEL BOTON DE BORRAR
345 var resetButton = document.querySelector("input[name=reset]");
346 resetButton.addEventListener("click", function () {
347 var searchButton = document.querySelector("input[name=but_buscar]");
348 searchButton.disabled = true;
349 makeRestCall([]);
350 });
351</script>