private void updatePatientNoAllergyInfo (PatientRefVo patient) throws StaleObjectException { DomainFactory factory = getDomainFactory(); String hql = new String("from PatientNoAllergyInfo alleInfo where alleInfo.patient.id = :patient"); List<?> list = factory.find(hql,new String[]{ "patient"},new Object[]{patient.getBoId()}); if (list!=null||list.isEmpty()) { for (Object object : list) { PatientNoAllergyInfo alleInfo =(PatientNoAllergyInfo)object; if(alleInfo.getAllergyStatus()==null ||alleInfo.getAllergyStatus().equals(getDomLookup(PatientAllergyStatus.NOKNOWNALLERGIES))) { alleInfo.setAllergyStatus(getDomLookup(PatientAllergyStatus.HASALLERGIES)); factory.save(alleInfo); } } } }
private void initializeHasNoKnownAllergies() { PatientNoAllergyInfoVo voPatientNoAllergyInfo = domain.getPatientNoAllergyInfo(form.getGlobalContext().Core.getPatientShort()); if(voPatientNoAllergyInfo != null && voPatientNoAllergyInfo.getAllergyStatusIsNotNull() && voPatientNoAllergyInfo.getAllergyStatus().equals(PatientAllergyStatus.NOKNOWNALLERGIES)) form.chkNoAllergies().setValue(true); }
public void refresh() { if(form.getGlobalContext().Core.getPatientShort() == null) return; form.getLocalContext().setNoAllergy(domain.getPatientNoAllergyInfo(form.getGlobalContext().Core.getPatientShort())); form.chkNoAllergies().setValue(form.getLocalContext().getNoAllergyIsNotNull() && PatientAllergyStatus.NOKNOWNALLERGIES.equals((form.getLocalContext().getNoAllergy().getAllergyStatus()))); populateAllergiesGrid(domain.listAllergies(form.getGlobalContext().Core.getPatientShort())); updateControlsState(); }
private void checkNoAlergyStatus(PatientNoAllergyInfoVo voPatientNoAllergyInfo) { if(voPatientNoAllergyInfo != null && voPatientNoAllergyInfo.getAllergyStatusIsNotNull() && voPatientNoAllergyInfo.getAllergyStatus().equals(PatientAllergyStatus.NOKNOWNALLERGIES)) { form.lblHasNoKnownAllergies().setVisible(true); if(voPatientNoAllergyInfo.getAuthoringInformation() == null || (voPatientNoAllergyInfo.getAuthoringInformation().getAuthoringHcp() == null && voPatientNoAllergyInfo.getAuthoringInformation().getAuthoringDateTime() == null )) { String strTemp = voPatientNoAllergyInfo.createInfoTooltip().toString(); int n = strTemp.indexOf("Entered By : </b>"); n = n + new String("Entered By : </b>").length(); strTemp = strTemp.substring(0, n); form.lblHasNoKnownAllergies().setTooltip(strTemp); } else form.lblHasNoKnownAllergies().setTooltip(voPatientNoAllergyInfo.createInfoTooltip().toString()); if (form.getMode().equals(FormMode.VIEW)) { form.btnUpdate().setVisible(true); form.btnUpdate().setEnabled(true); form.getContextMenus().getGenericGridUpdateItem().setVisible(true); } populateScreenFromData(voPatientNoAllergyInfo); } else { form.lblHasNoKnownAllergies().setVisible(false); form.lblHasNoKnownAllergies().setTooltip(""); //form.btnUpdate().setVisible(false); //form.btnUpdate().setEnabled(false); } }
private void editAllergy() { form.setMode(FormMode.EDIT); if (form.getLocalContext().getPatientNoAllergyInfoIsNotNull() && form.getLocalContext().getPatientNoAllergyInfo().getAllergyStatusIsNotNull() && form.getLocalContext().getPatientNoAllergyInfo().getAllergyStatus().equals(PatientAllergyStatus.NOKNOWNALLERGIES)) { form.ctnDetails().chkNoKnownAllergies().setVisible(true); form.ctnDetails().chkNoKnownAllergies().setEnabled(false); form.ctnDetails().chkNoKnownAllergies().setValue(true); } // these fields are not to be updated by the user enableAllergyDetailControls(false); form.ctnDetails().cmbReaction().setEnabled(true); form.ctnDetails().txtEffect().setEnabled(true); form.ctnDetails().cmbSource().setEnabled(true); form.ctnDetails().pdtDateIdentified().setEnabled(true); AllergenVo voAllergen = (AllergenVo) form.ctnDetails().customControlCodingItem().getSelectedItem(); if (voAllergen != null) defaultSourceCombo(voAllergen); form.ctnDetails().setcustomControlAuthoringInfoEnabled(false); form.ctnDetails().customControlCodingItem().setEnabled(false); checkNoAlergyStatus( form.getLocalContext().getPatientNoAllergyInfo()); if(form.ctnDetails().chkNoKnownAllergies().getValue()) { form.ctnDetails().setcustomControlCodingItemEnabled(false); enableAllergyDetailControls(false); } }
private void checkNoAlergyStatus(PatientNoAllergyInfoVo voPatientNoAllergyInfo) { if(voPatientNoAllergyInfo != null && voPatientNoAllergyInfo.getAllergyStatusIsNotNull() && voPatientNoAllergyInfo.getAllergyStatus().equals(PatientAllergyStatus.NOKNOWNALLERGIES)) { form.lblHasNoKnownAllergies().setVisible(true); if(voPatientNoAllergyInfo.getAuthoringInformation() == null || (voPatientNoAllergyInfo.getAuthoringInformation().getAuthoringHcp() == null && voPatientNoAllergyInfo.getAuthoringInformation().getAuthoringDateTime() == null )) { String strTemp = voPatientNoAllergyInfo.createInfoTooltip().toString(); int n = strTemp.indexOf("Entered By : </b>"); n = n + new String("Entered By : </b>").length(); strTemp = strTemp.substring(0, n); form.lblHasNoKnownAllergies().setTooltip(strTemp); } else form.lblHasNoKnownAllergies().setTooltip(voPatientNoAllergyInfo.createInfoTooltip().toString()); if (form.getMode().equals(FormMode.VIEW)) { form.btnUpdate().setVisible(true); form.btnUpdate().setEnabled(true); form.getContextMenus().getGenericGridUpdateItem().setVisible(true); } populateScreenFromData(voPatientNoAllergyInfo); } else { form.lblHasNoKnownAllergies().setVisible(false); form.lblHasNoKnownAllergies().setTooltip(""); form.btnUpdate().setVisible(false); //WDEV-18757 form.btnUpdate().setEnabled(false); //WDEV-18757 form.getContextMenus().getGenericGridUpdateItem().setVisible(false); //WDEV-18757 if (form.getMode().equals(FormMode.VIEW) && form.grdAllergies().getValue() == null) //WDEV-18829 clearDetailsPanel(); } }
private void newAllergy() { clearDetailsPanel(); form.getLocalContext().setVoAllergy(null); form.grdAllergies().setValue(null); setDefaultValues(); form.setMode(FormMode.EDIT); if( form.grdAllergies().getRows() != null && form.grdAllergies().getRows().size() > 0) { form.ctnDetails().chkNoKnownAllergies().setVisible(false); form.ctnDetails().chkNoKnownAllergies().setValue(false); } else if(form.getLocalContext().getPatientNoAllergyInfo() == null) { form.ctnDetails().chkNoKnownAllergies().setVisible(true); form.ctnDetails().chkNoKnownAllergies().setEnabled(true); form.ctnDetails().chkNoKnownAllergies().setValue(false); } else if (form.getLocalContext().getPatientNoAllergyInfoIsNotNull() && form.getLocalContext().getPatientNoAllergyInfo().getAllergyStatusIsNotNull() && form.getLocalContext().getPatientNoAllergyInfo().getAllergyStatus().equals(PatientAllergyStatus.NOKNOWNALLERGIES)) { form.ctnDetails().chkNoKnownAllergies().setVisible(false); form.ctnDetails().chkNoKnownAllergies().setEnabled(false); form.ctnDetails().chkNoKnownAllergies().setValue(false); } else if(form.getLocalContext().getPatientNoAllergyInfo().getAllergyStatus() == null) { form.ctnDetails().chkNoKnownAllergies().setVisible(true); form.ctnDetails().chkNoKnownAllergies().setEnabled(true); form.ctnDetails().chkNoKnownAllergies().setValue(false); } else if( ! form.getLocalContext().getbActiveAllergies() && form.getLocalContext().getPatientNoAllergyInfo().getAllergyStatus().equals(PatientAllergyStatus.HASALLERGIES)) { form.ctnDetails().chkNoKnownAllergies().setVisible(true); form.ctnDetails().chkNoKnownAllergies().setEnabled(true); form.ctnDetails().chkNoKnownAllergies().setValue(false); } else { form.ctnDetails().chkNoKnownAllergies().setVisible(false); form.ctnDetails().chkNoKnownAllergies().setValue(false); } // these fields only have this status when creating a new record form.ctnDetails().customControlAuthoringInfo().initializeComponent(); form.ctnDetails().setcustomControlAuthoringInfoEnabled(true); form.ctnDetails().setCollapsed(false); // WDEV-3126 correcting the tab order. form.ctnDetails().customControlCodingItem().setFocus(); Object mos = domain.getMosUser(); if(mos != null) form.ctnDetails().txtRcordingHCP().setValue(((MemberOfStaffLiteVo)mos).getIMosName()); form.ctnDetails().dtimRecordingDateTime().setValue(new DateTime()); enableAllergyDetailControls(true); if (ConfigFlag.UI.RESTRICT_TAXONOMY_ACCESS.getValue()) defaultCOEAllergyList(); }
/** * Updates the state of the buttons and context menus. * * @param void * @return void */ private void updateControlsState() { form.ctnDetails().customControlCodingItem().setParentEditing(new Boolean(form.getMode().equals(FormMode.EDIT))); if (form.getMode().equals(FormMode.EDIT)) { form.getContextMenus().getGenericGridAddItem().setVisible(false); form.btnUpdate().setVisible(false); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); form.getContextMenus().getGenericGridRemoveItem().setVisible(false); form.ctnDetails().setcustomControlCodingItemEnabled(true); if(ConfigFlag.UI.RESTRICT_TAXONOMY_ACCESS.getValue()) form.ctnDetails().cmbType().setEnabled(false); else form.ctnDetails().cmbType().setEnabled(true); form.ctnDetails().cmbReaction().setEnabled(true); } else { form.getContextMenus().getGenericGridAddItem().setVisible(true); // WDEV-3126 - edit and inactivate buttons and context menus should be available only for selected active records boolean activeRecordSelected = form.grdAllergies().getSelectedRowIndex() >= 0 && form.getLocalContext().getVoAllergyIsNotNull() && form.getLocalContext().getVoAllergy().getIsCurrentlyActiveAllergyIsNotNull() && form.getLocalContext().getVoAllergy().getIsCurrentlyActiveAllergy().booleanValue(); form.btnUpdate().setVisible(activeRecordSelected /* || form.getLocalContext().getPatientNoAllergyInfoIsNotNull() */); form.getContextMenus().getGenericGridUpdateItem().setVisible(activeRecordSelected); if (form.getLocalContext().getPatientNoAllergyInfoIsNotNull() && form.getLocalContext().getPatientNoAllergyInfo().getAllergyStatusIsNotNull() && form.getLocalContext().getPatientNoAllergyInfo().getAllergyStatus().equals(PatientAllergyStatus.NOKNOWNALLERGIES)) form.btnInactivate().setVisible(false); form.btnInactivate().setVisible(activeRecordSelected); form.getContextMenus().getGenericGridRemoveItem().setVisible(activeRecordSelected); } form.ctnDetails().setCollapsed(!(form.grdAllergies().getSelectedRowIndex() >= 0)); form.btnClose().setVisible(isAllergiesForTriage() && FormMode.VIEW.equals(form.getMode()));//WDEV-14413 form.btnClose().setEnabled(isAllergiesForTriage() && FormMode.VIEW.equals(form.getMode()));//WDEV-14413 }
public ims.core.vo.PatientAllergy savePatientAllergy(ims.core.vo.PatientAllergy voPatientAllergy, PatientNoAllergyInfoVo patientNoAllergyInfo) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException, DomainInterfaceException { if (!voPatientAllergy.isValidated()) throw new CodingRuntimeException("Patient Allergy has not been validated"); if (!patientNoAllergyInfo.isValidated()) throw new CodingRuntimeException("PatientNoAllergyInfoVo has not been validated"); if(voPatientAllergy == null) throw new CodingRuntimeException("Cannot save null PatientAllergyVo"); if (patientNoAllergyInfo == null) throw new CodingRuntimeException("Cannot save null PatientNoAllergyInfoVo"); DomainFactory factory = getDomainFactory(); //Check the allergy and save it if(voPatientAllergy.getAllergenIsNotNull() && voPatientAllergy.getAllergen().getID_Allergen() == null) { voPatientAllergy.setAllergen(saveAllergy(voPatientAllergy.getAllergen())); } PatientAllergy doPatientAllergy = PatientAllergyAssembler.extractPatientAllergy(factory, voPatientAllergy); if (!voPatientAllergy.getID_PatientAllergyIsNotNull()) { //Check the PatientNoAllergyInfo String hqlQuery = "select p1_1.allergyStatus from PatientNoAllergyInfo as p1_1 where (p1_1.patient.id = :Patient_id and p1_1.isRIE is null )"; List<?> list = factory.find(hqlQuery,"Patient_id",voPatientAllergy.getPatient().getID_Patient()); //If there is no PatientNoAllergiesInfo record, or the record exists and the status is NOKNOWNALLERGIES if ((list == null || list.size() == 0) || (getDomLookup(PatientAllergyStatus.NOKNOWNALLERGIES).equals(list.get(0)))) { savePatientNoAllergyInfo(patientNoAllergyInfo); } } factory.save(doPatientAllergy); //if the allergy has a PAS mapping of "ALLE" then insert an ALERT of this type. if (voPatientAllergy.getAllergenIsNotNull() && voPatientAllergy.getAllergen().getTaxonomyMapIsNotNull() && voPatientAllergy.getAllergen().getTaxonomyMap().size() > 0) { for ( int i = 0 ; i < voPatientAllergy.getAllergen().getTaxonomyMap().size() ; i++) { if (voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCodeIsNotNull() && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCode().equals("ALLE") && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyNameIsNotNull() && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyName().getText().equals("PAS")) { Alerts impl = (Alerts) getDomainImpl(ims.core.domain.impl.AlertsImpl.class); impl.saveHeartsAlert(voPatientAllergy.getPatient(), "ALLE", voPatientAllergy.getIsCurrentlyActiveAllergy()); } } } return (PatientAllergyAssembler.create(doPatientAllergy)); }
/** * Updates the state of the buttons and context menus. * * @param void * @return void */ private void updateControlsState() { form.ctnDetails().customControlCodingItem().setParentEditing(new Boolean(form.getMode().equals(FormMode.EDIT))); if (form.getMode().equals(FormMode.EDIT)) { form.getContextMenus().getGenericGridAddItem().setVisible(false); form.btnUpdate().setVisible(false); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); form.getContextMenus().getGenericGridRemoveItem().setVisible(false); form.ctnDetails().setcustomControlCodingItemEnabled(true); if(ConfigFlag.UI.RESTRICT_TAXONOMY_ACCESS.getValue()) form.ctnDetails().cmbType().setEnabled(false); else form.ctnDetails().cmbType().setEnabled(true); form.ctnDetails().cmbReaction().setEnabled(true); } else { form.getContextMenus().getGenericGridAddItem().setVisible(true); // WDEV-3126 - edit and inactivate buttons and context menus should be available only for selected active records boolean activeRecordSelected = form.grdAllergies().getSelectedRowIndex() >= 0 && form.getLocalContext().getVoAllergyIsNotNull() && form.getLocalContext().getVoAllergy().getIsCurrentlyActiveAllergyIsNotNull() && form.getLocalContext().getVoAllergy().getIsCurrentlyActiveAllergy().booleanValue(); //WDEV-18757 //form.btnUpdate().setVisible(activeRecordSelected /* || form.getLocalContext().getPatientNoAllergyInfoIsNotNull() */); //form.getContextMenus().getGenericGridUpdateItem().setVisible(activeRecordSelected); if (form.getLocalContext().getPatientNoAllergyInfoIsNotNull() && form.getLocalContext().getPatientNoAllergyInfo().getAllergyStatusIsNotNull() && form.getLocalContext().getPatientNoAllergyInfo().getAllergyStatus().equals(PatientAllergyStatus.NOKNOWNALLERGIES)) form.btnInactivate().setVisible(false); form.btnInactivate().setVisible(activeRecordSelected); form.getContextMenus().getGenericGridRemoveItem().setVisible(activeRecordSelected); } form.ctnDetails().setCollapsed(!(form.grdAllergies().getSelectedRowIndex() >= 0)); form.btnClose().setVisible(isAllergiesForTriage() && FormMode.VIEW.equals(form.getMode()));//WDEV-14413 form.btnClose().setEnabled(isAllergiesForTriage() && FormMode.VIEW.equals(form.getMode()));//WDEV-14413 }