public BedSpaceStateStatusLiteVo getBedSpaceStateStatus(BedSpaceRefVo bedSpaceref) { if (bedSpaceref == null || bedSpaceref.getID_BedSpace() == null) throw new CodingRuntimeException("Cannot get BedSpaceStateStatus on null bedSpaceRef"); String hql = "select bss.currentBedStatus from BedSpaceState as bss left join bss.bedSpace as bs where bs.id = " + bedSpaceref.getID_BedSpace(); List bedSpaces = getDomainFactory().find(hql); BedSpaceStateStatusLiteVoCollection voColl = BedSpaceStateStatusLiteVoAssembler.createBedSpaceStateStatusLiteVoCollectionFromBedSpaceStateStatus((bedSpaces)); if (voColl != null && voColl.size() > 0) return voColl.get(0); return null; }
public BedSpaceStateStatusLiteVo getBedSpaceStateStatus(BedSpaceRefVo bedSpaceref) { if (bedSpaceref == null || bedSpaceref.getID_BedSpace() == null) throw new CodingRuntimeException("Cannot get BedSpaceStateStatus on null bedSpaceRef"); String hql = "select bss.currentBedStatus from BedSpaceState as bss left join bss.bedSpace as bs where bs.id = " + bedSpaceref.getID_BedSpace(); List<?> bedSpaces = getDomainFactory().find(hql); BedSpaceStateStatusLiteVoCollection voColl = BedSpaceStateStatusLiteVoAssembler.createBedSpaceStateStatusLiteVoCollectionFromBedSpaceStateStatus((bedSpaces)); if (voColl != null && voColl.size() > 0) return voColl.get(0); return null; }
public void returnFromHomeLeaveToWard(InpatientEpisodeLiteVo voInpat, HomeLeaveVo voHomeLeave) throws DomainInterfaceException, StaleObjectException { if (voInpat == null) throw new CodingRuntimeException("voInpat argumment cannot be null in method returnFromHomeLeaveToWard()"); BedAdmissionComponent impl = (BedAdmissionComponent) getDomainImpl(BedAdmissionComponentImpl.class); AdmissionDetailVo voAdmissionDetail = null; if (voInpat.getBedIsNotNull()) { DomainFactory domainFactory = getDomainFactory(); BedSpaceState doBedSpaceState = (BedSpaceState) domainFactory.getDomainObject(BedSpaceState.class, voInpat.getBed().getID_BedSpaceState()); if (doBedSpaceState.getCurrentBedStatus() != null) { BedSpaceStateStatusLiteVo voBedSpaceStatus = BedSpaceStateStatusLiteVoAssembler.create(doBedSpaceState.getCurrentBedStatus()); BedSpaceStateStatusLiteVo voPrevBedStatus = (BedSpaceStateStatusLiteVo) voBedSpaceStatus.clone(); doBedSpaceState.setPreviousBedStatus(BedSpaceStateStatusLiteVoAssembler.extractBedSpaceStateStatus(domainFactory, voPrevBedStatus)); doBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatus()); doBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime(voHomeLeave.getDateReturnedFromHomeLeave(),(voHomeLeave.getTimeReturnedFromHomeLeave() != null ? voHomeLeave.getTimeReturnedFromHomeLeave() : new Time(0,0))).getJavaDate()); doBedSpaceState.getCurrentBedStatus().setBedStatus(getDomLookup(BedStatus.AVAILABLE)); voHomeLeave.setVacatedBedNumber(doBedSpaceState.getBedSpace() != null ? doBedSpaceState.getBedSpace().getBedNumber() : null); } doBedSpaceState.setInpatientEpisode(null); domainFactory.save(doBedSpaceState); } if (voInpat != null && voInpat.getPasEventIsNotNull()) voAdmissionDetail = impl.getAdmissionDetailByPasEvent(voInpat.getPasEvent()); impl.returnFromHomeLeaveToWardWaitingArea(voInpat, voAdmissionDetail, voHomeLeave); }