public BedSpaceStateLiteVo getBedSpaceStateByInpatientEpisode(InpatientEpisodeRefVo inpat) { if (inpat == null || inpat.getID_InpatientEpisode() == null) throw new CodingRuntimeException("inpat is null or id not provided in method getBedSpaceStateByInpatientEpisode"); String hql = "from BedSpaceState as bed where bed.inpatientEpisode.id = " + inpat.getID_InpatientEpisode(); List lstBeds = getDomainFactory().find(hql); if(lstBeds != null && lstBeds.size() == 1) return BedSpaceStateLiteVoAssembler.create((BedSpaceState) lstBeds.get(0)); return null; }
private BedSpaceStateLiteVo getBedSpaceState(BedSpace bed) { if (bed == null || bed.getId() == null) return null; String hql = "select bs from BedSpaceState as bs left join bs.bedSpace as bed where bed.id = " + bed.getId(); List bedState = getDomainFactory().find(hql); BedSpaceStateLiteVoCollection voColl = BedSpaceStateLiteVoAssembler.createBedSpaceStateLiteVoCollectionFromBedSpaceState(bedState); if (voColl != null && voColl.size() > 0) return voColl.get(0); return null; }
public void saveInternalTransfer(InpatientEpisodeLiteVo inpatEpis, BedSpaceStateLiteVo bedSpaceState) throws StaleObjectException { if (bedSpaceState == null) throw new CodingRuntimeException("bedSpaceState is null in method saveInternalTransfer"); if (inpatEpis == null) throw new CodingRuntimeException("inpatEpis is null in method saveInternalTransfer"); BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpaceState); InpatientEpisode doInpatEpis = InpatientEpisodeLiteVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatEpis); doInpatEpis.getBed().getCurrentBedStatus().setBedStatus(getDomLookup(BedStatus.AVAILABLE)); doInpatEpis.getBed().setInpatientEpisode(null); getDomainFactory().save(doInpatEpis); doBedSpaceState.setInpatientEpisode(doInpatEpis); doBedSpaceState.getCurrentBedStatus().setBedStatus(getDomLookup(BedStatus.OCCUPIED)); doInpatEpis.setBed(doBedSpaceState); getDomainFactory().save(doInpatEpis); }
private BedSpaceStateLiteVo getBedSpaceState(BedSpace bed) { if (bed == null || bed.getId() == null) return null; String hql = "select bs from BedSpaceState as bs left join bs.bedSpace as bed where bed.id = " + bed.getId(); List<?> bedState = getDomainFactory().find(hql); BedSpaceStateLiteVoCollection voColl = BedSpaceStateLiteVoAssembler.createBedSpaceStateLiteVoCollectionFromBedSpaceState(bedState); if (voColl != null && voColl.size() > 0) return voColl.get(0); return null; }
public ims.core.vo.BedSpaceStateLiteVoCollection listAvailableBedSpaces(ims.core.resource.place.vo.LocationRefVo wardRef) { if (wardRef == null) return null; StringBuilder hql = new StringBuilder(); DomainFactory factory = getDomainFactory(); hql.append("select bedspacest from BedSpaceState as bedspacest left join bedspacest.ward as ward left join bedspacest.bay as bay left join bedspacest.currentBedStatus as currentStatus left join currentStatus.bedStatus as status where ward.id = :WARD_ID and status.id = :AVAILABLE_BED_STATUS and bay.isActive = :IS_ACTIVE AND bay.id in (select bayloc.id from BayConfig bconfig left join bconfig.bay as bayloc left join bconfig.floorBedSpaceLayout as flayout left join flayout.status as stat where stat.id = :STATUS_ID) "); List<?> recordList = factory.find(hql.toString(), new String[]{"WARD_ID", "AVAILABLE_BED_STATUS", "IS_ACTIVE", "STATUS_ID"}, new Object[]{wardRef.getID_Location(),BedStatus.AVAILABLE.getID(), Boolean.TRUE,PreActiveActiveInactiveStatus.ACTIVE.getID()}); if (recordList == null || recordList.isEmpty()) return null; return BedSpaceStateLiteVoAssembler.createBedSpaceStateLiteVoCollectionFromBedSpaceState(recordList); }
public BedSpaceStateLiteVo saveCloseBed(BedSpaceStateLiteVo bedSpaceState, String user, ReasonForBedClosure reason, DateTime estReOpen) throws StaleObjectException { if(bedSpaceState == null) throw new CodingRuntimeException("bedSpaceState is null in method saveCloseBed"); BedSpaceState doBedSpace = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpaceState); doBedSpace.getCurrentBedStatus().setEstReopeningDateTime(estReOpen != null ? estReOpen.getJavaDate() : null); doBedSpace.getCurrentBedStatus().setReasonForClosure(getDomLookup(reason)); doBedSpace.getCurrentBedStatus().getSystemInformation().setCreationUser(user); getDomainFactory().save(doBedSpace); return BedSpaceStateLiteVoAssembler.create(doBedSpace); }
public void saveReOpenOrAssignBed(BedSpaceStateLiteVo bedSpaceState) throws StaleObjectException { if(bedSpaceState == null) throw new CodingRuntimeException("bedSpaceState is null in method saveReOpenOrAssignBed"); //WDEV-8507 bedSpaceState.setInpatientEpisode(null); getDomainFactory().save(BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpaceState)); }
public BedSpaceStateLiteVo getBedSpaceStateStatusByBedId(BedSpaceStateRefVo bedSpaceRef) { if(bedSpaceRef == null || bedSpaceRef.getID_BedSpaceState() == null) throw new CodingRuntimeException("Cannot get BedSpaceState on null Id."); return BedSpaceStateLiteVoAssembler.create( (BedSpaceState) getDomainFactory().getDomainObject(BedSpaceState.class, bedSpaceRef.getID_BedSpaceState())); }
public BedSpaceStateLiteVo getBedSpaceState(BedSpaceStateRefVo bedRef) { if(bedRef == null || bedRef.getID_BedSpaceState() == null) throw new CodingRuntimeException("Cannot get BedSpaceState on null Id."); return BedSpaceStateLiteVoAssembler.create( (BedSpaceState) getDomainFactory().getDomainObject(BedSpaceState.class, bedRef.getID_BedSpaceState())); }
public BedSpaceStateLiteVo getBedSpaceState(BedSpaceRefVo bed) { if(bed == null ) throw new DomainRuntimeException("Invalid BedRefVo"); DomainFactory factory = getDomainFactory(); BedSpaceState domBed = (BedSpaceState) factory.getDomainObject(BedSpaceState.class, bed.getID_BedSpace()); return BedSpaceStateLiteVoAssembler.create(domBed); }
public BedSpaceStateLiteVo getBedSpaceState(BedSpaceStateLiteVo bed) { if(bed == null ) throw new DomainRuntimeException("Invalid BedRefVo"); DomainFactory factory = getDomainFactory(); BedSpaceState domBed = (BedSpaceState) factory.getDomainObject(BedSpaceState.class, bed.getID_BedSpaceState()); return BedSpaceStateLiteVoAssembler.create(domBed); }
public BedSpaceStateLiteVo saveBedSpaceState(BedSpaceStateLiteVo voBSS) throws DomainInterfaceException, StaleObjectException { if (!voBSS.isValidated()) throw new CodingRuntimeException("BedSpaceStateLiteVo Record has not been validated"); if(voBSS == null) throw new CodingRuntimeException("Cannot save null BedSpaceStateLiteVo"); DomainFactory factory = getDomainFactory(); BedSpaceState doBSS = BedSpaceStateLiteVoAssembler.extractBedSpaceState(factory, voBSS); factory.save(doBSS); return (BedSpaceStateLiteVoAssembler.create(doBSS)); }
public BedSpaceStateLiteVo getBedSpaceState(BedSpaceRefVo bed) { if(bed == null ) throw new DomainRuntimeException("Invalid BedRefVo"); String hql = "select bs from BedSpaceState as bs left join bs.bedSpace as bed where bed.id = " + bed.getID_BedSpace(); List bedState = getDomainFactory().find(hql); //WDEV-11039 boolean hasAlerts = false; if(bedState != null && bedState.size() > 0) { BedSpaceState doBed = (BedSpaceState)bedState.get(0); if(doBed.getInpatientEpisode() != null && doBed.getInpatientEpisode().getPasEvent() != null && doBed.getInpatientEpisode().getPasEvent().getPatient() != null && doBed.getInpatientEpisode().getPasEvent().getPatient().getPatientAlerts() != null) if(doBed.getInpatientEpisode().getPasEvent().getPatient().getPatientAlerts().size() > 0 && isOneActive(doBed.getInpatientEpisode().getPasEvent().getPatient().getPatientAlerts(), true)) hasAlerts = true; } BedSpaceStateLiteVoCollection voColl = BedSpaceStateLiteVoAssembler.createBedSpaceStateLiteVoCollectionFromBedSpaceState(bedState); if (voColl != null && voColl.size() > 0) { if(voColl.get(0).getInpatientEpisodeIsNotNull() && voColl.get(0).getInpatientEpisode().getPasEventIsNotNull() && voColl.get(0).getInpatientEpisode().getPasEvent().getPatientIsNotNull()) voColl.get(0).getInpatientEpisode().getPasEvent().getPatient().setHasAlerts(hasAlerts); return voColl.get(0); } return null; }
public BedSpaceStateLiteVo getSelectedBedSpaceState(BedSpaceStateRefVo bedSpaceRef) { DomainFactory factory = getDomainFactory(); BedSpaceState doBedSpaceState = (BedSpaceState) factory.getDomainObject(BedSpaceState.class, bedSpaceRef.getID_BedSpaceState()); return doBedSpaceState != null ? BedSpaceStateLiteVoAssembler.create(doBedSpaceState) : null; }
public BedSpaceStateLiteVo getBedSpaceState(BedSpaceStateRefVo bedSpaceState) { if (bedSpaceState == null || bedSpaceState.getID_BedSpaceState() == null) return null; return BedSpaceStateLiteVoAssembler.create((BedSpaceState) getDomainFactory().getDomainObject(BedSpaceState.class, bedSpaceState.getID_BedSpaceState())); }