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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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]);
	}
}
 
Example 41
Project: AvoinApotti   File: DiagnosisListImpl.java   Source Code and License 5 votes vote down vote up
public ims.core.vo.DiagnosisVo saveDiagnosisVo(ims.core.vo.DiagnosisVo voDiagnosisVo) throws StaleObjectException, UniqueKeyViolationException																							
{
	if (!voDiagnosisVo.isValidated())
	{
		throw new DomainRuntimeException("This DiagnosisVo has not been validated");
	}
	
	DomainFactory factory = getDomainFactory();			
	Diagnosis domDiagnosis = DiagnosisVoAssembler.extractDiagnosis(factory, voDiagnosisVo);

	domDiagnosis.setKeywords(Keywords.setupKeyWords(domDiagnosis.getKeywords(), domDiagnosis.getDiagnosisName()));
	try
	{
		factory.save(domDiagnosis);
	}
	catch(UnqViolationUncheckedException e)
	{		
		//check which constraint was violated (name/taxononmy map)

		//name
		Diagnosis diag = Diagnosis.getDiagnosisFromDiagnosisName(factory, voDiagnosisVo.getDiagnosisName());
		if (diag != null && diag.getId() != null && !(diag.getId().equals(voDiagnosisVo.getID_Diagnosis())))
		{
			throw new UniqueKeyViolationException("Diagnosis record called \"" + voDiagnosisVo.getDiagnosisName() + "\" already exists. Duplicates not allowed.", e);	
		}

		//taxonomy map
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domDiagnosis, voDiagnosisVo.getTaxonomyMap(), "getDiagnosisName");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);
					
		throw (e);
	}
	return DiagnosisVoAssembler.create(domDiagnosis);
}
 
Example 42
Project: AvoinApotti   File: ProcedureListImpl.java   Source Code and License 5 votes vote down vote up
private List listDomProcedures(String filter, boolean activeOnly) 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();
	
	if (activeOnly)
	{
		hql.append(" where proc.isActive = :isActive");
		names.add("isActive");
		values.add(Boolean.TRUE);	
	}
	return Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);		
}
 
Example 43
Project: AvoinApotti   File: ManchesterTreatmentProtocolAdminImpl.java   Source Code and License 5 votes vote down vote up
public ims.clinical.vo.ClinicalProblemShortVoCollection listActiveProblems(String pcName) throws ims.domain.exceptions.DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from ClinicalProblem x 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, pcName, hql.toString(), names, values);
	return ClinicalProblemShortVoAssembler.createClinicalProblemShortVoCollectionFromClinicalProblem(resultsList);
}
 
Example 44
Project: AvoinApotti   File: SystemReviewConfigurationImpl.java   Source Code and License 5 votes vote down vote up
public ims.clinical.vo.ClinicalProblemVoCollection listClinicalProblems(String filter) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" from ClinicalProblem x");
	
	 
	String ret = "";
	if(filter!=null)
		ret = filter.replaceAll("%", "");
	if(ret.length()!=0)
		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 clinProblems =  Keywords.searchByKeywords(factory, filter, hql.toString(), names, values);
	if(clinProblems != null && clinProblems.size() > 0)
	{
		ClinicalProblemVoCollection tempColl = ClinicalProblemVoAssembler.createClinicalProblemVoCollectionFromClinicalProblem(clinProblems);
		return tempColl;
	}
			
	return null;
}
 
Example 45
Project: AvoinApotti   File: GPAdminImpl.java   Source Code and License 5 votes vote down vote up
public GP saveGp(GP gp) throws StaleObjectException, UniqueKeyViolationException
{
	if(!gp.isValidated()) 
		throw new DomainRuntimeException("Gp Not Validated");
		
	DomainFactory factory = getDomainFactory();
	
	gp.getName().setUppers();
	
	Gp doGp = GPAssembler.extractGp(factory, gp);
	Iterator it = doGp.getPractices().iterator();
	while(it.hasNext())
	{
		GpToPractice gpPract = (GpToPractice) it.next();
		gpPract.setGp(doGp);
	}
	try
	{
		factory.save(doGp);
	}
	catch (UnqViolationUncheckedException e)
	{
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doGp, "codeMappings", gp.getCodeMappings(), "getName");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);
	}
	return GPAssembler.create(doGp);
}
 
Example 46
Project: AvoinApotti   File: GPPracticeAdminImpl.java   Source Code and License 5 votes vote down vote up
public OrganisationVo saveOrg(OrganisationVo orgVo) throws StaleObjectException, UniqueKeyViolationException
{
	if (!orgVo.isValidated())
		throw new DomainRuntimeException("Org has not been validated");
	
	DomainFactory factory = getDomainFactory();
	Organisation doOrg = OrganisationVoAssembler.extractOrganisation(factory, orgVo);
	if (doOrg == null)
		throw new StaleObjectException(doOrg);
	doOrg.setUpperNames();
	
	try 
	{
		factory.save(doOrg);
	} 
	catch (UnqViolationUncheckedException e)
	{
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doOrg, "codeMappings", orgVo.getCodeMappings(), "getName");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);
		
		for (int i = 0; i < orgVo.getLocationSites().size(); i++)
		{
			LocSiteVo lsv = orgVo.getLocationSites().get(i);
			LocSite lsd = LocSiteVoAssembler.extractLocSite(factory, lsv);
			
			dupMessage = Keywords.checkDuplicateTaxonomy(factory, lsd, "codeMappings", lsv.getCodeMappings(), "getName");
			if(dupMessage != null)
				throw new UniqueKeyViolationException(dupMessage);
			
		}
		throw new UniqueKeyViolationException("An Record with this name already exists, Please change", e);
	}
	
	return OrganisationVoAssembler.create(doOrg);
}
 
Example 47
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 5 votes vote down vote up
private void checkChildsForDuplicateTaxonoy(LocMostVoCollection childs,Map<?, ?> doMap,DomainFactory factory) throws UniqueKeyViolationException
{
	for (int i = 0 ; i < childs.size(); i++)
	{
		LocMostVo locMostVo = childs.get(i);
		Object doObj = doMap.get(locMostVo);
		if (doObj instanceof Location)
		{
			String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doObj, "codeMappings", locMostVo.getCodeMappings(), "getName");
			if (dupMessage!=null)
				throw new UniqueKeyViolationException(dupMessage);
		}
	}
}
 
Example 48
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
/**
* listHotlistProblemsShort
 * @throws DomainInterfaceException 
*/
public ims.clinical.vo.ClinicalProblemShortVoCollection listHotlistProblemsShort(String pcName, ims.core.vo.lookups.Specialty lkpSpecialty) throws DomainInterfaceException
{
	if(pcName == null)
		throw new DomainRuntimeException("Invalid Search criteria. Clinical Problem name filter must be supplied.");
	
	if(lkpSpecialty == null)
		throw new DomainRuntimeException("Invalid Search criteria. Specialty must be supplied.");

	DomainFactory factory = getDomainFactory();

	StringBuffer hql = new StringBuffer("select distinct probHotListItem from ProblemHotlist as probHotList left join probHotList.hotlistItem as probHotListItem left join probHotListItem.problem as prob left join prob.keywords as kw "); 
	
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();

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

	hql.append(" and probHotList.specialty = :spec");
	names.add("spec");
	values.add(getDomLookup(lkpSpecialty));			

	List hits = Keywords.searchByKeywords(factory, pcName, hql.toString(), names, values);		
	
	List ret = new ArrayList();		
	for (int i = 0; i < hits.size(); i++)
	{
		ret.add(((ProblemHotlistItem)hits.get(i)).getProblem());
	}
	
	return ClinicalProblemShortVoAssembler.createClinicalProblemShortVoCollectionFromClinicalProblem(ret);
}
 
Example 49
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
/**
* listHotlistProcedureShort
 * @throws DomainInterfaceException 
*/
public ims.core.vo.ProcedureLiteVoCollection listHotlistProcedureShort(String procedureName, ims.core.vo.lookups.Specialty lkpSpecialty) throws DomainInterfaceException
{
	if(procedureName == null)
		throw new DomainRuntimeException("Invalid Search criteria. Clinical Problem name filter must be supplied.");
	
	if(lkpSpecialty == null)
		throw new DomainRuntimeException("Invalid Search criteria. Specialty must be supplied.");

	DomainFactory factory = getDomainFactory();

	StringBuffer hql = new StringBuffer("select distinct procHotListItem from ProcedureHotlist as procHotList left join procHotList.hotlistItem as procHotListItem left join procHotListItem.procedure as proc left 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);	

	if (lkpSpecialty !=null)
	{
		hql.append(" and procHotList.specialty = :spec");
		names.add("spec");
		values.add(getDomLookup(lkpSpecialty));			
	}

	List hits = Keywords.searchByKeywords(factory, procedureName, hql.toString(), names, values);		
	
	List ret = new ArrayList();		
	for (int i = 0; i < hits.size(); i++)
	{
		ret.add(((ProcedureHotlistItem)hits.get(i)).getProcedure());
	}
	
	return ProcedureLiteVoAssembler.createProcedureLiteVoCollectionFromProcedure(ret);
}
 
Example 50
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
public ims.core.vo.ProcedureLiteVoCollection listProcLiteVo(String filter) 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);	
	return ProcedureLiteVoAssembler.createProcedureLiteVoCollectionFromProcedure(Keywords.searchByKeywords(factory, filter, hql.toString(), names, values));		
}
 
Example 51
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
/**
* List of Diagnoses to choose from
 * @throws DomainInterfaceException 
*/
public ims.core.vo.DiagLiteVoCollection listDiagnosisLiteVo(String filter) 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();
	
	hql.append(" where d.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);	
	
	return DiagLiteVoAssembler.createDiagLiteVoCollectionFromDiagnosis(Keywords.searchByKeywords(factory, filter, hql.toString(), names, values));			
}
 
Example 52
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
/**
* listHotListDiagnosis
 * @throws DomainInterfaceException 
*/
public ims.core.vo.DiagLiteVoCollection listHotListDiagnosis(String name, ims.core.vo.lookups.Specialty specialty) throws DomainInterfaceException
{
	if(name == null)
		throw new DomainRuntimeException("Invalid Search criteria. Diagnosis name filter must be supplied.");
	
	if(specialty == null)
		throw new DomainRuntimeException("Invalid Search criteria. Specialty must be supplied.");

	DomainFactory factory = getDomainFactory();

	StringBuffer hql = new StringBuffer("select distinct diagHotListItem from DiagnosisHotlist as diagHotList left join diagHotList.hotListItem as diagHotListItem left join diagHotListItem.diagnosis as diag left join diag.keywords as kw "); 
	
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();

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

	hql.append(" and diagHotList.specialty = :spec");
	names.add("spec");
	values.add(getDomLookup(specialty));			

	List hits = Keywords.searchByKeywords(factory, name, hql.toString(), names, values);		
	
	List diags = new ArrayList();		
	for (int i = 0; i < hits.size(); i++)
	{
		diags.add(((DiagnosisHotlistItem)hits.get(i)).getDiagnosis());
	}
	
	return DiagLiteVoAssembler.createDiagLiteVoCollectionFromDiagnosis(diags);
}
 
Example 53
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
public MedicationLiteVoCollection listHotlistMedication(String name, Specialty specialty)  throws DomainInterfaceException
{
	if(name == null)
		throw new DomainRuntimeException("Invalid Search criteria. Medication name filter must be supplied.");
	
	if(specialty == null)
		throw new DomainRuntimeException("Invalid Search criteria. Specialty must be supplied.");

	DomainFactory factory = getDomainFactory();

	StringBuffer hql = new StringBuffer("select distinct medHotListItem from MedicationHotlist as medHotList left join medHotList.hotListItem as medHotListItem left join medHotListItem.medication as med left join med.keywords as kw "); 
	
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();

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

	hql.append(" and medHotList.specialty = :spec");
	names.add("spec");
	values.add(getDomLookup(specialty));			

	List hits = Keywords.searchByKeywords(factory, name, hql.toString(), names, values);		
	
	List meds = new ArrayList();		
	for (int i = 0; i < hits.size(); i++)
	{
		meds.add(((MedicationHotlistItem)hits.get(i)).getMedication());
	}
	
	return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(meds);
}
 
Example 54
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
public AllergenVoCollection listAllergens(String strAllergen) 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();
	
	hql.append(" where a.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);	

	return AllergenVoAssembler.createAllergenVoCollectionFromAllergen(Keywords.searchByKeywords(factory, strAllergen, hql.toString(), names, values));			

}
 
Example 55
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
public MedicationLiteVoCollection listMedications(String filterMedication) throws DomainInterfaceException
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer("select distinct m from Medication m join m.keywords as kw "); 
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();
	
	hql.append(" where m.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);			
	return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(Keywords.searchByKeywords(factory, filterMedication, hql.toString(), names, values));			
}
 
Example 56
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
public AllergenDetails saveAllergenDetails(AllergenDetails allergenDetails) throws StaleObjectException, UniqueKeyViolationException
{
	if (!allergenDetails.isValidated())
	{
		throw new DomainRuntimeException("Allergen Details VO has not be validated.");
	}
	
	DomainFactory factory = getDomainFactory();
	Allergen domAllergen = AllergenDetailsAssembler.extractAllergen(factory, allergenDetails);	
	
	domAllergen.setKeywords(Keywords.setupKeyWords(domAllergen.getKeywords(), domAllergen.getAllergenName()));
	try
	{
		factory.save(domAllergen);
	} 
	catch (UnqViolationUncheckedException e) 
	{	
		//check which constraint was violated (name/taxononmy map)

		//name
		Allergen allergen = Allergen.getAllergenFromAllergenName(factory, allergenDetails.getAllergenName());
		if (allergen != null && allergen.getId() != null && !(allergen.getId().equals(allergenDetails.getID_Allergen())))
		{
			throw new UniqueKeyViolationException("Allergen record called \"" + allergenDetails.getAllergenName() + "\" already exists. Duplicates not allowed.", e);					
		}

		//taxonomy map
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domAllergen, allergenDetails.getTaxonomyMap(), "getAllergenName");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);

		throw (e);
	}
	return AllergenDetailsAssembler.create(domAllergen);
}
 
Example 57
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
public DiagnosisVo saveDiagnosisVo(DiagnosisVo voDiagnosisVo) throws StaleObjectException, UniqueKeyViolationException 
{
	if (!voDiagnosisVo.isValidated())
	{
		throw new DomainRuntimeException("This DiagnosisVo has not been validated");
	}
	
	DomainFactory factory = getDomainFactory();			
	Diagnosis domDiagnosis = DiagnosisVoAssembler.extractDiagnosis(factory, voDiagnosisVo);

	domDiagnosis.setKeywords(Keywords.setupKeyWords(domDiagnosis.getKeywords(), domDiagnosis.getDiagnosisName()));
	try
	{
		factory.save(domDiagnosis);
	}
	catch(UnqViolationUncheckedException e)
	{		
		//check which constraint was violated (name/taxononmy map)

		//name
		Diagnosis diag = Diagnosis.getDiagnosisFromDiagnosisName(factory, voDiagnosisVo.getDiagnosisName());
		if (diag != null && diag.getId() != null && !(diag.getId().equals(voDiagnosisVo.getID_Diagnosis())))
		{
			throw new UniqueKeyViolationException("Diagnosis record called \"" + voDiagnosisVo.getDiagnosisName() + "\" already exists. Duplicates not allowed.", e);	
		}

		//taxonomy map
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domDiagnosis, voDiagnosisVo.getTaxonomyMap(), "getDiagnosisName");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);
					
		throw (e);
	}
	return DiagnosisVoAssembler.create(domDiagnosis);
}
 
Example 58
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
public ProblemConfigVo saveConfigVo(ProblemConfigVo voProblemConfig) throws StaleObjectException, UniqueKeyViolationException 
{
	if (!voProblemConfig.isValidated())
	{
		throw new DomainRuntimeException("This ProblemConfigVo has not be validated.");
	}
	
	DomainFactory factory = getDomainFactory();			
	ClinicalProblem domProblem = ProblemConfigVoAssembler.extractClinicalProblem(factory, voProblemConfig);
	
	domProblem.setKeywords(Keywords.setupKeyWords(domProblem.getKeywords(), domProblem.getPCName()));
	try
	{
		factory.save(domProblem);
	}
	catch(UnqViolationUncheckedException e)
	{
		//check which constraint was violated (name/taxononmy map)

		//name
		ClinicalProblem prob = ClinicalProblem.getClinicalProblemFromPCName(factory, voProblemConfig.getPCName());
		if (prob != null && prob.getId() != null && !(prob.getId().equals(voProblemConfig.getID_ClinicalProblem())))
		{
			throw new UniqueKeyViolationException("Problem record called \"" + voProblemConfig.getPCName() + "\" already exists. Duplicates not allowed.", e);					
		}
		
		//taxonomy map
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domProblem, voProblemConfig.getTaxonomyMap(), "getPCName");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);
		
		throw (e);
	}
	return ProblemConfigVoAssembler.create(domProblem);
}
 
Example 59
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
public MedicationVo saveConfigVo(MedicationVo voMedication) throws StaleObjectException, UniqueKeyViolationException 
	{
		if (!voMedication.isValidated())
		{
			throw new DomainRuntimeException("This MedicationVo has not been validated");
		}

		DomainFactory factory = getDomainFactory();

		voMedication.setMedicationName(voMedication.getMedicationName().trim());//wdev-1336

		Medication domMedication = MedicationVoAssembler.extractMedication(factory, voMedication);	
		
		domMedication.setKeywords(Keywords.setupKeyWords(domMedication.getKeywords(), domMedication.getMedicationName()));
	
		try
		{
			factory.save(domMedication);
		}
		catch (UnqViolationUncheckedException e)
		{		
//			check which constraint was violated (name/taxononmy map)

			//name
			Medication med = Medication.getMedicationFromMedicationName(factory, voMedication.getMedicationName());
			if (med != null && med.getId() != null && !(med.getId().equals(voMedication.getID_Medication())))
			{
				throw new UniqueKeyViolationException("Medication record called \"" + voMedication.getMedicationName() + "\" already exists. Duplicates not allowed.", e);	
			}
			
			//taxonomy map
			String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domMedication, voMedication.getTaxonomyMap(), "getMedicationName");
			if(dupMessage != null)
				throw new UniqueKeyViolationException(dupMessage);
			
			throw (e);
		}

		return MedicationVoAssembler.create(domMedication);
	}
 
Example 60
Project: AvoinApotti   File: ClinicalCodingImpl.java   Source Code and License 5 votes vote down vote up
public CancerImagingEventVo saveCancerImagingEventVo(CancerImagingEventVo voImagingEvent) throws StaleObjectException, UniqueKeyViolationException 
{
	if (!voImagingEvent.isValidated())
	{
		throw new DomainRuntimeException("This CancerImagingEventVo has not been validated");
	}
	
	DomainFactory factory = getDomainFactory();			
	CancerImagingEvent domCancerImagingEvent = CancerImagingEventVoAssembler.extractCancerImagingEvent(factory, voImagingEvent);

	domCancerImagingEvent.setKeywords(Keywords.setupKeyWords(domCancerImagingEvent.getKeywords(), domCancerImagingEvent.getImagingEventName()));
	try
	{
		factory.save(domCancerImagingEvent);
	}
	catch(UnqViolationUncheckedException e)
	{		
		//check which constraint was violated (name/taxononmy map)

		//name
		CancerImagingEvent cie = CancerImagingEvent.getCancerImagingEventFromImagingEventName(factory, voImagingEvent.getImagingEventName());
		if (cie != null && cie.getId() != null && !(cie.getId().equals(voImagingEvent.getID_CancerImagingEvent())))
		{
			throw new UniqueKeyViolationException("Cancer Imaging Event record called \"" + voImagingEvent.getImagingEventName() + "\" already exists. Duplicates not allowed.", e);	
		}

		//taxonomy map
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domCancerImagingEvent, voImagingEvent.getTaxonomyMap(), "getCancerImagingEvent");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);
					
		throw (e);
	}
	return CancerImagingEventVoAssembler.create(domCancerImagingEvent);
}