private void populateTypeOfRequestGrid(HospitalAtNightRequestTypeCollection typeOfRequestColl) { form.grdTypeRequest().getRows().clear(); if(typeOfRequestColl == null || typeOfRequestColl.size() == 0) return; for(int i=0; i<typeOfRequestColl.size(); i++) { grdTypeRequestRow row = form.grdTypeRequest().getRows().newRow(); row.setColType(typeOfRequestColl.get(i).getText()); row.setValue(typeOfRequestColl.get(i)); } }
private void initialize(Object[] args) throws PresentationLogicException { form.ccRequestingHCP().isRequired(true); form.ccRequestingHCP().initialize(MosType.HCP); Object hcp = domain.getHcpLiteUser(); if(hcp instanceof HcpLiteVo) { form.getLocalContext().setLoggedHCP((HcpLiteVo) hcp); } form.getLocalContext().setHospitalAtNightConfig(domain.getCurrentHospitalAtNightConfig(engine.getCurrentLocation()));// WDEV-13968 - this information should be used only on NEW record if(form.getGlobalContext().Clinical.getHospitalAtNightPatientDetails() == null) { if(form.getLocalContext().getLoggedHCP() == null) { form.getLocalContext().setErrorMessage(engine.showMessage("Logged in user must be an HCP.", "", MessageButtons.OK, MessageIcon.INFORMATION)); return; } if(form.getLocalContext().getHospitalAtNightConfig() == null)// WDEV-13968 { form.getLocalContext().setErrorMessage(engine.showMessage("Selected Hospital doesn't have a Hospital At Night Config.", "", MessageButtons.OK, MessageIcon.INFORMATION)); return; } if(form.getGlobalContext().Core.getPatientShort() == null) { form.getLocalContext().setErrorMessage(engine.showMessage("Please select a patient.", "", MessageButtons.OK, MessageIcon.INFORMATION)); return; } if(domain.isPatientAlreadyAddedToHospAtNightList(form.getGlobalContext().Core.getPatientShort(), form.getLocalContext().getHospitalAtNightConfig()))// WDEV-13968 { form.getLocalContext().setErrorMessage(engine.showMessage("Selected patient is already added to Hospital At Night List.", "", MessageButtons.OK, MessageIcon.INFORMATION)); return; } form.getLocalContext().setInpatientCareContext(domain.getInpatientCareContext(form.getGlobalContext().Core.getPatientShort())); if(form.getLocalContext().getInpatientCareContext() == null) { form.getLocalContext().setErrorMessage(engine.showMessage("Selected patient cannot be added to Hospital At Nigth List because is not currently an Inpatient.", "", MessageButtons.OK, MessageIcon.INFORMATION)); return; } form.ccRequestingHCP().setValue(form.getLocalContext().getLoggedHCP()); form.dtimRequestingDate().setValue(new DateTime()); } if(args != null && args.length > 0) { if(args[0] instanceof FormMode) form.getLocalContext().setDialogMode((FormMode) args[0]); } HospitalAtNightRequestTypeCollection typeOfRequestColl = ims.clinical.vo.lookups.LookupHelper.getHospitalAtNightRequestType(domain.getLookupService()); populateTypeOfRequestGrid(typeOfRequestColl); }