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

项目:AvoinApotti    文件:BedAdmissionComponentImpl.java   
public Boolean hasHomeLeavesByWard(LocationRefVo ward) 
{
    if(ward == null || ward.getID_Location() == null)
        throw new CodingRuntimeException("ward is null or id not provide in method listInpatientEpisodeByWard");

    String hql = getHomeLeavesQuery(true);

    List<?> inpatEpis = getDomainFactory().find(hql, new String[]{"idWard", "bTRUE","idWard2", "status"}, new Object[]{ward.getID_Location(), Boolean.TRUE, ward.getID_Location(),getDomLookup(TransferStatus.PENDING) });

    if(inpatEpis != null && inpatEpis.size() > 0)
    {
        if(((Long) inpatEpis.get(0)) > 0)
            return true;
    }

    return false;
}
项目:openMAXIMS    文件:Logic.java   
private PendingTransfersLiteVo populatePendingTransferOnAcceptFromScreen(PendingTransfersLiteVo value)
{
    if (value == null)
        return null;

    if (value.getPatientStatus() == null )
        value.setPatientStatus(value.getInpatientEpisode().getPasEvent().getPatient().getPatientCategory() != null ? value.getInpatientEpisode().getPasEvent().getPatient().getPatientCategory() : PatientStatus.NHS);
    value.setWardType(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbWardType().getValue());
    value.setService(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().qmbInService().getValue());
    value.setSpecialty(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbInSpecialty().getValue());
    value.setTransferRequestDateTime(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().dtimTransfer().getValue());
    value.setCurrentStatus(TransferStatus.TRANSFERRED);

    if (form.lyrDetail().tabTransfer().lyrTransfer().tabIn().ccInConsultant().getValue() instanceof MedicVo)
    {       
        value.setConsultant((MedicVo)form.lyrDetail().tabTransfer().lyrTransfer().tabIn().ccInConsultant().getValue());
    }
    return value;
}
项目:openMAXIMS    文件:Logic.java   
private PendingTransfersLiteVo populatePendingTransferDataFromScreen(PendingTransfersLiteVo selectedPendingTransfer)
{
    if (selectedPendingTransfer == null)
        return null;
    selectedPendingTransfer.setPatientStatus(form.cmbPatientStatus().getValue());
    selectedPendingTransfer.setWardType(form.cmbWardType().getValue());
    selectedPendingTransfer.setService(form.qmbService().getValue());
    selectedPendingTransfer.setSpecialty(form.cmbSpecialty().getValue());
    selectedPendingTransfer.setTransferRequestDateTime(form.dtimTransferAccept().getValue());
    selectedPendingTransfer.setCurrentStatus(TransferStatus.TRANSFERRED);

    if (form.ccConsultant().getValue() instanceof MedicVo)
    {       
        selectedPendingTransfer.setConsultant((MedicVo)form.ccConsultant().getValue());
    }

    return selectedPendingTransfer;
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public Boolean hasHomeLeavesByWard(LocationRefVo ward) 
{
    if(ward == null || ward.getID_Location() == null)
        throw new CodingRuntimeException("ward is null or id not provide in method listInpatientEpisodeByWard");

    String hql = getHomeLeavesQuery(true, true);

    List<?> inpatEpis = getDomainFactory().find(hql, new String[]{"idWard", "bTRUE","idWard2", "status"}, new Object[]{ward.getID_Location(), Boolean.TRUE, ward.getID_Location(),getDomLookup(TransferStatus.PENDING) });

    if(inpatEpis != null && inpatEpis.size() > 0)
    {
        if(((Long) inpatEpis.get(0)) > 0)
            return true;
    }

    return false;
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public Boolean hasHomeLeavesByWard(LocationRefVo ward) 
{
    if(ward == null || ward.getID_Location() == null)
        throw new CodingRuntimeException("ward is null or id not provide in method listInpatientEpisodeByWard");

    String hql = getHomeLeavesQuery(true);

    List<?> inpatEpis = getDomainFactory().find(hql, new String[]{"idWard", "bTRUE","idWard2", "status"}, new Object[]{ward.getID_Location(), Boolean.TRUE, ward.getID_Location(),getDomLookup(TransferStatus.PENDING) });

    if(inpatEpis != null && inpatEpis.size() > 0)
    {
        if(((Long) inpatEpis.get(0)) > 0)
            return true;
    }

    return false;
}
项目:openmaxims-linux    文件:BedAdmissionComponentImpl.java   
public Boolean hasHomeLeavesByWard(LocationRefVo ward) 
{
    if(ward == null || ward.getID_Location() == null)
        throw new CodingRuntimeException("ward is null or id not provide in method listInpatientEpisodeByWard");

    String hql = getHomeLeavesQuery(true);

    List<?> inpatEpis = getDomainFactory().find(hql, new String[]{"idWard", "bTRUE","idWard2", "status"}, new Object[]{ward.getID_Location(), Boolean.TRUE, ward.getID_Location(),getDomLookup(TransferStatus.PENDING) });

    if(inpatEpis != null && inpatEpis.size() > 0)
    {
        if(((Long) inpatEpis.get(0)) > 0)
            return true;
    }

    return false;
}
项目:AvoinApotti    文件:BedAdmissionComponentImpl.java   
public InpatientEpisodeLiteVoCollection listHomeLeavesByWard(LocationRefVo ward) 
{
    if(ward == null || ward.getID_Location() == null)
        throw new CodingRuntimeException("ward is null or id not provide in method listInpatientEpisodeByWard");

    String hql = getHomeLeavesQuery(false);//   WDEV-14563

    List<?> inpatEpis = getDomainFactory().find(hql, new String[]{"idWard", "bTRUE","idWard2", "status"}, new Object[]{ward.getID_Location(), Boolean.TRUE, ward.getID_Location(),getDomLookup(TransferStatus.PENDING) });
    return InpatientEpisodeLiteVoAssembler.createInpatientEpisodeLiteVoCollectionFromInpatientEpisode(inpatEpis);
}
项目:AvoinApotti    文件:WardViewImpl.java   
public PendingTransfersLiteVoCollection listPendingTransfersInByWard(LocationRefVo destWard)
{
    if(destWard == null || destWard.getID_Location() == null)
        throw new CodingRuntimeException("destWard is null or id not provided in method listPendingTransfersInByWard");

    String hql = "from PendingTransfers pend where pend.destinationWard.id = :idWard and pend.currentStatus = :status";
    List pendingTrans = getDomainFactory().find(hql, new String[]{"idWard","status"}, new Object[]{destWard.getID_Location(), getDomLookup(TransferStatus.PENDING)});
    return PendingTransfersLiteVoAssembler.createPendingTransfersLiteVoCollectionFromPendingTransfers(pendingTrans);
}
项目:AvoinApotti    文件:WardViewImpl.java   
public PendingTransfersLiteVoCollection listPendingTransfersOutByWard(LocationRefVo currentLocation)
{
    if(currentLocation == null || currentLocation.getID_Location() == null)
        throw new CodingRuntimeException("currentLocation is null or id not provided in method listPendingTransfersOutByWard");

    String hql = "from PendingTransfers pend where pend.inpatientEpisode.pasEvent.location.id = :idWard and pend.currentStatus = :status order by pend.inpatientEpisode.pasEvent.patient.name.upperSurname asc, pend.inpatientEpisode.pasEvent.patient.name.upperForename asc";
    List pendingTrans = getDomainFactory().find(hql, new String[]{"idWard","status"}, new Object[]{currentLocation.getID_Location(), getDomLookup(TransferStatus.PENDING)});
    return PendingTransfersLiteVoAssembler.createPendingTransfersLiteVoCollectionFromPendingTransfers(pendingTrans);
}
项目:openMAXIMS    文件:WardViewPatientSummaryComponentImpl.java   
public Integer countPatientsForTransferOut(ims.core.resource.place.vo.LocationRefVo ward, ims.core.resource.place.vo.LocationRefVo bay)
{
    if (ward == null || ward.getID_Location() == null)
        return 0;

    String query = "SELECT COUNT (pendTrans.id) FROM PendingTransfers AS pendTrans LEFT JOIN pendTrans.inpatientEpisode AS inpat WHERE inpat.pasEvent.location.id = :WARD_ID AND pendTrans.currentStatus.id = :STATUS ";

    String[] paramNames = new String[] {"WARD_ID", "STATUS"};
    Object[] paramValues = new Object[] {ward.getID_Location(), TransferStatus.PENDING.getID()};

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

    String query = "SELECT COUNT (pendTrans.id) FROM PendingTransfers AS pendTrans LEFT JOIN pendTrans.inpatientEpisode AS inpat WHERE pendTrans.destinationWard.id = :WARD_ID AND pendTrans.currentStatus.id = :STATUS ";

    String[] paramNames = new String[] {"WARD_ID", "STATUS"};
    Object[] paramValues = new Object[] {ward.getID_Location(), TransferStatus.PENDING.getID()};

    return (int) getDomainFactory().countWithHQL(query, paramNames, paramValues);
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
public PendingTransfersLiteVo getPendingTransferForInpatient(InpatientEpisodeRefVo inpatEpis)
{
    if (inpatEpis == null || inpatEpis.getID_InpatientEpisode() == null)
        return null;

    List<?> transfers = getDomainFactory().find("from PendingTransfers pTrans WHERE pTrans.inpatientEpisode.id = " + inpatEpis.getID_InpatientEpisode() + " AND pTrans.currentStatus.id = " + TransferStatus.PENDING.getId());
    if(transfers != null && transfers.size() == 1)
        return PendingTransfersLiteVoAssembler.create((PendingTransfers) transfers.get(0));

    return null;
}
项目:openMAXIMS    文件:WardDataViewImpl.java   
public PendingTransfersLiteVo getPendingTransfer(PendingTransfersRefVo pendingTransferRef)
{
    if (pendingTransferRef == null)
        return null;
    DomainFactory factory = getDomainFactory();

    PendingTransfers doPendingTransfer = (PendingTransfers) factory.getDomainObject(PendingTransfers.class, pendingTransferRef.getID_PendingTransfers());
    if (doPendingTransfer != null && TransferStatus.PENDING.getID() == doPendingTransfer.getCurrentStatus().getId())
        return PendingTransfersLiteVoAssembler.create(doPendingTransfer);

    return null;
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public InpatientEpisodeLiteVoCollection listHomeLeavesByWard(LocationRefVo ward) 
{
    if(ward == null || ward.getID_Location() == null)
        throw new CodingRuntimeException("ward is null or id not provide in method listInpatientEpisodeByWard");

    String hql = getHomeLeavesQuery(false, true);// WDEV-14563

    List<?> inpatEpis = getDomainFactory().find(hql, new String[]{"idWard", "bTRUE","idWard2", "status"}, new Object[]{ward.getID_Location(), Boolean.TRUE, ward.getID_Location(),getDomLookup(TransferStatus.PENDING) });
    return InpatientEpisodeLiteVoAssembler.createInpatientEpisodeLiteVoCollectionFromInpatientEpisode(inpatEpis);
}
项目:openMAXIMS    文件:WardViewImpl.java   
public PendingTransfersLiteVoCollection listPendingTransfersInByWard(LocationRefVo destWard)
{
    if(destWard == null || destWard.getID_Location() == null)
        throw new CodingRuntimeException("destWard is null or id not provided in method listPendingTransfersInByWard");

    String hql = "from PendingTransfers pend where pend.destinationWard.id = :idWard and pend.currentStatus = :status";
    List pendingTrans = getDomainFactory().find(hql, new String[]{"idWard","status"}, new Object[]{destWard.getID_Location(), getDomLookup(TransferStatus.PENDING)});
    return PendingTransfersLiteVoAssembler.createPendingTransfersLiteVoCollectionFromPendingTransfers(pendingTrans);
}
项目:openMAXIMS    文件:WardViewImpl.java   
public PendingTransfersLiteVoCollection listPendingTransfersOutByWard(LocationRefVo currentLocation)
{
    if(currentLocation == null || currentLocation.getID_Location() == null)
        throw new CodingRuntimeException("currentLocation is null or id not provided in method listPendingTransfersOutByWard");

    String hql = "from PendingTransfers pend where pend.inpatientEpisode.pasEvent.location.id = :idWard and pend.currentStatus = :status order by pend.inpatientEpisode.pasEvent.patient.name.upperSurname asc, pend.inpatientEpisode.pasEvent.patient.name.upperForename asc";
    List pendingTrans = getDomainFactory().find(hql, new String[]{"idWard","status"}, new Object[]{currentLocation.getID_Location(), getDomLookup(TransferStatus.PENDING)});
    return PendingTransfersLiteVoAssembler.createPendingTransfersLiteVoCollectionFromPendingTransfers(pendingTrans);
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public InpatientEpisodeLiteVoCollection listHomeLeavesByWard(LocationRefVo ward) 
{
    if(ward == null || ward.getID_Location() == null)
        throw new CodingRuntimeException("ward is null or id not provide in method listInpatientEpisodeByWard");

    String hql = getHomeLeavesQuery(false);//   WDEV-14563

    List<?> inpatEpis = getDomainFactory().find(hql, new String[]{"idWard", "bTRUE","idWard2", "status"}, new Object[]{ward.getID_Location(), Boolean.TRUE, ward.getID_Location(),getDomLookup(TransferStatus.PENDING) });
    return InpatientEpisodeLiteVoAssembler.createInpatientEpisodeLiteVoCollectionFromInpatientEpisode(inpatEpis);
}
项目:openMAXIMS    文件:WardViewImpl.java   
public PendingTransfersLiteVoCollection listPendingTransfersInByWard(LocationRefVo destWard)
{
    if(destWard == null || destWard.getID_Location() == null)
        throw new CodingRuntimeException("destWard is null or id not provided in method listPendingTransfersInByWard");

    String hql = "from PendingTransfers pend where pend.destinationWard.id = :idWard and pend.currentStatus = :status";
    List pendingTrans = getDomainFactory().find(hql, new String[]{"idWard","status"}, new Object[]{destWard.getID_Location(), getDomLookup(TransferStatus.PENDING)});
    return PendingTransfersLiteVoAssembler.createPendingTransfersLiteVoCollectionFromPendingTransfers(pendingTrans);
}
项目:openMAXIMS    文件:WardViewImpl.java   
public PendingTransfersLiteVoCollection listPendingTransfersOutByWard(LocationRefVo currentLocation)
{
    if(currentLocation == null || currentLocation.getID_Location() == null)
        throw new CodingRuntimeException("currentLocation is null or id not provided in method listPendingTransfersOutByWard");

    String hql = "from PendingTransfers pend where pend.inpatientEpisode.pasEvent.location.id = :idWard and pend.currentStatus = :status order by pend.inpatientEpisode.pasEvent.patient.name.upperSurname asc, pend.inpatientEpisode.pasEvent.patient.name.upperForename asc";
    List pendingTrans = getDomainFactory().find(hql, new String[]{"idWard","status"}, new Object[]{currentLocation.getID_Location(), getDomLookup(TransferStatus.PENDING)});
    return PendingTransfersLiteVoAssembler.createPendingTransfersLiteVoCollectionFromPendingTransfers(pendingTrans);
}
项目:openmaxims-linux    文件:BedAdmissionComponentImpl.java   
public InpatientEpisodeLiteVoCollection listHomeLeavesByWard(LocationRefVo ward) 
{
    if(ward == null || ward.getID_Location() == null)
        throw new CodingRuntimeException("ward is null or id not provide in method listInpatientEpisodeByWard");

    String hql = getHomeLeavesQuery(false);//   WDEV-14563

    List<?> inpatEpis = getDomainFactory().find(hql, new String[]{"idWard", "bTRUE","idWard2", "status"}, new Object[]{ward.getID_Location(), Boolean.TRUE, ward.getID_Location(),getDomLookup(TransferStatus.PENDING) });
    return InpatientEpisodeLiteVoAssembler.createInpatientEpisodeLiteVoCollectionFromInpatientEpisode(inpatEpis);
}
项目:openmaxims-linux    文件:WardViewImpl.java   
public PendingTransfersLiteVoCollection listPendingTransfersInByWard(LocationRefVo destWard)
{
    if(destWard == null || destWard.getID_Location() == null)
        throw new CodingRuntimeException("destWard is null or id not provided in method listPendingTransfersInByWard");

    String hql = "from PendingTransfers pend where pend.destinationWard.id = :idWard and pend.currentStatus = :status";
    List pendingTrans = getDomainFactory().find(hql, new String[]{"idWard","status"}, new Object[]{destWard.getID_Location(), getDomLookup(TransferStatus.PENDING)});
    return PendingTransfersLiteVoAssembler.createPendingTransfersLiteVoCollectionFromPendingTransfers(pendingTrans);
}
项目:openmaxims-linux    文件:WardViewImpl.java   
public PendingTransfersLiteVoCollection listPendingTransfersOutByWard(LocationRefVo currentLocation)
{
    if(currentLocation == null || currentLocation.getID_Location() == null)
        throw new CodingRuntimeException("currentLocation is null or id not provided in method listPendingTransfersOutByWard");

    String hql = "from PendingTransfers pend where pend.inpatientEpisode.pasEvent.location.id = :idWard and pend.currentStatus = :status order by pend.inpatientEpisode.pasEvent.patient.name.upperSurname asc, pend.inpatientEpisode.pasEvent.patient.name.upperForename asc";
    List pendingTrans = getDomainFactory().find(hql, new String[]{"idWard","status"}, new Object[]{currentLocation.getID_Location(), getDomLookup(TransferStatus.PENDING)});
    return PendingTransfersLiteVoAssembler.createPendingTransfersLiteVoCollectionFromPendingTransfers(pendingTrans);
}
项目:openMAXIMS    文件:WardViewPatientListImpl.java   
public WardViewPatientListVoCollection listForPatientsOnTheWard(LocationRefVo ward, LocationRefVo bay)
{
    if (ward == null || ward.getID_Location() == null)
        return null;

    StringBuilder query = new StringBuilder("SELECT inpatEp, patient, bedSpaceState, ");
    query.append(" (select count(pt.id) from PendingTransfers as pt left join pt.inpatientEpisode as inp where inp.id = inpatEp.id and pt.currentStatus.id = :PENDING_TRANSF) ");
    query.append(" FROM BedSpaceState AS bedSpaceState LEFT JOIN bedSpaceState.inpatientEpisode AS inpatEp ");
    query.append(" LEFT JOIN inpatEp.pasEvent AS pas LEFT JOIN pas.patient AS patient ");

    query.append(" WHERE pas.location.id = :WARD_ID ");
    query.append(" AND inpatEp.bed is not null AND (inpatEp.isOnHomeLeave is null OR inpatEp.isOnHomeLeave = 0)");

    query.append(" ORDER BY patient.name.upperSurname, patient.name.upperForename ");


    List<?> results = getDomainFactory().find(query.toString(), new String[]{"PENDING_TRANSF",  "WARD_ID"}, new Object[] {TransferStatus.PENDING.getID(), ward.getID_Location()});

    if (results == null || results.size() == 0)
        return null;

    WardViewPatientListVoCollection wardViewPatientsCollection = new WardViewPatientListVoCollection();

    Iterator<?> iterator = results.iterator();

    while (iterator.hasNext())
    {
        Object[] item = (Object[]) iterator.next();

        InpatientEpisode doInpat = (InpatientEpisode) item[0];
        Patient doPatient = (Patient) item[1];
        BedSpaceState doBedSpace = (BedSpaceState) item[2];
        Long transferCount = (Long) item[3];

        WardViewPatientListVo wardViewPatient = new WardViewPatientListVo();

        if (doPatient != null && doPatient.getAssociatedPatient() != null)
        {   
            doPatient = doPatient.getAssociatedPatient();
        }   
        PatientLite_IdentifiersVo patient = PatientLite_IdentifiersVoAssembler.create(doPatient);
        wardViewPatient.setPatient(patient);

        if (doInpat != null)
        {
            wardViewPatient.setInpatientEpisode(InpatientEpisodeForWardPatientListVoAssembler.create(doInpat));
            wardViewPatient.setCanReopenHomeLeave(canReopenHomeLeave(doInpat));
        }

        if (doBedSpace != null)
        {
            wardViewPatient.setBedSpaceState(new BedSpaceStateRefVo(doBedSpace.getId(), doBedSpace.getVersion()));
        }

        if (transferCount != null)
        {
            wardViewPatient.setHasPendingTransfer(transferCount.intValue() > 0);
        }

        wardViewPatientsCollection.add(wardViewPatient);
    }

    return wardViewPatientsCollection;
}
项目:openMAXIMS    文件:WardViewPatientListImpl.java   
public WardViewPatientListVoCollection listForPatientsAwaitingBed(LocationRefVo ward, LocationRefVo bay)
{
    if (ward == null || ward.getID_Location() == null)
        return null;

    StringBuilder query = new StringBuilder("SELECT inpatEp, patient, bedSpaceState, ");
    query.append(" (select count(pt.id) from PendingTransfers as pt left join pt.inpatientEpisode as inp where inp.id = inpatEp.id and pt.currentStatus.id = :PENDING_TRANSF) ");
    query.append(" FROM BedSpaceState AS bedSpaceState RIGHT JOIN bedSpaceState.inpatientEpisode AS inpatEp ");
    query.append(" LEFT JOIN inpatEp.pasEvent AS pas LEFT JOIN pas.patient AS patient ");
    query.append(" LEFT JOIN inpatEp.bed AS bed ");

    query.append(" WHERE pas.location.id = :WARD_ID AND bed is null AND (inpatEp.isOnHomeLeave is null OR inpatEp.isOnHomeLeave = 0) AND (inpatEp.isReadyToLeave is null OR inpatEp.isReadyToLeave = 0)");
    query.append(" ORDER BY patient.name.upperSurname, patient.name.upperForename ");

    List<?> results = getDomainFactory().find(query.toString(),  new String[] {"PENDING_TRANSF","WARD_ID"}, new Object[] {TransferStatus.PENDING.getID(), ward.getID_Location()});

    if (results == null || results.size() == 0)
        return null;

    WardViewPatientListVoCollection wardViewPatientsCollection = new WardViewPatientListVoCollection();

    Iterator<?> iterator = results.iterator();

    while (iterator.hasNext())
    {
        Object[] item = (Object[]) iterator.next();

        InpatientEpisode doInpat = (InpatientEpisode) item[0];
        Patient doPatient = (Patient) item[1];
        BedSpaceState doBedSpace = (BedSpaceState) item[2];
        Long transferCount = (Long) item[3];            

        WardViewPatientListVo wardViewPatient = new WardViewPatientListVo();

        if (doPatient != null && doPatient.getAssociatedPatient() != null)
        {   
            doPatient = doPatient.getAssociatedPatient();
        }   
        PatientLite_IdentifiersVo patient = PatientLite_IdentifiersVoAssembler.create(doPatient);
        wardViewPatient.setPatient(patient);

        if (doInpat != null)
        {
            wardViewPatient.setInpatientEpisode(InpatientEpisodeForWardPatientListVoAssembler.create(doInpat));
            wardViewPatient.setCanReopenHomeLeave(canReopenHomeLeave(doInpat));
        }

        if (doBedSpace != null)
        {
            wardViewPatient.setBedSpaceState(new BedSpaceStateRefVo(doBedSpace.getId(), doBedSpace.getVersion()));
        }

        if (transferCount != null)
        {
            wardViewPatient.setHasPendingTransfer(transferCount.intValue() > 0);
        }
        wardViewPatientsCollection.add(wardViewPatient);
    }

    return wardViewPatientsCollection;
}
项目:openMAXIMS    文件:WardViewPatientListImpl.java   
public WardViewPatientListVoCollection listForPatientsOnHomeLeave(LocationRefVo ward, LocationRefVo bay)
{
    if (ward == null || ward.getID_Location() == null)
        return null;

    StringBuilder query = new StringBuilder("SELECT inpatEp, patient, bedSpaceState, ");
    query.append(" (select count(pt.id) from PendingTransfers as pt left join pt.inpatientEpisode as inp where inp.id = inpatEp.id and pt.currentStatus.id = :PENDING_TRANSF) ");
    query.append(" FROM BedSpaceState AS bedSpaceState RIGHT JOIN bedSpaceState.inpatientEpisode AS inpatEp ");
    query.append(" LEFT JOIN inpatEp.pasEvent AS pas LEFT JOIN pas.patient AS patient ");
    query.append(" LEFT JOIN inpatEp.homeLeaves AS hl ");
    query.append(" LEFT JOIN inpatEp.bed AS bed ");

    query.append(" WHERE pas.location.id = :WARD_ID AND inpatEp.isOnHomeLeave = 1 AND (hl.isRIE is null OR hl.isRIE = 0) AND (hl.bedRetained is null OR  hl.bedRetained = 0) AND hl.dateReturnedFromHomeLeave is null AND bed is null");
    query.append(" ORDER BY patient.name.upperSurname, patient.name.upperForename ");

    List<?> results = getDomainFactory().find(query.toString(),new String[]{"PENDING_TRANSF","WARD_ID"}, new Object[] {TransferStatus.PENDING.getID(),ward.getID_Location()});

    if (results == null || results.size() == 0)
        return null;

    WardViewPatientListVoCollection wardViewPatientsCollection = new WardViewPatientListVoCollection();

    Iterator<?> iterator = results.iterator();

    while (iterator.hasNext())
    {
        Object[] item = (Object[]) iterator.next();

        InpatientEpisode doInpat = (InpatientEpisode) item[0];
        Patient doPatient = (Patient) item[1];
        BedSpaceState doBedSpace = (BedSpaceState) item[2];
        Long transferCount = (Long) item[3];

        WardViewPatientListVo wardViewPatient = new WardViewPatientListVo();

        if (doPatient != null && doPatient.getAssociatedPatient() != null)
        {   
            doPatient = doPatient.getAssociatedPatient();
        }   
        PatientLite_IdentifiersVo patient = PatientLite_IdentifiersVoAssembler.create(doPatient);
        wardViewPatient.setPatient(patient);

        if (doInpat != null)
        {
            wardViewPatient.setInpatientEpisode(InpatientEpisodeForWardPatientListVoAssembler.create(doInpat));
        }

        if (doBedSpace != null)
        {
            wardViewPatient.setBedSpaceState(new BedSpaceStateRefVo(doBedSpace.getId(), doBedSpace.getVersion()));
        }           
        if (transferCount != null)
        {
            wardViewPatient.setHasPendingTransfer(transferCount.intValue() > 0);
        }

        wardViewPatientsCollection.add(wardViewPatient);
    }

    return wardViewPatientsCollection;
}
项目:openMAXIMS    文件:WardViewPatientListImpl.java   
public WardViewPatientListVoCollection listForPatientsOnHomeLeaveWithBedsRetained(LocationRefVo ward, LocationRefVo bay)
{
    if (ward == null || ward.getID_Location() == null)
        return null;

    StringBuilder query = new StringBuilder("SELECT inpatEp, patient, bedSpaceState, ");
    query.append(" (select count(pt.id) from PendingTransfers as pt left join pt.inpatientEpisode as inp where inp.id = inpatEp.id and pt.currentStatus.id = :PENDING_TRANSF) ");
    query.append(" FROM BedSpaceState AS bedSpaceState LEFT JOIN bedSpaceState.inpatientEpisode AS inpatEp ");
    query.append(" LEFT JOIN inpatEp.pasEvent AS pas LEFT JOIN pas.patient AS patient ");

    query.append(" WHERE pas.location.id = :WARD_ID AND inpatEp.isOnHomeLeave = 1 ");
    query.append(" ORDER BY patient.name.upperSurname, patient.name.upperForename ");

    List<?> results = getDomainFactory().find(query.toString(), new String[] {"PENDING_TRANSF","WARD_ID"},new Object[] {TransferStatus.PENDING.getID(), ward.getID_Location()});

    if (results == null || results.size() == 0)
        return null;

    WardViewPatientListVoCollection wardViewPatientsCollection = new WardViewPatientListVoCollection();

    Iterator<?> iterator = results.iterator();

    while (iterator.hasNext())
    {
        Object[] item = (Object[]) iterator.next();

        InpatientEpisode doInpat = (InpatientEpisode) item[0];
        Patient doPatient = (Patient) item[1];
        BedSpaceState doBedSpace = (BedSpaceState) item[2];
        Long transferCount = (Long) item[3];

        WardViewPatientListVo wardViewPatient = new WardViewPatientListVo();

        if (doPatient != null && doPatient.getAssociatedPatient() != null)
        {   
            doPatient = doPatient.getAssociatedPatient();
        }
        PatientLite_IdentifiersVo patient = PatientLite_IdentifiersVoAssembler.create(doPatient);
        wardViewPatient.setPatient(patient);

        if (doInpat != null)
        {
            wardViewPatient.setInpatientEpisode(InpatientEpisodeForWardPatientListVoAssembler.create(doInpat));
        }

        if (doBedSpace != null)
        {
            wardViewPatient.setBedSpaceState(new BedSpaceStateRefVo(doBedSpace.getId(), doBedSpace.getVersion()));
        }
        if (transferCount != null)
        {
            wardViewPatient.setHasPendingTransfer(transferCount.intValue() > 0);
        }

        wardViewPatientsCollection.add(wardViewPatient);
    }

    return wardViewPatientsCollection;
}
项目:openMAXIMS    文件:WardViewPatientListImpl.java   
public WardViewPatientListVoCollection listForPatientsToBeDischargedWithin24Hours(LocationRefVo ward, LocationRefVo bay)
{
    if (ward == null || ward.getID_Location() == null)
        return null;

    StringBuilder query = new StringBuilder("SELECT inpatEp, patient, bedSpaceState, ");
    query.append(" (select count(pt.id) from PendingTransfers as pt left join pt.inpatientEpisode as inp where inp.id = inpatEp.id and pt.currentStatus.id = :PENDING_TRANSF) ");
    query.append(" FROM BedSpaceState AS bedSpaceState RIGHT JOIN bedSpaceState.inpatientEpisode AS inpatEp ");
    query.append(" LEFT JOIN inpatEp.pasEvent AS pas LEFT JOIN pas.patient AS patient ");
    query.append(" LEFT JOIN inpatEp.bed AS bed ");
    //          WDEV-21316
    query.append(" WHERE pas.location.id = :WARD_ID AND inpatEp.estDischargeDate <= :DATE_24H AND ((inpatEp.isConfirmedDischarge = 0 OR inpatEp.isConfirmedDischarge is null) and inpatEp.confirmedDischargeDateTime is null) AND ((inpatEp.isReadyToLeave is null OR inpatEp.isReadyToLeave = 0) and inpatEp.readyToLeaveDecisionDateTime is null)");
    query.append(" ORDER BY patient.name.upperSurname, patient.name.upperForename ");

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

    paramNames.add("WARD_ID");          paramValues.add(ward.getID_Location());
    paramNames.add("DATE_24H");         paramValues.add(new ims.framework.utils.DateTime().addHours(24).getJavaDate());
    paramNames.add("PENDING_TRANSF");   paramValues.add(TransferStatus.PENDING.getID());

    List<?> results = getDomainFactory().find(query.toString(), paramNames, paramValues);

    if (results == null || results.size() == 0)
        return null;

    WardViewPatientListVoCollection wardViewPatientsCollection = new WardViewPatientListVoCollection();

    Iterator<?> iterator = results.iterator();

    while (iterator.hasNext())
    {
        Object[] item = (Object[]) iterator.next();

        InpatientEpisode doInpat = (InpatientEpisode) item[0];
        Patient doPatient = (Patient) item[1];
        BedSpaceState doBedSpace = (BedSpaceState) item[2];
        Long transferCount = (Long) item[3];

        WardViewPatientListVo wardViewPatient = new WardViewPatientListVo();

        if (doPatient != null && doPatient.getAssociatedPatient() != null)
        {   
            doPatient = doPatient.getAssociatedPatient();
        }   
        PatientLite_IdentifiersVo patient = PatientLite_IdentifiersVoAssembler.create(doPatient);
        wardViewPatient.setPatient(patient);

        if (doInpat != null)
        {
            wardViewPatient.setInpatientEpisode(InpatientEpisodeForWardPatientListVoAssembler.create(doInpat));
            wardViewPatient.setCanReopenHomeLeave(canReopenHomeLeave(doInpat));
        }

        if (doBedSpace != null)
        {
            wardViewPatient.setBedSpaceState(new BedSpaceStateRefVo(doBedSpace.getId(), doBedSpace.getVersion()));
        }

        if (transferCount != null)
        {
            wardViewPatient.setHasPendingTransfer(transferCount.intValue() > 0);
        }
        wardViewPatientsCollection.add(wardViewPatient);
    }

    return wardViewPatientsCollection;
}
项目:openMAXIMS    文件:WardViewPatientListImpl.java   
public WardViewPatientListVoCollection listForPatientsWithDischargedConfirmedWithin24Hours(LocationRefVo ward, LocationRefVo bay)
{
    if (ward == null || ward.getID_Location() == null)
        return null;

    StringBuilder query = new StringBuilder("SELECT inpatEp, patient, bedSpaceState, ");
    query.append(" (select count(pt.id) from PendingTransfers as pt left join pt.inpatientEpisode as inp where inp.id = inpatEp.id and pt.currentStatus.id = :PENDING_TRANSF) ");
    query.append(" FROM BedSpaceState AS bedSpaceState RIGHT JOIN bedSpaceState.inpatientEpisode AS inpatEp ");
    query.append(" LEFT JOIN inpatEp.pasEvent AS pas LEFT JOIN pas.patient AS patient ");
    query.append(" LEFT JOIN inpatEp.bed AS bed ");

    query.append(" WHERE pas.location.id = :WARD_ID AND inpatEp.confirmedDischargeDateTime <= :DATE_24H AND inpatEp.isConfirmedDischarge = 1 AND ((inpatEp.isReadyToLeave is null OR inpatEp.isReadyToLeave = 0) AND inpatEp.readyToLeaveDecisionDateTime IS NULL)");
    query.append(" ORDER BY patient.name.upperSurname, patient.name.upperForename ");

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

    paramNames.add("WARD_ID");          paramValues.add(ward.getID_Location());
    paramNames.add("DATE_24H");         paramValues.add(new ims.framework.utils.DateTime().addHours(24).getJavaDate());
    paramNames.add("PENDING_TRANSF");   paramValues.add(TransferStatus.PENDING.getID());

    List<?> results = getDomainFactory().find(query.toString(), paramNames, paramValues);

    if (results == null || results.size() == 0)
        return null;

    WardViewPatientListVoCollection wardViewPatientsCollection = new WardViewPatientListVoCollection();

    Iterator<?> iterator = results.iterator();

    while (iterator.hasNext())
    {
        Object[] item = (Object[]) iterator.next();

        InpatientEpisode doInpat = (InpatientEpisode) item[0];
        Patient doPatient = (Patient) item[1];
        BedSpaceState doBedSpace = (BedSpaceState) item[2];         
        Long transferCount = (Long) item[3];

        WardViewPatientListVo wardViewPatient = new WardViewPatientListVo();

        if (doPatient != null && doPatient.getAssociatedPatient() != null)
        {   
            doPatient = doPatient.getAssociatedPatient();
        }   
        PatientLite_IdentifiersVo patient = PatientLite_IdentifiersVoAssembler.create(doPatient);
        wardViewPatient.setPatient(patient);

        if (doInpat != null)
        {
            wardViewPatient.setInpatientEpisode(InpatientEpisodeForWardPatientListVoAssembler.create(doInpat));
            wardViewPatient.setCanReopenHomeLeave(canReopenHomeLeave(doInpat));
        }

        if (doBedSpace != null)
        {
            wardViewPatient.setBedSpaceState(new BedSpaceStateRefVo(doBedSpace.getId(), doBedSpace.getVersion()));
        }           

        if (transferCount != null)
        {
            wardViewPatient.setHasPendingTransfer(transferCount.intValue() > 0);
        }

        wardViewPatientsCollection.add(wardViewPatient);
    }

    return wardViewPatientsCollection;
}
项目:openMAXIMS    文件:WardViewPatientListImpl.java   
public WardViewPatientListVoCollection listForPatientsReadyToLeave(LocationRefVo ward, LocationRefVo bay)
{
    if (ward == null || ward.getID_Location() == null)
        return null;

    StringBuilder query = new StringBuilder("SELECT inpatEp, patient, bedSpaceState,");
    query.append(" (select count(pt.id) from PendingTransfers as pt left join pt.inpatientEpisode as inp where inp.id = inpatEp.id and pt.currentStatus.id = :PENDING_TRANSF) ");
    query.append(" FROM BedSpaceState AS bedSpaceState RIGHT JOIN bedSpaceState.inpatientEpisode AS inpatEp ");
    query.append(" LEFT JOIN inpatEp.pasEvent AS pas LEFT JOIN pas.patient AS patient ");
    query.append(" WHERE pas.location.id = :WARD_ID");
    query.append(" AND inpatEp.readyToLeaveDecisionDateTime <= :TODAY_HIGH AND inpatEp.isReadyToLeave = 1");
    query.append(" ORDER BY patient.name.upperSurname ");

    List<?> results = getDomainFactory().find(query.toString(), new String[]{"PENDING_TRANSF","WARD_ID","TODAY_HIGH"}, new Object[] {TransferStatus.PENDING.getID(),ward.getID_Location(), new DateTime().addHours(24).getJavaDate()});

    if (results == null || results.size() == 0)
        return null;

    WardViewPatientListVoCollection wardViewPatientsCollection = new WardViewPatientListVoCollection();

    Iterator<?> iterator = results.iterator();

    while (iterator.hasNext())
    {
        Object[] item = (Object[]) iterator.next();

        InpatientEpisode doInpat = (InpatientEpisode) item[0];
        Patient doPatient = (Patient) item[1];
        BedSpaceState doBedSpace = (BedSpaceState) item[2];
        Long transferCount = (Long) item[3];

        WardViewPatientListVo wardViewPatient = new WardViewPatientListVo();

        if (doPatient != null && doPatient.getAssociatedPatient() != null)
        {   
            doPatient = doPatient.getAssociatedPatient();
        }   
        PatientLite_IdentifiersVo patient = PatientLite_IdentifiersVoAssembler.create(doPatient);
        wardViewPatient.setPatient(patient);

        if (doInpat != null)
        {
            wardViewPatient.setInpatientEpisode(InpatientEpisodeForWardPatientListVoAssembler.create(doInpat));
            wardViewPatient.setCanReopenHomeLeave(canReopenHomeLeave(doInpat));
        }

        if (doBedSpace != null)
        {
            wardViewPatient.setBedSpaceState(new BedSpaceStateRefVo(doBedSpace.getId(), doBedSpace.getVersion()));
        }
        if (transferCount != null)
        {
            wardViewPatient.setHasPendingTransfer(transferCount.intValue() > 0);
        }

        wardViewPatientsCollection.add(wardViewPatient);
    }

    return wardViewPatientsCollection;

}
项目:openMAXIMS    文件:WardViewPatientListImpl.java   
public WardViewPatientListVoCollection listForTransferOutPatients(LocationRefVo ward, LocationRefVo bay)
{
    if (ward == null || ward.getID_Location() == null)
        return null;

    StringBuilder query = new StringBuilder("SELECT inpat, patient, bedSpaceState, pendTrans ");
    query.append(" FROM PendingTransfers AS pendTrans ");
    query.append(" LEFT JOIN pendTrans.inpatientEpisode AS inpat LEFT JOIN inpat.pasEvent AS pas ");
    query.append(" LEFT JOIN pas.patient AS patient ");
    query.append(" LEFT JOIN inpat.bed AS bedSpaceState ");

    query.append(" WHERE pas.location.id = :WARD_ID AND pendTrans.currentStatus.id = :STATUS ");
    query.append(" ORDER BY patient.name.upperSurname ");

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

    paramNames.add("WARD_ID");      paramValues.add(ward.getID_Location());
    paramNames.add("STATUS");       paramValues.add(TransferStatus.PENDING.getID());

    List<?> results = getDomainFactory().find(query.toString(), paramNames, paramValues);

    if (results == null || results.size() == 0)
        return null;

    WardViewPatientListVoCollection wardViewPatientsCollection = new WardViewPatientListVoCollection();

    Iterator<?> iterator = results.iterator();

    while (iterator.hasNext())
    {
        Object[] item = (Object[]) iterator.next();

        InpatientEpisode doInpat = (InpatientEpisode) item[0];
        Patient doPatient = (Patient) item[1];
        BedSpaceState doBedSpace = (BedSpaceState) item[2];
        PendingTransfers doTransfer = (PendingTransfers) item[3];

        WardViewPatientListVo wardViewPatient = new WardViewPatientListVo();

        if (doPatient != null && doPatient.getAssociatedPatient() != null)
        {   
            doPatient = doPatient.getAssociatedPatient();
        }   
        PatientLite_IdentifiersVo patient = PatientLite_IdentifiersVoAssembler.create(doPatient);
        wardViewPatient.setPatient(patient);

        if (doInpat != null)
        {
            wardViewPatient.setInpatientEpisode(InpatientEpisodeForWardPatientListVoAssembler.create(doInpat));
        }

        if (doBedSpace != null)
        {
            wardViewPatient.setBedSpaceState(new BedSpaceStateRefVo(doBedSpace.getId(), doBedSpace.getVersion()));
        }

        if (doTransfer != null) //WDEV-21083
        {
            wardViewPatient.setPendingTransfer(PendingTransferForBedReadyDetailsVoAssembler.create(doTransfer));
        }           

        wardViewPatientsCollection.add(wardViewPatient);
    }

    return wardViewPatientsCollection;
}
项目:openMAXIMS    文件:WardViewPatientListImpl.java   
public WardViewPatientListVoCollection listForTransferInPatients(LocationRefVo ward, LocationRefVo bay)
{
    if (ward == null || ward.getID_Location() == null)
        return null;

    StringBuilder query = new StringBuilder("SELECT inpat, patient, bedSpaceState, pendTrans ");

    query.append(" FROM PendingTransfers AS pendTrans ");
    query.append(" LEFT JOIN pendTrans.inpatientEpisode AS inpat LEFT JOIN inpat.pasEvent AS pas ");
    query.append(" LEFT JOIN pas.patient AS patient ");
    query.append(" LEFT JOIN inpat.bed AS bedSpaceState ");
    query.append(" WHERE pendTrans.destinationWard.id = :WARD_ID AND pendTrans.currentStatus.id = :STATUS ");
    query.append(" ORDER BY patient.name.upperSurname ");

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

    paramNames.add("WARD_ID");      paramValues.add(ward.getID_Location());
    paramNames.add("STATUS");       paramValues.add(TransferStatus.PENDING.getID());


    List<?> results = getDomainFactory().find(query.toString(), paramNames, paramValues);

    if (results == null || results.size() == 0)
        return null;

    WardViewPatientListVoCollection wardViewPatientsCollection = new WardViewPatientListVoCollection();

    Iterator<?> iterator = results.iterator();

    while (iterator.hasNext())
    {
        Object[] item = (Object[]) iterator.next();

        InpatientEpisode doInpat = (InpatientEpisode) item[0];
        Patient doPatient = (Patient) item[1];
        BedSpaceState doBedSpace = (BedSpaceState) item[2];
        PendingTransfers doTransfer = (PendingTransfers) item[3];           

        WardViewPatientListVo wardViewPatient = new WardViewPatientListVo();

        if (doPatient != null && doPatient.getAssociatedPatient() != null)
        {   
            doPatient = doPatient.getAssociatedPatient();
        }   
        PatientLite_IdentifiersVo patient = PatientLite_IdentifiersVoAssembler.create(doPatient);
        wardViewPatient.setPatient(patient);

        if (doInpat != null)
        {
            wardViewPatient.setInpatientEpisode(InpatientEpisodeForWardPatientListVoAssembler.create(doInpat));
        }

        if (doBedSpace != null)
        {
            wardViewPatient.setBedSpaceState(new BedSpaceStateRefVo(doBedSpace.getId(), doBedSpace.getVersion()));
        }

        if (doTransfer != null) //WDEV-21083 
        {
            wardViewPatient.setPendingTransfer(PendingTransferForBedReadyDetailsVoAssembler.create(doTransfer));
        }

        wardViewPatientsCollection.add(wardViewPatient);
    }

    return wardViewPatientsCollection;
}