Java Code Examples for ims.admin.helper.Keywords

The following are top voted examples for showing how to use ims.admin.helper.Keywords. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AvoinApotti   File: OcsIfInboundImpl.java   View source code 6 votes vote down vote up
public void saveLocation(IfLocParentVo location) throws StaleObjectException, UniqueKeyViolationException
{
	if (!location.isValidated())
		throw new DomainRuntimeException("Location not Validated.");

	DomainFactory factory = getDomainFactory();

	Location doLocation = IfLocParentVoAssembler.extractLocation(factory, location);

	try
	{
		factory.save(doLocation);
	}
	catch (UnqViolationUncheckedException e)
	{
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doLocation, "codeMappings", location.getCodeMappings(), "getName");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);

		throw new UniqueKeyViolationException("An Location with this name already exists, Please change", e);			
	}
	return;		
}
 
Example 2
Project: AvoinApotti   File: MedicationListImpl.java   View source code 6 votes vote down vote up
/**
 * The filter is assumed to be one or more keywords seperated by some white space.
 * Each keyword is used in a seperate query to get back Medications which have a keyword like it.
 * Each subsequent keyword query narrows the original returned list so the eventual returned list
 * only contains Medication which contain a match on all the keywords.
 * It would be nice if this could be implemented as a single HQL query but I don't know how.
 * @param filter
 * @param activeOnly
 * @return
 * @throws DomainInterfaceException 
 */
private List listDomMedications(String filter, boolean activeOnly) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from Medication m join m.keywords as kw "); 
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	if (activeOnly)
	{
		hql.append(" where m.isActive = :isActive");
		names.add("isActive");
		values.add(Boolean.TRUE);	
	}		
	return Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);			
}
 
Example 3
Project: AvoinApotti   File: QuestionSelectNewImpl.java   View source code 6 votes vote down vote up
/**
* Question Add/Update
*/
public ims.core.vo.QuestionInformationVo saveQuestion(ims.core.vo.QuestionInformationVo questionInfo) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
{
	if(questionInfo == null)
		throw new RuntimeException("Cannot save null value for QuestionInformationVo");
	if(!questionInfo.isValidated())
		throw new CodingRuntimeException("QuestionInformationVo has not been validated");
				
	DomainFactory factory = getDomainFactory();
	QuestionInformation doQuestionInfo = QuestionInformationVoAssembler.extractQuestionInformation(factory, questionInfo);
	try 
	{
		factory.save(doQuestionInfo);
	} 
	catch(UnqViolationUncheckedException e)
	{
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doQuestionInfo, "taxonomyMap", questionInfo.getTaxonomyMap(), "getText");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);
		
		throw new UniqueKeyViolationException(e);
	}
	
	return QuestionInformationVoAssembler.create(doQuestionInfo);

}
 
Example 4
Project: AvoinApotti   File: DiagnosisListImpl.java   View source code 6 votes vote down vote up
/**
 * The filter is assumed to be one or more keywords seperated by some white space.
 * Each keyword is used in a seperate query to get back Diagnosis which have a keyword like it.
 * Each subsequent keyword query narrows the original returned list so the eventual returned list
 * only contains Diagnosis which contain a match on all the keywords.
 * It would be nice if this could be implemented as a single HQL query but I don't know how.
 * @param filter
 * @param activeOnly
 * @return
 * @throws DomainInterfaceException 
 */
private List listDomDiagnosis(String filter, boolean activeOnly) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from Diagnosis d join d.keywords as kw "); 
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	if (activeOnly)
	{
		hql.append(" where d.isActive = :isActive");
		names.add("isActive");
		values.add(Boolean.TRUE);	
	}
	
	return Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);			
}
 
Example 5
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
/**
 * Resets the keywords to the default values based on the cci name
 * @param void
 * @return void
 */
private void setDefaultKeywords()
{
	form.lyrDetails().tabKeywords().grdKeywords().getRows().clear();
	
	if (form.txtName().getValue() == null)
	{
		engine.showMessage("Please add the Name before set default keywords!");
		return;
	}
	
	String[] keys = Keywords.generateKeywords(form.txtName().getValue());
	
	for (int i = 0; i < keys.length; i++)
	{
		grdKeywordsRow row = form.lyrDetails().tabKeywords().grdKeywords().getRows().newRow();
		row.setValue(new KeywordVo());
		row.setKeyword(keys[i]);
	}
	updateControlsState();
}
 
Example 6
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void setDefaultKeywords()
{
	form.grdKeywords().getRows().clear();

	if (form.txtName().getValue() == null)
	{
		engine.showMessage("Please add the Name before set default keywords!");
		return;
	}

	String[] keys = Keywords.generateKeywords(form.txtName().getValue());

	for (int i = 0; i < keys.length; i++)
	{
		grdKeywordsRow row = form.grdKeywords().getRows().newRow();
		row.setValue(new KeywordVo());
		row.setColKeywords(keys[i]);
	}

	updateControlsState();
}
 
Example 7
Project: AvoinApotti   File: DiscriminatorConfigurationImpl.java   View source code 6 votes vote down vote up
private List<?> listItemInfo(String filter, boolean activeOnly) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from DiscriminatorConfig x");

	String ret = "";
	if (filter != null)
		ret = filter.replaceAll("%", "");
	if (ret.length() != 0)
		hql.append(" join x.keywords as kw");

	ArrayList<String> names = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();

	if (activeOnly)
	{
		hql.append(" where x.isActive = :isActive");
		names.add("isActive");
		values.add(Boolean.TRUE);
	}

	return Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);
}
 
Example 8
Project: AvoinApotti   File: DiscriminatorSelectDialogImpl.java   View source code 6 votes vote down vote up
private List<?> listItemInfo(String filter) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();

	StringBuffer hql = new StringBuffer(" from DiscriminatorConfig x");

	String ret = "";
	if (filter != null)
		ret = filter.replaceAll("%", "");
	if (ret.length() != 0)
		hql.append(" join x.keywords as kw");

	ArrayList<String> names = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();

	hql.append(" where x.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);

	return Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);
}
 
Example 9
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
private void checkChildsForDuplicateTaxonoy(LocSiteVoCollection childs,Map<?, ?> doMap,DomainFactory factory) throws UniqueKeyViolationException
{
		if (childs == null || doMap==null)
			return;
		
		for (int i = 0 ; i < childs.size(); i++)
		{
			LocSiteVo locMostVo = childs.get(i);
			Object doObj = doMap.get(locMostVo);
			//If doObj is null it means that nothing has changed in that record and hibernate didn't instantiated that record
			if (doObj instanceof Location)
			{
				//I'm using new Location(((Location) doObj).getId(),((Location) doObj).getVersion()) because LocSite extends Location 
				//and it's possible to have a Location with same mappings and not a LocSite.
				Location loc =(Location) doObj;
				String dupMessage = Keywords.checkDuplicateTaxonomy(factory,new Location(loc.getId(),loc.getVersion()), "codeMappings", locMostVo.getCodeMappings(), "getName");
				if (dupMessage!=null)
					throw new UniqueKeyViolationException(dupMessage);
			}
		}
}
 
Example 10
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
private void checkChildsForDuplicateTaxonoy(OrganisationVoCollection  childs,Map<?, ?> doMap,DomainFactory factory) throws UniqueKeyViolationException
{
	if (childs == null || doMap==null)
		return;
	
	for (int i = 0 ; i < childs.size(); i++)
	{
		OrganisationVo orgVo = childs.get(i);
		Object doObj = doMap.get(orgVo);
		//If doObj is null it means that nothing changed in that record and hibernate didn't instantiated that record
		if (doObj instanceof Organisation)
		{
			String dupMessage = Keywords.checkDuplicateTaxonomy(factory,doObj, "codeMappings", orgVo.getCodeMappings(), "getName");
			if (dupMessage!=null)
				throw new UniqueKeyViolationException(dupMessage);
		}
	}
}
 
Example 11
Project: AvoinApotti   File: BaselineObsImpl.java   View source code 6 votes vote down vote up
public AllergenVoCollection listActiveAllergies(String filter) throws DomainInterfaceException 
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from ");
	
	hql.append("Allergen x ");
	hql.append(" join x.keywords as kw");
	
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	hql.append(" where x.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);	
	
	List resultsList = Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);
	if (resultsList.size() > 0)
		return AllergenVoAssembler.createAllergenVoCollectionFromAllergen(resultsList).sort();
	else
		return null;
}
 
Example 12
Project: AvoinApotti   File: PresentationComponentImpl.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
public ims.core.vo.MedicationLiteVoCollection getMedications(String text) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from ");
	
	hql.append("Medication x ");
	hql.append(" join x.keywords as kw");
	
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	hql.append(" where x.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);	
	
	List resultsList = Keywords.searchByKeywords(factory, text, hql.toString(), names, values);
	if (resultsList.size() > 0)
		return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(resultsList).sort();
	else
		return null;
}
 
Example 13
Project: AvoinApotti   File: PresentationComponentImpl.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
public AllergenVoCollection getAllergies(String text) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from ");
	
	hql.append("Allergen x ");
	hql.append(" join x.keywords as kw");
	
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	hql.append(" where x.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);	
	
	List resultsList = Keywords.searchByKeywords(factory, text, hql.toString(), names, values);
	if (resultsList.size() > 0)
		return AllergenVoAssembler.createAllergenVoCollectionFromAllergen(resultsList).sort();
	else
		return null;

}
 
Example 14
Project: AvoinApotti   File: ClinicalCodingImpl.java   View source code 6 votes vote down vote up
public ims.clinical.vo.ClinicalProblemShortVoCollection listConfiguredProblemsShort(String pcName, Boolean activeOnly) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from ClinicalProblem p join p.keywords as kw "); 
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	if (activeOnly.booleanValue() == true)
	{
		hql.append(" where p.isActive = :isActive");
		names.add("isActive");
		values.add(Boolean.TRUE);	
	}
	
	return ClinicalProblemShortVoAssembler.createClinicalProblemShortVoCollectionFromClinicalProblem(Keywords.searchByKeywords(factory, pcName, hql.toString(), names, values));		
}
 
Example 15
Project: AvoinApotti   File: EDischargeMedsSthkDialogImpl.java   View source code 6 votes vote down vote up
public MedicationLiteVoCollection listMedicationHotlist(String text, HcpRefVo hcp) throws DomainInterfaceException//WDEV-11888//WDEV-11979
{
	//	WDEV-11979 - Start
	String hql = "select distinct med from MedicationFavourtiesForHCP as medFav left join medFav.hCP as hcp " +
			"left join medFav.medication as med left join med.keywords as kw where " +
			"(hcp.id = :hcpId and med.isActive = 1 and medFav.isRIE is null)";
	ArrayList<String> names = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();
	names.add("hcpId");
	values.add(hcp.getID_Hcp());
	return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(Keywords.searchByKeywords(getDomainFactory(), text, hql, names, values));
	//WDEV-11979 - End
	/*WDEV-11979
	String hql = "select distinct med from MedicationHotlist as medhot left join medhot.user as usr " +
			"left join medhot.hotListItem as hli left join hli.medication as med left join med.keywords as kw where" +
			"(medhot.user.id = :medicId and med.isActive = :active)" ;
	ArrayList<String> names = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();
	names.add("medicId");
	values.add(hcp.getID_Hcp());
	names.add("active");
	values.add(true);
	return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(Keywords.searchByKeywords(getDomainFactory(), text, hql, names, values));
	*/
}
 
Example 16
Project: openMAXIMS   File: OcsIfInboundImpl.java   View source code 6 votes vote down vote up
public void saveLocation(IfLocParentVo location) throws StaleObjectException, UniqueKeyViolationException
{
	if (!location.isValidated())
		throw new DomainRuntimeException("Location not Validated.");

	DomainFactory factory = getDomainFactory();

	Location doLocation = IfLocParentVoAssembler.extractLocation(factory, location);

	try
	{
		factory.save(doLocation);
	}
	catch (UnqViolationUncheckedException e)
	{
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doLocation, "codeMappings", location.getCodeMappings(), "getName");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);

		throw new UniqueKeyViolationException("An Location with this name already exists, Please change", e);			
	}
	return;		
}
 
Example 17
Project: openMAXIMS   File: AllergenListImpl.java   View source code 6 votes vote down vote up
/**
 * The filter is assumed to be one or more keywords seperated by some white space.
 * Each keyword is used in a seperate query to get back Allergens which have a keyword like it.
 * Each subsequent keyword query narrows the original returned list so the eventual returned list
 * only contains Allergens which contain a match on all the keywords.
 * It would be nice if this could be implemented as a single HQL query but I don't know how.
 * @param filter
 * @param activeOnly
 * @return
 * @throws DomainInterfaceException 
 */
private List listDomAllergen(String filter, boolean activeOnly) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from Allergen a join a.keywords as kw "); 
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	if (activeOnly)
	{
		hql.append(" where a.isActive = :isActive");
		names.add("isActive");
		values.add(Boolean.TRUE);	
	}
	return Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);			
}
 
Example 18
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
/**
 * Resets the keywords to the default values based on the cci name
 * @param void
 * @return void
 */
private void setDefaultKeywords()
{
	form.lyrDetails().tabKeywords().grdKeywords().getRows().clear();
	
	if (form.txtName().getValue() == null)
	{
		engine.showMessage("Please add the Name before set default keywords!");
		return;
	}
	
	String[] keys = Keywords.generateKeywords(form.txtName().getValue());
	
	for (int i = 0; i < keys.length; i++)
	{
		grdKeywordsRow row = form.lyrDetails().tabKeywords().grdKeywords().getRows().newRow();
		row.setValue(new KeywordVo());
		row.setKeyword(keys[i]);
	}
	updateControlsState();
}
 
Example 19
Project: openMAXIMS   File: DiscriminatorConfigurationImpl.java   View source code 6 votes vote down vote up
private List<?> listItemInfo(String filter, boolean activeOnly) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from DiscriminatorConfig x");

	String ret = "";
	if (filter != null)
		ret = filter.replaceAll("%", "");
	if (ret.length() != 0)
		hql.append(" join x.keywords as kw");

	ArrayList<String> names = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();

	if (activeOnly)
	{
		hql.append(" where x.isActive = :isActive");
		names.add("isActive");
		values.add(Boolean.TRUE);
	}

	return Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);
}
 
Example 20
Project: openMAXIMS   File: DiscriminatorSelectDialogImpl.java   View source code 6 votes vote down vote up
private List<?> listItemInfo(String filter) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();

	StringBuffer hql = new StringBuffer(" from DiscriminatorConfig x");

	String ret = "";
	if (filter != null)
		ret = filter.replaceAll("%", "");
	if (ret.length() != 0)
		hql.append(" join x.keywords as kw");

	ArrayList<String> names = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();

	hql.append(" where x.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);

	return Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);
}
 
Example 21
Project: openMAXIMS   File: PresentationComponentImpl.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
public AllergenVoCollection getAllergies(String text) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from ");
	
	hql.append("Allergen x ");
	hql.append(" join x.keywords as kw");
	
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	hql.append(" where x.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);	
	
	List resultsList = Keywords.searchByKeywords(factory, text, hql.toString(), names, values);
	if (resultsList.size() > 0)
		return AllergenVoAssembler.createAllergenVoCollectionFromAllergen(resultsList).sort();
	else
		return null;

}
 
Example 22
Project: openMAXIMS   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
private void checkChildsForDuplicateTaxonoy(OrganisationVoCollection  childs,Map<?, ?> doMap,DomainFactory factory) throws UniqueKeyViolationException
{
	if (childs == null || doMap==null)
		return;
	
	for (int i = 0 ; i < childs.size(); i++)
	{
		OrganisationVo orgVo = childs.get(i);
		Object doObj = doMap.get(orgVo);
		//If doObj is null it means that nothing changed in that record and hibernate didn't instantiated that record
		if (doObj instanceof Organisation)
		{
			String dupMessage = Keywords.checkDuplicateTaxonomy(factory,doObj, "codeMappings", orgVo.getCodeMappings(), "getName");
			if (dupMessage!=null)
				throw new UniqueKeyViolationException(dupMessage);
		}
	}
}
 
Example 23
Project: openmaxims-linux   File: OcsIfInboundImpl.java   View source code 6 votes vote down vote up
public void saveLocation(IfLocParentVo location) throws StaleObjectException, UniqueKeyViolationException
{
	if (!location.isValidated())
		throw new DomainRuntimeException("Location not Validated.");

	DomainFactory factory = getDomainFactory();

	Location doLocation = IfLocParentVoAssembler.extractLocation(factory, location);

	try
	{
		factory.save(doLocation);
	}
	catch (UnqViolationUncheckedException e)
	{
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doLocation, "codeMappings", location.getCodeMappings(), "getName");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);

		throw new UniqueKeyViolationException("An Location with this name already exists, Please change", e);			
	}
	return;		
}
 
Example 24
Project: openMAXIMS   File: AddEmergencyTheatreImpl.java   View source code 6 votes vote down vote up
private ProcedureLiteVoCollection listHotlistProcedures(String name, Specialty specialty) throws DomainInterfaceException
{

	DomainFactory factory = getDomainFactory();

	StringBuffer hql = new StringBuffer("select proc from ProcedureHotlist as procHotList left join procHotList.hotlistItem as procHotListItem left join procHotListItem.procedure as proc left join proc.keywords as kw " +
					   "where (proc.outpatientOnlyProcedure = 0 or proc.outpatientOnlyProcedure is null ) and (proc.medicalWL = 0 or proc.medicalWL is null )"); 
	
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();

	hql.append(" and proc.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);	

	if (specialty !=null)
	{
		hql.append(" and procHotList.specialty = :spec");
		names.add("spec");
		values.add(getDomLookup(specialty));			
	}
	 
	return ProcedureLiteVoAssembler.createProcedureLiteVoCollectionFromProcedure(Keywords.searchByKeywords(factory, name, hql.toString(), names, values)).sort();
}
 
Example 25
Project: openMAXIMS   File: BaselineObsImpl.java   View source code 6 votes vote down vote up
public AllergenVoCollection listActiveAllergies(String filter) throws DomainInterfaceException 
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from ");
	
	hql.append("Allergen x ");
	hql.append(" join x.keywords as kw");
	
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	hql.append(" where x.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);	
	
	List resultsList = Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);
	if (resultsList.size() > 0)
		return AllergenVoAssembler.createAllergenVoCollectionFromAllergen(resultsList).sort();
	else
		return null;
}
 
Example 26
Project: openMAXIMS   File: PresentationComponentImpl.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
public ims.core.vo.MedicationLiteVoCollection getMedications(String text) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from ");
	
	hql.append("Medication x ");
	hql.append(" join x.keywords as kw");
	
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	hql.append(" where x.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);	
	
	List resultsList = Keywords.searchByKeywords(factory, text, hql.toString(), names, values);
	if (resultsList.size() > 0)
		return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(resultsList).sort();
	else
		return null;
}
 
Example 27
Project: openMAXIMS   File: ClinicalCodingImpl.java   View source code 6 votes vote down vote up
public ims.clinical.vo.ClinicalProblemShortVoCollection listConfiguredProblemsShort(String pcName, Boolean activeOnly) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from ClinicalProblem p join p.keywords as kw "); 
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	if (activeOnly.booleanValue() == true)
	{
		hql.append(" where p.isActive = :isActive");
		names.add("isActive");
		values.add(Boolean.TRUE);	
	}
	
	return ClinicalProblemShortVoAssembler.createClinicalProblemShortVoCollectionFromClinicalProblem(Keywords.searchByKeywords(factory, pcName, hql.toString(), names, values));		
}
 
Example 28
Project: openMAXIMS   File: ClinicalCodingImpl.java   View source code 6 votes vote down vote up
public ims.core.vo.ProcedureLiteVoCollection listProcLiteVo(String filter, Boolean outpatonly) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from Procedure proc join proc.keywords as kw "); 
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	hql.append(" where proc.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);
	
	//wdev-19500
	if( outpatonly != null && Boolean.TRUE.equals(outpatonly))
	{
		hql.append(" and proc.outpatientOnlyProcedure = 1");
			
	}
	//----------
	
	return ProcedureLiteVoAssembler.createProcedureLiteVoCollectionFromProcedure(Keywords.searchByKeywords(factory, filter, hql.toString(), names, values));		
}
 
Example 29
Project: openMAXIMS   File: PresentationComponentImpl.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
public ims.core.vo.MedicationLiteVoCollection getMedications(String text) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from ");
	
	hql.append("Medication x ");
	hql.append(" join x.keywords as kw");
	
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	hql.append(" where x.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);	
	
	List resultsList = Keywords.searchByKeywords(factory, text, hql.toString(), names, values);
	if (resultsList.size() > 0)
		return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(resultsList).sort();
	else
		return null;
}
 
Example 30
Project: openmaxims-linux   File: ClinicalCodingImpl.java   View source code 6 votes vote down vote up
public ims.clinical.vo.ClinicalProblemShortVoCollection listConfiguredProblemsShort(String pcName, Boolean activeOnly) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from ClinicalProblem p join p.keywords as kw "); 
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	if (activeOnly.booleanValue() == true)
	{
		hql.append(" where p.isActive = :isActive");
		names.add("isActive");
		values.add(Boolean.TRUE);	
	}
	
	return ClinicalProblemShortVoAssembler.createClinicalProblemShortVoCollectionFromClinicalProblem(Keywords.searchByKeywords(factory, pcName, hql.toString(), names, values));		
}
 
Example 31
Project: openMAXIMS   File: EDischargeMedsSthkDialogImpl.java   View source code 6 votes vote down vote up
public MedicationLiteVoCollection listMedicationHotlist(String text, HcpRefVo hcp) throws DomainInterfaceException//WDEV-11888//WDEV-11979
{
	//	WDEV-11979 - Start
	String hql = "select distinct med from MedicationFavourtiesForHCP as medFav left join medFav.hCP as hcp " +
			"left join medFav.medication as med left join med.keywords as kw where " +
			"(hcp.id = :hcpId and med.isActive = 1 and medFav.isRIE is null)";
	ArrayList<String> names = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();
	names.add("hcpId");
	values.add(hcp.getID_Hcp());
	return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(Keywords.searchByKeywords(getDomainFactory(), text, hql, names, values));
	//WDEV-11979 - End
	/*WDEV-11979
	String hql = "select distinct med from MedicationHotlist as medhot left join medhot.user as usr " +
			"left join medhot.hotListItem as hli left join hli.medication as med left join med.keywords as kw where" +
			"(medhot.user.id = :medicId and med.isActive = :active)" ;
	ArrayList<String> names = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();
	names.add("medicId");
	values.add(hcp.getID_Hcp());
	names.add("active");
	values.add(true);
	return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(Keywords.searchByKeywords(getDomainFactory(), text, hql, names, values));
	*/
}
 
Example 32
Project: openmaxims-linux   File: QuestionSelectNewImpl.java   View source code 6 votes vote down vote up
/**
* Question Add/Update
*/
public ims.core.vo.QuestionInformationVo saveQuestion(ims.core.vo.QuestionInformationVo questionInfo) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
{
	if(questionInfo == null)
		throw new RuntimeException("Cannot save null value for QuestionInformationVo");
	if(!questionInfo.isValidated())
		throw new CodingRuntimeException("QuestionInformationVo has not been validated");
				
	DomainFactory factory = getDomainFactory();
	QuestionInformation doQuestionInfo = QuestionInformationVoAssembler.extractQuestionInformation(factory, questionInfo);
	try 
	{
		factory.save(doQuestionInfo);
	} 
	catch(UnqViolationUncheckedException e)
	{
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doQuestionInfo, "taxonomyMap", questionInfo.getTaxonomyMap(), "getText");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);
		
		throw new UniqueKeyViolationException(e);
	}
	
	return QuestionInformationVoAssembler.create(doQuestionInfo);

}
 
Example 33
Project: openmaxims-linux   File: Logic.java   View source code 6 votes vote down vote up
private void setDefaultKeywords()
{
	form.grdKeywords().getRows().clear();

	if (form.txtName().getValue() == null)
	{
		engine.showMessage("Please add the Name before set default keywords!");
		return;
	}

	String[] keys = Keywords.generateKeywords(form.txtName().getValue());

	for (int i = 0; i < keys.length; i++)
	{
		grdKeywordsRow row = form.grdKeywords().getRows().newRow();
		row.setValue(new KeywordVo());
		row.setColKeywords(keys[i]);
	}

	updateControlsState();
}
 
Example 34
Project: openMAXIMS   File: DiagnosisListImpl.java   View source code 6 votes vote down vote up
/**
 * The filter is assumed to be one or more keywords seperated by some white space.
 * Each keyword is used in a seperate query to get back Diagnosis which have a keyword like it.
 * Each subsequent keyword query narrows the original returned list so the eventual returned list
 * only contains Diagnosis which contain a match on all the keywords.
 * It would be nice if this could be implemented as a single HQL query but I don't know how.
 * @param filter
 * @param activeOnly
 * @return
 * @throws DomainInterfaceException 
 */
private List listDomDiagnosis(String filter, boolean activeOnly) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from Diagnosis d join d.keywords as kw "); 
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	if (activeOnly)
	{
		hql.append(" where d.isActive = :isActive");
		names.add("isActive");
		values.add(Boolean.TRUE);	
	}
	
	return Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);			
}
 
Example 35
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
/**
 * Resets the keywords to the default values based on the cci name
 * @param void
 * @return void
 */
private void setDefaultKeywords()
{
	form.lyrDetails().tabKeywords().grdKeywords().getRows().clear();
	
	if (form.txtName().getValue() == null)
	{
		engine.showMessage("Please add the Name before set default keywords!");
		return;
	}
	
	String[] keys = Keywords.generateKeywords(form.txtName().getValue());
	
	for (int i = 0; i < keys.length; i++)
	{
		grdKeywordsRow row = form.lyrDetails().tabKeywords().grdKeywords().getRows().newRow();
		row.setValue(new KeywordVo());
		row.setKeyword(keys[i]);
	}
	updateControlsState();
}
 
Example 36
Project: openMAXIMS   File: DiscriminatorConfigurationImpl.java   View source code 6 votes vote down vote up
private List<?> listItemInfo(String filter, boolean activeOnly) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from DiscriminatorConfig x");

	String ret = "";
	if (filter != null)
		ret = filter.replaceAll("%", "");
	if (ret.length() != 0)
		hql.append(" join x.keywords as kw");

	ArrayList<String> names = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();

	if (activeOnly)
	{
		hql.append(" where x.isActive = :isActive");
		names.add("isActive");
		values.add(Boolean.TRUE);
	}

	return Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);
}
 
Example 37
Project: openMAXIMS   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
private void checkChildsForDuplicateTaxonoy(LocSiteVoCollection childs,Map<?, ?> doMap,DomainFactory factory) throws UniqueKeyViolationException
{
		if (childs == null || doMap==null)
			return;
		
		for (int i = 0 ; i < childs.size(); i++)
		{
			LocSiteVo locMostVo = childs.get(i);
			Object doObj = doMap.get(locMostVo);
			//If doObj is null it means that nothing has changed in that record and hibernate didn't instantiated that record
			if (doObj instanceof Location)
			{
				//I'm using new Location(((Location) doObj).getId(),((Location) doObj).getVersion()) because LocSite extends Location 
				//and it's possible to have a Location with same mappings and not a LocSite.
				Location loc =(Location) doObj;
				String dupMessage = Keywords.checkDuplicateTaxonomy(factory,new Location(loc.getId(),loc.getVersion()), "codeMappings", locMostVo.getCodeMappings(), "getName");
				if (dupMessage!=null)
					throw new UniqueKeyViolationException(dupMessage);
			}
		}
}
 
Example 38
Project: openmaxims-linux   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
private void checkChildsForDuplicateTaxonoy(LocSiteVoCollection childs,Map<?, ?> doMap,DomainFactory factory) throws UniqueKeyViolationException
{
		if (childs == null || doMap==null)
			return;
		
		for (int i = 0 ; i < childs.size(); i++)
		{
			LocSiteVo locMostVo = childs.get(i);
			Object doObj = doMap.get(locMostVo);
			//If doObj is null it means that nothing has changed in that record and hibernate didn't instantiated that record
			if (doObj instanceof Location)
			{
				//I'm using new Location(((Location) doObj).getId(),((Location) doObj).getVersion()) because LocSite extends Location 
				//and it's possible to have a Location with same mappings and not a LocSite.
				Location loc =(Location) doObj;
				String dupMessage = Keywords.checkDuplicateTaxonomy(factory,new Location(loc.getId(),loc.getVersion()), "codeMappings", locMostVo.getCodeMappings(), "getName");
				if (dupMessage!=null)
					throw new UniqueKeyViolationException(dupMessage);
			}
		}
}
 
Example 39
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void setDefaultKeywords()
{
	form.grdKeywords().getRows().clear();
	String[] keys = Keywords.generateKeywords(form.txtMedicationName().getValue());
	for (int i = 0; i < keys.length; i++)
	{
		grdKeywordsRow row = form.grdKeywords().getRows().newRow();
		row.setValue(new KeywordVo());
		row.setKeyword(keys[i]);
	}
}
 
Example 40
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void setDefaultKeywords()
{
	form.grdKeywords().getRows().clear();
	String[] keys = Keywords.generateKeywords(form.txtDiagnosisName().getValue());
	for (int i = 0; i < keys.length; i++)
	{
		grdKeywordsRow row = form.grdKeywords().getRows().newRow();
		row.setValue(new KeywordVo());
		row.setKeyword(keys[i]);
	}
}