Java Code Examples for ims.core.vo.BedSpaceStateLiteVoCollection

The following are top voted examples for showing how to use ims.core.vo.BedSpaceStateLiteVoCollection. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateGrid(BedSpaceStateLiteVoCollection availableBeds) 
{	
	if (availableBeds != null)
	{
		for (BedSpaceStateLiteVo item: availableBeds)
		{
			grdAvailableBedsRow row = form.grdAvailableBeds().getRows().newRow();
			
			row.setColWard(item.getWardIsNotNull() && item.getWard().getNameIsNotNull() ? item.getWard().getName() : "");
			row.setColLocation(item.getBedSpaceIsNotNull() && item.getBedSpace().getWardTypeIsNotNull() ? item.getBedSpace().getWardType().toString() : "");
			//WDEV-18010
			row.setColBedNumber(item.getBedSpaceIsNotNull() && item.getBedSpace().getBedNumberIsNotNull() ? item.getBedSpace().getBedNumber() : "");
			row.setTooltipForColBedNumber(item.getBedSpace().getBedNumberIsNotNull() ? item.getBedSpace().getBedNumber() : "");
			row.setColBedType(item.getBedSpaceIsNotNull() && item.getBedSpace().getBedSpaceTypeIsNotNull() ? item.getBedSpace().getBedSpaceType().toString() : "");
			row.setColBedStatus(item.getBedSpaceIsNotNull() && item.getCurrentBedStatusIsNotNull() && item.getCurrentBedStatus().getBedStatusIsNotNull() ? item.getCurrentBedStatus().getBedStatus().toString() : "");
			row.setColComments(item.getCommentIsNotNull() ? item.getComment().toString() : "");
			//WDEV-8334
			row.setTooltipForColComments(item.getCommentIsNotNull() ? item.getComment().toString() : "");
			row.setValue(item);
		}
	}
}
 
Example 2
Project: AvoinApotti   File: WardBayConfigDialogImpl.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 3
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
@Override
protected void onGrdAvailableBedsGridHeaderClicked(int column) throws PresentationLogicException
{		
	if (COL_BED_NO == column)
	{
		BedSpaceStateLiteVoCollection gridValues = form.grdAvailableBeds().getValues();
		if (gridValues.size() < 2)
			return;
		BedSpaceStateLiteVo selVal = form.grdAvailableBeds().getValue();
		
		form.getLocalContext().setSortOrderBedNo(SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderBedNo()) ? SortOrder.DESCENDING : SortOrder.ASCENDING);
		gridValues.sort(BedSpaceStateLiteVo.getBedNumberComparator(form.getLocalContext().getSortOrderBedNo()));
		
		populateGrid(gridValues);
		if (selVal != null)
		{
			form.grdAvailableBeds().setValue(selVal);
		}
	}
	updateContextMenus();
}
 
Example 4
Project: openMAXIMS   File: WardBayConfigDialogImpl.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 5
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateGrid(BedSpaceStateLiteVoCollection availableBeds) 
{	
	if (availableBeds != null)
	{
		for (BedSpaceStateLiteVo item: availableBeds)
		{
			grdAvailableBedsRow row = form.grdAvailableBeds().getRows().newRow();
			
			row.setColWard(item.getWardIsNotNull() && item.getWard().getNameIsNotNull() ? item.getWard().getName() : "");
			row.setColLocation(item.getBedSpaceIsNotNull() && item.getBedSpace().getWardTypeIsNotNull() ? item.getBedSpace().getWardType().toString() : "");
			//WDEV-18010
			row.setColBedNumber(item.getBedSpaceIsNotNull() && item.getBedSpace().getBedNumberIsNotNull() ? item.getBedSpace().getBedNumber() : "");
			row.setTooltipForColBedNumber(item.getBedSpace().getBedNumberIsNotNull() ? item.getBedSpace().getBedNumber() : "");
			row.setColBedType(item.getBedSpaceIsNotNull() && item.getBedSpace().getBedSpaceTypeIsNotNull() ? item.getBedSpace().getBedSpaceType().toString() : "");
			row.setColBedStatus(item.getBedSpaceIsNotNull() && item.getCurrentBedStatusIsNotNull() && item.getCurrentBedStatus().getBedStatusIsNotNull() ? item.getCurrentBedStatus().getBedStatus().toString() : "");
			row.setColComments(item.getCommentIsNotNull() ? item.getComment().toString() : "");
			//WDEV-8334
			row.setTooltipForColComments(item.getCommentIsNotNull() ? item.getComment().toString() : "");
			row.setValue(item);
		}
	}
}
 
Example 6
Project: openMAXIMS   File: WardBayConfigDialogImpl.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 7
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateGrid(BedSpaceStateLiteVoCollection availableBeds) 
{	
	if (availableBeds != null)
	{
		for (BedSpaceStateLiteVo item: availableBeds)
		{
			grdAvailableBedsRow row = form.grdAvailableBeds().getRows().newRow();
			
			row.setColWard(item.getWardIsNotNull() && item.getWard().getNameIsNotNull() ? item.getWard().getName() : "");
			row.setColLocation(item.getBedSpaceIsNotNull() && item.getBedSpace().getWardTypeIsNotNull() ? item.getBedSpace().getWardType().toString() : "");
			//WDEV-18010
			row.setColBedNumber(item.getBedSpaceIsNotNull() && item.getBedSpace().getBedNumberIsNotNull() ? item.getBedSpace().getBedNumber() : "");
			row.setTooltipForColBedNumber(item.getBedSpace().getBedNumberIsNotNull() ? item.getBedSpace().getBedNumber() : "");
			row.setColBedType(item.getBedSpaceIsNotNull() && item.getBedSpace().getBedSpaceTypeIsNotNull() ? item.getBedSpace().getBedSpaceType().toString() : "");
			row.setColBedStatus(item.getBedSpaceIsNotNull() && item.getCurrentBedStatusIsNotNull() && item.getCurrentBedStatus().getBedStatusIsNotNull() ? item.getCurrentBedStatus().getBedStatus().toString() : "");
			row.setColComments(item.getCommentIsNotNull() ? item.getComment().toString() : "");
			//WDEV-8334
			row.setTooltipForColComments(item.getCommentIsNotNull() ? item.getComment().toString() : "");
			row.setValue(item);
		}
	}
}
 
Example 8
Project: openmaxims-linux   File: WardBayConfigDialogImpl.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 9
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void search() 
{
	AvailableBedsVo beds = populateDataFromScreen();
	
	form.getGlobalContext().STHK.setAvailableBedsListFilter(beds);
	form.getContextMenus().hideAllGenericGridMenuItems();

	form.grdAvailableBeds().getRows().clear();
	form.lbl6().setValue("Total : 0"); // WDEV-18099 
	BedSpaceStateLiteVoCollection availableBeds = null;
	
	if (beds.countFieldsWithValue() > 0)
	{
		availableBeds  = domain.listAvailableBeds(beds);
	}
	else
	{
		engine.showMessage("Please enter some valid search criteria.", "Invalid search criteria", MessageButtons.OK, MessageIcon.ERROR);
		return;
	}
	
	if (availableBeds == null || availableBeds.size() == 0)
	{
		engine.showMessage("No Bed records match your search criteria.", "No data found", MessageButtons.OK, MessageIcon.WARNING);
		return;
	}
	if (availableBeds != null)
		form.lbl6().setValue("Total : " + String.valueOf(availableBeds.size()));

	populateGrid(availableBeds);	
}
 
Example 10
Project: AvoinApotti   File: WardViewImpl.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 11
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void search() 
{
	AvailableBedsVo beds = populateDataFromScreen();
	
	form.getGlobalContext().STHK.setAvailableBedsListFilter(beds);
	form.getContextMenus().hideAllGenericGridMenuItems();

	form.grdAvailableBeds().getRows().clear();
	form.lbl6().setValue("Total: 0"); // WDEV-18099 
	BedSpaceStateLiteVoCollection availableBeds = null;
	form.getLocalContext().setSortOrderBedNo(null);
	
	if (beds.countFieldsWithValue() > 0)
	{
		availableBeds  = domain.listAvailableBeds(beds);
	}
	else
	{
		engine.showMessage("Please enter some valid search criteria.", "Invalid search criteria", MessageButtons.OK, MessageIcon.ERROR);
		return;
	}
	
	if (availableBeds == null || availableBeds.size() == 0)
	{
		engine.showMessage("No bed records match your search criteria.", "No data found", MessageButtons.OK, MessageIcon.WARNING);
		return;
	}
	if (availableBeds != null)
		form.lbl6().setValue("Total: " + String.valueOf(availableBeds.size()));
	
	if (availableBeds.size() >1)
	{	
		form.getLocalContext().setSortOrderBedNo(SortOrder.ASCENDING);
		availableBeds.sort(BedSpaceStateLiteVo.getBedNumberComparator(form.getLocalContext().getSortOrderBedNo()));
	}
	populateGrid(availableBeds);	
}
 
Example 12
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateGrid(BedSpaceStateLiteVoCollection availableBeds) 
{	
	form.grdAvailableBeds().getRows().clear();
	
	if (availableBeds == null)
		return;
	
	for (BedSpaceStateLiteVo item: availableBeds)
	 {
			grdAvailableBedsRow row = form.grdAvailableBeds().getRows().newRow();

			row.setColWard(item.getWardIsNotNull() && item.getWard().getNameIsNotNull() ? item.getWard().getName() : "");
			row.setTooltipForColWard(item.getWardIsNotNull() && item.getWard().getNameIsNotNull() ? item.getWard().getName() : "");//WDEV-22737
			row.setColLocation(item.getBedSpaceIsNotNull() && item.getBedSpace().getWardTypeIsNotNull() ? item.getBedSpace().getWardType().toString() : "");
			row.setTooltipForColLocation(item.getBedSpaceIsNotNull() && item.getBedSpace().getWardTypeIsNotNull() ? item.getBedSpace().getWardType().toString() : "");//WDEV-22737
			//WDEV-18010
			row.setColBedNumber(item.getBedSpaceIsNotNull() && item.getBedSpace().getBedNumberIsNotNull() ? item.getBedSpace().getBedNumber() : "");
			row.setTooltipForColBedNumber(item.getBedSpace() != null && item.getBedSpace().getBedNumberIsNotNull() ? item.getBedSpace().getBedNumber() : "");
			row.setColBedType(item.getBedSpaceIsNotNull() && item.getBedSpace().getBedSpaceTypeIsNotNull() ? item.getBedSpace().getBedSpaceType().toString() : "");
			row.setTooltipForColBedType(item.getBedSpaceIsNotNull() && item.getBedSpace().getBedSpaceTypeIsNotNull() ? item.getBedSpace().getBedSpaceType().toString() : "");//WDEV-22737
			row.setColBedStatus(item.getBedSpaceIsNotNull() && item.getCurrentBedStatusIsNotNull() && item.getCurrentBedStatus().getBedStatusIsNotNull() ? item.getCurrentBedStatus().getBedStatus().toString() : "");
			row.setTooltipForColBedStatus(item.getBedSpaceIsNotNull() && item.getCurrentBedStatusIsNotNull() && item.getCurrentBedStatus().getBedStatusIsNotNull() ? item.getCurrentBedStatus().getBedStatus().toString() : "");//WDEV-22737
			row.setColComments(item.getCommentIsNotNull() ? item.getComment().toString() : "");
			//WDEV-8334
			row.setTooltipForColComments(item.getCommentIsNotNull() ? item.getComment().toString() : "");
			if (ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS")) //WDEV-20328
			{
				row.setColWardStatus(getWardStatusTextDisplay(item.getWardStatus()));
				row.setTooltipForColWardStatus(getWardStatusTextDisplay(item.getWardStatus()));//WDEV-22737
			}
			row.setValue(item);
	 }		
}
 
Example 13
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateBedSpacesGrid(BedSpaceStateLiteVoCollection list)
{
	form.grdAvailableBeds().getRows().clear();
	if (list == null)
		return;
	for (BedSpaceStateLiteVo bedSpaceStateVo : list)
	{
		addNewBedSpaceRow(bedSpaceStateVo);
	}

}
 
Example 14
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void sortRecords()
{
	BedSpaceStateLiteVoCollection values = form.grdAvailableBeds().getValues();

	if (values.size() < 2)
		return;

	BedSpaceStateLiteVo selValue = form.grdAvailableBeds().getValue();
	form.getLocalContext().setSortOrderBedNumber(SortOrder.DESCENDING.equals(form.getLocalContext().getSortOrderBedNumber()) ? SortOrder.ASCENDING : SortOrder.DESCENDING);
	values.sort(BedSpaceStateLiteVo.getBedNumberComparator(form.getLocalContext().getSortOrderBedNumber()));

	populateBedSpacesGrid(values);
	if (selValue != null)
		form.grdAvailableBeds().setValue(selValue);	
}
 
Example 15
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void search() 
{
	AvailableBedsVo beds = populateDataFromScreen();
	
	form.getGlobalContext().STHK.setAvailableBedsListFilter(beds);
	form.getContextMenus().hideAllGenericGridMenuItems();

	form.grdAvailableBeds().getRows().clear();
	form.lbl6().setValue("Total : 0"); // WDEV-18099 
	BedSpaceStateLiteVoCollection availableBeds = null;
	
	if (beds.countFieldsWithValue() > 0)
	{
		availableBeds  = domain.listAvailableBeds(beds);
	}
	else
	{
		engine.showMessage("Please enter some valid search criteria.", "Invalid search criteria", MessageButtons.OK, MessageIcon.ERROR);
		return;
	}
	
	if (availableBeds == null || availableBeds.size() == 0)
	{
		engine.showMessage("No Bed records match your search criteria.", "No data found", MessageButtons.OK, MessageIcon.WARNING);
		return;
	}
	if (availableBeds != null)
		form.lbl6().setValue("Total : " + String.valueOf(availableBeds.size()));

	populateGrid(availableBeds);	
}
 
Example 16
Project: openMAXIMS   File: WardViewImpl.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 17
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
private void search() 
{
	AvailableBedsVo beds = populateDataFromScreen();
	
	form.getGlobalContext().STHK.setAvailableBedsListFilter(beds);
	form.getContextMenus().hideAllGenericGridMenuItems();

	form.grdAvailableBeds().getRows().clear();
	form.lbl6().setValue("Total : 0"); // WDEV-18099 
	BedSpaceStateLiteVoCollection availableBeds = null;
	
	if (beds.countFieldsWithValue() > 0)
	{
		availableBeds  = domain.listAvailableBeds(beds);
	}
	else
	{
		engine.showMessage("Please enter some valid search criteria.", "Invalid search criteria", MessageButtons.OK, MessageIcon.ERROR);
		return;
	}
	
	if (availableBeds == null || availableBeds.size() == 0)
	{
		engine.showMessage("No Bed records match your search criteria.", "No data found", MessageButtons.OK, MessageIcon.WARNING);
		return;
	}
	if (availableBeds != null)
		form.lbl6().setValue("Total : " + String.valueOf(availableBeds.size()));

	populateGrid(availableBeds);	
}
 
Example 18
Project: openmaxims-linux   File: WardViewImpl.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 19
Project: openMAXIMS   File: Logic.java   Source Code and License 4 votes vote down vote up
private void open()
{
	BedSpaceStateLiteVoCollection list = domain.listAvailableBedSpaces(form.getGlobalContext().Core.getWardViewPatientListWard());
	populateBedSpacesGrid(list);
}
 
Example 20
Project: openMAXIMS   File: WardViewImpl.java   Source Code and License 4 votes vote down vote up
public BedSpaceStateLiteVo getBedSpaceState(BedSpaceRefVo bed) 
{
	if(bed == null )
		throw new DomainRuntimeException("Invalid BedRefVo");
	
	String hql = "select bs,(select adm.healthyLodger from AdmissionDetail as adm where adm.pasEvent.id = bs.inpatientEpisode.pasEvent.id) from BedSpaceState as bs left join bs.bedSpace as bed where bed.id = " + bed.getID_BedSpace();
	
	List<?> bedState = null;
	
	//WDEV-23014 - Catch the Lock error and retry the entire transaction. After two retries, throw a SOE message. 

	try
	{
		bedState = getDomainFactory().find(hql);
	}
	catch (RuntimeException e) {
		if (e instanceof LockAcquisitionException) 
		{
			try
			{
				bedState = getDomainFactory().find(hql);
			}
			catch (RuntimeException e1) 
			{
				if (e1 instanceof LockAcquisitionException) 
				{
					throw new StaleStateException(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
				}
			}
		}
	}
	//WDEV-23014 ends here
	
	//WDEV-11039
	boolean hasAlerts = false;
	BedSpaceStateLiteVoCollection voColl  = new BedSpaceStateLiteVoCollection();
	if (bedState != null && bedState.size() > 0 && bedState.get(0) instanceof Object[])
	{
		Object[] recordDO = (Object[]) bedState.get(0);
		BedSpaceStateLiteVo bs = null;
		for (int i =0;i<recordDO.length;i++)
		{				
			if (recordDO[0] instanceof BedSpaceState)
			{	
				BedSpaceState doBed = (BedSpaceState)recordDO[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;

				bs  = BedSpaceStateLiteVoAssembler.create((BedSpaceState)recordDO[0]);
			}	
			if (bs.getInpatientEpisodeIsNotNull() && recordDO[1] != null && recordDO[1] instanceof HealthyLodger)
				bs.getInpatientEpisode().setHealthyLodgerDetails(HealthyLodgerVoAssembler.create((HealthyLodger)recordDO[1]));
		}
		if (bs != null)
			voColl.add(bs);

	}
	//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;
}