Java Code Examples for ims.core.vo.lookups.MedicationRouteCollection

The following are top voted examples for showing how to use ims.core.vo.lookups.MedicationRouteCollection. 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: EDischargeMedsSthkDialogImpl.java   Source Code and License 6 votes vote down vote up
public MedicationRouteCollection getRoutes(MedicationRefVo medication, DoseFormIndicator form)
{
	if (!medication.getID_MedicationIsNotNull())
		throw new DomainRuntimeException("Medication with null as id");
	String hql =  "select routes from Medication as medication left join medication.forms as forms left join forms.formRoutes as routes" +
			" left join forms.form as form where (medication.id = :medId and form.id = :formId)"; 
	List<?> dos = getDomainFactory().find(hql,new String[]{"medId","formId"},new Object[]{medication.getID_Medication(),form.getID()});
	if (dos == null || dos.size() == 0)
		return null;
	MedicationRouteLiteVoCollection routes = MedicationRouteLiteVoAssembler.createMedicationRouteLiteVoCollectionFromMedicationRoute(dos);
	MedicationRouteCollection result = new MedicationRouteCollection();
	for (int i = 0 ; i < routes.size() ; i++)
	{
		if( routes.get(i)!=null && routes.get(i).getRouteIsNotNull())
			result.add(routes.get(i).getRoute());
	}
	return result;
}
 
Example 2
Project: openMAXIMS   File: EDischargeMedsSthkDialogImpl.java   Source Code and License 6 votes vote down vote up
public MedicationRouteCollection getRoutes(MedicationRefVo medication, DoseFormIndicator form)
{
	if (!medication.getID_MedicationIsNotNull())
		throw new DomainRuntimeException("Medication with null as id");
	String hql =  "select routes from Medication as medication left join medication.forms as forms left join forms.formRoutes as routes" +
			" left join forms.form as form where (medication.id = :medId and form.id = :formId)"; 
	List<?> dos = getDomainFactory().find(hql,new String[]{"medId","formId"},new Object[]{medication.getID_Medication(),form.getID()});
	if (dos == null || dos.size() == 0)
		return null;
	MedicationRouteLiteVoCollection routes = MedicationRouteLiteVoAssembler.createMedicationRouteLiteVoCollectionFromMedicationRoute(dos);
	MedicationRouteCollection result = new MedicationRouteCollection();
	for (int i = 0 ; i < routes.size() ; i++)
	{
		if( routes.get(i)!=null && routes.get(i).getRouteIsNotNull())
			result.add(routes.get(i).getRoute());
	}
	return result;
}
 
Example 3
Project: openMAXIMS   File: EDischargeMedsSthkDialogImpl.java   Source Code and License 6 votes vote down vote up
public MedicationRouteCollection getRoutes(MedicationRefVo medication, DoseFormIndicator form)
{
	if (!medication.getID_MedicationIsNotNull())
		throw new DomainRuntimeException("Medication with null as id");
	String hql =  "select routes from Medication as medication left join medication.forms as forms left join forms.formRoutes as routes" +
			" left join forms.form as form where (medication.id = :medId and form.id = :formId)"; 
	List<?> dos = getDomainFactory().find(hql,new String[]{"medId","formId"},new Object[]{medication.getID_Medication(),form.getID()});
	if (dos == null || dos.size() == 0)
		return null;
	MedicationRouteLiteVoCollection routes = MedicationRouteLiteVoAssembler.createMedicationRouteLiteVoCollectionFromMedicationRoute(dos);
	MedicationRouteCollection result = new MedicationRouteCollection();
	for (int i = 0 ; i < routes.size() ; i++)
	{
		if( routes.get(i)!=null && routes.get(i).getRouteIsNotNull())
			result.add(routes.get(i).getRoute());
	}
	return result;
}
 
Example 4
Project: openmaxims-linux   File: EDischargeMedsSthkDialogImpl.java   Source Code and License 6 votes vote down vote up
public MedicationRouteCollection getRoutes(MedicationRefVo medication, DoseFormIndicator form)
{
	if (!medication.getID_MedicationIsNotNull())
		throw new DomainRuntimeException("Medication with null as id");
	String hql =  "select routes from Medication as medication left join medication.forms as forms left join forms.formRoutes as routes" +
			" left join forms.form as form where (medication.id = :medId and form.id = :formId)"; 
	List<?> dos = getDomainFactory().find(hql,new String[]{"medId","formId"},new Object[]{medication.getID_Medication(),form.getID()});
	if (dos == null || dos.size() == 0)
		return null;
	MedicationRouteLiteVoCollection routes = MedicationRouteLiteVoAssembler.createMedicationRouteLiteVoCollectionFromMedicationRoute(dos);
	MedicationRouteCollection result = new MedicationRouteCollection();
	for (int i = 0 ; i < routes.size() ; i++)
	{
		if( routes.get(i)!=null && routes.get(i).getRouteIsNotNull())
			result.add(routes.get(i).getRoute());
	}
	return result;
}
 
Example 5
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void rebindRouteRows(DynamicGridRow formRow)
{
	
	if (formRow == null)
		return;
	DynamicGridRowCollection rows = formRow.getRows();
	MedicationRouteCollection mRoutes = ims.core.vo.lookups.LookupHelper.getMedicationRoute(this.domain.getLookupService());
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (rows.get(i).getValue() instanceof MedicationRouteVo)
		{
			MedicationRouteVo x = (MedicationRouteVo) rows.get(i).getValue();
			if (!x.getRouteIsNotNull())
				continue;
			mRoutes.remove(x.getRoute());
		}	
	}
	for (int i = 0 ; i < rows.size() ; i++)
	{
		DynamicGridCell cell = rows.get(i).getCells().get(form.lyrDetails().tabFRU().dyngrdFRU().getColumns().getByIdentifier(COL_MAIN));
		Object back = cell.getValue();
		cell.getItems().clear();
		if (back!=null)
			cell.getItems().newItem(back);
		for (int j = 0 ; j < mRoutes.size() ;j++)
			cell.getItems().newItem(mRoutes.get(j));
		cell.setValue(back);
	}
}
 
Example 6
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateCmbRoute(MedicationRouteCollection routes)
{
	form.cmbRoute().clear();
	if (routes == null)
		return;
	for (int i = 0 ; i < routes.size() ; i++)
	{
		MedicationRoute route = routes.get(i);
		if (route != null)
		{
			form.cmbRoute().newRow(route, route.getText());
		}
	}
	
}
 
Example 7
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void rebindRouteRows(DynamicGridRow formRow)
{
	
	if (formRow == null)
		return;
	DynamicGridRowCollection rows = formRow.getRows();
	MedicationRouteCollection mRoutes = ims.core.vo.lookups.LookupHelper.getMedicationRoute(this.domain.getLookupService());
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (rows.get(i).getValue() instanceof MedicationRouteVo)
		{
			MedicationRouteVo x = (MedicationRouteVo) rows.get(i).getValue();
			if (!x.getRouteIsNotNull())
				continue;
			mRoutes.remove(x.getRoute());
		}	
	}
	for (int i = 0 ; i < rows.size() ; i++)
	{
		DynamicGridCell cell = rows.get(i).getCells().get(form.lyrDetails().tabFRU().dyngrdFRU().getColumns().getByIdentifier(COL_MAIN));
		Object back = cell.getValue();
		cell.getItems().clear();
		if (back!=null)
			cell.getItems().newItem(back);
		for (int j = 0 ; j < mRoutes.size() ;j++)
			cell.getItems().newItem(mRoutes.get(j));
		cell.setValue(back);
	}
}
 
Example 8
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateCmbRoute(MedicationRouteCollection routes)
{
	form.cmbRoute().clear();
	if (routes == null)
		return;
	for (int i = 0 ; i < routes.size() ; i++)
	{
		MedicationRoute route = routes.get(i);
		if (route != null)
		{
			form.cmbRoute().newRow(route, route.getText());
		}
	}
	
}
 
Example 9
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void rebindRouteRows(DynamicGridRow formRow)
{
	
	if (formRow == null)
		return;
	DynamicGridRowCollection rows = formRow.getRows();
	MedicationRouteCollection mRoutes = ims.core.vo.lookups.LookupHelper.getMedicationRoute(this.domain.getLookupService());
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (rows.get(i).getValue() instanceof MedicationRouteVo)
		{
			MedicationRouteVo x = (MedicationRouteVo) rows.get(i).getValue();
			if (!x.getRouteIsNotNull())
				continue;
			mRoutes.remove(x.getRoute());
		}	
	}
	for (int i = 0 ; i < rows.size() ; i++)
	{
		DynamicGridCell cell = rows.get(i).getCells().get(form.lyrDetails().tabFRU().dyngrdFRU().getColumns().getByIdentifier(COL_MAIN));
		Object back = cell.getValue();
		cell.getItems().clear();
		if (back!=null)
			cell.getItems().newItem(back);
		for (int j = 0 ; j < mRoutes.size() ;j++)
			cell.getItems().newItem(mRoutes.get(j));
		cell.setValue(back);
	}
}
 
Example 10
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateCmbRoute(MedicationRouteCollection routes)
{
	form.cmbRoute().clear();
	if (routes == null)
		return;
	for (int i = 0 ; i < routes.size() ; i++)
	{
		MedicationRoute route = routes.get(i);
		if (route != null)
		{
			form.cmbRoute().newRow(route, route.getText());
		}
	}
	
}
 
Example 11
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
private void rebindRouteRows(DynamicGridRow formRow)
{
	
	if (formRow == null)
		return;
	DynamicGridRowCollection rows = formRow.getRows();
	MedicationRouteCollection mRoutes = ims.core.vo.lookups.LookupHelper.getMedicationRoute(this.domain.getLookupService());
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (rows.get(i).getValue() instanceof MedicationRouteVo)
		{
			MedicationRouteVo x = (MedicationRouteVo) rows.get(i).getValue();
			if (!x.getRouteIsNotNull())
				continue;
			mRoutes.remove(x.getRoute());
		}	
	}
	for (int i = 0 ; i < rows.size() ; i++)
	{
		DynamicGridCell cell = rows.get(i).getCells().get(form.lyrDetails().tabFRU().dyngrdFRU().getColumns().getByIdentifier(COL_MAIN));
		Object back = cell.getValue();
		cell.getItems().clear();
		if (back!=null)
			cell.getItems().newItem(back);
		for (int j = 0 ; j < mRoutes.size() ;j++)
			cell.getItems().newItem(mRoutes.get(j));
		cell.setValue(back);
	}
}
 
Example 12
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateCmbRoute(MedicationRouteCollection routes)
{
	form.cmbRoute().clear();
	if (routes == null)
		return;
	for (int i = 0 ; i < routes.size() ; i++)
	{
		MedicationRoute route = routes.get(i);
		if (route != null)
		{
			form.cmbRoute().newRow(route, route.getText());
		}
	}
	
}
 
Example 13
Project: AvoinApotti   File: Logic.java   Source Code and License 4 votes vote down vote up
private void setDoseRowValue(DynamicGridRow row, MedicationDose dose)
{
	if (row == null)
		throw new CodingRuntimeException("Major Logical Error - Can not set a dose to null row");
	
	row.setValue(dose);
	
	if (dose == null)
		return;
	
	DynamicGridCell cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_DOSENAME), DynamicCellType.STRING);
	cell.setValidationMessage("Dose length is restricted to 255 characters.");
	cell.setValue(dose.getDose());
	cell.setWidth(120);
	cell.setReadOnly(true);
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_ROUTE), DynamicCellType.ENUMERATION);
	// bind to lookup
	cell.getItems().clear();
	MedicationRouteCollection medicationRouteCollection = LookupHelper.getMedicationRoute(domain.getLookupService());
	for (int i = 0; i < medicationRouteCollection.size(); i++)
	{
		MedicationRoute route = medicationRouteCollection.get(i);
		cell.getItems().newItem(route, route.getText());
	}
	cell.setValue(dose.getAdminRoute());
	cell.setWidth(120);
	cell.setReadOnly(true);
	
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY), DynamicCellType.STRING);
	cell.setIdentifier(dose.getDoseStartHcp());
	cell.setValue(dose.getDoseStartHcp() != null ? dose.getDoseStartHcp().toString() : "");
	cell.setWidth(200);
	cell.setReadOnly(true);
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_DATE), DynamicCellType.DATE);
	cell.setValue(dose.getDoseStartDate());
	cell.setWidth(-1);
	cell.setReadOnly(true);
	
	row.setIdentifier(ROW_STATE_NOT_EDITABLE);
}
 
Example 14
Project: AvoinApotti   File: Logic.java   Source Code and License 4 votes vote down vote up
private void newDose()
{
	DynamicGridRow row = form.dyngrdDoses().getRows().newRow();
	
	DynamicGridCell cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_DOSENAME), DynamicCellType.STRING);
	cell.setReadOnly(false);
	cell.setStringMaxLength(255);
	cell.setValidationMessage("Dose length is restricted to 255 characters.");
	cell.setWidth(120);
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_ROUTE), DynamicCellType.ENUMERATION);
	cell.setReadOnly(false);
	// bind to lookup
	cell.getItems().clear();
	MedicationRouteCollection medicationRouteCollection = LookupHelper.getMedicationRoute(domain.getLookupService());
	for (int i = 0; i < medicationRouteCollection.size(); i++)
	{
		MedicationRoute route = medicationRouteCollection.get(i);
		cell.getItems().newItem(route, route.getText());
	}
	cell.setWidth(120);

	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY), DynamicCellType.STRING);
	cell.setReadOnly(true);
	cell.setIdentifier(domain.getHcpUser());
	cell.setValue(domain.getHcpUser() != null ? domain.getHcpUser().toString() : "");
	cell.setWidth(200);
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_DATE), DynamicCellType.DATE);
	cell.setReadOnly(true);
	cell.setValue(new Date());
	cell.setWidth(-1);
	
	row.setValue(new MedicationDose());
	
	row.setIdentifier(ROW_STATE_EDITABLE);

	// Update grid selection
	form.dyngrdDoses().setSelectedRow(row);
}
 
Example 15
Project: openMAXIMS   File: Logic.java   Source Code and License 4 votes vote down vote up
private void setDoseRowValue(DynamicGridRow row, MedicationDose dose)
{
	if (row == null)
		throw new CodingRuntimeException("Major Logical Error - Can not set a dose to null row");
	
	row.setValue(dose);
	
	if (dose == null)
		return;
	
	DynamicGridCell cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_DOSENAME), DynamicCellType.STRING);
	cell.setValidationMessage("Dose length is restricted to 255 characters.");
	cell.setValue(dose.getDose());
	cell.setWidth(120);
	cell.setReadOnly(true);
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_ROUTE), DynamicCellType.ENUMERATION);
	// bind to lookup
	cell.getItems().clear();
	MedicationRouteCollection medicationRouteCollection = LookupHelper.getMedicationRoute(domain.getLookupService());
	for (int i = 0; i < medicationRouteCollection.size(); i++)
	{
		MedicationRoute route = medicationRouteCollection.get(i);
		cell.getItems().newItem(route, route.getText());
	}
	cell.setValue(dose.getAdminRoute());
	cell.setWidth(120);
	cell.setReadOnly(true);
	
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY), DynamicCellType.STRING);
	cell.setIdentifier(dose.getDoseStartHcp());
	cell.setValue(dose.getDoseStartHcp() != null ? dose.getDoseStartHcp().toString() : "");
	cell.setWidth(200);
	cell.setReadOnly(true);
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_DATE), DynamicCellType.DATE);
	cell.setValue(dose.getDoseStartDate());
	cell.setWidth(-1);
	cell.setReadOnly(true);
	
	row.setIdentifier(ROW_STATE_NOT_EDITABLE);
}
 
Example 16
Project: openMAXIMS   File: Logic.java   Source Code and License 4 votes vote down vote up
private void newDose()
{
	DynamicGridRow row = form.dyngrdDoses().getRows().newRow();
	
	DynamicGridCell cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_DOSENAME), DynamicCellType.STRING);
	cell.setReadOnly(false);
	cell.setStringMaxLength(255);
	cell.setValidationMessage("Dose length is restricted to 255 characters.");
	cell.setWidth(120);
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_ROUTE), DynamicCellType.ENUMERATION);
	cell.setReadOnly(false);
	// bind to lookup
	cell.getItems().clear();
	MedicationRouteCollection medicationRouteCollection = LookupHelper.getMedicationRoute(domain.getLookupService());
	for (int i = 0; i < medicationRouteCollection.size(); i++)
	{
		MedicationRoute route = medicationRouteCollection.get(i);
		cell.getItems().newItem(route, route.getText());
	}
	cell.setWidth(120);

	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY), DynamicCellType.STRING);
	cell.setReadOnly(true);
	cell.setIdentifier(domain.getHcpUser());
	cell.setValue(domain.getHcpUser() != null ? domain.getHcpUser().toString() : "");
	cell.setWidth(200);
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_DATE), DynamicCellType.DATE);
	cell.setReadOnly(true);
	cell.setValue(new Date());
	cell.setWidth(-1);
	
	row.setValue(new MedicationDose());
	
	row.setIdentifier(ROW_STATE_EDITABLE);

	// Update grid selection
	form.dyngrdDoses().setSelectedRow(row);
}
 
Example 17
Project: openMAXIMS   File: Logic.java   Source Code and License 4 votes vote down vote up
private void setDoseRowValue(DynamicGridRow row, MedicationDose dose)
{
	if (row == null)
		throw new CodingRuntimeException("Major Logical Error - Can not set a dose to null row");
	
	row.setValue(dose);
	
	if (dose == null)
		return;
	
	DynamicGridCell cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_DOSENAME), DynamicCellType.STRING);
	cell.setValidationMessage("Dose length is restricted to 255 characters.");
	cell.setValue(dose.getDose());
	cell.setWidth(120);
	cell.setReadOnly(true);
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_ROUTE), DynamicCellType.ENUMERATION);
	// bind to lookup
	cell.getItems().clear();
	MedicationRouteCollection medicationRouteCollection = LookupHelper.getMedicationRoute(domain.getLookupService());
	for (int i = 0; i < medicationRouteCollection.size(); i++)
	{
		MedicationRoute route = medicationRouteCollection.get(i);
		cell.getItems().newItem(route, route.getText());
	}
	cell.setValue(dose.getAdminRoute());
	cell.setWidth(120);
	cell.setReadOnly(true);
	
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY), DynamicCellType.STRING);
	cell.setIdentifier(dose.getDoseStartHcp());
	cell.setValue(dose.getDoseStartHcp() != null ? dose.getDoseStartHcp().toString() : "");
	cell.setWidth(200);
	cell.setReadOnly(true);
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_DATE), DynamicCellType.DATE);
	cell.setValue(dose.getDoseStartDate());
	cell.setWidth(-1);
	cell.setReadOnly(true);
	
	row.setIdentifier(ROW_STATE_NOT_EDITABLE);
}
 
Example 18
Project: openMAXIMS   File: Logic.java   Source Code and License 4 votes vote down vote up
private void newDose()
{
	DynamicGridRow row = form.dyngrdDoses().getRows().newRow();
	
	DynamicGridCell cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_DOSENAME), DynamicCellType.STRING);
	cell.setReadOnly(false);
	cell.setStringMaxLength(255);
	cell.setValidationMessage("Dose length is restricted to 255 characters.");
	cell.setWidth(120);
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_ROUTE), DynamicCellType.ENUMERATION);
	cell.setReadOnly(false);
	// bind to lookup
	cell.getItems().clear();
	MedicationRouteCollection medicationRouteCollection = LookupHelper.getMedicationRoute(domain.getLookupService());
	for (int i = 0; i < medicationRouteCollection.size(); i++)
	{
		MedicationRoute route = medicationRouteCollection.get(i);
		cell.getItems().newItem(route, route.getText());
	}
	cell.setWidth(120);

	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY), DynamicCellType.STRING);
	cell.setReadOnly(true);
	cell.setIdentifier(domain.getHcpUser());
	cell.setValue(domain.getHcpUser() != null ? domain.getHcpUser().toString() : "");
	cell.setWidth(200);
	
	cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_DATE), DynamicCellType.DATE);
	cell.setReadOnly(true);
	cell.setValue(new Date());
	cell.setWidth(-1);
	
	row.setValue(new MedicationDose());
	
	row.setIdentifier(ROW_STATE_EDITABLE);

	// Update grid selection
	form.dyngrdDoses().setSelectedRow(row);
}