Java 类ims.core.vo.lookups.BedStatus 实例源码

项目:AvoinApotti    文件:BedInfoDialogImpl.java   
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);
}
项目:AvoinApotti    文件:ADTImpl.java   
private void updateBed(DomainFactory factory, PASEvent peDo) throws StaleObjectException
{   
    BedSpaceState doBedSpaceState = getBedSpaceStateByPasEvent(peDo);
    if(doBedSpaceState != null)
    {
        doBedSpaceState.setPreviousBedStatus(doBedSpaceState.getCurrentBedStatus());
        doBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatus());
        doBedSpaceState.getCurrentBedStatus().setBedStatus(getDomLookup(BedStatus.AVAILABLE));
        doBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime().getJavaDate());
        doBedSpaceState.setInpatientEpisode(null);
        factory.save(doBedSpaceState);  
    }

    // WDEV-12588 If CareContext linked to this pasevent, update the bed number there too
    if (ConfigFlag.HL7.INPATIENT_EPISODE_MANAGEMENT_FROM_PAS.getValue())
    {
        CareContext doCareContext = (CareContext) getDomainFactory().findFirst("from CareContext cc where cc.pasEvent.id = " + peDo.getId());
        if (doCareContext != null)
        {
            doCareContext.setBedNumber(null);
            factory.save(doCareContext);
        }
    }

}
项目:openMAXIMS    文件:AssignBedToHomeLeaveInpatientImpl.java   
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);
}
项目:openMAXIMS    文件:ADTImpl.java   
private void updateBed(DomainFactory factory, PASEvent peDo) throws StaleObjectException
{   
    BedSpaceState doBedSpaceState = getBedSpaceStateByPasEvent(peDo);
    if(doBedSpaceState != null)
    {
        doBedSpaceState.setPreviousBedStatus(doBedSpaceState.getCurrentBedStatus());
        doBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatus());
        doBedSpaceState.getCurrentBedStatus().setBedStatus(getDomLookup(BedStatus.AVAILABLE));
        doBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime().getJavaDate());
        doBedSpaceState.setInpatientEpisode(null);
        factory.save(doBedSpaceState);  
    }

    // WDEV-12588 If CareContext linked to this pasevent, update the bed number there too
    if (ConfigFlag.HL7.INPATIENT_EPISODE_MANAGEMENT_FROM_PAS.getValue())
    {
        CareContext doCareContext = (CareContext) getDomainFactory().findFirst("from CareContext cc where cc.pasEvent.id = " + peDo.getId());
        if (doCareContext != null)
        {
            doCareContext.setBedNumber(null);
            factory.save(doCareContext);
        }
    }

}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
private int getNumberOfOccupiedBedsInBay(LocationRefVo bay) throws Exception
{
    if (bay == null || bay.getID_Location() == null)
        return 0;

    StringBuilder query = new StringBuilder("SELECT COUNT (bedSpace.id) FROM BedSpaceState AS bedSpaceState RIGHT JOIN bedSpaceState.bedSpace AS bedSpace ");
    query.append(" LEFT JOIN bedSpaceState.currentBedStatus AS currentStatus LEFT JOIN currentStatus.bedStatus AS bedStatus ");
    query.append(" LEFT JOIN bedSpaceState.bay AS bay ");

    query.append(" WHERE ");

    query.append(" bay.id = :BAY_ID AND bedStatus.id = :OCCUPIED_BED ");

    long occupiedBeds = getDomainFactory().countWithHQL(query.toString(), new String[] { "BAY_ID", "OCCUPIED_BED" }, new Object[] { bay.getID_Location(), BedStatus.OCCUPIED.getId() });

    return (int) occupiedBeds;
}
项目:openMAXIMS    文件:WardViewImpl.java   
private int getNumberOfOccupiedBedsInBay(LocationRefVo bay)
{
    int occupiedBeds = 0;

    FloorBedSpaceLayoutVo layout = listLayoutForCurrentBay((ILocation) bay);

    if (layout != null && layout.getFloorLayout() != null && layout.getBedSpaces() != null)
    {

        for (int x = 0; x < layout.getBedSpaces().size(); x++)
        {
            BedSpaceVo bedVo = layout.getBedSpaces().get(x);

            BedSpaceStateLiteVo state = getBedSpaceState(bedVo);

            if (state != null && state.getCurrentBedStatus() != null && BedStatus.OCCUPIED.equals(state.getCurrentBedStatus().getBedStatus()))
            {
                occupiedBeds += 1;
            }
        }
    }

    return occupiedBeds;
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
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);
}
项目:openMAXIMS    文件:ADTImpl.java   
private void updateBed(DomainFactory factory, PASEvent peDo) throws StaleObjectException
{   
    BedSpaceState doBedSpaceState = getBedSpaceStateByPasEvent(peDo);
    if(doBedSpaceState != null)
    {
        doBedSpaceState.setPreviousBedStatus(doBedSpaceState.getCurrentBedStatus());
        doBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatus());
        doBedSpaceState.getCurrentBedStatus().setBedStatus(getDomLookup(BedStatus.AVAILABLE));
        doBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime().getJavaDate());
        doBedSpaceState.setInpatientEpisode(null);
        factory.save(doBedSpaceState);  
    }

    // WDEV-12588 If CareContext linked to this pasevent, update the bed number there too
    if (ConfigFlag.HL7.INPATIENT_EPISODE_MANAGEMENT_FROM_PAS.getValue())
    {
        CareContext doCareContext = (CareContext) getDomainFactory().findFirst("from CareContext cc where cc.pasEvent.id = " + peDo.getId());
        if (doCareContext != null)
        {
            doCareContext.setBedNumber(null);
            factory.save(doCareContext);
        }
    }

}
项目:openmaxims-linux    文件:BedInfoDialogImpl.java   
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);
}
项目:openmaxims-linux    文件:ADTImpl.java   
private void updateBed(DomainFactory factory, PASEvent peDo) throws StaleObjectException
{   
    BedSpaceState doBedSpaceState = getBedSpaceStateByPasEvent(peDo);
    if(doBedSpaceState != null)
    {
        doBedSpaceState.setPreviousBedStatus(doBedSpaceState.getCurrentBedStatus());
        doBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatus());
        doBedSpaceState.getCurrentBedStatus().setBedStatus(getDomLookup(BedStatus.AVAILABLE));
        doBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime().getJavaDate());
        doBedSpaceState.setInpatientEpisode(null);
        factory.save(doBedSpaceState);  
    }

    // WDEV-12588 If CareContext linked to this pasevent, update the bed number there too
    if (ConfigFlag.HL7.INPATIENT_EPISODE_MANAGEMENT_FROM_PAS.getValue())
    {
        CareContext doCareContext = (CareContext) getDomainFactory().findFirst("from CareContext cc where cc.pasEvent.id = " + peDo.getId());
        if (doCareContext != null)
        {
            doCareContext.setBedNumber(null);
            factory.save(doCareContext);
        }
    }

}
项目:AvoinApotti    文件:Logic.java   
private DischargedEpisodeADTVo createInfantDischarge(InpatientEpisodeLiteVo voInpat)
{
    DischargedEpisodeADTVo voDischargedEpisode = new DischargedEpisodeADTVo();

    voDischargedEpisode.setDischargeDateTime(form.lyrDetail().tabDischarge().dtimDischarge().getValue());
    voDischargedEpisode.setDischargeDestination(form.lyrDetail().tabDischarge().cmbDischargeDestination().getValue());
    voDischargedEpisode.setMethodOfDischarge(form.lyrDetail().tabDischarge().cmbMethodDischarge().getValue());

    BedSpaceStateLiteVo voBedSpaceState = domain.getBedSpaceStateByInpatientEpisode(voInpat);
    if (voBedSpaceState != null && voBedSpaceState.getInpatientEpisodeIsNotNull())
    {
        voDischargedEpisode.setPasEvent(voBedSpaceState.getInpatientEpisode().getPasEvent());
        voDischargedEpisode.setConsultantStays(voBedSpaceState.getInpatientEpisode().getConsultantStays());
        voDischargedEpisode.setWardStays(voBedSpaceState.getInpatientEpisode().getWardStays());
    }
    else
        voDischargedEpisode.setPasEvent(voInpat.getPasEvent());

    // move to previous
    if (voBedSpaceState != null && voBedSpaceState.getCurrentBedStatusIsNotNull())
    {
        voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
        voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
        voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
        voBedSpaceState.getCurrentBedStatus().setBedStatus(form.lyrDetail().tabDischarge().chkAllocateForCleaning().getValue() ? BedStatus.FOR_CLEANING : BedStatus.AVAILABLE);
    }

    voDischargedEpisode.setIsActive(true);
    voDischargedEpisode.setBedSpaceForInfant(voBedSpaceState);
    return voDischargedEpisode;
}
项目:AvoinApotti    文件:Logic.java   
@Override
protected void onBtnCloseClick() throws PresentationLogicException
{
    BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

    if (voBedSpaceState == null)
        throw new CodingRuntimeException("voBedSpaceState is null in method onBtnCloseClick");

    // move to previous
    if (voBedSpaceState.getCurrentBedStatusIsNotNull())
    {
        voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
        voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
        voBedSpaceState.getCurrentBedStatus().setStatusDateTime(form.lyrDetail().tabCloseBed().dtimClose().getValue());
        voBedSpaceState.getCurrentBedStatus().setBedStatus(BedStatus.CLOSED);
    }

    String[] arrErrors = voBedSpaceState.validate(getUIValidationForCloseBed());
    if (arrErrors != null)
    {
        engine.showErrors(arrErrors);
        return;
    }

    try
    {
        domain.saveCloseBed(voBedSpaceState, form.lyrDetail().tabCloseBed().cmbUser().getValue(), form.lyrDetail().tabCloseBed().cmbCloseReason().getValue(), form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        initialise();
        engine.close(DialogResult.OK);
        return;
    }

    engine.close(DialogResult.OK);
}
项目:AvoinApotti    文件:Logic.java   
@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);
    }
}
项目:AvoinApotti    文件:Logic.java   
private Boolean areOccupiedBeds(BedSpaceVoCollection getBedSpaces)
{
    if (getBedSpaces == null)
        return false;

    for (int i=0; i < getBedSpaces.size(); i++)
    {
        BedSpaceStateStatusLiteVo bedSpaceState = domain.getBedSpaceStateStatus(getBedSpaces.get(i));

        if (BedStatus.OCCUPIED.equals(bedSpaceState.getBedStatus()))
            return true;
    }

    return false;
}
项目:openMAXIMS    文件:Logic.java   
private void onBedInfoDialogFormOpen(Object[] args)
{
    if (!ConfigFlag.DOM.USE_PDS.getValue().equals("None"))
        form.lyrDetail().tabAdmission().btnAdmit().setPostbackRequirePdsAuthentication(true);

    initialise(false, false);
    //WDEV-23052 - chair/bed label
    setBedTypeLabels(form.getGlobalContext().Core.getSelectedBedSpaceState());
    //WDEV-9790 - parameter passed from wardview will indicate its readonly state
    if(args != null && args.length > 0) //WDEV-10421 - null pointer fix
    {
        if(args[0] instanceof Boolean)
        {
            if((Boolean)args[0].equals(true))
            {
                form.getLocalContext().setIsReadOnly(true);
                setDialogAsReadOnly();
            }   
        }           
    }       
    BedDialogPatientDataTabs customTabToOpen = getCustomTabToOpen(args);

    // Show initial tab when the form is open
    BedStatus status = form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getCurrentBedStatusIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getCurrentBedStatus().getBedStatusIsNotNull() ? form.getGlobalContext().Core.getSelectedBedSpaceState().getCurrentBedStatus().getBedStatus() : null;

    showInitialTab(status, customTabToOpen);
    populateInstanceControls(status);
}
项目:openMAXIMS    文件:Logic.java   
private DischargedEpisodeADTVo createInfantDischarge(InpatientEpisodeLiteVo voInpat)
{
    DischargedEpisodeADTVo voDischargedEpisode = new DischargedEpisodeADTVo();

    voDischargedEpisode.setDischargeDateTime(form.lyrDetail().tabDischarge().dtimDischarge().getValue());
    voDischargedEpisode.setDischargeDestination(form.lyrDetail().tabDischarge().cmbDischargeDestination().getValue());
    voDischargedEpisode.setMethodOfDischarge(form.lyrDetail().tabDischarge().cmbMethodDischarge().getValue());

    BedSpaceStateLiteVo voBedSpaceState = domain.getBedSpaceStateByInpatientEpisode(voInpat);
    if (voBedSpaceState != null && voBedSpaceState.getInpatientEpisodeIsNotNull())
    {
        voDischargedEpisode.setPasEvent(voBedSpaceState.getInpatientEpisode().getPasEvent());
        voDischargedEpisode.setConsultantStays(voBedSpaceState.getInpatientEpisode().getConsultantStays());
        voDischargedEpisode.setWardStays(voBedSpaceState.getInpatientEpisode().getWardStays());
    }
    else
        voDischargedEpisode.setPasEvent(voInpat.getPasEvent());

    // move to previous
    if (voBedSpaceState != null && voBedSpaceState.getCurrentBedStatusIsNotNull())
    {
        voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
        voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
        voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
        voBedSpaceState.getCurrentBedStatus().setBedStatus(form.lyrDetail().tabDischarge().chkAllocateForCleaning().getValue() ? BedStatus.FOR_CLEANING : BedStatus.AVAILABLE);
    }

    voDischargedEpisode.setIsActive(true);
    voDischargedEpisode.setBedSpaceForInfant(voBedSpaceState);
    return voDischargedEpisode;
}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBtnCloseClick() throws PresentationLogicException
{
    BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

    if (voBedSpaceState == null)
        throw new CodingRuntimeException("voBedSpaceState is null in method onBtnCloseClick");

    // move to previous
    if (voBedSpaceState.getCurrentBedStatusIsNotNull())
    {
        voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
        voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
        voBedSpaceState.getCurrentBedStatus().setStatusDateTime(form.lyrDetail().tabCloseBed().dtimClose().getValue());
        voBedSpaceState.getCurrentBedStatus().setBedStatus(BedStatus.CLOSED);
    }

    String[] arrErrors = voBedSpaceState.validate(getUIValidationForCloseBed());
    if (arrErrors != null)
    {
        engine.showErrors(arrErrors);
        return;
    }

    try
    {
        domain.saveCloseBed(voBedSpaceState, form.lyrDetail().tabCloseBed().cmbUser().getValue(), form.lyrDetail().tabCloseBed().cmbCloseReason().getValue(), form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        initialise(false, false); //WDEV-17662
        engine.close(DialogResult.OK);
        return;
    }

    engine.close(DialogResult.OK);
}
项目:openMAXIMS    文件:Logic.java   
private String getBedTooltip(BedSpaceVo bedSpace, BedSpaceStateShortVo bedState)
{
    if (bedSpace == null)
        return null;

    StringBuilder tooltip = new StringBuilder();

    if (!ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS"))
    {
        if (bedSpace.getDescription() != null)
            tooltip.append("<b>Description : </b> ").append(bedSpace.getDescription()).append("<br>");

        if (bedState != null && bedState.getCurrentBedStatus() != null 
            && (BedStatus.FOR_CLEANING.equals(bedState.getCurrentBedStatus().getBedStatus()) || BedStatus.CLOSED.equals(bedState.getCurrentBedStatus().getBedStatus())))
        {
            if (bedState.getCurrentBedStatus().getStatusDateTime() != null)
            tooltip.append("<b>Closure Date/Time: </b>").append(bedState.getCurrentBedStatus().getStatusDateTime().toString()).append("<br/>");

            if (bedState.getCurrentBedStatus().getReasonForClosure() != null)
                tooltip.append("<b>Reason for Closure: </b>").append(bedState.getCurrentBedStatus().getReasonForClosure()).append("<br/>");

            if (bedState.getCurrentBedStatus().getEstReopeningDateTime() != null)
                tooltip.append("<b>Estimated Re-Opening Date/Time: </b>").append(bedState.getCurrentBedStatus().getEstReopeningDateTime());
        }
    }
    else if (bedState != null && ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS"))
    {
        tooltip.append(buildBedTooltip(bedState));
    }
    else
    {
        tooltip.append(bedSpace.getDescription());
    }

    return tooltip.toString();
}
项目:openMAXIMS    文件:Logic.java   
private Boolean areOccupiedBeds(BedSpaceVoCollection getBedSpaces)
{
    if (getBedSpaces == null)
        return false;

    for (int i=0; i < getBedSpaces.size(); i++)
    {
        BedSpaceStateStatusLiteVo bedSpaceState = domain.getBedSpaceStateStatus(getBedSpaces.get(i));

        if (BedStatus.OCCUPIED.equals(bedSpaceState.getBedStatus()))
            return true;
    }

    return false;
}
项目:openMAXIMS    文件:WardViewPatientListImpl.java   
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);     
}
项目:openMAXIMS    文件:Logic.java   
private DischargedEpisodeADTVo createInfantDischarge(InpatientEpisodeLiteVo voInpat)
{
    DischargedEpisodeADTVo voDischargedEpisode = new DischargedEpisodeADTVo();

    voDischargedEpisode.setDischargeDateTime(form.lyrDetail().tabDischarge().dtimDischarge().getValue());
    voDischargedEpisode.setDischargeDestination(form.lyrDetail().tabDischarge().cmbDischargeDestination().getValue());
    voDischargedEpisode.setMethodOfDischarge(form.lyrDetail().tabDischarge().cmbMethodDischarge().getValue());

    BedSpaceStateLiteVo voBedSpaceState = domain.getBedSpaceStateByInpatientEpisode(voInpat);
    if (voBedSpaceState != null && voBedSpaceState.getInpatientEpisodeIsNotNull())
    {
        voDischargedEpisode.setPasEvent(voBedSpaceState.getInpatientEpisode().getPasEvent());
        voDischargedEpisode.setConsultantStays(voBedSpaceState.getInpatientEpisode().getConsultantStays());
        voDischargedEpisode.setWardStays(voBedSpaceState.getInpatientEpisode().getWardStays());
    }
    else
        voDischargedEpisode.setPasEvent(voInpat.getPasEvent());

    // move to previous
    if (voBedSpaceState != null && voBedSpaceState.getCurrentBedStatusIsNotNull())
    {
        voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
        voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
        voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
        voBedSpaceState.getCurrentBedStatus().setBedStatus(form.lyrDetail().tabDischarge().chkAllocateForCleaning().getValue() ? BedStatus.FOR_CLEANING : BedStatus.AVAILABLE);
    }

    voDischargedEpisode.setIsActive(true);
    voDischargedEpisode.setBedSpaceForInfant(voBedSpaceState);
    return voDischargedEpisode;
}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBtnCloseClick() throws PresentationLogicException
{
    BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

    if (voBedSpaceState == null)
        throw new CodingRuntimeException("voBedSpaceState is null in method onBtnCloseClick");

    // move to previous
    if (voBedSpaceState.getCurrentBedStatusIsNotNull())
    {
        voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
        voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
        voBedSpaceState.getCurrentBedStatus().setStatusDateTime(form.lyrDetail().tabCloseBed().dtimClose().getValue());
        voBedSpaceState.getCurrentBedStatus().setBedStatus(BedStatus.CLOSED);
    }

    String[] arrErrors = voBedSpaceState.validate(getUIValidationForCloseBed());
    if (arrErrors != null)
    {
        engine.showErrors(arrErrors);
        return;
    }

    try
    {
        domain.saveCloseBed(voBedSpaceState, form.lyrDetail().tabCloseBed().cmbUser().getValue(), form.lyrDetail().tabCloseBed().cmbCloseReason().getValue(), form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        initialise();
        engine.close(DialogResult.OK);
        return;
    }

    engine.close(DialogResult.OK);
}
项目:openMAXIMS    文件:Logic.java   
@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);
    }
}
项目:openMAXIMS    文件:Logic.java   
private Boolean areOccupiedBeds(BedSpaceVoCollection getBedSpaces)
{
    if (getBedSpaces == null)
        return false;

    for (int i=0; i < getBedSpaces.size(); i++)
    {
        BedSpaceStateStatusLiteVo bedSpaceState = domain.getBedSpaceStateStatus(getBedSpaces.get(i));

        if (BedStatus.OCCUPIED.equals(bedSpaceState.getBedStatus()))
            return true;
    }

    return false;
}
项目:openmaxims-linux    文件:Logic.java   
private DischargedEpisodeADTVo createInfantDischarge(InpatientEpisodeLiteVo voInpat)
{
    DischargedEpisodeADTVo voDischargedEpisode = new DischargedEpisodeADTVo();

    voDischargedEpisode.setDischargeDateTime(form.lyrDetail().tabDischarge().dtimDischarge().getValue());
    voDischargedEpisode.setDischargeDestination(form.lyrDetail().tabDischarge().cmbDischargeDestination().getValue());
    voDischargedEpisode.setMethodOfDischarge(form.lyrDetail().tabDischarge().cmbMethodDischarge().getValue());

    BedSpaceStateLiteVo voBedSpaceState = domain.getBedSpaceStateByInpatientEpisode(voInpat);
    if (voBedSpaceState != null && voBedSpaceState.getInpatientEpisodeIsNotNull())
    {
        voDischargedEpisode.setPasEvent(voBedSpaceState.getInpatientEpisode().getPasEvent());
        voDischargedEpisode.setConsultantStays(voBedSpaceState.getInpatientEpisode().getConsultantStays());
        voDischargedEpisode.setWardStays(voBedSpaceState.getInpatientEpisode().getWardStays());
    }
    else
        voDischargedEpisode.setPasEvent(voInpat.getPasEvent());

    // move to previous
    if (voBedSpaceState != null && voBedSpaceState.getCurrentBedStatusIsNotNull())
    {
        voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
        voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
        voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
        voBedSpaceState.getCurrentBedStatus().setBedStatus(form.lyrDetail().tabDischarge().chkAllocateForCleaning().getValue() ? BedStatus.FOR_CLEANING : BedStatus.AVAILABLE);
    }

    voDischargedEpisode.setIsActive(true);
    voDischargedEpisode.setBedSpaceForInfant(voBedSpaceState);
    return voDischargedEpisode;
}
项目:openmaxims-linux    文件:Logic.java   
@Override
protected void onBtnCloseClick() throws PresentationLogicException
{
    BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

    if (voBedSpaceState == null)
        throw new CodingRuntimeException("voBedSpaceState is null in method onBtnCloseClick");

    // move to previous
    if (voBedSpaceState.getCurrentBedStatusIsNotNull())
    {
        voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
        voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
        voBedSpaceState.getCurrentBedStatus().setStatusDateTime(form.lyrDetail().tabCloseBed().dtimClose().getValue());
        voBedSpaceState.getCurrentBedStatus().setBedStatus(BedStatus.CLOSED);
    }

    String[] arrErrors = voBedSpaceState.validate(getUIValidationForCloseBed());
    if (arrErrors != null)
    {
        engine.showErrors(arrErrors);
        return;
    }

    try
    {
        domain.saveCloseBed(voBedSpaceState, form.lyrDetail().tabCloseBed().cmbUser().getValue(), form.lyrDetail().tabCloseBed().cmbCloseReason().getValue(), form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        initialise();
        engine.close(DialogResult.OK);
        return;
    }

    engine.close(DialogResult.OK);
}
项目:openmaxims-linux    文件:Logic.java   
@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);
    }
}
项目:openmaxims-linux    文件:Logic.java   
private Boolean areOccupiedBeds(BedSpaceVoCollection getBedSpaces)
{
    if (getBedSpaces == null)
        return false;

    for (int i=0; i < getBedSpaces.size(); i++)
    {
        BedSpaceStateStatusLiteVo bedSpaceState = domain.getBedSpaceStateStatus(getBedSpaces.get(i));

        if (BedStatus.OCCUPIED.equals(bedSpaceState.getBedStatus()))
            return true;
    }

    return false;
}
项目:AvoinApotti    文件:Logic.java   
@Override
protected void onBtnAssignClick() throws PresentationLogicException
{
    saveReOpenOrAssign(BedStatus.FOR_CLEANING);
}
项目:AvoinApotti    文件:Logic.java   
@Override
protected void onBtnReOpenClick() throws PresentationLogicException
{
    saveReOpenOrAssign(BedStatus.AVAILABLE);
}
项目:AvoinApotti    文件:Logic.java   
private void saveReOpenOrAssign(BedStatus status)
{
    ////WDEV-17935
    if (BedStatus.FOR_CLEANING.equals(status))
    {
        String[] errCleaningBed = getUIValidationForCloseBed();
        if (errCleaningBed != null)
        {
            engine.showErrors(errCleaningBed);
            return;
        }
    }

    BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

    if (voBedSpaceState == null)
        throw new CodingRuntimeException("voBedSpaceState is null in method saveReOpenOrAssign");

    // move to previous
    if (voBedSpaceState.getCurrentBedStatusIsNotNull())
    {
        voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
        voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
        voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
        voBedSpaceState.getCurrentBedStatus().setBedStatus(status);

        //WDEV-17935
        if (BedStatus.FOR_CLEANING.equals(status))
        {
            voBedSpaceState.getCurrentBedStatus().setReasonForClosure(form.lyrDetail().tabCloseBed().cmbCloseReason().getValue());
            voBedSpaceState.getCurrentBedStatus().setEstReopeningDateTime(form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
        }
    }

    String[] arrErrors = voBedSpaceState.validate();
    if (arrErrors != null)
    {
        engine.showErrors(arrErrors);
        return;
    }

    try
    {
        domain.saveReOpenOrAssignBed(voBedSpaceState);
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        initialise();
        return;
    }

    engine.close(DialogResult.OK);
}
项目:AvoinApotti    文件:WardDataViewImpl.java   
/**
 * A list of all the occupied beds and associated inpatients across a ward
 */
public WardDataViewVoCollection listInpatientsInBedsByWard(LocationRefVo ward)
{
    if (ward == null || ward.getID_Location() == null)
        throw new CodingRuntimeException("ward is null or id not provided in method listInpatientsInBedsByWard");

    WardDataViewVoCollection voCollWdv = new WardDataViewVoCollection();

    String hql = "select bed, pat, bay, pe,inpatEpis from BedSpaceState as bedSpaceState left join bedSpaceState.bedSpace as bed left join bedSpaceState.currentBedStatus as currentStatus left join bedSpaceState.inpatientEpisode as inpatEpis left join inpatEpis.pasEvent as pe left join pe.patient as pat left join bedSpaceState.bay as bay " +
            "where (bedSpaceState.ward.id = :wardId and bedSpaceState.inpatientEpisode is not null  and currentStatus.bedStatus = :occupied)";

    List wdvList = getDomainFactory().find(hql, new String[]{"wardId","occupied"}, new Object[]{ward.getID_Location(), getDomLookup(BedStatus.OCCUPIED)});
    if(wdvList != null && wdvList.size() > 0)
    {
        Iterator it = wdvList.iterator();
        while(it.hasNext())
        {
            Object[] item = (Object[])it.next();
            BedSpace doBed = (BedSpace) item[0];
            Patient doPat = (Patient) item[1];
            Location doBay = (Location) item[2];
            PASEvent doPe = (PASEvent) item[3];
            InpatientEpisode doInpat = (InpatientEpisode) item[4]; //wdev-14784

            WardDataViewVo voWardDv = new WardDataViewVo(); 
            voWardDv.setBed(BedSpaceVoAssembler.create(doBed));
            voWardDv.setBay(LocationLiteVoAssembler.create(doBay));
            voWardDv.setPatient(PatientShortAssembler.create(doPat));
            voWardDv.getPatient().setHasAlerts(doPat.getPatientAlerts() != null && doPat.getPatientAlerts().size() > 0 ? true : false);
            voWardDv.setInpatEpisode(InpatientEpisodeForVTERiskAsessmentVoAssembler.create(doInpat)); //wdev-14784
            //wdev-11083

            Iterator<ims.core.clinical.domain.objects.PatientAlert> patAlert = doPat.getPatientAlerts().iterator();

            boolean flagHasAlerts = false;
            while(patAlert != null && patAlert.hasNext())
            {                   
                if(Boolean.TRUE.equals(patAlert.next().isIsCurrentlyActiveAlert()))
                {
                    flagHasAlerts = true;
                    break;

                }
            }
            voWardDv.getPatient().setHasActiveAlerts(flagHasAlerts);
            //end wdev-11083
            voWardDv.setPasEvent(PasEventADTVoAssembler.create(doPe));

            voCollWdv.add(voWardDv);
        }
    }

    voCollWdv.sort();
    return voCollWdv;
}
项目:openMAXIMS    文件:Logic.java   
private Color getRowColour(WardDataViewVo bedSpace)
{
    ColorBean darkOrangeBean = new ColorBean();
    darkOrangeBean.setName("Dark Orange");
    darkOrangeBean.setValue(INTENSE_ORANGE_COLOR_HEXA_CODE);
    Color darkOrange = new Color(darkOrangeBean);

    if (bedSpace.getBedSpaceState() != null && bedSpace.getBedSpaceState().getCurrentBedStatus() != null)
    {
        if( BedStatus.FOR_CLEANING.equals(bedSpace.getBedSpaceState().getCurrentBedStatus().getBedStatus()))
            return Color.Magenta;

        else if(BedStatus.CLOSED.equals(bedSpace.getBedSpaceState().getCurrentBedStatus().getBedStatus()))
            return Color.Gray;

        else if(BedStatus.AVAILABLE.equals(bedSpace.getBedSpaceState().getCurrentBedStatus().getBedStatus()))
            return Color.LimeGreen;
    }

    //WDEV-22309 

    if (bedSpace.getPatientIsNotNull() && bedSpace.getPatient().getDodIsNotNull())
        return Color.Yellow;

    if (isPatientOnTrackingMovement(bedSpace))
        return Color.RoyalBlue;     

    if (bedSpace.getInpatEpisodeIsNotNull())
    {           
        if (isPatientOnHomeLeave(bedSpace))
            return Color.LightGray;

        if (bedSpace.getPendingTransfer() != null)
            return Color.LightSkyBlue;

        /**     Each row in the list will be assigned a background colour according to the bed status: 
        //          White. Occupied. Estimated date/time of discharge >24hrs from current date/time 
        //          Amber. Occupied. Estimated date/time of discharge <24hrs from current date/time 
        //          Red. Occupied. Confirmed discharge  */

        if (bedSpace.getInpatEpisode().isDischargeDueWithin24Hrs())
            return Boolean.TRUE.equals(bedSpace.getInpatEpisode().getIsConfirmedDischarge()) ? Color.Red : darkOrange;  


    }       
    return null;
}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBtnAssignClick() throws PresentationLogicException
{
    saveReOpenOrAssign(BedStatus.FOR_CLEANING);
}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBtnReOpenClick() throws PresentationLogicException
{
    saveReOpenOrAssign(BedStatus.AVAILABLE);
}
项目:openMAXIMS    文件:Logic.java   
private void saveReOpenOrAssign(BedStatus status)
{
    ////WDEV-17935
    if (BedStatus.FOR_CLEANING.equals(status))
    {
        String[] errCleaningBed = getUIValidationForCloseBed();
        if (errCleaningBed != null)
        {
            engine.showErrors(errCleaningBed);
            return;
        }
    }

    BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

    if (voBedSpaceState == null)
        throw new CodingRuntimeException("voBedSpaceState is null in method saveReOpenOrAssign");

    // move to previous
    if (voBedSpaceState.getCurrentBedStatusIsNotNull())
    {
        voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
        voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
        voBedSpaceState.getCurrentBedStatus().setStatusDateTime(form.lyrDetail().tabCloseBed().dtimClose().getValue()); // WDEV-22423 - take date from screen
        voBedSpaceState.getCurrentBedStatus().setBedStatus(status);

        //WDEV-17935
        if (BedStatus.FOR_CLEANING.equals(status))
        {
            voBedSpaceState.getCurrentBedStatus().setReasonForClosure(form.lyrDetail().tabCloseBed().cmbCloseReason().getValue());
            voBedSpaceState.getCurrentBedStatus().setEstReopeningDateTime(form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
        }
    }

    String[] arrErrors = voBedSpaceState.validate();
    if (arrErrors != null)
    {
        engine.showErrors(arrErrors);
        return;
    }

    try
    {
        domain.saveReOpenOrAssignBed(voBedSpaceState);
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        initialise(false, false); //WDEV-17662
        return;
    }

    engine.close(DialogResult.OK);
}
项目:openMAXIMS    文件:Logic.java   
private void movePatientToBed()
{
    if (form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() && form.lyrDetail().tabBedMove().grdPatients().getValue() != null)
    {
        if (ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS"))
        {
            String wardAvailabilityErrors = validateInternalTransferInWard(form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() ? form.getGlobalContext().Core.getSelectedBedSpaceState().getWard() : form.getGlobalContext().Core.getADTWard());
            if(wardAvailabilityErrors != null)
            {
                form.getLocalContext().setMessageBoxWardBayAvailability(engine.showMessage(wardAvailabilityErrors,"Not Allowed", MessageButtons.OK, MessageIcon.INFORMATION));
                return;
            }
            boolean bValidate = isBedAllocationValidatedByRelevantRule(form.getGlobalContext().Core.getBedRuleBreachReason(), form.getLocalContext().getTabFocused());
            if (!bValidate)
                return;
        }   
        //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();

            try
            {
                domain.saveInternalTransfer(form.lyrDetail().tabBedMove().grdPatients().getValue(), voBedSpaceState, form.getGlobalContext().Core.getBedRuleBreachReason());
            }
            catch (StaleObjectException e)
            {
                engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
                populateBedMoveTabFromData(false);
            }
        }
        else
        {
            engine.showMessage("This patient has been already moved to another bed/chair.");
        }

        engine.close(DialogResult.OK);
    }
}
项目:openMAXIMS    文件:Logic.java   
private void setFocusOnLastSelectedTab(BedDialogPatientDataTabs tab, BedStatus bedStatus, boolean refreshData)
{
    if (!BedStatus.OCCUPIED.equals(bedStatus))
        return;

    if (BedDialogPatientDataTabs.TAB_DEMOGRAPHICS.equals(tab))
    {
        form.lyrDetail().showtabPatient();
        return;
    }
    else if (BedDialogPatientDataTabs.TAB_TRANSFER_OUT.equals(tab))
    {
        form.lyrDetail().showtabTransfer();
        form.lyrDetail().tabTransfer().lyrTransfer().showtabOut();
        if (refreshData)
        {   
            form.lyrDetail().tabTransfer().btnCancelTransfer().setVisible(form.getLocalContext().getPendingTransferOutIsNotNull());
            populateTransferOutTabFromData();
        }
        return;
    }
    else if (BedDialogPatientDataTabs.TAB_TRANSFER_IN.equals(tab))
    {
        form.lyrDetail().showtabTransfer();
        form.lyrDetail().tabTransfer().lyrTransfer().showtabIn();
        if (refreshData)
        {   
            populateTransferInListFromData();               
        }   
        return;
    }
    else if (BedDialogPatientDataTabs.TAB_TRANSFER_CONSULTANT.equals(tab))
    {
        form.lyrDetail().showtabTransfer();
        form.lyrDetail().tabTransfer().lyrTransfer().showtabConsultant();
        return;

    }
    else if (BedDialogPatientDataTabs.TAB_DISCHARGE.equals(tab))
    {
        form.lyrDetail().showtabDischarge();
        if (refreshData)
        {
            bindTreatmentDiagnosisDereferredReason(domain.listCancellationTypeReason());
            populateDischargeTabFromData();
        }   
        return;

    }
    else if (BedDialogPatientDataTabs.TAB_EST_DISCHARGE.equals(tab))
    {
        form.lyrDetail().showtabReadyForDischarge();
        if (refreshData)
        {   
            populateEstimatedDischargeTabFromData();
            boolean bShowExtendedLOSReason = form.getLocalContext().getAdmissionDetails() != null && form.getLocalContext().getAdmissionDetails().getEstDischargeDate() != null && form.lyrDetail().tabReadyForDischarge().dtimNewEstDischDate().getValue() != null && form.lyrDetail().tabReadyForDischarge().dtimNewEstDischDate().getValue().isGreaterThan(form.getLocalContext().getAdmissionDetails().getEstDischargeDate());
            updateReadyForDischargeControlsState(form.lyrDetail().tabReadyForDischarge().dtimNewEstDischDate().getValue() != null || Boolean.TRUE.equals(form.getLocalContext().getbWasReviseEstDischargeDatePressed()), form.lyrDetail().tabReadyForDischarge().dtimConfirmedDischargeDate().getValue() != null || Boolean.TRUE.equals(form.getLocalContext().getbWasConfirmPatientDischPressed()), DelayedDischargeEnumeration.rdoDelayedDischYes.equals(form.lyrDetail().tabReadyForDischarge().DelayedDischarge().getValue()), bShowExtendedLOSReason);             
        }   
        return;

    }
    else if (BedDialogPatientDataTabs.TAB_INFANTS_TRANSFER.equals(tab))
    {
        form.lyrDetail().showtabInfants();
        form.lyrDetail().tabInfants().lyrInfants().showtabInfantTransfer();
        if (refreshData)
            populateInfantsTabFromData();
        return;

    }
    else if (BedDialogPatientDataTabs.TAB_INFANTS_DISCHARGE.equals(tab))
    {
        form.lyrDetail().showtabInfants();
        form.lyrDetail().tabInfants().lyrInfants().showtabInfantDischarge();
        if (refreshData)
            populateInfantsTabFromData();
        return;

    }
    //WDEV-17662 -------end
}
项目:openMAXIMS    文件:Logic.java   
private void showInitialTab(BedStatus status, BedDialogPatientDataTabs customTabToOpen)
{
    if (customTabToOpen != null)
    {               
        if (BedDialogPatientDataTabs.TAB_TRANSFER_OUT.equals(customTabToOpen))
        {
            form.lyrDetail().showtabTransfer();
            form.lyrDetail().tabTransfer().lyrTransfer().showtabOut();
        }
        if (BedDialogPatientDataTabs.TAB_TRANSFER_CONSULTANT.equals(customTabToOpen))
        {
            form.lyrDetail().showtabTransfer();
            form.lyrDetail().tabTransfer().lyrTransfer().showtabConsultant();
        }           
        else if (BedDialogPatientDataTabs.TAB_DISCHARGE.equals(customTabToOpen))
        {
            form.lyrDetail().showtabDischarge();
        }
        else if (BedDialogPatientDataTabs.TAB_RETURNFROMHOMELEAVE.equals(customTabToOpen)
                    || BedDialogPatientDataTabs.TAB_CANCEL_RETURNFROMHOMELEAVE.equals(customTabToOpen))
        {
            form.lyrDetail().showtabHomeLeaveReturn();
        }
        else if (BedDialogPatientDataTabs.TAB_EST_DISCHARGE.equals(customTabToOpen))
        {
            form.lyrDetail().showtabReadyForDischarge();
            form.getLocalContext().setTabFocused(customTabToOpen);
        }

        return;
    }

    if (status != null)
    {
        if (status.equals(BedStatus.AVAILABLE))
        {
            form.lyrDetail().tabAdmission().ccAdmit().initialise();
            engine.clearPatientContextInformation();
            form.lyrDetail().tabAdmission().btnAdmit().setEnabled(false);
            form.lyrDetail().tabAdmission().btnCancelHL().setVisible(false);
            form.lyrDetail().tabAdmission().btnCancelHL().setEnabled(false);
        }
        else if (status.equals(BedStatus.OCCUPIED))
        {
            switchToRelevantTab(form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisode());
        }
    }
    // no bed selected
    else
    {
        if(form.getGlobalContext().Core.getSelectedWaitingAreaPatient() == null)
        {   
            form.lyrDetail().tabAdmission().ccAdmit().initialise();
            engine.clearPatientContextInformation();
        }   
        switchToRelevantTab(form.getGlobalContext().Core.getSelectedWaitingAreaPatient());
    }
}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBedPlannerBedClicked(Bed bed) 
{
    form.getGlobalContext().Core.setSelectedWaitingAreaPatient(null);
    form.getGlobalContext().Core.setBedInfoAction(null);
    form.dyngrdDisplay().setValue(null);

    if (bed != null && bed.getIdentifier() != null)
    {           
        BedSpaceStateLiteVo bedSpaceState = domain.getBedSpaceState((BedSpaceVo) bed.getIdentifier());
        WardBayConfigForWardViewVo wardConfig = form.getLocalContext().getWardBayConfig();

        if (ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS") && wardConfig != null)
        {
            if (bedSpaceState != null && (WardBayStatus.CLOSED.equals(wardConfig.getWardAvailabilityStatus()) || WardBayStatus.CLOSED.equals(wardConfig.getBayConfig(form.cmbBay().getValue()).getBayAvailabilityStatus())))
                return;
            if (bedSpaceState != null && bedSpaceState.getCurrentBedStatusIsNotNull() && BedStatus.AVAILABLE.equals(bedSpaceState.getCurrentBedStatus().getBedStatus()) &&  (WardBayStatus.BLOCKED.equals(wardConfig.getWardAvailabilityStatus()) || WardBayStatus.BLOCKED.equals(wardConfig.getBayConfig(form.cmbBay().getValue()).getBayAvailabilityStatus())))
                return;
        }

        form.getGlobalContext().Core.setPatientShort(null);
        form.getGlobalContext().Core.setSelectedBedSpaceState(bedSpaceState);

        if(bedSpaceState != null && bedSpaceState.getInpatientEpisode() != null && bedSpaceState.getInpatientEpisode().getPasEventIsNotNull())
        {
            //WDEV-22236
            CareContextShortVo careContextForPasEvent = domain.getCareContextForPasEvent(bedSpaceState.getInpatientEpisode().getPasEvent());
            form.getGlobalContext().Core.setCurrentCareContext(careContextForPasEvent);
            if (careContextForPasEvent == null && bedSpaceState.getInpatientEpisode().getPasEvent().getPatientIsNotNull())
            {   
                form.getGlobalContext().Core.setPatientShort(domain.getPatientShort(bedSpaceState.getInpatientEpisode().getPasEvent().getPatient()));
            }   
            if (bedSpaceState.getInpatientEpisode().getPasEvent().getPatientIsNotNull())
            {
                form.getGlobalContext().Core.setSelectingPatientForm(engine.getFormName());                 
            }   
        }


    }

    resetPIDBarText();//WDEV-14476 

    //WDEV-9790
    engine.open(form.getForms().Core.BedInfoDialog, new Object[]{new Boolean(form.isReadOnly())});
}