/** * @return true if result contains a coded value with the given concept id (if the result is a * list, then returns true if <em>any</em> member has a matching coded value) */ public boolean containsConcept(Integer conceptId) { if (isSingleResult()) { return (valueCoded != null && valueCoded.getConceptId().equals(conceptId)); } for (Result r : this) { if (r.containsConcept(conceptId)) { return true; } } return false; }
/** * Auto generated method comment * * @param conceptId * @return */ public static String checkIfConceptExistByIdAsString(String conceptId) { String res = ""; try { if (conceptId.trim().compareTo("") == 0) return res; Concept concept = Context.getConceptService().getConcept(Integer.parseInt(conceptId)); res = (concept != null) ? "" + concept.getConceptId() : ""; } catch (Exception e) { log.info(e.getMessage()); } return res; }
public DataObject simplifyConcept(Concept concept, Locale locale) throws Exception { List<Object> propertyNamesAndValues = new ArrayList<Object>(); ConceptName preferredName = concept.getPreferredName(locale); propertyNamesAndValues.add("conceptId"); propertyNamesAndValues.add(Integer.toString((concept.getConceptId()))); if (preferredName != null && preferredName.getName() != null) { propertyNamesAndValues.add("conceptName"); propertyNamesAndValues.add(preferredName.getName()); } else if (preferredName == null && concept.getName() != null) { propertyNamesAndValues.add("conceptName"); propertyNamesAndValues.add(concept.getName().getName()); } DataObject dataObject = DataObject.create(propertyNamesAndValues); return dataObject; }
public ConceptSearchResult(Concept con) { this.conceptId = con.getConceptId(); if (con.getName() != null) { this.conceptName = con.getName().getName(); } if (con.getDescription() != null) { this.conceptDescription = con.getDescription().getDescription(); } if (con.getConceptClass() != null) { this.conceptClass = con.getConceptClass().getName(); } if (con.getDatatype() != null) { this.conceptDatatype = con.getDatatype().getName(); } this.otherNames = new Vector<String>(); for (ConceptName cn : con.getNames()) { this.otherNames.add(cn.getName()); } }
public boolean contains(Concept concept) { return containsConcept(concept.getConceptId()); }
@RequestMapping(method = RequestMethod.POST) public void savePatientInfo( @RequestParam("patientId") Integer patientId, @RequestParam(value = "encounterId", required = false) Integer encounterId, HttpServletRequest request, HttpServletResponse response) throws ParseException, IOException { Map<String, String> parameters = RegistrationWebUtils.optimizeParameters(request); // get patient Patient patient = Context.getPatientService().getPatient(patientId); /* * SAVE ENCOUNTER */ Encounter encounter = null; if (encounterId != null) { encounter = Context.getEncounterService().getEncounter(encounterId); } else { encounter = RegistrationWebUtils.createEncounter(patient, true); // create OPD obs Concept opdWardConcept = Context.getConceptService().getConcept(RegistrationConstants.CONCEPT_NAME_OPD_WARD); Concept selectedOPDConcept = Context.getConceptService() .getConcept( Integer.parseInt( parameters.get(RegistrationConstants.FORM_FIELD_PATIENT_OPD_WARD))); Obs opd = new Obs(); opd.setConcept(opdWardConcept); opd.setValueCoded(selectedOPDConcept); encounter.addObs(opd); // send patient to opd room/bloodbank // harsh 5/10/2012 changed the way to get blood bank concept->shifted hardcoded dependency // from id to name // Concept bloodbankConcept = Context.getConceptService().getConcept( // GlobalPropertyUtil.getInteger(RegistrationConstants.PROPERTY_BLOODBANK_CONCEPT_ID, // 6425)); String bloodBankWardName = GlobalPropertyUtil.getString( RegistrationConstants.PROPERTY_BLOODBANK_OPDWARD_NAME, "Blood Bank Room"); // ghanshyam 03-sept-2013 Bug #394 [Blood bank]queue String socn = new String(selectedOPDConcept.getName().toString()); String substringofsocn = socn.substring(0, 15); if (!substringofsocn.equalsIgnoreCase(bloodBankWardName)) { RegistrationWebUtils.sendPatientToOPDQueue(patient, selectedOPDConcept, true); } else { OrderType orderType = null; String orderTypeName = Context.getAdministrationService().getGlobalProperty("bloodbank.orderTypeName"); orderType = OrderUtil.getOrderTypeByName(orderTypeName); Order order = new Order(); order.setConcept(selectedOPDConcept); order.setCreator(Context.getAuthenticatedUser()); order.setDateCreated(new Date()); order.setOrderer(Context.getAuthenticatedUser()); order.setPatient(patient); order.setStartDate(new Date()); order.setAccessionNumber("0"); order.setOrderType(orderType); order.setEncounter(encounter); encounter.addOrder(order); } } // create temporary attributes for (String name : parameters.keySet()) { if ((name.contains(".attribute.")) && (!StringUtils.isBlank(parameters.get(name)))) { String[] parts = name.split("\\."); String idText = parts[parts.length - 1]; Integer id = Integer.parseInt(idText); Concept tempCatConcept = Context.getConceptService().getConceptByName("TEMPORARY CATEGORY"); Concept temporaryAttributeConcept = Context.getConceptService().getConcept(tempCatConcept.getConceptId()); Obs temporaryAttribute = new Obs(); temporaryAttribute.setConcept(temporaryAttributeConcept); logger.info("concept: " + temporaryAttributeConcept); logger.info("value: " + parameters.get(name)); temporaryAttribute.setValueAsString(parameters.get(name)); encounter.addObs(temporaryAttribute); } } // save encounter Context.getEncounterService().saveEncounter(encounter); logger.info( String.format( "Save encounter for the visit of patient [encounterId=%s, patientId=%s]", encounter.getId(), patient.getId())); response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); out.print("success"); }