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

The following are Jave code examples for showing how to use setInpatientEpisode() 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: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
@Override
protected void onBtnInternalTransferClick() throws PresentationLogicException
{
	if (form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() && form.lyrDetail().tabBedMove().grdPatients().getValue() != null)
	{
		//WDEV-16030
		BedSpaceStateLiteVo domainBedSpaceState = domain.getBedSpaceStateStatusByBedId(form.lyrDetail().tabBedMove().grdPatients().getValue().getBed());

		if (domainBedSpaceState != null && domainBedSpaceState.getCurrentBedStatus() != null && BedStatus.OCCUPIED.equals(domainBedSpaceState.getCurrentBedStatus().getBedStatus()))
		{
			BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();
			voBedSpaceState.setInpatientEpisode(form.lyrDetail().tabBedMove().grdPatients().getValue());
			
			try
			{
				domain.saveInternalTransfer(form.lyrDetail().tabBedMove().grdPatients().getValue(), voBedSpaceState);
			}
			catch (StaleObjectException e)
			{
				engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
				populateBedMoveTabFromData();
			}
		}
		else
		{
			engine.showMessage("Patient has already been moved to another bed.");
		}

		engine.close(DialogResult.OK);
	}
}
 
Example 2
Project: AvoinApotti   File: BedInfoDialogImpl.java   Source Code and License Vote up 5 votes
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));	
}
 
Example 3
Project: openMAXIMS   File: BedInfoDialogImpl.java   Source Code and License Vote up 5 votes
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));	
}
 
Example 4
Project: openMAXIMS   File: Logic.java   Source Code and License Vote up 5 votes
@Override
protected void onBtnInternalTransferClick() throws PresentationLogicException
{
	if (form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() && form.lyrDetail().tabBedMove().grdPatients().getValue() != null)
	{
		//WDEV-16030
		BedSpaceStateLiteVo domainBedSpaceState = domain.getBedSpaceStateStatusByBedId(form.lyrDetail().tabBedMove().grdPatients().getValue().getBed());

		if (domainBedSpaceState != null && domainBedSpaceState.getCurrentBedStatus() != null && BedStatus.OCCUPIED.equals(domainBedSpaceState.getCurrentBedStatus().getBedStatus()))
		{
			BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();
			voBedSpaceState.setInpatientEpisode(form.lyrDetail().tabBedMove().grdPatients().getValue());
			
			try
			{
				domain.saveInternalTransfer(form.lyrDetail().tabBedMove().grdPatients().getValue(), voBedSpaceState);
			}
			catch (StaleObjectException e)
			{
				engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
				populateBedMoveTabFromData();
			}
		}
		else
		{
			engine.showMessage("Patient has already been moved to another bed.");
		}

		engine.close(DialogResult.OK);
	}
}
 
Example 5
Project: openMAXIMS   File: BedInfoDialogImpl.java   Source Code and License Vote up 5 votes
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));	
}
 
Example 6
Project: openmaxims-linux   File: Logic.java   Source Code and License Vote up 5 votes
@Override
protected void onBtnInternalTransferClick() throws PresentationLogicException
{
	if (form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() && form.lyrDetail().tabBedMove().grdPatients().getValue() != null)
	{
		//WDEV-16030
		BedSpaceStateLiteVo domainBedSpaceState = domain.getBedSpaceStateStatusByBedId(form.lyrDetail().tabBedMove().grdPatients().getValue().getBed());

		if (domainBedSpaceState != null && domainBedSpaceState.getCurrentBedStatus() != null && BedStatus.OCCUPIED.equals(domainBedSpaceState.getCurrentBedStatus().getBedStatus()))
		{
			BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();
			voBedSpaceState.setInpatientEpisode(form.lyrDetail().tabBedMove().grdPatients().getValue());
			
			try
			{
				domain.saveInternalTransfer(form.lyrDetail().tabBedMove().grdPatients().getValue(), voBedSpaceState);
			}
			catch (StaleObjectException e)
			{
				engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
				populateBedMoveTabFromData();
			}
		}
		else
		{
			engine.showMessage("Patient has already been moved to another bed.");
		}

		engine.close(DialogResult.OK);
	}
}
 
Example 7
Project: openmaxims-linux   File: BedInfoDialogImpl.java   Source Code and License Vote up 5 votes
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));	
}
 
Example 8
Project: openMAXIMS   File: BedInfoDialogImpl.java   Source Code and License Vote up 4 votes
public void saveTransferOut(PendingTransfersLiteVo pendingTransfer) throws StaleObjectException, DomainInterfaceException  //WDEV-20023
{
	if(pendingTransfer == null)
		throw new CodingRuntimeException("pendingTransfer is null in method saveTransferOut");
	if(!pendingTransfer.isValidated())
		throw new CodingRuntimeException("pendingTransfer has not been validated in method saveTransferOut");
	
	DomainFactory domainFactory = getDomainFactory();
	//WDEV-9192
	if(pendingTransfer.getInpatientEpisodeIsNotNull())
	{
		String currentTransfer = "";
		if(pendingTransfer.getID_PendingTransfers() != null)
			currentTransfer = " and pt.id <> '" +  pendingTransfer.getID_PendingTransfers() + "'";
		
		List existingPTs = getDomainFactory().find("from PendingTransfers pt where pt.inpatientEpisode.id = '" + pendingTransfer.getInpatientEpisode().getID_InpatientEpisode() + "'" + currentTransfer);
		if(existingPTs != null && existingPTs.size() > 0)
			throw new DomainInterfaceException("Patient already has a transfer pending, the screen will be refreshed");
	}
	
	//WDEV-10421
	PendingTransfers doTransfer = PendingTransfersLiteVoAssembler.extractPendingTransfers(getDomainFactory(), pendingTransfer);
	//get the admission detail record and update its history for transfers
	AdmissionDetail doAdmissionDetail = populateTransferHistory(doTransfer, TRANSFEROUT, null, null);
	//WDEV-20291 - starts here
	BedSpaceStateLiteVo bedSpaceVo = null;
	if (Boolean.TRUE.equals(pendingTransfer.getNoLongerInBed())) 
	{
		InpatientEpisode doInpatEp = doTransfer.getInpatientEpisode();
		if (doInpatEp != null && doInpatEp.getBed() != null)
		{
			bedSpaceVo = BedSpaceStateLiteVoAssembler.create(doInpatEp.getBed());
	
			if (bedSpaceVo.getCurrentBedStatusIsNotNull())
			{
				bedSpaceVo.setPreviousBedStatus((BedSpaceStateStatusLiteVo) bedSpaceVo.getCurrentBedStatus().clone());
				BedSpaceStateStatusLiteVo bedStatusVo = new BedSpaceStateStatusLiteVo();
				bedStatusVo.setBedStatus(BedStatus.AVAILABLE);
				bedStatusVo.setStatusDateTime(pendingTransfer.getTransferRequestDateTime());
				
				bedSpaceVo.setCurrentBedStatus(bedStatusVo);				
				
			}
			bedSpaceVo.setInpatientEpisode(null);	
			updateOccupiedBedsForWardAndBay(LocationLiteVoAssembler.create(doInpatEp.getBed().getWard()), LocationLiteVoAssembler.create(doInpatEp.getBed().getBay()), null);
		}
		doInpatEp.setBedNo(null); //WDEV-20291
	}
	try
	{
		if (bedSpaceVo != null && Boolean.TRUE.equals(pendingTransfer.getNoLongerInBed()))
		{	
			BedSpaceState bedDO = BedSpaceStateLiteVoAssembler.extractBedSpaceState(domainFactory, bedSpaceVo);
			domainFactory.save(bedDO);			
		}
		domainFactory.save(doTransfer);
		
		// WDEV-19774 - Trigger creation of A15 Pending Transfer HL7 message
		InpatientEpisodeVo inpatEpisodeVo = InpatientEpisodeVoAssembler.create(doTransfer.getInpatientEpisode());
		
		if(inpatEpisodeVo.getPasEvent()!=null)
		{
	    	ADT adtimpl = (ADT) getDomainImpl(ADTImpl.class);
			adtimpl.triggerPendingTransferEvent(inpatEpisodeVo.getPasEvent());
		} //WDEV-19974
					
		if(doAdmissionDetail != null)
			getDomainFactory().save(doAdmissionDetail);	
		
	}
	catch (IllegalArgumentException e)
	{
		//where object has been deleted - this happens when a transfer in has been deleted (transfer complete) and this user has the old pending transfer record and is trying to update it
		throw new DomainInterfaceException("Patient's transfer has already been processed, the screen will be refreshed");
	}
}
 
Example 9
Project: openMAXIMS   File: BedInfoDialogImpl.java   Source Code and License Vote up 4 votes
public void cancelHomeLeaveReturn(InpatientEpisodeLiteVo voInpat,BedSpaceStateLiteVo voBedSpaceState, HomeLeaveVo voHlToReOpen) throws DomainInterfaceException,StaleObjectException
{
	if (voInpat == null)
		throw new CodingRuntimeException("The InpatientEpisodeLiteVo argument cannot be null in method cancelHomeLeaveReturn()");
	if (voHlToReOpen == null)
		throw new CodingRuntimeException("The HomeLeaveVo argument cannot be null in method cancelHomeLeaveReturn()");
	if (!voHlToReOpen.isValidated())
		throw new CodingRuntimeException("The HomeLeaveVo is not validated in method cancelHomeLeaveReturn()");
	DomainFactory factory = getDomainFactory();

	InpatientEpisode inpatEpisodeDO = (InpatientEpisode) factory.getDomainObject(InpatientEpisode.class, voInpat.getID_InpatientEpisode());
	
	if (inpatEpisodeDO == null)
		throw new DomainInterfaceException("This patient is no longer an inpatient. The screen will be refreshed.");
	if (inpatEpisodeDO != null && inpatEpisodeDO.getVersion() > voInpat.getVersion_InpatientEpisode() &&  Boolean.TRUE.equals(inpatEpisodeDO.isIsOnHomeLeave()))
		throw new DomainInterfaceException("This inpatient has been sent on home leave or their home leave return was cancelled by another user. The screen will be refreshed.");
	
	if (inpatEpisodeDO.getHomeLeaves() != null && !inpatEpisodeDO.getHomeLeaves().isEmpty())
	{	
		HomeLeave homeLeaveDO = HomeLeaveVoAssembler.extractHomeLeave(factory, voHlToReOpen);
		
		if (homeLeaveDO != null)
		{
			if (inpatEpisodeDO.getHomeLeaves().contains(homeLeaveDO))
				inpatEpisodeDO.getHomeLeaves().set(inpatEpisodeDO.getHomeLeaves().indexOf(homeLeaveDO), homeLeaveDO);
			
			inpatEpisodeDO.setIsOnHomeLeave(true);
			inpatEpisodeDO.setDateOnHomeLeave(homeLeaveDO.getDateOnHomeLeave() != null ? homeLeaveDO.getDateOnHomeLeave() : null);
			inpatEpisodeDO.setTimeOnHomeLeave(homeLeaveDO.getTimeOnHomeLeave() != null ? homeLeaveDO.getTimeOnHomeLeave() : null);
			inpatEpisodeDO.setExpectedDateOfReturn(homeLeaveDO.getExpectedDateOfReturn() != null ? homeLeaveDO.getExpectedDateOfReturn() : null);
			inpatEpisodeDO.setExpectedTimeOfReturn(homeLeaveDO.getExpectedTimeOfReturn() != null ? homeLeaveDO.getExpectedTimeOfReturn()  : null);
			inpatEpisodeDO.setVacatedBedNumber(homeLeaveDO.getVacatedBedNumber() != null ? homeLeaveDO.getVacatedBedNumber() : null);

			if (voBedSpaceState != null && !Boolean.TRUE.equals(homeLeaveDO.isBedRetained()))
			{
				if (voBedSpaceState.getCurrentBedStatusIsNotNull())
				{
					voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
					voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
					voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
					voBedSpaceState.getCurrentBedStatus().setBedStatus(BedStatus.AVAILABLE);						
				}
							
				voBedSpaceState.setInpatientEpisode(null);
				
				inpatEpisodeDO.setBed(null);
			}
		}
		if (inpatEpisodeDO.getPasEvent() != null)
		{
			ADT adtimpl = (ADT) getDomainImpl(ADTImpl.class);
			adtimpl.triggerCancelReturnFromLeaveOfAbsenceEvent(new PASEventRefVo(inpatEpisodeDO.getPasEvent().getId(), inpatEpisodeDO.getPasEvent().getVersion()));
		}
		factory.save(inpatEpisodeDO);

		if (voBedSpaceState != null)
		{
			BedSpaceState doBed = BedSpaceStateLiteVoAssembler.extractBedSpaceState(factory, voBedSpaceState);
			factory.save(doBed);				
		}

		if (voBedSpaceState != null && !Boolean.TRUE.equals(voHlToReOpen.getBedRetained()))
			updateOccupiedBedsForWardAndBay(voBedSpaceState.getWard(), voBedSpaceState.getBay(), null);
		
		if (ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS") && voBedSpaceState != null && !Boolean.TRUE.equals(voHlToReOpen.getBedRetained()))
		{
			Sex tempGender = voInpat.getPasEvent() != null && voInpat.getPasEvent().getPatientIsNotNull() && voInpat.getPasEvent().getPatient().getSexIsNotNull() && !Sex.UNKNOWN.equals(voInpat.getPasEvent().getPatient().getSex())? voInpat.getPasEvent().getPatient().getSex() : null;
			checkAndUpdateBayConfig(factory, voBedSpaceState,tempGender);
		}
	}		
}