private ReferralsRecordingVo populateDataFromScreen(ReferralsRecordingVo rrVo) { rrVo.setReferralSource(form.cmbSourceofReferral().getValue()); rrVo.setRefOrgaCode(form.qmbReferringOrg().getValue()); if (form.qmbReferredBy().getValue() instanceof MedicVo) { rrVo.setReferredBy((Hcp) form.qmbReferredBy().getValue()); rrVo.setReferredByGP(null); } else if (form.qmbReferredBy().getValue() instanceof GpLiteVo) { rrVo.setReferredByGP((GpShortVo)form.qmbReferredBy().getValue()); rrVo.setReferredBy(null); } rrVo.setReferralPriority(form.cmbPriority().getValue()); rrVo.setDateSent(form.dteDecisionToRefer().getValue()); rrVo.setDateReceived(form.dteRecieptReferral().getValue()); rrVo.setReasonForReferral(form.cmbReasonReferral().getValue()); rrVo.setUrgentCancerReferralType(form.cmbUrgntReferralType().getValue()); rrVo.setCancerStatus(form.cmbCancerStatus().getValue()); rrVo.setReferralHCP(form.qmbReferredTo().getValue()); rrVo.setSpecialtyFunctionCode(form.cmbSpecialtyCode().getValue()); rrVo.setDateFirstSeen(form.dteFirstSeen().getValue()); rrVo.setDelayReasonGPUrgentReferral(form.cmbDelayReasonFirstSeen().getValue()); rrVo.setDelayReasonText(form.txtDelayResonComments().getValue()); if (rrVo.getRecordingMOS() == null && form.getLocalContext().getLoggedInMOSIsNotNull()) rrVo.setRecordingMOS(form.getLocalContext().getLoggedInMOS()); ReferralsRecordingVoCollection voRRColl = new ReferralsRecordingVoCollection(); for (int i = 0 ; i < form.grdPreceedingReferrals().getRows().size() ; i++) { ReferralsRecordingVo prVo = new ReferralsRecordingVo(); prVo = form.grdPreceedingReferrals().getRows().get(i).getValue(); prVo.setPrimaryPreceeding(PrimaryPreceeding.PREECEDING); prVo.setReferralCategory(ReferralCategory.PRECEEDEDEPISODE); if (prVo.getClinicalContact() == null) prVo.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); if (prVo.getCareContext() == null) prVo.setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); if (prVo.getCareSpell() == null) prVo.setCareSpell(form.getGlobalContext().Core.getCurrentCareContext().getEpisodeOfCare().getCareSpell()); voRRColl.add(prVo); } rrVo.setPreceedingReferrals(voRRColl); return rrVo; }
/** * geStagingClassification */ public ims.clinical.vo.ReferralsRecordingVo getPrimaryPreecedingReferralRecording(ims.core.admin.vo.CareSpellRefVo csRefVo) { if(csRefVo == null) throw new RuntimeException("Cannot get ReferralsRecordingVo for null CareContextRefVo"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from ReferralsRecording rr "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (csRefVo != null) { hql.append(andStr + " rr.careSpell.id = :id_CareSpell"); markers.add("id_CareSpell"); values.add(csRefVo.getID_CareSpell()); andStr = " and "; } hql.append(andStr + " rr.primaryPreceeding = :pp_PRIMARY"); markers.add("pp_PRIMARY"); values.add(getDomLookup(PrimaryPreceeding.PRIMARY)); andStr = " and "; hql.append(andStr + " rr.referralCategory = :rc_PRECEEDEDEPISODE"); markers.add("rc_PRECEEDEDEPISODE"); values.add(getDomLookup(ReferralCategory.PRECEEDEDEPISODE)); andStr = " and "; if (markers.size() > 0) query += " where "; query += hql.toString(); List rrList = factory.find(query, markers, values); ReferralsRecordingVoCollection coll = ReferralsRecordingVoAssembler.createReferralsRecordingVoCollectionFromReferralsRecording(rrList); if(coll != null && coll.size() > 0) return coll.get(0); else return null; }
private boolean save() { if (form.ctnDetails().cmbReferralType().getValue() == null)//wdev-3028 { engine.showMessage("Referral Type is a mandatory field. Please enter one and save again."); return false; } ReferralsRecordingVo editedRecord = form.getLocalContext().getEditedRecord(); ReferralsRecordingVo record = populateDataFromScreen(editedRecord); record.setReferralCategory(ReferralCategory.FURTHERREFERRAL); String[] uiErrors = getUiErrors(); String[] errors = record.validate(uiErrors); if(errors != null && errors.length > 0) { //WDEV-16518 workaround for validation of Date Sent field. BO field is common to 2 forms. for (int i=0; i<errors.length; i++) { if (errors[i]!= null && errors[i].equals("Date Decision to Refer is mandatory")) { errors[i] = "Date Sent is mandatory"; break; } } engine.showErrors(errors); form.ctnDetails().setCollapsed(false); return false; } try { record = domain.save(record); } catch(StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); ReferralsRecordingVo updatedRecord = getAndDisplayRecord(record); updateRowRecord(updatedRecord); return false; } form.getLocalContext().setEditedRecord(record); return true; }
public ReferralsRecordingShortVoCollection list(CareContextRefVo careContext) { return ReferralsRecordingShortVoAssembler.createReferralsRecordingShortVoCollectionFromReferralsRecording( getDomainFactory().find("from ReferralsRecording as ref where ref.careContext.id = :CARE_CONTEXT and ref.referralCategory = :REF_CAT", new String[] {"CARE_CONTEXT", "REF_CAT"}, new Object[] {careContext.getID_CareContext(), getDomLookup(ReferralCategory.FURTHERREFERRAL)})); }