/** * Populates the grid withen PatientAllergyCollection * * @param PatientAllergyCollection * @return void */ private void populateListControl(PatientAllergyCollection voCollPatientAllergy) { clearScreen(); clearGrid(); if (voCollPatientAllergy != null) { PatientAllergy voPatientAllergy = null; GenForm.grdAllergiesRow row = null; for (int i=0; i<voCollPatientAllergy.size(); i++) { voPatientAllergy = voCollPatientAllergy.get(i); row = form.grdAllergies().getRows().newRow(); populateRow(voPatientAllergy, row); } } }
@SuppressWarnings("unchecked") public PatientAllergyCollection getPatientAllergies(Integer patientId) { if(patientId == null) throw new CodingRuntimeException("Invalid patient Id."); DomainFactory factory = getDomainFactory(); List list = factory.find("from PatientAllergy patAlrg where patAlrg.patient.id = :patient and patAlrg.isCurrentlyActiveAllergy = 1", new String[] {"patient"},new Object[] {patientId}); return PatientAllergyAssembler.createPatientAllergyCollectionFromPatientAllergy(list).sort(); }
@SuppressWarnings("unchecked") private void populateAllergiesGridFromData(PatientAllergyCollection allergies) { for (Iterator iterator = allergies.iterator(); iterator.hasNext();) { PatientAllergy name = (PatientAllergy) iterator.next(); grdAlergiesRow row = form.grdAlergies().getRows().newRow(); row.setValue(name); row.getAllergy().newRow(name.getAllergen(), name.getAllergen().getAllergenName()); row.getAllergy().setValue(name.getAllergen()); row.getAllergy().setEditedText(name.getAllergen().getAllergenName()); } }
private PatientAllergyCollection getAllergies(PatientAllergyCollection patAlColl) { for(int i=0; i<form.grdAlergies().getRows().size(); i++) { if(form.grdAlergies().getRows().get(i) != null && form.grdAlergies().getRows().get(i).getValue() instanceof PatientAllergy) { if(!patAlColl.contains(form.grdAlergies().getRows().get(i).getValue())) { patAlColl.add(form.grdAlergies().getRows().get(i).getValue()); } } } for(int i=0; i<patAlColl.size(); i++) { Boolean isEqual = false; for(int j=0; j<form.grdAlergies().getRows().size(); j++) { if(patAlColl.get(i) != null && form.grdAlergies().getRows().get(j) != null && form.grdAlergies().getRows().get(j).getValue() != null && patAlColl.get(i).equals(form.grdAlergies().getRows().get(j).getValue())) { isEqual = true; break; } } if(!isEqual) { patAlColl.remove(i); } } return patAlColl.size()==0 ? null : patAlColl; }
@Override protected void onContextMenuItemClick(int menuItemID, ims.framework.Control sender) throws ims.framework.exceptions.PresentationLogicException { if (sender.equals(form.grdAlergies())) { switch (menuItemID) { case GenForm.ContextMenus.RefManNamespace.allergyMenu.addItem : if (domain.getHcpLiteUser() == null) { engine.showMessage("Logged in user is not a HCP."); return; } PatientAllergyCollection coll = new PatientAllergyCollection(); for (int i = 0; i < form.grdAlergies().getRows().size(); i++) { coll.add(form.grdAlergies().getRows().get(i).getValue()); } form.getGlobalContext().Core.setAllergiesAtConsultation(coll); engine.open(form.getForms().Clinical.AllergiesDialog); break; case GenForm.ContextMenus.RefManNamespace.allergyMenu.removeItem : removeAllergy(); break; default : } } }
protected void onFormDialogClosed(FormName formName, DialogResult result) throws PresentationLogicException { if(result.equals(DialogResult.OK) && formName.equals(form.getForms().Clinical.AllergiesDialog)) { if (form.getGlobalContext().Core.getAllergiesAtConsultationIsNotNull()) { PatientAllergyCollection allergies = form.getGlobalContext().Core.getAllergiesAtConsultation(); form.grdAlergies().getRows().clear(); for (int i = 0; i < allergies.size(); i++) { grdAlergiesRow row = form.grdAlergies().getRows().newRow(true); if(allergies.get(i).getAllergenDescriptionIsNotNull()) row.setColAllergy(allergies.get(i).getAllergenDescription()); if(allergies.get(i).getAuthoringInformationIsNotNull() && allergies.get(i).getAuthoringInformation().getAuthoringHcpIsNotNull()) row.setColAuthoringHCP(allergies.get(i).getAuthoringInformation().getAuthoringHcp().toString()); row.setValue(allergies.get(i)); } } form.getContextMenus().RefMan.getallergyMenuremoveItemItem().setVisible(form.grdAlergies().getSelectedRow() != null ? true : false); } if(formName.equals(form.getForms().RefMan.ChangeUpdatingHCP) && DialogResult.OK.equals(result)) { form.ccLastUpdating().setValue(form.getGlobalContext().RefMan.getLastUpdatingHCP()); } }
private boolean activeAllergiesExist(PatientAllergyCollection voCollPatientAllergy) { for(int i=0; i<voCollPatientAllergy.size(); i++) { if(voCollPatientAllergy.get(i).getIsCurrentlyActiveAllergyIsNotNull() && voCollPatientAllergy.get(i).getIsCurrentlyActiveAllergy()) return true; } return false; }
public PatientAllergyCollection listPatientAllergies(PatientShort patient) { Allergies allergies = (Allergies)getDomainImpl(AllergiesImpl.class); return allergies.listPatientAllergies(patient, true); }
private void open() { clearScreen(); boolean hasAllergies = false; PatientAllergyCollection voCollPatientAllergy = domain.listPatientAllergies(form.getGlobalContext().Core.getPatientShort(), Boolean.FALSE); PatientAllergyCollection voColl = new PatientAllergyCollection(); if(voCollPatientAllergy != null && voCollPatientAllergy.size() > 0) { hasAllergies = activeAllergiesExist(voCollPatientAllergy);//WDEV-11159 if (form.groupFilter().getValue().equals(GenForm.groupFilterEnumeration.rdoActive)) { for (int i = 0; i < voCollPatientAllergy.size(); i++) { if (voCollPatientAllergy.get(i)!=null) if (voCollPatientAllergy.get(i).getIsCurrentlyActiveAllergyIsNotNull()) if(voCollPatientAllergy.get(i).getIsCurrentlyActiveAllergy()) { voColl.add(voCollPatientAllergy.get(i)); } } } else { voColl = voCollPatientAllergy; } } setToolBarAllergies(hasAllergies); // refresh the local and global contexts due to whether the patient has active allergies or not form.getLocalContext().setbActiveAllergies(new Boolean(hasAllergies)); populateListControl(voColl); // select record in the grid if the local context value is not null and populate details panel if (form.getLocalContext().getVoAllergyIsNotNull()) { form.grdAllergies().setValue(form.getLocalContext().getVoAllergy()); form.getLocalContext().setVoAllergy(form.grdAllergies().getValue()); // updates for concurrent use // WDEV-3165 - must check for null value to cover case where record is made inactive or RIE, and is no longer listed in the grid if (form.getLocalContext().getVoAllergyIsNotNull()) populateDetailsPanel(form.grdAllergies().getValue()); } form.setMode(FormMode.VIEW); //form.btnUpdate().setEnabled(false); //form.btnInactivate().setVisible(false); checkNoAlergyStatus(form.getLocalContext().getPatientNoAllergyInfo()); }