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 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 {
private static CodeableConceptDt findType(Participant participant, CodingDt participationType) { if (participant != null) { for (CodeableConceptDt tp : participant.getType()) { for (CodingDt coding : tp.getCoding()) { if (coding.getSystem().equals(participationType.getSystem()) && coding.getCode().equals(participationType.getCode())) { return tp; } } } } return null; }
/** * 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 static IdentifierDt getIdentifier(List<IdentifierDt> list, IdentifierTypeCodesEnum... types) { for (IdentifierTypeCodesEnum type : types) { for (IdentifierDt id : list) { for (CodingDt coding : id.getType().getCoding()) { if (coding.getSystem().equals(type.getSystem()) && coding.getCode().equals(type.getCode())) { return id; } } } } return null; }
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(); }
/** * Returns the first tag (if any) that has the given system and code, or returns * <code>null</code> if none */ public CodingDt getTag(String theSystem, String theCode) { for (CodingDt next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; }
/** * Returns the first security label (if any) that has the given system and code, or returns * <code>null</code> if none */ public CodingDt getSecurity(String theSystem, String theCode) { for (CodingDt next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; }
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; }
/** * Returns an encounter location with the specified physical type. * * @param encounter An encounter. * @param physicalType The physical location type sought. * @return The encounter location corresponding to the specified physical type, or null if none * found. */ public static Encounter.Location getLocationByPhysicalType(Encounter encounter, String physicalType) { for (Encounter.Location encounterLocation : encounter.getLocation()) { Location location = ClientUtil.getResource(encounterLocation.getLocation(), Location.class); if (physicalType.equals(location.getPhysicalType().getCodingFirstRep().getCode())) { return encounterLocation; } } return null; }
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; }
@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 {
txtICD.setText(icd9.getProxiedObject().getCode());
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; }
/** * 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]); } }