List of usage examples for org.apache.commons.lang3 StringUtils equalsIgnoreCase
public static boolean equalsIgnoreCase(final CharSequence str1, final CharSequence str2)
Compares two CharSequences, returning true if they represent equal sequences of characters, ignoring case.
null s are handled without exceptions.
From source file:com.glaf.core.db.TransformTable.java
protected void transform(QueryDefinition queryDefinition, Map<String, ColumnDefinition> columnMap, List<String> aggregationKeys, Map<String, TableModel> resultMap) { Map<String, Object> params = SystemConfig.getContextMap(); StringBuffer sb = new StringBuffer(1000); String sql = queryDefinition.getSql(); sql = QueryUtils.replaceSQLVars(sql); sql = QueryUtils.replaceSQLParas(sql, params); logger.debug("sql=" + sql); logger.debug("columnMap=" + columnMap.keySet()); Long databaseId = queryDefinition.getDatabaseId(); String systemName = Environment.getCurrentSystemName(); List<ColumnModel> cellModelList = new java.util.ArrayList<ColumnModel>(); try {/*w w w . j av a 2s . c om*/ Database database = getDatabaseService().getDatabaseById(databaseId); if (database != null) { Environment.setCurrentSystemName(database.getName()); } List<Map<String, Object>> rows = getTablePageService().getListData(sql, params); if (rows != null && !rows.isEmpty()) { logger.debug(queryDefinition.getTitle() + " " + rows.size()); logger.debug("RotatingFlag:" + queryDefinition.getRotatingFlag()); logger.debug("RotatingColumn:" + queryDefinition.getRotatingColumn()); /** * ???? */ if (StringUtils.equalsIgnoreCase(queryDefinition.getRotatingFlag(), "R2C") && StringUtils.isNotEmpty(queryDefinition.getRotatingColumn()) && rows.size() == 1) { Map<String, Object> dataMap = rows.get(0); logger.debug("?dataMap?:" + dataMap); ColumnDefinition idField = columnMap.get(aggregationKeys.get(0).toLowerCase()); ColumnDefinition field = columnMap.get(queryDefinition.getRotatingColumn().toLowerCase()); if (idField != null && field != null) { String javaType = field.getJavaType(); List<TableModel> list = new ArrayList<TableModel>(); Set<Entry<String, Object>> entrySet = dataMap.entrySet(); for (Entry<String, Object> entry : entrySet) { String key = entry.getKey(); Object value = entry.getValue(); if (key == null || value == null) { continue; } TableModel tableModel = new TableModel(); tableModel.setTableName(queryDefinition.getTargetTableName()); ColumnModel cell = new ColumnModel(); cell.setColumnName(queryDefinition.getRotatingColumn()); cell.setType(javaType); // logger.debug(cell.getColumnName()+"->"+javaType); if ("String".equals(javaType)) { cell.setStringValue(ParamUtils.getString(dataMap, key)); cell.setValue(cell.getStringValue()); } else if ("Integer".equals(javaType)) { cell.setIntValue(ParamUtils.getInt(dataMap, key)); cell.setValue(cell.getIntValue()); } else if ("Long".equals(javaType)) { cell.setLongValue(ParamUtils.getLong(dataMap, key)); cell.setValue(cell.getLongValue()); } else if ("Double".equals(javaType)) { cell.setDoubleValue(ParamUtils.getDouble(dataMap, key)); cell.setValue(cell.getDoubleValue()); } else if ("Date".equals(javaType)) { cell.setDateValue(ParamUtils.getDate(dataMap, key)); cell.setValue(cell.getDateValue()); } else { cell.setValue(value); } tableModel.addColumn(cell); ColumnModel idColumn = new ColumnModel(); idColumn.setColumnName(aggregationKeys.get(0)); idColumn.setJavaType(idField.getJavaType()); idColumn.setValue(key); tableModel.setIdColumn(idColumn); list.add(tableModel); } logger.debug("update datalist:" + list); Environment.setCurrentSystemName(systemName); getTableDataService().updateTableData(list); } } else { Set<String> cols = new HashSet<String>(); for (Map<String, Object> dataMap : rows) { sb.delete(0, sb.length()); cols.clear(); cellModelList.clear(); logger.debug("dataMap:" + dataMap); Set<Entry<String, Object>> entrySet = dataMap.entrySet(); for (Entry<String, Object> entry : entrySet) { String key = entry.getKey(); Object value = entry.getValue(); if (key == null || value == null) { continue; } /** * ???? */ if (cols.contains(key.toLowerCase())) { continue; } if (columnMap.get(key.toLowerCase()) == null) { logger.debug(key + " definition is null"); continue; } if (aggregationKeys.contains(key.toLowerCase())) { sb.append(value).append("_"); } ColumnDefinition column = columnMap.get(key.toLowerCase()); String javaType = column.getJavaType(); ColumnModel cell = new ColumnModel(); cell.setColumnName(column.getColumnName()); cell.setType(javaType); // logger.debug(cell.getColumnName()+"->"+javaType); if ("String".equals(javaType)) { cell.setStringValue(ParamUtils.getString(dataMap, key)); cell.setValue(cell.getStringValue()); } else if ("Integer".equals(javaType)) { cell.setIntValue(ParamUtils.getInt(dataMap, key)); cell.setValue(cell.getIntValue()); } else if ("Long".equals(javaType)) { cell.setLongValue(ParamUtils.getLong(dataMap, key)); cell.setValue(cell.getLongValue()); } else if ("Double".equals(javaType)) { cell.setDoubleValue(ParamUtils.getDouble(dataMap, key)); cell.setValue(cell.getDoubleValue()); } else if ("Date".equals(javaType)) { cell.setDateValue(ParamUtils.getDate(dataMap, key)); cell.setValue(cell.getDateValue()); } else { cell.setValue(value); } cellModelList.add(cell); cols.add(cell.getColumnName()); // logger.debug(cell.getColumnName()+"->"+javaType+":"+cell.getValue()); } // logger.debug(sb.toString()); /** * ?? */ if (sb.toString().endsWith("_")) { sb.delete(sb.length() - 1, sb.length()); String rowKey = sb.toString(); logger.debug("rowKey=" + rowKey); TableModel rowModel = resultMap.get(rowKey); if (rowModel == null) { rowModel = new TableModel(); ColumnModel cell01 = new ColumnModel(); cell01.setColumnName("ID"); cell01.setType("String"); cell01.setValueExpression(ExpressionConstants.ID_EXPRESSION); cols.add("ID"); rowModel.addColumn(cell01); rowModel.setIdColumn(cell01); ColumnModel cell04 = new ColumnModel(); cell04.setColumnName("AGGREGATIONKEY"); cell04.setType("String"); cols.add("AGGREGATIONKEY"); rowModel.addColumn(cell04); resultMap.put(rowKey, rowModel); } for (ColumnModel cell : cellModelList) { /** * ?? */ if (columnMap.get(cell.getColumnName().toLowerCase()) != null) { rowModel.addColumn(cell); } } } } } } } catch (Exception ex) { ex.printStackTrace(); logger.error(ex); } finally { Environment.setCurrentSystemName(systemName); } }
From source file:com.hybris.mobile.data.WebServiceDataProvider.java
/** * Synchronous call to the OCC web services * //from w ww. j a v a 2 s.com * @param url * The url * @param isAuthorizedRequest * Whether this request requires the authorization token sending * @param httpMethod * method type (GET, PUT, POST, DELETE) * @param httpBody * Data to be sent in the body (Can be empty) * @return The data from the server as a string, in almost all cases JSON * @throws MalformedURLException * @throws IOException * @throws ProtocolException */ public static String getResponse(Context context, String url, Boolean isAuthorizedRequest, String httpMethod, Bundle httpBody) throws MalformedURLException, IOException, ProtocolException, JSONException { // Refresh if necessary if (isAuthorizedRequest && WebServiceAuthProvider.tokenExpiredHint(context)) { WebServiceAuthProvider.refreshAccessToken(context); } boolean refreshLimitReached = false; int refreshed = 0; String response = ""; while (!refreshLimitReached) { // If we have refreshed max number of times, we will not do so again if (refreshed == 1) { refreshLimitReached = true; } // Make the connection and get the response OutputStream os; HttpURLConnection connection; if (httpMethod.equals("GET") && httpBody != null && !httpBody.isEmpty()) { url = url + "?" + encodePostBody(httpBody); } URL requestURL = new URL(addParameters(context, url)); if (StringUtils.equalsIgnoreCase(requestURL.getProtocol(), "https")) { trustAllHosts(); HttpsURLConnection https = createSecureConnection(requestURL); https.setHostnameVerifier(DO_NOT_VERIFY); if (isAuthorizedRequest) { String authValue = "Bearer " + SDKSettings.getSharedPreferenceString(context, "access_token"); https.setRequestProperty("Authorization", authValue); } connection = https; } else { connection = createConnection(requestURL); } connection.setRequestMethod(httpMethod); if (!httpMethod.equals("GET") && !httpMethod.equals("DELETE")) { connection.setDoOutput(true); connection.setDoInput(true); connection.connect(); if (httpBody != null && !httpBody.isEmpty()) { os = new BufferedOutputStream(connection.getOutputStream()); os.write(encodePostBody(httpBody).getBytes()); os.flush(); } } response = ""; try { LoggingUtils.d(LOG_TAG, connection.toString()); response = readFromStream(connection.getInputStream()); } catch (FileNotFoundException e) { LoggingUtils.e(LOG_TAG, "Error reading stream \"" + connection.getInputStream() + "\". " + e.getLocalizedMessage(), context); response = readFromStream(connection.getErrorStream()); } finally { connection.disconnect(); } // Allow for calls to return nothing if (response.length() == 0) { return ""; } // Check for JSON parsing errors (will throw JSONException is can't be parsed) JSONObject object = new JSONObject(response); // If no error, return response if (!object.has("error")) { return response; } // If there is a refresh token error, refresh the token else if (object.getString("error").equals("invalid_token")) { if (refreshLimitReached) { // Give up return response; } else { // Refresh the token WebServiceAuthProvider.refreshAccessToken(context); refreshed++; } } } // while(!refreshLimitReached) // There is an error other than a refresh error, so return the response return response; }
From source file:com.google.dart.tools.core.DartCoreDebug.java
/** * @return <code>true</code> if option has "expected" value. *//*from w w w . j a va2 s .c o m*/ private static boolean isOptionValue(String optionSuffix, String expected) { String value = getOptionValue(optionSuffix); if (value != null && !"false".equals(value)) { SPARSE_OPTION_MAP.put(optionSuffix, value); } return StringUtils.equalsIgnoreCase(value, expected); }
From source file:com.dominion.salud.mpr.negocio.service.tratamientos.impl.PrescripcionesServiceImpl.java
/** * * @param message//from w w w. j a v a 2 s .com * @throws Exception */ @Override @Transactional(noRollbackFor = { NoResultException.class }) public void processMessage(String message) throws Exception { logger.info("INICIANDO EL PROCESADO DEL MOVIMIENTO ENTRANTE"); logger.info(message); //Resultado final del proceso List<String> resultado = new ArrayList<>(); try { ZMP_O09 hl7message = (ZMP_O09) new ER7Parser().parse(message); PID pid = hl7message.getPATIENT().getPID(); PV1 pv1 = hl7message.getPATIENT().getPATIENT_VISIT().getPV1(); List<ZMP_O09_ORDER> zmp_o09_orders = hl7message.getORDERAll(); for (ZMP_O09_ORDER zmp_o09_order : zmp_o09_orders) { ORC orc = zmp_o09_order.getORC(); Z01 z01 = zmp_o09_order.getZ01(); TQ1 tq1 = zmp_o09_order.getTIMING().getTQ1(); RXC rxc = zmp_o09_order.getCOMPONENT().getRXC(); //ORC.21.10 - Centro logger.debug(" Procesando datos del CENTRO (" + orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue() + ") " + orc.getOrderingFacilityName(0).getOrganizationName().getValue()); Centros centros = new Centros(); centros.setCodCentro(orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue()); //ORC.21.10 try { centros = centrosService.findByCodCentro(centros); logger.debug(" ORC.21.10 - Centro: " + centros.toString()); } catch (NoResultException nre) { logger.error( " No se puede procesar el movimiento sin EQUIVALENCIA para el campo ORC.21.10 - CENTRO (" + orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue() + ")"); resultado.add("No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO: CENTRO (" + orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue() + ")"); } //PID.3 - Identificadores del paciente (NHC) y (CIPA) Integer nhc = null; String cipa = null; logger.debug(" Procesando el campo PID.3 - Identificadores del Paciente"); for (int i = 0; i < pid.getPatientIdentifierList().length; i++) { // PID.3 - PatientIdentifierList if (StringUtils.equalsIgnoreCase( pid.getPatientIdentifierList(i).getIdentifierTypeCode().getValue(), "PI")) { try { nhc = NumberUtils .createInteger(pid.getPatientIdentifierList(i).getIDNumber().getValue()); logger.debug(" PID.3(PI): " + nhc); } catch (Exception e) { logger.warn("El campo PID.3(PI) - NHC (" + pid.getPatientIdentifierList(i).getIDNumber().getValue() + ") no es correcto"); } } else if (StringUtils.equalsIgnoreCase( pid.getPatientIdentifierList(i).getIdentifierTypeCode().getValue(), "CIPA")) { if (StringUtils.isNotBlank(pid.getPatientIdentifierList(i).getIDNumber().getValue())) { cipa = pid.getPatientIdentifierList(i).getIDNumber().getValue(); logger.debug(" PID.3(CIPA): " + cipa); } } } //PID.5 - Paciente logger.debug(" Procesando datos del PACIENTE (" + pid.getPatientName(0).getFamilyName().getSurname().getValue() + " " + pid.getMotherSMaidenName(0).getFamilyName().getSurname().getValue() + ", " + pid.getPatientName(0).getGivenName().getValue() + ")"); Pacientes pacientes = new Pacientes(); pacientes.setCipa(cipa); pacientes.setTxtNombre(pid.getPatientName(0).getGivenName().getValue()); //PID.5.2 pacientes.setTxtApellido1(pid.getPatientName(0).getFamilyName().getSurname().getValue()); //PID.5.1.1 pacientes.setTxtApellido2(pid.getMotherSMaidenName(0).getFamilyName().getSurname().getValue()); //PID.6.1.1 pacientes.setFechaNac(pid.getDateTimeOfBirth().getTime().getValueAsDate()); //PID.7.1 logger.debug(" PID.5 - Paciente: " + pacientes.toString()); //PID.8 - Sexo logger.debug(" Procesando datos del SEXO (" + pid.getAdministrativeSex().getValue() + ")"); SexosExt sexosExt = new SexosExt(); try { sexosExt.setCentros(centros); sexosExt.setCodSexoExt(pid.getAdministrativeSex().getValue()); //PID.8 sexosExt.setTxtSexoExt(pid.getAdministrativeSex().getValue()); //PID.8 sexosExt = sexosExtService.traducirEquivalencia(sexosExt); logger.debug(" PID.8 - Sexo: " + sexosExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (StringUtils.isNotBlank(pid.getAdministrativeSex().getValue())) { logger.warn(" No se ha encontrado EQUIVALENCIA para el CAMPO PID.8 - SEXO (" + pid.getAdministrativeSex().getValue() + ")"); } else { logger.warn(" No se ha indicado INFORMACION para el CAMPO PID.8 - SEXO (" + pid.getAdministrativeSex().getValue() + ")"); } } //Datos del Episodio Episodios episodios = new Episodios(); //PV1.2 - Clase de Paciente logger.debug( " Procesando datos de la CLASE DE PACIENTE (" + pv1.getPatientClass().getValue() + ")"); //PV1.2 if (StringUtils.isNotBlank(pv1.getPatientClass().getValue())) { if (StringUtils.equals(pv1.getPatientClass().getValue(), "O")) { //Outpatient //PV1.18 - Tipo de Paciente logger.debug(" Procesando datos del TIPO DE PACIENTE (" + pv1.getPatientType().getValue() + ")"); //PV1.18 if (StringUtils.isNotBlank(pv1.getPatientType().getValue())) { episodios.setAmbito(pv1.getPatientType().getValue()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO PV1.18 - TIPO DE PACIENTE (" + pv1.getPatientType().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: TIPO DE PACIENTE"); } } else { episodios.setAmbito("H"); } logger.debug(" PV1.2 - Clase de Paciente y PV1.18 - Tipo de Paciente: " + episodios.getAmbito()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO PV1.2 - CLASE DE PACIENTE (" + pv1.getPatientClass().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: CLASE DE PACIENTE"); } //PV1.19.1 - Codigo de Episodio logger.debug(" Procesando datos del CODIGO DE EPISODIO (" + pv1.getVisitNumber().getIDNumber().getValue() + ")"); //PV1.19.1 if (StringUtils.isNotBlank(pv1.getVisitNumber().getIDNumber().getValue())) { episodios.setCodEpisodio(pv1.getVisitNumber().getIDNumber().getValue()); logger.debug(" PV1.19.1 - Codigo de Episodio: " + episodios.getCodEpisodio()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO PV1.19.1 - CODIGO DE EPISODIO (" + pv1.getVisitNumber().getIDNumber().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: CODIGO DE EPISODIO"); } //ORC.2.1 - Codigo de Prescripcion String cod_prescripcion = null; logger.debug(" Procesando CODIGO DE PRESCRIPCION (" + orc.getPlacerOrderNumber().getEntityIdentifier().getValue() + ")"); //ORC.2.1 if (StringUtils.isNotBlank(orc.getPlacerOrderNumber().getEntityIdentifier().getValue())) { cod_prescripcion = orc.getPlacerOrderNumber().getEntityIdentifier().getValue(); logger.debug(" ORC.2.1 - Codigo de Prescripcion: " + cod_prescripcion); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO ORC.2.1 - CODIGO DE PRESCRIPCION (" + orc.getPlacerOrderNumber().getEntityIdentifier().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: CODIGO DE PRESCRIPCION"); } //ORC.10 - Medico Prescriptor logger.debug(" Procesando datos del MEDICO PRESCRIPTOR (" + orc.getEnteredBy(0).getIDNumber().getValue() + ") " + orc.getOrderingProvider(0).getGivenName().getValue() + " " + orc.getOrderingProvider(0).getFamilyName().getSurname().getValue() + " " + orc.getOrderingProvider(0).getSecondAndFurtherGivenNamesOrInitialsThereof().getValue()); Medicos medicos = new Medicos(); medicos.setCodMedico(orc.getEnteredBy(0).getIDNumber().getValue()); //ORC.10.1 medicos.setTxtNombre(orc.getEnteredBy(0).getGivenName().getValue()); //ORC.10.3 medicos.setTxtApellido1(orc.getEnteredBy(0).getFamilyName().getSurname().getValue()); //ORC.10.2.1 medicos.setTxtApellido2( orc.getEnteredBy(0).getSecondAndFurtherGivenNamesOrInitialsThereof().getValue()); //ORC.10.4 medicos = medicosService.findByCodMedicoAndInsert(medicos); if (medicos != null) { logger.debug(" ORC.10 - Medico Prescriptor: " + medicos.toString()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO: ORC.10 - MEDICO PRESCRIPTOR (" + orc.getEnteredBy(0).getIDNumber().getValue() + ") " + orc.getOrderingProvider(0).getGivenName().getValue() + " " + orc.getOrderingProvider(0).getFamilyName().getSurname().getValue() + " " + orc.getOrderingProvider(0).getSecondAndFurtherGivenNamesOrInitialsThereof() .getValue()); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: MEDICO PRESCRIPTOR (" + orc.getEnteredBy(0).getIDNumber().getValue() + ") " + orc.getOrderingProvider(0).getGivenName().getValue() + " " + orc.getOrderingProvider(0).getFamilyName().getSurname().getValue() + " " + orc.getOrderingProvider(0).getSecondAndFurtherGivenNamesOrInitialsThereof() .getValue()); } //TQ1.7 - Fecha de Inicio de la Prescripcion Date fecha_ini_prescripcion = null; logger.debug(" Procesando FECHA DE INICIO DE LA PRESCRIPCION (" + tq1.getStartDateTime().getTime().getValue() + ")"); //TQ1.7 if (StringUtils.isNotBlank(tq1.getStartDateTime().getTime().getValue()) && tq1.getStartDateTime().getTime().getValueAsDate() != null) { fecha_ini_prescripcion = tq1.getStartDateTime().getTime().getValueAsDate(); logger.debug(" TQ1.7 - Fecha de Inicio de la Prescripcion: " + fecha_ini_prescripcion); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO: TQ1.7 - FECHA DE INICIO DE LA PRESCRIPCION (" + tq1.getStartDateTime().getTime().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: FECHA DE INICIO DE LA PRESCRIPCION (" + tq1.getStartDateTime().getTime().getValue() + ")"); } //TQ1.8 - Fecha Fin de la Prescripcion Date fecha_fin_prescripcion = null; logger.debug(" Procesando FECHA DE FIN DE LA PRESCRIPCION (" + tq1.getEndDateTime().getTime().getValue() + ")"); //TQ1.8 if (StringUtils.isNotBlank(tq1.getEndDateTime().getTime().getValue()) && tq1.getEndDateTime().getTime().getValueAsDate() != null) { fecha_fin_prescripcion = tq1.getEndDateTime().getTime().getValueAsDate(); logger.debug(" TQ1.8 - Fecha de Fin de la Prescripcion: " + fecha_fin_prescripcion); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO: TQ1.8 - FECHA FIN DE LA PRESCRIPCION (" + tq1.getEndDateTime().getTime().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: FECHA FIN DE LA PRESCRIPCION (" + tq1.getEndDateTime().getTime().getValue() + ")"); } //RXC.2 - Marca logger.debug(" Procesando de la MARCA (" + rxc.getComponentCode().getIdentifier().getValue() + ") " + rxc.getComponentCode().getText().getValue()); Marcas marcas = new Marcas(); marcas.setCodNac(rxc.getComponentCode().getIdentifier().getValue()); //RXC.2.1 marcas.setTxtMarca(rxc.getComponentCode().getText().getValue()); //RXC.2.2 marcas = marcasService.findByCodNacAndInsert(marcas); if (marcas != null) { logger.debug(" RXC.2 - Marca: " + marcas.toString()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el campo RXC.2 - MARCA (" + rxc.getComponentCode().getIdentifier().getValue() + ") " + rxc.getComponentCode().getText().getValue()); resultado.add("No se puede procesar el movimiento sin INFORMACION en el CAMPO: MARCA (" + rxc.getComponentCode().getIdentifier().getValue() + ") " + rxc.getComponentCode().getText().getValue()); } //Z01.9 - Dosis Prescrita en Unidad de Medida Double dosis_prescrita = null; logger.debug( " Procesando datos de la DOSIS PRESCRITA (" + z01.getDosisPrescrita().getValue() + ")"); //Z01.9 if (StringUtils.isNotBlank(z01.getDosisPrescrita().getValue()) && NumberUtils.isNumber(z01.getDosisPrescrita().getValue())) { try { dosis_prescrita = NumberUtils.createDouble(z01.getDosisPrescrita().getValue()); logger.debug(" Z01.9 - Dosis Prescrita: " + dosis_prescrita); } catch (Exception e) { logger.error( " No se puede procesar el movimiento porque la INFORMACION en el campo Z01.9 - DOSIS PRESCRITA (" + z01.getDosisPrescrita().getValue() + ") NO es correcta"); resultado.add( "No se puede procesar el movimiento porque la INFORMACION en el CAMPO: DOSIS PRESCRITA (" + z01.getDosisPrescrita().getValue() + ") NO es correcta"); } } else { logger.error( " No se puede procesar el movimiento sin datos en el campo Z01.9 - Dosis Prescrita (" + z01.getDosisPrescrita().getValue() + ")"); resultado .add("No se puede procesar el movimiento sin INFORMACION en el CAMPO: Dosis Prescrita (" + z01.getDosisPrescrita().getValue() + ")"); } //Z01.10 - Unidad de Medida de la Dosis Prescrita logger.debug(" Procesando datos de la UNIDAD DE MEDIDA DE LA DOSIS PRESCRITA (" + z01.getUnidMedDosisPrescrita().getIdentifier().getValue() + ") " + z01.getUnidMedDosisPrescrita().getText().getValue()); UnidMedExt unidMedExt = new UnidMedExt(); try { unidMedExt.setCentros(centros); unidMedExt.setCodUnidMedExt(z01.getUnidMedDosisPrescrita().getIdentifier().getValue()); //Z01.10.1 unidMedExt.setTxtUnidMedExt(z01.getUnidMedDosisPrescrita().getText().getValue()); //Z01.10.2 unidMedExt = unidMedExtService.traducirEquivalenciaAndInsert(unidMedExt); logger.debug( " Z01.10 - Unidad de Medida de la Dosis Prescrita: " + unidMedExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (StringUtils.isNotBlank(z01.getUnidMedDosisPrescrita().getIdentifier().getValue())) { logger.warn( " No se ha indicado INFORMACION para el CAMPO Z01.10 - UNIDAD DE MEDIDA DE LA DOSIS PRESCRITA (" + z01.getUnidMedDosisPrescrita().getIdentifier().getValue() + ") " + z01.getUnidMedDosisPrescrita().getText().getValue()); } else { logger.warn( " No se ha encontrado EQUIVALENCIA para el CAMPO Z01.10 - UNIDAD DE MEDIDA DE LA DOSIS PRESCRITA (" + z01.getUnidMedDosisPrescrita().getIdentifier().getValue() + ") " + z01.getUnidMedDosisPrescrita().getText().getValue()); } } //Z01.13 - Secuencias logger.debug(" Procesando de la SECUENCIA (" + z01.getSecuencia().getIdentifier().getValue() + ") " + z01.getSecuencia().getText().getValue()); SecuenciasExt secuenciasExt = new SecuenciasExt(); try { secuenciasExt.setCentros(centros); secuenciasExt.setCodSecuenciaExt(z01.getSecuencia().getIdentifier().getValue()); //Z01.13.1 secuenciasExt.setTxtSecuenciaExt(z01.getSecuencia().getText().getValue()); //Z01.13.2 secuenciasExt = secuenciasExtService.traducirEquivalenciaAndInsert(secuenciasExt); logger.debug(" Z01.13 - Secuencia: " + secuenciasExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (StringUtils.isNotBlank(z01.getSecuencia().getIdentifier().getValue())) { logger.warn( " No se ha indicado INFORMACION para el CAMPO Z01.13 - SECUENCIA (" + z01.getSecuencia().getIdentifier().getValue() + ") " + z01.getSecuencia().getText().getValue()); } else { logger.warn( " No se ha encontrado EQUIVALENCIA para el CAMPO Z01.13 - SECUENCIA (" + z01.getSecuencia().getIdentifier().getValue() + ") " + z01.getSecuencia().getText().getValue()); } } //Z01.14 - Pautas logger.debug(" Procesando de la PAUTA (" + z01.getPauta().getIdentifier().getValue() + ") " + z01.getPauta().getText().getValue()); PautasExt pautasExt = new PautasExt(); try { pautasExt.setCentros(centros); pautasExt.setCodPautaExt(z01.getPauta().getIdentifier().getValue()); //Z01.14.1 pautasExt.setTxtPautaExt(z01.getPauta().getText().getValue()); //Z01.14.2 pautasExt = pautasExtService.traducirEquivalenciaAndInsert(pautasExt); logger.debug(" Z01.14 - Pauta: " + pautasExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (StringUtils.isNotBlank(z01.getPauta().getIdentifier().getValue())) { logger.warn(" No se ha indicado INFORMACION para el CAMPO Z01.14 - PAUTA (" + z01.getPauta().getIdentifier().getValue() + ") " + z01.getPauta().getText().getValue()); } else { logger.warn(" No se ha encontrado EQUIVALENCIA para el CAMPO Z01.14 - PAUTA (" + z01.getPauta().getIdentifier().getValue() + ") " + z01.getPauta().getText().getValue()); } } //Z01.16 - Razon Fin logger.debug(" Procesando la RAZON DE FIN DE TRATAMIENTO (" + z01.getRazonFin().getIdentifier().getValue() + ") " + z01.getRazonFin().getText().getValue()); RazonFinExt razonFinExt = new RazonFinExt(); try { razonFinExt.setCentros(centros); razonFinExt.setCodRazonFinExt(z01.getRazonFin().getIdentifier().getValue()); //Z01.16.1 razonFinExt.setTxtRazonFinExt(z01.getRazonFin().getText().getValue()); //Z01.16.2 razonFinExt = razonFinExtService.traducirEquivalenciaAndInsert(razonFinExt); logger.debug(" Z01.16 - Razon de Fin: " + razonFinExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (StringUtils.isNotBlank(z01.getRazonFin().getIdentifier().getValue())) { logger.warn( " No se ha indicado INFORMACION para el CAMPO Z01.16 - RAZON DE FIN DE TRATAMIENTO (" + z01.getRazonFin().getIdentifier().getValue() + ") " + z01.getRazonFin().getText().getValue()); } else { logger.warn( " No se ha encontrado EQUIVALENCIA para el CAMPO Z01.16 - RAZON DE FIN DE TRATAMIENTO (" + z01.getRazonFin().getIdentifier().getValue() + ") " + z01.getRazonFin().getText().getValue()); } } //RESULTADO GENERAL DEL PROCESADO DEL MOVIMIENTO String mensaje = ""; if (!resultado.isEmpty()) { logger.error("RESULTADO GENERAL DEL PROCESADO: "); for (String linea : resultado) { mensaje += " - " + linea + "\n"; } logger.error(" " + mensaje); } if (StringUtils.isNotBlank(mensaje)) { throw new Exception(mensaje); } logger.info("FINALIZANDO EL PROCESADO DEL MOVIMIENTO ENTRANTE ENTRANTE"); //ALMACENAMIENTO DEL MOVIMIENTO logger.info("INICIANDO EL ALMACENAMIENTO DEL MOVIMIENTO ENTRANTE"); //PACIENTE try { logger.debug(" Buscando PACIENTE por CIPA (" + pacientes.getCipa() + ")"); pacientes = pacientesService.findByCIPA(pacientes); } catch (NoResultException nre) { logger.debug(" Almacenando datos del PACIENTE"); pacientes.setSexos(sexosExt.getSexos()); pacientes = pacientesService.save(pacientes); } finally { logger.debug(" Paciente: " + pacientes.toString()); } //EPISODIO try { episodios.setNhc(nhc); episodios.setCentros(centros); episodios.setPacientes(pacientes); logger.debug(" Buscando EPISODIO por COD_EPISODIO (" + episodios.getCodEpisodio() + "), NHC (" + episodios.getNhc() + "), PROGRAMA (" + episodios.getProgramas() + "), CENTRO (" + episodios.getCentros() + ")"); episodios = episodiosService.findByCodEpisodioNHCIdProgramaIdCentro(episodios); } catch (NoResultException nre) { logger.debug(" Almacenando datos del EPISODIO"); episodios = episodiosService.save(episodios); } finally { logger.debug(" Episodio: " + episodios.toString()); } //PRESCRIPCIONES logger.debug(" Almacenando datos de la PRESCRIPCION: (" + cod_prescripcion + ")"); Prescripciones prescripciones = new Prescripciones(); try { prescripciones.setCodPrescripcion(cod_prescripcion); logger.debug(" Buscando PRESCRIPCION por COD_PRESCRIPCION (" + prescripciones.getCodPrescripcion() + ")"); prescripciones = findByCodPrescripcion(prescripciones); logger.debug(" Actualizando PRESCRIPCION por COD_PRESCRIPCION (" + prescripciones.getCodPrescripcion() + ")"); prescripciones.setFechaFin(fecha_fin_prescripcion); prescripciones.setRazonFin(razonFinExt.getRazonFin()); prescripciones = save(prescripciones); } catch (NoResultException nre) { Prescripciones prescripcionesOld = new Prescripciones(); prescripcionesOld .setCodPrescripcion(StringUtils.split(prescripciones.getCodPrescripcion(), "-")[0] + "-" + StringUtils.split(prescripciones.getCodPrescripcion(), "-")[1] + "-" + StringUtils.split(prescripciones.getCodPrescripcion(), "-")[2] + "-" + StringUtils.split(prescripciones.getCodPrescripcion(), "-")[3] + "-" + StringUtils.split(prescripciones.getCodPrescripcion(), "-")[4]); List<Prescripciones> prescripcioneses = findLikeCodPrescripcion(prescripcionesOld); for (Prescripciones prescripcionesUpd : prescripcioneses) { if (StringUtils.equals(StringUtils.split(prescripcionesUpd.getCodPrescripcion(), "-")[7], StringUtils.split(prescripciones.getCodPrescripcion(), "-")[7])) { logger.debug(" Estableciendo fecha de fin en la prescripcion: " + prescripcionesUpd.toString()); prescripcionesUpd.setFechaFin(new Date()); save(prescripcionesUpd); } } prescripciones.setEpisodios(episodios); prescripciones.setMarcas(marcas); prescripciones.setMedicos(medicos); prescripciones.setDosis(dosis_prescrita); prescripciones.setFechaIni(fecha_ini_prescripcion); prescripciones.setFechaFin(fecha_fin_prescripcion); prescripciones.setRazonFin(razonFinExt.getRazonFin()); prescripciones.setCodPrescripcion(cod_prescripcion); prescripciones.setPautas(pautasExt.getPautas()); prescripciones.setRazonFin(razonFinExt.getRazonFin()); prescripciones.setSecuencias(secuenciasExt.getSecuencias()); prescripciones.setUnidMed(unidMedExt.getUnidMed()); prescripciones = save(prescripciones); } finally { logger.debug(" Prescripcion: " + prescripciones.toString()); } logger.info("FINALIZANDO EL ALMACENAMIENTO DEL MOVIMIENTO ENTRANTE"); } } catch (Exception e) { throw new Exception("SE HAN PRODUCIDO ERRORES AL PROCESAR EL MOVIMIENTO: \n" + e.getMessage() != null ? e.getMessage() : e.toString()); } }
From source file:com.sixwonders.courtkiosk.CheckInActivity.java
@Override public void processFinish(String callType, Object objectResult) { if (StringUtils.equalsIgnoreCase("auth", callType)) { ArrayList<Citation> citations = CitationAdapter.adaptCitationData((ArrayList<JSONObject>) objectResult); if (citations.isEmpty()) { //TODO: tell user info could not be found! Toast.makeText(this, "No court date found!", Toast.LENGTH_LONG).show(); } else {/*www. j a v a2s . c o m*/ openCompleteRegistrationActivity(citations.get(0)); } } }
From source file:com.glaf.activiti.container.ProcessContainer.java
/** * /*from w w w .j a v a 2 s.co m*/ * * @param actorId * @param rows * @return */ public List<TaskItem> filter(String actorId, List<TaskItem> rows) { List<Agent> agents = this.getAgents(actorId); logger.debug(agents); List<TaskItem> taskItems = new java.util.concurrent.CopyOnWriteArrayList<TaskItem>(); if (rows != null && rows.size() > 0) { Iterator<TaskItem> iter = rows.iterator(); while (iter.hasNext()) { TaskItem item = iter.next(); // logger.debug(item.getProcessDescription() + "\t" // + item.getTaskDescription() + "\t" + item.getActorId()); /** * ? */ if (StringUtils.equals(actorId, item.getActorId())) { taskItems.add(item); } else if (StringUtils.contains(item.getActorId(), actorId)) { List<String> actorIds = StringTools.split(item.getActorId()); if (actorIds != null && actorIds.contains(actorId)) { taskItems.add(item); } } else { if (agents != null && agents.size() > 0) { Iterator<Agent> it = agents.iterator(); while (it.hasNext()) { Agent agent = it.next(); if (!agent.isValid()) { continue; } /** * ??? */ if (!StringUtils.equals(item.getActorId(), agent.getAssignFrom())) { continue; } switch (agent.getAgentType()) { case 0:// ? taskItems.add(item); break; case 1:// ?? if (StringUtils.equalsIgnoreCase(agent.getProcessName(), item.getProcessName())) { taskItems.add(item); } break; case 2:// ?? if (StringUtils.equalsIgnoreCase(agent.getProcessName(), item.getProcessName()) && StringUtils.equalsIgnoreCase(agent.getTaskName(), item.getTaskName())) { taskItems.add(item); } break; default: break; } } } } } } return taskItems; }
From source file:com.inkubator.hrm.web.approval.ApprovalDefinitionFormController.java
public void onProcessCange() { String approvalProcess = approvalDefinitionModel.getProcessType(); if (StringUtils.equalsIgnoreCase(approvalProcess, HRMConstant.ON_APPROVE_INFO) || StringUtils.equalsIgnoreCase(approvalProcess, HRMConstant.ON_REJECT_INFO)) { onProcess = Boolean.TRUE; }//from www . j a v a 2 s . c o m if (StringUtils.equalsIgnoreCase(approvalProcess, HRMConstant.APPROVAL_PROCESS) || approvalProcess == null || approvalProcess.isEmpty()) { onProcess = Boolean.FALSE; } }
From source file:ec.edu.chyc.manejopersonal.managebean.GestorArticulo.java
private void agregarNuevaFirmaAVacio(Persona personaVacia, String nuevaFirma) { boolean existeFirma = false; for (PersonaFirma perFirma : personaVacia.getPersonaFirmasCollection()) { if (StringUtils.equalsIgnoreCase(perFirma.getFirma().getNombre(), nuevaFirma)) { existeFirma = true;//from w w w. j a v a 2 s . co m break; } } if (!existeFirma) { } }
From source file:com.dominion.salud.mpr.negocio.service.tratamientos.impl.AdministracionesServiceImpl.java
@Override @Transactional(noRollbackFor = { NoResultException.class }) public void processMessage(String message) throws Exception { logger.info("INICIANDO EL PROCESADO DEL MOVIMIENTO ENTRANTE"); logger.info(message);//w ww.j a v a 2 s .com //Resultado final del proceso List<String> resultado = new ArrayList<>(); try { RAS_O17 hl7message = (RAS_O17) new ER7Parser().parse(message); PID pid = hl7message.getPATIENT().getPID(); PV1 pv1 = hl7message.getPATIENT().getPATIENT_VISIT().getPV1(); List<RAS_O17_ORDER> ras_o17_orders = hl7message.getORDERAll(); for (RAS_O17_ORDER ras_o17_order : ras_o17_orders) { ORC orc = ras_o17_order.getORC(); TQ1 tq1 = ras_o17_order.getTIMING().getTQ1(); RXA rxa = ras_o17_order.getADMINISTRATION().getRXA(); RXO rxo = ras_o17_order.getORDER_DETAIL().getRXO(); //ORC.21.10 - Centro logger.debug(" Procesando datos del CENTRO (" + orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue() + ") " + orc.getOrderingFacilityName(0).getOrganizationName().getValue()); Centros centros = new Centros(); centros.setCodCentro(orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue()); //ORC.21.10 try { centros = centrosService.findByCodCentro(centros); logger.debug(" ORC.21.10 - Centro: " + centros.toString()); } catch (NoResultException nre) { logger.error( " No se puede procesar el movimiento sin EQUIVALENCIA para el campo ORC.21.10 - CENTRO (" + orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue() + ")"); resultado.add("No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO: CENTRO (" + orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue() + ")"); } //PID.3 - Identificadores del paciente (NHC) y (CIPA) Integer nhc = null; String cipa = null; logger.debug(" Procesando el campo PID.3 - Identificadores del Paciente"); for (int i = 0; i < pid.getPatientIdentifierList().length; i++) { // PID.3 - PatientIdentifierList if (StringUtils.equalsIgnoreCase( pid.getPatientIdentifierList(i).getIdentifierTypeCode().getValue(), "PI")) { try { nhc = NumberUtils .createInteger(pid.getPatientIdentifierList(i).getIDNumber().getValue()); logger.debug(" PID.3(PI): " + nhc); } catch (Exception e) { logger.warn("El campo PID.3(PI) - NHC (" + pid.getPatientIdentifierList(i).getIDNumber().getValue() + ") no es correcto"); } } else if (StringUtils.equalsIgnoreCase( pid.getPatientIdentifierList(i).getIdentifierTypeCode().getValue(), "CIPA")) { if (StringUtils.isNotBlank(pid.getPatientIdentifierList(i).getIDNumber().getValue())) { cipa = pid.getPatientIdentifierList(i).getIDNumber().getValue(); logger.debug(" PID.3(CIPA): " + cipa); } } } //PID.5 - Paciente logger.debug(" Procesando datos del PACIENTE (" + pid.getPatientName(0).getFamilyName().getSurname().getValue() + " " + pid.getMotherSMaidenName(0).getFamilyName().getSurname().getValue() + ", " + pid.getPatientName(0).getGivenName().getValue() + ")"); Pacientes pacientes = new Pacientes(); pacientes.setCipa(cipa); pacientes.setTxtNombre(pid.getPatientName(0).getGivenName().getValue()); //PID.5.2 pacientes.setTxtApellido1(pid.getPatientName(0).getFamilyName().getSurname().getValue()); //PID.5.1.1 pacientes.setTxtApellido2(pid.getMotherSMaidenName(0).getFamilyName().getSurname().getValue()); //PID.6.1.1 pacientes.setFechaNac(pid.getDateTimeOfBirth().getTime().getValueAsDate()); //PID.7.1 logger.debug(" PID.5 - Paciente: " + pacientes.toString()); //PID.8 - Sexo logger.debug(" Procesando datos del SEXO (" + pid.getAdministrativeSex().getValue() + ")"); SexosExt sexosExt = new SexosExt(); try { sexosExt.setCentros(centros); sexosExt.setCodSexoExt(pid.getAdministrativeSex().getValue()); //PID.8 sexosExt.setTxtSexoExt(pid.getAdministrativeSex().getValue()); //PID.8 sexosExt = sexosExtService.traducirEquivalencia(sexosExt); logger.debug(" PID.8 - Sexo: " + sexosExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (StringUtils.isNotBlank(pid.getAdministrativeSex().getValue())) { logger.warn(" No se ha encontrado EQUIVALENCIA para el CAMPO PID.8 - SEXO (" + pid.getAdministrativeSex().getValue() + ")"); } else { logger.warn(" No se ha indicado INFORMACION para el CAMPO PID.8 - SEXO (" + pid.getAdministrativeSex().getValue() + ")"); } } //Datos del Episodio Episodios episodios = new Episodios(); //PV1.2 - Clase de Paciente logger.debug( " Procesando datos de la CLASE DE PACIENTE (" + pv1.getPatientClass().getValue() + ")"); //PV1.2 if (StringUtils.isNotBlank(pv1.getPatientClass().getValue())) { if (StringUtils.equals(pv1.getPatientClass().getValue(), "O")) { //Outpatient //PV1.18 - Tipo de Paciente logger.debug(" Procesando datos del TIPO DE PACIENTE (" + pv1.getPatientType().getValue() + ")"); //PV1.18 if (StringUtils.isNotBlank(pv1.getPatientType().getValue())) { episodios.setAmbito(pv1.getPatientType().getValue()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO PV1.18 - TIPO DE PACIENTE (" + pv1.getPatientType().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: TIPO DE PACIENTE"); } } else { episodios.setAmbito("H"); } logger.debug(" PV1.2 - Clase de Paciente y PV1.18 - Tipo de Paciente: " + episodios.getAmbito()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO PV1.2 - CLASE DE PACIENTE (" + pv1.getPatientClass().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: CLASE DE PACIENTE"); } //PV1.19.1 - Codigo de Episodio logger.debug(" Procesando datos del CODIGO DE EPISODIO (" + pv1.getVisitNumber().getIDNumber().getValue() + ")"); //PV1.19.1 if (StringUtils.isNotBlank(pv1.getVisitNumber().getIDNumber().getValue())) { episodios.setCodEpisodio(pv1.getVisitNumber().getIDNumber().getValue()); logger.debug(" PV1.19.1 - Codigo de Episodio: " + episodios.getCodEpisodio()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO PV1.19.1 - CODIGO DE EPISODIO (" + pv1.getVisitNumber().getIDNumber().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: CODIGO DE EPISODIO"); } //ORC.2.1 - Codigo de Prescripcion String cod_prescripcion = null; logger.debug(" Procesando CODIGO DE PRESCRIPCION (" + orc.getPlacerOrderNumber().getEntityIdentifier().getValue() + ")"); //ORC.2.1 if (StringUtils.isNotBlank(orc.getPlacerOrderNumber().getEntityIdentifier().getValue())) { cod_prescripcion = orc.getPlacerOrderNumber().getEntityIdentifier().getValue(); logger.debug(" ORC.2.1 - Codigo de Prescripcion: " + cod_prescripcion); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO ORC.2.1 - CODIGO DE PRESCRIPCION (" + orc.getPlacerOrderNumber().getEntityIdentifier().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: CODIGO DE PRESCRIPCION"); } //ORC.3.1 - Codigo de Administracion String cod_administracion = null; logger.debug(" Procesando CODIGO DE ADMINSTRACION (" + orc.getFillerOrderNumber().getEntityIdentifier().getValue() + ")"); //ORC.2.1 if (StringUtils.isNotBlank(orc.getFillerOrderNumber().getEntityIdentifier().getValue())) { cod_administracion = orc.getFillerOrderNumber().getEntityIdentifier().getValue(); logger.debug(" ORC.3.1 - Codigo de Administracion: " + cod_administracion); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el campo ORC.3.1 - CODIGO DE ADMINSTRACION (" + orc.getFillerOrderNumber().getEntityIdentifier().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: CODIGO DE ADMINSTRACION (" + orc.getFillerOrderNumber().getEntityIdentifier().getValue() + ")"); } //ORC.10 - Medico Prescriptor logger.debug(" Procesando datos del MEDICO PRESCRIPTOR (" + orc.getEnteredBy(0).getIDNumber().getValue() + ") " + orc.getOrderingProvider(0).getGivenName().getValue() + " " + orc.getOrderingProvider(0).getFamilyName().getSurname().getValue() + " " + orc.getOrderingProvider(0).getSecondAndFurtherGivenNamesOrInitialsThereof().getValue()); Medicos medicos = new Medicos(); medicos.setCodMedico(orc.getEnteredBy(0).getIDNumber().getValue()); //ORC.10.1 medicos.setTxtNombre(orc.getEnteredBy(0).getGivenName().getValue()); //ORC.10.3 medicos.setTxtApellido1(orc.getEnteredBy(0).getFamilyName().getSurname().getValue()); //ORC.10.2.1 medicos.setTxtApellido2( orc.getEnteredBy(0).getSecondAndFurtherGivenNamesOrInitialsThereof().getValue()); //ORC.10.4 medicos = medicosService.findByCodMedicoAndInsert(medicos); if (medicos != null) { logger.debug(" ORC.10 - Medico Prescriptor: " + medicos.toString()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO: ORC.10 - MEDICO PRESCRIPTOR (" + orc.getEnteredBy(0).getIDNumber().getValue() + ") " + orc.getOrderingProvider(0).getGivenName().getValue() + " " + orc.getOrderingProvider(0).getFamilyName().getSurname().getValue() + " " + orc.getOrderingProvider(0).getSecondAndFurtherGivenNamesOrInitialsThereof() .getValue()); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: MEDICO PRESCRIPTOR (" + orc.getEnteredBy(0).getIDNumber().getValue() + ") " + orc.getOrderingProvider(0).getGivenName().getValue() + " " + orc.getOrderingProvider(0).getFamilyName().getSurname().getValue() + " " + orc.getOrderingProvider(0).getSecondAndFurtherGivenNamesOrInitialsThereof() .getValue()); } //TQ1.7 - Fecha de Inicio de la Prescripcion Date fecha_ini_prescripcion = null; logger.debug(" Procesando FECHA DE INICIO DE LA PRESCRIPCION (" + tq1.getStartDateTime().getTime().getValue() + ")"); //TQ1.7 if (StringUtils.isNotBlank(tq1.getStartDateTime().getTime().getValue()) && tq1.getStartDateTime().getTime().getValueAsDate() != null) { fecha_ini_prescripcion = tq1.getStartDateTime().getTime().getValueAsDate(); logger.debug(" TQ1.7 - Fecha de Inicio de la Prescripcion: " + fecha_ini_prescripcion); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO: TQ1.7 - FECHA DE INICIO DE LA PRESCRIPCION (" + tq1.getStartDateTime().getTime().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: FECHA DE INICIO DE LA PRESCRIPCION (" + tq1.getStartDateTime().getTime().getValue() + ")"); } //RXA.3 - Fecha de la Administracion Date fecha_administracion = null; logger.debug(" Procesando FECHA DE LA ADMINISTRACION (" + rxa.getDateTimeStartOfAdministration().getTime().getValue() + ")"); //RXA.3 if (StringUtils.isNotBlank(rxa.getDateTimeStartOfAdministration().getTime().getValue()) && rxa.getDateTimeStartOfAdministration().getTime().getValueAsDate() != null) { fecha_administracion = rxa.getDateTimeStartOfAdministration().getTime().getValueAsDate(); logger.debug(" RXA.3 - Fecha de la Administracion: " + fecha_administracion); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO RXD.3 - FECHA DE LA ADMINISTRACION (" + rxa.getDateTimeStartOfAdministration().getTime().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: FECHA DE LA ADMINISTRACION (" + rxa.getDateTimeStartOfAdministration().getTime().getValue() + ")"); } //RXA.5 - Marca logger.debug(" Procesando de la MARCA (" + rxa.getAdministeredCode().getIdentifier().getValue() + ") " + rxa.getAdministeredCode().getText().getValue()); Marcas marcas = new Marcas(); marcas.setCodNac(rxa.getAdministeredCode().getIdentifier().getValue()); //RXA.5.1 marcas.setTxtMarca(rxa.getAdministeredCode().getText().getValue()); //RXA.5.2 marcas = marcasService.findByCodNacAndInsert(marcas); if (marcas != null) { logger.debug(" RXA.5 - Marca: " + marcas.toString()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO RXA.5 - MARCA (" + rxa.getAdministeredCode().getIdentifier().getValue() + ") " + rxa.getAdministeredCode().getText().getValue()); resultado.add("No se puede procesar el movimiento sin INFORMACION en el CAMPO: MARCA (" + rxa.getAdministeredCode().getIdentifier().getValue() + ") " + rxa.getAdministeredCode().getText().getValue()); } //RXA.6 - Dosis Administrada en Forma Farmaceutica Double dosis_administrada = null; logger.debug(" Procesando datos de la DOSIS ADMINISTRADA (" + rxa.getAdministeredAmount().getValue() + ")"); //RXA.6 if (StringUtils.isNotBlank(rxa.getAdministeredAmount().getValue()) && NumberUtils.isNumber(rxa.getAdministeredAmount().getValue())) { try { dosis_administrada = NumberUtils.createDouble(rxa.getAdministeredAmount().getValue()); logger.debug(" RXA.6 - Dosis Administrada: " + dosis_administrada); } catch (Exception e) { logger.error( " No se puede procesar el movimiento porque la INFORMACION en el CAMPO RXA.6 - DOSIS ADMINISTRADA (" + rxa.getAdministeredAmount().getValue() + ") NO es correcta"); resultado.add( "No se puede procesar el movimiento porque la INFORMACION en el CAMPO: DOSIS ADMINISTRADA (" + rxa.getAdministeredAmount().getValue() + ") NO es correcta"); } } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO RXA.6 - Dosis Administrada (" + rxa.getAdministeredAmount().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: Dosis Administrada (" + rxa.getAdministeredAmount().getValue() + ")"); } //RXA.7 - Forma Farmaceutica de la Dosis Administrada logger.debug(" Procesando la FORMA FARMACEUTICA DE LA DOSIS ADMINISTRADA (" + rxa.getAdministeredUnits().getIdentifier().getValue() + ") " + rxa.getAdministeredUnits().getText().getValue()); FormasFarExt formasFarExt = new FormasFarExt(); try { formasFarExt.setCentros(centros); formasFarExt.setCodFormaFarExt(rxa.getAdministeredUnits().getIdentifier().getValue()); //RXA.7.1 formasFarExt.setTxtFormaFarExt(rxa.getAdministeredUnits().getText().getValue()); //RXA.7.2 formasFarExt = formasFarExtService.traducirEquivalenciaAndInsert(formasFarExt); logger.debug(" RXA.7 - Forma Farmaceutica de la Dosis Administrada: " + formasFarExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (StringUtils.isNotBlank(rxa.getAdministeredUnits().getIdentifier().getValue())) { logger.warn( " No se ha indicado INFORMACION para el CAMPO RXA.7 - FORMA FARMACEUTICA DE LA DOSIS ADMINISTRADA (" + rxa.getAdministeredUnits().getIdentifier().getValue() + ") " + rxa.getAdministeredUnits().getText().getValue()); } else { logger.warn( " No se ha encontrado EQUIVALENCIA para el CAMPO RXA.7 - FORMA FARMACEUTICA DE LA DOSIS ADMINISTRADA (" + rxa.getAdministeredUnits().getIdentifier().getValue() + ") " + rxa.getAdministeredUnits().getText().getValue()); } } //RXA.9 - Pautas logger.debug( " Procesando de la PAUTA (" + rxa.getAdministrationNotes(0).getIdentifier().getValue() + ") " + rxa.getAdministrationNotes(0).getText().getValue()); PautasExt pautasExt = new PautasExt(); try { pautasExt.setCentros(centros); pautasExt.setCodPautaExt(rxa.getAdministrationNotes(0).getIdentifier().getValue()); //RXA.9.1 pautasExt.setTxtPautaExt(rxa.getAdministrationNotes(0).getText().getValue()); //RXA.9.2 pautasExt = pautasExtService.traducirEquivalenciaAndInsert(pautasExt); logger.debug(" RXA.9 - Pauta: " + pautasExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (StringUtils.isNotBlank(rxa.getAdministrationNotes(0).getIdentifier().getValue())) { logger.warn(" No se ha indicado INFORMACION para el CAMPO RXA.9 - PAUTA (" + rxa.getAdministrationNotes(0).getIdentifier().getValue() + ") " + rxa.getAdministrationNotes(0).getText().getValue()); } else { logger.warn(" No se ha encontrado EQUIVALENCIA para el CAMPO RXA.9 - PAUTA (" + rxa.getAdministrationNotes(0).getIdentifier().getValue() + ") " + rxa.getAdministrationNotes(0).getText().getValue()); } } //RXA.19 - Secuencias logger.debug(" Procesando de la SECUENCIA (" + rxa.getIndication(0).getIdentifier().getValue() + ") " + rxa.getIndication(0).getText().getValue()); SecuenciasExt secuenciasExt = new SecuenciasExt(); try { secuenciasExt.setCentros(centros); secuenciasExt.setCodSecuenciaExt(rxa.getIndication(0).getIdentifier().getValue()); //RXA.19.1 secuenciasExt.setTxtSecuenciaExt(rxa.getIndication(0).getText().getValue()); //RXA.19.2 secuenciasExt = secuenciasExtService.traducirEquivalenciaAndInsert(secuenciasExt); logger.debug(" RXA.19 - Secuencia: " + secuenciasExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (StringUtils.isNotBlank(rxa.getIndication(0).getIdentifier().getValue())) { logger.warn( " No se ha indicado INFORMACION para el CAMPO RXA.19 - SECUENCIA (" + rxa.getIndication(0).getIdentifier().getValue() + ") " + rxa.getIndication(0).getText().getValue()); } else { logger.warn( " No se ha encontrado EQUIVALENCIA para el CAMPO RXA.19 - SECUENCIA (" + rxa.getIndication(0).getIdentifier().getValue() + ") " + rxa.getIndication(0).getText().getValue()); } } //RXO.2 - Dosis Prescrita en Unidad de Medida Double dosis_prescrita = null; logger.debug(" Procesando datos de la DOSIS PRESCRITA (" + rxo.getRequestedGiveAmountMinimum().getValue() + ")"); //RXO.2 if (StringUtils.isNotBlank(rxo.getRequestedGiveAmountMinimum().getValue()) && NumberUtils.isNumber(rxo.getRequestedGiveAmountMinimum().getValue())) { try { dosis_prescrita = NumberUtils.createDouble(rxo.getRequestedGiveAmountMinimum().getValue()); logger.debug(" RXO.2 - Dosis Prescrita: " + dosis_prescrita); } catch (Exception e) { logger.error( " No se puede procesar el movimiento porque la INFORMACION en el campo RXO.2 - DOSIS PRESCRITA (" + rxo.getRequestedGiveAmountMinimum().getValue() + ") NO es correcta"); resultado.add( "No se puede procesar el movimiento porque la INFORMACION en el CAMPO: DOSIS PRESCRITA (" + rxo.getRequestedGiveAmountMinimum().getValue() + ") NO es correcta"); } } else { logger.error( " No se puede procesar el movimiento sin datos en el campo RXO.2 - DOSIS PRESCRITA (" + rxo.getRequestedGiveAmountMinimum().getValue() + ")"); resultado .add("No se puede procesar el movimiento sin INFORMACION en el CAMPO: DOSIS PRESCRITA (" + rxo.getRequestedGiveAmountMinimum().getValue() + ")"); } //RXO.4 - Unidad de Medida de la Dosis Prescrita logger.debug(" Procesando datos de la UNIDAD DE MEDIDA DE LA DOSIS PRESCRITA (" + rxo.getRequestedGiveUnits().getIdentifier().getValue() + ") " + rxo.getRequestedGiveUnits().getText().getValue()); UnidMedExt unidMedExt = new UnidMedExt(); try { unidMedExt.setCentros(centros); unidMedExt.setCodUnidMedExt(rxo.getRequestedGiveUnits().getIdentifier().getValue()); //Z01.10.1 unidMedExt.setTxtUnidMedExt(rxo.getRequestedGiveUnits().getText().getValue()); //Z01.10.2 unidMedExt = unidMedExtService.traducirEquivalenciaAndInsert(unidMedExt); logger.debug( " RXO.4 - Unidad de Medida de la Dosis Prescrita: " + unidMedExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (StringUtils.isNotBlank(rxo.getRequestedGiveUnits().getIdentifier().getValue())) { logger.warn( " No se ha indicado INFORMACION para el CAMPO RXO.4 - UNIDAD DE MEDIDA DE LA DOSIS PRESCRITA (" + rxo.getRequestedGiveUnits().getIdentifier().getValue() + ") " + rxo.getRequestedGiveUnits().getText().getValue()); } else { logger.warn( " No se ha encontrado EQUIVALENCIA para el CAMPO RXO.4 - UNIDAD DE MEDIDA DE LA DOSIS PRESCRITA (" + rxo.getRequestedGiveUnits().getIdentifier().getValue() + ") " + rxo.getRequestedGiveUnits().getText().getValue()); } } //RESULTADO GENERAL DEL PROCESADO DEL MOVIMIENTO String mensaje = ""; if (!resultado.isEmpty()) { logger.error("RESULTADO GENERAL DEL PROCESADO: "); for (String linea : resultado) { mensaje += " - " + linea + "\n"; } logger.error(" " + mensaje); } if (StringUtils.isNotBlank(mensaje)) { throw new Exception(mensaje); } logger.info("FINALIZANDO EL PROCESADO DEL MOVIMIENTO ENTRANTE ENTRANTE"); //ALMACENAMIENTO DEL MOVIMIENTO logger.info("INICIANDO EL ALMACENAMIENTO DEL MOVIMIENTO ENTRANTE"); //PACIENTE try { logger.debug(" Buscando PACIENTE por CIPA (" + pacientes.getCipa() + ")"); pacientes = pacientesService.findByCIPA(pacientes); } catch (NoResultException nre) { logger.debug(" Almacenando datos del PACIENTE"); pacientes.setSexos(sexosExt.getSexos()); pacientes = pacientesService.save(pacientes); } finally { logger.debug(" Paciente: " + pacientes.toString()); } //EPISODIO try { episodios.setNhc(nhc); episodios.setCentros(centros); episodios.setPacientes(pacientes); logger.debug(" Buscando EPISODIO por COD_EPISODIO (" + episodios.getCodEpisodio() + "), NHC (" + episodios.getNhc() + "), PROGRAMA (" + episodios.getProgramas() + "), CENTRO (" + episodios.getCentros() + ")"); episodios = episodiosService.findByCodEpisodioNHCIdProgramaIdCentro(episodios); } catch (NoResultException nre) { logger.debug(" Almacenando datos del EPISODIO"); episodios = episodiosService.save(episodios); } finally { logger.debug(" Episodio: " + episodios.toString()); } //PRESCRIPCIONES Prescripciones prescripciones = new Prescripciones(); try { prescripciones.setCodPrescripcion(cod_prescripcion); logger.debug(" Buscando PRESCRIPCION por COD_PRESCRIPCION (" + prescripciones.getCodPrescripcion() + ")"); prescripciones = prescripcionesService.findByCodPrescripcion(prescripciones); } catch (NoResultException nre) { logger.debug(" Almacenando datos de la PRESCRIPCION: (" + cod_prescripcion + ")"); Prescripciones prescripcionesOld = new Prescripciones(); prescripcionesOld .setCodPrescripcion(StringUtils.split(prescripciones.getCodPrescripcion(), "-")[0] + "-" + StringUtils.split(prescripciones.getCodPrescripcion(), "-")[1] + "-" + StringUtils.split(prescripciones.getCodPrescripcion(), "-")[2] + "-" + StringUtils.split(prescripciones.getCodPrescripcion(), "-")[3] + "-" + StringUtils.split(prescripciones.getCodPrescripcion(), "-")[4]); List<Prescripciones> prescripcioneses = prescripcionesService .findLikeCodPrescripcion(prescripcionesOld); for (Prescripciones prescripcionesUpd : prescripcioneses) { if (StringUtils.equals(StringUtils.split(prescripcionesUpd.getCodPrescripcion(), "-")[7], StringUtils.split(prescripciones.getCodPrescripcion(), "-")[7])) { logger.debug(" Estableciendo fecha de fin en la prescripcion: " + prescripcionesUpd.toString()); prescripcionesUpd.setFechaFin(new Date()); prescripcionesService.save(prescripcionesUpd); } } prescripciones.setEpisodios(episodios); prescripciones.setMarcas(marcas); prescripciones.setMedicos(medicos); prescripciones.setDosis(dosis_prescrita); prescripciones.setFechaIni(fecha_ini_prescripcion); prescripciones.setPautas(pautasExt.getPautas()); prescripciones.setSecuencias(secuenciasExt.getSecuencias()); prescripciones.setCodPrescripcion(cod_prescripcion); prescripciones.setUnidMed(unidMedExt.getUnidMed()); prescripciones = prescripcionesService.save(prescripciones); } finally { logger.debug(" Prescripcion: " + prescripciones.toString()); } //ADMINISTRACIONES Administraciones administraciones = new Administraciones(); try { administraciones.setCodAdministracion(cod_administracion); logger.debug(" Buscando ADMINISTRACIONES por COD_ADMINISTRACION (" + administraciones.getCodAdministracion() + ")"); administraciones = findByCodAdministracion(administraciones); } catch (NoResultException nre) { administraciones.setPrescripciones(prescripciones); administraciones.setFormasFar(formasFarExt.getFormasFar()); administraciones.setCantidad(dosis_administrada); administraciones.setFechaAdm(fecha_administracion); save(administraciones); } finally { logger.debug(" Administraciones: " + administraciones.toString()); } logger.info("FINALIZANDO EL ALMACENAMIENTO DEL MOVIMIENTO ENTRANTE"); } } catch (Exception e) { throw new Exception("SE HAN PRODUCIDO ERRORES AL PROCESAR EL MOVIMIENTO: \n" + e.getMessage() != null ? e.getMessage() : e.toString()); } }
From source file:com.feilong.core.lang.EnumUtil.java
/** * Checks if is equals./*from w w w . j av a 2 s . c om*/ * * @param <T> * the generic type * @param propertyValue * the property value * @param specifiedValue * * @param ignoreCase * the ignore case * @return true, if checked * @since 1.4.0 */ private static <T> boolean isEquals(Object propertyValue, T specifiedValue, boolean ignoreCase) { if (propertyValue == null || specifiedValue == null) {// return propertyValue == specifiedValue; } else if (propertyValue == specifiedValue) { return true; } // propertyValue specifiedValue, ?null String propertyValueString = propertyValue.toString(); String specifiedValueString = specifiedValue.toString(); return ignoreCase ? StringUtils.equalsIgnoreCase(propertyValueString, specifiedValueString) : StringUtils.equals(propertyValueString, specifiedValueString); }