Java Code Examples for ims.core.vo.BedSpaceStateLiteVo.getBay()

The following are Jave code examples for showing how to use getBay() of the ims.core.vo.BedSpaceStateLiteVo class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: openMAXIMS   File: Logic.java   Source Code and License Vote up 6 votes
private String validateOnAdmission(LocationLiteVo ward)
{
	WardConfigLiteVo wardConfig = form.getLocalContext().getSelectedWardConfig();
	BedSpaceStateLiteVo selectedBedSpaceState = form.grdAvailableBeds().getValue();
	if (wardConfig == null)
		return null;

	StringBuilder str = new StringBuilder();
	String strMessage = "Cannot allocate bed at this time.";

	if (selectedBedSpaceState != null)
	{
		LocationLiteVo baySelected = selectedBedSpaceState.getBay();
		if (isBayBlocked(baySelected))
		{
			str.append("'" + baySelected.getName() + "' is currently blocked. " + strMessage);
		}
		else if (isBayClosed(baySelected))
		{
			str.append("'" + baySelected.getName() + "' is currently closed. " + strMessage);
		}			
	}		
	return str.length() > 0 ? str.toString() : null;
}
 
Example 2
Project: openMAXIMS   File: BedInfoDialogImpl.java   Source Code and License Vote up 5 votes
private void checkAndUpdatePreviousBayConfig(DomainFactory factory, BedSpaceStateLiteVo voBedSpacState, Sex tempGenderToSet) throws StaleObjectException
{
	if (voBedSpacState.getBay() == null || voBedSpacState.getWard() == null)
		return;

	WardConfigLiteVo wardConfigLiteVo = getWardConfig(voBedSpacState.getWard());
	BayConfigLiteVo bayConfig = getBayConfig(voBedSpacState.getBay(), wardConfigLiteVo);		
	boolean wasConfigChanged = false;

	if (bayConfig != null && bayConfig.getTemporaryBayGenderIsNotNull())
	{
		if (bayConfig.getNumOfOccupiedBeds() == null || bayConfig.getNumOfOccupiedBeds() == 0)
		{	
			bayConfig.setTemporaryBayGender(null);
			wasConfigChanged = true;
		}	
		if (tempGenderToSet != null)
		{	
			Sex tempGender = getTempGenderToInstateForPreviousBay(wardConfigLiteVo, bayConfig);
			if (tempGender != null)
			{	
				bayConfig.setTemporaryBayGender(tempGender);
				wasConfigChanged = true;
				if (wasConfigChanged)
				{	
					BayConfig bayConfigDO = BayConfigLiteVoAssembler.extractBayConfig(factory, bayConfig);
					factory.save(bayConfigDO);
				}
			}
		}
	}
}
 
Example 3
Project: openMAXIMS   File: BedAdmissionComponentImpl.java   Source Code and License Vote up 5 votes
private void checkAndUpdateBayConfig(DomainFactory factory, BedSpaceStateLiteVo voBedSpacState, Sex tempGenderToSet) throws StaleObjectException
{
	if (voBedSpacState.getBay() == null || voBedSpacState.getWard() == null)
		return;

	BayConfigLiteVo bayConfig =  getBayConfig(voBedSpacState.getBay());		

	if (bayConfig != null && bayConfig.getTemporaryBayGenderIsNotNull())
	{
		if (bayConfig.getNumOfOccupiedBeds() == null || bayConfig.getNumOfOccupiedBeds() == 0)
			bayConfig.setTemporaryBayGender(null);

		else if (allPatientsGenderMatchBayGender(bayConfig))
		{
			bayConfig.setTemporaryBayGender(Sex.MALE.equals(tempGenderToSet) ? Sex.FEMALE : Sex.MALE);				
		}
		else if (!tempGenderToSet.equals(bayConfig.getTemporaryBayGender()))
		{
			bayConfig.setTemporaryBayGender(tempGenderToSet);
		}
		if (!bayConfig.isValidated())
		{
			String[] err = bayConfig.validate();
			if (err != null)
			{	
				BayConfig bayConfigDO = BayConfigLiteVoAssembler.extractBayConfig(factory, bayConfig);				
				factory.save(bayConfigDO);
			}
		}			
	}
}
 
Example 4
Project: openMAXIMS   File: BedInfoDialogImpl.java   Source Code and License Vote up 4 votes
private void checkAndUpdateBayConfig(DomainFactory factory, BedSpaceStateLiteVo voBedSpacState, Sex tempGenderToSet) throws StaleObjectException
{
	if (voBedSpacState.getBay() == null || voBedSpacState.getWard() == null)
		return;

	WardConfigLiteVo wardConfigLiteVo = getWardConfig(voBedSpacState.getWard());
	BayConfigLiteVo bayConfig = getBayConfig(voBedSpacState.getBay(), wardConfigLiteVo);	

	if (bayConfig != null && bayConfig.getTemporaryBayGenderIsNotNull())
	{
		Integer intMales = countMalePatientsOnTheWard(wardConfigLiteVo.getWard(), bayConfig.getBay());
		Integer intFemales = countFemalePatientsOnTheWard(wardConfigLiteVo.getWard(), bayConfig.getBay());
		boolean cfgChanged = false;
		
		if (tempGenderToSet != null)
		{	
			if (bayConfig.getNumOfOccupiedBeds() == null || bayConfig.getNumOfOccupiedBeds() == 0 || (intFemales == 0 && intMales == 0))
			{	
				bayConfig.setTemporaryBayGender(null);
				cfgChanged = true;
			}
			else if (allPatientsGenderMatchBayGender(bayConfig) || (intFemales == 0 &&  intMales != 0)  || (intMales == 0 && intFemales != 0))
			{				
				if (intMales != null && intMales >0 && !Sex.MALE.equals(bayConfig.getTemporaryBayGender()))
				{
					bayConfig.setTemporaryBayGender(Sex.MALE);
					cfgChanged = true;
				}
				if (intFemales != null && intFemales >0 && !Sex.FEMALE.equals(bayConfig.getTemporaryBayGender()))
				{
					bayConfig.setTemporaryBayGender(Sex.FEMALE);
					cfgChanged = true;
				}			
			}
		}
		if (cfgChanged)
		{	
			String[] err = bayConfig.validate();
			if (err == null)
			{	
				BayConfig bayConfigDO = BayConfigLiteVoAssembler.extractBayConfig(factory, bayConfig);				
				factory.save(bayConfigDO);
			}
		}	

	}
}