Java 类ims.core.vo.HomeLeaveVo 实例源码

项目:openMAXIMS    文件:WardViewPatientListImpl.java   
private HomeLeaveVo getLatestClosedHomeLeaveForEpisode(InpatientEpisode doInpat)
{
    if (doInpat.getHomeLeaves() == null || doInpat.getHomeLeaves().size() == 0)
        return null;

    InPatientEpisodeADTVo voEpisode = InPatientEpisodeADTVoAssembler.create(doInpat);
    if (voEpisode != null)
    {   
    for (int i=voEpisode.getHomeLeaves().size()-1;i>=0;i--)
    {
        if (voEpisode.getHomeLeaves().get(i).getDateReturnedFromHomeLeave() == null)
            voEpisode.getHomeLeaves().remove(i);
    }
    voEpisode.getHomeLeaves().sort(HomeLeaveVo.getDateOnHomeLeaveComparator(SortOrder.DESCENDING));
    if (voEpisode.getHomeLeaves().size() > 0 && voEpisode.getHomeLeaves().get(0) != null)
            return voEpisode.getHomeLeaves().get(0);
    }
    return null;
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
private InpatientEpisode closeCurrentHomeLeaveAndUpdateEpisode(InpatientEpisode doInpatEpis, HomeLeaveVo voHl)
{
    HomeLeave currentHomeLeaveDO = null;
    if (doInpatEpis == null || !Boolean.TRUE.equals(doInpatEpis.isIsOnHomeLeave()) ||  doInpatEpis.getHomeLeaves() == null)
        return null;

    for(int i = 0 ; doInpatEpis.getHomeLeaves().size() > 0 && i < doInpatEpis.getHomeLeaves().size() ; i++)
    {
        HomeLeave doHL = (HomeLeave)doInpatEpis.getHomeLeaves().get(i);
         if (doHL != null && doHL.getDateReturnedFromHomeLeave() == null && doHL.getDateOnHomeLeave().equals(doInpatEpis.getDateOnHomeLeave()))
         {
             currentHomeLeaveDO = doHL;
             break;
         }           
    }

    if (currentHomeLeaveDO != null)
    {   
        currentHomeLeaveDO.setDateReturnedFromHomeLeave(voHl.getDateReturnedFromHomeLeaveIsNotNull() ? voHl.getDateReturnedFromHomeLeave().getDate() : null);
        currentHomeLeaveDO.setTimeReturnedFromHomeLeave(voHl.getTimeReturnedFromHomeLeaveIsNotNull() ? voHl.getTimeReturnedFromHomeLeave().toString() : null);

        doInpatEpis.getHomeLeaves().set(doInpatEpis.getHomeLeaves().indexOf(currentHomeLeaveDO), currentHomeLeaveDO);    
    } 

    return doInpatEpis;
}
项目:AvoinApotti    文件:BedInfoDialogImpl.java   
private void copyHomeleaveToDto(Homeleave homeLeaveRec, HomeLeaveVo voHomeLeave, InPatientEpisodeADTVo inpatientEpisode)
{
    HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0);

    hlRec.Pkey = getPatientIdValue(inpatientEpisode, PatIdType.PKEY);
    hlRec.Hospnum = getPatientIdValue(inpatientEpisode, PatIdType.HOSPNUM);

    InpatientEpisode doInpat = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode);
    hlRec.Rescode = doInpat.getPasEvent() != null && doInpat.getPasEvent().getLocation() != null ? doInpat.getPasEvent().getLocation().getExtCode(TaxonomyType.PAS.getID()) : null;
    hlRec.Mors = DTOHelper.getPasMapping(doInpat.getWardType());

    hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : "";
    hlRec.Leavetm =  voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : "";

    hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : "";
    hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : "";
    if(hlRec.Mors.equals("M"))
    {
        if(doInpat.getPasEvent().getPatient().getSex() != null)
        {
            if(doInpat.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE)))
                hlRec.Btyp = "M";
            else if(doInpat.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE)))
                hlRec.Btyp = "F";
            else
                //defaulting Male for unknown sex
                hlRec.Btyp = "M";
        }
        else
            //defaulting Male for unknown sex
            hlRec.Btyp = "M";   
    }
    else if(hlRec.Mors.equals("S"))
        hlRec.Btyp = "S";


    hlRec.Hlfl = "Y"; //"Y" on an insert

    hlRec.Webadt = "Y";             
}
项目:openMAXIMS    文件:Logic.java   
private void populateHomeLeaveReturnCancelControlsFromData(HomeLeaveVo voHl)
{
    clearHomeLeaveReturnCancelTab();
    if (voHl == null)
        return;
    form.lyrDetail().tabHLeaveReturnCancel().dteOnHomeLeave().setValue(voHl.getDateOnHomeLeave());
    form.lyrDetail().tabHLeaveReturnCancel().timOnHomeLeave().setValue(voHl.getTimeOnHomeLeave());              
    form.lyrDetail().tabHLeaveReturnCancel().dteExpHLReturn().setValue(voHl.getExpectedDateOfReturn());
    form.lyrDetail().tabHLeaveReturnCancel().timExpHLReturn().setValue(voHl.getExpectedTimeOfReturn());
    form.lyrDetail().tabHLeaveReturnCancel().chkPatientBedRetained().setValue(voHl.getBedRetained());           
}
项目:openMAXIMS    文件:Logic.java   
private HomeLeaveVo getLatestClosedHomeLeaveForEpisode(InPatientEpisodeADTVo voEpisode)
{
    if (voEpisode.getHomeLeaves() == null || voEpisode.getHomeLeaves().size() == 0)
        return null;
    for (int i=voEpisode.getHomeLeaves().size()-1;i>=0;i--)
    {
        if (voEpisode.getHomeLeaves().get(i).getDateReturnedFromHomeLeave() == null)
            voEpisode.getHomeLeaves().remove(i);
    }
    voEpisode.getHomeLeaves().sort(HomeLeaveVo.getDateOnHomeLeaveComparator(SortOrder.DESCENDING));
    if (voEpisode.getHomeLeaves().size() > 0 && voEpisode.getHomeLeaves().get(0) != null)
            return voEpisode.getHomeLeaves().get(0);

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private void cancelHomeLeaveReturn()
{
    BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

    InpatientEpisodeLiteVo voInp = voBedSpaceState != null ? voBedSpaceState.getInpatientEpisode() : form.getGlobalContext().Core.getSelectedWaitingAreaPatient();

    HomeLeaveVo voHl = populateHomeLeaveToReOpenDataFromScreen(form.getLocalContext().getHomeLeaveToReOpen(), voBedSpaceState != null);

    if (voHl == null)
    {   
        engine.showMessage("The home leave record has been changed by another user. The screen will be refreshed.");
        engine.close(DialogResult.OK);
        return;
    }

    String[] validationErrors = voHl.validate();
    if (validationErrors != null)
    {
        engine.showErrors(validationErrors);            
        return;
    }       
    try
    {
        domain.cancelHomeLeaveReturn(voInp, voBedSpaceState,voHl);
    }
    catch (DomainInterfaceException e)
    {
        engine.showMessage(e.getMessage());
        engine.close(DialogResult.OK);
        return;
    }
    catch (StaleObjectException ex)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        engine.close(DialogResult.OK);
        return;
    }
    engine.close(DialogResult.OK);  
}
项目:openMAXIMS    文件:Logic.java   
private HomeLeaveVo populateHomeLeaveToReOpenDataFromScreen(HomeLeaveVo homeLeaveToReOpen, boolean patientCurrentlyInBed)
{
    if (homeLeaveToReOpen == null)
        return null;

    homeLeaveToReOpen.setDateOnHomeLeave(form.lyrDetail().tabHLeaveReturnCancel().dteOnHomeLeave().getValue());
    homeLeaveToReOpen.setTimeOnHomeLeave(form.lyrDetail().tabHLeaveReturnCancel().timOnHomeLeave().getValue());             
    homeLeaveToReOpen.setExpectedDateOfReturn(form.lyrDetail().tabHLeaveReturnCancel().dteExpHLReturn().getValue());
    homeLeaveToReOpen.setExpectedTimeOfReturn(form.lyrDetail().tabHLeaveReturnCancel().timExpHLReturn().getValue());
    homeLeaveToReOpen.setDateReturnedFromHomeLeave(null);
    homeLeaveToReOpen.setTimeReturnedFromHomeLeave(null);
    homeLeaveToReOpen.setBedRetained(patientCurrentlyInBed ? form.lyrDetail().tabHLeaveReturnCancel().chkPatientBedRetained().getValue() : false);

    return homeLeaveToReOpen;
}
项目:openMAXIMS    文件:Logic.java   
private HomeLeaveVo getLatestOngoingHomeLeave(InPatientEpisodeADTVo voEpisode)
{
    if (voEpisode == null || voEpisode.getHomeLeaves() == null)
        return null;
    for (int i=voEpisode.getHomeLeaves().size()-1;i>=0;i--)
    {
        if (voEpisode.getHomeLeaves().get(i).getDateReturnedFromHomeLeave() != null)
            voEpisode.getHomeLeaves().remove(i);
    }
    voEpisode.getHomeLeaves().sort(HomeLeaveVo.getDateOnHomeLeaveComparator(SortOrder.DESCENDING));
    if (voEpisode.getHomeLeaves().size() > 0 && voEpisode.getHomeLeaves().get(0) != null)
        return voEpisode.getHomeLeaves().get(0);
    return null;
}
项目:openMAXIMS    文件:Logic.java   
private void open()
{
    InpatientEpisodeRefVo inpatRef = form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() ? (InpatientEpisodeRefVo) form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisode() : (InpatientEpisodeRefVo) form.getGlobalContext().Core.getSelectedWaitingAreaPatient();
    HomeLeaveVo vo = domain.getCurrentHomeLeave(inpatRef);
    form.getLocalContext().setCurrentHomeLeave(vo);
    populateScreenFromData(vo);

}
项目:openMAXIMS    文件:Logic.java   
private void populateScreenFromData(HomeLeaveVo vo)
{
    if (vo == null)
        return;
    form.dteHomeLeave().setValue(vo.getDateOnHomeLeave());
    form.timHomeLeave().setValue(vo.getTimeOnHomeLeave());
    form.dteHlReturn().setValue(vo.getExpectedDateOfReturn());
    form.timHlReturn().setValue(vo.getExpectedTimeOfReturn());      
}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException
{
    HomeLeaveVo voToSave = populateDataFromScreen(form.getLocalContext().getCurrentHomeLeave());

    String [] errors = voToSave.validate(getUiErrors());

    if (errors != null)
    {
        engine.showErrors(errors);
        return;
    }
    form.getGlobalContext().Core.setHomeLeaveDetails(voToSave);
    engine.close(DialogResult.OK);
}
项目:openMAXIMS    文件:Logic.java   
private HomeLeaveVo populateDataFromScreen(HomeLeaveVo currentHomeLeave)
{
    if (currentHomeLeave == null)
        return null;
    HomeLeaveVo currentHomeLeaveToUpdate = (HomeLeaveVo) currentHomeLeave.clone();
    currentHomeLeaveToUpdate.setDateOnHomeLeave(form.dteHomeLeave().getValue());
    currentHomeLeaveToUpdate.setTimeOnHomeLeave(form.timHomeLeave().getValue());
    currentHomeLeaveToUpdate.setExpectedDateOfReturn(form.dteHlReturn().getValue());
    currentHomeLeaveToUpdate.setExpectedTimeOfReturn(form.timHlReturn().getValue());

    return currentHomeLeaveToUpdate;
}
项目:openMAXIMS    文件:WardViewPatientListImpl.java   
private boolean canReopenHomeLeave(InpatientEpisode doInpat)
{
    if (Boolean.TRUE.equals(doInpat.isIsOnHomeLeave()) || doInpat.getHomeLeaves() == null || doInpat.getHomeLeaves().size() == 0)
        return false;
    HomeLeaveVo latestHomeLeave = getLatestClosedHomeLeaveForEpisode(doInpat);

    return latestHomeLeave != null;
}
项目: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    文件:BedInfoDialogImpl.java   
private void copyHomeleaveToDto(Homeleave homeLeaveRec, HomeLeaveVo voHomeLeave, InPatientEpisodeADTVo inpatientEpisode)
{
    HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0);

    hlRec.Pkey = getPatientIdValue(inpatientEpisode, PatIdType.PKEY);
    hlRec.Hospnum = getPatientIdValue(inpatientEpisode, PatIdType.HOSPNUM);

    InpatientEpisode doInpat = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode);
    hlRec.Rescode = doInpat.getPasEvent() != null && doInpat.getPasEvent().getLocation() != null ? doInpat.getPasEvent().getLocation().getExtCode(TaxonomyType.PAS.getID()) : null;
    hlRec.Mors = DTOHelper.getPasMapping(doInpat.getWardType());

    hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : "";
    hlRec.Leavetm =  voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : "";

    hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : "";
    hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : "";
    if(hlRec.Mors.equals("M"))
    {
        if(doInpat.getPasEvent().getPatient().getSex() != null)
        {
            if(doInpat.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE)))
                hlRec.Btyp = "M";
            else if(doInpat.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE)))
                hlRec.Btyp = "F";
            else
                //defaulting Male for unknown sex
                hlRec.Btyp = "M";
        }
        else
            //defaulting Male for unknown sex
            hlRec.Btyp = "M";   
    }
    else if(hlRec.Mors.equals("S"))
        hlRec.Btyp = "S";


    hlRec.Hlfl = "Y"; //"Y" on an insert

    hlRec.Webadt = "Y";             
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
private HomeLeaveVo getLatestOngoingHomeLeave(InPatientEpisodeADTVo voEpisode)
{
    if (voEpisode == null || voEpisode.getHomeLeaves() == null)
        return null;
    for (int i=voEpisode.getHomeLeaves().size()-1;i>=0;i--)
    {
        if (voEpisode.getHomeLeaves().get(i).getDateReturnedFromHomeLeave() != null)
            voEpisode.getHomeLeaves().remove(i);
    }
    voEpisode.getHomeLeaves().sort(HomeLeaveVo.getDateOnHomeLeaveComparator(SortOrder.DESCENDING));
    if (voEpisode.getHomeLeaves().size() > 0 && voEpisode.getHomeLeaves().get(0) != null)
            return voEpisode.getHomeLeaves().get(0);
    return null;
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
private void copyHomeleaveToDto(Homeleave homeLeaveRec, HomeLeaveVo voHomeLeave, InPatientEpisodeADTVo inpatientEpisode)
{
    HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0);

    hlRec.Pkey = getPatientIdValue(inpatientEpisode, PatIdType.PKEY);
    hlRec.Hospnum = getPatientIdValue(inpatientEpisode, PatIdType.HOSPNUM);

    InpatientEpisode doInpat = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode);
    hlRec.Rescode = doInpat.getPasEvent() != null && doInpat.getPasEvent().getLocation() != null ? doInpat.getPasEvent().getLocation().getExtCode(TaxonomyType.PAS.getID()) : null;
    hlRec.Mors = DTOHelper.getPasMapping(doInpat.getWardType());

    hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : "";
    hlRec.Leavetm =  voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : "";

    hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : "";
    hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : "";
    if(hlRec.Mors.equals("M"))
    {
        if(doInpat.getPasEvent().getPatient().getSex() != null)
        {
            if(doInpat.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE)))
                hlRec.Btyp = "M";
            else if(doInpat.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE)))
                hlRec.Btyp = "F";
            else
                //defaulting Male for unknown sex
                hlRec.Btyp = "M";
        }
        else
            //defaulting Male for unknown sex
            hlRec.Btyp = "M";   
    }
    else if(hlRec.Mors.equals("S"))
        hlRec.Btyp = "S";


    hlRec.Hlfl = "Y"; //"Y" on an insert

    hlRec.Webadt = "Y";             
}
项目:openmaxims-linux    文件:BedInfoDialogImpl.java   
private void copyHomeleaveToDto(Homeleave homeLeaveRec, HomeLeaveVo voHomeLeave, InPatientEpisodeADTVo inpatientEpisode)
{
    HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0);

    hlRec.Pkey = getPatientIdValue(inpatientEpisode, PatIdType.PKEY);
    hlRec.Hospnum = getPatientIdValue(inpatientEpisode, PatIdType.HOSPNUM);

    InpatientEpisode doInpat = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode);
    hlRec.Rescode = doInpat.getPasEvent() != null && doInpat.getPasEvent().getLocation() != null ? doInpat.getPasEvent().getLocation().getExtCode(TaxonomyType.PAS.getID()) : null;
    hlRec.Mors = DTOHelper.getPasMapping(doInpat.getWardType());

    hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : "";
    hlRec.Leavetm =  voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : "";

    hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : "";
    hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : "";
    if(hlRec.Mors.equals("M"))
    {
        if(doInpat.getPasEvent().getPatient().getSex() != null)
        {
            if(doInpat.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE)))
                hlRec.Btyp = "M";
            else if(doInpat.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE)))
                hlRec.Btyp = "F";
            else
                //defaulting Male for unknown sex
                hlRec.Btyp = "M";
        }
        else
            //defaulting Male for unknown sex
            hlRec.Btyp = "M";   
    }
    else if(hlRec.Mors.equals("S"))
        hlRec.Btyp = "S";


    hlRec.Hlfl = "Y"; //"Y" on an insert

    hlRec.Webadt = "Y";             
}
项目:openmaxims-linux    文件:BedAdmissionComponentImpl.java   
private void copyHomeLeaveToDto(Homeleave homeLeaveRec, AdmissionDetail doAdmissionDetail, HomeLeaveVo voHomeLeave) 
    {       
        HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0);

        hlRec.Pkey = getPatientIdValue(doAdmissionDetail, PatIdType.PKEY);
        hlRec.Hospnum = getPatientIdValue(doAdmissionDetail, PatIdType.HOSPNUM);

        hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : "";
        hlRec.Leavetm =  voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : "";

        hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : "";
        hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : "";

        hlRec.Rescode = doAdmissionDetail.getWard() != null ? doAdmissionDetail.getWard().getExtCode(TaxonomyType.PAS.getID()) : null;
        hlRec.Mors = DTOHelper.getPasMapping(doAdmissionDetail.getWardType());
        if(hlRec.Mors.equals("M"))
        {
            if(doAdmissionDetail.getPasEvent().getPatient().getSex() != null)
            {
                if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE)))
                    hlRec.Btyp = "M";
                else if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE)))
                    hlRec.Btyp = "F";
                else
                    //defaulting Male for unknown sex
                    hlRec.Btyp = "M";
            }
            else
                //defaulting Male for unknown sex
                hlRec.Btyp = "M";   
        }
        else if(hlRec.Mors.equals("S"))
            hlRec.Btyp = "S";

        hlRec.Returndt = voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateReturnedFromHomeLeave().getDate()) : "";
        hlRec.Returntm = voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString(TimeFormat.FLAT4) : "";

//      if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO"))
//          hlRec.Cflup = rec.Rescode;

        if (voHomeLeave.getID_HomeLeaveIsNotNull())
            hlRec.Hlfl = "N"; //"N" on an update
        else
            hlRec.Hlfl = "Y"; //"Y" on an insert
        hlRec.Webadt = "Y";             
    }
项目:AvoinApotti    文件:BedInfoDialogImpl.java   
public CareContextShortVo saveHomeLeave(BedSpaceStateLiteVo voBedSpaceStateLite, InPatientEpisodeADTVo inpatientEpisode, HomeLeaveVo homeLeaveVo) throws DomainInterfaceException, StaleObjectException 
{
    if(inpatientEpisode == null)
        throw new CodingRuntimeException("inpatientEpisode is null in method saveTransfer");
    if(!inpatientEpisode.isValidated())
        throw new CodingRuntimeException("inpatientEpisode has not been validated in method saveTransfer");

    if(homeLeaveVo == null)
        throw new CodingRuntimeException("homeLeaveVo is null in method saveHomeLeave");

    DomainFactory factory = getDomainFactory();

    if (Boolean.FALSE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()))
    {
        Homeleave hlRec = (Homeleave)getDTOInstance(Homeleave.class);
        hlRec.DataCollection.add();

        copyHomeleaveToDto(hlRec, homeLeaveVo, inpatientEpisode);

        //Update Home Leave on PAS 
        Result res = hlRec.insert();
        if (res != null && res.getId() < 0 )
        {
            if (res.getId() == -5)
                throw new DomainInterfaceException("Error occurred saving Home Leave record to PAS " + res.getMessage());
            else 
                throw new DTODomainInterfaceException(res.getId(), "Error occurred saving Home Leave record to PAS " + res.getMessage());   
        }
    }       
    //Save MAXIMS HomeLeave
    HomeLeave doHL = HomeLeaveVoAssembler.extractHomeLeave(factory, homeLeaveVo);

    //Save IP details
    InpatientEpisode doInpatEpis = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode);
    doInpatEpis.getHomeLeaves().add(doHL);

    doInpatEpis.setIsOnHomeLeave(true);
    doInpatEpis.setDateOnHomeLeave(homeLeaveVo.getDateOnHomeLeaveIsNotNull() ? homeLeaveVo.getDateOnHomeLeave().getDate() : null);
    doInpatEpis.setTimeOnHomeLeave(homeLeaveVo.getTimeOnHomeLeaveIsNotNull() ? homeLeaveVo.getTimeOnHomeLeave().toString() : null);
    doInpatEpis.setExpectedDateOfReturn(homeLeaveVo.getExpectedDateOfReturnIsNotNull() ? homeLeaveVo.getExpectedDateOfReturn().getDate() : null);
    doInpatEpis.setExpectedTimeOfReturn(homeLeaveVo.getExpectedTimeOfReturnIsNotNull() ? homeLeaveVo.getExpectedTimeOfReturn().toString() : null);
    doInpatEpis.setVacatedBedNumber(homeLeaveVo.getVacatedBedNumberIsNotNull() ? homeLeaveVo.getVacatedBedNumber() : "");

    factory.save(doInpatEpis);

    //Vacate the bed.
    if(voBedSpaceStateLite != null)
    {
        BedSpaceState doBed = BedSpaceStateLiteVoAssembler.extractBedSpaceState(factory, voBedSpaceStateLite);
        factory.save(doBed);
    }
    return null;
}
项目:AvoinApotti    文件:BedInfoDialogImpl.java   
private void copyHomeLeaveToDto(Homeleave homeLeaveRec, AdmissionDetail doAdmissionDetail, HomeLeaveVo voHomeLeave) 
    {       
        HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0);

        hlRec.Pkey = getPatientIdValue(doAdmissionDetail, PatIdType.PKEY);
        hlRec.Hospnum = getPatientIdValue(doAdmissionDetail, PatIdType.HOSPNUM);

        hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : "";
        hlRec.Leavetm =  voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : "";

        hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : "";
        hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : "";

        hlRec.Rescode = doAdmissionDetail.getWard() != null ? doAdmissionDetail.getWard().getExtCode(TaxonomyType.PAS.getID()) : null;
        hlRec.Mors = DTOHelper.getPasMapping(doAdmissionDetail.getWardType());
        if(doAdmissionDetail.getPasEvent().getPatient().getSex() != null)
        {
            if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE)))
                hlRec.Btyp = "M";
            else if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE)))
                hlRec.Btyp = "F";
            else
                //defaulting Male for unknown sex
                hlRec.Btyp = "M";
        }
        else
            //defaulting Male for unknown sex
            hlRec.Btyp = "M";   

        hlRec.Returndt = voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateReturnedFromHomeLeave().getDate()) : "";
        hlRec.Returntm = voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString(TimeFormat.FLAT4) : "";

//      if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO"))
//          hlRec.Cflup = rec.Rescode;

        if (voHomeLeave.getID_HomeLeaveIsNotNull())
            hlRec.Hlfl = "N"; //"N" on an update
        else
            hlRec.Hlfl = "Y"; //"Y" on an insert

        hlRec.Webadt = "Y";             
    }
项目:AvoinApotti    文件:BedAdmissionComponentImpl.java   
private void copyHomeLeaveToDto(Homeleave homeLeaveRec, AdmissionDetail doAdmissionDetail, HomeLeaveVo voHomeLeave) 
    {       
        HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0);

        hlRec.Pkey = getPatientIdValue(doAdmissionDetail, PatIdType.PKEY);
        hlRec.Hospnum = getPatientIdValue(doAdmissionDetail, PatIdType.HOSPNUM);

        hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : "";
        hlRec.Leavetm =  voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : "";

        hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : "";
        hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : "";

        hlRec.Rescode = doAdmissionDetail.getWard() != null ? doAdmissionDetail.getWard().getExtCode(TaxonomyType.PAS.getID()) : null;
        hlRec.Mors = DTOHelper.getPasMapping(doAdmissionDetail.getWardType());
        if(hlRec.Mors.equals("M"))
        {
            if(doAdmissionDetail.getPasEvent().getPatient().getSex() != null)
            {
                if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE)))
                    hlRec.Btyp = "M";
                else if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE)))
                    hlRec.Btyp = "F";
                else
                    //defaulting Male for unknown sex
                    hlRec.Btyp = "M";
            }
            else
                //defaulting Male for unknown sex
                hlRec.Btyp = "M";   
        }
        else if(hlRec.Mors.equals("S"))
            hlRec.Btyp = "S";

        hlRec.Returndt = voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateReturnedFromHomeLeave().getDate()) : "";
        hlRec.Returntm = voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString(TimeFormat.FLAT4) : "";

//      if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO"))
//          hlRec.Cflup = rec.Rescode;

        if (voHomeLeave.getID_HomeLeaveIsNotNull())
            hlRec.Hlfl = "N"; //"N" on an update
        else
            hlRec.Hlfl = "Y"; //"Y" on an insert
        hlRec.Webadt = "Y";             
    }
项目:AvoinApotti    文件:BedAdmissionComponentImpl.java   
public void allocateBed(BedSpaceStateLiteVo bedSpace, InpatientEpisodeLiteVo inpatientEpisode, AdmissionDetailVo admissionDetail, HomeLeaveVo voHomeLeave) throws StaleObjectException, DomainInterfaceException 
{
    if (inpatientEpisode == null)
        throw new CodingRuntimeException("inpatientEpisode is null in method allocateBed");
    if (bedSpace == null)
        throw new CodingRuntimeException("bedSpace is null in method allocateBed");
    if (admissionDetail == null)
        throw new CodingRuntimeException("admissionDetail is null in method allocateBed");

    BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpace);    
    InpatientEpisode doInpatEpis = InpatientEpisodeLiteVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode);
    AdmissionDetail doAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admissionDetail);

    if(doBedSpaceState != null)
    {
        doBedSpaceState.setInpatientEpisode(doInpatEpis);   
        doInpatEpis.setBed(doBedSpaceState);
    }

    if(voHomeLeave != null)
    {
        for(int i = 0 ; doInpatEpis.getHomeLeaves().size() > 0 && i < doInpatEpis.getHomeLeaves().size() ; i++)
        {
             HomeLeave doHL = (HomeLeave)doInpatEpis.getHomeLeaves().get(i);
             if (doHL != null
                && doHL.getDateReturnedFromHomeLeave() == null)
             {
                 doHL.setDateReturnedFromHomeLeave(voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getDateReturnedFromHomeLeave().getDate() : null);
                 doHL.setTimeReturnedFromHomeLeave(voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString() : null);

                 doInpatEpis.getHomeLeaves().set(i, doHL);
             }
        }
        doInpatEpis.setIsOnHomeLeave(false);
        doInpatEpis.setDateOnHomeLeave(null);
        doInpatEpis.setTimeOnHomeLeave(null);
        doInpatEpis.setExpectedDateOfReturn(null);
        doInpatEpis.setExpectedTimeOfReturn(null);
        doInpatEpis.setVacatedBedNumber(null);

        //UPDATE PAS THAT NO LONGER ON HOME LEAVE 
        if (Boolean.FALSE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()))
        {
            Homeleave hlRec = (Homeleave)getDTOInstance(Homeleave.class);
            hlRec.DataCollection.add();

            copyHomeLeaveToDto(hlRec, doAdmissionDetail, voHomeLeave);

            Result res = hlRec.update();
            if (res != null && res.getId() < 0 )
            {
                if (res.getId() == -5)
                    throw new DomainInterfaceException("Error occurred saving Home Leave record to PAS " + res.getMessage());
                else 
                    throw new DTODomainInterfaceException(res.getId(), "Error occurred saving Home Leave record to PAS " + res.getMessage());   
            }
        }
    }

    getDomainFactory().save(doInpatEpis);

    if(doBedSpaceState != null)
        doAdmissionDetail.setBed(doBedSpaceState.getBedSpace());

    getDomainFactory().save(doAdmissionDetail);
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
private void copyHomeLeaveToDto(Homeleave homeLeaveRec, AdmissionDetail doAdmissionDetail, HomeLeaveVo voHomeLeave) 
    {       
        HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0);

        hlRec.Pkey = getPatientIdValue(doAdmissionDetail, PatIdType.PKEY);
        hlRec.Hospnum = getPatientIdValue(doAdmissionDetail, PatIdType.HOSPNUM);

        hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : "";
        hlRec.Leavetm =  voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : "";

        hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : "";
        hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : "";

        hlRec.Rescode = doAdmissionDetail.getWard() != null ? doAdmissionDetail.getWard().getExtCode(TaxonomyType.PAS.getID()) : null;
        hlRec.Mors = DTOHelper.getPasMapping(doAdmissionDetail.getWardType());
        if(doAdmissionDetail.getPasEvent().getPatient().getSex() != null)
        {
            if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE)))
                hlRec.Btyp = "M";
            else if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE)))
                hlRec.Btyp = "F";
            else
                //defaulting Male for unknown sex
                hlRec.Btyp = "M";
        }
        else
            //defaulting Male for unknown sex
            hlRec.Btyp = "M";   

        hlRec.Returndt = voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateReturnedFromHomeLeave().getDate()) : "";
        hlRec.Returntm = voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString(TimeFormat.FLAT4) : "";

//      if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO"))
//          hlRec.Cflup = rec.Rescode;

        if (voHomeLeave.getID_HomeLeaveIsNotNull())
            hlRec.Hlfl = "N"; //"N" on an update
        else
            hlRec.Hlfl = "Y"; //"Y" on an insert

        hlRec.Webadt = "Y";             
    }
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
public void returnFromHomeLeave(BedSpaceStateLiteVo voBedSpaceStateLite, InpatientEpisodeLiteVo voInpatEpis, HomeLeaveVo voHl,  AdmissionReasonVo admissionReasonVo) throws DomainInterfaceException, StaleObjectException 
{
    DomainFactory factory = getDomainFactory();

    BedSpaceState savedBedSpaceStateDO = (BedSpaceState) factory.getDomainObject(BedSpaceState.class, voBedSpaceStateLite.getID_BedSpaceState());

    if (savedBedSpaceStateDO != null && (savedBedSpaceStateDO.getInpatientEpisode() == null ||  savedBedSpaceStateDO.getInpatientEpisode().getVersion() > voInpatEpis.getVersion_InpatientEpisode()))
    {
        if (savedBedSpaceStateDO.getInpatientEpisode() == null)
            throw new DomainInterfaceException(" This patient has been discharged or moved by another user. The screen will be refreshed.");
        if (savedBedSpaceStateDO.getInpatientEpisode().getVersion() > voInpatEpis.getVersion_InpatientEpisode() && !Boolean.TRUE.equals(savedBedSpaceStateDO.getInpatientEpisode().isIsOnHomeLeave()))
            throw new DomainInterfaceException(" The home leave for this patient has been processed by another user. The screen will be refreshed.");
    }       
    InpatientEpisode doInpatEpis = InpatientEpisodeLiteVoAssembler.extractInpatientEpisode(getDomainFactory(), voInpatEpis);
    if(voHl != null)
    {
        doInpatEpis = closeCurrentHomeLeaveAndUpdateEpisode(doInpatEpis, voHl);
        doInpatEpis.setIsOnHomeLeave(false);
        doInpatEpis.setDateOnHomeLeave(null);
        doInpatEpis.setTimeOnHomeLeave(null);
        doInpatEpis.setExpectedDateOfReturn(null);
        doInpatEpis.setExpectedTimeOfReturn(null);
        doInpatEpis.setVacatedBedNumber(null);          
    }

    savedBedSpaceStateDO.setInpatientEpisode(doInpatEpis);

    //WDEV-20405 - Trigger creation of A21 PATIENT GOES ON A LEAVE OF ABSENCE HL7 message
    InpatientEpisodeVo inpatEpisodeVo = InpatientEpisodeVoAssembler.create(doInpatEpis);
    if(inpatEpisodeVo != null
            && inpatEpisodeVo.getPasEvent() != null)
    {
        ADT adtimpl = (ADT) getDomainImpl(ADTImpl.class);
        adtimpl.triggerReturnFromLeaveOfAbsenceEvent(inpatEpisodeVo.getPasEvent());
    } //WDEV-20405

    if (ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS") && voBedSpaceStateLite != null && !Boolean.TRUE.equals(voHl.getBedRetained()))
    {
        Sex tempGender = voInpatEpis.getPasEvent() != null && voInpatEpis.getPasEvent().getPatientIsNotNull() ? voInpatEpis.getPasEvent().getPatient().getSex() : null;
        checkAndUpdateBayConfig(factory, voBedSpaceStateLite, tempGender);
    }       
    factory.save(savedBedSpaceStateDO);     

}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
public void cancelHomeLeave(BedSpaceStateLiteVo voBedSpaceState,InpatientEpisodeLiteVo voInpat) throws StaleObjectException, DomainInterfaceException
{
    if (voInpat == null)
        throw new CodingRuntimeException("InpatientEpisodeLiteVo argument cannot be null in method cancelHomeLeave()");
    DomainFactory factory = getDomainFactory();
    WardView impl = (WardView) getDomainImpl(WardViewImpl.class);
    CareContextShortVo voCareContext = impl.getCareContextForPasEvent(voInpat.getPasEvent());
    InPatientEpisodeADTVo voInpatADTVo = getInpatientEpisode(voInpat);
    if (voInpatADTVo == null)
        throw new DomainInterfaceException("This patient is no longer an inpatient. The screen will be refreshed.");
    if (voInpatADTVo != null && voInpatADTVo.getVersion_InpatientEpisode() > voInpat.getVersion_InpatientEpisode() &&  !Boolean.TRUE.equals(voInpatADTVo.getIsOnHomeLeave()))
        throw new DomainInterfaceException("This inpatient is no longer on home leave. The screen will be refreshed.");

    HomeLeaveVo homeLeaveToCancel = getLatestOngoingHomeLeave(voInpatADTVo);

    if (homeLeaveToCancel != null)
    {
        factory.markAsRie(HomeLeave.class, homeLeaveToCancel.getID_HomeLeave(), null, voInpat.getPasEvent() != null && voInpat.getPasEvent().getPatientIsNotNull() ?  voInpat.getPasEvent().getPatient().getID_Patient() : null, null, voCareContext != null ? voCareContext.getID_CareContext() : null, "Cancellation of Sending on Home Leave");

        InpatientEpisode doInpatientEpisode = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(factory, voInpatADTVo);

        doInpatientEpisode.setIsOnHomeLeave(false);
        doInpatientEpisode.setDateOnHomeLeave(null);
        doInpatientEpisode.setTimeOnHomeLeave(null);
        doInpatientEpisode.setExpectedDateOfReturn(null);
        doInpatientEpisode.setExpectedTimeOfReturn(null);

        if (doInpatientEpisode.getPasEvent() != null)
        {
            ADT adtimpl = (ADT) getDomainImpl(ADTImpl.class);
            adtimpl.triggerCancelLeaveOfAbsenceEvent(new PASEventRefVo(doInpatientEpisode.getPasEvent().getId(), doInpatientEpisode.getPasEvent().getVersion()));
        }
        factory.save(doInpatientEpisode);
        if (ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS") && voBedSpaceState != null && !Boolean.TRUE.equals(homeLeaveToCancel.getBedRetained()))
        {
            Sex tempGender = voInpat.getPasEvent() != null && voInpat.getPasEvent().getPatientIsNotNull() ? voInpat.getPasEvent().getPatient().getSex() : null;
            checkAndUpdateBayConfig(factory, voBedSpaceState,tempGender);
        }
    }

}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
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);
        }
    }       
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
public void vacateBedSpace(InPatientEpisodeADTVo voInpat, BedSpaceStateLiteVo voBedSpaceStateLite, HomeLeaveVo voCurrentHomeLeave) throws DomainInterfaceException, StaleObjectException
{
    if (voInpat == null)
        throw new CodingRuntimeException("InPatientEpisodeADTVo argument cannot be null in method vacateBedSpace()");

    if (voCurrentHomeLeave == null)
        throw new CodingRuntimeException("HomeLeaveVo argument cannot be null in method vacateBedSpace()");

    DomainFactory domainFactory = getDomainFactory();

    InpatientEpisode inpatientEpisodeDO = (InpatientEpisode) domainFactory.getDomainObject(InpatientEpisode.class, voInpat.getID_InpatientEpisode());

    if (inpatientEpisodeDO == null || inpatientEpisodeDO.getVersion() > voInpat.getVersion_InpatientEpisode())
        throw new DomainInterfaceException("The patient record was updated by another user. The screen will refresh.");
    if (inpatientEpisodeDO.getBed() == null)
        throw new DomainInterfaceException("The bed was vacated by another user. The screen will refresh.");

    InpatientEpisode doInpat = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(domainFactory, voInpat);
    HomeLeave doHomeLeave = HomeLeaveVoAssembler.extractHomeLeave(domainFactory, voCurrentHomeLeave);

    int currentHomeLeaveIndex = -1;
    if (doHomeLeave != null)
    {   
        currentHomeLeaveIndex = doInpat.getHomeLeaves().indexOf(doHomeLeave);
        if (currentHomeLeaveIndex != -1)
        {
            HomeLeave doHLForUpdate = (HomeLeave) doInpat.getHomeLeaves().get(currentHomeLeaveIndex);
            if (doHLForUpdate != null)
            {   
                doHLForUpdate.setBedRetained(doHomeLeave.isBedRetained());
            }   
        }
    }
    else
    {
        throw new DomainInterfaceException("The home leave was cancelled by another user. The screen will refresh.");
    }

    domainFactory.save(doInpat);

    if (voBedSpaceStateLite != null)
    {   
        BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(domainFactory,voBedSpaceStateLite);
        domainFactory.save(doBedSpaceState);
    }
    updateOccupiedBedsForWardAndBay(voBedSpaceStateLite.getWard(), voBedSpaceStateLite.getBay(), null);         

    if (ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS") && voBedSpaceStateLite != null )
    {
        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(domainFactory, voBedSpaceStateLite,tempGender);
    }
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
private void copyHomeLeaveToDto(Homeleave homeLeaveRec, AdmissionDetail doAdmissionDetail, HomeLeaveVo voHomeLeave) 
{       
    HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0);

    hlRec.Pkey = getPatientIdValue(doAdmissionDetail, PatIdType.PKEY);
    hlRec.Hospnum = getPatientIdValue(doAdmissionDetail, PatIdType.HOSPNUM);

    hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : "";
    hlRec.Leavetm =  voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : "";

    hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : "";
    hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : "";

    hlRec.Rescode = doAdmissionDetail.getWard() != null ? doAdmissionDetail.getWard().getExtCode(TaxonomyType.PAS.getID()) : null;
    hlRec.Mors = DTOHelper.getPasMapping(doAdmissionDetail.getWardType());
    if(hlRec.Mors.equals("M"))
    {
        if(doAdmissionDetail.getPasEvent().getPatient().getSex() != null)
        {
            if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE)))
                hlRec.Btyp = "M";
            else if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE)))
                hlRec.Btyp = "F";
            else
                //defaulting Male for unknown sex
                hlRec.Btyp = "M";
        }
        else
            //defaulting Male for unknown sex
            hlRec.Btyp = "M";   
    }
    else if(hlRec.Mors.equals("S"))
        hlRec.Btyp = "S";

    hlRec.Returndt = voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateReturnedFromHomeLeave().getDate()) : "";
    hlRec.Returntm = voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString(TimeFormat.FLAT4) : "";

    //      if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO"))
    //          hlRec.Cflup = rec.Rescode;

    if (voHomeLeave.getID_HomeLeaveIsNotNull())
        hlRec.Hlfl = "N"; //"N" on an update
    else
        hlRec.Hlfl = "Y"; //"Y" on an insert
    hlRec.Webadt = "Y";             
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public void returnFromHomeLeaveToWardWaitingArea(InpatientEpisodeLiteVo inpatientEpisode, AdmissionDetailVo admissionDetail, HomeLeaveVo voHomeLeave) throws DomainInterfaceException, StaleObjectException
{
    allocateBed(null, inpatientEpisode, admissionDetail, voHomeLeave, null, null);      
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
public CareContextShortVo saveHomeLeave(BedSpaceStateLiteVo voBedSpaceStateLite, InPatientEpisodeADTVo inpatientEpisode, HomeLeaveVo homeLeaveVo) throws DomainInterfaceException, StaleObjectException 
{
    if(inpatientEpisode == null)
        throw new CodingRuntimeException("inpatientEpisode is null in method saveTransfer");
    if(!inpatientEpisode.isValidated())
        throw new CodingRuntimeException("inpatientEpisode has not been validated in method saveTransfer");

    if(homeLeaveVo == null)
        throw new CodingRuntimeException("homeLeaveVo is null in method saveHomeLeave");

    DomainFactory factory = getDomainFactory();

    if (Boolean.FALSE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()))
    {
        Homeleave hlRec = (Homeleave)getDTOInstance(Homeleave.class);
        hlRec.DataCollection.add();

        copyHomeleaveToDto(hlRec, homeLeaveVo, inpatientEpisode);

        //Update Home Leave on PAS 
        Result res = hlRec.insert();
        if (res != null && res.getId() < 0 )
        {
            if (res.getId() == -5)
                throw new DomainInterfaceException("Error occurred saving Home Leave record to PAS " + res.getMessage());
            else 
                throw new DTODomainInterfaceException(res.getId(), "Error occurred saving Home Leave record to PAS " + res.getMessage());   
        }
    }       
    //Save MAXIMS HomeLeave
    HomeLeave doHL = HomeLeaveVoAssembler.extractHomeLeave(factory, homeLeaveVo);

    //Save IP details
    InpatientEpisode doInpatEpis = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode);
    doInpatEpis.getHomeLeaves().add(doHL);

    doInpatEpis.setIsOnHomeLeave(true);
    doInpatEpis.setDateOnHomeLeave(homeLeaveVo.getDateOnHomeLeaveIsNotNull() ? homeLeaveVo.getDateOnHomeLeave().getDate() : null);
    doInpatEpis.setTimeOnHomeLeave(homeLeaveVo.getTimeOnHomeLeaveIsNotNull() ? homeLeaveVo.getTimeOnHomeLeave().toString() : null);
    doInpatEpis.setExpectedDateOfReturn(homeLeaveVo.getExpectedDateOfReturnIsNotNull() ? homeLeaveVo.getExpectedDateOfReturn().getDate() : null);
    doInpatEpis.setExpectedTimeOfReturn(homeLeaveVo.getExpectedTimeOfReturnIsNotNull() ? homeLeaveVo.getExpectedTimeOfReturn().toString() : null);
    doInpatEpis.setVacatedBedNumber(homeLeaveVo.getVacatedBedNumberIsNotNull() ? homeLeaveVo.getVacatedBedNumber() : "");

    factory.save(doInpatEpis);

    //Vacate the bed.
    if(voBedSpaceStateLite != null)
    {
        BedSpaceState doBed = BedSpaceStateLiteVoAssembler.extractBedSpaceState(factory, voBedSpaceStateLite);
        factory.save(doBed);
    }
    return null;
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
private void copyHomeLeaveToDto(Homeleave homeLeaveRec, AdmissionDetail doAdmissionDetail, HomeLeaveVo voHomeLeave) 
    {       
        HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0);

        hlRec.Pkey = getPatientIdValue(doAdmissionDetail, PatIdType.PKEY);
        hlRec.Hospnum = getPatientIdValue(doAdmissionDetail, PatIdType.HOSPNUM);

        hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : "";
        hlRec.Leavetm =  voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : "";

        hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : "";
        hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : "";

        hlRec.Rescode = doAdmissionDetail.getWard() != null ? doAdmissionDetail.getWard().getExtCode(TaxonomyType.PAS.getID()) : null;
        hlRec.Mors = DTOHelper.getPasMapping(doAdmissionDetail.getWardType());
        if(doAdmissionDetail.getPasEvent().getPatient().getSex() != null)
        {
            if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE)))
                hlRec.Btyp = "M";
            else if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE)))
                hlRec.Btyp = "F";
            else
                //defaulting Male for unknown sex
                hlRec.Btyp = "M";
        }
        else
            //defaulting Male for unknown sex
            hlRec.Btyp = "M";   

        hlRec.Returndt = voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateReturnedFromHomeLeave().getDate()) : "";
        hlRec.Returntm = voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString(TimeFormat.FLAT4) : "";

//      if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO"))
//          hlRec.Cflup = rec.Rescode;

        if (voHomeLeave.getID_HomeLeaveIsNotNull())
            hlRec.Hlfl = "N"; //"N" on an update
        else
            hlRec.Hlfl = "Y"; //"Y" on an insert

        hlRec.Webadt = "Y";             
    }
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
private void copyHomeLeaveToDto(Homeleave homeLeaveRec, AdmissionDetail doAdmissionDetail, HomeLeaveVo voHomeLeave) 
    {       
        HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0);

        hlRec.Pkey = getPatientIdValue(doAdmissionDetail, PatIdType.PKEY);
        hlRec.Hospnum = getPatientIdValue(doAdmissionDetail, PatIdType.HOSPNUM);

        hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : "";
        hlRec.Leavetm =  voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : "";

        hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : "";
        hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : "";

        hlRec.Rescode = doAdmissionDetail.getWard() != null ? doAdmissionDetail.getWard().getExtCode(TaxonomyType.PAS.getID()) : null;
        hlRec.Mors = DTOHelper.getPasMapping(doAdmissionDetail.getWardType());
        if(hlRec.Mors.equals("M"))
        {
            if(doAdmissionDetail.getPasEvent().getPatient().getSex() != null)
            {
                if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE)))
                    hlRec.Btyp = "M";
                else if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE)))
                    hlRec.Btyp = "F";
                else
                    //defaulting Male for unknown sex
                    hlRec.Btyp = "M";
            }
            else
                //defaulting Male for unknown sex
                hlRec.Btyp = "M";   
        }
        else if(hlRec.Mors.equals("S"))
            hlRec.Btyp = "S";

        hlRec.Returndt = voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateReturnedFromHomeLeave().getDate()) : "";
        hlRec.Returntm = voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString(TimeFormat.FLAT4) : "";

//      if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO"))
//          hlRec.Cflup = rec.Rescode;

        if (voHomeLeave.getID_HomeLeaveIsNotNull())
            hlRec.Hlfl = "N"; //"N" on an update
        else
            hlRec.Hlfl = "Y"; //"Y" on an insert
        hlRec.Webadt = "Y";             
    }
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public void allocateBed(BedSpaceStateLiteVo bedSpace, InpatientEpisodeLiteVo inpatientEpisode, AdmissionDetailVo admissionDetail, HomeLeaveVo voHomeLeave) throws StaleObjectException, DomainInterfaceException 
{
    if (inpatientEpisode == null)
        throw new CodingRuntimeException("inpatientEpisode is null in method allocateBed");
    if (bedSpace == null)
        throw new CodingRuntimeException("bedSpace is null in method allocateBed");
    if (admissionDetail == null)
        throw new CodingRuntimeException("admissionDetail is null in method allocateBed");

    BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpace);    
    InpatientEpisode doInpatEpis = InpatientEpisodeLiteVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode);
    AdmissionDetail doAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admissionDetail);

    if(doBedSpaceState != null)
    {
        doBedSpaceState.setInpatientEpisode(doInpatEpis);   
        doInpatEpis.setBed(doBedSpaceState);
    }

    if(voHomeLeave != null)
    {
        for(int i = 0 ; doInpatEpis.getHomeLeaves().size() > 0 && i < doInpatEpis.getHomeLeaves().size() ; i++)
        {
             HomeLeave doHL = (HomeLeave)doInpatEpis.getHomeLeaves().get(i);
             if (doHL != null
                && doHL.getDateReturnedFromHomeLeave() == null)
             {
                 doHL.setDateReturnedFromHomeLeave(voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getDateReturnedFromHomeLeave().getDate() : null);
                 doHL.setTimeReturnedFromHomeLeave(voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString() : null);

                 doInpatEpis.getHomeLeaves().set(i, doHL);
             }
        }
        doInpatEpis.setIsOnHomeLeave(false);
        doInpatEpis.setDateOnHomeLeave(null);
        doInpatEpis.setTimeOnHomeLeave(null);
        doInpatEpis.setExpectedDateOfReturn(null);
        doInpatEpis.setExpectedTimeOfReturn(null);
        doInpatEpis.setVacatedBedNumber(null);

        //UPDATE PAS THAT NO LONGER ON HOME LEAVE 
        if (Boolean.FALSE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()))
        {
            Homeleave hlRec = (Homeleave)getDTOInstance(Homeleave.class);
            hlRec.DataCollection.add();

            copyHomeLeaveToDto(hlRec, doAdmissionDetail, voHomeLeave);

            Result res = hlRec.update();
            if (res != null && res.getId() < 0 )
            {
                if (res.getId() == -5)
                    throw new DomainInterfaceException("Error occurred saving Home Leave record to PAS " + res.getMessage());
                else 
                    throw new DTODomainInterfaceException(res.getId(), "Error occurred saving Home Leave record to PAS " + res.getMessage());   
            }
        }
    }

    getDomainFactory().save(doInpatEpis);

    if(doBedSpaceState != null)
        doAdmissionDetail.setBed(doBedSpaceState.getBedSpace());

    getDomainFactory().save(doAdmissionDetail);
}
项目:openmaxims-linux    文件:BedInfoDialogImpl.java   
public CareContextShortVo saveHomeLeave(BedSpaceStateLiteVo voBedSpaceStateLite, InPatientEpisodeADTVo inpatientEpisode, HomeLeaveVo homeLeaveVo) throws DomainInterfaceException, StaleObjectException 
{
    if(inpatientEpisode == null)
        throw new CodingRuntimeException("inpatientEpisode is null in method saveTransfer");
    if(!inpatientEpisode.isValidated())
        throw new CodingRuntimeException("inpatientEpisode has not been validated in method saveTransfer");

    if(homeLeaveVo == null)
        throw new CodingRuntimeException("homeLeaveVo is null in method saveHomeLeave");

    DomainFactory factory = getDomainFactory();

    if (Boolean.FALSE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()))
    {
        Homeleave hlRec = (Homeleave)getDTOInstance(Homeleave.class);
        hlRec.DataCollection.add();

        copyHomeleaveToDto(hlRec, homeLeaveVo, inpatientEpisode);

        //Update Home Leave on PAS 
        Result res = hlRec.insert();
        if (res != null && res.getId() < 0 )
        {
            if (res.getId() == -5)
                throw new DomainInterfaceException("Error occurred saving Home Leave record to PAS " + res.getMessage());
            else 
                throw new DTODomainInterfaceException(res.getId(), "Error occurred saving Home Leave record to PAS " + res.getMessage());   
        }
    }       
    //Save MAXIMS HomeLeave
    HomeLeave doHL = HomeLeaveVoAssembler.extractHomeLeave(factory, homeLeaveVo);

    //Save IP details
    InpatientEpisode doInpatEpis = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode);
    doInpatEpis.getHomeLeaves().add(doHL);

    doInpatEpis.setIsOnHomeLeave(true);
    doInpatEpis.setDateOnHomeLeave(homeLeaveVo.getDateOnHomeLeaveIsNotNull() ? homeLeaveVo.getDateOnHomeLeave().getDate() : null);
    doInpatEpis.setTimeOnHomeLeave(homeLeaveVo.getTimeOnHomeLeaveIsNotNull() ? homeLeaveVo.getTimeOnHomeLeave().toString() : null);
    doInpatEpis.setExpectedDateOfReturn(homeLeaveVo.getExpectedDateOfReturnIsNotNull() ? homeLeaveVo.getExpectedDateOfReturn().getDate() : null);
    doInpatEpis.setExpectedTimeOfReturn(homeLeaveVo.getExpectedTimeOfReturnIsNotNull() ? homeLeaveVo.getExpectedTimeOfReturn().toString() : null);
    doInpatEpis.setVacatedBedNumber(homeLeaveVo.getVacatedBedNumberIsNotNull() ? homeLeaveVo.getVacatedBedNumber() : "");

    factory.save(doInpatEpis);

    //Vacate the bed.
    if(voBedSpaceStateLite != null)
    {
        BedSpaceState doBed = BedSpaceStateLiteVoAssembler.extractBedSpaceState(factory, voBedSpaceStateLite);
        factory.save(doBed);
    }
    return null;
}
项目:openmaxims-linux    文件:BedInfoDialogImpl.java   
private void copyHomeLeaveToDto(Homeleave homeLeaveRec, AdmissionDetail doAdmissionDetail, HomeLeaveVo voHomeLeave) 
    {       
        HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0);

        hlRec.Pkey = getPatientIdValue(doAdmissionDetail, PatIdType.PKEY);
        hlRec.Hospnum = getPatientIdValue(doAdmissionDetail, PatIdType.HOSPNUM);

        hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : "";
        hlRec.Leavetm =  voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : "";

        hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : "";
        hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : "";

        hlRec.Rescode = doAdmissionDetail.getWard() != null ? doAdmissionDetail.getWard().getExtCode(TaxonomyType.PAS.getID()) : null;
        hlRec.Mors = DTOHelper.getPasMapping(doAdmissionDetail.getWardType());
        if(doAdmissionDetail.getPasEvent().getPatient().getSex() != null)
        {
            if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE)))
                hlRec.Btyp = "M";
            else if(doAdmissionDetail.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE)))
                hlRec.Btyp = "F";
            else
                //defaulting Male for unknown sex
                hlRec.Btyp = "M";
        }
        else
            //defaulting Male for unknown sex
            hlRec.Btyp = "M";   

        hlRec.Returndt = voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateReturnedFromHomeLeave().getDate()) : "";
        hlRec.Returntm = voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString(TimeFormat.FLAT4) : "";

//      if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO"))
//          hlRec.Cflup = rec.Rescode;

        if (voHomeLeave.getID_HomeLeaveIsNotNull())
            hlRec.Hlfl = "N"; //"N" on an update
        else
            hlRec.Hlfl = "Y"; //"Y" on an insert

        hlRec.Webadt = "Y";             
    }
项目:openmaxims-linux    文件:BedAdmissionComponentImpl.java   
public void allocateBed(BedSpaceStateLiteVo bedSpace, InpatientEpisodeLiteVo inpatientEpisode, AdmissionDetailVo admissionDetail, HomeLeaveVo voHomeLeave) throws StaleObjectException, DomainInterfaceException 
{
    if (inpatientEpisode == null)
        throw new CodingRuntimeException("inpatientEpisode is null in method allocateBed");
    if (bedSpace == null)
        throw new CodingRuntimeException("bedSpace is null in method allocateBed");
    if (admissionDetail == null)
        throw new CodingRuntimeException("admissionDetail is null in method allocateBed");

    BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpace);    
    InpatientEpisode doInpatEpis = InpatientEpisodeLiteVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode);
    AdmissionDetail doAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admissionDetail);

    if(doBedSpaceState != null)
    {
        doBedSpaceState.setInpatientEpisode(doInpatEpis);   
        doInpatEpis.setBed(doBedSpaceState);
    }

    if(voHomeLeave != null)
    {
        for(int i = 0 ; doInpatEpis.getHomeLeaves().size() > 0 && i < doInpatEpis.getHomeLeaves().size() ; i++)
        {
             HomeLeave doHL = (HomeLeave)doInpatEpis.getHomeLeaves().get(i);
             if (doHL != null
                && doHL.getDateReturnedFromHomeLeave() == null)
             {
                 doHL.setDateReturnedFromHomeLeave(voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getDateReturnedFromHomeLeave().getDate() : null);
                 doHL.setTimeReturnedFromHomeLeave(voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString() : null);

                 doInpatEpis.getHomeLeaves().set(i, doHL);
             }
        }
        doInpatEpis.setIsOnHomeLeave(false);
        doInpatEpis.setDateOnHomeLeave(null);
        doInpatEpis.setTimeOnHomeLeave(null);
        doInpatEpis.setExpectedDateOfReturn(null);
        doInpatEpis.setExpectedTimeOfReturn(null);
        doInpatEpis.setVacatedBedNumber(null);

        //UPDATE PAS THAT NO LONGER ON HOME LEAVE 
        if (Boolean.FALSE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()))
        {
            Homeleave hlRec = (Homeleave)getDTOInstance(Homeleave.class);
            hlRec.DataCollection.add();

            copyHomeLeaveToDto(hlRec, doAdmissionDetail, voHomeLeave);

            Result res = hlRec.update();
            if (res != null && res.getId() < 0 )
            {
                if (res.getId() == -5)
                    throw new DomainInterfaceException("Error occurred saving Home Leave record to PAS " + res.getMessage());
                else 
                    throw new DTODomainInterfaceException(res.getId(), "Error occurred saving Home Leave record to PAS " + res.getMessage());   
            }
        }
    }

    getDomainFactory().save(doInpatEpis);

    if(doBedSpaceState != null)
        doAdmissionDetail.setBed(doBedSpaceState.getBedSpace());

    getDomainFactory().save(doAdmissionDetail);
}