List of usage examples for org.apache.commons.lang3.math NumberUtils isNumber
public static boolean isNumber(final String str)
Checks whether the String a valid Java number.
Valid numbers include hexadecimal marked with the 0x
or 0X
qualifier, octal numbers, scientific notation and numbers marked with a type qualifier (e.g.
From source file:com.epam.catgenome.manager.FeatureIndexManager.java
private void addNumberInfo(Map<String, Object> permittedInfo, Map<String, Object> info, int count, VCFHeaderLineCount countType, VCFHeaderLineType type, InfoItem key) { Object value;//from ww w. ja v a2 s . c o m if (isVariableLength(countType)) { value = info.get(key.getName()).toString(); } else if (count > 1) { value = parseNumberArray(type, info.get(key.getName())); if (value == null) { LOGGER.error( MessageHelper.getMessage(MessagesConstants.ERROR_FEATURE_INDEX_WRITING_WRONG_PARAMETER_TYPE, key.getName(), key.getType(), info.get(key.getName()).toString())); return; } permittedInfo.put("_" + key.getName() + "_v", info.get(key.getName()).toString()); } else { String numberString = info.get(key.getName()).toString(); if (NumberUtils.isNumber(numberString)) { value = parseNumber(type, info.get(key.getName())); } else { LOGGER.error( MessageHelper.getMessage(MessagesConstants.ERROR_FEATURE_INDEX_WRITING_WRONG_PARAMETER_TYPE, key.getName(), key.getType(), numberString)); return; } } permittedInfo.put(key.getName(), value); }
From source file:lineage2.gameserver.model.Skill.java
/** * Constructor for Skill./*from w w w . j av a 2s. c o m*/ * @param set StatsSet */ protected Skill(StatsSet set) { _id = set.getInteger("skill_id"); _level = set.getInteger("level"); _displayId = set.getInteger("displayId", _id); _displayLevel = set.getInteger("displayLevel", _level); _baseLevel = set.getInteger("base_level"); _name = set.getString("name"); _operateType = set.getEnum("operateType", SkillOpType.class); _isNewbie = set.getBool("isNewbie", false); _isSelfDispellable = set.getBool("isSelfDispellable", true); _isPreservedOnDeath = set.getBool("isPreservedOnDeath", false); _isAwakeningToggle = set.getBool("isAwakeningToggle", false); _isHeroic = set.getBool("isHeroic", false); _isAltUse = set.getBool("altUse", false); _mpConsume1 = set.getInteger("mpConsume1", 0); _mpConsume2 = set.getInteger("mpConsume2", 0); _maxHitCancelCount = set.getInteger("maxHitCancelCount", 0); _energyConsume = set.getInteger("energyConsume", 0); _hpConsume = set.getInteger("hpConsume", 0); _soulsConsume = set.getInteger("soulsConsume", 0); _isSoulBoost = set.getBool("soulBoost", false); _isChargeBoost = set.getBool("chargeBoost", false); _isProvoke = set.getBool("provoke", false); _isUsingWhileCasting = set.getBool("isUsingWhileCasting", false); _matak = set.getInteger("mAtk", 0); _isUseSS = Ternary.valueOf(set.getString("useSS", Ternary.DEFAULT.toString()).toUpperCase()); _magicLevel = set.getInteger("magicLevel", 0); _castCount = set.getInteger("castCount", 0); _castRange = set.getInteger("castRange", 40); _baseValues = set.getString("baseValues", null); _skillToCast = set.getInteger("skillToCast", 0); _skillToCastLevel = set.getInteger("skillToCastLevel", 0); String s1 = set.getString("itemConsumeCount", ""); String s2 = set.getString("itemConsumeId", ""); String s3 = set.getString("relationSkillsId", ""); _powerModCount = set.getInteger("powerModCount", 0); if (!(_powerModCount == 0)) { _isPowerModified = true; for (int i = 0; i < _powerModCount; i++) { List<String> weaponsMod = new ArrayList<String>(); String sPowerMod = set.getString("powerModByWeapon" + String.valueOf(i + 1), ""); double dPowerMod = set.getDouble("powerModPercent" + String.valueOf(i + 1), 1.); if (sPowerMod.length() == 0) { weaponsMod.add("None"); } else { String[] s = sPowerMod.split(";"); for (int j = 0; j < s.length; j++) { weaponsMod.add(s[j]); } } _powerModifiers.put(weaponsMod, dPowerMod); } } if (s1.length() == 0) { _itemConsume = new int[] { 0 }; } else { String[] s = s1.split(" "); _itemConsume = new int[s.length]; for (int i = 0; i < s.length; i++) { _itemConsume[i] = Integer.parseInt(s[i]); } } if (s2.length() == 0) { _itemConsumeId = new int[] { 0 }; } else { String[] s = s2.split(" "); _itemConsumeId = new int[s.length]; for (int i = 0; i < s.length; i++) { _itemConsumeId[i] = Integer.parseInt(s[i]); } } if (s3.length() == 0) { _relationSkillsId = new int[] { 0 }; } else { _isRelation = true; String[] s = s3.split(";"); _relationSkillsId = new int[s.length]; for (int i = 0; i < s.length; i++) { _relationSkillsId[i] = Integer.parseInt(s[i]); } } _referenceItemId = set.getInteger("referenceItemId", 0); _referenceItemMpConsume = set.getInteger("referenceItemMpConsume", 0); _castOverStun = set.getBool("castOverStun", false); _isItemHandler = set.getBool("isHandler", false); _isCommon = set.getBool("isCommon", false); _isAuraSkill = set.getBool("isAuraSkill", false); _isAlterSkill = set.getBool("isAlterSkill", false); _isSaveable = set.getBool("isSaveable", true); _coolTime = set.getInteger("coolTime", 0); _skillInterruptTime = set.getInteger("hitCancelTime", 0); _reuseDelay = set.getLong("reuseDelay", 0); _hitTime = set.getInteger("hitTime", 0); _skillRadius = set.getInteger("skillRadius", 80); _targetType = set.getEnum("target", SkillTargetType.class); _magicType = set.getEnum("magicType", SkillMagicType.class, SkillMagicType.PHYSIC); _traitType = set.getEnum("trait", SkillTrait.class, null); _saveVs = set.getEnum("saveVs", BaseStats.class, null); _dispelOnDamage = set.getBool("dispelOnDamage", false); _hideStartMessage = set.getBool("isHideStartMessage", false); _hideUseMessage = set.getBool("isHideUseMessage", false); _isUndeadOnly = set.getBool("undeadOnly", false); _isCorpse = set.getBool("corpse", false); _power = set.getDouble("power", 0.); _power2 = set.getDouble("power2", 0.); _powerPvP = set.getDouble("powerPvP", 0.); _powerPvE = set.getDouble("powerPvE", 0.); _effectPoint = set.getInteger("effectPoint", 0); _nextAction = NextAction.valueOf(set.getString("nextAction", "DEFAULT").toUpperCase()); _skillType = set.getEnum("skillType", SkillType.class); _isSuicideAttack = set.getBool("isSuicideAttack", false); _isSkillTimePermanent = set.getBool("isSkillTimePermanent", false); _isReuseDelayPermanent = set.getBool("isReuseDelayPermanent", false); _deathlink = set.getBool("deathlink", false); _basedOnTargetDebuff = set.getBool("basedOnTargetDebuff", false); _isNotUsedByAI = set.getBool("isNotUsedByAI", false); _isIgnoreResists = set.getBool("isIgnoreResists", false); _isIgnoreInvul = set.getBool("isIgnoreInvul", false); _isTrigger = set.getBool("isTrigger", false); _isNotAffectedByMute = set.getBool("isNotAffectedByMute", false); _flyingTransformUsage = set.getBool("flyingTransformUsage", false); _flySpeed = set.getInteger("flySpeed", 0); _canUseTeleport = set.getBool("canUseTeleport", true); if (NumberUtils.isNumber(set.getString("element", "NONE"))) { _element = Element.getElementById(set.getInteger("element", -1)); } else { _element = Element.getElementByName(set.getString("element", "none").toUpperCase()); } _elementPower = set.getInteger("elementPower", 0); _activateRate = set.getInteger("activateRate", -1); _levelModifier = set.getInteger("levelModifier", 1); _isCancelable = set.getBool("cancelable", true); _isReflectable = set.getBool("reflectable", true); _isHealDamageSkill = set.getBool("isHealDamageSkill", false); _isShieldignore = set.getBool("shieldignore", false); _criticalRate = set.getInteger("criticalRate", 0); _isOverhit = set.getBool("overHit", false); _weaponsAllowed = set.getInteger("weaponsAllowed", 0); _minPledgeClass = set.getInteger("minPledgeClass", 0); _minRank = set.getInteger("minRank", 0); _isOffensive = set.getBool("isOffensive", _skillType.isOffensive()); _isPvpSkill = set.getBool("isPvpSkill", _skillType.isPvpSkill()); _isFishingSkill = set.getBool("isFishingSkill", false); _isPvm = set.getBool("isPvm", _skillType.isPvM()); _isForceUse = set.getBool("isForceUse", false); _isBehind = set.getBool("behind", false); _scopeAngle = set.getInteger("scopeAngle", 120); _symbolId = set.getInteger("symbolId", 0); _npcId = set.getInteger("npcId", 0); _flyType = FlyType.valueOf(set.getString("flyType", "NONE").toUpperCase()); _flyToBack = set.getBool("flyToBack", false); _flyRadius = set.getInteger("flyRadius", 200); _negateSkill = set.getInteger("negateSkill", 0); _negatePower = set.getInteger("negatePower", Integer.MAX_VALUE); _numCharges = set.getInteger("num_charges", 0); _maxCharges = set.getInteger("max_charges", 0); _condCharges = set.getInteger("cond_charges", 0); _delayedEffect = set.getInteger("delayedEffect", 0); _cancelTarget = set.getInteger("cancelTarget", 0); _skillInterrupt = set.getBool("skillInterrupt", false); _lethal1 = set.getDouble("lethal1", 0.); _lethal2 = set.getDouble("lethal2", 0.); _absorbPart = set.getDouble("absorbPart", 0.); _icon = set.getString("icon", ""); _isMarkDamage = set.getBool("isMarkDamage", false); StringTokenizer st = new StringTokenizer(set.getString("addSkills", ""), ";"); while (st.hasMoreTokens()) { int id = Integer.parseInt(st.nextToken()); int level = Integer.parseInt(st.nextToken()); if (level == -1) { level = _level; } _addedSkills = ArrayUtils.add(_addedSkills, new AddedSkill(id, level)); } if (_nextAction == NextAction.DEFAULT) { switch (_skillType) { case PDAM: case CPDAM: case LETHAL_SHOT: case SPOIL: case SOWING: case STUN: case DRAIN_SOUL: _nextAction = NextAction.ATTACK; break; default: _nextAction = NextAction.NONE; } } String canLearn = set.getString("canLearn", null); if (canLearn == null) { _canLearn = null; } else { _canLearn = new ArrayList<ClassId>(); st = new StringTokenizer(canLearn, " \r\n\t,;"); while (st.hasMoreTokens()) { String cls = st.nextToken(); _canLearn.add(ClassId.valueOf(cls)); } } String teachers = set.getString("teachers", null); if (teachers == null) { _teachers = null; } else { _teachers = new ArrayList<Integer>(); st = new StringTokenizer(teachers, " \r\n\t,;"); while (st.hasMoreTokens()) { String npcid = st.nextToken(); _teachers.add(Integer.parseInt(npcid)); } } hashCode = (_id * 1023) + _level; }
From source file:net.cbtltd.rest.interhome.A_Handler.java
/** * Read accommodation products./*from ww w. ja v a2s.c o m*/ */ public synchronized void readProducts() { Date version = new Date(); String message = "Interhome readProducts " + getAltpartyid(); LOG.debug(message); String codeinterhome = null; String fn = null; final SqlSession sqlSession = RazorServer.openSession(); try { RelationService.load(sqlSession, Downloaded.PRODUCT_DOWNLOAD_DATE, getAltpartyid(), version.toString()); JAXBContext jc = JAXBContext.newInstance("net.cbtltd.rest.interhome.accommodation"); Unmarshaller um = jc.createUnmarshaller(); fn = "accommodation.xml"; Accommodations accommodations = (Accommodations) um.unmarshal(ftp(fn)); int i = 0; StringBuilder sb = new StringBuilder(); // boolean check = true; for (Accommodation accommodation : accommodations.getAccommodation()) { try { // if (accommodation.getCode().equalsIgnoreCase("DK1026.631.1")) {check = false;} // if (accommodation.getCountry().equalsIgnoreCase("FR")) {check = false;} // if (check) continue; // Product product = PartnerService.getProduct(sqlSession, getAltpartyid(), accommodation.getCode()); Product product = getProduct(sqlSession, getAltpartyid(), accommodation.getCode()); // if (product == null) {continue;} ArrayList<String> attributes = new ArrayList<String>(); product.setBathroom( accommodation.getBathrooms() == null ? 2 : accommodation.getBathrooms().intValue()); product.setRoom( accommodation.getBedrooms() == null ? 2 : accommodation.getBedrooms().intValue()); net.cbtltd.shared.Country country = sqlSession.getMapper(CountryMapper.class) .read(accommodation.getCountry()); Geodata geodata = accommodation.getGeodata(); product.setLatitude(geodata == null ? null : geodata.getLat().doubleValue()); product.setLongitude(geodata == null ? null : geodata.getLng().doubleValue()); product.setAltitude(0.0); product.setPerson(accommodation.getPax() == null ? 2 : accommodation.getPax().intValue()); product.setRoom( accommodation.getBedrooms() == null ? 1 : accommodation.getBedrooms().intValue()); product.setToilet( accommodation.getToilets() == null ? 0 : accommodation.getToilets().intValue()); product.setChild(0); product.setSecuritydeposit(Product.DEFAULT_SECUIRTY_DEPOSIT); product.setCommission(20.0); product.setCleaningfee(Product.DEFAULT_CLEANING_FEE); product.setCurrency(country.getCurrency()); // product.setDiscount(20.0); product.setInfant(0); String floor = accommodation.getFloor(); Short space = accommodation.getSqm(); if (NumberUtils.isNumber(floor)) { product.setFloor(Integer.valueOf(floor)); } else { LOG.error("Invalid floor or space value for product id: " + product.getId() + ", altid: " + accommodation.getCode()); } product.setSpace((space == null ? "0" : space) + " sq.m"); product.setQuantity(1); product.setRank(getRank()); product.setRating(5); // product.setState(Product.CREATED); product.setType(Product.Type.Accommodation.name()); product.setUnit(Unit.DAY); product.setWebaddress(accommodation.getUrl()); product.setVersion(version); // Search location by specific Interhome Code. codeinterhome = accommodation.getCountry() + "." + accommodation.getPlace(); Location location = new Location(); try { location.setCodeinterhome(codeinterhome); location = sqlSession.getMapper(LocationMapper.class).interhomeSearch(location); //location = getLocation(sqlSession, codeinterhome); } catch (Throwable x) { LOG.error("Location error for Accommodation: " + accommodation.getCode() + ", country: " + accommodation.getCountry() + ", region: " + accommodation.getRegion() + ", code: " + accommodation.getPlace() + ". Error: " + x.getMessage()); } if (location == null) { sb.append("\n") .append("Accommodation: " + accommodation.getCode() + " country: " + accommodation.getCountry() + " region: " + accommodation.getRegion() + " code: " + accommodation.getPlace()); product.setState(Product.SUSPENDED); } else { product.setLocationid(location.getId()); } String name = accommodation.getName(); product.setName(name == null || name.trim().isEmpty() ? getPropType(accommodation.getType()) + " " + (location == null ? "" : location.getName()) : getPropType(accommodation.getType()) + " " + name.trim()); sqlSession.getMapper(ProductMapper.class).update(product); if (accommodation.getBrand() != null) { product.setValue(Product.Value.Brand.name(), accommodation.getBrand()); } if (accommodation.getRegion() != null) { product.setValue(Product.Value.Region.name(), accommodation.getRegion()); } if (accommodation.getMaxrentalprice() != null) { product.setDoubleValue(Product.Value.Maxrentalprice.name(), accommodation.getMaxrentalprice().doubleValue()); } if (accommodation.getMinrentalprice() != null) { product.setDoubleValue(Product.Value.Minrentalprice.name(), accommodation.getMinrentalprice().doubleValue()); } if (accommodation.getSqm() != null) { product.setIntegerValue(Product.Value.SquareMetre.name(), accommodation.getSqm().intValue()); } if (accommodation.getFloor() != null) { product.setValue(Product.Value.Floor.name(), accommodation.getFloor()); } addType(attributes, accommodation.getType()); if (accommodation.getAttributes() != null && accommodation.getAttributes().getAttribute() != null) { for (String attribute : accommodation.getAttributes().getAttribute()) { addAttribute(attributes, attribute); } } if (accommodation.getDetails() != null) { addDetail(attributes, accommodation.getDetails()); } addQuality(attributes, String.valueOf(accommodation.getQuality())); if (accommodation.getThemes() != null && accommodation.getThemes().getTheme() != null) { for (String theme : accommodation.getThemes().getTheme()) { addTheme(attributes, theme); } } RelationService.replace(sqlSession, Relation.PRODUCT_VALUE, product.getId(), product.getValues()); RelationService.create(sqlSession, Relation.PRODUCT_ATTRIBUTE, product.getId(), attributes); RelationService.removeDeprecatedData(sqlSession, Relation.PRODUCT_ATTRIBUTE, product.getId(), attributes); /* StringBuilder description = new StringBuilder(); Distances distances = accommodation.getDistances(); if (distances != null && distances.getDistance() != null) { description.append("Distances to:"); for (Distance distance : distances.getDistance()) { description.append(" ") .append(getDistance(distance.getType())) .append(" ") .append(distance.getValue()) .append("m "); } description.append("\n"); } Text action = new Text(product.getPublicId(), Language.Code.en.name()); Text text = sqlSession.getMapper(TextMapper.class).readbyexample(action); if (text == null) {text = new Text(product.getPublicId(), product.getPublicLabel(), Text.Type.HTML, new Date(), "", Language.Code.en.name());} text.setState(Text.State.Created.name()); text.setNotes(description.toString()); product.setPublicText(text); TextService.update(sqlSession, product.getTexts());*/ if (HasUrls.LIVE && accommodation.getPictures() != null && accommodation.getPictures().getPicture() != null) { ArrayList<NameId> images = new ArrayList<NameId>(); List<Picture> pictures = accommodation.getPictures().getPicture(); int k = 0; for (Picture picture : pictures) { if (picture.getType().equalsIgnoreCase("M")) { String imageid = getImage(picture.getType()) + " " + getImage(picture.getSeason()); images.add(new NameId(imageid, picture.getUrl().replace("partner-medium", "partner-xlarge"))); pictures.remove(k); break; } k++; } k = 0; while (k < pictures.size()) { Picture picture = pictures.get(k); if (picture.getType().equalsIgnoreCase("I")) { String imageid = getImage(picture.getType()) + " " + getImage(picture.getSeason()); images.add(new NameId(imageid, picture.getUrl().replace("partner-medium", "partner-xlarge"))); pictures.remove(k); } else k++; } for (Picture picture : pictures) { try { String imageid = getImage(picture.getType()) + " " + getImage(picture.getSeason()); images.add(new NameId(imageid, picture.getUrl().replace("partner-medium", "partner-xlarge"))); } catch (Throwable x) { LOG.error("\nURL error " + picture.getUrl()); } } UploadFileService.uploadImages(sqlSession, NameId.Type.Product, product.getId(), Language.EN, images); } sqlSession.commit(); LOG.debug(i++ + " " + accommodation.getCode() + " = " + product.getId()); // wait(getProductwait()); } catch (Throwable x) { LOG.error(accommodation + " error " + x.getMessage()); } // TODO: CJM if (i > 10) break; } Product action = new Product(); action.setAltpartyid(getAltpartyid()); action.setState(Product.CREATED); action.setVersion(version); sqlSession.getMapper(ProductMapper.class).cancelversion(action); sqlSession.commit(); LOG.debug("Missing Places" + sb.toString()); /* Language.Code language = Language.Code.en; readDescriptions(sqlSession, "outsidedescription_" + language.name() + ".xml", language, "House/Residence", false); readDescriptions(sqlSession, "insidedescription_" + language.name() + ".xml", language, "Interior", false); language = Language.Code.de; readDescriptions(sqlSession, "outsidedescription_" + language.name() + ".xml", language, "Haus/Residenz", true); readDescriptions(sqlSession, "insidedescription_" + language.name() + ".xml", language, "Innenbereich", false); language = Language.Code.fr; readDescriptions(sqlSession, "outsidedescription_" + language.name() + ".xml", language, "La maison/la rsidence de vacances", true); readDescriptions(sqlSession, "insidedescription_" + language.name() + ".xml", language, "L'intrieur du logement", false); language = Language.Code.es; readDescriptions(sqlSession, "outsidedescription_" + language.name() + ".xml", language, "Haus/Residenz", true); readDescriptions(sqlSession, "insidedescription_" + language.name() + ".xml", language, "Innenbereich", false); */ } catch (Throwable x) { sqlSession.rollback(); LOG.error(x.getMessage()); } finally { sqlSession.close(); delete(fn); } //MonitorService.monitor(message, timestamp); }
From source file:fi.foyt.fni.materials.MaterialController.java
public Material findMaterialByCompletePath(String completePath) { String path = RequestUtils.stripTrailingSlash(completePath); String materialPath = RequestUtils.stripPrecedingSlash(path.substring(MATERIALS_PATH.length() + 1)); PermaLink permaLink = permaLinkDAO.findByPath(materialPath); if (permaLink != null) { return permaLink.getMaterial(); }/*from w w w. ja v a 2 s . c o m*/ String[] pathElements = materialPath.split("/"); if (pathElements.length >= 2) { String userIdPart = pathElements[0]; if (!NumberUtils.isNumber(userIdPart)) { return null; } Long userId = NumberUtils.createLong(userIdPart); if (userId == null) { return null; } User owner = userDAO.findById(userId); if (owner == null) { return null; } Folder parentFolder = null; for (int i = 1, l = pathElements.length - 1; i < l; i++) { String pathElement = pathElements[i]; if (parentFolder != null) parentFolder = (Folder) materialDAO.findByParentFolderAndUrlName(parentFolder, pathElement); else parentFolder = (Folder) materialDAO.findByRootFolderAndUrlName(owner, pathElement); } if (parentFolder != null) return materialDAO.findByParentFolderAndUrlName(parentFolder, pathElements[pathElements.length - 1]); else return materialDAO.findByRootFolderAndUrlName(owner, pathElements[pathElements.length - 1]); } return null; }
From source file:com.ah.be.common.NmsUtil.java
public static String changeNumberSequence2NumberSestion(String numberSeq) { final String regex_comma = ",", regex_oneSpace = " ", regex_catenation = "-"; if (StringUtils.isNotBlank(numberSeq)) { String[] numberStrs = numberSeq.split(regex_comma); if (null != numberStrs) { List<Integer> numberSeqList = new ArrayList<>(); List<String> numberStrSectionList = new ArrayList<>(); for (String numberStr : numberStrs) { if (NumberUtils.isNumber(numberStr.trim())) { Integer number = Integer.valueOf(numberStr.trim()); if (!numberSeqList.contains(number)) { numberSeqList.add(number); }/* www .j a v a 2s. c o m*/ } } if (!numberSeqList.isEmpty()) { final int size = numberSeqList.size(); if (size == 1) { return numberSeqList.get(0).toString(); } else { Collections.sort(numberSeqList); int start = 0, end = 0; for (int i = 0; i < size; i++) { int cur = numberSeqList.get(i).intValue(); if (end == 0) { start = cur; } int next = i + 1 >= size ? 0 : numberSeqList.get(i + 1).intValue(); if (cur + 1 == next) { end = next; } else { numberStrSectionList.add(start + (end == 0 ? "" : (start + 1 == end ? regex_comma + regex_oneSpace : regex_catenation) + end)); end = 0; } } String[] numberSectionArray = numberStrSectionList.toArray(new String[0]); return StringUtils.join(numberSectionArray, regex_comma + regex_oneSpace); } } } } return null; }
From source file:com.dominion.salud.mpr.negocio.service.tratamientos.impl.DispensacionesServiceImpl.java
/** * * @param message//from ww w.j ava2 s .com * @throws Exception */ @Override @Transactional(noRollbackFor = { NoResultException.class }, rollbackFor = { Exception.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<>(); int contador = 0; try { ZDS_O13 hl7message = (ZDS_O13) new ER7Parser().parse(message); PID pid = hl7message.getPATIENT().getPID(); PV1 pv1 = hl7message.getPATIENT().getPATIENT_VISIT().getPV1(); List<ZDS_O13_ORDER> zds_o13_orders = hl7message.getORDERAll(); for (ZDS_O13_ORDER zds_o13_order : zds_o13_orders) { ORC orc = zds_o13_order.getORC(); TQ1 tq1 = zds_o13_order.getTIMING().getTQ1(); RXD rxd = zds_o13_order.getRXD(); Z01 z01 = (Z01) zds_o13_order.getZ01(); OBX obx = zds_o13_order.getOBSERVATION().getOBX(); //Z01.15 - Datos del Acuerdo logger.debug(" Procesando datos del ACUERDO (" + z01.getAcuerdo().getIdentifier().getValue() + ") " + z01.getAcuerdo().getText().getValue()); Acuerdos acuerdos = null; if (StringUtils.isNotBlank(z01.getAcuerdo().getIdentifier().getValue())) { try { acuerdos = new Acuerdos(); acuerdos.setCodAcuerdo(z01.getAcuerdo().getIdentifier().getValue()); acuerdos = acuerdosService.findByCodAcuerdo(acuerdos); logger.debug(" Z01.15 - Datos del Acuerdo: " + (acuerdos != null ? acuerdos.toString() : "null")); } catch (NoResultException nre) { acuerdos = null; logger.debug(" El movimiento no coincide con ningun ACUERDO"); } } else { logger.debug(" El movimiento no coincide con ningun ACUERDO"); } //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 logger.debug(" PID.5 - Paciente: " + pacientes.toString()); //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 String cod_episodio = ""; logger.debug(" Procesando datos del CODIGO DE EPISODIO (" + pv1.getVisitNumber().getIDNumber().getValue() + ")"); //PV1.19.1 if (StringUtils.isNotBlank(pv1.getVisitNumber().getIDNumber().getValue())) { cod_episodio = pv1.getVisitNumber().getIDNumber().getValue(); logger.debug(" PV1.19.1 - Codigo de Episodio: " + cod_episodio); } 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 Dispensacion String cod_dispensacion = null; logger.debug(" Procesando CODIGO DE DISPENSACION (" + orc.getFillerOrderNumber().getEntityIdentifier().getValue() + ")"); //ORC.2.1 if (StringUtils.isNotBlank(orc.getFillerOrderNumber().getEntityIdentifier().getValue())) { cod_dispensacion = orc.getFillerOrderNumber().getEntityIdentifier().getValue(); logger.debug(" ORC.3.1 - Codigo de Dispensacion: " + cod_dispensacion); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO ORC.3.1 - CODIGO DE DISPENSACION (" + orc.getFillerOrderNumber().getEntityIdentifier().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: CODIGO DE DISPENSACION"); } //CRITERIOS DE INCLUSION //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 (acuerdos != null) { if (acuerdos.getSexos() != null) { //Es un criterio de inclusion del acuerdo if (StringUtils.isNotBlank(pid.getAdministrativeSex().getValue())) { logger.error( " No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo PID.8 - SEXO (" + pid.getAdministrativeSex().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: SEXO (" + pid.getAdministrativeSex().getValue() + ")"); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION para el criterio de inclusion en el campo PID.8 - SEXO"); resultado.add( "No se puede procesar el movimiento sin INFORMACION para el CRITERIO DE INCLUSION: SEXO"); } } else if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(pid.getAdministrativeSex().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo PID.8 - SEXO (" + pid.getAdministrativeSex().getValue() + ")"); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: SEXO (" + pid.getAdministrativeSex().getValue() + ")"); } } } } //Z01.6 - Indicacion logger.debug( " Procesando datos de la INDICACION (" + z01.getIndicacion().getIdentifier().getValue() + ") " + z01.getIndicacion().getText().getValue()); IndicacionesExt indicacionesExt = new IndicacionesExt(); try { indicacionesExt.setCentros(centros); indicacionesExt.setCodIndicacionExt(z01.getIndicacion().getIdentifier().getValue()); //Z01.6.1 indicacionesExt.setTxtIndicacionExt(z01.getIndicacion().getText().getValue()); //Z01.6.2 indicacionesExt = indicacionesExtService.traducirEquivalenciaAndInsert(indicacionesExt); logger.debug(" Z01.6 - Indicacion: " + indicacionesExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (acuerdos.getAcuIndicacioneses() != null && !acuerdos.getAcuIndicacioneses().isEmpty()) { //Es un criterio de inclusion del acuerdo if (StringUtils.isNotBlank(z01.getIndicacion().getIdentifier().getValue())) { logger.error( " No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo Z01.6 - INDICACION (" + z01.getIndicacion().getIdentifier().getValue() + ") " + z01.getIndicacion().getText().getValue()); resultado.add( "No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: INDICACION (" + z01.getIndicacion().getIdentifier().getValue() + ") " + z01.getIndicacion().getText().getValue()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION para el criterio de inclusion en el campo Z01.6 - INDICACION"); resultado.add( "No se puede procesar el movimiento sin INFORMACION para el CRITERIO DE INCLUSION: INDICACION"); } } else if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(z01.getIndicacion().getIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo Z01.6 - INDICACION (" + z01.getIndicacion().getIdentifier().getValue() + ") " + z01.getIndicacion().getText().getValue()); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: INDICACION (" + z01.getIndicacion().getIdentifier().getValue() + ") " + z01.getIndicacion().getText().getValue()); } } } } //Z01.5 - Linea de Tratamiento logger.debug(" Procesando datos de la LINEA DE TRATAMIENTO (" + z01.getLineaTrat().getIdentifier().getValue() + ") " + z01.getLineaTrat().getText().getValue()); LineasTratExt lineasTratExt = new LineasTratExt(); try { lineasTratExt.setCentros(centros); lineasTratExt.setCodLineaTratExt(z01.getLineaTrat().getIdentifier().getValue()); //Z01.5.1 lineasTratExt.setTxtLineaTratExt(z01.getLineaTrat().getText().getValue()); //Z01.5.2 lineasTratExt = lineasTratExtService.traducirEquivalenciaAndInsert(lineasTratExt); logger.debug(" Z01.5 - Linea de Tratamiento: " + lineasTratExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (acuerdos.getAcuLineasTrats() != null && !acuerdos.getAcuLineasTrats().isEmpty()) { //Es un criterio de inclusion del acuerdo if (StringUtils.isNotBlank(z01.getLineaTrat().getIdentifier().getValue())) { logger.error( " No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo Z01.5 - LINEA DE TRATAMIENTO (" + z01.getLineaTrat().getIdentifier().getValue() + ") " + z01.getLineaTrat().getText().getValue()); resultado.add( "No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: LINEA DE TRATAMIENTO (" + z01.getLineaTrat().getIdentifier().getValue() + ") " + z01.getLineaTrat().getText().getValue()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION para el criterio de inclusion en el campo Z01.5 - LINEA DE TRATAMIENTO"); resultado.add( "No se puede procesar el movimiento sin INFORMACION para el CRITERIO DE INCLUSION: LINEA DE TRATAMIENTO"); } } else if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(z01.getLineaTrat().getIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo Z01.5 - LINEA DE TRATAMIENTO (" + z01.getLineaTrat().getIdentifier().getValue() + ") " + z01.getLineaTrat().getText().getValue()); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: LINEA DE TRATAMIENTO (" + z01.getLineaTrat().getIdentifier().getValue() + ") " + z01.getLineaTrat().getText().getValue()); } } } } //Z01.2[] - Situaciones Clinicas de Partida logger.debug( " Procesando SITUACIONES CLINICAS DE PARTIDA y VALORES DE SITUACION CLINICA DE PARTIDA"); List<EpiSitClinica> epiSitClinicas = new ArrayList<>(); if (z01.getSituacionClinica() != null && z01.getSituacionClinica().length > 0) { for (int i = 0; i < z01.getSituacionClinica().length; i++) { logger.debug(" Procesando SITUACION CLINICA DE PARTIDA (" + z01.getSituacionClinica(i).getIdentifier().getValue() + ") " + z01.getSituacionClinica(i).getText().getValue()); try { SitClinicaExt sitClinicaExt = new SitClinicaExt(); sitClinicaExt.setCentros(centros); sitClinicaExt .setCodSitClinicaExt(z01.getSituacionClinica(i).getIdentifier().getValue()); //Z01.2.1 sitClinicaExt.setTxtSitClinicaExt(z01.getSituacionClinica(i).getText().getValue()); //Z01.2.2 sitClinicaExt = sitClinicaExtService.traducirEquivalenciaAndInsert(sitClinicaExt); logger.debug( " Z01.2.(1,2) - Situacion Clinica: " + sitClinicaExt.toString()); EpiSitClinica epiSitClinica = new EpiSitClinica(); epiSitClinica.setEpisodios(episodios); epiSitClinica.setSitClinica(sitClinicaExt.getSitClinica()); epiSitClinicas.add(epiSitClinica); //Z01.2.(4,5) - Valores de Situacion Clinica de Partida List<EpiValSitClinica> epiValSitClinicas = new ArrayList<>(); logger.debug(" Procesando VALOR DE SITUACION CLINICA DE PARTIDA (" + z01.getSituacionClinica(i).getAlternateIdentifier().getValue() + ") " + z01.getSituacionClinica(i).getAlternateText().getValue() + " [" + z01.getSituacionClinica(i).getNameOfAlternateCodingSystem() + "]"); if (StringUtils .isNotBlank(z01.getSituacionClinica(i).getAlternateIdentifier().getValue())) { try { logger.debug(" Procesando VALOR DE SITUACION CLINICA DE PARTIDA (" + z01.getSituacionClinica(i).getAlternateIdentifier().getValue() + ") " + z01.getSituacionClinica(i).getAlternateText().getValue()); ValSitClinicaExt valSitClinicaExt = new ValSitClinicaExt(); valSitClinicaExt.setCentros(centros); valSitClinicaExt.setCodValSitClinicaExt( z01.getSituacionClinica(i).getAlternateIdentifier().getValue()); //Z01.2.4 valSitClinicaExt.setTxtValSitClinicaExt( z01.getSituacionClinica(i).getAlternateText().getValue()); //Z01.2.5 valSitClinicaExt = valSitClinicaExtService .traducirEquivalenciaAndInsert(valSitClinicaExt); logger.debug( " Z01.2.(4,5) - Valor de Situacion Clinica de Partida: " + valSitClinicaExt.toString()); EpiValSitClinica epiValSitClinica = new EpiValSitClinica(); epiValSitClinica.setEpiSitClinica(epiSitClinica); epiValSitClinica.setValSitClinica(valSitClinicaExt.getValSitClinica()); epiValSitClinicas.add(epiValSitClinica); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (acuerdos.getAcuSitClinicas() != null && !acuerdos.getAcuSitClinicas().isEmpty()) { //Es un criterio de inclusion del acuerdo if (StringUtils.isNotBlank(z01.getSituacionClinica(i) .getAlternateIdentifier().getValue())) { logger.error( " No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo Z01.2.(4,5) - VALOR DE SITUACION CLINICA DE PARTIDA (" + z01.getSituacionClinica(i) .getAlternateIdentifier().getValue() + ") " + z01.getSituacionClinica(i) .getAlternateText().getValue()); resultado.add( "No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: VALOR DE SITUACION CLINICA DE PARTIDA (" + z01.getSituacionClinica(i) .getAlternateIdentifier().getValue() + ") " + z01.getSituacionClinica(i) .getAlternateText().getValue()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION para el criterio de inclusion en el campo Z01.2.(4,5) - VALOR DE SITUACION CLINICA DE PARTIDA"); resultado.add( "No se puede procesar el movimiento sin INFORMACION para el CRITERIO DE INCLUSION: VALOR DE SITUACION CLINICA DE PARTIDA"); } } else if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(z01.getSituacionClinica(i) .getAlternateIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo Z01.2.(4,5) - VALOR DE SITUACION CLINICA DE PARTIDA (" + z01.getSituacionClinica(i) .getAlternateIdentifier().getValue() + ") " + z01.getSituacionClinica(i) .getAlternateText().getValue()); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: VALOR DE SITUACION CLINICA DE PARTIDA (" + z01.getSituacionClinica(i) .getAlternateIdentifier().getValue() + ") " + z01.getSituacionClinica(i) .getAlternateText().getValue()); } } } } } else if (StringUtils.isNotBlank( z01.getSituacionClinica(i).getNameOfAlternateCodingSystem().getValue())) { logger.debug(" Procesando VALOR DE SITUACION CLINICA DE PARTIDA (" + z01.getSituacionClinica(i).getNameOfAlternateCodingSystem().getValue() + ")"); EpiValSitClinica epiValSitClinica = new EpiValSitClinica(); epiValSitClinica.setEpiSitClinica(epiSitClinica); epiValSitClinica.setValor( z01.getSituacionClinica(i).getNameOfAlternateCodingSystem().getValue()); epiValSitClinicas.add(epiValSitClinica); } epiSitClinica.setEpiValSitClinicas(epiValSitClinicas); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (acuerdos.getAcuSitClinicas() != null && !acuerdos.getAcuSitClinicas().isEmpty()) { //Es un criterio de inclusion del acuerdo if (StringUtils .isNotBlank(z01.getSituacionClinica(i).getIdentifier().getValue())) { logger.error( " No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo Z01.2.(1,2) - SITUACION CLINICA DE PARTIDA (" + z01.getSituacionClinica(i).getIdentifier().getValue() + ") " + z01.getSituacionClinica(i).getText().getValue()); resultado.add( "No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: SITUACION CLINICA DE PARTIDA (" + z01.getSituacionClinica(i).getIdentifier().getValue() + ") " + z01.getSituacionClinica(i).getText().getValue()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION para el criterio de inclusion en el campo Z01.2.(1,2) - SITUACION CLINICA DE PARTIDA"); resultado.add( "No se puede procesar el movimiento sin INFORMACION para el CRITERIO DE INCLUSION: SITUACION CLINICA DE PARTIDA"); } } else if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils .isNotBlank(z01.getSituacionClinica(i).getIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo Z01.2.(1,2) - SITUACION CLINICA DE PARTIDA (" + z01.getSituacionClinica(i).getIdentifier().getValue() + ") " + z01.getSituacionClinica(i).getText().getValue()); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: SITUACION CLINICA DE PARTIDA (" + z01.getSituacionClinica(i).getIdentifier().getValue() + ") " + z01.getSituacionClinica(i).getText().getValue()); } } } } } } //Z01.3[] - Marcadores Biologicos logger.debug(" Procesando MARCADORES BIOLOGICOS y VALORES DE MARCADOR BIOLOGICO"); List<EpiMarcaBio> epiMarcaBios = new ArrayList<>(); if (z01.getMarcadorBiologico() != null && z01.getMarcadorBiologico().length > 0) { for (int i = 0; i < z01.getMarcadorBiologico().length; i++) { logger.debug(" Procesando MARCADOR BIOLOGICO (" + z01.getMarcadorBiologico(i).getIdentifier().getValue() + ") " + z01.getMarcadorBiologico(i).getText().getValue()); try { MarcaBioExt marcaBioExt = new MarcaBioExt(); marcaBioExt.setCentros(centros); marcaBioExt.setCodMarcaBioExt(z01.getMarcadorBiologico(i).getIdentifier().getValue()); //Z01.2.1 marcaBioExt.setTxtMarcaBioExt(z01.getMarcadorBiologico(i).getText().getValue()); //Z01.2.2 marcaBioExt = marcaBioExtService.traducirEquivalenciaAndInsert(marcaBioExt); logger.debug( " Z01.3.(1,2) - Marcador Biologico: " + marcaBioExt.toString()); EpiMarcaBio epiMarcaBio = new EpiMarcaBio(); epiMarcaBio.setEpisodios(episodios); epiMarcaBio.setMarcaBio(marcaBioExt.getMarcaBio()); epiMarcaBios.add(epiMarcaBio); //Z01.3.(4,5) - Valores de Marcador Biologico List<EpiValMarcaBio> epiValMarcaBios = new ArrayList<>(); logger.debug(" Procesando VALOR DE MARCADOR BIOLOGICO (" + z01.getMarcadorBiologico(i).getAlternateIdentifier().getValue() + ") " + z01.getMarcadorBiologico(i).getAlternateText().getValue() + " [" + z01.getMarcadorBiologico(i).getNameOfAlternateCodingSystem().getValue() + "]"); if (StringUtils .isNotBlank(z01.getMarcadorBiologico(i).getAlternateIdentifier().getValue())) { try { logger.debug(" Procesando VALOR DE MARCADOR BIOLOGICO (" + z01.getMarcadorBiologico(i).getAlternateIdentifier().getValue() + ") " + z01.getMarcadorBiologico(i).getAlternateText().getValue()); ValMarcaBioExt valMarcaBioExt = new ValMarcaBioExt(); valMarcaBioExt.setCentros(centros); valMarcaBioExt.setCodValMarcaBioExt( z01.getMarcadorBiologico(i).getAlternateIdentifier().getValue()); //Z01.3.4 valMarcaBioExt.setTxtValMarcaBioExt( z01.getMarcadorBiologico(i).getAlternateText().getValue()); //Z01.3.5 valMarcaBioExt = valMarcaBioExtService .traducirEquivalenciaAndInsert(valMarcaBioExt); logger.debug(" Z01.3.(4,5) - Valor de Marcador Biologico: " + valMarcaBioExt.toString()); EpiValMarcaBio epiValMarcaBio = new EpiValMarcaBio(); epiValMarcaBio.setEpiMarcaBio(epiMarcaBio); epiValMarcaBio.setValMarcaBio(valMarcaBioExt.getValMarcaBio()); epiValMarcaBios.add(epiValMarcaBio); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (acuerdos.getAcuMarcaBios() != null && !acuerdos.getAcuMarcaBios().isEmpty()) { //Es un criterio de inclusion del acuerdo if (StringUtils.isNotBlank(z01.getMarcadorBiologico(i) .getAlternateIdentifier().getValue())) { logger.error( " No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo Z01.3.(4,5) - VALOR DE MARCADOR BIOLOGICO (" + z01.getMarcadorBiologico(i) .getAlternateIdentifier().getValue() + ") " + z01.getMarcadorBiologico(i) .getAlternateText().getValue()); resultado.add( "No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: VALOR DE MARCADOR BIOLOGICO (" + z01.getMarcadorBiologico(i) .getAlternateIdentifier().getValue() + ") " + z01.getMarcadorBiologico(i) .getAlternateText().getValue()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION para el criterio de inclusion en el campo Z01.3.(4,5) - VALOR DE MARCADOR BIOLOGICO"); resultado.add( "No se puede procesar el movimiento sin INFORMACION para el CRITERIO DE INCLUSION: VALOR DE MARCADOR BIOLOGICO"); } } else if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(z01.getMarcadorBiologico(i) .getAlternateIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo Z01.3.(4,5) - VALOR DE MARCADOR BIOLOGICO (" + z01.getMarcadorBiologico(i) .getAlternateIdentifier().getValue() + ") " + z01.getMarcadorBiologico(i) .getAlternateText().getValue()); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: VALOR DE MARCADOR BIOLOGICO (" + z01.getMarcadorBiologico(i) .getAlternateIdentifier().getValue() + ") " + z01.getMarcadorBiologico(i) .getAlternateText().getValue()); } } } } } else if (StringUtils.isNotBlank( z01.getMarcadorBiologico(i).getNameOfAlternateCodingSystem().getValue())) { logger.debug(" Procesando VALOR DE MARCADOR BIOLOGICO (" + z01.getMarcadorBiologico(i).getNameOfAlternateCodingSystem().getValue() + ")"); EpiValMarcaBio epiValMarcaBio = new EpiValMarcaBio(); epiValMarcaBio.setEpiMarcaBio(epiMarcaBio); epiValMarcaBio.setValor( z01.getMarcadorBiologico(i).getNameOfAlternateCodingSystem().getValue()); epiValMarcaBios.add(epiValMarcaBio); } epiMarcaBio.setEpiValMarcaBios(epiValMarcaBios); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (acuerdos.getAcuMarcaBios() != null && !acuerdos.getAcuMarcaBios().isEmpty()) { //Es un criterio de inclusion del acuerdo if (StringUtils .isNotBlank(z01.getMarcadorBiologico(i).getIdentifier().getValue())) { logger.error( " No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo Z01.3.(1,2) - MARCADOR BIOLOGICO (" + z01.getMarcadorBiologico(i).getIdentifier().getValue() + ") " + z01.getMarcadorBiologico(i).getText().getValue()); resultado.add( "No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: MARCADOR BIOLOGICO (" + z01.getMarcadorBiologico(i).getIdentifier().getValue() + ") " + z01.getMarcadorBiologico(i).getText().getValue()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION para el criterio de inclusion en el campo Z01.3.(1,2) - MARCADOR BIOLOGICO"); resultado.add( "No se puede procesar el movimiento sin INFORMACION para el CRITERIO DE INCLUSION: MARCADOR BIOLOGICO"); } } else if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils .isNotBlank(z01.getMarcadorBiologico(i).getIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo Z01.3.(1,2) - MARCADOR BIOLOGICO (" + z01.getMarcadorBiologico(i).getIdentifier().getValue() + ") " + z01.getMarcadorBiologico(i).getText().getValue()); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: MARCADOR BIOLOGICO (" + z01.getMarcadorBiologico(i).getIdentifier().getValue() + ") " + z01.getMarcadorBiologico(i).getText().getValue()); } } } } } } //RXD.21 - Programas y Diagnosticos ProgramasExt programasExt = new ProgramasExt(); Diagnosticos diagnosticos = null; for (int i = 0; i < rxd.getIndication().length; i++) { if (StringUtils.equalsIgnoreCase(rxd.getIndication(i).getNameOfCodingSystem().getValue(), "I9C")) { //RXD.21 - Diagnostico logger.debug(" Procesando datos del DIAGNOSTICO (" + rxd.getIndication(i).getIdentifier().getValue() + ") " + rxd.getIndication(i).getText().getValue()); try { diagnosticos = new Diagnosticos(); diagnosticos.setCodDiagnostico(rxd.getIndication(i).getIdentifier().getValue()); //RXD.21.1 diagnosticos.setTxtDiagnostico(rxd.getIndication(i).getText().getValue()); //RXD.21.2 diagnosticos = diagnosticosService.findByCodDiagnostico(diagnosticos); logger.debug(" RXD.21(I9C) - Diagnostico: " + diagnosticos.toString()); } catch (NoResultException nre) { diagnosticos = null; if (acuerdos != null) { if (acuerdos.getAcuDiagnosticoses() != null && !acuerdos.getAcuDiagnosticoses().isEmpty()) { //Es un criterio de inclusion del acuerdo if (StringUtils.isNotBlank(rxd.getIndication(i).getIdentifier().getValue())) { logger.error( " No se puede procesar el movimiento sin INFORMACION para el criterio de inclusion en el campo RXD.21(I9C) - DIAGNOSTICO (" + rxd.getIndication(i).getIdentifier().getValue() + ") " + rxd.getIndication(i).getText().getValue()); resultado.add( "No se puede procesar el movimiento sin INFORMACION para el CRITERIO DE INCLUSION: DIAGNOSTICO (" + rxd.getIndication(i).getIdentifier().getValue() + ") " + rxd.getIndication(i).getText().getValue()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION para el criterio de inclusion en el campo RXD.21(I9C) - DIAGNOSTICO"); resultado.add( "No se puede procesar el movimiento sin INFORMACION para el CRITERIO DE INCLUSION: DIAGNOSTICO"); } } } } } else if (StringUtils.equalsIgnoreCase(rxd.getIndication(i).getNameOfCodingSystem().getValue(), "PRDSP")) { //RXD.21 - Programa logger.debug(" Procesando datos del PROGRAMA (" + rxd.getIndication(i).getIdentifier().getValue() + ") " + rxd.getIndication(i).getText().getValue()); try { programasExt.setCentros(centros); programasExt.setCodProgramaExt(rxd.getIndication(i).getIdentifier().getValue()); //RXD.21.1 programasExt.setTxtProgramaExt(rxd.getIndication(i).getText().getValue()); //RXD.21.2 programasExt = programasExtService.traducirEquivalenciaAndInsert(programasExt); logger.debug(" RXD.21(PRDSP) - PROGRAMA: " + programasExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (acuerdos.getAcuProgramases() != null && !acuerdos.getAcuProgramases().isEmpty()) { //Es un criterio de inclusion del acuerdo if (StringUtils.isNotBlank(rxd.getIndication(i).getIdentifier().getValue())) { logger.error( " No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo RXD.21(PRDSP) - PROGRAMA (" + rxd.getIndication(i).getIdentifier().getValue() + ") " + rxd.getIndication(i).getText().getValue()); resultado.add( "No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: PROGRAMA (" + rxd.getIndication(i).getIdentifier().getValue() + ") " + rxd.getIndication(i).getText().getValue()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION para el criterio de inclusion en el campo RXD.21(PRDSP) - PROGRAMA"); resultado.add( "No se puede procesar el movimiento sin INFORMACION para el CRITERIO DE INCLUSION: PROGRAMA"); } } else if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(rxd.getIndication(i).getIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el criterio de inclusion en el campo RXD.21(PRDSP) - PROGRAMA (" + rxd.getIndication(i).getIdentifier().getValue() + ") " + rxd.getIndication(i).getText().getValue()); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CRITERIO DE INCLUSION: PROGRAMA (" + rxd.getIndication(i).getIdentifier().getValue() + ") " + rxd.getIndication(i).getText().getValue()); } } } } } } //PID.7 - Edad (Fecha de Nacimiento) Date fechaNacimiento = null; logger.debug(" Procesando datos de la EDAD (Fecha de Nacimiento) (" + pid.getDateTimeOfBirth().getTime().getValue() + ")"); try { fechaNacimiento = pid.getDateTimeOfBirth().getTime().getValueAsDate(); //PID.7 if (fechaNacimiento == null) { throw new Exception("No se ha indicado la fecha de nacimiento"); } } catch (Exception e) { if (acuerdos != null) { if (acuerdos.getAcuEdadeses() != null && !acuerdos.getAcuEdadeses().isEmpty()) { //Es un criterio de inclusion del acuerdo logger.error( " No se puede procesar el movimiento sin INFORMACION para el criterio de inclusion en el campo PID.7 - EDAD[Fecha de Nacimiento] (" + pid.getDateTimeOfBirth().getTime().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION para el CRITERIO DE INCLUSION: EDAD [Fecha de Nacimiento]"); } } } //OBX.3 - Peso Double peso = null; logger.debug(" Procesando datos del PESO (" + obx.getObservationIdentifier().getText().getValue() + ")"); try { peso = NumberUtils.toDouble(obx.getObservationIdentifier().getText().getValue()); //OBX.3 if (peso == null) { throw new Exception("No se ha indicado el peso"); } } catch (Exception e) { if (acuerdos != null) { if (acuerdos.getAcuPesoses() != null && !acuerdos.getAcuPesoses().isEmpty()) { //Es un criterio de inclusion del acuerdo logger.error( " No se puede procesar el movimiento sin INFORMACION para el criterio de inclusion en el campo OBX.3 - PESO (" + obx.getObservationIdentifier().getText().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION para el CRITERIO DE INCLUSION: PESO"); } } } //MAESTROS GENERALES //Z01.1 - Tipo de Uso logger.debug(" Procesando datos del TIPO DE USO (" + z01.getTipoUso().getIdentifier().getValue() + ") " + z01.getTipoUso().getText().getValue()); TiposUsoExt tiposUsoExt = new TiposUsoExt(); try { tiposUsoExt.setCentros(centros); tiposUsoExt.setCodTipoUsoExt(z01.getTipoUso().getIdentifier().getValue()); //Z01.1.1 tiposUsoExt.setTxtTipoUsoExt(z01.getTipoUso().getText().getValue()); //Z01.1.2 tiposUsoExt = tiposUsoExtService.traducirEquivalenciaAndInsert(tiposUsoExt); logger.debug(" Z01.1 - Tipo de Uso: " + tiposUsoExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(z01.getTipoUso().getIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO Z01.6 - TIPO DE USO (" + z01.getTipoUso().getIdentifier().getValue() + ") " + z01.getTipoUso().getText().getValue()); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO: TIPO DE USO (" + z01.getTipoUso().getIdentifier().getValue() + ") " + z01.getTipoUso().getText().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()); } //RXD.5 - Formas Farmaceutica logger.debug(" Procesando la FORMA FARMACEUTICA DE LA DOSIS DISPENSADA (" + rxd.getActualDispenseUnits().getIdentifier().getValue() + ") " + rxd.getActualDispenseUnits().getText().getValue()); FormasFarExt formasFarExt = new FormasFarExt(); try { formasFarExt.setCentros(centros); formasFarExt.setCodFormaFarExt(rxd.getActualDispenseUnits().getIdentifier().getValue()); //RXD.5.1 formasFarExt.setTxtFormaFarExt(rxd.getActualDispenseUnits().getText().getValue()); //RXD.5.2 formasFarExt = formasFarExtService.traducirEquivalenciaAndInsert(formasFarExt); logger.debug(" RXD.5 - Forma Farmaceutica de la Dosis Dispensada: " + formasFarExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(rxd.getActualDispenseUnits().getIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO RXD.5 - FORMA FARMACEUTICA(" + rxd.getActualDispenseUnits().getIdentifier().getValue() + ") " + rxd.getActualDispenseUnits().getText().getValue()); resultado.add( "El ACUERDO es REQUERIDO.No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO: FORMA FARMACEUTICA (" + rxd.getActualDispenseUnits().getIdentifier().getValue() + ") " + rxd.getActualDispenseUnits().getText().getValue()); } } } } //Z01.7 - Protocolos logger.debug(" Procesando datos del PROTOCOLO (" + z01.getProtocolo().getIdentifier().getValue() + ") " + z01.getProtocolo().getText().getValue()); ProtocolosExt protocolosExt = new ProtocolosExt(); try { protocolosExt.setCentros(centros); protocolosExt.setCodProtocoloExt(z01.getProtocolo().getIdentifier().getValue()); //Z01.7.1 protocolosExt.setTxtProtocoloExt(z01.getProtocolo().getText().getValue()); //Z01.7.2 protocolosExt = protocolosExtService.traducirEquivalenciaAndInsert(protocolosExt); logger.debug(" Z01.7 - Protocolo: " + protocolosExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(z01.getProtocolo().getIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO.No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO Z01.7 - PROTOCOLO (" + z01.getProtocolo().getIdentifier().getValue() + ") " + z01.getProtocolo().getText().getValue()); resultado.add( "EL ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO: PROTOCOLO (" + z01.getProtocolo().getIdentifier().getValue() + ") " + z01.getProtocolo().getText().getValue()); } } } } //Z01.8 - Servicios logger.debug(" Procesando datos del SERVICIO (" + z01.getServicio().getIdentifier().getValue() + ") " + z01.getServicio().getText().getValue()); ServiciosExt serviciosExt = new ServiciosExt(); try { serviciosExt.setCentros(centros); serviciosExt.setCodServicioExt(z01.getServicio().getIdentifier().getValue()); //Z01.8.1 serviciosExt.setTxtServicioExt(z01.getServicio().getText().getValue()); //Z01.8.2 serviciosExt = serviciosExtService.traducirEquivalenciaAndInsert(serviciosExt); logger.debug(" Z01.8 - Servicio: " + serviciosExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(z01.getServicio().getIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO Z01.8 - SERVICIO (" + z01.getServicio().getIdentifier().getValue() + ") " + z01.getServicio().getText().getValue()); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO: SERVICIO (" + z01.getServicio().getIdentifier().getValue() + ") " + z01.getServicio().getText().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 (acuerdos != null) { if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(z01.getUnidMedDosisPrescrita().getIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO Z01.10 - UNIDAD DE MEDIDA DE LA DOSIS PRESCRITA (" + z01.getUnidMedDosisPrescrita().getIdentifier().getValue() + ") " + z01.getUnidMedDosisPrescrita().getText().getValue()); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO: 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.15.1 secuenciasExt.setTxtSecuenciaExt(z01.getSecuencia().getText().getValue()); //Z01.15.2 secuenciasExt = secuenciasExtService.traducirEquivalenciaAndInsert(secuenciasExt); logger.debug(" Z01.13 - Secuencia: " + secuenciasExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(z01.getSecuencia().getIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO Z01.15 - SECUENCIA (" + z01.getSecuencia().getIdentifier().getValue() + ") " + z01.getSecuencia().getText().getValue()); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO: 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.16.1 pautasExt.setTxtPautaExt(z01.getPauta().getText().getValue()); //Z01.16.2 pautasExt = pautasExtService.traducirEquivalenciaAndInsert(pautasExt); logger.debug(" Z01.14 - Pauta: " + pautasExt.toString()); } catch (NoExisteEquivalenciaException neee) { if (acuerdos != null) { if (StringUtils.equals(acuerdos.getRequerido(), "S")) { if (StringUtils.isNotBlank(z01.getPauta().getIdentifier().getValue())) { logger.error( " El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO Z01.14 - PAUTA (" + z01.getPauta().getIdentifier().getValue() + ") " + z01.getPauta().getText().getValue()); resultado.add( "El ACUERDO es REQUERIDO. No se puede procesar el movimiento sin EQUIVALENCIA para el CAMPO: PAUTA (" + z01.getPauta().getIdentifier().getValue() + ") " + z01.getPauta().getText().getValue()); } } } } //OTRAS VALIDACIONES SIN NORMALIZACION //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() + ")"); } //RXD.2 - Marca logger.debug(" Procesando de la MARCA (" + rxd.getDispenseGiveCode().getIdentifier().getValue() + ") " + rxd.getDispenseGiveCode().getText().getValue()); Marcas marcas = new Marcas(); marcas.setCodNac(rxd.getDispenseGiveCode().getIdentifier().getValue()); //RXD.2.1 marcas.setTxtMarca(rxd.getDispenseGiveCode().getText().getValue()); //RXD.2.2 marcas = marcasService.findByCodNacAndInsert(marcas); if (marcas != null) { logger.debug(" RXD.2 - Marca: " + marcas.toString()); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el campo RXD.2 - MARCA (" + rxd.getDispenseGiveCode().getIdentifier().getValue() + ") " + rxd.getDispenseGiveCode().getText().getValue()); resultado.add("No se puede procesar el movimiento sin INFORMACION en el CAMPO: MARCA (" + rxd.getDispenseGiveCode().getIdentifier().getValue() + ") " + rxd.getDispenseGiveCode().getText().getValue()); } //RXD.3 - Fecha de la Dispensacion Date fecha_dispensacion = null; logger.debug(" Procesando FECHA DE LA DISPENSACION (" + rxd.getDateTimeDispensed().getTime().getValue() + ")"); //RXD.3 if (StringUtils.isNotBlank(rxd.getDateTimeDispensed().getTime().getValue()) && rxd.getDateTimeDispensed().getTime().getValueAsDate() != null) { fecha_dispensacion = rxd.getDateTimeDispensed().getTime().getValueAsDate(); logger.debug(" RXD.3 - Fecha de la Dispensacion: " + fecha_dispensacion); } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO: RXD.3 - FECHA DE LA DISPENSACION (" + rxd.getDateTimeDispensed().getTime().getValue() + ")"); resultado.add( "No se puede procesar el movimiento sin INFORMACION en el CAMPO: FECHA DE LA DISPENSACION (" + rxd.getDateTimeDispensed().getTime().getValue() + ")"); } //RXD.4 - Dosis Dispensada en Forma Farmaceutica Double dosis_dispensada = null; logger.debug(" Procesando datos de la DOSIS DISPENSADA (" + rxd.getActualDispenseAmount().getValue() + ")"); if (StringUtils.isNotBlank(rxd.getActualDispenseAmount().getValue()) && NumberUtils.isNumber(rxd.getActualDispenseAmount().getValue())) { try { dosis_dispensada = NumberUtils.createDouble(rxd.getActualDispenseAmount().getValue()); logger.debug(" RXD.4 - Dosis Dispensada: " + dosis_dispensada); } catch (Exception e) { resultado.add( "No se puede procesar el movimiento porque los datos en el campo RXD.4 - DOSIS PRESCRITA (" + rxd.getActualDispenseAmount().getValue() + ") NO son correctos"); } } else { logger.error( " No se puede procesar el movimiento sin INFORMACION en el CAMPO: RXD.4 - DOSIS PRESCRITA (" + rxd.getActualDispenseAmount().getValue() + ")"); resultado .add("No se puede procesar el movimiento sin INFORMACION en el CAMPO: DOSIS PRESCRITA (" + rxd.getActualDispenseAmount().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 INFORMACION 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.11 - Ciclo String ciclo = null; logger.debug(" Procesando datos de CICLO (" + z01.getCiclo().getValue() + ")"); if (StringUtils.isNotBlank(z01.getCiclo().getValue())) { ciclo = z01.getCiclo().getValue(); logger.debug(" Z01.11 - Ciclo: " + ciclo); } //Z01.12 - Dia Ciclo String dia_ciclo = null; logger.debug(" Procesando datos del DIA DE CICLO (" + z01.getDiaCiclo().getValue() + ")"); if (StringUtils.isNotBlank(z01.getDiaCiclo().getValue())) { dia_ciclo = z01.getDiaCiclo().getValue(); logger.debug(" Z01.12 - Dia de Ciclo: " + dia_ciclo); } //CONSULTA EMPI if (MPRConstantes._EMPI_ENABLE) { try { logger.debug(" Iniciando consulta EMPI (Usuario: " + MPRConstantes._EMPI_USUARIO + ", Sistema: " + MPRConstantes._EMPI_SISTEMA + ", URL: " + MPRConstantes._EMPI_URL + ")"); EMPIClient client = new EMPIClient(MPRConstantes._EMPI_USUARIO, MPRConstantes._EMPI_SISTEMA, MPRConstantes._EMPI_URL); logger.debug(" Obteniendo Registros por CIPA: (CIPA: " + pacientes.getCipa() + ")"); EMPIResponse response = client.obtenerRegistrosByCIPA(pacientes.getCipa()); if (response != null && response.getPaciente() != null) { logger.debug(" Respuesta obtenida: " + response.toString()); pacientes.setTxtNombre(response.getPaciente().getNombre()); pacientes.setTxtApellido1(response.getPaciente().getApellido1()); pacientes.setTxtApellido2(response.getPaciente().getApellido2()); fechaNacimiento = response.getPaciente().getFechaNacimiento().toGregorianCalendar() .getTime(); } else { logger.debug( " No se han obtenido datos de EMPI. Se emplearan los datos del mensaje HL7"); } } catch (Exception e) { logger.warn( "Se han producido errores al obtener datos de EMPI. Se emplearan los datos del mensaje HL7: " + e.getMessage()); } } //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() + ")"); if (StringUtils.isNotBlank(pacientes.getCipa())) { pacientes = pacientesService.findByCIPA(pacientes); } else { Episodios consulta = new Episodios(); consulta.setNhc(nhc); consulta.setCentros(centros); consulta = episodiosService.findByNHCIdCentro(consulta); pacientes = consulta.getPacientes(); } } catch (NoResultException nre) { logger.debug(" Almacenando datos del PACIENTE"); pacientes.setSexos(sexosExt.getSexos()); pacientes.setFechaNac(fechaNacimiento); pacientes = pacientesService.save(pacientes); } finally { logger.debug(" Paciente: " + pacientes.toString()); } //EPISODIO try { episodios.setNhc(nhc); episodios.setCentros(centros); episodios.setCodEpisodio(cod_episodio); episodios.setPacientes(pacientes); episodios.setProgramas(programasExt.getProgramas()); episodios.setServicio(serviciosExt.getServicios()); 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 { if (contador == 0) { //Solo la primera vez //EPI_MARCA_BIO y EPI_VAL_MARCA_BIO epiMarcaBioService.delete(episodios.getEpiMarcaBios()); if (epiMarcaBios != null && !epiMarcaBios.isEmpty()) { for (EpiMarcaBio epiMarcaBio : epiMarcaBios) { logger.debug( " Insertando Marcador Biologico: " + epiMarcaBio.toString()); epiMarcaBio.setEpisodios(episodios); epiMarcaBioService.save(epiMarcaBio); } } //EPI_SIT_CLINICA y EPI_VAL_SIT_CLINICA epiSitClinicaService.delete(episodios.getEpiSitClinicas()); if (epiSitClinicas != null && !epiSitClinicas.isEmpty()) { for (EpiSitClinica epiSitClinica : epiSitClinicas) { logger.debug( " Insertando Situacion Clinica: " + epiSitClinica.toString()); epiSitClinica.setEpisodios(episodios); epiSitClinicaService.save(epiSitClinica); } } } 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(), "-")[8], StringUtils.split(prescripciones.getCodPrescripcion(), "-")[8])) { 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.setUnidMed(unidMedExt.getUnidMed()); prescripciones.setFechaIni(fecha_ini_prescripcion); prescripciones.setPautas(pautasExt.getPautas()); prescripciones.setSecuencias(secuenciasExt.getSecuencias()); prescripciones = prescripcionesService.save(prescripciones); } finally { logger.debug(" Prescripcion: " + prescripciones.toString()); } //DISPENSACIONES logger.debug(" Almacenando datos de la DISPENSACION: (" + cod_dispensacion + ")"); Dispensaciones dispensaciones = new Dispensaciones(); try { dispensaciones.setCodDispensacion(cod_dispensacion); logger.debug(" Buscando DISPENSACION por COD_DISPENSACION (" + dispensaciones.getCodDispensacion() + ")"); dispensaciones = findByCodDispensacion(dispensaciones); dispensaciones.setCantidad(dosis_dispensada); logger.debug( " Actualizando CANTIDAD DISPENSADA de la DISPENSACION con COD_DISPENSACION (" + dispensaciones.getCodDispensacion() + ")"); } catch (NoResultException nre) { dispensaciones.setAcuerdos(acuerdos); dispensaciones.setPrescripciones(prescripciones); dispensaciones.setCantidad(dosis_dispensada); dispensaciones.setFormasFar(formasFarExt.getFormasFar()); dispensaciones.setFechaDisp(fecha_dispensacion); dispensaciones.setDiagnosticos(diagnosticos); dispensaciones.setIndicaciones(indicacionesExt.getIndicaciones()); dispensaciones.setLineasTrat(lineasTratExt.getLineasTrat()); dispensaciones.setProtocolos(protocolosExt.getProtocolos()); dispensaciones.setTiposUso(tiposUsoExt.getTiposUso()); dispensaciones.setPeso(peso); dispensaciones.setCiclo(ciclo); dispensaciones.setDiaCiclo(dia_ciclo); logger.debug(" Insertando nueva DISPENSACION con COD_DISPENSACION (" + dispensaciones.getCodDispensacion() + ")"); } finally { dispensaciones = save(dispensaciones); logger.debug(" Dispensacion: " + dispensaciones.toString()); } contador++; 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:caveworld.core.Config.java
public static void syncVeinsCfg() { if (veinsCfg == null) { veinsCfg = loadConfig("veins"); } else {/*from www . j a v a2 s . co m*/ CaveworldAPI.clearCaveVeins(); } if (veinsCfg.getCategoryNames().isEmpty()) { List<ICaveVein> veins = Lists.newArrayList(); veins.add(new CaveVein(new BlockEntry(CaveBlocks.cavenium_ore, 0), 5, 12, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.cavenium_ore, 0), 5, 10, 100, 64, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.cavenium_ore, 0), 20, 1, 8, 64, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.cavenium_ore, 1), 3, 8, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.cavenium_ore, 1), 2, 6, 100, 128, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.coal_ore, 0), 16, 15, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(Blocks.coal_ore, 0), 13, 25, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.coal_ore, 0), 85, 1, 10, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.coal_ore, 0), 15, 25, 100, 128, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.iron_ore, 0), 12, 40, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(Blocks.iron_ore, 0), 10, 32, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.iron_ore, 0), 50, 1, 10, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.iron_ore, 0), 12, 35, 100, 128, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 3), 6, 30, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 3), 8, 20, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 3), 15, 8, 8, 1, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 3), 8, 15, 100, 128, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.gold_ore, 0), 8, 12, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(Blocks.gold_ore, 0), 8, 6, 100, 1, 127)); veins.add(new CaveVein(new BlockEntry(Blocks.gold_ore, 0), 24, 1, 8, 1, 127)); veins.add(new CaveVein(new BlockEntry(Blocks.gold_ore, 0), 8, 6, 100, 128, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.redstone_ore, 0), 6, 20, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(Blocks.redstone_ore, 0), 7, 12, 100, 1, 127)); veins.add(new CaveVein(new BlockEntry(Blocks.redstone_ore, 0), 30, 1, 8, 1, 127)); veins.add(new CaveVein(new BlockEntry(Blocks.lapis_ore, 0), 4, 10, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(Blocks.lapis_ore, 0), 5, 4, 100, 1, 70)); veins.add(new CaveVein(new BlockEntry(Blocks.lapis_ore, 0), 18, 1, 8, 1, 70)); veins.add(new CaveVein(new BlockEntry(Blocks.diamond_ore, 0), 5, 2, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(Blocks.diamond_ore, 0), 8, 1, 100, 1, 25)); veins.add(new CaveVein(new BlockEntry(Blocks.diamond_ore, 0), 18, 1, 5, 1, 25)); veins.add(new CaveVein(new BlockEntry(Blocks.diamond_ore, 0), 8, 1, 100, 128, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 5), 3, 3, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 5), 5, 3, 100, 1, 25)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 5), 10, 1, 5, 1, 25)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 5), 5, 2, 100, 128, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 0), 8, 35, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 0), 10, 15, 100, 1, 63)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 2), 7, 18, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 2), 5, 22, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 7), 1, 3, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.emerald_ore, 0), 6, 12, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(Blocks.emerald_ore, 0), 5, 6, 100, 50, 255, null, Type.MOUNTAIN, Type.HILLS)); veins.add(new CaveVein(new BlockEntry(Blocks.emerald_ore, 0), 16, 1, 6, 50, 255, null, Type.MOUNTAIN, Type.HILLS)); veins.add(new CaveVein(new BlockEntry(Blocks.emerald_ore, 0), 5, 5, 100, 128, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.quartz_ore, 0), 10, 16, 100, 1, 255, new BlockEntry(Blocks.netherrack, 0), Type.NETHER)); veins.add(new CaveVein(new BlockEntry(Blocks.dirt, 0), 28, 35, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(Blocks.dirt, 0), 25, 24, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.gravel, 0), 23, 10, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(Blocks.gravel, 0), 20, 8, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.clay, 0), 12, 20, 100, 1, 15)); veins.add(new CaveVein(new BlockEntry(Blocks.sand, 0), 20, 18, 100, 1, 255, null, Type.SANDY)); veins.add(new CaveVein(new BlockEntry(Blocks.soul_sand, 0), 20, 10, 100, 1, 255, new BlockEntry(Blocks.netherrack, 0), Type.NETHER)); veins.add(new CaveVein(new BlockEntry(Blocks.stained_hardened_clay, 1), 24, 25, 100, 1, 255, new BlockEntry(Blocks.dirt, 0), Type.MESA)); veins.add(new CaveVein(new BlockEntry(Blocks.stained_hardened_clay, 12), 24, 20, 100, 1, 255, new BlockEntry(Blocks.dirt, 0), Type.MESA)); for (ICaveVein entry : veins) { CaveworldAPI.addCaveVein(entry); } } else { int i = 0; for (String name : veinsCfg.getCategoryNames()) { if (NumberUtils.isNumber(name)) { CaveworldAPI.addCaveVein(null); } else ++i; } if (i > 0) { try { FileUtils.forceDelete(new File(veinsCfg.toString())); CaveworldAPI.clearCaveVeins(); veinsCfg = null; syncVeinsCfg(); } catch (Exception e) { e.printStackTrace(); } } } saveConfig(veinsCfg); }
From source file:caveworld.core.Config.java
public static void syncVeinsCavernCfg() { if (veinsCavernCfg == null) { veinsCavernCfg = loadConfig("cavern", "veins"); } else {//from w w w. ja v a2s .com CaveworldAPI.clearCavernVeins(); } if (veinsCavernCfg.getCategoryNames().isEmpty()) { List<ICaveVein> veins = Lists.newArrayList(); veins.add(new CaveVein(new BlockEntry(CaveBlocks.cavenium_ore, 0), 5, 8, 100, 1, 127)); veins.add(new CaveVein(new BlockEntry(Blocks.coal_ore, 0), 17, 20, 100, 1, 127)); veins.add(new CaveVein(new BlockEntry(Blocks.iron_ore, 0), 10, 28, 100, 1, 127)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 3), 8, 20, 100, 1, 127)); veins.add(new CaveVein(new BlockEntry(Blocks.gold_ore, 0), 8, 3, 100, 1, 127)); veins.add(new CaveVein(new BlockEntry(Blocks.redstone_ore, 0), 7, 8, 100, 1, 40)); veins.add(new CaveVein(new BlockEntry(Blocks.lapis_ore, 0), 5, 2, 100, 1, 50)); veins.add(new CaveVein(new BlockEntry(Blocks.diamond_ore, 0), 8, 1, 100, 1, 20)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 5), 5, 2, 100, 1, 20)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 0), 10, 15, 100, 100, 127)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 2), 5, 20, 100, 1, 127)); veins.add(new CaveVein(new BlockEntry(Blocks.emerald_ore, 0), 5, 3, 100, 50, 127, null, Type.MOUNTAIN, Type.HILLS)); veins.add(new CaveVein(new BlockEntry(Blocks.quartz_ore, 0), 10, 16, 100, 1, 127, new BlockEntry(Blocks.netherrack, 0), Type.NETHER)); veins.add(new CaveVein(new BlockEntry(Blocks.dirt, 0), 25, 20, 100, 1, 127)); veins.add(new CaveVein(new BlockEntry(Blocks.gravel, 0), 20, 6, 100, 1, 127)); veins.add(new CaveVein(new BlockEntry(Blocks.sand, 0), 20, 8, 100, 1, 127, null, Type.SANDY)); veins.add(new CaveVein(new BlockEntry(Blocks.sand, 0), 20, 8, 100, 1, 127, new BlockEntry(Blocks.gravel, 0), Type.SANDY)); veins.add(new CaveVein(new BlockEntry(Blocks.soul_sand, 0), 20, 10, 100, 1, 127, new BlockEntry(Blocks.netherrack, 0), Type.NETHER)); veins.add(new CaveVein(new BlockEntry(Blocks.stained_hardened_clay, 1), 24, 20, 100, 1, 127, new BlockEntry(Blocks.dirt, 0), Type.MESA)); veins.add(new CaveVein(new BlockEntry(Blocks.stained_hardened_clay, 12), 24, 14, 100, 1, 127, new BlockEntry(Blocks.dirt, 0), Type.MESA)); for (ICaveVein entry : veins) { CaveworldAPI.addCavernVein(entry); } } else { int i = 0; for (String name : veinsCavernCfg.getCategoryNames()) { if (NumberUtils.isNumber(name)) { CaveworldAPI.addCavernVein(null); } else ++i; } if (i > 0) { try { FileUtils.forceDelete(new File(veinsCavernCfg.toString())); CaveworldAPI.clearCavernVeins(); veinsCavernCfg = null; syncVeinsCavernCfg(); } catch (Exception e) { e.printStackTrace(); } } } saveConfig(veinsCavernCfg); }
From source file:caveworld.core.Config.java
public static void syncVeinsAquaCavernCfg() { if (veinsAquaCavernCfg == null) { veinsAquaCavernCfg = loadConfig("aquacavern", "veins"); } else {/*from w w w . j av a2 s. c o m*/ CaveworldAPI.clearAquaCavernVeins(); } if (veinsAquaCavernCfg.getCategoryNames().isEmpty()) { List<ICaveVein> veins = Lists.newArrayList(); veins.add(new CaveVein(new BlockEntry(CaveBlocks.cavenium_ore, 0), 5, 10, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.cavenium_ore, 0), 20, 3, 8, 1, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.cavenium_ore, 1), 2, 4, 100, 127, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.coal_ore, 0), 17, 30, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.coal_ore, 0), 85, 2, 10, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.iron_ore, 0), 10, 45, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.iron_ore, 0), 50, 2, 10, 1, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 3), 8, 35, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 3), 24, 10, 1, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.gold_ore, 0), 8, 7, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.gold_ore, 0), 24, 2, 8, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.redstone_ore, 0), 7, 18, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.redstone_ore, 0), 30, 2, 8, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.lapis_ore, 0), 5, 10, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.lapis_ore, 0), 18, 2, 8, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.diamond_ore, 0), 8, 3, 100, 1, 20)); veins.add(new CaveVein(new BlockEntry(Blocks.diamond_ore, 0), 15, 2, 5, 1, 20)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 5), 6, 4, 100, 1, 20)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 5), 12, 3, 5, 1, 20)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 0), 30, 35, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 2), 10, 32, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(CaveBlocks.gem_ore, 7), 1, 3, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.emerald_ore, 0), 5, 7, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.emerald_ore, 0), 16, 2, 6, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.dirt, 0), 25, 20, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.gravel, 0), 20, 30, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.sand, 0), 20, 20, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.clay, 0), 20, 20, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.stained_hardened_clay, 1), 24, 20, 100, 1, 255, new BlockEntry(Blocks.dirt, 0), Type.MESA)); veins.add(new CaveVein(new BlockEntry(Blocks.stained_hardened_clay, 12), 24, 14, 100, 1, 255, new BlockEntry(Blocks.dirt, 0), Type.MESA)); for (ICaveVein entry : veins) { CaveworldAPI.addAquaCavernVein(entry); } } else { int i = 0; for (String name : veinsAquaCavernCfg.getCategoryNames()) { if (NumberUtils.isNumber(name)) { CaveworldAPI.addAquaCavernVein(null); } else ++i; } if (i > 0) { try { FileUtils.forceDelete(new File(veinsAquaCavernCfg.toString())); CaveworldAPI.clearAquaCavernVeins(); veinsAquaCavernCfg = null; syncVeinsAquaCavernCfg(); } catch (Exception e) { e.printStackTrace(); } } } saveConfig(veinsAquaCavernCfg); }
From source file:caveworld.core.Config.java
public static void syncVeinsCavelandCfg() { if (veinsCavelandCfg == null) { veinsCavelandCfg = loadConfig("caveland", "veins"); } else {/*w w w . ja v a2 s .com*/ CaveworldAPI.clearCavelandVeins(); } if (veinsCavelandCfg.getCategoryNames().isEmpty()) { List<ICaveVein> veins = Lists.newArrayList(); veins.add(new CaveVein(new BlockEntry(Blocks.coal_ore, 0), 17, 30, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.coal_ore, 0), 15, 20, 100, 1, 10)); veins.add(new CaveVein(new BlockEntry(Blocks.iron_ore, 0), 10, 30, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.iron_ore, 0), 8, 20, 100, 1, 10)); veins.add(new CaveVein(new BlockEntry(Blocks.gravel, 0), 20, 30, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.gravel, 0), 10, 10, 100, 1, 10)); veins.add(new CaveVein(new BlockEntry(Blocks.sand, 0), 20, 20, 100, 1, 255)); veins.add(new CaveVein(new BlockEntry(Blocks.sand, 0), 10, 7, 100, 1, 10)); for (ICaveVein entry : veins) { CaveworldAPI.addCavelandVein(entry); } } else { int i = 0; for (String name : veinsCavelandCfg.getCategoryNames()) { if (NumberUtils.isNumber(name)) { CaveworldAPI.addCavelandVein(null); } else ++i; } if (i > 0) { try { FileUtils.forceDelete(new File(veinsCavelandCfg.toString())); CaveworldAPI.clearCavelandVeins(); veinsCavelandCfg = null; syncVeinsCavelandCfg(); } catch (Exception e) { e.printStackTrace(); } } } saveConfig(veinsCavelandCfg); }