public IMos[] listMOS(String name, MosType mosType, HcpDisType mosDiscipline, Integer mosLocation, Boolean canReferPatient, Boolean isALocalConsultant, Boolean isResponsibleHcp, ServiceRefVo service, ServiceFunction function) { if(name == null || (name != null && name.length() == 0)) throw new DomainRuntimeException("Can not search on null name."); //WDEV-20489 if (name != null && name.length() > 40) { name = name.substring(1, 40); } //WDEV-20489 if(mosType == null) mosType = MosType.ALL; if(mosType.equals(MosType.HCP)) { return listHCP(name, null, mosDiscipline, mosLocation, canReferPatient,isALocalConsultant,isResponsibleHcp, service, function);//WDEV-15544 //WDEV-15194 } if(mosType.equals(MosType.MEDIC)) { return listHCP(name, MEDIC, null, mosLocation, canReferPatient,isALocalConsultant,isResponsibleHcp, service, function);//WDEV-15544 //WDEV-15194 } return listAllMOS(name); }
private IMos[] listHCP(String name, String subClass, HcpDisType mosDiscipline, Integer mosLocation, Boolean canReferPatient,Boolean isALocalConsultant,Boolean isResponsibleHcp, ServiceRefVo service, ServiceFunction function) { List hcps = listHCPList(name, subClass, mosDiscipline, mosLocation, canReferPatient,isALocalConsultant,isResponsibleHcp, service, function);//WDEV-15544 //WDEV-15194 if(mosDiscipline != null || subClass != null) { return listByDiscipline(hcps, name, mosDiscipline); } /*if(mosLocation!=null){ HcpCollection collHcps = listMOSByPrimaryLocation(HcpAssembler.createHcpCollectionFromHcp(hcps), mosLocation); DomainFactory factory = getDomainFactory(); hcps = HcpAssembler.extractHcpList(factory, collHcps); } */ return (HcpLiteVoAssembler.createHcpLiteVoCollectionFromHcp(hcps)).sort().toIMosArray(); }
@Override protected void onBtnLinkedAppointmentsClick() throws PresentationLogicException { form.getGlobalContext().Scheduling.setLinkedOPA(form.getLocalContext().getSelectedFutureAppointment()); ServiceAndFunctionForFutureApptsVo serviceAndFunction = form.getLocalContext().getServiceAndFunctionForAppt(); ServiceLiteVo service = serviceAndFunction != null ? serviceAndFunction.getService() : null; ServiceFunction function = serviceAndFunction != null && serviceAndFunction.getFunction() != null ? serviceAndFunction.getFunction().getFunction() : null; Integer numberOfLinkedAppts = 0; if (GroupNoLinkedApptsEnumeration.rdo2.equals(form.lyrTabs().tabLinkedOpa().GroupNoLinkedAppts().getValue())) numberOfLinkedAppts = 2; else if (GroupNoLinkedApptsEnumeration.rdo3.equals(form.lyrTabs().tabLinkedOpa().GroupNoLinkedAppts().getValue())) numberOfLinkedAppts = 3; engine.open(form.getForms().Scheduling.LinkedAppointmentDetails, new Object[] {numberOfLinkedAppts, service , function , form.getMode() , Boolean.TRUE}); }
@Override protected void onRadioButtonGroupSameDayValueChanged() throws PresentationLogicException { ServiceLiteVo originalService = null; ServiceFunction originalFunction = null; if(form.GroupSameService().getValue().equals(GroupSameServiceEnumeration.rdoYes)) { originalService = form.getLocalContext().getOriginalService(); originalFunction = form.getLocalContext().getOriginalFunction(); } form.cc1().initialise(form.getGlobalContext().RefMan.getCatsReferral(), true, 1, form.getLocalContext().getOriginalService(), originalFunction, getOtherDayValue(), form.getLocalContext().getCABApptDate(), false, GroupSameServiceEnumeration.rdoYes.equals(form.GroupSameService().getValue()) ? false : true); form.cc2().initialise(form.getGlobalContext().RefMan.getCatsReferral(), true, 2, originalService, originalFunction, getOtherDayValue(), form.getLocalContext().getCABApptDate(), false, GroupSameServiceEnumeration.rdoYes.equals(form.GroupSameService().getValue()) ? false : true); form.cc3().initialise(form.getGlobalContext().RefMan.getCatsReferral(), true, 3, originalService, originalFunction, getOtherDayValue(), form.getLocalContext().getCABApptDate(), false, GroupSameServiceEnumeration.rdoYes.equals(form.GroupSameService().getValue()) ? false : true); updateControlsState(); }
private boolean isFunctionInCollection(ServiceFunctionLiteVoCollection voCollServiceFunctions, ims.core.vo.lookups.ServiceFunction tempLkp) { if( voCollServiceFunctions == null || voCollServiceFunctions.size() == 0 || tempLkp == null) return false; for(ServiceFunctionLiteVo tempVo : voCollServiceFunctions) { if( tempVo != null && tempVo.getFunctionIsNotNull()) { if( tempVo.getFunction().equals(tempLkp)) return true; } } return false; }
@Override protected void onRadioButtonGroupSameDayValueChanged() throws PresentationLogicException { form.intValue().setValue(null); form.cmbPeriod().setValue(null); form.dteApptDate().setValue(null); ServiceLiteVo originalService = null; ServiceFunction originalFunction = null; if(form.GroupSameService().getValue().equals(GroupSameServiceEnumeration.rdoYes)) { originalService = form.getLocalContext().getOriginalService(); originalFunction = form.getLocalContext().getOriginalFunction(); } form.cc1().initialise(form.getGlobalContext().RefMan.getCatsReferral(), false, 1, form.getLocalContext().getOriginalService(), originalFunction, getOtherDayValue(), null, form.getLocalContext().getIsFromAppointmentOutcome(), GroupSameServiceEnumeration.rdoYes.equals(form.GroupSameService().getValue()) ? false : true); form.cc2().initialise(form.getGlobalContext().RefMan.getCatsReferral(), false, 2, originalService, originalFunction, getOtherDayValue(), null, form.getLocalContext().getIsFromAppointmentOutcome(), GroupSameServiceEnumeration.rdoYes.equals(form.GroupSameService().getValue()) ? false : true); form.cc3().initialise(form.getGlobalContext().RefMan.getCatsReferral(), false, 3, originalService, originalFunction, getOtherDayValue(), null, form.getLocalContext().getIsFromAppointmentOutcome(), GroupSameServiceEnumeration.rdoYes.equals(form.GroupSameService().getValue()) ? false : true); updateControlsState(); }
private void populateClinicTypeGridByServiceFunctionsGlobalContext(ServiceFunctionCollection ServiceFunctionsColl, boolean bSelectAll) { form.grdClinicTypes().getRows().clear(); if(ServiceFunctionsColl == null || ServiceFunctionsColl.size() == 0) return; ServiceFunctionLiteVoCollection voCollServiceFunctions = domain.listServiceFunctionByService(form.getGlobalContext().Scheduling.getProfileService()); if( voCollServiceFunctions == null || voCollServiceFunctions.size() == 0) return; form.grdClinicTypes().setReadOnly(false); for(int i = 0; i < ServiceFunctionsColl.size();i++) { ServiceFunction serviceFunction = ServiceFunctionsColl.get(i); ServiceFunctionLiteVo tempVo = getServiceFunctionByFunction(voCollServiceFunctions,serviceFunction); grdClinicTypesRow row = form.grdClinicTypes().getRows().newRow(); row.setColClinicType(serviceFunction != null ? serviceFunction.getText() : null); row.setColSelect(bSelectAll); row.setValue(tempVo); } }
private ServiceFunctionLiteVo getServiceFunctionByFunction(ServiceFunctionLiteVoCollection voCollServiceFunctions,ServiceFunction serviceFunction) { if( voCollServiceFunctions == null || voCollServiceFunctions.size() == 0) return null; if( serviceFunction == null ) return null; for(int i = 0; i < voCollServiceFunctions.size();i++) { ServiceFunctionLiteVo tenmpVo = voCollServiceFunctions.get(i); if( tenmpVo != null && serviceFunction.equals(tenmpVo.getFunction())) { return tenmpVo; } } return null; }
private DynamicGridRow getFunctionRow(DynamicGridRow serviceRow, ServiceFunction function) { if(function == null) return null; for(int i=0; i<serviceRow.getRows().size(); i++) { DynamicGridRow functionRow = serviceRow.getRows().get(i); if(functionRow.getValue() instanceof HCPServiceFunctionVo) { if(function.equals(((HCPServiceFunctionVo) functionRow.getValue()).getFunction())) return functionRow; } else if(functionRow.getValue() instanceof ServiceFunction) { if(function.equals((ServiceFunction) functionRow.getValue())) return functionRow; } } return null; }
private boolean functionWasAlreadyAdded(ServiceFunction function) { if(function == null) return false; for(int i=0; i<form.lyrService().tabActivityandFunctions().grdServiceFunction().getRows().size(); i++) { ServiceFunctionForServiceConfigurationVo rowValue = form.lyrService().tabActivityandFunctions().grdServiceFunction().getRows().get(i).getValue(); if(rowValue != null && function.equals(rowValue.getFunction())) { form.lyrService().tabActivityandFunctions().grdServiceFunction().setValue(rowValue); return true; } } return false; }
private ServiceFunction createAndSaveServiceFunctionInstance() { ServiceFunction function = domain.getServiceFunctionInstance(form.lyrService().tabActivityandFunctions().txtFunction().getValue()); if(function != null) return function; try { function = domain.saveServiceFunctionInstance(form.lyrService().tabActivityandFunctions().txtFunction().getValue()); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); return null; } return function; }
public ServiceFunction saveServiceFunctionInstance(String serviceFunctionText) throws StaleObjectException { DomainFactory factory = getDomainFactory(); java.util.List lst = factory.find("from LookupInstance l where l.id = (select max(l1.id) from LookupInstance l1)"); int nextVal = ((LookupInstance) lst.get(0)).getId(); if (nextVal < 0) nextVal = 0; Lookup type = factory.getLookup(ServiceFunction.TYPE_ID); LookupInstance doServiceFunction = new LookupInstance(nextVal + 1, type, true, serviceFunctionText); doServiceFunction.setText(serviceFunctionText); factory.save(doServiceFunction); return createServiceFunctionLookupInstance(doServiceFunction); }
public ServiceFunction getServiceFunctionInstance(String serviceFunctionText) { if(serviceFunctionText == null || serviceFunctionText.length() == 0) return null; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); DomainFactory factory = getDomainFactory(); String hql = "select li from LookupInstance as li left join li.type as lt where lt.id = :LookupId and UPPER(li.text) = :ServiceFunctionText "; markers.add("LookupId"); values.add(ServiceFunction.TYPE_ID); markers.add("ServiceFunctionText"); values.add(serviceFunctionText.toUpperCase()); List serviceFunstions = factory.find(hql, markers, values); if(serviceFunstions == null || serviceFunstions.size() == 0) return null; if(serviceFunstions.get(0) instanceof LookupInstance) return createServiceFunctionLookupInstance((LookupInstance) serviceFunstions.get(0)); return null; }
@Override protected void onBtnAppointmentDetailsClick() throws ims.framework.exceptions.PresentationLogicException { if(form.getLocalContext().getCatsReferral() == null) return; ServiceLiteVo originalService = form.getLocalContext().getCatsReferral().getReferralDetails() != null ? form.getLocalContext().getCatsReferral().getReferralDetails().getService() : null; ServiceFunction originalFunction = form.cmbFunction().getValue() != null ? form.cmbFunction().getValue().getFunction() : null; if(Boolean.TRUE.equals(form.getLocalContext().getCatsReferral().getIsCAB())) { engine.open(form.getForms().Scheduling.LinkedAppointmentDetailsCB, new Object[] {getNumberOfLinkedAppointmentsFromScreen(form.lyrActionsRequired().tabLinkedOPA().GroupLinkedAppt().getValue()), originalService, originalFunction, getCABAppointments(form.getLocalContext().getCatsReferral().getAppointments()), (FormMode.VIEW.equals(form.getMode()) ? FormMode.VIEW : null)}); } else { engine.open(form.getForms().Scheduling.LinkedAppointmentDetails, new Object[] {getNumberOfLinkedAppointmentsFromScreen(form.lyrActionsRequired().tabLinkedOPA().GroupLinkedAppt().getValue()), originalService, originalFunction, (FormMode.VIEW.equals(form.getMode()) ? FormMode.VIEW : null)}); } }
private ServiceFunctionVo inFunctionList(ServiceFunction value, ServiceFunctionVoCollection voVollFunc) { if (voVollFunc != null && voVollFunc.size() > 0) { for (int i = 0; i < voVollFunc.size(); i++) { if (voVollFunc.get(i).getFunctionIsNotNull() && voVollFunc.get(i).getFunction().equals(value)) return voVollFunc.get(i); } } return null; }
public void initializeResponsibleHcp(MosType mosType, Boolean isResponsibleHCP, ServiceRefVo service, ServiceFunction function) { clearSpecificSearchContexts(); form.getLocalContext().setMOSSearchType(mosType); form.getLocalContext().setIsResponsibleHcp(isResponsibleHCP); form.getLocalContext().setService(service); form.getLocalContext().setFunction(function); }
private boolean setColSelectTrueIfGridContainFunction(ServiceFunction tempLk ) { for(int i = 0;i < form.lyrDetails().tabGeneralDetails().grdServiceFunctions().getRows().size();i++) { grdServiceFunctionsRow row = form.lyrDetails().tabGeneralDetails().grdServiceFunctions().getRows().get(i); if( row != null && tempLk != null && row.getValue() != null && tempLk.equals(row.getValue())) { row.setColumnSelect(true); return true; } } return false; }
public void initialise(CatsReferralRefVo catsReferral, Boolean isCAB, Integer sequence, ServiceLiteVo originalService, ServiceFunction originalFunction, Boolean enableTimeControls, Date cabDate, Boolean fromApptOutcome, Boolean enableService) { form.getLocalContext().setCatsReferral(catsReferral); form.getLocalContext().setIsCAB(isCAB); form.getLocalContext().setSequence(sequence); form.getLocalContext().setOriginalService(originalService); form.getLocalContext().setOriginalFunction(originalFunction); clear(); form.GroupSeq().setValue(getGroupSequenceValue(sequence)); if(originalService != null) { form.qmbService().newRow(originalService, originalService.getServiceName()); } form.qmbService().setValue(originalService); bindFunctionCombo(form.qmbService().getValue()); if(originalFunction != null) { form.cmbFunction().newRow(originalFunction, originalFunction.getText()); } form.cmbFunction().setValue(originalFunction); form.getLocalContext().setServiceTriageConf(domain.getServiceTriageActions(originalService)); bindOtherHCPCombo(); form.getLocalContext().setEnableTimeControls(enableTimeControls); form.getLocalContext().setApptDate(cabDate); form.getLocalContext().setIsFromAppointmentOutcome(fromApptOutcome); form.getLocalContext().setEnableService(enableService); updateControlsState(); }
public ServiceFunctionLiteVo getServiceFunction(ServiceRefVo service, ServiceFunction function) { if (service == null || service.getID_Service() == null || function == null) return null; List list = getDomainFactory().find("select servFunct from ServiceFunction as servFunct left join servFunct.service as serv left join servFunct.function as func where servFunct.isActive = 1 and serv.id = :serviceID and func.id = :functionID", new String[] {"serviceID", "functionID"}, new Object[] {service.getID_Service(), function.getID()}); if (list != null && list.size() > 0) return ServiceFunctionLiteVoAssembler.createServiceFunctionLiteVoCollectionFromServiceFunction(list).get(0); return null; }
private Object getChildText(HCPServiceFunctionVo inst, ServiceFunction function) { if(inst != null) { return inst.getFunction() != null ? inst.getFunction().getText() : null; } return function != null ? function.getText() : null; }
private HCPServiceFunctionVo createHcpServiceFunctionRecord(ServiceLiteVo service, ServiceFunction function) { HCPServiceFunctionVo record = new HCPServiceFunctionVo(); record.setService(service); record.setFunction(function); record.setIsActive(true); return record; }
private void addServiceFunction() { if(form.lyrService().tabActivityandFunctions().txtFunction().getValue() == null || form.lyrService().tabActivityandFunctions().txtFunction().getValue().trim().length() == 0) return; if(form.lyrService().tabActivityandFunctions().qmbService().getValue() == null) return; form.lyrService().tabActivityandFunctions().grdServiceFunction().setValue(null); ServiceFunctionForServiceConfigurationVo serviceFunction = new ServiceFunctionForServiceConfigurationVo(); serviceFunction.setService(form.lyrService().tabActivityandFunctions().qmbService().getValue()); ServiceFunction function = createAndSaveServiceFunctionInstance(); if(function == null) return; if(functionWasAlreadyAdded(function)) { form.lyrService().tabActivityandFunctions().txtFunction().setValue(null); return; } serviceFunction.setFunction(function); serviceFunction.setIsActive(true); addServiceFunctionRow(serviceFunction); form.lyrService().tabActivityandFunctions().txtFunction().setValue(null); }
public ServiceFunctionCollection listServiceFunctionsLookups(String searchText) { ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); DomainFactory factory = getDomainFactory(); String hql = "select li from LookupInstance as li left join li.type as lt where lt.id = :LookupId "; markers.add("LookupId"); values.add(ServiceFunction.TYPE_ID); if(searchText != null) { hql += " and UPPER(li.text) like :LookupText"; markers.add("LookupText"); values.add(searchText.toUpperCase() + "%"); } hql += " order by UPPER(li.text) asc"; List serviceFunctions = factory.find(hql, markers, values); if(serviceFunctions == null) return null; ServiceFunctionCollection coll = new ServiceFunctionCollection(); for(int i=0; i<serviceFunctions.size(); i++) { if(serviceFunctions.get(i) instanceof LookupInstance) { LookupInstance instance = (LookupInstance) serviceFunctions.get(i); coll.add(createServiceFunctionLookupInstance(instance)); } } return coll.size() > 0 ? coll : null; }
public HcpLiteVoCollection listRedirectedHCPs(String value, ServiceRefVo service, HcpRefVo currentResponsibleHcpRef, ServiceFunction serviceFunction) //DEV-21062 { if (value == null || value.length() == 0 || service == null) return null; ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); String query = " select h from Hcp h "; query += " left join h.serviceFunction as servf left join servf.service as serv "; query += " where h.isActive = 1 and (h.mos.name.upperSurname like :NAME or h.mos.name.upperForename like :NAME) "; query += " AND h.isHCPaResponsibleHCP = 1 "; query += " AND serv.id = :serviceID and servf.isActive = 1 "; paramNames.add("NAME"); paramValues.add(value.toUpperCase() + "%"); paramNames.add("serviceID"); paramValues.add(service.getID_Service()); //WDEV-21041 if (currentResponsibleHcpRef != null) { query += " AND h.id <> :HCP_ID "; paramNames.add("HCP_ID"); paramValues.add(currentResponsibleHcpRef.getID_Hcp()); } if(serviceFunction != null) { query += " AND servf.function.id =:FUNCTION "; paramNames.add("FUNCTION"); paramValues.add(serviceFunction.getID()); } query += " ORDER BY h.mos.name.upperSurname"; return HcpLiteVoAssembler.createHcpLiteVoCollectionFromHcp(getDomainFactory().find(query.toString(), paramNames, paramValues)); }
@Override protected void onFormOpen(Object[] args) throws PresentationLogicException { if(args != null && args.length > 0) { if(args[0] instanceof Integer) { form.getLocalContext().setNumberOfLinkedAppointments((Integer) args[0]); } if(args.length > 1) { if(args[1] instanceof ServiceLiteVo) { form.getLocalContext().setOriginalService((ServiceLiteVo) args[1]); } if(args.length > 2) { if(args[2] instanceof ServiceFunction) { form.getLocalContext().setOriginalFunction((ServiceFunction) args[2]); } if(args.length > 3) { if(args[3] instanceof BookAppointmentForReferralTriageVoCollection) { form.getLocalContext().setCABAppointments((BookAppointmentForReferralTriageVoCollection) args[3]); } if(args.length > 4) { if(args[4] instanceof FormMode) { form.getLocalContext().setFormMode((FormMode) args[4]); } } } } } } initialise(); open(); }
@Override protected void onFormOpen(Object[] args) throws ims.framework.exceptions.PresentationLogicException { if(args != null && args.length > 0) { if(args[0] instanceof Integer) { form.getLocalContext().setNumberOfLinkedAppointments((Integer) args[0]); } if(args.length > 1) { if(args[1] instanceof ServiceLiteVo) { form.getLocalContext().setOriginalService((ServiceLiteVo) args[1]); } if(args.length > 2) { if(args[2] instanceof ServiceFunction) { form.getLocalContext().setOriginalFunction((ServiceFunction) args[2]); } } if(args.length > 3) { if(args[3] instanceof FormMode) { form.getLocalContext().setFormMode((FormMode) args[3]); } } if(args.length > 4) { if(args[4] instanceof Boolean) { form.getLocalContext().setIsFromAppointmentOutcome((Boolean) args[4]); } } } } initialise(); open(); }
private void addChildRow(DynamicGridRow serviceRow, HCPServiceFunctionVo inst, ServiceFunction function, ServiceFunctionForServiceConfigurationVo conf) { if(serviceRow == null || (inst == null && function == null)) return; DynamicGridRow childRow = null; childRow = getFunctionRow(serviceRow, inst != null ? inst.getFunction() : function); if(childRow == null && inst != null && !Boolean.TRUE.equals(inst.getIsActive())) return; DynamicGridCell rowCell = null; if(childRow == null) { childRow = serviceRow.getRows().newRow(); rowCell = childRow.getCells().newCell(getColumn(COLUMN_SERVICE), DynamicCellType.STRING); rowCell.setValue(getChildText(inst, function)); rowCell.setReadOnly(true); } childRow.setValue(inst != null ? inst : function); DynamicGridCell rowCellC = childRow.getCells().get(getColumn(COLUMN_CHECKBOX)); if(rowCellC == null) { rowCellC = childRow.getCells().newCell(getColumn(COLUMN_CHECKBOX), DynamicCellType.BOOL); rowCellC.setAutoPostBack(true); } DynamicGridCell cellParent = rowCellC.getRow().getParent().getCells().get(getColumn(COLUMN_SELECT_ALL_CHILDREN)); if(cellParent != null) { rowCellC.setReadOnly(rowCellC.getRow().getParent().getCells().get(getColumn(COLUMN_SELECT_ALL_CHILDREN)).isReadOnly()); } rowCellC.setValue(inst != null ? Boolean.TRUE.equals(inst.getIsActive()) : null); }
private ServiceFunction createServiceFunctionLookupInstance(LookupInstance instance) { if(instance == null) return null; ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance.getImage() != null) { img = new ims.framework.utils.ImagePath(instance.getImage().getImageId(), instance.getImage().getImagePath()); } color = instance.getColor(); if (color != null) color.getValue(); ims.core.vo.lookups.ServiceFunction serviceFunction = new ims.core.vo.lookups.ServiceFunction(instance.getId(),instance.getText(), instance.isActive(), null, img, color); ims.core.vo.lookups.ServiceFunction parentServiceFunction = serviceFunction; ims.domain.lookups.LookupInstance parentServiceFunctionDo = instance.getParent(); while (parentServiceFunctionDo != null) { if (parentServiceFunctionDo.getImage() != null) { img = new ims.framework.utils.ImagePath(parentServiceFunctionDo.getImage().getImageId(), parentServiceFunctionDo.getImage().getImagePath() ); } else { img = null; } color = parentServiceFunctionDo.getColor(); if (color != null) { color.getValue(); } parentServiceFunction.setParent(new ims.core.vo.lookups.ServiceFunction(parentServiceFunctionDo.getId(),parentServiceFunctionDo.getText(), parentServiceFunctionDo.isActive(), null, img, color)); parentServiceFunction = parentServiceFunction.getParent(); parentServiceFunctionDo = parentServiceFunctionDo.getParent(); } return serviceFunction; }