private boolean save() { ElectiveListConfigurationVo configToSave=populateDataFromScreen(form.getLocalContext().getSelectedRecord()); String[] errors = configToSave.validate(getUIErrors(configToSave)); if (errors != null && errors.length>0) { engine.showErrors(errors); return false; } try { form.getLocalContext().setSelectedRecord(domain.save(configToSave)); } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } return true; }
private void populateInstanceControlsFromData(ElectiveListConfigurationVo selectedRecord) { clearInstanceControls(); if (selectedRecord==null) return; selectedRecord=domain.getConfiguration(selectedRecord); form.getLocalContext().setSelectedRecord(selectedRecord); form.ctnDetails().txtWaitingListName().setValue(selectedRecord.getWaitingListName()); if (selectedRecord.getServiceIsNotNull()) { form.ctnDetails().qmbService().newRow(selectedRecord.getService(), selectedRecord.getService().getServiceName()); form.ctnDetails().qmbService().setValue(selectedRecord.getService()); } form.ctnDetails().dteStart().setValue(selectedRecord.getStartDate()); form.ctnDetails().dteEnd().setValue(selectedRecord.getEndDate()); form.ctnDetails().txtCode().setValue(selectedRecord.getWaitingListCode()); form.ctnDetails().chkActive().setValue(selectedRecord.getIsActive()); populateConsultantsGrid(selectedRecord.getHCPs()); populateHospitalsGrid(selectedRecord.getListLocations()); }
private void populateInstanceControlsFromData(ElectiveListConfigurationVo selectedRecord) { clearInstanceControls(); if (selectedRecord==null) return; selectedRecord=domain.getConfiguration(selectedRecord); form.getLocalContext().setSelectedRecord(selectedRecord); form.ctnDetails().txtWaitingListName().setValue(selectedRecord.getWaitingListName()); if (selectedRecord.getServiceIsNotNull()) { form.ctnDetails().qmbService().newRow(selectedRecord.getService(), selectedRecord.getService().getServiceName()); form.ctnDetails().qmbService().setValue(selectedRecord.getService()); populateSpecialtyFromDetailsContainer(form.ctnDetails().qmbService().getValue());//WDEV-20064 } form.ctnDetails().dteStart().setValue(selectedRecord.getStartDate()); form.ctnDetails().dteEnd().setValue(selectedRecord.getEndDate()); form.ctnDetails().txtCode().setValue(selectedRecord.getWaitingListCode()); form.ctnDetails().chkActive().setValue(selectedRecord.getIsActive()); populateConsultantsGrid(selectedRecord.getHCPs()); populateHospitalsGrid(selectedRecord.getListLocations()); }
private void populateGrid(ElectiveListConfigurationVoCollection collWaitingListConfig) { form.grdWaitingList().getRows().clear(); for (int i=0;i<collWaitingListConfig.size();i++) { ElectiveListConfigurationVo value = collWaitingListConfig.get(i); grdWaitingListRow row = form.grdWaitingList().getRows().newRow(); row.setValue(value); row.setColWaitingListName(value.getWaitingListName()); row.setTooltipForColWaitingListName(value.getWaitingListName()); row.setColStartDate(value.getStartDate()!=null ? value.getStartDate().toString() : null); row.setTooltipForColStartDate(value.getStartDate()!=null ? value.getStartDate().toString() : null); row.setColEndDate(value.getEndDate()!=null ? value.getEndDate().toString() : null); row.setTooltipForColEndDate(value.getEndDate()!=null ? value.getEndDate().toString() : null); row.setColService(value.getService().getServiceName()); row.setTooltipForColService(populateTooltipForColService(value.getService()));//WDEV-18561 String valueCons = getConsultantsToDisplay(value.getHCPs()); row.setColConsultants(valueCons); row.setTooltipForColConsultants(valueCons); String valueHosp=getHospitalsToDisplay(value.getListLocations()); row.setColHospitals(valueHosp); row.setTooltipForColHospitals(valueHosp); row.setColActive(value.getIsActive()); } }
private ElectiveListConfigurationVo getSelectedWaitingList() { for (int i=0;i<form.grdElectiveList().getRows().size();i++) { if (form.grdElectiveList().getRows().get(i).getcolSelect()) return domain.getElectiveListConfiguration(form.grdElectiveList().getRows().get(i).getValue()); form.grdElectiveList().getRows().get(i).setcolSelect(false); } return null; }
private void addRowsToElectiveListCombo(ElectiveListConfigurationVoCollection electiveListConfig, boolean isDiagnosticReason) { ElectiveListConfigurationVoCollection tempListConfig = new ElectiveListConfigurationVoCollection(); int nrOfListsHcpIsDefault = 0; ElectiveListConfigurationVo defaultHcpList = null; for (int i = 0; i < electiveListConfig.size(); i++) { // check if HCP if default for this ElectiveListConfiguration add instances if (!isDiagnosticReason && form.ccRespHCP().getValue() != null && isDefaultHcpOnListConfig(electiveListConfig.get(i))) { form.cmbElectiveList().newRow(electiveListConfig.get(i), electiveListConfig.get(i).getWaitingListName()+(electiveListConfig.get(i).getServiceIsNotNull() ? " ("+electiveListConfig.get(i).getService().getServiceName()+")":"" ), Color.Red); if (nrOfListsHcpIsDefault == 0) //set the defaultHcpList to the first default elective List found for the HCP { defaultHcpList = electiveListConfig.get(i); } nrOfListsHcpIsDefault++; } else // add to a temporary list tempListConfig.add(electiveListConfig.get(i)); } ServiceLiteVo referralService = (form.getLocalContext().getReferral()!=null && form.getLocalContext().getReferral().getReferralDetails()!=null ? form.getLocalContext().getReferral().getReferralDetails().getService(): null); //WDEV-18388 // add the remaining ElectiveListConfiguration items to the combo for (int i = 0; i < tempListConfig.size(); i++) { form.cmbElectiveList().newRow(tempListConfig.get(i), tempListConfig.get(i).getWaitingListName()+ (tempListConfig.get(i).getServiceIsNotNull() && referralService!=null && referralService.getID_Service().intValue() != tempListConfig.get(i).getService().getID_Service().intValue() ? " (Service: "+ tempListConfig.get(i).getService().getServiceName()+")" : "")); } if (electiveListConfig.size() == 1) form.cmbElectiveList().setValue(electiveListConfig.get(0)); else if (nrOfListsHcpIsDefault == 1) // if the HCP has only one default Elective List, default it. form.cmbElectiveList().setValue(defaultHcpList); }
private boolean isDefaultHcpOnListConfig(ElectiveListConfigurationVo electiveListConfig) { for (int j = 0; electiveListConfig.getHCPs() != null && j < electiveListConfig.getHCPs().size(); j++) { if (Boolean.TRUE.equals(electiveListConfig.getHCPs().get(j).getDefaultForHCP()) && electiveListConfig.getHCPs().get(j).getHCP().equals(form.ccRespHCP().getValue())) { return true; } } return false; }
public ElectiveListConfigurationVo getElectiveListConfiguration(ElectiveListConfigurationRefVo electiveListConfigRef) { if (electiveListConfigRef==null ||electiveListConfigRef.getID_ElectiveListConfiguration()==null) { throw new CodingRuntimeException("Cannot get ElectiveListConfigurationVo on null Id "); } DomainFactory factory = getDomainFactory(); ElectiveListConfiguration domainWaitListConfig = (ElectiveListConfiguration) factory.getDomainObject(ElectiveListConfiguration.class,electiveListConfigRef.getID_ElectiveListConfiguration()); return ElectiveListConfigurationVoAssembler.create(domainWaitListConfig); }
public void createCaseNoteRequests(PatientElectiveListRefVo patientElectiveList) { if (patientElectiveList == null || patientElectiveList.getID_PatientElectiveList() == null) return; PatientElectiveList domPatientElectiveList = (PatientElectiveList) getDomainFactory().getDomainObject(PatientElectiveList.class, patientElectiveList.getID_PatientElectiveList()); if (domPatientElectiveList.getTCIDetails() == null) return; TCIForPatientElectiveList domTciDetails = (TCIForPatientElectiveList) getDomainFactory().getDomainObject(TCIForPatientElectiveList.class, domPatientElectiveList.getTCIDetails().getId()); if (domTciDetails == null) return; PatientElectiveListTCIVo tci = PatientElectiveListTCIVoAssembler.create(domTciDetails); //WDEV-20064 ElectiveListConfiguration domElectiveListConf = domPatientElectiveList.getElectiveList(); LocationLiteVo caseNoteFolderLoc=null; if (domElectiveListConf!=null) { ElectiveListConfigurationVo electiveListConf = ElectiveListConfigurationVoAssembler.create(domElectiveListConf); caseNoteFolderLoc=getCaseNoteLocAssociatedWithHospital(electiveListConf, tci.getTCIHospital()); } if (caseNoteFolderLoc!=null && tci.getTCIDate() != null && tci.getTCITime() != null) { if (tci.getTCIDate().isGreaterThan(new Date()) || (tci.getTCIDate().equals(new Date()) && tci.getTCITime().isGreaterOrEqualThan(new Time()))) { saveAutomatedCaseNoteRequests(domPatientElectiveList.getPatient(), tci, caseNoteFolderLoc);//WDEV-20064 } } }
private LocationLiteVo getCaseNoteLocAssociatedWithHospital(ElectiveListConfigurationVo electiveList, LocationLiteVo tciHospital) { if (electiveList==null || electiveList.getListLocations()==null ) return null; for (int i=0;i<electiveList.getListLocations().size();i++) { if (tciHospital.equals(electiveList.getListLocations().get(i).getListLocation())) { return electiveList.getListLocations().get(i).getCaseNoteFolderLocation(); } } return null; }
@Override protected void onQmbHospitalTextSubmited(String value) throws PresentationLogicException { form.qmbWard().clear(); //WDEV-20065 form.qmbHospital().clear(); ElectiveListConfigurationVo selectedElectiveList = form.cmbElectiveList().getValue(); if (selectedElectiveList==null) return ; LocationLiteVoCollection hospitals = domain.listHospitalsByElectiveList(selectedElectiveList, value); if (hospitals == null || hospitals.size()==0) return; for (int i = 0; i < hospitals.size(); i++) { form.qmbHospital().newRow(hospitals.get(i), hospitals.get(i).getName()); } if (hospitals.size()==1) { form.qmbHospital().setValue(hospitals.get(0)); } else { form.qmbHospital().showOpened(); } updateControlsState(); //WDEV-18656 }
private LocationLiteVo getCaseNoteLocAssociatedWithHospital(ElectiveListConfigurationVo electiveList, LocationLiteVo tciHospital) { if (electiveList==null || electiveList.getListLocations()==null || tciHospital==null) return null; for (int i=0;i<electiveList.getListLocations().size();i++) { if (tciHospital.equals(electiveList.getListLocations().get(i).getListLocation())) { return electiveList.getListLocations().get(i).getCaseNoteFolderLocation(); } } return null; }
private String[] getUIErrors(ElectiveListConfigurationVo configToSave) { ArrayList<String> errors = new ArrayList<String>(); if (form.ctnDetails().dteStart().getValue()!=null & form.ctnDetails().dteEnd().getValue()!=null && form.ctnDetails().dteStart().getValue().isGreaterThan(form.ctnDetails().dteEnd().getValue())) { errors.add("'End Date' should be greater than 'Start Date'!"); } if (form.ctnDetails().chkActive().getValue() && form.ctnDetails().txtCode().getValue()!=null && domain.existConfigurationWithSameCode(form.ctnDetails().txtCode().getValue(),configToSave,form.ctnDetails().dteStart().getValue(),form.ctnDetails().dteEnd().getValue())) { errors.add("'"+ form.ctnDetails().txtCode().getValue() +"' Elective List Code is already used for another configuration !"); } if (form.ctnDetails().chkActive().getValue() && form.ctnDetails().txtWaitingListName().getValue()!=null && domain.existConfigurationWithSameName(form.ctnDetails().txtWaitingListName().getValue(),configToSave)) { errors.add("'"+ form.ctnDetails().txtWaitingListName().getValue() +"' Elective List Name is already used!"); } for (int i=0;form.ctnDetails().chkActive().getValue() && form.ctnDetails().qmbService().getValue()!=null && form.ctnDetails().dteStart().getValue()!=null && i<form.ctnDetails().grdConsultants().getRows().size();i++) { if (form.ctnDetails().grdConsultants().getRows().get(i).getColDefault() && domain.isConsultantMarkedAsDefaultForSameServiceForOtherConfiguration((HcpRefVo) form.ctnDetails().grdConsultants().getRows().get(i).getColConsultants().getValue(),form.ctnDetails().qmbService().getValue(),configToSave,form.ctnDetails().dteStart().getValue(),form.ctnDetails().dteEnd().getValue())) { errors.add("Your chosen default List Owner is already marked as default for another configuration with the same Specialty from selected Service or same Service in the same time interval."); } } for (int i=0;i<form.ctnDetails().grdConsultants().getRows().size();i++) { if (form.ctnDetails().grdConsultants().getRows().get(i).getColConsultants().getValue()==null) { errors.add("Please select a List Owner or remove the empty row"); } } for (int i=0;i<form.ctnDetails().grdHospitals().getRows().size();i++) { if (form.ctnDetails().grdHospitals().getRows().get(i).getColHospitals().getValue()==null) { errors.add("Please select a Location or remove the empty row"); } } if (errors.size() > 0) { String[] UIErrors = new String[errors.size()]; errors.toArray(UIErrors); return UIErrors; } return null; }
private String[] getUIErrors(ElectiveListConfigurationVo configToSave) { ArrayList<String> errors = new ArrayList<String>(); if (form.ctnDetails().dteStart().getValue()!=null & form.ctnDetails().dteEnd().getValue()!=null && form.ctnDetails().dteStart().getValue().isGreaterThan(form.ctnDetails().dteEnd().getValue())) { errors.add("'End Date' should be greater than 'Start Date'!"); } if (form.ctnDetails().chkActive().getValue() && form.ctnDetails().txtCode().getValue()!=null && domain.existConfigurationWithSameCode(form.ctnDetails().txtCode().getValue(),configToSave,form.ctnDetails().dteStart().getValue(),form.ctnDetails().dteEnd().getValue())) { errors.add("'"+ form.ctnDetails().txtCode().getValue() +"' Elective List Code is already used for another configuration !"); } if (form.ctnDetails().chkActive().getValue() && form.ctnDetails().txtWaitingListName().getValue()!=null && domain.existConfigurationWithSameName(form.ctnDetails().txtWaitingListName().getValue(),configToSave)) { errors.add("'"+ form.ctnDetails().txtWaitingListName().getValue() +"' Elective List Name is already used!"); } for (int i=0;form.ctnDetails().chkActive().getValue() && form.ctnDetails().qmbService().getValue()!=null && form.ctnDetails().dteStart().getValue()!=null && i<form.ctnDetails().grdConsultants().getRows().size();i++) { if (form.ctnDetails().grdConsultants().getRows().get(i).getColDefault() && domain.isConsultantMarkedAsDefaultForSameServiceForOtherConfiguration((HcpRefVo) form.ctnDetails().grdConsultants().getRows().get(i).getColConsultants().getValue(),form.ctnDetails().qmbService().getValue(),configToSave,form.ctnDetails().dteStart().getValue(),form.ctnDetails().dteEnd().getValue())) { errors.add("Your chosen default List Owner is already marked as default for another configuration with the same Service in the same time interval.");//WDEV-21153 } } for (int i=0;i<form.ctnDetails().grdConsultants().getRows().size();i++) { if (form.ctnDetails().grdConsultants().getRows().get(i).getColConsultants().getValue()==null) { errors.add("Please select a List Owner or remove the empty row"); } } for (int i=0;i<form.ctnDetails().grdHospitals().getRows().size();i++) { if (form.ctnDetails().grdHospitals().getRows().get(i).getColHospitals().getValue()==null) { errors.add("Please select a Location or remove the empty row"); } } if (errors.size() > 0) { String[] UIErrors = new String[errors.size()]; errors.toArray(UIErrors); return UIErrors; } return null; }