private ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult validateCodeIsInContains(List<ExpansionContains> contains, String theSystem, String theCode, CodingDt theCoding, CodeableConceptDt theCodeableConcept) { for (ExpansionContains nextCode : contains) { ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult result = validateCodeIsInContains(nextCode.getContains(), theSystem, theCode, theCoding, theCodeableConcept); if (result != null) { return result; } String system = nextCode.getSystem(); String code = nextCode.getCode(); if (isNotBlank(theCode)) { if (theCode.equals(code) && (isBlank(theSystem) || theSystem.equals(system))) { return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay()); } } else if (theCoding != null) { if (StringUtils.equals(system, theCoding.getSystem()) && StringUtils.equals(code, theCoding.getCode())) { return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay()); } } else { for (CodingDt next : theCodeableConcept.getCoding()) { if (StringUtils.equals(system, next.getSystem()) && StringUtils.equals(code, next.getCode())) { return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay()); } } } } return null; }
@SuppressWarnings("unused") public static void codeableConcepts() { // START SNIPPET: codeableConcepts Patient patient = new Patient(); // Coded types can naturally be set using plain strings CodingDt statusCoding = patient.getMaritalStatus().addCoding(); statusCoding.setSystem("http://hl7.org/fhir/v3/MaritalStatus"); statusCoding.setCode("M"); statusCoding.setDisplay("Married"); // You could add a second coding to the field if needed too. This // can be useful if you want to convey the concept using different // codesystems. CodingDt secondStatus = patient.getMaritalStatus().addCoding(); secondStatus.setCode("H"); secondStatus.setSystem("http://example.com#maritalStatus"); secondStatus.setDisplay("Happily Married"); // CodeableConcept also has a text field meant to convey // a user readable version of the concepts it conveys. patient.getMaritalStatus().setText("Happily Married"); // There are also accessors for retrieving values String firstCode = patient.getMaritalStatus().getCoding().get(0).getCode(); String secondCode = patient.getMaritalStatus().getCoding().get(1).getCode(); // END SNIPPET: codeableConcepts }
@Override public BaseCodingDt newCodingDt() { return new CodingDt(); }
protected MetaDt toMetaDt(Collection<TagDefinition> tagDefinitions) { MetaDt retVal = new MetaDt(); for (TagDefinition next : tagDefinitions) { switch (next.getTagType()) { case PROFILE: retVal.addProfile(next.getCode()); break; case SECURITY_LABEL: retVal.addSecurity().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay()); break; case TAG: retVal.addTag().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay()); break; } } return retVal; }
patient.getMaritalStatus().getCodingFirstRep().setDisplay("Married"); patient.getMaritalStatus().getCodingFirstRep().setVersion("1.0"); patient.getMaritalStatus().getCodingFirstRep().setUserSelected(true); String code = patient.getMaritalStatus().getCodingFirstRep().getCode(); String codeSystem = patient.getMaritalStatus().getCodingFirstRep().getCode();
/** * Returns a displayable value for a codeable concept. * * @param value Codeable concept. * @return Displayable value. */ public static String getDisplayValue(CodeableConceptDt value) { CodingDt coding = value.getCodingFirstRep(); String result = coding.getDisplay(); return result == null ? coding.getCode() : result; }
public Collection<String> getTypes() { if (types == null) { types = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); CodeableConceptDt dt = reference.getType(); List<CodingDt> codings = dt == null ? null : dt.getCoding(); if (codings != null) { for (CodingDt coding : codings) { String type = coding.getDisplay().toString(); if (!StringUtils.isEmpty(type)) { types.add(type); } } } } return types; }
public static String getServiceCategory(Encounter encounter) { CodeableConceptDt cpt = encounter == null ? null : FhirUtil.getFirst(encounter.getType()); CodingDt coding = cpt == null ? null : cpt.getCodingFirstRep(); return coding == null ? null : coding.getCode(); }
public static CodeableConceptDt createServiceCategory(String sc, String shortDx, String longDx) { CodeableConceptDt cpt = new CodeableConceptDt(); cpt.setText(longDx); CodingDt coding = new CodingDt(); coding.setCode(sc); coding.setDisplay(shortDx); cpt.getCoding().add(coding); return cpt; }
@Override public List<? extends IBaseCoding> getSecurity() { ArrayList<CodingDt> retVal = new ArrayList<CodingDt>(); List<BaseCodingDt> labelsList = ResourceMetadataKeyEnum.SECURITY_LABELS.get(BaseResource.this); if (labelsList == null) { return Collections.emptyList(); } for (BaseCodingDt next : labelsList) { retVal.add(new CodingDt(next.getSystemElement().getValue(), next.getCodeElement().getValue()).setDisplay(next.getDisplayElement().getValue())); } return Collections.unmodifiableList(retVal); }
/** * Returns a coding of the desired system from a list. * * @param list List of codings to consider. * @param systems One or more systems to consider. These are searched in order until one is * found. A null value matches any system. * @return An coding with a matching system, or null if none found. */ public static CodingDt getCoding(List<CodingDt> list, String... systems) { for (String system : systems) { for (CodingDt coding : list) { if (system == null || system.equals(coding.getSystem())) { return coding; } } } return null; }
/** * Wire variables and events. */ @Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); for (CodeableConceptDt cat : EncounterUtil.getServiceCategories()) { CodingDt coding = cat.getCodingFirstRep(); Comboitem item = cboServiceCategory.appendItem(coding.getDisplay()); item.setValue(coding.getCode()); item.setTooltiptext(cat.getText()); } List<String> data = broker.callRPCList("RGCWENCX CLINLOC", null, "", 1, 9999); for (String itm : data) { String[] pcs = StrUtil.split(itm, StrUtil.U, 3); Listitem item = lstLocation.appendItem(pcs[1], pcs[0]); item.setAttribute("sc", pcs[2]); } }
coding.setCode("29463-7").setSystem("http://loinc.org").setDisplay("Body Weight");
private String getManifestations(List<CodeableConceptDt> symptoms) { StringBuilder sb = new StringBuilder(); for (CodeableConceptDt symptom : symptoms) { String sx = symptom.getText(); if (StringUtils.isEmpty(sx)) { sx = symptom.getCodingFirstRep().getDisplay(); } add(sx, sb); } return sb.toString(); }
public static int compareProblemIDs(String id1, String id2) { IdentifierDt ed1 = PCCUtil.parseProblemID(id1); IdentifierDt ed2 = PCCUtil.parseProblemID(id2); int i = ed1.getType().getCodingFirstRep().getCode().compareToIgnoreCase(ed2.getType().getCodingFirstRep().getCode()); if (i == 0) { int v1 = NumberUtils.toInt(ed1.getValue()); int v2 = NumberUtils.toInt(ed2.getValue()); i = v1 == v2 ? 0 : v1 > v2 ? 1 : -1; } return i; }
@Override public LookupCodeResult lookupCode(IPrimitiveType<String> theCode, IPrimitiveType<String> theSystem, CodingDt theCoding, RequestDetails theRequestDetails) { boolean haveCoding = theCoding != null && isNotBlank(theCoding.getSystem()) && isNotBlank(theCoding.getCode()); boolean haveCode = theCode != null && theCode.isEmpty() == false; boolean haveSystem = theSystem != null && theSystem.isEmpty() == false; String system; if (haveCoding) { code = theCoding.getCode(); system = theCoding.getSystem(); } else { code = theCode.getValue();
private static synchronized void loadServiceCategories() { if (serviceCategories == null) { Map<String, CodeableConceptDt> map = new LinkedHashMap<String, CodeableConceptDt>(); Bundle bundle = ClientUtil.getFhirClient().search().forResource(ValueSet.class) .where(ValueSet.NAME.matchesExactly().value("EncounterType")).execute(); for (ValueSet vs : FhirUtil.getEntries(bundle, ValueSet.class)) { UriDt system = vs.getDefine().getSystemElement(); for (ValueSet.DefineConcept concept : vs.getDefine().getConcept()) { CodeableConceptDt cc = new CodeableConceptDt(); CodingDt coding = cc.addCoding(); coding.setCode(concept.getCode()); coding.setDisplay(concept.getDisplay()); coding.setSystem(system); cc.setText(concept.getDefinition()); map.put(coding.getCode(), cc); } } serviceCategories = map; } return; }
txtICD.setText(icd9.getProxiedObject().getCode()); narr = icd9 == null ? "" : icd9.getProxiedObject().getDisplay();