private void linkGPtoPractice(GpToPracticesVoCollection coll, GP gpVo, OrganisationVo orgVo, int i, boolean bSetPrimary) throws HL7Exception,StaleObjectException { orgVo = saveOrganisation(orgVo); GpToPracticesVo link = new GpToPracticesVo(); link.setGp(gpVo); link.setPractice(orgVo); if (bSetPrimary) //only HEARTS behaviour will set this { link.setIsPrimaryPractice(true); for (int j = 0; j < coll.size(); j++) coll.get(j).setIsPrimaryPractice(false); } else if (ConfigFlag.HL7.HEARTS_GP_MODEL.getValue() == false) { // set the first practice to primary if (i == 0) link.setIsPrimaryPractice(true); else link.setIsPrimaryPractice(false); } coll.add(link); }
private boolean practiceAdded(OrganisationWithSitesVo practice) { //Don't add null value if(practice == null) return true; for (int i = 0; i < form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().size(); i++) { Object objVal = form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().get(i).getValue() ; if(objVal instanceof GpToPracticesVo) { if(practice.equals(((GpToPracticesVo)objVal).getPractice())) { return true; } } } return false; }
private DynamicGridRow getPracticeRow(OrganisationWithSitesVo practice) { //Don't add null value if(practice == null) return null; for (int i = 0; i < form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().size(); i++) { Object objVal = form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().get(i).getValue() ; if(objVal instanceof GpToPracticesVo) { if(practice.equals(((GpToPracticesVo)objVal).getPractice())) { return form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().get(i); } } } return null; }
@Override public void setPatient(Patient pat) { if(pat == null)//WDEV-22338 return; //WDEV-21256` if (pat.getGpIsNotNull()) { //set address line to primary practice if (pat.getGp().getPracticesIsNotNull()) { for (GpToPracticesVo gpPract : pat.getGp().getPractices()){ if (gpPract!=null && gpPract.getIsPrimaryPracticeIsNotNull() && gpPract.getIsPrimaryPractice()) { if (gpPract.getPracticeIsNotNull() && gpPract.getPractice().getAddressIsNotNull()) form.getLocalContext().setnofixedAbodeTown(gpPract.getPractice().getAddress().getAddressPostTown()); } } } } displayOtherAdressesAndTooltip(pat.getAddresses()); }
private OrganisationRefVo getPatientGpDefaultPractice(PatientWithGPForCCGVo patient) { if (patient == null || patient.getGp() == null || patient.getGp().getPractices() == null) return null; for (GpToPracticesVo gpToPractices : patient.getGp().getPractices()) { if (Boolean.TRUE.equals(gpToPractices.getIsPrimaryPractice())) return gpToPractices.getPractice(); } return null; }
private GpToPracticesVoCollection newGpToPracticesCollectionFromDTORecord(Gp_practiceRecord gp_practice_record, GpShortVo voGP ) { GpToPracticesVo voGpToPractice = new GpToPracticesVo(); voGpToPractice.setGp(voGP); voGpToPractice.setGpCode(gp_practice_record.Gp_code); // TODO voGpToPractice.setPractice(voGPPractice); voGpToPractice.setIsPrimaryPractice(Boolean.TRUE); GpToPracticesVoCollection voCollGpToPractices = new GpToPracticesVoCollection(); voCollGpToPractices.add(voGpToPractice); return voCollGpToPractices; }
private void updateControlsState() { if (form.getMode().equals(FormMode.EDIT)) { form.setcustomControlGpSearchEnabled(false); form.customControlGpSearch().setVisibleContextMenu(Boolean.FALSE); form.getContextMenus().getGPAdminContactsADDItem().setVisible(true); form.getContextMenus().getGPAdminContactsREMOVEItem().setVisible(form.ctnGPDetails().lyrGPDetails().tabGPDetails().grdContacts().getSelectedRowIndex() >= 0); form.getContextMenus().getGPAdminMappingsADDItem().setVisible(true); form.getContextMenus().getGPAdminMappingsREMOVEItem().setVisible(form.ctnGPDetails().lyrGPDetails().tabGPDetails().grdMappings().getSelectedRowIndex() >= 0); form.getContextMenus().getGpPracticeGridSearchAddPracticeItem().setVisible(true); form.getContextMenus().getGpPracticeGridRemovePracticeItem().setVisible((form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getValue() instanceof GpToPracticesVo || form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getValue() instanceof OrganisationWithSitesVo)); form.btnClose().setEnabled(false); form.ctnGPDetails().setCollapsed(false); form.ctnGPDetails().lyrGPDetails().tabGPDetails().cmbGPStatus().setEnabled(!engine.getFormName().equals(form.getForms().Admin.GPAdminDialog) || (engine.getFormName().equals(form.getForms().Admin.GPAdminDialog)) && (form.lnkBack().isVisible())); } else { form.setcustomControlGpSearchEnabled(true); form.customControlGpSearch().setVisibleContextMenu(Boolean.TRUE); form.btnEdit().setVisible(form.customControlGpSearch().getValue() != null); form.getContextMenus().getGPAdminContactsADDItem().setVisible(false); form.getContextMenus().getGPAdminContactsREMOVEItem().setVisible(false); form.getContextMenus().getGPAdminMappingsADDItem().setVisible(false); form.getContextMenus().getGPAdminMappingsREMOVEItem().setVisible(false); form.getContextMenus().getGpPracticeGridSearchAddPracticeItem().setVisible(false); form.getContextMenus().getGpPracticeGridRemovePracticeItem().setVisible(false); form.ctnGPDetails().setCollapsed(!(form.customControlGpSearch().getValue() != null)); form.btnClose().setEnabled(true); } }
/** * Returns a collection of all practices in the Details panel grid. * @param null * @return GpToPracticesVoCollection */ private GpToPracticesVoCollection getPractices() { GpToPracticesVoCollection voPracts = new GpToPracticesVoCollection(); for (int i = 0; i < form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().size(); i++) { Object obj = form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().get(i).getValue(); if ( obj != null && obj instanceof GpToPracticesVo) { GpToPracticesVo voGpToPractice = (GpToPracticesVo)obj; DynamicGridRow pRow = form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().get(i); if (pRow != null) { DynamicGridCell cellPrimary = pRow.getCells().get(form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getColumns().getByIdentifier(COL_PRIMARY)); if (cellPrimary != null && cellPrimary.getValue() != null && cellPrimary.getValue().equals(Boolean.TRUE)) voGpToPractice.setIsPrimaryPractice(Boolean.TRUE); else voGpToPractice.setIsPrimaryPractice(Boolean.FALSE); DynamicGridCell cellPasCode = pRow.getCells().get(form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getColumns().getByIdentifier(COL_PASCODE)); voGpToPractice.setGpCode((String)cellPasCode.getValue()); } voPracts.add(voGpToPractice); } } return voPracts; }
protected void onDyngrdPracticesCellValueChanged(DynamicGridCell cell) { if (cell.getType().getID() == DynamicCellType.BOOL.getID()) { if (cell.getValue().equals(Boolean.TRUE)) { DynamicGridRow pRow; for (int i = 0; i < form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().size();i++) { pRow = form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().get(i); DynamicGridCell cellPrimary = pRow.getCells().get(form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getColumns().getByIdentifier(COL_PRIMARY)); cellPrimary.setValue(Boolean.FALSE); //WDEV-16516 if(pRow.getValue() instanceof GpToPracticesVo) { ((GpToPracticesVo) pRow.getValue()).setIsPrimaryPractice(false); } } cell.setValue(Boolean.TRUE); //WDEV-16516 if(cell.getRow().getValue() instanceof GpToPracticesVo) { ((GpToPracticesVo) cell.getRow().getValue()).setIsPrimaryPractice(true); } } } }
private GP updateGpStatus(GP gp) { if(gp!=null) { gp.setStatus(GPStatus.INACTIVE); String gMCCode = gp.getNationalCode(); if(gp.getPracticesIsNotNull()&&gp.getPractices().size()>0 &&gMCCode!=null) { for (GpToPracticesVo gpToPracticesVo : gp.getPractices()) { if(gpToPracticesVo.getPracticeIsNotNull()&&gpToPracticesVo.getPractice().getIsActive()!=null&&gpToPracticesVo.getPractice().getIsActive()) { if(gpToPracticesVo.getPractice().getLocationSitesIsNotNull()&&gpToPracticesVo.getPractice().getLocationSites().size()>0) { for (LocSiteVo surgery : gpToPracticesVo.getPractice().getLocationSites()) { if(surgery.getIsActiveIsNotNull() && surgery.getIsActive().equals(Boolean.TRUE)&& surgery.getPasCode()!=null&& gMCCode!=null&& gMCCode.trim()!=null&& surgery.getPasCode().toUpperCase().matches("\\S+_"+gMCCode.trim().toUpperCase()+"_\\S+")) //http://jira/browse/WDEV-15535 changed filter from PAS to GMC { gp.setStatus(GPStatus.ACTIVE); break; } } } } } } } return gp; }
private boolean containsPrimary(GpToPracticesVoCollection coll) { if (coll!=null) { for (GpToPracticesVo gpToPracticesVo : coll) { if(gpToPracticesVo.getIsPrimaryPracticeIsNotNull() &&gpToPracticesVo.getIsPrimaryPractice().equals(Boolean.TRUE)) { return true; } } } return false; }
private void addPracticeRow(GpToPracticesVo voPractice) { editPracticeRow(voPractice, form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().newRow()); }
/** * Addes the given GpToPracticesVo as the next row in the practices grid. * @param GpToPracticesVo */ private void editPracticeRow(GpToPracticesVo voPractice, DynamicGridRow row) { if (voPractice != null && row != null) { DynamicGridColumn nameColumn = form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getColumns().getByIdentifier(COL_PRACTICENAME); if(nameColumn == null) return; row.setBackColor(Color.Beige); row.setBold(true); DynamicGridCell cell = row.getCells().newCell(nameColumn, DynamicCellType.STRING); String name = ""; if ( voPractice.getPracticeIsNotNull() && voPractice.getPractice().getNameIsNotNull()) name = voPractice.getPractice().getName(); cell.setValue(name); cell.setTooltip(name); cell.setWidth(300); cell.setReadOnly(true); cell = row.getCells().newCell(form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getColumns().getByIdentifier(COL_PASCODE), DynamicCellType.STRING); cell.setValue(voPractice.getGpCode()); cell.setWidth(60); cell.setIntMaxLength(40);//WDEV-15431 cell = row.getCells().newCell(form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getColumns().getByIdentifier(COL_PRIMARY), DynamicCellType.BOOL); cell.setValue(voPractice.getIsPrimaryPractice()); cell.setAutoPostBack(true); cell.setWidth(60); cell = row.getCells().newCell(form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getColumns().getByIdentifier(COL_ADDRESS), DynamicCellType.STRING); cell.setReadOnly(true);//WDEV-15431 if (voPractice.getPracticeIsNotNull() && voPractice.getPractice().getAddressIsNotNull() && voPractice.getPractice().getAddress() != null) { String strAddress = voPractice.getPractice().getAddress().toDisplayString(); if(strAddress.endsWith(",")) { strAddress = strAddress.substring(0,strAddress.length()-1); } cell.setValue(strAddress); cell.setTooltip(strAddress); cell.setWidth(-1); } row.setCollapsedImage(form.getImages().Admin.Organisation); row.setExpandedImage(form.getImages().Admin.Organisation); // if the site is using surgeries, display them on screen. otherwise, skip. if (ConfigFlag.DOM.GP_USE_SURGERIES.getValue()) { if (voPractice.getPracticeIsNotNull() && voPractice.getPractice().getLocationSitesIsNotNull()) { voPractice.getPractice().getLocationSites().sort(); for(int x = 0; x < voPractice.getPractice().getLocationSites().size(); x++) { populateSurgeries(voPractice.getPractice().getLocationSites().get(x), row); } row.setExpanded(true); } } row.setSelectable(true); row.setValue(voPractice); } }
private String getCCGCode(PatientWithGPForCCGVo patient) { if (patient == null) return null; String ccG = null; if (!Boolean.TRUE.equals(ConfigFlag.DOM.GP_USE_SURGERIES.getValue())) { // 1 - Patient.Gp.practices.practice (with isDefault).PCTCode (this is a CCG so no lookup of CCGPCTPCCodes needed) // 2 - Patient.Gp.practices.practice (with isDefault).Address.Postcode if (patient.getGp() != null && patient.getGp().getPractices() != null) { for (GpToPracticesVo gpToPractice : patient.getGp().getPractices()) { if (Boolean.TRUE.equals(gpToPractice.getIsPrimaryPractice())) { // Case 1 if (gpToPractice.getPractice() != null && gpToPractice.getPractice().getPctCode() != null && gpToPractice.getPractice().getPctCode().trim().length() > 0) return gpToPractice.getPractice().getPctCode(); // Case 2 if (gpToPractice.getPractice() != null && gpToPractice.getPractice().getAddress() != null) { ccG = getCCGCodeFromPostCode(gpToPractice.getPractice().getAddress().getPostCode()); if (ccG != null) return ccG; } } } } } // 3 - Patient.gpSurgery.address.postcode if (patient.getGpSurgery() != null && patient.getGpSurgery().getAddress() != null) { ccG = getCCGCodeFromPostCode(patient.getGpSurgery().getAddress().getPostCode()); if (ccG != null) return ccG; } // 4 - Patient.Address.Postcode if (patient.getAddress() != null) { ccG = getCCGCodeFromPostCode(patient.getAddress().getPostCode()); if (ccG != null) return ccG; } return null; }