private VaccineLiteVoCollection filterExistingVaccines(VaccineLiteVoCollection coll) { VaccineLiteVoCollection newVaccinesColl = new VaccineLiteVoCollection(); if(form.grdSelectedItems().getRows().size() == 0) return coll; coll.sort(SortOrder.ASCENDING); for(int j=0; j<coll.size(); j++) { boolean vaccineFound = false; for(int i=0; i<form.grdSelectedItems().getRows().size(); i++) { if(coll.get(j).equals((VaccineLiteVo) form.grdSelectedItems().getRows().get(i).getValue())) { vaccineFound = true; break; } } if(!vaccineFound) { newVaccinesColl.add(coll.get(j)); } } return newVaccinesColl; }
public VaccineLiteVoCollection listVaccine(String filter) throws DomainInterfaceException { VaccineLiteVoCollection coll = new VaccineLiteVoCollection(); IGenericItem[] items = listIGenericItems(filter, CciType.VACCINE, true); if (items != null) { for ( int i = 0; i < items.length; i++) { coll.add((VaccineLiteVo)items[i]); } return coll; } return null; }
public VaccineManufacturerBatchVoCollection listBatchVaccine(String batchNumber, VaccineLiteVo vaccine) throws DomainInterfaceException { if (batchNumber == null) throw new DomainInterfaceException("Can not search for batch vaccines after an empty batch number"); if (vaccine == null) throw new DomainInterfaceException("Can not search for batch vaccines with no selected vaccine"); DomainFactory factory = getDomainFactory(); String query = "from VaccineManufacturerBatch as vmb where vmb.vaccine.id = :ID and UPPER(vmb.batchNumber) like :BATCHNUMBER and vmb.status.id = -617"; ArrayList<String> markers = new ArrayList<String>(); markers.add("ID"); markers.add("BATCHNUMBER"); ArrayList<Object> values = new ArrayList<Object>(); values.add(vaccine.getID_Vaccine()); values.add("%" + batchNumber.toUpperCase() +"%"); return VaccineManufacturerBatchVoAssembler.createVaccineManufacturerBatchVoCollectionFromVaccineManufacturerBatch(factory.find(query, markers, values)); }
private void populateGrid(VaccineManufacturerBatchVoCollection listVaccineBatch) { boolean existParent = false; for(int i=0; i<listVaccineBatch.size(); i++) { existParent = false; for(int j=0; j<form.grdBatchList().getRows().size(); j++) { if(form.grdBatchList().getRows().get(j).getValue() instanceof VaccineLiteVo && form.grdBatchList().getRows().get(j).getValue().compareTo(listVaccineBatch.get(i).getVaccine()) == 0) { newChildNode(form.grdBatchList().getRows().get(j), listVaccineBatch.get(i)); existParent = true; break; } } if(existParent == false) { newParentNode(listVaccineBatch.get(i)); } } form.grdBatchList().resetScrollPosition(); }
@Override protected void onGrdBatchListRowExpandCollapse(grdBatchListRow row) throws PresentationLogicException { if(row.getValue() instanceof VaccineLiteVo && !row.isExpanded() && form.grdBatchList().getSelectedRow() != null) { for(int i=0; i<row.getRows().size(); i++) { if(row.getRows().get(i).getValue() != null && row.getRows().get(i).getValue().equals(form.grdBatchList().getSelectedRow().getValue())) { form.grdBatchList().setValue(null); form.getLocalContext().setlastRecord(null); updateControlState(); clearScreen(); break; } } } }
protected void onBtnOKClick() throws ims.framework.exceptions.PresentationLogicException { if(form.grdSelectedItems().getRows().size() == 0) { engine.showMessage("No items were selected."); return; } ProcedureLiteVoCollection procColl = new ProcedureLiteVoCollection(); DiagLiteVoCollection diagColl = new DiagLiteVoCollection(); ClinicalProblemShortVoCollection probColl = new ClinicalProblemShortVoCollection(); VaccineLiteVoCollection vaccColl = new VaccineLiteVoCollection(); for (int j = 0; j < form.grdSelectedItems().getRows().size(); j++) { grdSelectedItemsRow selRow = form.grdSelectedItems().getRows().get(j); if(selRow.getValue() instanceof ProcedureLiteVo) procColl.add((ProcedureLiteVo)selRow.getValue()); else if(selRow.getValue() instanceof DiagLiteVo) diagColl.add((DiagLiteVo)selRow.getValue()); else if(selRow.getValue() instanceof ClinicalProblemShortVo) probColl.add((ClinicalProblemShortVo)selRow.getValue()); else if(selRow.getValue() instanceof VaccineLiteVo) vaccColl.add((VaccineLiteVo) selRow.getValue()); } if(form.getGlobalContext().Clinical.getPMHConfigSearchTypeIsNotNull() && form.getGlobalContext().Clinical.getPMHConfigSearchType().equalsIgnoreCase("P")) form.getGlobalContext().Clinical.setSelectedProcedures(procColl); else if(form.getGlobalContext().Clinical.getPMHConfigSearchTypeIsNotNull() && form.getGlobalContext().Clinical.getPMHConfigSearchType().equalsIgnoreCase("D")) form.getGlobalContext().Clinical.setSelectedDiagnosis(diagColl); else if(form.getGlobalContext().Clinical.getPMHConfigSearchTypeIsNotNull() && form.getGlobalContext().Clinical.getPMHConfigSearchType().equalsIgnoreCase("PR")) form.getGlobalContext().Clinical.setSelectedProblems(probColl); else if(form.getGlobalContext().Clinical.getPMHConfigSearchTypeIsNotNull() && form.getGlobalContext().Clinical.getPMHConfigSearchType().equalsIgnoreCase("VACCINE")) form.getGlobalContext().Clinical.CCISearch.setSelectedVaccines(vaccColl); engine.close(DialogResult.OK); }
private void updateVaccinesToSelectedStageConfiguration() { VaccineLiteVoCollection vaccineVoCollection = form.getGlobalContext().Clinical.CCISearch.getSelectedVaccines(); // If the collection is null or empty - set the current vaccines to null if (vaccineVoCollection == null || vaccineVoCollection.size() == 0) { if (form.ctnScheduleConfiguration().dyngrdStageConfiguration().getValue() instanceof StageConfigurationVo) if (form.ctnScheduleConfiguration().dyngrdStageConfiguration().getSelectedRow() != null) setDynamicGridRowsStageVaccineCollection(form.ctnScheduleConfiguration().dyngrdStageConfiguration().getSelectedRow(), null); return; } StageVaccineVoCollection stageVaccineVoCollection = new StageVaccineVoCollection(); for (int i = 0; i < vaccineVoCollection.size(); i++) { VaccineLiteVo vaccineVo = vaccineVoCollection.get(i); if (vaccineVo != null) { StageVaccineVo stageVaccineVo = new StageVaccineVo(); stageVaccineVo.setVaccine(vaccineVo); stageVaccineVoCollection.add(stageVaccineVo); } } if (form.ctnScheduleConfiguration().dyngrdStageConfiguration().getValue() != null) { if (form.ctnScheduleConfiguration().dyngrdStageConfiguration().getValue() instanceof StageConfigurationVo) { ((StageConfigurationVo) form.ctnScheduleConfiguration().dyngrdStageConfiguration().getValue()).setStageVaccines(stageVaccineVoCollection); setDynamicGridRowsStageVaccineCollection(form.ctnScheduleConfiguration().dyngrdStageConfiguration().getSelectedRow(), stageVaccineVoCollection); } } }
private void seachVaccine(String value) { if (value == null || value.length() < 3) { engine.showMessage("Please enter at least 3 characters for search criteria"); return; } VaccineLiteVoCollection coll = null; try { coll = domain.listVaccineByName(value); } catch (DomainInterfaceException e) { e.printStackTrace(); } form.ctnBatchDetails().qmbName().setValue(null); form.ctnBatchDetails().qmbName().clear(); if (coll != null) { for (int i = 0; i < coll.size(); i++) { VaccineLiteVo vo = coll.get(i); form.ctnBatchDetails().qmbName().newRow(vo, vo.getVaccineName()); } } if (coll.size() == 1) { form.ctnBatchDetails().qmbName().setValue(coll.get(0)); } else if (coll.size() > 1) { form.ctnBatchDetails().qmbName().showOpened(); } }
@Override protected void onQmbBatchNumberTextSubmited(String value) throws PresentationLogicException { // Check for a vaccine if (form.ctnVaccineDetails().cmbVaccine().getValue() == null) { engine.showMessage("Please select a vaccine to search batch for", "PCI - Error"); return; } // Check for a valid vaccine VO if (form.ctnVaccineDetails().cmbVaccine().getValue().getStageVaccine() == null) throw new CodingRuntimeException("Logical error - the selected vaccine is not properly populated"); // Get vaccine to search for VaccineLiteVo vaccine = form.ctnVaccineDetails().cmbVaccine().getValue().getStageVaccine().getVaccine(); // Populate combobox with vaccine batches try { VaccineManufacturerBatchVoCollection listBatchVaccine = domain.listBatchVaccine(form.ctnVaccineDetails().qmbBatchNumber().getEditedText(), vaccine); if (form.ctnVaccineDetails().qmbBatchNumber().getValue() != null && listBatchVaccine.indexOf(form.ctnVaccineDetails().qmbBatchNumber().getValue()) == -1) listBatchVaccine.add(form.ctnVaccineDetails().qmbBatchNumber().getValue()); if (form.dyngrdStages().getValue() instanceof ClientScheduleStageVaccineVo) { ClientScheduleStageVaccineVo vaccineVo = (ClientScheduleStageVaccineVo)form.dyngrdStages().getValue(); VaccineManufacturerBatchVo batchVaccine = domain.getBatchVaccine(vaccineVo.getBatchNumber()); if (batchVaccine != null && listBatchVaccine.indexOf(batchVaccine) == -1) { listBatchVaccine.add(0, batchVaccine); } } populateBatchVaccine(listBatchVaccine); } catch (DomainInterfaceException e) { engine.showMessage(e.getMessage(), "PCI - Error"); return; } }
private StageVaccineVo getDynamicGridRowStageVaccine(DynamicGridRow row, StageVaccineVo stageVaccine) { if (row == null) throw new CodingRuntimeException("Major Logical Error - Can not retrieve a vaccine from a null row"); if (row.getValue() != null && !(row.getValue() instanceof StageVaccineVo)) throw new CodingRuntimeException("Major Logical Error - Can not retrieve data from a non stage vaccine row"); if (stageVaccine == null) stageVaccine = new StageVaccineVo(); // Column and cell identifier DynamicGridColumn column; DynamicGridCell cell; // First cell (Vaccine) column = form.ctnScheduleConfiguration().dyngrdStageConfiguration().getColumns().getByIdentifier(COL_STAGE_VACCINENAME); cell = row.getCells().get(column); stageVaccine.setVaccine((VaccineLiteVo) cell.getIdentifier()); // Second cell (Shot number) column = form.ctnScheduleConfiguration().dyngrdStageConfiguration().getColumns().getByIdentifier(COL_AGE_SHOTNO); cell = row.getCells().get(column); stageVaccine.setShotNo((Integer) cell.getValue()); // Third cell (PCRS Code) column = form.ctnScheduleConfiguration().dyngrdStageConfiguration().getColumns().getByIdentifier(COL_VACCINES_PCRSCODE); cell = row.getCells().get(column); stageVaccine.setPcrsCode((String) cell.getValue()); // Fourth cell (Driver) column = form.ctnScheduleConfiguration().dyngrdStageConfiguration().getColumns().getByIdentifier(COL_DRIVER); cell = row.getCells().get(column); stageVaccine.setDriver(DATA_MIGRATION.equals(form.ctnScheduleConfiguration().txtScheduleName().getValue()) ? null : (((Boolean) cell.getValue()) == null ? false : ((Boolean) cell.getValue()))); stageVaccine.setIntervalMonths(DATA_MIGRATION.equals(form.ctnScheduleConfiguration().txtScheduleName().getValue()) ? null : getIntervalMonths(cell)); // Fifth cell (Can be rescheduled) column = form.ctnScheduleConfiguration().dyngrdStageConfiguration().getColumns().getByIdentifier(COL_RESCHEDULE); cell = row.getCells().get(column); stageVaccine.setCanBeRescheduled(((Boolean) cell.getValue()) == null ? false : ((Boolean) cell.getValue())); // Six cell (Last shot) column = form.ctnScheduleConfiguration().dyngrdStageConfiguration().getColumns().getByIdentifier(COL_LAST_SHOT); cell = row.getCells().get(column); stageVaccine.setIsLastShotForVaccine(((Boolean) cell.getValue()) == null ? false : ((Boolean) cell.getValue())); return stageVaccine; }