private String buildPracticeDisplayData(GpPracticeLiteVo practice, boolean showLabels) { if (practice == null) return ""; String displayData = ""; if (showLabels) { displayData = "Practice: " + practice.getName() + (practice.getAddressIsNotNull() && practice.getAddress().toDisplayString() != null && practice.getAddress().toDisplayString().length() > 0 ? "<br/>Address: " + practice.getAddress().toDisplayString() : ""); } else { displayData = practice.getName() + (practice.getAddressIsNotNull() && practice.getAddress().toDisplayString() != null && practice.getAddress().toDisplayString().length() > 0 ? "<br/>" + practice.getAddress().toDisplayString() : ""); } if (displayData.contains(",") && displayData.substring(displayData.lastIndexOf(",") + 1, displayData.length()).trim().length() == 0) { displayData = displayData.substring(0, displayData.lastIndexOf(",")); } return displayData; }
private void filterSurgeriesForAddress(GPSearchCriteriaVo filter, GpPracticeLiteVo practWithSurg) //WDEV-18377 { if (practWithSurg.getSurgeriesIsNotNull() && practWithSurg.getSurgeries().size() >0 && ConfigFlag.DOM.GP_USE_SURGERIES.getValue()) { for (int j=practWithSurg.getSurgeries().size()-1; j>=0;j--) { if (practWithSurg.getSurgeries().get(j) == null) continue; if (!isSurgeryValidforAddress(filter, practWithSurg.getSurgeries().get(j))) { practWithSurg.getSurgeries().remove(j); } } } }
private boolean isPracticeValidforAddress(GPSearchCriteriaVo filter, GpPracticeLiteVo practice) { if (practice != null && filter.getAddressContains() != null && filter.getAddressContains().length() > 0) { if (practice.getIsActiveIsNotNull() && Boolean.TRUE.equals(practice.getIsActive()) && ((practice.getNameIsNotNull() && practice.getName().toUpperCase().contains(filter.getAddressContains().replaceAll("%", "").toUpperCase())) || //WDEV-18828 (practice.getAddressIsNotNull() && (practice.getAddress().getLine1IsNotNull() && practice.getAddress().getLine1().toUpperCase().contains(filter.getAddressContains().replaceAll("%", "").toUpperCase()) || (practice.getAddress().getLine2IsNotNull()&& practice.getAddress().getLine2().toUpperCase().contains(filter.getAddressContains().replaceAll("%", "").toUpperCase())) || (practice.getAddress().getLine3IsNotNull()&& practice.getAddress().getLine3().toUpperCase().contains(filter.getAddressContains().replaceAll("%", "").toUpperCase())) || (practice.getAddress().getLine4IsNotNull() && practice.getAddress().getLine4().toUpperCase().contains(filter.getAddressContains().replaceAll("%", "").toUpperCase())) || (practice.getAddress().getLine5IsNotNull() && practice.getAddress().getLine5().toUpperCase().contains(filter.getAddressContains().replaceAll("%", "").toUpperCase())) || (practice.getAddress().getPostCodeIsNotNull() && practice.getAddress().getPostCode().replace(" ", "").toUpperCase().equals(filter.getAddressContains().replaceAll("%", "").replace(" ", "").toUpperCase())))))) { return true; } } return false; }
private void populateSurgeriesInGrid(GPLiteWithPracticesVo voGpWithPractice, GpPracticeLiteVo gppractice, DynamicGridRow row) { String gMCCode = null; if (voGpWithPractice != null) { if(voGpWithPractice.getCodeMappingsIsNotNull()) { gMCCode = voGpWithPractice.getCodeMappings().getMappingValue(TaxonomyType.NAT_GP_CODE); } } if (gppractice.getSurgeries() != null && gppractice.getSurgeries().size() > 0) { LocSiteShortVoCollection heartsSurgeries = getHeartsSurgery(gppractice.getSurgeries(), gMCCode); if (heartsSurgeries != null && heartsSurgeries.size() > 0) { populateSurgeriesFromCollection(voGpWithPractice, gppractice, row, heartsSurgeries); } else { populateSurgeriesFromCollection(voGpWithPractice, gppractice, row, gppractice.getSurgeries()); } } }
private boolean hasActiveSurgeries (GpPracticeLiteVo gppractice) { if (gppractice.getSurgeriesIsNotNull() && gppractice.getSurgeries().size() > 0) { for (int i=0; i<gppractice.getSurgeries().size(); i++) { if (gppractice.getSurgeries().get(i) != null && Boolean.TRUE.equals(gppractice.getSurgeries().get(i).getIsActive())) return true; } } return false; }
private void populateSurgeriesFromCollection(GPLiteWithPracticesVo voGpWithPractice, GpPracticeLiteVo gppractice, DynamicGridRow row, LocSiteShortVoCollection surgeries) { for (LocSiteShortVo surgery : surgeries) { if (surgery == null || (surgery != null && !(Boolean.TRUE.equals(surgery.getIsActive())))) continue; addSurgeryRow(voGpWithPractice, gppractice, row, surgery); row = null; } }
private void populateGPPracticeParents(GPLiteWithPracticesVo voGp) { clear(); String gMCCode=null; if (voGp != null) { if(voGp.getCodeMappingsIsNotNull()) { gMCCode=voGp.getCodeMappings().getMappingValue(TaxonomyType.NAT_GP_CODE); } if (voGp.getPractices() == null || voGp.getPractices().size() <= 0) { engine.showMessage("The GP has no associated practices."); return; } // populate the gp's practices on the tree for (int j = 0; j < voGp.getPractices().size(); j++) { GpPracticeLiteVo practice = voGp.getPractices().get(j).getPractice(); if (practice != null && practice.getIsActiveIsNotNull() && practice.getIsActive().equals(Boolean.TRUE)) { TreeNode node = form.trePracticesSurgeries().getNodes().add(practice, practice.getName() + displayPracticeAddress(practice.getAddress()), j + 1); if (ConfigFlag.DOM.GP_USE_SURGERIES.getValue()) // only list surgeries if config flag allows { node.setEnabled(false); populateSurgeryChildren(practice, node,gMCCode); } else { node.setEnabled(true); } } } form.trePracticesSurgeries().collapseAll(); } }
public GpLiteToPracticeLiteVo synchronizeGPPracticeDetails(String strGPCode) throws StaleObjectException, UniqueKeyViolationException { Gp_practice gpPracticeRecord = (Gp_practice) getDTOInstance(Gp_practice.class); gpPracticeRecord.Filter.Gp_code = strGPCode; GP voGP = null; Result gpPracticeGetResult = gpPracticeRecord.get(); if (gpPracticeGetResult != null) return null; Gp_practiceRecord gp_practice_record = gpPracticeRecord.DataCollection.get(0); OrganisationVo voSavedPractice = null; if (gpPracticeGetResult == null && gp_practice_record != null) { // Extract the organisation which is in effect the practice and the location site // which is in effect the surgery and synchronise them withthe current date. // If the Practice is in csp, get it and populate from dto, otherwise just populate from dto. try { voSavedPractice = saveOrganisation(populatePracticeFromDTORecord(gp_practice_record)); } catch (UniqueKeyViolationException e) { // DARA TODO Comm Channels } voGP = saveGP(populateGpFromDTORecord(gp_practice_record, voSavedPractice)); GpLiteToPracticeLiteVo voGpLiteToPracticeLite = new GpLiteToPracticeLiteVo(); // Just need a get here to see if you already have a gppracticeslite record. GpPracticeLiteVo voGpPracticeLite = new GpPracticeLiteVo(); voGpPracticeLite.setAddress(voSavedPractice.getAddress()); voGpPracticeLite.setID_Organisation(voSavedPractice.getID_Organisation()); voGpPracticeLite.setIsActive(voSavedPractice.getIsActive()); voGpPracticeLite.setName(voSavedPractice.getName()); voGpPracticeLite.setType(OrganisationType.GPP); LocSiteShortVo voLocSiteShort = getLocSiteShortByTaxonomyType(gp_practice_record.Gp_practice_id, TaxonomyType.PAS); LocSiteShortVoCollection voCollLocations = new LocSiteShortVoCollection(); voCollLocations.add(voLocSiteShort); voGpPracticeLite.setSurgeries(voCollLocations); voGpLiteToPracticeLite.setGp(voGP == null ? null : voGP); voGpLiteToPracticeLite.setPractice(voGpPracticeLite); return voGpLiteToPracticeLite; } return null; }
public GpLiteToPracticeLiteVo synchronizeGPPracticeDetails(String strGPCode) throws StaleObjectException, UniqueKeyViolationException { if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue())) return null; Gp_practice gpPracticeRecord = (Gp_practice) getDTOInstance(Gp_practice.class); gpPracticeRecord.Filter.Gp_code = strGPCode; GP voGP = null; Result gpPracticeGetResult = gpPracticeRecord.get(); if (gpPracticeGetResult != null) return null; Gp_practiceRecord gp_practice_record = gpPracticeRecord.DataCollection.get(0); OrganisationVo voSavedPractice = null; if (gpPracticeGetResult == null && gp_practice_record != null) { // Extract the organisation which is in effect the practice and the location site // which is in effect the surgery and synchronise them withthe current date. // If the Practice is in csp, get it and populate from dto, otherwise just populate from dto. try { voSavedPractice = saveOrganisation(populatePracticeFromDTORecord(gp_practice_record)); } catch (UniqueKeyViolationException e) { // DARA TODO Comm Channels } voGP = saveGP(populateGpFromDTORecord(gp_practice_record, voSavedPractice)); GpLiteToPracticeLiteVo voGpLiteToPracticeLite = new GpLiteToPracticeLiteVo(); // Just need a get here to see if you already have a gppracticeslite record. GpPracticeLiteVo voGpPracticeLite = new GpPracticeLiteVo(); voGpPracticeLite.setAddress(voSavedPractice.getAddress()); voGpPracticeLite.setID_Organisation(voSavedPractice.getID_Organisation()); voGpPracticeLite.setIsActive(voSavedPractice.getIsActive()); voGpPracticeLite.setName(voSavedPractice.getName()); voGpPracticeLite.setType(OrganisationType.GPP); LocSiteShortVo voLocSiteShort = getLocSiteShortByTaxonomyType(gp_practice_record.Gp_practice_id, TaxonomyType.PAS); LocSiteShortVoCollection voCollLocations = new LocSiteShortVoCollection(); voCollLocations.add(voLocSiteShort); voGpPracticeLite.setSurgeries(voCollLocations); voGpLiteToPracticeLite.setGp(voGP == null ? null : voGP); voGpLiteToPracticeLite.setPractice(voGpPracticeLite); return voGpLiteToPracticeLite; } return null; }
private void addSurgeryRow(GPLiteWithPracticesVo voGpWithPractice,GpPracticeLiteVo gppractice, DynamicGridRow row, LocSiteShortVo surg) { if (row == null) { row = form.dynGrdGps().getRows().newRow(); if (getColumn(COL_GP_NAME) != null) { DynamicGridCell gpNameCell = row.getCells().newCell(getColumn(COL_GP_NAME), DynamicCellType.HTMLVIEW); String gpNameFormatted = "GP Name: " + voGpWithPractice.getName().toString() + "<br/>"+ (voGpWithPractice.getNationalCode() != null ? "National GP Code: " + voGpWithPractice.getNationalCode(): ""); //WDEV-18739 gpNameCell.setValue(voGpWithPractice.getName().toString() + (voGpWithPractice.getNationalCode() != null ? "<br/>" + voGpWithPractice.getNationalCode(): "")); //WDEV-18739 gpNameCell.setTooltip(gpNameFormatted); } if (getColumn(COL_GP_PRACTICE_CODE) != null) { DynamicGridCell gpCodeCell = row.getCells().newCell(getColumn(COL_GP_PRACTICE_CODE), DynamicCellType.HTMLVIEW); String practiceCodeFormatted = gppractice.getNationalCode() != null ? gppractice.getNationalCode() :"" ; gpCodeCell.setValue(practiceCodeFormatted); gpCodeCell.setTooltip(practiceCodeFormatted); } if (getColumn(COL_PRACTICE_ADDR) != null) { DynamicGridCell practAddressCell = row.getCells().newCell(getColumn(COL_PRACTICE_ADDR), DynamicCellType.HTMLVIEW); practAddressCell.setValue(buildPracticeDisplayData(gppractice, false)); practAddressCell.setTooltip(buildPracticeDisplayData(gppractice, true)); } } row.setReadOnly(Boolean.TRUE); if (getColumn(COL_SURGERY_ADDR) != null) { DynamicGridCell surgerycelladdr = row.getCells().newCell(getColumn(COL_SURGERY_ADDR), DynamicCellType.HTMLVIEW); surgerycelladdr.setValue(buildSurgeryDisplayData(surg,false)); surgerycelladdr.setTooltip(buildSurgeryDisplayData(surg,true)); } row.setIdentifier((GpRefVo)voGpWithPractice); row.setValue(surg); }