private boolean checkForValidEndDate(DynamicGridCell cell, DynamicGridRow row) { DynamicGridCell end_dateCell = row.getCells().get(form.dyngrdOrganisationLocation().getColumns().getByIdentifier(COL_ACCREDITATION_END_DATE)); if (wasPreviousAccreditationACCREDITED(row.getValue()) && getColByIdentifier(COL_ACCREDITATION_END_DATE) != null && end_dateCell != null && end_dateCell.getValue() == null) { engine.showMessage("An Accreditation End date is required for " + ((HcpLocationVo)row.getValue()).getLocation().getName() + ". Please enter one and save.", "Missing End Date", MessageButtons.OK, MessageIcon.ERROR); if (getColByIdentifier(COL_ACCREDITATION) != null) { cell = row.getCells().get(form.dyngrdOrganisationLocation().getColumns().getByIdentifier(COL_ACCREDITATION)); if (cell != null && cell.getType().equals(DynamicCellType.ENUMERATION)) { cell.setValue(AccreditationLocationStatus.ACCREDITED); cell.setIdentifier(AccreditationLocationStatus.ACCREDITED); cell.setWidth(200); cell.setTooltip(createAccreditationHistoryTooltip(((HcpLocationVo)row.getValue()).getAccreditationHistory(), ((HcpLocationVo)row.getValue()).getCaseTypes())); } } return false; } return true; }
private AccreditationLocationStatus createAccreditationLookupInstance(LookupInstance lookupInstance) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (lookupInstance.getImage() != null) { img = new ims.framework.utils.ImagePath(lookupInstance.getImage().getImageId(), lookupInstance.getImage().getImagePath()); } color = lookupInstance.getColor(); if (color != null) color.getValue(); AccreditationLocationStatus statusInst = new AccreditationLocationStatus(lookupInstance.getId(),lookupInstance.getText(), lookupInstance.isActive(), null, img, color); return statusInst; }
private Boolean wasPreviousAccreditationACCREDITED(Object value) { if (value instanceof HcpLocationVo) { if ( ((HcpLocationVo)value).getAccreditationStatusIsNotNull() && ((HcpLocationVo)value).getAccreditationStatus().equals(AccreditationLocationStatus.ACCREDITED) ) return true; } return false; }
@Override protected void onDyngrdOrganisationLocationCellButtonClicked(DynamicGridCell cell) { form.dyngrdOrganisationLocation().setSelectedRow(cell.getRow()); DynamicGridCell cellAccreditation = cell.getRow().getCells().get(form.dyngrdOrganisationLocation().getColumns().getByIdentifier(COL_ACCREDITATION)); if (cellAccreditation.getValue() == null || (cellAccreditation.getValue() != null && ( !((AccreditationLocationStatus)cellAccreditation.getValue()).equals(AccreditationLocationStatus.RESTICT_ACCRED) && !((AccreditationLocationStatus)cellAccreditation.getValue()).equals(AccreditationLocationStatus.RESTRICT_ACCRED_REFERRING))) ) return; if (form.dyngrdOrganisationLocation().getSelectedRow() != null && form.dyngrdOrganisationLocation().getSelectedRow().getValue() != null && form.dyngrdOrganisationLocation().getSelectedRow().getValue() instanceof HcpLocationVo ) form.getGlobalContext().NTPF.setCaseTypes(((HcpLocationVo) form.dyngrdOrganisationLocation().getSelectedRow().getValue()) != null ? ((HcpLocationVo) form.dyngrdOrganisationLocation().getSelectedRow().getValue()).getCaseTypes() : null); else if (cell.getIdentifier() != null && cell.getIdentifier() instanceof CaseTypeCollection) { form.getGlobalContext().NTPF.setCaseTypes((CaseTypeCollection)cell.getIdentifier()); } else { form.getGlobalContext().NTPF.setCaseTypes(null); } engine.open(form.getForms().Admin.NTPFCaseTypeConfigDialog); }
protected void onDyngrdOrganisationLocationCellValueChanged(DynamicGridCell cell) { if (cell.getType().equals(DynamicCellType.ENUMERATION)) { DynamicGridRow row = cell.getRow(); if ( (row != null) && (row.getValue() != null) ) { form.dyngrdOrganisationLocation().setSelectedRow(row); if (cell.getValue() != null) row.setChecked(true); else row.setChecked(false); //Find the previous accreditation for this Row....if it was ACCREDITED stop and insist on an end date being saved first if (ConfigFlag.UI.MANDATORY_MOS_ACCREDITATION_STATUS.getValue()) { if (getColByIdentifier(COL_ACCREDITATION) != null && getColByIdentifier(COL_ACCREDITATION_CASETYPES) != null) { DynamicGridCell cellAccreditation = row.getCells().get(form.dyngrdOrganisationLocation().getColumns().getByIdentifier(COL_ACCREDITATION)); if (cellAccreditation.getValue() != null && (((AccreditationLocationStatus) cellAccreditation.getValue()).equals(AccreditationLocationStatus.RESTICT_ACCRED) || ((AccreditationLocationStatus) cellAccreditation.getValue()).equals(AccreditationLocationStatus.RESTRICT_ACCRED_REFERRING))) { row.getCells().newCell(getColByIdentifier(COL_ACCREDITATION_CASETYPES), DynamicCellType.BUTTON); } else { DynamicGridCell caseTypeCell = row.getCells().get(form.dyngrdOrganisationLocation().getColumns().getByIdentifier(COL_ACCREDITATION_CASETYPES)); if (caseTypeCell != null) caseTypeCell.clear(); } DynamicGridCell cellCases = row.getCells().get(form.dyngrdOrganisationLocation().getColumns().getByIdentifier(COL_ACCREDITATION_CASETYPES)); if (form.dyngrdOrganisationLocation().getSelectedRow().getValue() instanceof HcpLocationVo) { ((HcpLocationVo)form.dyngrdOrganisationLocation().getSelectedRow().getValue()).setCaseTypes(null); } else if (cellCases != null) cellCases.setIdentifier(null); } } } } }
public MedicWithLocationsVoCollection listMedicsForLocation(LocationRefVo location, CaseType caseType) { DomainFactory factory = getDomainFactory(); java.util.List medics = null; ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); String hql = "select distinct mos, hcpLoc.accreditationStatus " + " from MemberOfStaff as mos left join mos.hcp as hcp left join mos.locations as hcpLoc "; if (caseType != null) hql += " left join hcpLoc.caseTypes as casTyp "; hql += " where (hcpLoc.location.id = :idLocation and mos.isActive = :isActive and hcp.hcpType = :medical "; if (caseType != null) hql += " and ( hcpLoc.accreditationStatus in (:id1, :id4, :id5, :id6) or (casTyp.instance = :caseType and hcpLoc.accreditationStatus in (:id2, :id3) ) )"; else hql += "and hcpLoc.accreditationStatus in (:accredStat, :id4, :id5, :id6)"; hql += ")"; if (caseType != null) medics = factory.find(hql, new String[]{"idLocation","isActive", "medical", "caseType", "id1", "id2", "id3", "id4", "id5", "id6"}, new Object[]{location.getID_Location(), Boolean.TRUE, getDomLookup(HcpDisType.MEDICAL), getDomLookup(caseType), getDomLookup(AccreditationLocationStatus.ACCREDITED), getDomLookup(AccreditationLocationStatus.RESTICT_ACCRED), getDomLookup(AccreditationLocationStatus.RESTRICT_ACCRED_REFERRING), getDomLookup(AccreditationLocationStatus.ACCREDITATIONSUSPENDED), getDomLookup(AccreditationLocationStatus.NOTACCREDITED), getDomLookup(AccreditationLocationStatus.REFERRINGCONSULTANT)}); else medics = factory.find(hql, new String[]{"idLocation","isActive", "medical", "accredStat", "id4", "id5", "id6" }, new Object[]{location.getID_Location(), Boolean.TRUE, getDomLookup(HcpDisType.MEDICAL), getDomLookup(AccreditationLocationStatus.ACCREDITED), getDomLookup(AccreditationLocationStatus.ACCREDITATIONSUSPENDED), getDomLookup(AccreditationLocationStatus.NOTACCREDITED), getDomLookup(AccreditationLocationStatus.REFERRINGCONSULTANT)}); MedicWithLocationsVoCollection voCollMedic = new MedicWithLocationsVoCollection(); Iterator it = medics.iterator(); while(it.hasNext()) { MedicWithLocationsVo voMedicWithLoc = new MedicWithLocationsVo(); Object[] lstItem = (Object[]) it.next(); MemberOfStaff doMos = (MemberOfStaff) lstItem[0]; MemberOfStaffVo voMos = new MemberOfStaffVo(); MedicVo voMedic = new MedicVo(); voMos.setID_MemberOfStaff(doMos.getId()); voMedic.setID_Hcp(doMos.getHcp().getId()); ims.core.vo.PersonName pn = new ims.core.vo.PersonName(); pn.setForename(doMos.getName().getForename()); pn.setSurname(doMos.getName().getSurname()); pn.setMiddleName(doMos.getName().getMiddleName()); if (doMos.getName().getTitle() != null) pn.setTitle(LookupHelper.getPersonTitleInstance(getLookupService(),doMos.getName().getTitle().getId())); voMos.setName(pn); voMedic.setMos(voMos); voMedicWithLoc.setMedicVo(voMedic); voMedicWithLoc.setAccreditationStatus(createAccreditationLookupInstance((LookupInstance)lstItem[1])); voCollMedic.add(voMedicWithLoc); } return voCollMedic.sort(); }
public MedicWithLocationsVoCollection listReferringMedicsForLocation(LocationRefVo location) { DomainFactory factory = getDomainFactory(); java.util.List medics = null; ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); String hql = "select distinct mos, hcpLoc.accreditationStatus " + " from MemberOfStaff as mos left join mos.hcp as hcp left join mos.locations as hcpLoc "; hql += " where (hcpLoc.location.id = :idLocation and mos.isActive = :isActive and hcp.hcpType = :medical "; hql += " and ( hcpLoc.accreditationStatus in (:id1, :id2, :id3) ) )"; medics = factory.find(hql, new String[]{"idLocation","isActive", "medical", "id1", "id2", "id3"}, new Object[]{location.getID_Location(), Boolean.TRUE, getDomLookup(HcpDisType.MEDICAL), getDomLookup(AccreditationLocationStatus.ACCREDITED), getDomLookup(AccreditationLocationStatus.REFERRINGCONSULTANT), getDomLookup(AccreditationLocationStatus.RESTRICT_ACCRED_REFERRING)}); MedicWithLocationsVoCollection voCollMedic = new MedicWithLocationsVoCollection(); Iterator it = medics.iterator(); while(it.hasNext()) { MedicWithLocationsVo voMedicWithLoc = new MedicWithLocationsVo(); Object[] lstItem = (Object[]) it.next(); MemberOfStaff doMos = (MemberOfStaff) lstItem[0]; MemberOfStaffVo voMos = new MemberOfStaffVo(); MedicVo voMedic = new MedicVo(); voMos.setID_MemberOfStaff(doMos.getId()); voMedic.setID_Hcp(doMos.getHcp().getId()); ims.core.vo.PersonName pn = new ims.core.vo.PersonName(); pn.setForename(doMos.getName().getForename()); pn.setSurname(doMos.getName().getSurname()); pn.setMiddleName(doMos.getName().getMiddleName()); if (doMos.getName().getTitle() != null) pn.setTitle(LookupHelper.getPersonTitleInstance(getLookupService(),doMos.getName().getTitle().getId())); voMos.setName(pn); voMedic.setMos(voMos); voMedicWithLoc.setMedicVo(voMedic); voMedicWithLoc.setAccreditationStatus(createAccreditationLookupInstance((LookupInstance)lstItem[1])); voCollMedic.add(voMedicWithLoc); } return voCollMedic.sort(); }