/** * Agrega una notificación de tipo Rotavirus * * @param json con los datos de la ficha * @param request con datos de autenticación * @return DaNotificacion agregada * @throws Exception */ public DaNotificacion guardarNotificacion(String json, HttpServletRequest request) throws Exception { logger.debug("Guardando Notificacion"); DaNotificacion noti = new DaNotificacion(); Integer personaId = null; Integer codSilaisAtencion = null; Integer codUnidadAtencion = null; String urgente = null; JsonObject jObjectJson = new Gson().fromJson(json, JsonObject.class); if (jObjectJson.get("personaId") != null && !jObjectJson.get("personaId").getAsString().isEmpty()) { personaId = jObjectJson.get("personaId").getAsInt(); } if (jObjectJson.get("codSilaisAtencion") != null && !jObjectJson.get("codSilaisAtencion").getAsString().isEmpty()) { codSilaisAtencion = jObjectJson.get("codSilaisAtencion").getAsInt(); } if (jObjectJson.get("codUnidadAtencion") != null && !jObjectJson.get("codUnidadAtencion").getAsString().isEmpty()) { codUnidadAtencion = jObjectJson.get("codUnidadAtencion").getAsInt(); } if (jObjectJson.get("urgente") != null && !jObjectJson.get("urgente").getAsString().isEmpty()) { urgente = jObjectJson.get("urgente").getAsString(); } if (personaId != null) { SisPersona persona = personaService.getPersona(personaId); noti.setPersona(persona); noti.setFechaRegistro(new Timestamp(new Date().getTime())); noti.setCodSilaisAtencion(entidadAdmonService.getSilaisByCodigo(codSilaisAtencion)); noti.setCodUnidadAtencion(unidadesService.getUnidadByCodigo(codUnidadAtencion)); long idUsuario = seguridadService.obtenerIdUsuario(request); noti.setUsuarioRegistro(usuarioService.getUsuarioById((int) idUsuario)); noti.setCodTipoNotificacion(catalogoService.getTipoNotificacion("TPNOTI|RTV")); noti.setMunicipioResidencia(persona.getMunicipioResidencia()); noti.setDireccionResidencia(persona.getDireccionResidencia()); noti.setUrgente(catalogoService.getRespuesta(urgente)); daNotificacionService.addNotification(noti); return noti; } else { throw new Exception(); } }