private void populateInpatientsGrid() { try { form.dyngrdInpatients().getRows().clear(); if(form.cmbWard().getValue() == null) return; if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO")) { fillGridFromHomeLeaveANDInpatRecords(); } else { // List all beds from ward, regardless if the bed is occupied or not // WDEV-21014 numeric sorting by Bed No. WardDataViewVoCollection bedsColl = domain.listAllBedsForWard(form.cmbWard().getValue()); if (bedsColl != null && bedsColl.size() > 1) { form.getLocalContext().setSortOrderBedNumber(SortOrder.ASCENDING); bedsColl.sort(new WardViewBedNumberComparator(form.getLocalContext().getSortOrderBedNumber())); } // WDEV-21014 --- end listBedSpacesFromWard(bedsColl); } } catch (DomainInterfaceException ex) { engine.showMessage(ex.getMessage()); } }
@Override protected void onDyngrdInpatientsColumnHeaderClicked(DynamicGridColumn column) { if (form.dyngrdInpatients().getRows().size() <=1) return; if (column.equals(getColumn(COL_BED_NO))) { WardDataViewVoCollection records = getValuesFromGrid(); form.getLocalContext().setSortOrderBedNumber(SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderBedNumber())? SortOrder.DESCENDING : SortOrder.ASCENDING); records.sort(new WardViewBedNumberComparator(form.getLocalContext().getSortOrderBedNumber())); listBedSpacesFromWard(records); } updateControlsState(); }
private WardDataViewVoCollection getValuesFromGrid() { WardDataViewVoCollection coll = new WardDataViewVoCollection(); for (int i=0; i<form.dyngrdInpatients().getRows().size();i++) { if (form.dyngrdInpatients().getRows().get(i) != null && form.dyngrdInpatients().getRows().get(i).getValue() instanceof WardDataViewVo) { coll.add((WardDataViewVo) form.dyngrdInpatients().getRows().get(i).getValue()); } } return coll; }
private void fillFromInpatRecords() { WardDataViewVoCollection voCollWdv = domain.listInpatientsInBedsByWard(form.cmbWard().getValue()); if(voCollWdv != null) { for (WardDataViewVo voWdv : voCollWdv) { grdInpatientsRow row = form.grdInpatients().getRows().newRow(); PatientShort voPatient = voWdv.getPatient(); if(voPatient != null) { if(voPatient.getNameIsNotNull()) { row.setColForename(voPatient.getName().getForename()); row.setColSurname(voPatient.getName().getSurname()); } PatientId patId = voPatient.getDisplayId(); row.setColDisplayId(patId != null ? patId.getValue() : null); Integer age = voPatient.calculateAge(); if(age != null) row.setColAge(String.valueOf(age)); if(voPatient.getHasActiveAlertsIsNotNull() && voPatient.getHasActiveAlerts()) //wdev-11083 row.setColAlert(form.getImages().Core.Alert16); //WDEV-18011 row.setColInfant(calculateInfants(voPatient)); } if(voWdv.getBayIsNotNull()) row.setColBay(voWdv.getBay().getName()); if(voWdv.getBedIsNotNull()) row.setColBedNumber(voWdv.getBed().getBedNumber()); row.setColPasEventHidden(voWdv.getPasEvent()); //wdev-14784 if( voWdv.getInpatEpisodeIsNotNull() && voWdv.getInpatEpisode().getVTEAssessmentStatusIsNotNull() && ConfigFlag.UI.VTE_RISK_ASSESSMENT_FUNCTIONALITY.getValue() == true) //wdev-15062 { row.setColVTEStatus(VTEAsessmentStatus.REQUIRED.equals(voWdv.getInpatEpisode().getVTEAssessmentStatus()) ? form.getImages().OCRR.Requested : (VTEAsessmentStatus.INPROGRESS.equals(voWdv.getInpatEpisode().getVTEAssessmentStatus()) ? form.getImages().OCRR.InProgress : null)); } else { row.setColVTEStatus(null); } //---------- row.setTooltip(buildRowTooltip(voWdv)); row.setValue(voPatient); } } }
/** * A list of all the occupied beds and associated inpatients across a ward */ public WardDataViewVoCollection listInpatientsInBedsByWard(LocationRefVo ward) { if (ward == null || ward.getID_Location() == null) throw new CodingRuntimeException("ward is null or id not provided in method listInpatientsInBedsByWard"); WardDataViewVoCollection voCollWdv = new WardDataViewVoCollection(); String hql = "select bed, pat, bay, pe,inpatEpis from BedSpaceState as bedSpaceState left join bedSpaceState.bedSpace as bed left join bedSpaceState.currentBedStatus as currentStatus left join bedSpaceState.inpatientEpisode as inpatEpis left join inpatEpis.pasEvent as pe left join pe.patient as pat left join bedSpaceState.bay as bay " + "where (bedSpaceState.ward.id = :wardId and bedSpaceState.inpatientEpisode is not null and currentStatus.bedStatus = :occupied)"; List wdvList = getDomainFactory().find(hql, new String[]{"wardId","occupied"}, new Object[]{ward.getID_Location(), getDomLookup(BedStatus.OCCUPIED)}); if(wdvList != null && wdvList.size() > 0) { Iterator it = wdvList.iterator(); while(it.hasNext()) { Object[] item = (Object[])it.next(); BedSpace doBed = (BedSpace) item[0]; Patient doPat = (Patient) item[1]; Location doBay = (Location) item[2]; PASEvent doPe = (PASEvent) item[3]; InpatientEpisode doInpat = (InpatientEpisode) item[4]; //wdev-14784 WardDataViewVo voWardDv = new WardDataViewVo(); voWardDv.setBed(BedSpaceVoAssembler.create(doBed)); voWardDv.setBay(LocationLiteVoAssembler.create(doBay)); voWardDv.setPatient(PatientShortAssembler.create(doPat)); voWardDv.getPatient().setHasAlerts(doPat.getPatientAlerts() != null && doPat.getPatientAlerts().size() > 0 ? true : false); voWardDv.setInpatEpisode(InpatientEpisodeForVTERiskAsessmentVoAssembler.create(doInpat)); //wdev-14784 //wdev-11083 Iterator<ims.core.clinical.domain.objects.PatientAlert> patAlert = doPat.getPatientAlerts().iterator(); boolean flagHasAlerts = false; while(patAlert != null && patAlert.hasNext()) { if(Boolean.TRUE.equals(patAlert.next().isIsCurrentlyActiveAlert())) { flagHasAlerts = true; break; } } voWardDv.getPatient().setHasActiveAlerts(flagHasAlerts); //end wdev-11083 voWardDv.setPasEvent(PasEventADTVoAssembler.create(doPe)); voCollWdv.add(voWardDv); } } voCollWdv.sort(); return voCollWdv; }
/** * A list of all the occupied beds and associated inpatients across a ward */ public WardDataViewVoCollection listInpatientsInBedsByWard(LocationRefVo ward) { if (ward == null || ward.getID_Location() == null) throw new CodingRuntimeException("ward is null or id not provided in method listInpatientsInBedsByWard"); WardDataViewVoCollection voCollWdv = new WardDataViewVoCollection(); String hql = "select bed, pat, bay, pe,inpatEpis from BedSpaceState as bedSpaceState left join bedSpaceState.bedSpace as bed left join bedSpaceState.currentBedStatus as currentStatus left join bedSpaceState.inpatientEpisode as inpatEpis left join inpatEpis.pasEvent as pe left join pe.patient as pat left join bedSpaceState.bay as bay " + "where (bedSpaceState.ward.id = :wardId and bedSpaceState.inpatientEpisode is not null and currentStatus.bedStatus = :occupied)"; List wdvList = getDomainFactory().find(hql, new String[]{"wardId","occupied"}, new Object[]{ward.getID_Location(), getDomLookup(BedStatus.OCCUPIED)}); if(wdvList != null && wdvList.size() > 0) { Iterator it = wdvList.iterator(); while(it.hasNext()) { Object[] item = (Object[])it.next(); BedSpace doBed = (BedSpace) item[0]; Patient doPat = (Patient) item[1]; Location doBay = (Location) item[2]; PASEvent doPe = (PASEvent) item[3]; InpatientEpisode doInpat = (InpatientEpisode) item[4]; //wdev-14784 WardDataViewVo voWardDv = new WardDataViewVo(); voWardDv.setBed(BedSpaceVoAssembler.create(doBed)); voWardDv.setBay(LocationLiteVoAssembler.create(doBay)); voWardDv.setPatient(PatientLite_IdentifiersVoAssembler.create(doPat)); voWardDv.getPatient().setHasAlerts(doPat.getPatientAlerts() != null && doPat.getPatientAlerts().size() > 0 ? true : false); voWardDv.setInpatEpisode(InpatientEpisodeForVTERiskAsessmentVoAssembler.create(doInpat)); //wdev-14784 //wdev-11083 Iterator<ims.core.clinical.domain.objects.PatientAlert> patAlert = doPat.getPatientAlerts().iterator(); boolean flagHasAlerts = false; while(patAlert != null && patAlert.hasNext()) { if(Boolean.TRUE.equals(patAlert.next().isIsCurrentlyActiveAlert())) { flagHasAlerts = true; break; } } voWardDv.getPatient().setHasAlerts(flagHasAlerts); //end wdev-11083 voWardDv.setPasEvent(PasEventADTVoAssembler.create(doPe)); voCollWdv.add(voWardDv); } } voCollWdv.sort(); return voCollWdv; }