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; }
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo, DischargeReportDetailVo reportDetails, String docName, DocumentCategory category) { if (reportDetails != null) { if (reportDetails.getCareContextIsNotNull()) { PatientLiteVo patient = getPatientByCareContext(reportDetails.getCareContext()); if (patient != null) { PatientDocumentVo vo = new PatientDocumentVo(); vo.setPatient(patient); vo.setCareContext(reportDetails.getCareContext()); //WDEV-12352 - starts here if(reportDetails.getCareContext() != null) { EpisodeOfCareInterfaceVo ep = getEpisodeOfCare(reportDetails.getCareContext()); vo.setEpisodeofCare(ep); vo.setSpecialty(ep != null ? ep.getSpecialty() : null); vo.setResponsibleHCP(ep.getResponsibleHCP());//WDEV-14258 CareContextForDischargeSummarySchedulerVo cc = getCareContext(reportDetails.getCareContext());//WDEV-14258 //WDEV-14258 if(cc != null && cc.getStartDateTimeIsNotNull()) { vo.setDocumentDate(cc.getStartDateTime().getDate()); } } //WDEV-14258 if(vo.getDocumentDate() == null) { vo.setDocumentDate(new ims.framework.utils.Date()); } ////WDEV-12352 - ends here vo.setName(docName); vo.setServerDocument(serverDocumentVo); vo.setCreationType(DocumentCreationType.GENERATED); vo.setCategory(category); vo.setRecordingUser(getMosUser() != null ? (MemberOfStaffLiteVo) getMosUser() : null); vo.setRecordingDateTime(new DateTime()); vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE); //WDEV-14258 vo.setResponsibleHCP(getResponsibleHCPForCareContext(reportDetails.getCareContext()));//wdev-13102 return vo; } } } return null; }