@Override protected void onBtnOKClick() throws ims.framework.exceptions.PresentationLogicException { SpecimenWorkListItemListVo specimenWorkListItem = form.getLocalContext().getSpecimenWorkListItem(); //WDEV-16582 if (specimenWorkListItem.getWard() != null) //this means the round was already closed and the screen should be refreshed { form.getGlobalContext().OCRR.getMoveToWardDetails().setIsRoundClosed(Boolean.TRUE); engine.showMessage("Round was closed by another user. Screen will be refreshed."); engine.close(DialogResult.OK); return; } if (saveWorkListItem(specimenWorkListItem)) engine.close(DialogResult.OK); }
private Object getIdentifier(SpecimenWorkListItemListVo item) { String patIdValue = ""; String patIdentifier = ConfigFlag.UI.DISPLAY_PATID_TYPE.getValue(); PatIdType patIdType = PatIdType.getNegativeInstance(patIdentifier); if(patIdType != null) { PatientIdCollection patIdsColl = null; if(item.getSpecimen().getOrderIsNotNull() && item.getSpecimen().getOrder().getPatientIsNotNull()) patIdsColl = item.getSpecimen().getOrder().getPatient().getIdentifiers(); for (int i = 0; patIdsColl != null && i < patIdsColl.size(); i++) { if(patIdsColl.get(i).getTypeIsNotNull() && patIdsColl.get(i).getType().equals(patIdType)) { patIdValue = patIdsColl.get(i).getValue(); break; } } } return patIdType.toString() + " " + patIdValue; }
private void createControlsForNotCollection(DynamicGridRow row, SpecimenWorkListItemListVo item) { clearVariableCells(row); DynamicGridCell cell = row.getCells().newCell(getColumn(DATE_COL), DynamicCellType.LABEL, DynamicGridCellOptions.READ_ONLY_DATA_CELL); cell = row.getCells().newCell(getColumn(TIME_COL), DynamicCellType.LABEL, DynamicGridCellOptions.READ_ONLY_DATA_CELL); cell = row.getCells().newCell(getColumn(QUERY_COL), DynamicCellType.LABEL, DynamicGridCellOptions.LABEL_CELL); getColumn(QUERY_COL).setAlignment(Alignment.RIGHT); cell.setValue("Reason:"); cell = row.getCells().newCell(getColumn(TEXT_COL), DynamicCellType.STRING, item !=null?DynamicGridCellOptions.READ_ONLY_DATA_CELL:DynamicGridCellOptions.EDITABLE_DATA_CELL); setCellMaxLength(item, cell); if(item != null) { if(item.getSpecimenIsNotNull() && item.getSpecimen().getCollectorCommentIsNotNull()) { cell.setValue(item.getSpecimen().getCollectorComment()); cell.setTooltip(item.getSpecimen().getCollectorComment()); } } }
public int compare(Object arg0, Object arg1) { final int EQUAL = 0; final int AFTER = 1; SpecimenWorkListItemListVo voObj1 = (SpecimenWorkListItemListVo) arg0; SpecimenWorkListItemListVo voObj2 = (SpecimenWorkListItemListVo) arg1; Date startDateToCollect = voObj1.getDateToCollect(); Date endDateToCollect = voObj2.getDateToCollect(); Time startTimeToCollect = voObj1.getTimeToCollect(); Time endTimeToCollect = voObj2.getTimeToCollect(); if(startDateToCollect != null && endDateToCollect != null) { //Covers only equal dates and null time (Date Time sort moved into hql query) if(startDateToCollect.equals(endDateToCollect)) { if(startTimeToCollect == null && endTimeToCollect != null) { return AFTER; } } } return EQUAL; }
protected void onBtnPrintClick() throws PresentationLogicException { form.getLocalContext().setContextDummyForReportsLabel(null); form.getLocalContext().setContextDummyForReportsScreen(null); if(form.dyngrdCollect().getRows().size() == 0) { engine.showMessage("There is no data to print"); return; } SpecimenWorkListItemListVoCollection voColl = getWorkListItemsToprint(); if(voColl != null && voColl.size() != 0) { SpecimenWorkListItemListVo dummy = new SpecimenWorkListItemListVo(); dummy.setID_SpecimenWorkListItem(new Integer(-1)); form.getLocalContext().setContextDummyForReportsLabel(dummy); } form.getGlobalContext().Core.setPrepareForPrinting(Boolean.TRUE); engine.open(form.getForms().Core.PrintReport); }
private SpecimenWorkListItemListVoCollection getWorkListItemsToprint() { SpecimenWorkListItemListVoCollection voColl = new SpecimenWorkListItemListVoCollection(); for (int i = 0; i < form.dyngrdCollect().getRows().size(); i++) { for (int j = 0; j < form.dyngrdCollect().getRows().get(i).getRows().size(); j++) { for (int k = 0; k < form.dyngrdCollect().getRows().get(i).getRows().get(j).getRows().size(); k++) { DynamicGridCell printCell = form.dyngrdCollect().getRows().get(i).getRows().get(j).getRows().get(k).getCells().get(getColumn(PRINT_COL)); if(printCell != null && printCell.getValue() != null && printCell.getValue().equals(PrintStatus.FORPRINTING)) { voColl.add((SpecimenWorkListItemListVo) form.dyngrdCollect().getRows().get(i).getRows().get(j).getRows().get(k).getValue()); } } } } return voColl; }
private void refreshDataInGrid(SpecimenWorkListItemListVoCollection voColl) { for (int i = 0; i < form.dyngrdCollect().getRows().size(); i++) { for (int j = 0; j < form.dyngrdCollect().getRows().get(i).getRows().size(); j++) { for (int k = 0; k < form.dyngrdCollect().getRows().get(i).getRows().get(j).getRows().size(); k++) { DynamicGridRow row = form.dyngrdCollect().getRows().get(i).getRows().get(j).getRows().get(k); DynamicGridCell printCell = row.getCells().get(getColumn(PRINT_COL)); if(printCell != null && printCell.getValue() != null && printCell.getValue().equals(PrintStatus.FORPRINTING)) { loadPrintedStatus(printCell, true); printCell.setValue(PrintStatus.PRINTED); //Set the value of the row with a new one (otherwise will get a Stale Object Exception when saving) SpecimenWorkListItemListVo voNewSavedValue = getNewValueFromSavedList(row.getValue(), voColl); if(voNewSavedValue != null) row.setValue(voNewSavedValue); } } } } }
private void createControlsForNotCollection(DynamicGridRow row, SpecimenWorkListItemListVo item) { clearVariableCells(row); DynamicGridCell cell = row.getCells().newCell(getColumn(DATE_COL), DynamicCellType.LABEL, DynamicGridCellOptions.READ_ONLY_DATA_CELL); cell = row.getCells().newCell(getColumn(TIME_COL), DynamicCellType.LABEL, DynamicGridCellOptions.READ_ONLY_DATA_CELL); cell = row.getCells().newCell(getColumn(QUERY_COL), DynamicCellType.LABEL, DynamicGridCellOptions.LABEL_CELL); cell.setValue("Reason:"); cell = row.getCells().newCell(getColumn(TEXT_COL), DynamicCellType.STRING, DynamicGridCellOptions.EDITABLE_DATA_CELL); setCellMaxLength(item, cell); if(item != null) { if(item.getSpecimenIsNotNull() && item.getSpecimen().getCollectorCommentIsNotNull()) { cell.setValue(item.getSpecimen().getCollectorComment()); cell.setTooltip(item.getSpecimen().getCollectorComment()); } } }
private Object getIdentifier(SpecimenWorkListItemListVo item) { String patIdValue = ""; String patIdentifier = ConfigFlag.UI.DISPLAY_PATID_TYPE.getValue(); PatIdType patIdType = PatIdType.getNegativeInstance(patIdentifier); if (patIdType != null) { PatientIdCollection patIdsColl = null; //WDEV-16232 if (item.getSpecimenIsNotNull() && item.getSpecimen().getOrderIsNotNull() && item.getSpecimen().getOrder().getPatientIsNotNull()) patIdsColl = item.getSpecimen().getOrder().getPatient().getIdentifiers(); else if (item.getDFTOrderInvestigationIsNotNull() && item.getDFTOrderInvestigation().getOrderDetailsIsNotNull() && item.getDFTOrderInvestigation().getOrderDetails().getPatientIsNotNull()) patIdsColl = item.getDFTOrderInvestigation().getOrderDetails().getPatient().getIdentifiers(); for (int i = 0; patIdsColl != null && i < patIdsColl.size(); i++) { if (patIdsColl.get(i).getTypeIsNotNull() && patIdsColl.get(i).getType().equals(patIdType)) { patIdValue = patIdsColl.get(i).getValue(); break; } } } return patIdType.toString() + " " + patIdValue; }
private void createControlsForNotCollection(DynamicGridRow row, SpecimenWorkListItemListVo item) { clearVariableCells(row); DynamicGridCell cell = row.getCells().newCell(getColumn(DATE_COL), DynamicCellType.LABEL, DynamicGridCellOptions.READ_ONLY_DATA_CELL); cell = row.getCells().newCell(getColumn(TIME_COL), DynamicCellType.LABEL, DynamicGridCellOptions.READ_ONLY_DATA_CELL); cell = row.getCells().newCell(getColumn(QUERY_COL), DynamicCellType.LABEL, DynamicGridCellOptions.LABEL_CELL); getColumn(QUERY_COL).setAlignment(Alignment.RIGHT); cell.setValue("Reason:"); cell = row.getCells().newCell(getColumn(TEXT_COL), DynamicCellType.STRING, item != null ? DynamicGridCellOptions.READ_ONLY_DATA_CELL : DynamicGridCellOptions.EDITABLE_DATA_CELL); setCellMaxLength(item, cell); if (item != null) { if (item.getSpecimenIsNotNull() && item.getSpecimen().getCollectorCommentIsNotNull()) { cell.setValue(item.getSpecimen().getCollectorComment()); cell.setTooltip(item.getSpecimen().getCollectorComment()); } } }
private void enableContextMenu() { boolean isRowEditable = false; boolean isAtLeastOneActivePhlebMayCollect = false; DynamicGridRow row = form.dyngrdCollect().getSelectedRow(); if (specimenSelected(row)) { SpecimenWorkListItemListVo specimenWorkListItemListVo = ((SpecimenWorkListItemListVo) row.getValue()); isRowEditable = isRowEditable(specimenWorkListItemListVo.getCollectionStatus()); // WDEV-2281 Boolean isAtLeasOneActive = domain.isAtLeastOneActivePhlebMayCollect(specimenWorkListItemListVo); isAtLeastOneActivePhlebMayCollect = isAtLeasOneActive != null ? isAtLeasOneActive.booleanValue() : false; } form.getContextMenus().getOutpatientPhlebotomyMoveToPhlebotomyItem().setVisible(isRowEditable && isAtLeastOneActivePhlebMayCollect); }
private SpecimenWorkListItemListVoCollection getWorkListItemsToprint() { SpecimenWorkListItemListVoCollection voColl = new SpecimenWorkListItemListVoCollection(); for (int i = 0; i < form.dyngrdCollect().getRows().size(); i++) { for (int j = 0; j < form.dyngrdCollect().getRows().get(i).getRows().size(); j++) { for (int k = 0; k < form.dyngrdCollect().getRows().get(i).getRows().get(j).getRows().size(); k++) { DynamicGridCell printCell = form.dyngrdCollect().getRows().get(i).getRows().get(j).getRows().get(k).getCells().get(getColumn(PRINT_COL)); if (printCell != null && printCell.getValue() != null && printCell.getValue().equals(PrintStatus.FORPRINTING)) { voColl.add((SpecimenWorkListItemListVo) form.dyngrdCollect().getRows().get(i).getRows().get(j).getRows().get(k).getValue()); } } } } return voColl; }
private void refreshDataInGrid(SpecimenWorkListItemListVoCollection voColl) { for (int i = 0; i < form.dyngrdCollect().getRows().size(); i++) { for (int j = 0; j < form.dyngrdCollect().getRows().get(i).getRows().size(); j++) { for (int k = 0; k < form.dyngrdCollect().getRows().get(i).getRows().get(j).getRows().size(); k++) { DynamicGridRow row = form.dyngrdCollect().getRows().get(i).getRows().get(j).getRows().get(k); DynamicGridCell printCell = row.getCells().get(getColumn(PRINT_COL)); if (printCell != null && printCell.getValue() != null && printCell.getValue().equals(PrintStatus.FORPRINTING)) { loadPrintedStatus(printCell, true); printCell.setValue(PrintStatus.PRINTED); // Set the value of the row with a new one (otherwise // will get a Stale Object Exception when saving) SpecimenWorkListItemListVo voNewSavedValue = getNewValueFromSavedList(row.getValue(), voColl); if (voNewSavedValue != null) row.setValue(voNewSavedValue); } } } } }
private String getHeaderTitle(SpecimenWorkListItemListVo item) { StringBuffer sb = new StringBuffer(); sb.append("Date Required: "); sb.append(item.getDateToCollectIsNotNull() ? item.getDateToCollect().toString() : ""); sb.append(" - Responsible Clinician: "); if(item.getSpecimenIsNotNull() && item.getSpecimen().getOrderIsNotNull() && item.getSpecimen().getOrder().getResponsibleClinicianIsNotNull() && item.getSpecimen().getOrder().getResponsibleClinician().getMosIsNotNull() && item.getSpecimen().getOrder().getResponsibleClinician().getMos().getName() != null) { sb.append(item.getSpecimen().getOrder().getResponsibleClinician().getMos().getName().toString()); } else if(item.getSpecimen() == null && item.getDFTOrderInvestigation() != null && item.getDFTOrderInvestigation().getOrderDetails() != null && item.getDFTOrderInvestigation().getOrderDetails().getResponsibleClinician() != null && item.getDFTOrderInvestigation().getOrderDetails().getResponsibleClinician().getMos() != null && item.getDFTOrderInvestigation().getOrderDetails().getResponsibleClinician().getMos().getName() != null) { sb.append(item.getDFTOrderInvestigation().getOrderDetails().getResponsibleClinician().getMos().getName().toString()); } return sb.toString(); }
private boolean saveVos(SpecimenWorkListItemListVo voItem, SpecimenWorkListItemListVo voPrevItem) { String[] errors = voPrevItem.validate(voItem.validate(getUiErrors(voItem.getListType(), voItem))); if(errors != null) { engine.showErrors(errors); return false; } try { SpecimenWorkListItemListVo voPrevItemSaved = domain.saveWorkListItem(voItem, voPrevItem); form.getGlobalContext().OCRR.setSpecimenWorkListItemList(voPrevItemSaved); } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); return true;//WDEV-16708 } return true; }
public SpecimenWorkListItemListVo saveWorkListItem(SpecimenWorkListItemListVo orderSpecimenVo) throws StaleObjectException { if(orderSpecimenVo == null) throw new CodingRuntimeException("Cannot save null SpecimenWorkListItemListVo"); DomainFactory factory = getDomainFactory(); SpecimenWorkListItem doSpecimenWorkListItem = SpecimenWorkListItemListVoAssembler.extractSpecimenWorkListItem(factory, orderSpecimenVo); if(orderSpecimenVo.getCollectionStatusIsNotNull() && orderSpecimenVo.getCollectionStatus().equals(SpecimenCollectionStatus.COLLECTIONCOMPLETE) && doSpecimenWorkListItem.getSpecimen() != null) { java.util.Set investigations = doSpecimenWorkListItem.getSpecimen().getInvestigations(); for (java.util.Iterator iter = investigations.iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof OrderInvestigation) { OrderInvestigation element = (OrderInvestigation) obj; element.setDisplayDateTime(orderSpecimenVo.getSpecimen().getCollDateTimePlacer().getJavaDate()); element.setDisplayFlag(getDomLookup(OcsDisplayFlag.SPEC_COLL)); } } } factory.save(doSpecimenWorkListItem); return SpecimenWorkListItemListVoAssembler.create(doSpecimenWorkListItem); }
public SpecimenWorkListItemListVo saveWorkListItem(SpecimenWorkListItemListVo orderSpecimenVo) throws StaleObjectException { if (orderSpecimenVo == null) throw new CodingRuntimeException("Cannot save null SpecimenWorkListItemListVo"); DomainFactory factory = getDomainFactory(); SpecimenWorkListItem doSpecimenWorkListItem = SpecimenWorkListItemListVoAssembler.extractSpecimenWorkListItem(factory, orderSpecimenVo); if(doSpecimenWorkListItem.getSpecimen()!=null && orderSpecimenVo.getCollectionStatusIsNotNull() && orderSpecimenVo.getCollectionStatus().equals(SpecimenCollectionStatus.COLLECTIONCOMPLETE)) { java.util.Set investigations = doSpecimenWorkListItem.getSpecimen().getInvestigations(); for (java.util.Iterator iter = investigations.iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof OrderInvestigation) { OrderInvestigation element = (OrderInvestigation) obj; element.setDisplayDateTime(orderSpecimenVo.getSpecimen().getCollDateTimePlacer().getJavaDate()); element.setDisplayFlag(getDomLookup(OcsDisplayFlag.SPEC_COLL)); } } } factory.save(doSpecimenWorkListItem); return SpecimenWorkListItemListVoAssembler.create(doSpecimenWorkListItem); }
private String getInvestigationName(SpecimenWorkListItemListVo specimen) { String investigationName = ""; if (specimen.getSpecimenIsNotNull()) { for (int j = 0; specimen.getSpecimen().getInvestigationsIsNotNull() && j < specimen.getSpecimen().getInvestigations().size(); j++) { if (specimen.getSpecimen().getInvestigations().get(j).getInvestigationIsNotNull() && specimen.getSpecimen().getInvestigations().get(j).getInvestigation().getInvestigationIndexIsNotNull() && specimen.getSpecimen().getInvestigations().get(j).getInvestigation().getInvestigationIndex().getName() != null) { investigationName = (investigationName != "" ? investigationName + ", " + specimen.getSpecimen().getInvestigations().get(j).getInvestigation().getInvestigationIndex().getName() : specimen.getSpecimen().getInvestigations().get(j).getInvestigation().getInvestigationIndex().getName()); } } return investigationName; } else if (specimen.getDFTOrderInvestigationIsNotNull() && specimen.getDFTOrderInvestigation().getInvestigationIsNotNull() && specimen.getDFTOrderInvestigation().getInvestigation().getInvestigationIndexIsNotNull() && specimen.getDFTOrderInvestigation().getInvestigation().getInvestigationIndex().getNameIsNotNull()) { investigationName = specimen.getDFTOrderInvestigation().getInvestigation().getInvestigationIndex().getName(); return investigationName; } return investigationName; }
private String getPatientName(SpecimenWorkListItemListVo specimen) { String patientName = ""; String surename = ""; String forename = ""; if (specimen.getSpecimenIsNotNull() && specimen.getSpecimen().getOrderIsNotNull() && specimen.getSpecimen().getOrder().getPatientIsNotNull() && specimen.getSpecimen().getOrder().getPatient().getNameIsNotNull()) { forename = specimen.getSpecimen().getOrder().getPatient().getName().getForename(); surename = specimen.getSpecimen().getOrder().getPatient().getName().getSurname(); patientName = (forename != null ? surename + " " + forename : surename); return patientName; } else if (specimen.getDFTOrderInvestigationIsNotNull() && specimen.getDFTOrderInvestigation().getOrderDetailsIsNotNull() && specimen.getDFTOrderInvestigation().getOrderDetails().getPatientIsNotNull() && specimen.getDFTOrderInvestigation().getOrderDetails().getPatient().getNameIsNotNull()) { forename = specimen.getDFTOrderInvestigation().getOrderDetails().getPatient().getName().getForename(); surename = specimen.getDFTOrderInvestigation().getOrderDetails().getPatient().getName().getSurname(); patientName = (forename != null ? surename + " " + forename : surename); return patientName; } return patientName; }
public SpecimenWorkListItemListVo saveWorkListItem(SpecimenWorkListItemListVo orderSpecimenVo) throws StaleObjectException { if(orderSpecimenVo == null) throw new CodingRuntimeException("Cannot save null SpecimenWorkListItemListVo"); DomainFactory factory = getDomainFactory(); SpecimenWorkListItem doSpecimenWorkListItem = SpecimenWorkListItemListVoAssembler.extractSpecimenWorkListItem(factory, orderSpecimenVo); if(orderSpecimenVo.getCollectionStatusIsNotNull() && orderSpecimenVo.getCollectionStatus().equals(SpecimenCollectionStatus.COLLECTIONCOMPLETE)) { java.util.Set investigations = doSpecimenWorkListItem.getSpecimen().getInvestigations(); for (java.util.Iterator iter = investigations.iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof OrderInvestigation) { OrderInvestigation element = (OrderInvestigation) obj; element.setDisplayDateTime(orderSpecimenVo.getSpecimen().getCollDateTimePlacer().getJavaDate()); element.setDisplayFlag(getDomLookup(OcsDisplayFlag.SPEC_COLL)); } } } factory.save(doSpecimenWorkListItem); return SpecimenWorkListItemListVoAssembler.create(doSpecimenWorkListItem); }