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; }