public PatientShortListVo getPatientByCareContext(CareContextRefVo careContext) { if(careContext == null || careContext.getID_CareContext() == null) { throw new CodingRuntimeException("CareContextRefVo is null"); } if(careContext.getID_CareContext() == null) { throw new CodingRuntimeException("CareContextRefVo id is null"); } DomainFactory factory = getDomainFactory(); List domainObjectList = factory.find("select p from CareContext as cc left join cc.episodeOfCare as eoc left join eoc.careSpell as cs left join cs.patient as p where (cc.id = :idCareContext)", new String[]{"idCareContext"}, new Object[]{careContext.getID_CareContext()}); PatientShortListVoCollection patient = PatientShortListVoAssembler.createPatientShortListVoCollectionFromPatient(domainObjectList); return patient != null && patient.size() > 0 ? (patient.get(0) != null ? patient.get(0) : null) : null; }
private void updateAndCreateRecords(DomainFactory factory, CatsReferral domReferral, RTTStatusEventMapVo rttMap) throws StaleObjectException, DomainInterfaceException { if (ConfigFlag.DOM.RTT_STATUS_POINT_FUNCTIONALITY.getValue() && Boolean.TRUE.equals(domReferral.isRTTClockImpact()) && rttMap.getTargetRTTStatusIsNotNull()) { PathwayRTTStatusVo pathwayRTTStatus = new PathwayRTTStatusVo(); pathwayRTTStatus.setRTTStatus(rttMap.getTargetRTTStatus()); pathwayRTTStatus.setStatusBy((MemberOfStaffRefVo) getMosUser()); pathwayRTTStatus.setStatusDateTime(new DateTime()); PathwayRTTStatus domainRttStatus = PathwayRTTStatusVoAssembler.extractPathwayRTTStatus(factory, pathwayRTTStatus); if (domReferral.getJourney() != null && domReferral.getJourney().getCurrentClock() != null) { domReferral.getJourney().getCurrentClock().setCurrentRTTStatus(domainRttStatus); if (domReferral.getJourney().getCurrentClock().getRTTStatusHistory() == null) { domReferral.getJourney().getCurrentClock().setRTTStatusHistory(new java.util.ArrayList()); } domReferral.getJourney().getCurrentClock().getRTTStatusHistory().add(domainRttStatus); } domReferral.setCurrentRTTStatus(domainRttStatus); if (rttMap.getEvent() != null) { PatientEventVo patEvent = new PatientEventVo(); patEvent.setPatient(PatientShortListVoAssembler.create(domReferral.getPatient())); patEvent.setEvent(rttMap.getEvent()); patEvent.setEventDateTime(new DateTime()); patEvent.setEventStatus(EventStatus.ACTIVE); patEvent.setJourney(PatientJourneyVoAssembler.create(domReferral.getJourney())); HL7PathwayIf impl = (HL7PathwayIf) getDomainImpl(HL7PathwayIfImpl.class); impl.instantiatePatientEvent(patEvent); } } }