private void open() { clearScreen(); setSmokingControls(null); if(form.getGlobalContext().Core.getCurrentCareContextIsNotNull()) { RACPSymptomRiskFactorsVo voRACPSymptomRiskFactors = domain.getRACPSymptomRiskFactorsForCareContact(form.getGlobalContext().Core.getCurrentCareContext()); form.getLocalContext().setRACPSymptomRiskFactorsVo(voRACPSymptomRiskFactors); if(voRACPSymptomRiskFactors!=null) { loadSymptomsGrid(true); loadRiskFactorsGrid(true); populateScreen(voRACPSymptomRiskFactors); } } form.setMode(FormMode.VIEW); //WDEV-13437 }
private void populateSymptomsFromGrid(RACPSymptomRiskFactorsVo symptomRiskFactorsVo) { RACPSymptomsVoCollection collRACPSymptomsVo = new RACPSymptomsVoCollection(); symptomRiskFactorsVo.setSymptoms(null); for (int i = 0; i < form.grdSymptoms().getRows().size(); i++) { grdSymptomsRow row = form.grdSymptoms().getRows().get(i); if(row.getcolFinding().getValue()!=null){ RACPSymptomsVo voRACPSymptoms = new RACPSymptomsVo (); voRACPSymptoms.setRAPCSymptom(row.getcolSymp()); voRACPSymptoms.setRACPCFinding((RACPSymptom) row.getcolFinding().getValue()); collRACPSymptomsVo.add(voRACPSymptoms); } } if(collRACPSymptomsVo.size()>0) symptomRiskFactorsVo.setSymptoms(collRACPSymptomsVo); }
public RACPSymptomRiskFactorsVo getRACPSymptomRiskFactorsForCareContact(CareContextRefVo refCareContextRefVo) { if (refCareContextRefVo == null) throw new CodingRuntimeException("Cannot get RACPSymptomRiskFactorsVo for null ClinicalContactRefVo"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from RACPSymptomRiskFactors srf where "); ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); hql.append(" srf.careContext.id = :ccId"); markers.add("ccId"); values.add(refCareContextRefVo.getID_CareContext()); List listRACPSymptomRiskFactors = factory.find(hql.toString(), markers,values); if(listRACPSymptomRiskFactors != null && listRACPSymptomRiskFactors.size() > 0) { RACPSymptomRiskFactorsVoCollection voColl = RACPSymptomRiskFactorsVoAssembler.createRACPSymptomRiskFactorsVoCollectionFromRACPSymptomRiskFactors(listRACPSymptomRiskFactors); if(voColl != null && voColl.size() > 0) return voColl.get(0); } return null; }
private void populateScreen(RACPSymptomRiskFactorsVo voRACPSymptomRiskFactors) { form.chkCardiacSymptoms().setValue(voRACPSymptomRiskFactors.getSymptomIndicator()); form.chkRiskFactors().setValue(voRACPSymptomRiskFactors.getRiskFactorIndicator()); form.txtCardiacSymptoms().setValue(voRACPSymptomRiskFactors.getSymptomNotes()); form.txtNotes().setValue(voRACPSymptomRiskFactors.getOtherNotes()); if(voRACPSymptomRiskFactors.getAlcoholUnitsPerWeekIsNotNull()) form.cmbAlcohol().setValue(voRACPSymptomRiskFactors.getAlcoholUnitsPerWeek().getUnitsPerWeek()); intDurationValueChanged(); cmbDurationValueChanged(); form.cmbDiabetes().setValue(voRACPSymptomRiskFactors.getDiabetesStatus()); form.cmbDuration().setValue(voRACPSymptomRiskFactors.getSymptomDuration()); form.intDuration().setValue(voRACPSymptomRiskFactors.getSymptomDurationUnit()); if(voRACPSymptomRiskFactors.getSmokingStatusIsNotNull()){ setSmokingControls(voRACPSymptomRiskFactors.getSmokingStatus().getCurrentSmokingStatus()); form.cmbSmoker().setValue(voRACPSymptomRiskFactors.getSmokingStatus().getCurrentSmokingStatus()); if(voRACPSymptomRiskFactors.getSmokingStatus().getSmokingDetailsIsNotNull()){ SmokingDetailsCollection collSmokingDetails = voRACPSymptomRiskFactors.getSmokingStatus().getSmokingDetails(); if(collSmokingDetails!=null && collSmokingDetails.size()>0){ SmokingDetails smokingDetails = collSmokingDetails.get(0); form.intDailyAmount().setValue(smokingDetails.getAmountPerDay()); form.intYearsStopped().setValue(collSmokingDetails.get(0).getNumberOfYears()); } } } if(voRACPSymptomRiskFactors.getSymptomsIsNotNull()){ RACPSymptomsVoCollection currentSymptomsColl = voRACPSymptomRiskFactors.getSymptoms(); form.grdSymptoms().getRows().clear(); for (int i = 0; i < currentSymptomsColl.size(); i++) { RACPSymptomsVo voRACPSymptoms = currentSymptomsColl.get(i); grdSymptomsRow row = form.grdSymptoms().getRows().newRow(); row.setcolSymp(voRACPSymptoms.getRAPCSymptom()); row.getcolFinding().newRow(voRACPSymptoms.getRACPCFinding(), voRACPSymptoms.getRACPCFinding().getText()); row.getcolFinding().setValue(voRACPSymptoms.getRACPCFinding()); } } }
private boolean save() { if(isRACPCComplete())// WDEV-13662 return false; RACPSymptomRiskFactorsVo voRACPSymptomRiskFactors = populateDataFromScreen(form.getLocalContext().getRACPSymptomRiskFactorsVo()); String[] uiErrors = validateUIRules(); String[] arrErrors = voRACPSymptomRiskFactors.validate(uiErrors); if (arrErrors != null) { engine.showErrors(arrErrors); return false; } try { voRACPSymptomRiskFactors = domain.saveRACPSymptomRiskFactorsVo(voRACPSymptomRiskFactors); } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } form.getLocalContext().setRACPSymptomRiskFactorsVo(voRACPSymptomRiskFactors); return true; }
private void populateRiskFactorsFromGrid(RACPSymptomRiskFactorsVo symptomRiskFactorsVo) { RACPRiskFactorCollection collRACPRiskFactor = new RACPRiskFactorCollection(); for (int i = 0; i < form.grdRisks().getRows().size(); i++) { grdRisksRow row = form.grdRisks().getRows().get(i); if(row.getcolSelect()) collRACPRiskFactor.add(row.getValue()); } if(collRACPRiskFactor.size()>0) symptomRiskFactorsVo.setRiskFactors(collRACPRiskFactor); else symptomRiskFactorsVo.setRiskFactors(null); }
public RACPSymptomRiskFactorsVo saveRACPSymptomRiskFactorsVo(RACPSymptomRiskFactorsVo voRACPSymptomRiskFactors) throws StaleObjectException { if (voRACPSymptomRiskFactors == null || !voRACPSymptomRiskFactors.isValidated()) throw new CodingRuntimeException("Plan Advice is null or has not been validated"); DomainFactory factory=getDomainFactory(); RACPSymptomsVoCollection symptoms = voRACPSymptomRiskFactors.getSymptoms(); if(symptoms!=null){ RACPSymptomsVoCollection collRACPSymptomsVo = new RACPSymptomsVoCollection(); for (int i = 0; i < symptoms.size(); i++) { RACPSymptoms doSymptom = RACPSymptomsVoAssembler.extractRACPSymptoms(factory, symptoms.get(i)); factory.save(doSymptom); collRACPSymptomsVo.add(RACPSymptomsVoAssembler.create(doSymptom)); } voRACPSymptomRiskFactors.setSymptoms(collRACPSymptomsVo); } if(voRACPSymptomRiskFactors.getAlcoholUnitsPerWeekIsNotNull()){ Alcohol doAlcohol = AlcoholVoAssembler.extractAlcohol(factory, voRACPSymptomRiskFactors.getAlcoholUnitsPerWeek()); factory.save(doAlcohol); voRACPSymptomRiskFactors.setAlcoholUnitsPerWeek(AlcoholVoAssembler.create(doAlcohol)); } if(voRACPSymptomRiskFactors.getSmokingStatusIsNotNull()){ Smoking doSmoking = SmokingAssembler.extractSmoking(factory, voRACPSymptomRiskFactors.getSmokingStatus()); factory.save(doSmoking); voRACPSymptomRiskFactors.setSmokingStatus(SmokingAssembler.create(doSmoking)); } RACPSymptomRiskFactors doRACPSymptomRiskFactors = RACPSymptomRiskFactorsVoAssembler.extractRACPSymptomRiskFactors(factory, voRACPSymptomRiskFactors); factory.save(doRACPSymptomRiskFactors); return RACPSymptomRiskFactorsVoAssembler.create(doRACPSymptomRiskFactors); }