private void loadCategories(boolean onlyAlertsThatCanEdited) { form.ctnDetails().cmbCategory().clear(); AlertTypeCollection coll = onlyAlertsThatCanEdited ? form.getLocalContext().getAlertsThatCanBeEdited() : form.getLocalContext().getAlertsThatCanBeViewedOrEdited(); if(coll == null) return; for(int i=0; i<coll.size(); i++) { AlertType item = coll.get(i); if(item.isActive()) form.ctnDetails().cmbCategory().newRow(item, item.getText()); } }
private boolean hasTheUserRightToCreateAlert() { IAppRole role = engine.getLoggedInRole(); IAlertsAccess[] alertsAccessList = role.getAlertsAccessList(); for(int i=0; i<alertsAccessList.length; i++) { IAlertsAccess alertAccess = alertsAccessList[i]; if(alertAccess == null) continue; if(!(alertAccess.getIAlertType() instanceof AlertType) || !(alertAccess.getIAccess() instanceof AlertAccessRights)) continue; AlertAccessRights access = (AlertAccessRights) alertAccess.getIAccess(); if(AlertAccessRights.READ_WRITE.equals(access)) { return true; } } return false; }
private String getAlertCategoryIds(AlertTypeCollection alertsType) { if(alertsType == null) return null; String ids = ""; for(int i=0; i<alertsType.size(); i++) { AlertType alertCat = alertsType.get(i); if(alertCat == null) continue; ids += (ids.length() > 0 ? "," : "") + alertCat.getID(); } return ids.length() > 0 ? ids : null; }
private void bindAlertTypeCell(DynamicGridCell cell) { ims.framework.cn.data.TreeNode[] alertsTypeColl = LookupHelper.getAlertType(domain.getLookupService()).getRootNodes(); if(alertsTypeColl == null) return; cell.getItems().clear(); for(int i=0; i<alertsTypeColl.length; i++) { if(!(alertsTypeColl[i] instanceof AlertType)) continue; AlertType item = (AlertType)alertsTypeColl[i]; if(item.isActive() && isNotAlreadyAdded(item)) { cell.getItems().newItem(item, item.getText()); } } }
private void deleteThisAlertFromAllAlertsItems(AlertType alert, DynamicGridCell cellFromEvent) { for(int i=0; i<form.lyrRights().tabAlerts().dyngrdAlerts().getRows().size(); i++) { DynamicGridRow row = form.lyrRights().tabAlerts().dyngrdAlerts().getRows().get(i); DynamicGridCell cell = row.getCells().get(getColumn(COL_ALERT)); Object value = cell.getValue(); bindAlertTypeCell(cell); //WDEV-21078 if (value!=null && value instanceof AlertType && !Boolean.TRUE.equals(((AlertType)value).isActive())) { AlertType item = (AlertType)value; cell.getItems().newItem(item, item.getText(), null, Color.Red); } cell.setValue(value); } }
private boolean isNotAlreadyAdded(AlertType item) { if(item == null) return false; for(int i=0; i<form.lyrRights().tabAlerts().dyngrdAlerts().getRows().size(); i++) { DynamicGridRow row = form.lyrRights().tabAlerts().dyngrdAlerts().getRows().get(i); AlertType alert = (AlertType) row.getCells().get(getColumn(COL_ALERT)).getValue(); if(item.equals(alert)) return false; } return true; }
private void addRow(int position, Image alertIcon, AlertType alertCategoryPosition) { grdAlertsRow row = form.grdAlerts().getRows().newRow(); row.setColAlertPosition(position); if (alertIcon!=null) { row.setColAlertIcon(alertIcon); } if (alertCategoryPosition!=null) { row.setColAlertCategory(alertCategoryPosition.getText()); row.setTooltipForColAlertCategory(alertCategoryPosition.getText()); } row.setValue(alertCategoryPosition); }
private AlertTypeCollection excludeUsedAlertsFromColl(AlertTypeCollection collAllerts) { if (collAllerts==null || collAllerts.size()==0) return null; AlertTypeCollection tempCollAlerts=(AlertTypeCollection)collAllerts.clone(); for (int i=0;i<form.grdAlerts().getRows().size();i++) { if (form.grdAlerts().getSelectedRow()!=null && form.grdAlerts().getRows().get(i).getColAlertPosition()==form.grdAlerts().getSelectedRow().getColAlertPosition()) { continue; } if (form.grdAlerts().getRows().get(i).getValue()!=null && form.grdAlerts().getRows().get(i).getValue() instanceof AlertType) { tempCollAlerts.remove(form.grdAlerts().getRows().get(i).getValue()); } } return tempCollAlerts; }
private AlertTypeCollection getAlertsCategories() { TreeNode[] coll = LookupHelper.getAlertType(domain.getLookupService()).getRootNodes(); AlertTypeCollection alertCategoryColl = new AlertTypeCollection(); for(int i=0; i<coll.length; i++) { AlertType item = (AlertType) coll[i]; if(item.getParent()==null && Boolean.TRUE.equals(item.isActive())) { alertCategoryColl.add(item); } } return alertCategoryColl; }
private void loadCategories() { TreeNode[] coll = LookupHelper.getAlertType(domain.getLookupService()).getRootNodes(); if(coll != null) { for(int i=0;i<coll.length;i++) { AlertType item = (AlertType)coll[i]; if(item.isActive()) form.ctnDetails().cmbCategory().newRow(item, item.getText()); } } }
private void loadAlertCategories() { TreeNode[] coll = LookupHelper.getAlertType(domain.getLookupService()).getRootNodes(); if(coll != null) { for(int i=0;i<coll.length;i++) { AlertType item = (AlertType)coll[i]; if(item.isActive()) form.ctnAlert().cmbAlertCategory().newRow(item, item.getText()); } } }
private boolean hasTheUserRightToEditAlert(AlertType alertType) { if(alertType == null) return false; IAppRole role = engine.getLoggedInRole(); IAlertsAccess[] alertsAccessList = role.getAlertsAccessList(); for(int i=0; i<alertsAccessList.length; i++) { IAlertsAccess alertAccess = alertsAccessList[i]; if(alertAccess == null) continue; if(!(alertAccess.getIAlertType() instanceof AlertType) || !(alertAccess.getIAccess() instanceof AlertAccessRights)) continue; AlertType alertCat = (AlertType) alertAccess.getIAlertType(); AlertAccessRights access = (AlertAccessRights) alertAccess.getIAccess(); if(AlertAccessRights.READ_WRITE.equals(access) && alertCat.equals(alertType.getParent())) { return true; } } return false; }
private void editAlert() { AlertType cat = form.ctnDetails().cmbCategory().getValue(); loadCategories(true); form.ctnDetails().cmbCategory().setValue(cat); form.ctnDetails().cmbSource().setFocus(); form.setMode(FormMode.EDIT); if (form.getLocalContext().getPatientNoAlertInfoVoIsNotNull() && form.getLocalContext().getPatientNoAlertInfoVo().getAlertStatusIsNotNull() && form.getLocalContext().getPatientNoAlertInfoVo().getAlertStatus().equals(PatientAlertStatus.NOKNOWNALERTS)) { form.ctnDetails().chkNoKnownAlerts().setVisible(true); form.ctnDetails().chkNoKnownAlerts().setEnabled(false); form.ctnDetails().chkNoKnownAlerts().setValue(true); } form.btnUpdate().setEnabled(false); form.btnInactivate().setVisible(false); enableDetailsControls(true); form.getLocalContext().setAlertRecord(form.grdAlerts().getValue()); form.ctnDetails().setcustomControlAuthoringInfoEnabled(false); form.getContextMenus().hideAllGenericGridMenuItems(); checkNoAlertStatus(form.getLocalContext().getPatientNoAlertInfoVo()); if(form.ctnDetails().chkNoKnownAlerts().getValue()) enableDetailsControls(false); alertsValueChanged(); }
private AlertTypeCollection getAlertsCategoriesThanCanBeViewedOrEdit(boolean onlyEdit) { TreeNode[] coll = LookupHelper.getAlertType(domain.getLookupService()).getRootNodes(); IAppRole role = engine.getLoggedInRole(); IAlertsAccess[] alertsAccessList = role.getAlertsAccessList(); AlertTypeCollection alertCategoryColl = new AlertTypeCollection(); for(int i=0; i<alertsAccessList.length; i++) { IAlertsAccess alertAccess = alertsAccessList[i]; if(alertAccess == null) continue; if(!(alertAccess.getIAlertType() instanceof AlertType) || !(alertAccess.getIAccess() instanceof AlertAccessRights)) continue; AlertType alertType = (AlertType) alertAccess.getIAlertType(); AlertAccessRights access = (AlertAccessRights) alertAccess.getIAccess(); if((Boolean.FALSE.equals(onlyEdit) && AlertAccessRights.READ_ONLY.equals(access)) || AlertAccessRights.READ_WRITE.equals(access)) { alertCategoryColl.add(getAlertTypeWithChildren(coll, alertType)); } } return alertCategoryColl; }
private AlertType getAlertTypeWithChildren(TreeNode[] coll, AlertType alertType) { for(int i=0; i<coll.length; i++) { AlertType item = (AlertType) coll[i]; if(alertType.equals(item)) return item; } return null; }
public boolean hasAlertsForViewOrEdit(ims.core.vo.Patient voPat) { IAppRole role = getSessionData().role.get(); IAlertsAccess[] alertsAccessList = role.getAlertsAccessList(); AlertTypeCollection alertCategoryColl = new AlertTypeCollection(); for(int i=0; i<alertsAccessList.length; i++) { IAlertsAccess alertAccess = alertsAccessList[i]; if(alertAccess == null) continue; if(!(alertAccess.getIAlertType() instanceof AlertType) || !(alertAccess.getIAccess() instanceof AlertAccessRights)) continue; AlertType alertType = (AlertType) alertAccess.getIAlertType(); AlertAccessRights access = (AlertAccessRights) alertAccess.getIAccess(); if(AlertAccessRights.READ_ONLY.equals(access) || AlertAccessRights.READ_WRITE.equals(access)) { alertCategoryColl.add(alertType); } } if(alertCategoryColl == null || alertCategoryColl.size() == 0) return false; Demographics demog = (Demographics)getDomainImpl(DemographicsImpl.class); return demog.hasAlertsForViewOrEdit(voPat, alertCategoryColl); }
private String getAlertCategoryIds(IAppRole role) { IAlertsAccess[] alertsAccessList = role.getAlertsAccessList(); String ids = ""; for(int i=0; i<alertsAccessList.length; i++) { IAlertsAccess alertAccess = alertsAccessList[i]; if(alertAccess == null) continue; if(!(alertAccess.getIAlertType() instanceof AlertType) || !(alertAccess.getIAccess() instanceof AlertAccessRights)) continue; AlertType alertType = (AlertType) alertAccess.getIAlertType(); AlertAccessRights access = (AlertAccessRights) alertAccess.getIAccess(); if(AlertAccessRights.READ_ONLY.equals(access) || AlertAccessRights.READ_WRITE.equals(access)) { ids += (ids.length() > 0 ? "," : "") + alertType.getID(); } } return ids.length() > 0 ? ids : null; }
public Boolean hasPatientActiveSelfAdmit(PatientRefVo patient) { if (patient == null || patient.getID_Patient() == null) return false; String hql = "SELECT COUNT(alert.id) FROM PatientAlert AS alert LEFT JOIN alert.patient AS pat LEFT JOIN alert.alertType AS aType LEFT JOIN aType.parent AS aCategory WHERE (alert.isRIE is null OR alert.isRIE = 0) AND aCategory.id = :SELF_ADMIT_ALERT AND alert.isCurrentlyActiveAlert = :ACTIVE_ALERT AND pat.id = :PATIENT"; long count = getDomainFactory().countWithHQL(hql, new String[]{"SELF_ADMIT_ALERT","ACTIVE_ALERT", "PATIENT" }, new Object[]{AlertType.SELF_ADMIT_PATIENT.getID(), Boolean.TRUE, patient.getID_Patient()}); return count > 0; }
private Boolean hasActiveSelfAdmitAlert(PatientRefVo patientRefVo) { if (patientRefVo == null || patientRefVo.getID_Patient() == null) return false; String hql = "select count(alert.id) from PatientAlert as alert left join alert.patient as pat left join alert.alertType as aType left join aType.parent as aCategory WHERE (alert.isRIE is null OR alert.isRIE = 0) and aCategory.id = :SELF_ADMIT_ALERT and alert.isCurrentlyActiveAlert = :ACTIVE_ALERT and pat.id = :PATIENT"; long count = getDomainFactory().countWithHQL(hql, new String[]{"SELF_ADMIT_ALERT","ACTIVE_ALERT", "PATIENT" }, new Object[]{AlertType.SELF_ADMIT_PATIENT.getID(), Boolean.TRUE, patientRefVo.getID_Patient()}); return count > 0; }
private AlertAccessRightVoCollection populateAlertAccessRightsFromScreen() { AlertAccessRightVoCollection coll = new AlertAccessRightVoCollection(); for(int i=0; i<form.lyrRights().tabAlerts().dyngrdAlerts().getRows().size(); i++) { DynamicGridRow row = form.lyrRights().tabAlerts().dyngrdAlerts().getRows().get(i); AlertAccessRightVo alertAccess = null; if(row.getValue() instanceof AlertAccessRightVo) { alertAccess = (AlertAccessRightVo) row.getValue(); } else { alertAccess = new AlertAccessRightVo(); } alertAccess.setAlertType((AlertType) row.getCells().get(getColumn(COL_ALERT)).getValue()); alertAccess.setAccess((AlertAccessRights) row.getCells().get(getColumn(COL_ACCESS)).getValue()); if(alertAccess.getID_AlertAccessRight() == null && alertAccess.getAlertType() == null && alertAccess.getAccess() == null) continue; coll.add(alertAccess); } return coll; }
@Override protected void onDyngrdAlertsCellValueChanged(DynamicGridCell cell) { if(getColumn(COL_ALERT).equals(cell.getColumn())) { deleteThisAlertFromAllAlertsItems((AlertType) cell.getValue(), cell); } }
private void populateAlertCategoryCombo(AlertTypeCollection collAllerts) { form.cmbAlertCategory().clear(); if(collAllerts == null) return; for(int i=0; i<collAllerts.size(); i++) { AlertType item = collAllerts.get(i); if(item.isActive()) form.cmbAlertCategory().newRow(item, item.getText()); } }
private boolean hasSealedEnvelope(PatientLiteVo patient) { if (patient == null || patient.getID_Patient() == null) return false; StringBuilder query = new StringBuilder("SELECT COUNT (patAlert.id) FROM PatientAlert AS patAlert LEFT JOIN patAlert.patient AS pat LEFT JOIN patAlert.alertType AS type "); query.append("WHERE pat.id = :PAT_ID AND type.id = :ALERT_TYPE AND patAlert.isCurrentlyActiveAlert = 1"); long count = getDomainFactory().countWithHQL(query.toString(), new String[] {"PAT_ID", "ALERT_TYPE"}, new Object[] {patient.getID_Patient(), AlertType.SEALED_ENVELOPE_PATIENT.getID()}); if (count > 0) return true; return false; }
public PatientAlertLiteVoCollection listAlerts(PatientRefVo patient, IAppRole role) { if(patient == null) throw new CodingRuntimeException("Cannot list Patient Alerts on null Patient Id."); ArrayList<String> names = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select patAlrt from PatientAlert patAlrt left join patAlrt.alertType as alertType "); hql.append(" where patAlrt.patient.id = :patient"); names.add("patient"); values.add(patient.getID_Patient()); hql.append (" and patAlrt.isCurrentlyActiveAlert = :isActive"); names.add("isActive"); values.add(Boolean.TRUE); String alertCategoryIds = getAlertCategoryIds(role); if(alertCategoryIds == null || alertCategoryIds.length() == 0) return null; hql.append (" and alertType.parent is not null and alertType.parent.id in ("); hql.append(alertCategoryIds); hql.append(")"); hql.append (" and alertType.parent.id = :alertTypeH"); names.add("alertTypeH"); values.add(AlertType.ANAESTHETIC_HAZARDS.getID()); hql.append(" order by patAlrt.systemInformation.creationDateTime desc"); List<?> list = factory.find(hql.toString(), names,values); return(PatientAlertLiteVoAssembler.createPatientAlertLiteVoCollectionFromPatientAlert(list)); }
private PatientAlertCategoriesVo populatePatientAlertCategoriesData(PatientAlertCategoriesVo patientAlertcategories, PatientRefVo patientRef, PatientAlertCollection collAlerts) { if (patientAlertcategories==null) patientAlertcategories=new PatientAlertCategoriesVo(); else patientAlertcategories=(PatientAlertCategoriesVo) patientAlertcategories.clone(); AlertPIDBarConfiguration impl=(AlertPIDBarConfiguration)getDomainImpl(AlertPIDBarConfigurationImpl.class); AlertPIDBarConfigVo alertPidBarConfig = impl.getAlertPIDBarConfig(); patientAlertcategories.setPatient(patientRef); //initially set all PatientAlertCategory to false patientAlertcategories.setHasAlertCategory1(false); patientAlertcategories.setHasAlertCategory2(false); patientAlertcategories.setHasAlertCategory3(false); patientAlertcategories.setHasAlertCategory4(false); patientAlertcategories.setHasAlertCategoryOther(false); if (alertPidBarConfig==null) { patientAlertcategories.setHasAlertCategoryOther(true); } else { for (int i=0;collAlerts!=null && i<collAlerts.size();i++) { AlertType alertCategory = collAlerts.get(i).getAlertType().getParent(); if (alertCategory!=null ) { if (alertCategory.equals(alertPidBarConfig.getAlertCategoryPosition1())) { patientAlertcategories.setHasAlertCategory1(true); } else if (alertCategory.equals(alertPidBarConfig.getAlertCategoryPosition2())) { patientAlertcategories.setHasAlertCategory2(true); } else if (alertCategory.equals(alertPidBarConfig.getAlertCategoryPosition3())) { patientAlertcategories.setHasAlertCategory3(true); } else if (alertCategory.equals(alertPidBarConfig.getAlertCategoryPosition4())) { patientAlertcategories.setHasAlertCategory4(true); } else { patientAlertcategories.setHasAlertCategoryOther(true); } } } } return patientAlertcategories; }