public EpisodeOfCareInterfaceVo saveEpisodeOfCare(EpisodeOfCareInterfaceVo voEpisode) throws StaleObjectException { if (!voEpisode.isValidated()) throw new CodingRuntimeException("EpisodeOfCare has not been validated!"); DomainFactory factory=getDomainFactory(); EpisodeOfCare domEpis = EpisodeOfCareInterfaceVoAssembler.extractEpisodeOfCare(factory, voEpisode); factory.save(domEpis); return EpisodeOfCareInterfaceVoAssembler.create(domEpis); }
private EpisodeOfCareInterfaceVo getEpisodeOfCare(CareContextRefVo careContext) { if(careContext == null || careContext.getID_CareContext() == null) throw new CodingRuntimeException("Can not get Specialty from Episode Of Care on null careContext."); DomainFactory factory = getDomainFactory(); List<?> dischargeDetails = factory.find("select eoc from EpisodeOfCare as eoc left join eoc.careContexts as cc where cc.id = :idCareContext", new String[]{"idCareContext"}, new Object[]{careContext.getID_CareContext()}); EpisodeOfCareInterfaceVoCollection eocVos = EpisodeOfCareInterfaceVoAssembler.createEpisodeOfCareInterfaceVoCollectionFromEpisodeOfCare(dischargeDetails); return (eocVos != null && eocVos.size() > 0) ? eocVos.get(0) : null; }