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

项目:AvoinApotti    文件:Logic.java   
/**
 * Function used to compare two records after age
 */
public int compare(PendingEmergencyAdmissionLiteVo o1, PendingEmergencyAdmissionLiteVo o2)
{
    if (o1.getPasEventIsNotNull() && o1.getPasEvent().getPatientIsNotNull() && o1.getPasEvent().getPatient().getAgeIsNotNull()
            && o2.getPasEventIsNotNull() && o2.getPasEvent().getPatientIsNotNull() && o2.getPasEvent().getPatient().getAgeIsNotNull())
    {
        return o1.getPasEvent().getPatient().getAge().compareTo(o2.getPasEvent().getPatient().getAge()) * direction;
    }

    if (o1.getPasEventIsNotNull() && o1.getPasEvent().getPatientIsNotNull() && o1.getPasEvent().getPatient().getAgeIsNotNull()
            && (!o2.getPasEventIsNotNull() || !o2.getPasEvent().getPatientIsNotNull() || !o2.getPasEvent().getPatient().getAgeIsNotNull()) )
    {
        return direction;
    }

    if (o1.getPasEventIsNotNull() && o1.getPasEvent().getPatientIsNotNull() && o1.getPasEvent().getPatient().getAgeIsNotNull()
            && (!o2.getPasEventIsNotNull() || !o2.getPasEvent().getPatientIsNotNull() || !o2.getPasEvent().getPatient().getAgeIsNotNull()) )
    {
        return -1 * direction;
    }

    return 0;
}
项目:AvoinApotti    文件:Logic.java   
/**
 * Function used to compare two records after alert image
 */
public int compare(PendingEmergencyAdmissionLiteVo o1, PendingEmergencyAdmissionLiteVo o2)
{
    if (o1.getPasEvent()!= null && o1.getPasEvent().getPatient() != null && o2.getPasEvent() != null && o2.getPasEvent().getPatient() != null)
    {
        Integer val1 = Boolean.TRUE.equals(o1.getActiveAlerts()) ? 1 : 0;
        Integer val2 = Boolean.TRUE.equals(o2.getActiveAlerts()) ? 1 : 0;

        if (val1 != 0 && val2 != 0)
        {
            return val1.compareTo(val2) * direction;
        }

        if (val1 != 0 && val2 == 0)
        {
            return direction;
        }

        if (val2 != 0 && val1 == 0)
        {
            return -1 * direction;
        }   
    }

return 0;
}
项目:AvoinApotti    文件:Logic.java   
/**
 * WDEV-13136
 * Function used to update the global contexts PatientToBeDisplayed and PatientShort
 */
private void updateGlobalContextOnSelection(PendingEmergencyAdmissionLiteVo selectedValue)
{
    form.getGlobalContext().Core.setSelectingPatientForm(null);
    form.getGlobalContext().Core.setPatientToBeDisplayed(null);
    form.getGlobalContext().Core.setPatientShort(null);

    if (selectedValue == null)
        return;

    if (selectedValue.getPasEventIsNotNull() && selectedValue.getPasEvent().getPatientIsNotNull())
    {
        PatientShort ps = domain.getPatientShort(selectedValue.getPasEvent().getPatient());

        form.getGlobalContext().Core.setSelectingPatientForm(engine.getFormName());
        form.getGlobalContext().Core.setPatientToBeDisplayed(ps);
        form.getGlobalContext().Core.setPatientShort(ps);
    }
}
项目:openMAXIMS    文件:Logic.java   
public int compare(Object o1, Object o2)
{
    PartialDate pdate1 = null;
    PartialDate pdate2 = null;

    if (o1 instanceof PendingEmergencyAdmissionLiteVo && o2 instanceof PendingEmergencyAdmissionLiteVo)
    {
        PendingEmergencyAdmissionLiteVo ps1 = (PendingEmergencyAdmissionLiteVo)o1;
        pdate1 = ps1.getPasEventIsNotNull()  && ps1.getPasEvent().getPatientIsNotNull() ? ps1.getPasEvent().getPatient().getDob() : null;
        PendingEmergencyAdmissionLiteVo ps2 = (PendingEmergencyAdmissionLiteVo)o2;
        pdate2 = ps2.getPasEventIsNotNull() && ps2.getPasEvent().getPatientIsNotNull()  ? ps2.getPasEvent().getPatient().getDob() : null;
    }



    if (pdate1 != null && pdate2 != null)
        return  pdate1.compareTo(pdate2)*direction;
    if (pdate1 != null)
        return direction;
    if (pdate2 != null)
        return -1*direction;

    return 0;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * Function used to compare two records after alert image
 */
public int compare(PendingEmergencyAdmissionLiteVo o1, PendingEmergencyAdmissionLiteVo o2)
{
    if (o1.getPasEvent()!= null && o1.getPasEvent().getPatient() != null && o2.getPasEvent() != null && o2.getPasEvent().getPatient() != null)
    {
        Integer val1 = Boolean.TRUE.equals(o1.getActiveAlerts()) ? 1 : 0;
        Integer val2 = Boolean.TRUE.equals(o2.getActiveAlerts()) ? 1 : 0;

        if (val1 != 0 && val2 != 0)
        {
            return val1.compareTo(val2) * direction;
        }

        if (val1 != 0 && val2 == 0)
        {
            return direction;
        }

        if (val2 != 0 && val1 == 0)
        {
            return -1 * direction;
        }   
    }

return 0;
}
项目:openMAXIMS    文件:PendingEmergencyAdmissionsImpl.java   
public CareContextShortVo getCurrentCareContext(PendingEmergencyAdmissionLiteVo adm)
{
    if (adm == null)
        return null;

    CareContextShortVo cc = null;
    if (adm.getPasEvent() != null)
    {   
        WardView impl = (WardView) getDomainImpl(WardViewImpl.class);
        cc =  impl.getCareContextForPasEvent(adm.getPasEvent());
    }
    if (cc == null)
    {   
        String hql = "select cc from Tracking as track left join track.attendance as att left join att.careContext as cc left join track.associatedPendingEmergencyAdmission as pea WHERE (att.isRIE is null OR att.isRIE = 0) AND pea.id = :PENDING_ADM_ID";
        DomainFactory fact = getDomainFactory();

        CareContext careContextDO = (CareContext) fact.findFirst(hql, "PENDING_ADM_ID", adm.getID_PendingEmergencyAdmission());
        cc = careContextDO != null ? CareContextShortVoAssembler.create(careContextDO) : null;
    }

    return cc;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * Function used to compare two records after age
 */
public int compare(PendingEmergencyAdmissionLiteVo o1, PendingEmergencyAdmissionLiteVo o2)
{
    if (o1.getPasEventIsNotNull() && o1.getPasEvent().getPatientIsNotNull() && o1.getPasEvent().getPatient().getAgeIsNotNull()
            && o2.getPasEventIsNotNull() && o2.getPasEvent().getPatientIsNotNull() && o2.getPasEvent().getPatient().getAgeIsNotNull())
    {
        return o1.getPasEvent().getPatient().getAge().compareTo(o2.getPasEvent().getPatient().getAge()) * direction;
    }

    if (o1.getPasEventIsNotNull() && o1.getPasEvent().getPatientIsNotNull() && o1.getPasEvent().getPatient().getAgeIsNotNull()
            && (!o2.getPasEventIsNotNull() || !o2.getPasEvent().getPatientIsNotNull() || !o2.getPasEvent().getPatient().getAgeIsNotNull()) )
    {
        return direction;
    }

    if (o1.getPasEventIsNotNull() && o1.getPasEvent().getPatientIsNotNull() && o1.getPasEvent().getPatient().getAgeIsNotNull()
            && (!o2.getPasEventIsNotNull() || !o2.getPasEvent().getPatientIsNotNull() || !o2.getPasEvent().getPatient().getAgeIsNotNull()) )
    {
        return -1 * direction;
    }

    return 0;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * Function used to compare two records after alert image
 */
public int compare(PendingEmergencyAdmissionLiteVo o1, PendingEmergencyAdmissionLiteVo o2)
{
    if (o1.getPasEvent()!= null && o1.getPasEvent().getPatient() != null && o2.getPasEvent() != null && o2.getPasEvent().getPatient() != null)
    {
        Integer val1 = Boolean.TRUE.equals(o1.getActiveAlerts()) ? 1 : 0;
        Integer val2 = Boolean.TRUE.equals(o2.getActiveAlerts()) ? 1 : 0;

        if (val1 != 0 && val2 != 0)
        {
            return val1.compareTo(val2) * direction;
        }

        if (val1 != 0 && val2 == 0)
        {
            return direction;
        }

        if (val2 != 0 && val1 == 0)
        {
            return -1 * direction;
        }   
    }

return 0;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * WDEV-13136
 * Function used to update the global contexts PatientToBeDisplayed and PatientShort
 */
private void updateGlobalContextOnSelection(PendingEmergencyAdmissionLiteVo selectedValue)
{
    form.getGlobalContext().Core.setSelectingPatientForm(null);
    form.getGlobalContext().Core.setPatientToBeDisplayed(null);
    form.getGlobalContext().Core.setPatientShort(null);

    if (selectedValue == null)
        return;

    if (selectedValue.getPasEventIsNotNull() && selectedValue.getPasEvent().getPatientIsNotNull())
    {
        PatientShort ps = domain.getPatientShort(selectedValue.getPasEvent().getPatient());

        form.getGlobalContext().Core.setSelectingPatientForm(engine.getFormName());
        form.getGlobalContext().Core.setPatientToBeDisplayed(ps);
        form.getGlobalContext().Core.setPatientShort(ps);
    }
}
项目:openmaxims-linux    文件:Logic.java   
/**
 * Function used to compare two records after age
 */
public int compare(PendingEmergencyAdmissionLiteVo o1, PendingEmergencyAdmissionLiteVo o2)
{
    if (o1.getPasEventIsNotNull() && o1.getPasEvent().getPatientIsNotNull() && o1.getPasEvent().getPatient().getAgeIsNotNull()
            && o2.getPasEventIsNotNull() && o2.getPasEvent().getPatientIsNotNull() && o2.getPasEvent().getPatient().getAgeIsNotNull())
    {
        return o1.getPasEvent().getPatient().getAge().compareTo(o2.getPasEvent().getPatient().getAge()) * direction;
    }

    if (o1.getPasEventIsNotNull() && o1.getPasEvent().getPatientIsNotNull() && o1.getPasEvent().getPatient().getAgeIsNotNull()
            && (!o2.getPasEventIsNotNull() || !o2.getPasEvent().getPatientIsNotNull() || !o2.getPasEvent().getPatient().getAgeIsNotNull()) )
    {
        return direction;
    }

    if (o1.getPasEventIsNotNull() && o1.getPasEvent().getPatientIsNotNull() && o1.getPasEvent().getPatient().getAgeIsNotNull()
            && (!o2.getPasEventIsNotNull() || !o2.getPasEvent().getPatientIsNotNull() || !o2.getPasEvent().getPatient().getAgeIsNotNull()) )
    {
        return -1 * direction;
    }

    return 0;
}
项目:openmaxims-linux    文件:Logic.java   
/**
 * Function used to compare two records after alert image
 */
public int compare(PendingEmergencyAdmissionLiteVo o1, PendingEmergencyAdmissionLiteVo o2)
{
    if (o1.getPasEvent()!= null && o1.getPasEvent().getPatient() != null && o2.getPasEvent() != null && o2.getPasEvent().getPatient() != null)
    {
        Integer val1 = Boolean.TRUE.equals(o1.getActiveAlerts()) ? 1 : 0;
        Integer val2 = Boolean.TRUE.equals(o2.getActiveAlerts()) ? 1 : 0;

        if (val1 != 0 && val2 != 0)
        {
            return val1.compareTo(val2) * direction;
        }

        if (val1 != 0 && val2 == 0)
        {
            return direction;
        }

        if (val2 != 0 && val1 == 0)
        {
            return -1 * direction;
        }   
    }

return 0;
}
项目:openmaxims-linux    文件:Logic.java   
/**
 * WDEV-13136
 * Function used to update the global contexts PatientToBeDisplayed and PatientShort
 */
private void updateGlobalContextOnSelection(PendingEmergencyAdmissionLiteVo selectedValue)
{
    form.getGlobalContext().Core.setSelectingPatientForm(null);
    form.getGlobalContext().Core.setPatientToBeDisplayed(null);
    form.getGlobalContext().Core.setPatientShort(null);

    if (selectedValue == null)
        return;

    if (selectedValue.getPasEventIsNotNull() && selectedValue.getPasEvent().getPatientIsNotNull())
    {
        PatientShort ps = domain.getPatientShort(selectedValue.getPasEvent().getPatient());

        form.getGlobalContext().Core.setSelectingPatientForm(engine.getFormName());
        form.getGlobalContext().Core.setPatientToBeDisplayed(ps);
        form.getGlobalContext().Core.setPatientShort(ps);
    }
}
项目:AvoinApotti    文件:Logic.java   
private PendingEmergencyAdmissionLiteVo populateDataFormScreen()
{
    PendingEmergencyAdmissionLiteVo voEmergencyAdmission = form.getGlobalContext().Core.getADTPendingEmergencyAdmission();

    if(voEmergencyAdmission != null)
    {
        voEmergencyAdmission.setAllocatedWard(form.cmbWard().getValue());

        if(voEmergencyAdmission.getPasEventIsNotNull())
            voEmergencyAdmission.getPasEvent().setSpecialty(form.cmbSpecialty().getValue());
    }

    return voEmergencyAdmission;
}
项目:AvoinApotti    文件:Logic.java   
/**
 * WDEV-13136
 * Function used to sort admissions by column
 */
private void sortAdmissions(int column)
{
    // Get records from grid
    PendingEmergencyAdmissionLiteVoCollection records = form.grdAdmissions().getValues();

    // Toggle sort mode for column
    sortOrderToggle(column);

    // Determine the column - sort records after it
    if (column == COL_AGE)
    {
        records.sort(new AgeComparator(form.getLocalContext().getSortOrderAge()));
    }
    else if (column == COL_DATE_DECISION_TO_ADMIT)
    {
        records.sort(PendingEmergencyAdmissionLiteVo.getDateTimeComparator(form.getLocalContext().getSortOrder()));
    }

    //WDEV-18011 
    else if (column == COL_ALERT)
    {
        records.sort(new AlertComparator(form.getLocalContext().getSortOrderAlert()));
    }

    // Get selection
    PendingEmergencyAdmissionLiteVo selectedValue = form.grdAdmissions().getValue();
    // Re-populate grid
    populateGrid(records);
    // Update selection
    form.grdAdmissions().setValue(selectedValue);
    // Call code for new selection
    updateGlobalContextOnSelection(form.grdAdmissions().getValue());
}
项目:AvoinApotti    文件:PendingEmergencyAdmissionsImpl.java   
public void removeFromPendingEmergency(PendingEmergencyAdmissionLiteVo pendingEmergency) throws StaleObjectException
{
    if (pendingEmergency == null || pendingEmergency.getID_PendingEmergencyAdmission() == null)
        throw new CodingRuntimeException("pendingEmergency  is null or id not provided in method removeFromPendingEmergency");

    DomainFactory factory = getDomainFactory();
    PendingEmergencyAdmission doPendingEmergency = (PendingEmergencyAdmission)factory.getDomainObject(pendingEmergency);

    doPendingEmergency.setBedTypeRequested(null);
    doPendingEmergency.setAllocatedWard(null);

    factory.save(doPendingEmergency);
}
项目:AvoinApotti    文件:AssignADTWardAndSpecialtyDialogImpl.java   
/**
* savePendingEmergency
*/
public void savePendingEmergency(ims.core.vo.PendingEmergencyAdmissionLiteVo emergency, Boolean hasWardChanged,TrackingForADTWardAndSpecialtyDialogVo tracking) throws ims.domain.exceptions.StaleObjectException
{
    if (hasWardChanged == null)
        throw new CodingRuntimeException("hasWardChanged cannot be null in method savePendingEmergency");
    if (emergency == null)
        throw new CodingRuntimeException("emergency is null in method savePendingEmergency");
    if (!emergency.isValidated())
        throw new CodingRuntimeException("emergency has not been validated in method savePendingEmergency");

    //WDEV-10421
    DomainFactory factory = getDomainFactory();
    PendingEmergencyAdmission doPendingEmergency = PendingEmergencyAdmissionLiteVoAssembler.extractPendingEmergencyAdmission(factory, emergency);
    if(hasWardChanged)
    {
        AllocatedWardHistory doAllocWardHist = new AllocatedWardHistory();
        doAllocWardHist.setAllocatedWard(doPendingEmergency.getAllocatedWard());
        doAllocWardHist.setAllocatedWardDateTime(new Date());       
        if(getLoggedInUser() != null)
            doAllocWardHist.setAllocatingUser((AppUser) getDomainFactory().getDomainObject((AppUserRefVo) getLoggedInUser()));

        doPendingEmergency.getAllocatedWardHistory().add(doAllocWardHist);
    }       

    factory.save(doPendingEmergency);

    //wdev-16866
    if( tracking != null )
    {
        Tracking doTracking =  TrackingForADTWardAndSpecialtyDialogVoAssembler.extractTracking(factory, tracking);
        factory.save(doTracking);       
    }
    //------------
}
项目:openMAXIMS    文件:Logic.java   
private PendingEmergencyAdmissionLiteVo populateDataFormScreen()
{
    PendingEmergencyAdmissionLiteVo voEmergencyAdmission = form.getGlobalContext().Core.getADTPendingEmergencyAdmission();

    if(voEmergencyAdmission != null)
    {
        voEmergencyAdmission.setAllocatedWard(form.cmbWard().getValue());

        if(voEmergencyAdmission.getPasEventIsNotNull())
            voEmergencyAdmission.getPasEvent().setSpecialty(form.cmbSpecialty().getValue());
    }

    return voEmergencyAdmission;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * WDEV-13136
 * Function used to update the global contexts PatientToBeDisplayed and PatientShort
 */
private void updateGlobalContextOnSelection(PendingEmergencyAdmissionLiteVo selectedValue)
{
    form.getGlobalContext().Core.setSelectingPatientForm(null);
    form.getGlobalContext().Core.setPatientToBeDisplayed(null);
    form.getGlobalContext().Core.setPatientShort(null);
    form.getGlobalContext().Core.setCurrentCareContext(null);

    if (selectedValue == null)
        return;

    if (selectedValue.getPasEventIsNotNull())
    {
        form.getGlobalContext().Core.setCurrentCareContext(domain.getCurrentCareContext(selectedValue));

        if (form.getGlobalContext().Core.getCurrentCareContext() == null && selectedValue.getPasEvent().getPatientIsNotNull())
        {
            PatientShort ps = domain.getPatientShort(selectedValue.getPasEvent().getPatient());

            form.getGlobalContext().Core.setSelectingPatientForm(engine.getFormName());
            form.getGlobalContext().Core.setPatientToBeDisplayed(ps);
            form.getGlobalContext().Core.setPatientShort(ps);
        }
        else if (form.getGlobalContext().Core.getCurrentCareContext() != null)
        {
            form.getGlobalContext().Core.setSelectingPatientForm(engine.getFormName());
            form.getGlobalContext().Core.setPatientToBeDisplayed(form.getGlobalContext().Core.getPatientShort());
        }
    }

}
项目:openMAXIMS    文件:PendingEmergencyAdmissionsImpl.java   
public void removeFromPendingEmergency(PendingEmergencyAdmissionLiteVo pendingEmergency) throws StaleObjectException
{
    if (pendingEmergency == null || pendingEmergency.getID_PendingEmergencyAdmission() == null)
        throw new CodingRuntimeException("pendingEmergency  is null or id not provided in method removeFromPendingEmergency");

    DomainFactory factory = getDomainFactory();
    PendingEmergencyAdmission doPendingEmergency = (PendingEmergencyAdmission)factory.getDomainObject(pendingEmergency);

    doPendingEmergency.setBedTypeRequested(null);
    doPendingEmergency.setAllocatedWard(null);

    factory.save(doPendingEmergency);
}
项目:openMAXIMS    文件:AssignADTWardAndSpecialtyDialogImpl.java   
/**
* savePendingEmergency
*/
public void savePendingEmergency(ims.core.vo.PendingEmergencyAdmissionLiteVo emergency, Boolean hasWardChanged,TrackingForADTWardAndSpecialtyDialogVo tracking) throws ims.domain.exceptions.StaleObjectException
{
    if (hasWardChanged == null)
        throw new CodingRuntimeException("hasWardChanged cannot be null in method savePendingEmergency");
    if (emergency == null)
        throw new CodingRuntimeException("emergency is null in method savePendingEmergency");
    if (!emergency.isValidated())
        throw new CodingRuntimeException("emergency has not been validated in method savePendingEmergency");

    //WDEV-10421
    DomainFactory factory = getDomainFactory();
    PendingEmergencyAdmission doPendingEmergency = PendingEmergencyAdmissionLiteVoAssembler.extractPendingEmergencyAdmission(factory, emergency);
    if(hasWardChanged)
    {
        AllocatedWardHistory doAllocWardHist = new AllocatedWardHistory();
        doAllocWardHist.setAllocatedWard(doPendingEmergency.getAllocatedWard());
        doAllocWardHist.setAllocatedWardDateTime(new Date());       
        if(getLoggedInUser() != null)
            doAllocWardHist.setAllocatingUser((AppUser) getDomainFactory().getDomainObject((AppUserRefVo) getLoggedInUser()));

        doPendingEmergency.getAllocatedWardHistory().add(doAllocWardHist);
    }       

    factory.save(doPendingEmergency);

    //wdev-16866
    if( tracking != null )
    {
        Tracking doTracking =  TrackingForADTWardAndSpecialtyDialogVoAssembler.extractTracking(factory, tracking);
        factory.save(doTracking);       
    }
    //------------
}
项目:openMAXIMS    文件:Logic.java   
private PendingEmergencyAdmissionLiteVo populateDataFormScreen()
{
    PendingEmergencyAdmissionLiteVo voEmergencyAdmission = form.getGlobalContext().Core.getADTPendingEmergencyAdmission();

    if(voEmergencyAdmission != null)
    {
        voEmergencyAdmission.setAllocatedWard(form.cmbWard().getValue());

        if(voEmergencyAdmission.getPasEventIsNotNull())
            voEmergencyAdmission.getPasEvent().setSpecialty(form.cmbSpecialty().getValue());
    }

    return voEmergencyAdmission;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * WDEV-13136
 * Function used to sort admissions by column
 */
private void sortAdmissions(int column)
{
    // Get records from grid
    PendingEmergencyAdmissionLiteVoCollection records = form.grdAdmissions().getValues();

    // Toggle sort mode for column
    sortOrderToggle(column);

    // Determine the column - sort records after it
    if (column == COL_AGE)
    {
        records.sort(new AgeComparator(form.getLocalContext().getSortOrderAge()));
    }
    else if (column == COL_DATE_DECISION_TO_ADMIT)
    {
        records.sort(PendingEmergencyAdmissionLiteVo.getDateTimeComparator(form.getLocalContext().getSortOrder()));
    }

    //WDEV-18011 
    else if (column == COL_ALERT)
    {
        records.sort(new AlertComparator(form.getLocalContext().getSortOrderAlert()));
    }

    // Get selection
    PendingEmergencyAdmissionLiteVo selectedValue = form.grdAdmissions().getValue();
    // Re-populate grid
    populateGrid(records);
    // Update selection
    form.grdAdmissions().setValue(selectedValue);
    // Call code for new selection
    updateGlobalContextOnSelection(form.grdAdmissions().getValue());
}
项目:openMAXIMS    文件:PendingEmergencyAdmissionsImpl.java   
public void removeFromPendingEmergency(PendingEmergencyAdmissionLiteVo pendingEmergency) throws StaleObjectException
{
    if (pendingEmergency == null || pendingEmergency.getID_PendingEmergencyAdmission() == null)
        throw new CodingRuntimeException("pendingEmergency  is null or id not provided in method removeFromPendingEmergency");

    DomainFactory factory = getDomainFactory();
    PendingEmergencyAdmission doPendingEmergency = (PendingEmergencyAdmission)factory.getDomainObject(pendingEmergency);

    doPendingEmergency.setBedTypeRequested(null);
    doPendingEmergency.setAllocatedWard(null);

    factory.save(doPendingEmergency);
}
项目:openMAXIMS    文件:AssignADTWardAndSpecialtyDialogImpl.java   
/**
* savePendingEmergency
*/
public void savePendingEmergency(ims.core.vo.PendingEmergencyAdmissionLiteVo emergency, Boolean hasWardChanged,TrackingForADTWardAndSpecialtyDialogVo tracking) throws ims.domain.exceptions.StaleObjectException
{
    if (hasWardChanged == null)
        throw new CodingRuntimeException("hasWardChanged cannot be null in method savePendingEmergency");
    if (emergency == null)
        throw new CodingRuntimeException("emergency is null in method savePendingEmergency");
    if (!emergency.isValidated())
        throw new CodingRuntimeException("emergency has not been validated in method savePendingEmergency");

    //WDEV-10421
    DomainFactory factory = getDomainFactory();
    PendingEmergencyAdmission doPendingEmergency = PendingEmergencyAdmissionLiteVoAssembler.extractPendingEmergencyAdmission(factory, emergency);
    if(hasWardChanged)
    {
        AllocatedWardHistory doAllocWardHist = new AllocatedWardHistory();
        doAllocWardHist.setAllocatedWard(doPendingEmergency.getAllocatedWard());
        doAllocWardHist.setAllocatedWardDateTime(new Date());       
        if(getLoggedInUser() != null)
            doAllocWardHist.setAllocatingUser((AppUser) getDomainFactory().getDomainObject((AppUserRefVo) getLoggedInUser()));

        doPendingEmergency.getAllocatedWardHistory().add(doAllocWardHist);
    }       

    factory.save(doPendingEmergency);

    //wdev-16866
    if( tracking != null )
    {
        Tracking doTracking =  TrackingForADTWardAndSpecialtyDialogVoAssembler.extractTracking(factory, tracking);
        factory.save(doTracking);       
    }
    //------------
}
项目:openmaxims-linux    文件:Logic.java   
private PendingEmergencyAdmissionLiteVo populateDataFormScreen()
{
    PendingEmergencyAdmissionLiteVo voEmergencyAdmission = form.getGlobalContext().Core.getADTPendingEmergencyAdmission();

    if(voEmergencyAdmission != null)
    {
        voEmergencyAdmission.setAllocatedWard(form.cmbWard().getValue());

        if(voEmergencyAdmission.getPasEventIsNotNull())
            voEmergencyAdmission.getPasEvent().setSpecialty(form.cmbSpecialty().getValue());
    }

    return voEmergencyAdmission;
}
项目:openmaxims-linux    文件:Logic.java   
/**
 * WDEV-13136
 * Function used to sort admissions by column
 */
private void sortAdmissions(int column)
{
    // Get records from grid
    PendingEmergencyAdmissionLiteVoCollection records = form.grdAdmissions().getValues();

    // Toggle sort mode for column
    sortOrderToggle(column);

    // Determine the column - sort records after it
    if (column == COL_AGE)
    {
        records.sort(new AgeComparator(form.getLocalContext().getSortOrderAge()));
    }
    else if (column == COL_DATE_DECISION_TO_ADMIT)
    {
        records.sort(PendingEmergencyAdmissionLiteVo.getDateTimeComparator(form.getLocalContext().getSortOrder()));
    }

    //WDEV-18011 
    else if (column == COL_ALERT)
    {
        records.sort(new AlertComparator(form.getLocalContext().getSortOrderAlert()));
    }

    // Get selection
    PendingEmergencyAdmissionLiteVo selectedValue = form.grdAdmissions().getValue();
    // Re-populate grid
    populateGrid(records);
    // Update selection
    form.grdAdmissions().setValue(selectedValue);
    // Call code for new selection
    updateGlobalContextOnSelection(form.grdAdmissions().getValue());
}
项目:openmaxims-linux    文件:PendingEmergencyAdmissionsImpl.java   
public void removeFromPendingEmergency(PendingEmergencyAdmissionLiteVo pendingEmergency) throws StaleObjectException
{
    if (pendingEmergency == null || pendingEmergency.getID_PendingEmergencyAdmission() == null)
        throw new CodingRuntimeException("pendingEmergency  is null or id not provided in method removeFromPendingEmergency");

    DomainFactory factory = getDomainFactory();
    PendingEmergencyAdmission doPendingEmergency = (PendingEmergencyAdmission)factory.getDomainObject(pendingEmergency);

    doPendingEmergency.setBedTypeRequested(null);
    doPendingEmergency.setAllocatedWard(null);

    factory.save(doPendingEmergency);
}
项目:openmaxims-linux    文件:AssignADTWardAndSpecialtyDialogImpl.java   
/**
* savePendingEmergency
*/
public void savePendingEmergency(ims.core.vo.PendingEmergencyAdmissionLiteVo emergency, Boolean hasWardChanged,TrackingForADTWardAndSpecialtyDialogVo tracking) throws ims.domain.exceptions.StaleObjectException
{
    if (hasWardChanged == null)
        throw new CodingRuntimeException("hasWardChanged cannot be null in method savePendingEmergency");
    if (emergency == null)
        throw new CodingRuntimeException("emergency is null in method savePendingEmergency");
    if (!emergency.isValidated())
        throw new CodingRuntimeException("emergency has not been validated in method savePendingEmergency");

    //WDEV-10421
    DomainFactory factory = getDomainFactory();
    PendingEmergencyAdmission doPendingEmergency = PendingEmergencyAdmissionLiteVoAssembler.extractPendingEmergencyAdmission(factory, emergency);
    if(hasWardChanged)
    {
        AllocatedWardHistory doAllocWardHist = new AllocatedWardHistory();
        doAllocWardHist.setAllocatedWard(doPendingEmergency.getAllocatedWard());
        doAllocWardHist.setAllocatedWardDateTime(new Date());       
        if(getLoggedInUser() != null)
            doAllocWardHist.setAllocatingUser((AppUser) getDomainFactory().getDomainObject((AppUserRefVo) getLoggedInUser()));

        doPendingEmergency.getAllocatedWardHistory().add(doAllocWardHist);
    }       

    factory.save(doPendingEmergency);

    //wdev-16866
    if( tracking != null )
    {
        Tracking doTracking =  TrackingForADTWardAndSpecialtyDialogVoAssembler.extractTracking(factory, tracking);
        factory.save(doTracking);       
    }
    //------------
}
项目:AvoinApotti    文件:Logic.java   
@Override
protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException
{
    PendingEmergencyAdmissionLiteVo voEmergencyAdmission = populateDataFormScreen();

    ArrayList<String> screenErrors = new ArrayList<String>();

    if (form.cmbWard().getValue() == null)
        screenErrors.add("Ward is a mandatory item.");
    if (form.cmbSpecialty().getValue() == null)
        screenErrors.add("Specialty is a mandatory item.");

    String[] arrErrors = voEmergencyAdmission.validate();

    String[] arrScreenAndVoErrors = addScreenErrorsToVOErrors(screenErrors, arrErrors);
    if (arrScreenAndVoErrors.length != 0)
    {
        engine.showErrors(arrScreenAndVoErrors);
        return;
    }

    Boolean hasWardChanged = form.getLocalContext().getSelectedWard() == null;
    if(form.getLocalContext().getSelectedWardIsNotNull() && form.getGlobalContext().Core.getADTPendingEmergencyAdmissionIsNotNull() && form.getGlobalContext().Core.getADTPendingEmergencyAdmission().getAllocatedWardIsNotNull())
        hasWardChanged = !form.getLocalContext().getSelectedWard().equals(form.getGlobalContext().Core.getADTPendingEmergencyAdmission().getAllocatedWard());

    //wdev-16866
    TrackingForADTWardAndSpecialtyDialogVo trackVo = null;
    if( voEmergencyAdmission != null && voEmergencyAdmission.getID_PendingEmergencyAdmissionIsNotNull())
    {
        trackVo = domain.getTracking(voEmergencyAdmission);
        if( trackVo != null)
        {
            if( trackVo.getBedAvailabilityIsNotNull() )
            {
                trackVo.getBedAvailability().setWard(voEmergencyAdmission.getAllocatedWard());
                trackVo.getBedAvailability().setAvailableDateTime(new DateTime());
            }
        }

    }
    //------------

    try
    {
        domain.savePendingEmergency(voEmergencyAdmission, hasWardChanged,trackVo);      //wdev-16866
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        open();
    }

    engine.close(DialogResult.OK);
}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException
{
    PendingEmergencyAdmissionLiteVo voEmergencyAdmission = populateDataFormScreen();

    ArrayList<String> screenErrors = new ArrayList<String>();

    if (form.cmbWard().getValue() == null)
        screenErrors.add("Ward is a mandatory item.");
    if (form.cmbSpecialty().getValue() == null)
        screenErrors.add("Specialty is a mandatory item.");

    String[] arrErrors = voEmergencyAdmission.validate();

    String[] arrScreenAndVoErrors = addScreenErrorsToVOErrors(screenErrors, arrErrors);
    if (arrScreenAndVoErrors.length != 0)
    {
        engine.showErrors(arrScreenAndVoErrors);
        return;
    }

    Boolean hasWardChanged = form.getLocalContext().getSelectedWard() == null;
    if(form.getLocalContext().getSelectedWardIsNotNull() && form.getGlobalContext().Core.getADTPendingEmergencyAdmissionIsNotNull() && form.getGlobalContext().Core.getADTPendingEmergencyAdmission().getAllocatedWardIsNotNull())
        hasWardChanged = !form.getLocalContext().getSelectedWard().equals(form.getGlobalContext().Core.getADTPendingEmergencyAdmission().getAllocatedWard());

    //wdev-16866
    TrackingForADTWardAndSpecialtyDialogVo trackVo = null;
    if( voEmergencyAdmission != null && voEmergencyAdmission.getID_PendingEmergencyAdmissionIsNotNull())
    {
        trackVo = domain.getTracking(voEmergencyAdmission);
        if( trackVo != null)
        {
            if( trackVo.getBedAvailabilityIsNotNull() )
            {
                trackVo.getBedAvailability().setWard(voEmergencyAdmission.getAllocatedWard());
                trackVo.getBedAvailability().setAvailableDateTime(new DateTime());
            }
        }

    }
    //------------

    try
    {
        domain.savePendingEmergency(voEmergencyAdmission, hasWardChanged,trackVo);      //wdev-16866
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        open();
    }

    engine.close(DialogResult.OK);
}
项目:openMAXIMS    文件:Logic.java   
/**
 * Function used to compare two records after bed availability status image
 */
public int compare(PendingEmergencyAdmissionLiteVo o1, PendingEmergencyAdmissionLiteVo o2)
{
    if (o1.getBedAvailability() != null && o2.getBedAvailability() != null)
    {
        Integer val1, val2;

        if (o1.getBedAvailability().getAvailableDateTime() != null)
        {
            val1 = 1;
        }
        else if (o1.getBedAvailability().getAwaitingDateTime() != null)
        {
            val1 = 2;
        }
        else 
            val1 = 0;

        if (o2.getBedAvailability().getAvailableDateTime() != null)
        {
            val2 = 1;
        }
        else if (o2.getBedAvailability().getAwaitingDateTime() != null)
        {
            val2 = 2;
        }
        else 
            val2 = 0;

        if (val1 != 0 && val2 == 0)
        {
            return direction;
        }

        if (val2 != 0 && val1 == 0)
        {
            return -1 * direction;
        }

        if (val1 != 0 && val2 != 0)
        {
            return val1.compareTo(val2) * direction;
        }               
    }

    return 0;
}
项目:openMAXIMS    文件:Logic.java   
private String getBedStatusTooltip(PendingEmergencyAdmissionLiteVo pendingEmergencyAdmission) 
{
    StringBuffer sb = new StringBuffer();
    BedAvailabilityForTrackingVo bedAvailability = pendingEmergencyAdmission.getBedAvailability();
    sb.append("Requested by:<b> ");
    if (pendingEmergencyAdmission.getBedAvailability() != null)
    {
        if (bedAvailability.getRequestedBy() != null)
        {
            if (bedAvailability.getRequestedBy().getName() != null && bedAvailability.getRequestedBy().getName().getSurname() != null)
                sb.append(bedAvailability.getRequestedBy().getName().getSurname()).append(" ");

            if (bedAvailability.getRequestedBy().getName() != null && bedAvailability.getRequestedBy().getName().getForename() != null)
                sb.append(bedAvailability.getRequestedBy().getName().getForename());
        }
    }
    sb.append("</b><br>");


    sb.append("Decision to Admit Date/Time:<b> ");
    if (pendingEmergencyAdmission != null && pendingEmergencyAdmission.getDTADateTime() != null)
    {
        sb.append(pendingEmergencyAdmission.getDTADateTime());
    }
    sb.append("</b><br>");


    sb.append("Requested Bed Type:<b> ");
    if (pendingEmergencyAdmission != null && pendingEmergencyAdmission.getBedTypeRequested() != null)
    {
        sb.append(pendingEmergencyAdmission.getBedTypeRequested().getText());
    }
    sb.append("</b><br>");


    sb.append("Hospital:<b> ");
    if (pendingEmergencyAdmission != null && pendingEmergencyAdmission.getHospital() != null)
    {
        sb.append(pendingEmergencyAdmission.getHospital().getName());
    }
    sb.append("</b><br>");


    sb.append("Ward:<b> ");
    if (pendingEmergencyAdmission != null && pendingEmergencyAdmission.getAllocatedWard() != null)
    {
        sb.append(pendingEmergencyAdmission.getAllocatedWard().getName());
    }
    sb.append("</b><br><br>");


    sb.append("Bed Available Date/Time:<b> ");
    if (bedAvailability != null && bedAvailability.getAvailableDateTime() != null)
    {
        sb.append(bedAvailability.getAvailableDateTime());
    }
    sb.append("</b><br>");


    sb.append("Bed Available Ward:<b> ");
    if (bedAvailability != null && bedAvailability.getWard() != null)
    {
        sb.append(bedAvailability.getWard().getName() + "</b>");
    }

    return sb.toString();
}
项目:openMAXIMS    文件:Logic.java   
/**
 * WDEV-13136
 * Function used to sort admissions by column
 */
private void sortAdmissions(int column)
{
    // Get records from grid
    PendingEmergencyAdmissionLiteVoCollection records = form.grdAdmissions().getValues();

    //no need to sort 1 record
    if (records.size() < 2)
        return;

    // Toggle sort mode for column
    sortOrderToggle(column);

    // Determine the column - sort records after it
    if (column == COL_AGE)
    {
        //records.sort(new AgeComparator(form.getLocalContext().getSortOrderAge()));
        records.sort(new AgeDOBComparator(form.getLocalContext().getSortOrderAge()));   //wdev-21464

    }
    else if (column == COL_DATE_DECISION_TO_ADMIT)
    {
        records.sort(PendingEmergencyAdmissionLiteVo.getDateTimeComparator(form.getLocalContext().getSortOrder()));
    }

    //WDEV-18011 
    else if (column == COL_ALERT)
    {
        records.sort(new AlertComparator(form.getLocalContext().getSortOrderAlert()));
    }

    //WDEV-22426 
    else if (column == COL_BED_AVAILABILITY)
    {
        records.sort(new BedAvailabilityStatusComparator(form.getLocalContext().getSortOrderBedAvailability()));
    }

    // Get selection
    PendingEmergencyAdmissionLiteVo selectedValue = form.grdAdmissions().getValue();
    // Re-populate grid
    populateGrid(records);
    // Update selection
    form.grdAdmissions().setValue(selectedValue);
    // Call code for new selection
    updateGlobalContextOnSelection(form.grdAdmissions().getValue());
}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException
{
    PendingEmergencyAdmissionLiteVo voEmergencyAdmission = populateDataFormScreen();

    ArrayList<String> screenErrors = new ArrayList<String>();

    if (form.cmbWard().getValue() == null)
        screenErrors.add("Ward is a mandatory item.");
    if (form.cmbSpecialty().getValue() == null)
        screenErrors.add("Specialty is a mandatory item.");

    String[] arrErrors = voEmergencyAdmission.validate();

    String[] arrScreenAndVoErrors = addScreenErrorsToVOErrors(screenErrors, arrErrors);
    if (arrScreenAndVoErrors.length != 0)
    {
        engine.showErrors(arrScreenAndVoErrors);
        return;
    }

    Boolean hasWardChanged = form.getLocalContext().getSelectedWard() == null;
    if(form.getLocalContext().getSelectedWardIsNotNull() && form.getGlobalContext().Core.getADTPendingEmergencyAdmissionIsNotNull() && form.getGlobalContext().Core.getADTPendingEmergencyAdmission().getAllocatedWardIsNotNull())
        hasWardChanged = !form.getLocalContext().getSelectedWard().equals(form.getGlobalContext().Core.getADTPendingEmergencyAdmission().getAllocatedWard());

    //wdev-16866
    TrackingForADTWardAndSpecialtyDialogVo trackVo = null;
    if( voEmergencyAdmission != null && voEmergencyAdmission.getID_PendingEmergencyAdmissionIsNotNull())
    {
        trackVo = domain.getTracking(voEmergencyAdmission);
        if( trackVo != null)
        {
            if( trackVo.getBedAvailabilityIsNotNull() )
            {
                trackVo.getBedAvailability().setWard(voEmergencyAdmission.getAllocatedWard());
                trackVo.getBedAvailability().setAvailableDateTime(new DateTime());
            }
        }

    }
    //------------

    try
    {
        domain.savePendingEmergency(voEmergencyAdmission, hasWardChanged,trackVo);      //wdev-16866
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        open();
    }

    engine.close(DialogResult.OK);
}
项目:openmaxims-linux    文件:Logic.java   
@Override
protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException
{
    PendingEmergencyAdmissionLiteVo voEmergencyAdmission = populateDataFormScreen();

    ArrayList<String> screenErrors = new ArrayList<String>();

    if (form.cmbWard().getValue() == null)
        screenErrors.add("Ward is a mandatory item.");
    if (form.cmbSpecialty().getValue() == null)
        screenErrors.add("Specialty is a mandatory item.");

    String[] arrErrors = voEmergencyAdmission.validate();

    String[] arrScreenAndVoErrors = addScreenErrorsToVOErrors(screenErrors, arrErrors);
    if (arrScreenAndVoErrors.length != 0)
    {
        engine.showErrors(arrScreenAndVoErrors);
        return;
    }

    Boolean hasWardChanged = form.getLocalContext().getSelectedWard() == null;
    if(form.getLocalContext().getSelectedWardIsNotNull() && form.getGlobalContext().Core.getADTPendingEmergencyAdmissionIsNotNull() && form.getGlobalContext().Core.getADTPendingEmergencyAdmission().getAllocatedWardIsNotNull())
        hasWardChanged = !form.getLocalContext().getSelectedWard().equals(form.getGlobalContext().Core.getADTPendingEmergencyAdmission().getAllocatedWard());

    //wdev-16866
    TrackingForADTWardAndSpecialtyDialogVo trackVo = null;
    if( voEmergencyAdmission != null && voEmergencyAdmission.getID_PendingEmergencyAdmissionIsNotNull())
    {
        trackVo = domain.getTracking(voEmergencyAdmission);
        if( trackVo != null)
        {
            if( trackVo.getBedAvailabilityIsNotNull() )
            {
                trackVo.getBedAvailability().setWard(voEmergencyAdmission.getAllocatedWard());
                trackVo.getBedAvailability().setAvailableDateTime(new DateTime());
            }
        }

    }
    //------------

    try
    {
        domain.savePendingEmergency(voEmergencyAdmission, hasWardChanged,trackVo);      //wdev-16866
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        open();
    }

    engine.close(DialogResult.OK);
}