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

项目:AvoinApotti    文件:Logic.java   
private ElectiveListStatusVo getLastElectiveListFromHistory( ElectiveListStatusVoCollection coll )
{
    if( coll == null || coll.size() == 0 )
        return null;

    ElectiveListStatusVo last = coll.get(0);
    if( coll.size() > 1)
    {
        for(int i = 1; i < coll.size();i++)
        {
            if( last.getStatusDateTimeIsNotNull() && coll.get(i).getStatusDateTimeIsNotNull() && last.getStatusDateTime().isLessThan(coll.get(i).getStatusDateTime()) && coll.get(i).getElectiveListStatusIsNotNull() && !coll.get(i).getElectiveListStatus().equals(WaitingListStatus.SUSPENDED))
            {
                last = coll.get(i);
            }
        }
    }
    return last;

}
项目:openMAXIMS    文件:WardViewPatientSummaryComponentImpl.java   
public Integer countPatientsForTCIAdmissions(ims.core.resource.place.vo.LocationRefVo ward, ims.core.resource.place.vo.LocationRefVo bay)
{
    if (ward == null || ward.getID_Location() == null)
        return 0;

    StringBuilder query = new StringBuilder("SELECT COUNT (pel.id) FROM PatientElectiveList AS pel ");
    query.append("LEFT JOIN pel.electiveListStatus AS els LEFT JOIN els.electiveListStatus AS elStatus ");
    query.append("LEFT JOIN pel.tCIDetails AS tci LEFT JOIN tci.tCIWard AS ward ");
    query.append("LEFT JOIN pel.patient AS patient ");

    query.append("WHERE ward.id = :WARD_ID AND elStatus.id = :TCI_GIVEN AND tci.isActive = 1 AND tci.currentOutcome is null ");
    query.append( " AND tci.tCIDate = :TODAY");

    String[] paramNames = new String[] {"WARD_ID", "TCI_GIVEN", "TODAY"};
    Object[] paramValues = new Object[] {ward.getID_Location(), WaitingListStatus.TCI_GIVEN.getID(), new ims.framework.utils.Date().getDate()};

    return (int) getDomainFactory().countWithHQL(query.toString(), paramNames, paramValues);
}
项目:openMAXIMS    文件:BookTheatreSlotDetailDialogImpl.java   
public void triggerElectiveListEvent(PatientElectiveList domPatElectiveList) throws StaleObjectException
{
    if (domPatElectiveList != null
    // WDEV-20746 Tighten up checks
    && domPatElectiveList.getTCIDetails() != null && domPatElectiveList.getTCIDetails().getTCIDate() != null && domPatElectiveList.getElectiveListStatus() != null && domPatElectiveList.getElectiveListStatus().getElectiveListStatus() != null && WaitingListStatus.TCI_GIVEN.getID() == (domPatElectiveList.getElectiveListStatus().getElectiveListStatus().getId())) // WDEV-20746
    {
        DomainFactory factory = getDomainFactory();
        String hqlString = "select ot.providerSystem from OutboundTriggers as ot left join ot.queueType as qt left join qt.instance as i" + " where(i.id = " + QueueType.ELECTIVELIST.getId() + ")";

        java.util.List<ProviderSystem> list = factory.find(hqlString);
        for (ProviderSystem providerSystem : list)
        {
            ElectiveListMessageQueue messageQueue = new ElectiveListMessageQueue();
            messageQueue.setPatientElectiveList(domPatElectiveList);
            messageQueue.setProviderSystem(providerSystem);
            messageQueue.setWasProcessed(Boolean.FALSE);
            messageQueue.setMessageStatus(getDomLookup(OrderMessageStatus.CREATED));
            messageQueue.setMsgType(getDomLookup(MsgEventType.A05));
            messageQueue.setQueueType(getDomLookup(QueueType.ELECTIVELIST));

            factory.save(messageQueue);
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private ElectiveListStatusVo getLastElectiveListFromHistory( ElectiveListStatusVoCollection coll )
{
    if( coll == null || coll.size() == 0 )
        return null;

    ElectiveListStatusVo last = coll.get(0);
    if( coll.size() > 1)
    {
        for(int i = 1; i < coll.size();i++)
        {
            if( last.getStatusDateTimeIsNotNull() && coll.get(i).getStatusDateTimeIsNotNull() && last.getStatusDateTime().isLessThan(coll.get(i).getStatusDateTime()) && coll.get(i).getElectiveListStatusIsNotNull() && !coll.get(i).getElectiveListStatus().equals(WaitingListStatus.SUSPENDED))
            {
                last = coll.get(i);
            }
        }
    }
    return last;

}
项目:AvoinApotti    文件:BedInfoDialogImpl.java   
public Boolean hasElectiveListsToRemove(PatientRefVo patientRef, PatientElectiveListRefVo electiveListRef, Specialty specialty)
{
    if (patientRef == null || patientRef.getID_Patient() == null)
        return Boolean.FALSE;

    if (specialty == null)
        return Boolean.FALSE;

    StringBuilder query = new StringBuilder("SELECT COUNT(pel.id) FROM PatientElectiveList AS pel LEFT JOIN pel.electiveList AS el LEFT JOIN el.service AS service LEFT JOIN service.specialty AS specialty LEFT JOIN pel.patient AS patient LEFT JOIN pel.electiveListStatus AS elStatus LEFT JOIN elStatus.electiveListStatus as eleListStatus");
    query.append(" WHERE patient.id = :PAT_ID AND specialty.id = :SPECIALTY_ID AND eleListStatus.id <> :STATUS_ID ");

    if (electiveListRef != null)
        query.append(" AND pel.id <> :PEL_ID ");

    ArrayList<String> paramNames = new ArrayList<String>(); 
    ArrayList<Object> paramValues = new ArrayList<Object>();

    paramNames.add("PAT_ID");   
    paramValues.add(patientRef.getID_Patient());
    paramNames.add("SPECIALTY_ID");     
    paramValues.add(specialty.getID());
    paramNames.add("STATUS_ID");        
    paramValues.add(WaitingListStatus.REMOVED.getID());

    if (electiveListRef != null)
    {
        paramNames.add("PEL_ID");
        paramValues.add(electiveListRef.getID_PatientElectiveList());
    }
    long count = getDomainFactory().countWithHQL(query.toString(), paramNames.toArray(new String[paramNames.size()]), paramValues.toArray(new Object[paramValues.size()]));

    if (count > 0)
        return Boolean.TRUE;

    return Boolean.FALSE;
}
项目:AvoinApotti    文件:BedInfoDialogImpl.java   
public PatientElectiveListBedAdmissionVoCollection getElectiveListsToRemove(PatientRefVo patientRef, PatientElectiveListRefVo electiveListRef, Specialty specialty)
{
    if (patientRef == null || patientRef.getID_Patient() == null)
        return null;

    if (specialty == null)
        return null;

    DomainFactory factory = getDomainFactory();

    StringBuilder query = new StringBuilder("SELECT pel FROM PatientElectiveList AS pel LEFT JOIN pel.electiveList AS el LEFT JOIN el.service AS service LEFT JOIN service.specialty AS specialty LEFT JOIN pel.patient AS patient LEFT JOIN pel.electiveListStatus AS elStatus LEFT JOIN elStatus.electiveListStatus as eleListStatus");
    query.append(" WHERE patient.id = :PAT_ID AND specialty.id = :SPECIALTY_ID AND eleListStatus.id <> :STATUS_ID ");

    if (electiveListRef != null)
        query.append(" AND pel.id <> :PEL_ID ");

    ArrayList<String> paramNames = new ArrayList<String>(); 
    ArrayList<Object> paramValues = new ArrayList<Object>();

    paramNames.add("PAT_ID");   
    paramValues.add(patientRef.getID_Patient());
    paramNames.add("SPECIALTY_ID");     
    paramValues.add(specialty.getID());
    paramNames.add("STATUS_ID");        
    paramValues.add(WaitingListStatus.REMOVED.getID());

    if (electiveListRef != null)
    {
        paramNames.add("PEL_ID");
        paramValues.add(electiveListRef.getID_PatientElectiveList());
    }

    return PatientElectiveListBedAdmissionVoAssembler.createPatientElectiveListBedAdmissionVoCollectionFromPatientElectiveList(factory.find(query.toString(), paramNames, paramValues));
}
项目:AvoinApotti    文件:BedAdmissionComponentImpl.java   
public PatientElectiveListBedInfoVoCollection listPatientElective(LocationRefVo ward, Date fromDate, Date toDate)
{
    StringBuilder query = new StringBuilder();
    ArrayList<String> paramNames = new ArrayList<String>();
    ArrayList<Object> paramValues = new ArrayList<Object>();

    query.append("SELECT pel FROM PatientElectiveList AS pel ");
    query.append("LEFT JOIN pel.electiveListStatus AS els LEFT JOIN els.electiveListStatus AS elStatus ");
    query.append("LEFT JOIN pel.tCIDetails AS tci LEFT JOIN tci.tCIWard AS ward ");
    query.append("LEFT JOIN pel.patient AS patient ");

    query.append("WHERE ward.id = :WARD AND elStatus.id = :TCI_GIVEN AND tci.isActive = 1 AND tci.currentOutcome is null ");
    paramNames.add("WARD");
    paramValues.add(ward.getID_Location());
    paramNames.add("TCI_GIVEN");
    paramValues.add(WaitingListStatus.TCI_GIVEN.getId());

    if (fromDate != null)
    {
        query.append(" AND tci.tCIDate >= :FROM_DATE");
        paramNames.add("FROM_DATE");
        paramValues.add(fromDate.getDate());
    }

    if (toDate != null)
    {
        query.append(" AND tci.tCIDate <= :TO_DATE");
        paramNames.add("TO_DATE");
        paramValues.add(toDate.getDate());
    }

    query.append(" ORDER BY patient.name.surname, patient.name.forename");

    return PatientElectiveListBedInfoVoAssembler.createPatientElectiveListBedInfoVoCollectionFromPatientElectiveList(getDomainFactory().find(query.toString(), paramNames, paramValues));
}
项目:AvoinApotti    文件:WardViewImpl.java   
public PatientElectiveListForWardViewVoCollection listPatientElectiveListForWardViewVo(LocationRefVo ward, Date tcidate)
{
    StringBuilder query = new StringBuilder();
    ArrayList<String> paramNames = new ArrayList<String>();
    ArrayList<Object> paramValues = new ArrayList<Object>();

    query.append("SELECT pel FROM PatientElectiveList AS pel ");
    query.append("LEFT JOIN pel.electiveListStatus AS els LEFT JOIN els.electiveListStatus AS elStatus ");
    query.append("LEFT JOIN pel.tCIDetails AS tci LEFT JOIN tci.tCIWard AS ward ");
    query.append("LEFT JOIN pel.patient AS patient ");

    query.append("WHERE ward.id = :WARD AND elStatus.id = :TCI_GIVEN AND tci.isActive = 1 AND tci.currentOutcome is null ");
    paramNames.add("WARD");
    paramValues.add(ward.getID_Location());
    paramNames.add("TCI_GIVEN");
    paramValues.add(WaitingListStatus.TCI_GIVEN.getId());
    if( tcidate != null)    //wdev-19115
    {
        query.append(" AND tci.tCIDate = :CURRENT_DATE");
        paramNames.add("CURRENT_DATE");
        paramValues.add(tcidate.getDate());
    }


    query.append(" ORDER BY patient.name.surname, patient.name.forename");

    return PatientElectiveListForWardViewVoAssembler.createPatientElectiveListForWardViewVoCollectionFromPatientElectiveList(getDomainFactory().find(query.toString(), paramNames, paramValues));

}
项目:AvoinApotti    文件:AppointmentOutcomeDialogImpl.java   
public Boolean thereAreActivePatientElectiveListsForCurrentCatsReferral(CatsReferralRefVo catsRef)
{
    if (catsRef == null || catsRef.getID_CatsReferral() == null)
        throw new CodingRuntimeException("catsRef is null");

    StringBuilder hqlBuilder = new StringBuilder("select pel from PatientElectiveList as pel left join pel.referral as cats left join pel.electiveListStatus as els left join els.electiveListStatus as status where cats.id=:CATS_ID and (status is null or status.id <> :STATUS)");
    List <?> list = getDomainFactory().find(hqlBuilder.toString(),new String[]{"CATS_ID","STATUS"},new Object[]{catsRef.getID_CatsReferral(),WaitingListStatus.REMOVED.getID()} );

    if (list == null || list.size() == 0)
        return false;

    return true;
}
项目:AvoinApotti    文件:AppointmentOutcomeDialogImpl.java   
public Boolean hasReferralActivePatientElectiveList(Booking_AppointmentRefVo bookApptRef)
{
    if(bookApptRef == null || bookApptRef.getID_Booking_Appointment() == null)
        return null;

    DomainFactory factory = getDomainFactory();
    String query = "select count(pEl) from PatientElectiveList as pEl left join pEl.electiveListStatus as es left join es.electiveListStatus as s left join pEl.referral as c left join c.appointments as a where a.id = :BookAppointmentId and s.id not in (:RemovedStatus)";

    Object[] count = factory.find(query, new String[] {"BookAppointmentId", "RemovedStatus"}, new Object[] {bookApptRef.getID_Booking_Appointment(), WaitingListStatus.REMOVED.getID()}).toArray();

    if(count != null && count.length > 0 && ((Long) count[0]).intValue() > 0)
        return true;

    return false;   
}
项目:AvoinApotti    文件:Logic.java   
private ElectiveListStatusVo getPreviousStatusFromHistory(ElectiveListStatusVoCollection electiveListStatusHistory)
{
    if (electiveListStatusHistory==null || electiveListStatusHistory.size()<1)
        return null;

    for (int i=electiveListStatusHistory.size()-1;i>=0;i--)
    {
        if (!WaitingListStatus.SUSPENDED.equals(electiveListStatusHistory.get(i).getElectiveListStatus()))
        {
            return electiveListStatusHistory.get(i);
        }
    }

    return null;
}
项目:AvoinApotti    文件:Logic.java   
private ElectiveListStatusVo populateStatus(WaitingListStatus waitingListStatus)
{
    ElectiveListStatusVo status = new ElectiveListStatusVo();

    Object user = domain.getMosUser();
    if(user instanceof MemberOfStaffLiteVo)
    {
        status.setAuthoringUser((MemberOfStaffLiteVo) user);
    }

    status.setStatusDateTime(new DateTime());
    status.setElectiveListStatus(waitingListStatus);
    return status;
}
项目:AvoinApotti    文件:Logic.java   
private PatientElectiveListForTCIDetailsDialogVo setRemovedStatus(PatientElectiveListForTCIDetailsDialogVo record )
{
    if( record == null )
        return null;

    // create a new electiveliststatus
    ElectiveListStatusVo electivStatus = new ElectiveListStatusVo();
    //set the values for the new created electiveliststatus 
    electivStatus.setElectiveListStatus(WaitingListStatus.REMOVED);
    electivStatus.setStatusDateTime(form.dtimRemovalDateTime().getValue());

    electivStatus.setAuthoringUser((MemberOfStaffLiteVo) form.ccRemovedBy().getValue());
    electivStatus.setRemovalReason(form.cmbRemovalReason().getValue());
    electivStatus.setRemovalOtherReason(form.cmbRemovalOtherReason().getValue());
    electivStatus.setStatusComment(form.txtRemovalComment().getValue());

    //get the history
    ElectiveListStatusVoCollection electListColl = record.getElectiveListStatusHistory();       
    if( electListColl == null )
        electListColl = new ElectiveListStatusVoCollection();

    electListColl.add(electivStatus);                           //add to history the old electiveliststatus
    record.setElectiveListStatusHistory(electListColl);
    record.setElectiveListStatus(electivStatus);                //set the new electiveliststatus
    return record;


}
项目:AvoinApotti    文件:Logic.java   
private ElectiveListStatusVo populateElectiveListStatus(WaitingListStatus requiresTci)
{
    ElectiveListStatusVo status = new ElectiveListStatusVo();
    status.setElectiveListStatus(requiresTci);
    status.setAuthoringUser((MemberOfStaffLiteVo) domain.getMosUser());
    status.setStatusDateTime(new DateTime());

    return status;
}
项目:AvoinApotti    文件:Logic.java   
protected void onRadioButtonGroupShowValueChanged() throws PresentationLogicException
{
    if( form.GroupShow().getValue().equals(GroupShowEnumeration.rdoShowSuspended) )
    {
        form.cmbStatus().setValue(WaitingListStatus.SUSPENDED);

    }
    else if( form.GroupShow().getValue().equals(GroupShowEnumeration.rdoShowAdmited) ||  form.GroupShow().getValue().equals(GroupShowEnumeration.rdo28Day)) //wdev-18596
    {
        form.cmbStatus().setValue(WaitingListStatus.REQUIRES_TCI);

    }

}
项目:AvoinApotti    文件:Logic.java   
private ElectiveListStatusVo populateElectiveListStatus(WaitingListStatus status)
{
    ElectiveListStatusVo electiveListStatus = new ElectiveListStatusVo();

    electiveListStatus.setElectiveListStatus(status); 
    electiveListStatus.setStatusDateTime(new DateTime());

    Object mos = domain.getMosUser();
    if (mos !=null && mos instanceof MemberOfStaffLiteVo)
    {
        electiveListStatus.setAuthoringUser((MemberOfStaffLiteVo) mos);
    }
    return electiveListStatus;
}
项目:AvoinApotti    文件:Logic.java   
private void populateWaitingListGrid()
{
    form.lyrSelect().tabWaitingList().grdWaitingList().getRows().clear();

    PatientElectiveListForReferralDetailsVoCollection waitingList = domain.getWaitingListForReferral(form.getGlobalContext().RefMan.getCatsReferral());

    if (waitingList == null)
    {
        updateControlState();
        return;
    }

    for (int i = 0; i < waitingList.size(); i++)
    {
        grdWaitingListRow newRow = form.lyrSelect().tabWaitingList().grdWaitingList().getRows().newRow();

        newRow.setColName(waitingList.get(i).getElectiveList() != null ? waitingList.get(i).getElectiveList().getWaitingListName() : "");
        newRow.setProcedure(waitingList.get(i) != null ? waitingList.get(i).getPrimaryProcedureIsNotNull()? waitingList.get(i).getPrimaryProcedure().getProcedureName() : "" : "");
        newRow.setColStatus(waitingList.get(i).getElectiveListStatus() != null && waitingList.get(i).getElectiveListStatus().getElectiveListStatus() != null ? waitingList.get(i).getElectiveListStatus().getElectiveListStatus().getText() : "");
        newRow.setTooltipForColStatus(waitingList.get(i).getElectiveListStatus() != null && waitingList.get(i).getElectiveListStatus().getElectiveListStatus() != null && WaitingListStatus.REMOVED.equals(waitingList.get(i).getElectiveListStatus().getElectiveListStatus())? "Status: " +waitingList.get(i).getElectiveListStatus().getElectiveListStatus().getText()+ "<br> Removal Reason: " +(waitingList.get(i).getElectiveListStatus().getRemovalReasonIsNotNull() ? waitingList.get(i).getElectiveListStatus().getRemovalReason(): "")  : ""); //WDEV-18564

        newRow.setColDateOnList(waitingList.get(i).getDateOnList() != null ? waitingList.get(i).getDateOnList().toString() : "");

        if (waitingList.get(i).getTCIDetails() != null)
        {
            newRow.setColTciDate(waitingList.get(i).getTCIDetails() != null && waitingList.get(i).getTCIDetails().getTCIDateIsNotNull() ? waitingList.get(i).getTCIDetails().getTCIDate().toString() : "");
            newRow.setColTciTime(waitingList.get(i).getTCIDetails() != null && waitingList.get(i).getTCIDetails().getTCITimeIsNotNull() ? waitingList.get(i).getTCIDetails().getTCITime().toString() : "");             
        }

        newRow.setValue(waitingList.get(i));
    }

    updateControlState();
}
项目:openMAXIMS    文件:InpatientEpisodeMaintenanceImpl.java   
private ElectiveListStatus getStatusPriorToAdmission(List<ElectiveListStatus> history)
{
    Collections.sort(history, new dateComparator());
    for (ElectiveListStatus electiveListStatus : history) {
        if(WaitingListStatus.ADMITTED.getID() != electiveListStatus.getElectiveListStatus().getId())
            return electiveListStatus;
    }
    return null;
}
项目:openMAXIMS    文件:InpatientEpisodeMaintenanceImpl.java   
private ElectiveListStatus getStatusPriorToDischargeWithTreatmentDeferred(List<ElectiveListStatus> history)
{
    Collections.sort(history, new dateComparator());
    for (ElectiveListStatus electiveListStatus : history) {
        if(WaitingListStatus.REQUIRES_TCI.getID() != electiveListStatus.getElectiveListStatus().getId())
            return electiveListStatus;
    }
    return null;
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
public Boolean hasElectiveListsToRemove(PatientRefVo patientRef, PatientElectiveListRefVo electiveListRef, Specialty specialty)
{
    if (patientRef == null || patientRef.getID_Patient() == null)
        return Boolean.FALSE;

    if (specialty == null)
        return Boolean.FALSE;

    StringBuilder query = new StringBuilder("SELECT COUNT(pel.id) FROM PatientElectiveList AS pel LEFT JOIN pel.electiveList AS el LEFT JOIN el.service AS service LEFT JOIN service.specialty AS specialty LEFT JOIN pel.patient AS patient LEFT JOIN pel.electiveListStatus AS elStatus LEFT JOIN elStatus.electiveListStatus as eleListStatus");
    query.append(" WHERE patient.id = :PAT_ID AND specialty.id = :SPECIALTY_ID AND eleListStatus.id <> :STATUS_ID ");

    if (electiveListRef != null)
        query.append(" AND pel.id <> :PEL_ID ");

    ArrayList<String> paramNames = new ArrayList<String>(); 
    ArrayList<Object> paramValues = new ArrayList<Object>();

    paramNames.add("PAT_ID");   
    paramValues.add(patientRef.getID_Patient());
    paramNames.add("SPECIALTY_ID");     
    paramValues.add(specialty.getID());
    paramNames.add("STATUS_ID");        
    paramValues.add(WaitingListStatus.REMOVED.getID());

    if (electiveListRef != null)
    {
        paramNames.add("PEL_ID");
        paramValues.add(electiveListRef.getID_PatientElectiveList());
    }
    long count = getDomainFactory().countWithHQL(query.toString(), paramNames.toArray(new String[paramNames.size()]), paramValues.toArray(new Object[paramValues.size()]));

    if (count > 0)
        return Boolean.TRUE;

    return Boolean.FALSE;
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
public PatientElectiveListBedAdmissionVoCollection getElectiveListsToRemove(PatientRefVo patientRef, PatientElectiveListRefVo electiveListRef, Specialty specialty)
{
    if (patientRef == null || patientRef.getID_Patient() == null)
        return null;

    if (specialty == null)
        return null;

    DomainFactory factory = getDomainFactory();

    StringBuilder query = new StringBuilder("SELECT pel FROM PatientElectiveList AS pel LEFT JOIN pel.electiveList AS el LEFT JOIN el.service AS service LEFT JOIN service.specialty AS specialty LEFT JOIN pel.patient AS patient LEFT JOIN pel.electiveListStatus AS elStatus LEFT JOIN elStatus.electiveListStatus as eleListStatus");
    query.append(" WHERE patient.id = :PAT_ID AND specialty.id = :SPECIALTY_ID AND eleListStatus.id <> :STATUS_ID ");

    if (electiveListRef != null)
        query.append(" AND pel.id <> :PEL_ID ");

    ArrayList<String> paramNames = new ArrayList<String>(); 
    ArrayList<Object> paramValues = new ArrayList<Object>();

    paramNames.add("PAT_ID");   
    paramValues.add(patientRef.getID_Patient());
    paramNames.add("SPECIALTY_ID");     
    paramValues.add(specialty.getID());
    paramNames.add("STATUS_ID");        
    paramValues.add(WaitingListStatus.REMOVED.getID());

    if (electiveListRef != null)
    {
        paramNames.add("PEL_ID");
        paramValues.add(electiveListRef.getID_PatientElectiveList());
    }

    return PatientElectiveListBedAdmissionVoAssembler.createPatientElectiveListBedAdmissionVoCollectionFromPatientElectiveList(factory.find(query.toString(), paramNames, paramValues));
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public Boolean hasPatientTCIForSameService(PatientRefVo patientRef, ServiceRefVo serviceRef)
{

    if (patientRef == null || patientRef.getID_Patient() == null)
        return Boolean.FALSE;

    if (serviceRef == null || serviceRef.getID_Service() == null)
        return Boolean.FALSE;

    StringBuilder query = new StringBuilder("SELECT COUNT(pel.id) FROM PatientElectiveList AS pel LEFT JOIN pel.electiveList AS el LEFT JOIN el.service AS service  LEFT JOIN pel.patient AS patient LEFT JOIN pel.electiveListStatus AS elStatus LEFT JOIN elStatus.electiveListStatus as eleListStatus LEFT JOIN pel.tCIDetails AS tci ");
    query.append(" WHERE patient.id = :PAT_ID AND service.id = :SERVICE_ID AND eleListStatus.id <> :STATUS_ID AND tci.isActive = 1 ");

    ArrayList<String> paramNames = new ArrayList<String>(); 
    ArrayList<Object> paramValues = new ArrayList<Object>();

    paramNames.add("PAT_ID");   
    paramValues.add(patientRef.getID_Patient());
    paramNames.add("SERVICE_ID");       
    paramValues.add(serviceRef.getID_Service());
    paramNames.add("STATUS_ID");        
    paramValues.add(WaitingListStatus.REMOVED.getID());

    long count = getDomainFactory().countWithHQL(query.toString(), paramNames.toArray(new String[paramNames.size()]), paramValues.toArray(new Object[paramValues.size()]));

    if (count > 0)
        return Boolean.TRUE;

    return Boolean.FALSE;
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public Boolean hasPatientTCIWithinNextMonth(PatientRefVo patientRef)
{
    if (patientRef == null || patientRef.getID_Patient() == null)
        return Boolean.FALSE;

    StringBuilder query = new StringBuilder("SELECT COUNT(pel.id) FROM PatientElectiveList AS pel LEFT JOIN pel.electiveList AS el LEFT JOIN el.service AS service  LEFT JOIN pel.patient AS patient LEFT JOIN pel.electiveListStatus AS elStatus LEFT JOIN elStatus.electiveListStatus as eleListStatus LEFT JOIN pel.tCIDetails AS tci ");
    query.append(" WHERE patient.id = :PAT_ID AND eleListStatus.id <> :STATUS_ID AND tci.isActive = 1 AND  tci.tCIDate >= :tciDateFrom and tci.tCIDate <= :tciDateTo ");

    ArrayList<String> paramNames = new ArrayList<String>(); 
    ArrayList<Object> paramValues = new ArrayList<Object>();

    paramNames.add("PAT_ID");   
    paramValues.add(patientRef.getID_Patient());
    paramNames.add("STATUS_ID");        
    paramValues.add(WaitingListStatus.REMOVED.getID());

    paramNames.add("tciDateFrom");      
    paramValues.add(new Date().getDate());
    paramNames.add("tciDateTo");        
    paramValues.add(new Date().addMonth(1).getDate());

    long count = getDomainFactory().countWithHQL(query.toString(), paramNames.toArray(new String[paramNames.size()]), paramValues.toArray(new Object[paramValues.size()]));

    if (count > 0)
        return Boolean.TRUE;

    return Boolean.FALSE;
}
项目:openMAXIMS    文件:WardViewImpl.java   
public PatientElectiveListForWardViewVoCollection listPatientElectiveListForWardViewVo(LocationRefVo ward, Date tcidate)
{
    StringBuilder query = new StringBuilder();
    ArrayList<String> paramNames = new ArrayList<String>();
    ArrayList<Object> paramValues = new ArrayList<Object>();

    query.append("SELECT pel FROM PatientElectiveList AS pel ");
    query.append("LEFT JOIN pel.electiveListStatus AS els LEFT JOIN els.electiveListStatus AS elStatus ");
    query.append("LEFT JOIN pel.tCIDetails AS tci LEFT JOIN tci.tCIWard AS ward ");
    query.append("LEFT JOIN pel.patient AS patient ");

    query.append("WHERE ward.id = :WARD AND elStatus.id = :TCI_GIVEN AND tci.isActive = 1 AND tci.currentOutcome is null ");
    paramNames.add("WARD");
    paramValues.add(ward.getID_Location());
    paramNames.add("TCI_GIVEN");
    paramValues.add(WaitingListStatus.TCI_GIVEN.getId());
    if( tcidate != null)    //wdev-19115
    {
        query.append(" AND tci.tCIDate = :CURRENT_DATE");
        paramNames.add("CURRENT_DATE");
        paramValues.add(tcidate.getDate());
    }


    query.append(" ORDER BY patient.name.surname, patient.name.forename");

    return PatientElectiveListForWardViewVoAssembler.createPatientElectiveListForWardViewVoCollectionFromPatientElectiveList(getDomainFactory().find(query.toString(), paramNames, paramValues));

}
项目:openMAXIMS    文件:AppointmentOutcomeDialogImpl.java   
public Boolean thereAreActivePatientElectiveListsForCurrentCatsReferral(CatsReferralRefVo catsRef)
{
    if (catsRef == null || catsRef.getID_CatsReferral() == null)
        throw new CodingRuntimeException("catsRef is null");

    StringBuilder hqlBuilder = new StringBuilder("select pel from PatientElectiveList as pel left join pel.referral as cats left join pel.electiveListStatus as els left join els.electiveListStatus as status where cats.id=:CATS_ID and (status is null or status.id <> :STATUS)");
    List <?> list = getDomainFactory().find(hqlBuilder.toString(),new String[]{"CATS_ID","STATUS"},new Object[]{catsRef.getID_CatsReferral(),WaitingListStatus.REMOVED.getID()} );

    if (list == null || list.size() == 0)
        return false;

    return true;
}
项目:openMAXIMS    文件:AppointmentOutcomeDialogImpl.java   
public Boolean hasReferralActivePatientElectiveList(Booking_AppointmentRefVo bookApptRef)
{
    if(bookApptRef == null || bookApptRef.getID_Booking_Appointment() == null)
        return null;

    DomainFactory factory = getDomainFactory();
    String query = "select count(pEl) from PatientElectiveList as pEl left join pEl.electiveListStatus as es left join es.electiveListStatus as s left join pEl.referral as c left join c.appointments as a where a.id = :BookAppointmentId and s.id not in (:RemovedStatus)";

    Object[] count = factory.find(query, new String[] {"BookAppointmentId", "RemovedStatus"}, new Object[] {bookApptRef.getID_Booking_Appointment(), WaitingListStatus.REMOVED.getID()}).toArray();

    if(count != null && count.length > 0 && ((Long) count[0]).intValue() > 0)
        return true;

    return false;   
}
项目:openMAXIMS    文件:TheatreSessionManagementImpl.java   
private boolean isSuspensionRecordRelevant(PatientElectiveList patientElectiveListDO)
{
    if (patientElectiveListDO == null || patientElectiveListDO.getId() == null || patientElectiveListDO.getElectiveListStatus() == null || !getDomLookup(WaitingListStatus.SUSPENDED).equals(patientElectiveListDO.getElectiveListStatus().getElectiveListStatus()))
        return false;
    if (patientElectiveListDO.getCurrentSuspensionEndDate() == null || patientElectiveListDO.getCurrentSuspensionEndDate().after(new Date()))
        return true;

    return false;
}
项目:openMAXIMS    文件:Logic.java   
private void populateScreenFromData(PatientElectiveListDetailsVo patientElectiveList)
{
    clearScreen();

    if(patientElectiveList == null)
        return;

    form.ctnDetails().lblCurrentStatus().setValue(patientElectiveList.getElectiveListStatus() != null ? patientElectiveList.getElectiveListStatus().getElectiveListStatus().getText() : "");
    form.ctnDetails().cmbPatientCategory().setValue(patientElectiveList.getPatientCategory());

    if(patientElectiveList.getElectiveListStatus() != null && patientElectiveList.getElectiveListStatus().getElectiveListStatus() != null && patientElectiveList.getElectiveListStatus().getElectiveListStatus().equals(WaitingListStatus.REMOVED ))
    {
        String strStatus = "Current Status: <b>" +  patientElectiveList.getElectiveListStatus().getElectiveListStatus().getText() + "</b><br>";
        strStatus += "Removal Reason: " + (patientElectiveList.getElectiveListStatus().getRemovalReason() != null ? "<b>" + patientElectiveList.getElectiveListStatus().getRemovalReason().getText() + "</b>":"");

        form.ctnDetails().lblCurrentStatus().setTooltip(strStatus);
    }
    else if( patientElectiveList.getElectiveListStatus() != null && patientElectiveList.getElectiveListStatus().getElectiveListStatus() != null )
    {
        form.ctnDetails().lblCurrentStatus().setTooltip("Current Status: <b>" +  patientElectiveList.getElectiveListStatus().getElectiveListStatus().getText() + "</b>");
    }

    form.ctnDetails().lblDateOnList().setValue(patientElectiveList.getDateOnList() != null ? patientElectiveList.getDateOnList().toString() : "");
    form.ctnDetails().lblReferralService().setValue((patientElectiveList.getReferral() != null && patientElectiveList.getReferral().getReferralDetails() != null && patientElectiveList.getReferral().getReferralDetails().getService() != null) ? patientElectiveList.getReferral().getReferralDetails().getService().getServiceName() : "");
    form.ctnDetails().lblBreachDate().setValue((patientElectiveList.getReferral() != null && patientElectiveList.getReferral().getReferralDetails() != null && patientElectiveList.getReferral().getReferralDetails().getEnd18WW() != null) ? patientElectiveList.getReferral().getReferralDetails().getEnd18WW().toString() : "");

    populateRequestSectionFromData(patientElectiveList);
    populateTCIFromData(patientElectiveList.getTCIDetails());
    populateERODFromData(patientElectiveList.getEROD());

    populateNotesFromData(patientElectiveList.getNotes());
    populateTCIHistory(patientElectiveList.getTCIHistory());
    populateERODHistory(patientElectiveList.getERODHistory());
}
项目:openMAXIMS    文件:Logic.java   
private void updateERODDetails()
{
    boolean viewModeOnly = Boolean.TRUE.equals(form.getLocalContext().getViewModeOnly());
    boolean editModeERODDetails = FormMode.EDIT.equals(form.getLocalContext().getERODFormMode());
    boolean viewModeERODDetails = FormMode.VIEW.equals(form.getLocalContext().getERODFormMode());

    boolean editModeTCIDetails = FormMode.EDIT.equals(form.getLocalContext().getTCIFormMode());
    boolean editModeRequestDetails = FormMode.EDIT.equals(form.getLocalContext().getRequestFormMode());

    form.ctnDetails().dteEarliestDateOffered().setEnabled(editModeERODDetails);
    form.ctnDetails().chkEXTDelay().setEnabled(editModeERODDetails);
    form.ctnDetails().dteSecondDateOffered().setEnabled(editModeERODDetails);
    form.ctnDetails().txtSecondDateOffered().setEnabled(editModeERODDetails && !form.ctnDetails().chkEXTDelay().getValue());
    form.ctnDetails().dtePatientAvailableFromDate().setEnabled(editModeERODDetails);
    form.ctnDetails().cmbERODReason().setEnabled(editModeERODDetails);
    form.ctnDetails().txtERODComment().setEnabled(editModeERODDetails);
    form.ctnDetails().dteERODDateOfOffer().setEnabled(editModeERODDetails);

    boolean sourceOfReferralNationalScreening = form.getLocalContext().getPatientElectiveList() != null && form.getLocalContext().getPatientElectiveList().getReferral() != null && form.getLocalContext().getPatientElectiveList().getReferral().getReferralDetails() != null &&  SourceOfReferral.NATIONAL_SCREENING.equals(form.getLocalContext().getPatientElectiveList().getReferral().getReferralDetails().getReferrerType());
    boolean referralUrgencyOrSourceOfReferral = form.getLocalContext().getPatientElectiveList() != null && form.getLocalContext().getPatientElectiveList().getReferral() != null && (ReferralUrgency.TWO_WEEK_WAIT.equals(form.getLocalContext().getPatientElectiveList().getReferral().getUrgency()) || ReferralUrgency.CONSULTANT_UPGRADE.equals(form.getLocalContext().getPatientElectiveList().getReferral().getUrgency()) || sourceOfReferralNationalScreening );
    boolean preAssessmentCompletionExemptService = form.getLocalContext().getPatientElectiveList() != null && form.getLocalContext().getPatientElectiveList().getReferral() != null && form.getLocalContext().getPatientElectiveList().getReferral().getReferralDetails() != null && form.getLocalContext().getPatientElectiveList().getReferral().getReferralDetails().getService() != null && Boolean.TRUE.equals(form.getLocalContext().getPatientElectiveList().getReferral().getReferralDetails().getService().getIsPreAssessmentCompletionExempt());

    form.ctnDetails().btnAddEROD().setVisible(!viewModeOnly && form.getLocalContext().getPatientElectiveList() != null && (form.getLocalContext().getPatientElectiveList().getEROD() == null || (form.getLocalContext().getPatientElectiveList().getEROD() != null && Boolean.FALSE.equals(form.getLocalContext().getPatientElectiveList().getEROD().getIsActive()))) && (WaitingListStatus.REQUIRES_TCI.equals(form.getLocalContext().getPatientElectiveList().getElectiveListStatus().getElectiveListStatus()) || WaitingListStatus.TCI_GIVEN.equals(form.getLocalContext().getPatientElectiveList().getElectiveListStatus().getElectiveListStatus()) || (Boolean.TRUE.equals(form.getLocalContext().getPatientElectiveList().getPreAssessmentRequired()) && preAssessmentCompletionExemptService && referralUrgencyOrSourceOfReferral)) && viewModeERODDetails && !editModeRequestDetails && !editModeTCIDetails);
    form.ctnDetails().btnEditEROD().setVisible(!viewModeOnly && viewModeERODDetails && form.getLocalContext().getPatientElectiveList().getEROD() != null && !editModeRequestDetails && !editModeTCIDetails);
    form.ctnDetails().btnRecordERODInError().setVisible(!viewModeOnly && viewModeERODDetails && form.getLocalContext().getPatientElectiveList().getEROD() != null && !editModeRequestDetails && !editModeTCIDetails);

    form.ctnDetails().btnSaveEROD().setVisible(editModeERODDetails);
    form.ctnDetails().btnCancelEROD().setVisible(editModeERODDetails);
}
项目:openMAXIMS    文件:Logic.java   
private ElectiveListStatusVo populateElectiveListStatus(WaitingListStatus status)
{
    ElectiveListStatusVo electiveListStatus = new ElectiveListStatusVo();

    electiveListStatus.setElectiveListStatus(status); 
    electiveListStatus.setStatusDateTime(new DateTime());

    Object mos = domain.getMosUser();
    if (mos !=null && mos instanceof MemberOfStaffLiteVo)
    {
        electiveListStatus.setAuthoringUser((MemberOfStaffLiteVo) mos);
    }
    return electiveListStatus;
}
项目:openMAXIMS    文件:Logic.java   
private ElectiveListStatusVo getPreviousStatusFromHistory(ElectiveListStatusVoCollection electiveListStatusHistory)
{
    if (electiveListStatusHistory==null || electiveListStatusHistory.size()<1)
        return null;

    for (int i=electiveListStatusHistory.size()-1;i>=0;i--)
    {
        if (!WaitingListStatus.SUSPENDED.equals(electiveListStatusHistory.get(i).getElectiveListStatus()))
        {
            return electiveListStatusHistory.get(i);
        }
    }

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private ElectiveListStatusVo populateStatus(WaitingListStatus waitingListStatus)
{
    ElectiveListStatusVo status = new ElectiveListStatusVo();

    Object user = domain.getMosUser();
    if(user instanceof MemberOfStaffLiteVo)
    {
        status.setAuthoringUser((MemberOfStaffLiteVo) user);
    }

    status.setStatusDateTime(new DateTime());
    status.setElectiveListStatus(waitingListStatus);
    return status;
}
项目:openMAXIMS    文件:Logic.java   
private PatientElectiveListForTCIDetailsDialogVo setRemovedStatus(PatientElectiveListForTCIDetailsDialogVo record )
{
    if( record == null )
        return null;

    // create a new electiveliststatus
    ElectiveListStatusVo electivStatus = new ElectiveListStatusVo();
    //set the values for the new created electiveliststatus 
    electivStatus.setElectiveListStatus(WaitingListStatus.REMOVED);
    electivStatus.setStatusDateTime(form.dtimRemovalDateTime().getValue());

    electivStatus.setAuthoringUser((MemberOfStaffLiteVo) form.ccRemovedBy().getValue());
    electivStatus.setRemovalReason(form.cmbRemovalReason().getValue());
    electivStatus.setRemovalOtherReason(form.cmbRemovalOtherReason().getValue());
    electivStatus.setStatusComment(form.txtRemovalComment().getValue());

    //get the history
    ElectiveListStatusVoCollection electListColl = record.getElectiveListStatusHistory();       
    if( electListColl == null )
        electListColl = new ElectiveListStatusVoCollection();

    electListColl.add(electivStatus);                           //add to history the old electiveliststatus
    record.setElectiveListStatusHistory(electListColl);
    record.setElectiveListStatus(electivStatus);                //set the new electiveliststatus
    return record;


}
项目:openMAXIMS    文件:Logic.java   
private boolean isSuspensionRecordRelevant(PatientElectiveListDetailsToSaveVo patientElectiveList)
{
    if (patientElectiveList == null || patientElectiveList.getID_PatientElectiveList() == null || patientElectiveList.getElectiveListStatus() == null || !WaitingListStatus.SUSPENDED.equals(patientElectiveList.getElectiveListStatus().getElectiveListStatus()))
        return false;
    if (patientElectiveList.getCurrentSuspensionEndDate() == null || patientElectiveList.getCurrentSuspensionEndDate().isGreaterThan(new DateTime()))
        return true;

    return false;
}
项目:openMAXIMS    文件:Logic.java   
private ElectiveListStatusVo populateElectiveListStatus(WaitingListStatus requiresTci)
{
    ElectiveListStatusVo status = new ElectiveListStatusVo();
    status.setElectiveListStatus(requiresTci);
    status.setAuthoringUser((MemberOfStaffLiteVo) domain.getMosUser());
    status.setStatusDateTime(new DateTime());

    return status;
}
项目:openMAXIMS    文件:Logic.java   
private ElectiveListStatusVo populateElectiveListStatus(WaitingListStatus status)
{
    ElectiveListStatusVo electiveListStatus = new ElectiveListStatusVo();

    electiveListStatus.setElectiveListStatus(status); 
    electiveListStatus.setStatusDateTime(new DateTime());

    Object mos = domain.getMosUser();
    if (mos !=null && mos instanceof MemberOfStaffLiteVo)
    {
        electiveListStatus.setAuthoringUser((MemberOfStaffLiteVo) mos);
    }
    return electiveListStatus;
}
项目:openMAXIMS    文件:BookTheatreSlotDetailDialogImpl.java   
public Boolean hasNonDiagnosticPatientElectiveList(CatsReferralRefVo catsReferral)
{
    if (catsReferral == null || catsReferral.getID_CatsReferral() == null)
        return false;

    DomainFactory factory = getDomainFactory();
    String query = "select count(pel.id) from PatientElectiveList as pel left join pel.electiveListStatus as els left join els.electiveListStatus as status left join pel.referral as cats left join cats.journey as j left join j.currentClock as cc left join pel.pathwayClock as pc where cats.id = :CatsReferral and cc.id = pc.id and status.id not in (" + WaitingListStatus.REMOVED.getID() + ")";

    Object[] count = factory.find(query, new String[] { "CatsReferral" }, new Object[] { catsReferral.getID_CatsReferral() }).toArray();

    if (count != null && count.length > 0)
        return ((Long) count[0]).intValue() > 0;

    return false;
}
项目:openMAXIMS    文件:NewElectiveListTCIErodDialogImpl.java   
public Boolean hasNonDiagnosticPatientElectiveList(CatsReferralRefVo catsReferral)
{
    if(catsReferral == null || catsReferral.getID_CatsReferral() == null)
        return false;

    DomainFactory factory = getDomainFactory();
    String query = "select count(pel.id) from PatientElectiveList as pel left join pel.electiveListStatus as els left join els.electiveListStatus as status left join pel.referral as cats left join cats.journey as j left join j.currentClock as cc left join pel.pathwayClock as pc where cats.id = :CatsReferral and cc.id = pc.id and status.id not in (" + WaitingListStatus.REMOVED.getID() + ")";

    Object[] count = factory.find(query, new String[] {"CatsReferral"}, new Object[] {catsReferral.getID_CatsReferral()}).toArray();

    if(count != null && count.length > 0)
        return ((Long) count[0]).intValue() > 0;

    return false;
}
项目:openMAXIMS    文件:NewElectiveListTCIErodDialogImpl.java   
public Boolean hasNonDiagnosticPatientElectiveListforReferral(CatsReferralRefVo catsReferral)
{
    if(catsReferral == null || catsReferral.getID_CatsReferral() == null)
        return false;

    DomainFactory factory = getDomainFactory();
    String query = "select count(pel.id) from PatientElectiveList as pel left join pel.electiveListStatus as els left join els.electiveListStatus as status left join pel.referral as cats left join pel.electiveListReason as pelr where cats.id = :CatsReferral and pelr.id not in (" + ElectiveListReason.DIAGNOSTIC.getID() + ") and status.id not in (" + WaitingListStatus.REMOVED.getID() + ")";

    Object[] count = factory.find(query, new String[] {"CatsReferral"}, new Object[] {catsReferral.getID_CatsReferral()}).toArray();

    if(count != null && count.length > 0)
        return ((Long) count[0]).intValue() > 0;

    return false;
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
public Boolean hasElectiveListsToRemove(PatientRefVo patientRef, PatientElectiveListRefVo electiveListRef, Specialty specialty)
{
    if (patientRef == null || patientRef.getID_Patient() == null)
        return Boolean.FALSE;

    if (specialty == null)
        return Boolean.FALSE;

    StringBuilder query = new StringBuilder("SELECT COUNT(pel.id) FROM PatientElectiveList AS pel LEFT JOIN pel.electiveList AS el LEFT JOIN el.service AS service LEFT JOIN service.specialty AS specialty LEFT JOIN pel.patient AS patient LEFT JOIN pel.electiveListStatus AS elStatus LEFT JOIN elStatus.electiveListStatus as eleListStatus");
    query.append(" WHERE patient.id = :PAT_ID AND specialty.id = :SPECIALTY_ID AND eleListStatus.id <> :STATUS_ID ");

    if (electiveListRef != null)
        query.append(" AND pel.id <> :PEL_ID ");

    ArrayList<String> paramNames = new ArrayList<String>(); 
    ArrayList<Object> paramValues = new ArrayList<Object>();

    paramNames.add("PAT_ID");   
    paramValues.add(patientRef.getID_Patient());
    paramNames.add("SPECIALTY_ID");     
    paramValues.add(specialty.getID());
    paramNames.add("STATUS_ID");        
    paramValues.add(WaitingListStatus.REMOVED.getID());

    if (electiveListRef != null)
    {
        paramNames.add("PEL_ID");
        paramValues.add(electiveListRef.getID_PatientElectiveList());
    }
    long count = getDomainFactory().countWithHQL(query.toString(), paramNames.toArray(new String[paramNames.size()]), paramValues.toArray(new Object[paramValues.size()]));

    if (count > 0)
        return Boolean.TRUE;

    return Boolean.FALSE;
}