Java Code Examples for ims.ocrr.orderingresults.vo.OrderInvestigationRefVo

The following are top voted examples for showing how to use ims.ocrr.orderingresults.vo.OrderInvestigationRefVo. 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 updateInvestigationStatus(OrderInvestigationRefVo invRef, IfOrderInvCurrentStatusVo newStatus) throws StaleObjectException
{
	if(invRef == null)
		throw new DomainRuntimeException("Investigation must be specified to update status.");
	
	if(newStatus == null)
		throw new DomainRuntimeException("New Status value must be provided in order to update investigation status.");
	
	DomainFactory factory = getDomainFactory();
	OrderInvestigation ordInv = (OrderInvestigation)factory.getDomainObject(OrderInvestigation.class, invRef.getID_OrderInvestigation());

	OrderedInvestigationStatus currStatus = ordInv.getOrdInvCurrentStatus();
	currStatus.setOrdInvStatus(getDomLookup(newStatus.getOrdInvStatus()));
	currStatus.setChangeDateTime(newStatus.getChangeDateTime().getJavaDate());
	currStatus.setChangeUser(newStatus.getChangeUser());
	currStatus.setStatusReason(newStatus.getStatusReason());
	ordInv.getOrdInvStatusHistory().add(currStatus);
	
	factory.save(ordInv);
}
 
Example 2
Project: AvoinApotti   File: PatientClericalTaskDialogImpl.java   Source Code and License 6 votes vote down vote up
public PatientClericalTaskVoCollection getPatientClericalTasksByResultSelected(OrderInvestigationRefVo resultSelectedId) //WDEV-14080
{
	if(resultSelectedId == null || resultSelectedId.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("Can not get ResultSelected value on null Id.");
	
	StringBuffer hql = new StringBuffer();
	hql.append("select patClericalTask from PatientClericalTask as patClericalTask left join patClericalTask.investigation as orderInvestigation ");
	hql.append("where orderInvestigation.id = :orderId ");
	hql.append("order by patClericalTask.requestedDateTime desc");
	
	DomainFactory factory = getDomainFactory();
	List<?> list = factory.find(hql.toString(), new String[] {"orderId"}, new Object[] {resultSelectedId.getID_OrderInvestigation()});
	
	return PatientClericalTaskVoAssembler.createPatientClericalTaskVoCollectionFromPatientClericalTask(list); //WDEV-14080
	
}
 
Example 3
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
/**
 * Function used to fill in the OrderInvestigation.Containers field
 * <br>While this function doesn't have a return value, it does have a side-effect as it
 * modifies the OrderInvestigation VO
 */
private void fillInOrderInvestigationContainers(OrderInvestigationVo orderInvestigation, OrderSpecimenContainerVoCollection containers)
{
	if (orderInvestigation == null || containers == null)
		return;
	
	orderInvestigation.setContainer(new OrderSpecimenContainerVoCollection());
	
	for (OrderSpecimenContainerVo container : containers)
	{
		if (container.getOrderInvestigation() != null)
		{
			for (OrderInvestigationRefVo investigation : container.getOrderInvestigation())
			{
				if (investigation.equals(orderInvestigation))
					orderInvestigation.getContainer().add(container);
			}
		}
	}
}
 
Example 4
Project: AvoinApotti   File: MyOrderImpl.java   Source Code and License 6 votes vote down vote up
/**
 * Function used to update OrderInvestigationAppointment (with new Investigation - amended one)
 */
public void updateOrderInvestigationAppointment(OrderInvWithStatusApptVo orderInvestigationAppointment, OrderInvestigationLiteVo investigationToAmend) throws StaleObjectException
{
	if (orderInvestigationAppointment == null)
		throw new CodingRuntimeException("Can not save null OderInvestigationAppointemnt");
	
	if (orderInvestigationAppointment.isValidated() == false)
		throw new CodingRuntimeException("Can not save not validated OrderInvestigationAppointment");
	
	if (investigationToAmend == null)
		throw new CodingRuntimeException("Can not save null OrderInvestigation");
	
	// Get domain object to save
	OrderInvAppt domOrderInvestigationAppointment = OrderInvWithStatusApptVoAssembler.extractOrderInvAppt(getDomainFactory(), orderInvestigationAppointment);
	OrderInvestigation domOrderInvestigation = OrderInvestigationLiteVoAssembler.extractOrderInvestigation(getDomainFactory(), investigationToAmend);
	
	getDomainFactory().save(domOrderInvestigationAppointment);
	getDomainFactory().save(domOrderInvestigation);
	
	OCSExternalEvents impl = (OCSExternalEvents) getDomainImpl(OCSExternalEventsImpl.class);
	impl.generateOrderUpdateEvent(new Booking_AppointmentRefVo(domOrderInvestigationAppointment.getAppointment().getId(), domOrderInvestigationAppointment.getAppointment().getVersion()), new OrderInvestigationRefVo(domOrderInvestigationAppointment.getOrderInvestigation().getId(), domOrderInvestigationAppointment.getOrderInvestigation().getVersion()));
	
	return;
}
 
Example 5
Project: AvoinApotti   File: PrintOrderImpl.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("rawtypes")
public ServiceLiteVo getModality(OrderInvestigationRefVo orderInv)
{
	if(orderInv == null || orderInv.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("orderInv parameter is null in method getModality");
	
	DomainFactory factory = getDomainFactory();
	String hql = "select o2_1.discipline from OrderInvestigation as o1_1 join o1_1.specimen as o2_1 where (o1_1.id = (:ID)) ";
	List list = factory.find(hql,new String[] {"ID"},new Object[] {orderInv.getID_OrderInvestigation()});

	if(list.size() > 0)
		return ServiceLiteVoAssembler.create((Service) list.get(0));
	
	//if current OrderInvestigation doesn't have a specimen we get the modality as follows:
	//OrderInvestigation.investigation.providerService.locationService.service
	hql = "select l2_1.service from OrderInvestigation as o1_1 left join o1_1.investigation as i1_1 left join i1_1.providerService as l1_1 left join l1_1.locationService as l2_1 left join l2_1.service as s1_1 where (o1_1.id = :ID)";
	list = factory.find(hql,new String[] {"ID"},new Object[] {orderInv.getID_OrderInvestigation()});

	if(list.size() > 0)
		return ServiceLiteVoAssembler.create((Service) list.get(0));
	
	return null;
}
 
Example 6
Project: AvoinApotti   File: OrderSummaryCatsImpl.java   Source Code and License 6 votes vote down vote up
/**
* cancelOrderInvestigations and generateOrderCanceEvent where applicable
*/
@Override
public void cancelOrderInvestigations(PatientShort patient, OrderInvestigationRefVoCollection collOrderInvestigation, InvestigationStatusChangeReason cancelReason, String cancelReasonComment) throws StaleObjectException, ForeignKeyViolationException
{
	super.cancelOrderInvestigations(patient, collOrderInvestigation, cancelReason, cancelReasonComment);
	
	//send the message where relevant
	String hql = "select ordInvAppt from OrderInvAppt as ordInvAppt where ordInvAppt.orderInvestigation.id in (" + getIdString(collOrderInvestigation) + ")";
	List<?> doOrdInvAppts = getDomainFactory().find(hql);

	if(doOrdInvAppts != null && doOrdInvAppts.size() > 0)
	{
		Iterator<?> it = doOrdInvAppts.iterator();
		while(it.hasNext())
		{
			OrderInvAppt doOrderInvAppt = (OrderInvAppt) it.next();

			OCSExternalEvents impl = (OCSExternalEvents) getDomainImpl(OCSExternalEventsImpl.class);
			impl.generateOrderCancelEvent(new Booking_AppointmentRefVo(doOrderInvAppt.getAppointment().getId(), doOrderInvAppt.getAppointment().getVersion()), new OrderInvestigationRefVo(doOrderInvAppt.getOrderInvestigation().getId(), doOrderInvAppt.getOrderInvestigation().getVersion()));	
		}
	}
}
 
Example 7
Project: AvoinApotti   File: PathologyDialogImpl.java   Source Code and License 6 votes vote down vote up
public PatientClericalTaskVo getPatientClericalTask(OrderInvestigationRefVo resultSelected) 
{
	if(resultSelected == null || resultSelected.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("Can not get ResultSelected value on null Id.");
	
	StringBuffer hql = new StringBuffer();
	hql.append("select patClericalTask from PatientClericalTask as patClericalTask left join patClericalTask.investigation as orderInvestigation ");
	hql.append("where orderInvestigation.id = :orderId ");
	hql.append("order by patClericalTask.requestedDateTime desc");
	
	DomainFactory factory = getDomainFactory();
	List<?> list = factory.find(hql.toString(), new String[] {"orderId"}, new Object[] {resultSelected.getID_OrderInvestigation()});
	
	if (list!=null && list.size()>0)
	{
		return PatientClericalTaskVoAssembler.createPatientClericalTaskVoCollectionFromPatientClericalTask(list).get(0);
	}
	return null;
	
}
 
Example 8
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void markInvestigations(OrderInvestigationRefVoCollection resultsForReport)
{
	if (resultsForReport == null)
		return;
	
	for (OrderInvestigationRefVo investigation : resultsForReport)
	{
		for (int i = 0; i < form.lyr1().tabDischargePatient().grdInvestigation().getRows().size(); i++)
		{
			grdInvestigationRow investigationRow = form.lyr1().tabDischargePatient().grdInvestigation().getRows().get(i);
			
			if (investigation.equals(investigationRow.getValue()))
				investigationRow.setColSelect(true);
		}
	}
}
 
Example 9
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private boolean isApptStatusEqual(ims.ocrr.orderingresults.vo.OrderInvestigationRefVo voInvRef, Status_Reason status)
{
	if(status == null)
		throw new CodingRuntimeException("status is null in method isApptStatusEqual");

	//Find the Inv in the OrderInvAppts Collection, for this get the ReferrapApptDetailsBookingApptVo and its status
	if(voInvRef != null)
	{
		ReferralAppointmentDetailsBookingAppointmentVo voAppt = findApptForGivenInv(voInvRef);
		if(voAppt != null
			&& voAppt.getApptStatusIsNotNull()
			&& voAppt.getApptStatus().equals(status))
			return true;
	}
	
	return false;
}
 
Example 10
Project: AvoinApotti   File: ExternalEventsImpl.java   Source Code and License 6 votes vote down vote up
public Booking_AppointmentRefVo getLatestAppointmentForInvestigation(
		OrderInvestigationRefVo invRef) throws StaleObjectException {
	DomainFactory factory = getDomainFactory();

	String hql = " select o.appointment as ba from OrderInvAppt o "
			+ " join o.orderInvestigation inv where inv.id = :invId"
			+ " order by o.id desc";

	List<?> list = factory.find(hql, new String[] { "invId" },
			new Object[] { invRef.getID_OrderInvestigation()});

	if (list == null || list.size() == 0) return null;
	Booking_Appointment domObj = (Booking_Appointment) list.get(0);

	Booking_AppointmentRefVo apptRef = new Booking_AppointmentRefVo();
	apptRef.setID_Booking_Appointment(domObj.getId());
	return apptRef;		

}
 
Example 11
Project: AvoinApotti   File: ExternalEventsImpl.java   Source Code and License 6 votes vote down vote up
public void setCATSReferralHasRejectedInv(
		OrderInvestigationRefVo orderInvRef)
		throws DomainInterfaceException, StaleObjectException {
	DomainFactory factory = getDomainFactory();
	
	String hql= "select cr from CatsReferral as cr left join "+
	"cr.investigationOrders as io left join io.investigations as inv where "+
	"(inv.id = :invId) and cr.isRIE is null";
	
	List<?> referralList = factory.find(hql, new String[] { "invId" },
			new Object[] { orderInvRef.getBoId() });

	if (referralList.size() == 0)
	{
		LOG.error("CATSReferral not found for Order Investigation:"+orderInvRef.toString());
		return;
	}
	CatsReferral domObjReferral = (CatsReferral) referralList.get(0); // Should be only one
	domObjReferral.setHasRejectedInv(Boolean.TRUE);
	factory.save(domObjReferral);
	
}
 
Example 12
Project: openMAXIMS   File: ExternalEventsImpl.java   Source Code and License 6 votes vote down vote up
public Booking_AppointmentRefVo getLatestAppointmentForInvestigation(
		OrderInvestigationRefVo invRef) throws StaleObjectException {
	DomainFactory factory = getDomainFactory();

	String hql = " select o.appointment as ba from OrderInvAppt o "
			+ " join o.orderInvestigation inv where inv.id = :invId"
			+ " order by o.id desc";

	List<?> list = factory.find(hql, new String[] { "invId" },
			new Object[] { invRef.getID_OrderInvestigation()});

	if (list == null || list.size() == 0) return null;
	Booking_Appointment domObj = (Booking_Appointment) list.get(0);

	Booking_AppointmentRefVo apptRef = new Booking_AppointmentRefVo();
	apptRef.setID_Booking_Appointment(domObj.getId());
	return apptRef;		

}
 
Example 13
Project: openMAXIMS   File: PatientClericalTaskDialogImpl.java   Source Code and License 6 votes vote down vote up
public PatientClericalTaskVoCollection getPatientClericalTasksByResultSelected(OrderInvestigationRefVo resultSelectedId) //WDEV-14080
{
	if(resultSelectedId == null || resultSelectedId.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("Can not get ResultSelected value on null Id.");
	
	StringBuffer hql = new StringBuffer();
	hql.append("select patClericalTask from PatientClericalTask as patClericalTask left join patClericalTask.investigation as orderInvestigation ");
	hql.append("where orderInvestigation.id = :orderId ");
	hql.append("order by patClericalTask.requestedDateTime desc");
	
	DomainFactory factory = getDomainFactory();
	List<?> list = factory.find(hql.toString(), new String[] {"orderId"}, new Object[] {resultSelectedId.getID_OrderInvestigation()});
	
	return PatientClericalTaskVoAssembler.createPatientClericalTaskVoCollectionFromPatientClericalTask(list); //WDEV-14080
	
}
 
Example 14
Project: openmaxims-linux   File: PatientClericalTaskDialogImpl.java   Source Code and License 6 votes vote down vote up
public PatientClericalTaskVoCollection getPatientClericalTasksByResultSelected(OrderInvestigationRefVo resultSelectedId) //WDEV-14080
{
	if(resultSelectedId == null || resultSelectedId.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("Can not get ResultSelected value on null Id.");
	
	StringBuffer hql = new StringBuffer();
	hql.append("select patClericalTask from PatientClericalTask as patClericalTask left join patClericalTask.investigation as orderInvestigation ");
	hql.append("where orderInvestigation.id = :orderId ");
	hql.append("order by patClericalTask.requestedDateTime desc");
	
	DomainFactory factory = getDomainFactory();
	List<?> list = factory.find(hql.toString(), new String[] {"orderId"}, new Object[] {resultSelectedId.getID_OrderInvestigation()});
	
	return PatientClericalTaskVoAssembler.createPatientClericalTaskVoCollectionFromPatientClericalTask(list); //WDEV-14080
	
}
 
Example 15
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
/**
 * Function used to fill in the OrderInvestigation.Containers field
 * <br>While this function doesn't have a return value, it does have a side-effect as it
 * modifies the OrderInvestigation VO
 */
private void fillInOrderInvestigationContainers(OrderInvestigationVo orderInvestigation, OrderSpecimenContainerVoCollection containers)
{
	if (orderInvestigation == null || containers == null)
		return;
	
	orderInvestigation.setContainer(new OrderSpecimenContainerVoCollection());
	
	for (OrderSpecimenContainerVo container : containers)
	{
		if (container.getOrderInvestigation() != null)
		{
			for (OrderInvestigationRefVo investigation : container.getOrderInvestigation())
			{
				if (investigation.equals(orderInvestigation))
					orderInvestigation.getContainer().add(container);
			}
		}
	}
}
 
Example 16
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void markInvestigations(OrderInvestigationRefVoCollection resultsForReport)
{
	if (resultsForReport == null)
		return;
	
	for (OrderInvestigationRefVo investigation : resultsForReport)
	{
		for (int i = 0; i < form.lyr1().tabDischargePatient().grdInvestigation().getRows().size(); i++)
		{
			grdInvestigationRow investigationRow = form.lyr1().tabDischargePatient().grdInvestigation().getRows().get(i);
			
			if (investigation.equals(investigationRow.getValue()))
				investigationRow.setColSelect(true);
		}
	}
}
 
Example 17
Project: openMAXIMS   File: PrintOrderImpl.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("rawtypes")
public ServiceLiteVo getModality(OrderInvestigationRefVo orderInv)
{
	if(orderInv == null || orderInv.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("orderInv parameter is null in method getModality");
	
	DomainFactory factory = getDomainFactory();
	String hql = "select o2_1.discipline from OrderInvestigation as o1_1 join o1_1.specimen as o2_1 where (o1_1.id = (:ID)) ";
	List list = factory.find(hql,new String[] {"ID"},new Object[] {orderInv.getID_OrderInvestigation()});

	if(list.size() > 0)
		return ServiceLiteVoAssembler.create((Service) list.get(0));
	
	//if current OrderInvestigation doesn't have a specimen we get the modality as follows:
	//OrderInvestigation.investigation.providerService.locationService.service
	hql = "select l2_1.service from OrderInvestigation as o1_1 left join o1_1.investigation as i1_1 left join i1_1.providerService as l1_1 left join l1_1.locationService as l2_1 left join l2_1.service as s1_1 where (o1_1.id = :ID)";
	list = factory.find(hql,new String[] {"ID"},new Object[] {orderInv.getID_OrderInvestigation()});

	if(list.size() > 0)
		return ServiceLiteVoAssembler.create((Service) list.get(0));
	
	return null;
}
 
Example 18
Project: openmaxims-linux   File: PrintOrderImpl.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("rawtypes")
public ServiceLiteVo getModality(OrderInvestigationRefVo orderInv)
{
	if(orderInv == null || orderInv.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("orderInv parameter is null in method getModality");
	
	DomainFactory factory = getDomainFactory();
	String hql = "select o2_1.discipline from OrderInvestigation as o1_1 join o1_1.specimen as o2_1 where (o1_1.id = (:ID)) ";
	List list = factory.find(hql,new String[] {"ID"},new Object[] {orderInv.getID_OrderInvestigation()});

	if(list.size() > 0)
		return ServiceLiteVoAssembler.create((Service) list.get(0));
	
	//if current OrderInvestigation doesn't have a specimen we get the modality as follows:
	//OrderInvestigation.investigation.providerService.locationService.service
	hql = "select l2_1.service from OrderInvestigation as o1_1 left join o1_1.investigation as i1_1 left join i1_1.providerService as l1_1 left join l1_1.locationService as l2_1 left join l2_1.service as s1_1 where (o1_1.id = :ID)";
	list = factory.find(hql,new String[] {"ID"},new Object[] {orderInv.getID_OrderInvestigation()});

	if(list.size() > 0)
		return ServiceLiteVoAssembler.create((Service) list.get(0));
	
	return null;
}
 
Example 19
Project: openMAXIMS   File: OrderSummaryCatsImpl.java   Source Code and License 6 votes vote down vote up
/**
* cancelOrderInvestigations and generateOrderCanceEvent where applicable
*/
@Override
public void cancelOrderInvestigations(PatientShort patient, OrderInvestigationRefVoCollection collOrderInvestigation, InvestigationStatusChangeReason cancelReason, String cancelReasonComment) throws StaleObjectException, ForeignKeyViolationException
{
	super.cancelOrderInvestigations(patient, collOrderInvestigation, cancelReason, cancelReasonComment);
	
	//send the message where relevant
	String hql = "select ordInvAppt from OrderInvAppt as ordInvAppt where ordInvAppt.orderInvestigation.id in (" + getIdString(collOrderInvestigation) + ")";
	List<?> doOrdInvAppts = getDomainFactory().find(hql);

	if(doOrdInvAppts != null && doOrdInvAppts.size() > 0)
	{
		Iterator<?> it = doOrdInvAppts.iterator();
		while(it.hasNext())
		{
			OrderInvAppt doOrderInvAppt = (OrderInvAppt) it.next();

			OCSExternalEvents impl = (OCSExternalEvents) getDomainImpl(OCSExternalEventsImpl.class);
			impl.generateOrderCancelEvent(new Booking_AppointmentRefVo(doOrderInvAppt.getAppointment().getId(), doOrderInvAppt.getAppointment().getVersion()), new OrderInvestigationRefVo(doOrderInvAppt.getOrderInvestigation().getId(), doOrderInvAppt.getOrderInvestigation().getVersion()));	
		}
	}
}
 
Example 20
Project: openMAXIMS   File: PathologyDialogImpl.java   Source Code and License 6 votes vote down vote up
public PatientClericalTaskVo getPatientClericalTask(OrderInvestigationRefVo resultSelected) 
{
	if(resultSelected == null || resultSelected.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("Can not get ResultSelected value on null Id.");
	
	StringBuffer hql = new StringBuffer();
	hql.append("select patClericalTask from PatientClericalTask as patClericalTask left join patClericalTask.investigation as orderInvestigation ");
	hql.append("where orderInvestigation.id = :orderId ");
	hql.append("order by patClericalTask.requestedDateTime desc");
	
	DomainFactory factory = getDomainFactory();
	List<?> list = factory.find(hql.toString(), new String[] {"orderId"}, new Object[] {resultSelected.getID_OrderInvestigation()});
	
	if (list!=null && list.size()>0)
	{
		return PatientClericalTaskVoAssembler.createPatientClericalTaskVoCollectionFromPatientClericalTask(list).get(0);
	}
	return null;
	
}
 
Example 21
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
/**
 * Function used to fill in the OrderInvestigation.Containers field
 * <br>While this function doesn't have a return value, it does have a side-effect as it
 * modifies the OrderInvestigation VO
 */
private void fillInOrderInvestigationContainers(OrderInvestigationVo orderInvestigation, OrderSpecimenContainerVoCollection containers)
{
	if (orderInvestigation == null || containers == null)
		return;
	
	orderInvestigation.setContainer(new OrderSpecimenContainerVoCollection());
	
	for (OrderSpecimenContainerVo container : containers)
	{
		if (container.getOrderInvestigation() != null)
		{
			for (OrderInvestigationRefVo investigation : container.getOrderInvestigation())
			{
				if (investigation.equals(orderInvestigation))
					orderInvestigation.getContainer().add(container);
			}
		}
	}
}
 
Example 22
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void markInvestigations(OrderInvestigationRefVoCollection resultsForReport)
{
	if (resultsForReport == null)
		return;
	
	for (OrderInvestigationRefVo investigation : resultsForReport)
	{
		for (int i = 0; i < form.lyr1().tabDischargePatient().grdInvestigation().getRows().size(); i++)
		{
			grdInvestigationRow investigationRow = form.lyr1().tabDischargePatient().grdInvestigation().getRows().get(i);
			
			if (investigation.equals(investigationRow.getValue()))
				investigationRow.setColSelect(true);
		}
	}
}
 
Example 23
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private boolean isApptStatusEqual(ims.ocrr.orderingresults.vo.OrderInvestigationRefVo voInvRef, Status_Reason status)
{
	if(status == null)
		throw new CodingRuntimeException("status is null in method isApptStatusEqual");

	//Find the Inv in the OrderInvAppts Collection, for this get the ReferrapApptDetailsBookingApptVo and its status
	if(voInvRef != null)
	{
		ReferralAppointmentDetailsBookingAppointmentVo voAppt = findApptForGivenInv(voInvRef);
		if(voAppt != null
			&& voAppt.getApptStatusIsNotNull()
			&& voAppt.getApptStatus().equals(status))
			return true;
	}
	
	return false;
}
 
Example 24
Project: openMAXIMS   File: ExternalEventsImpl.java   Source Code and License 6 votes vote down vote up
public void setCATSReferralHasRejectedInv(
		OrderInvestigationRefVo orderInvRef)
		throws DomainInterfaceException, StaleObjectException {
	DomainFactory factory = getDomainFactory();
	
	String hql= "select cr from CatsReferral as cr left join "+
	"cr.investigationOrders as io left join io.investigations as inv where "+
	"(inv.id = :invId) and cr.isRIE is null";
	
	List<?> referralList = factory.find(hql, new String[] { "invId" },
			new Object[] { orderInvRef.getBoId() });

	if (referralList.size() == 0)
	{
		LOG.error("CATSReferral not found for Order Investigation:"+orderInvRef.toString());
		return;
	}
	CatsReferral domObjReferral = (CatsReferral) referralList.get(0); // Should be only one
	domObjReferral.setHasRejectedInv(Boolean.TRUE);
	factory.save(domObjReferral);
	
}
 
Example 25
Project: openMAXIMS   File: OcsIfInboundImpl.java   Source Code and License 6 votes vote down vote up
public void updateInvestigationStatus(OrderInvestigationRefVo invRef, IfOrderInvCurrentStatusVo newStatus) throws StaleObjectException
{
	if(invRef == null)
		throw new DomainRuntimeException("Investigation must be specified to update status.");
	
	if(newStatus == null)
		throw new DomainRuntimeException("New Status value must be provided in order to update investigation status.");
	
	DomainFactory factory = getDomainFactory();
	OrderInvestigation ordInv = (OrderInvestigation)factory.getDomainObject(OrderInvestigation.class, invRef.getID_OrderInvestigation());

	OrderedInvestigationStatus currStatus = ordInv.getOrdInvCurrentStatus();
	currStatus.setOrdInvStatus(getDomLookup(newStatus.getOrdInvStatus()));
	currStatus.setChangeDateTime(newStatus.getChangeDateTime().getJavaDate());
	currStatus.setChangeUser(newStatus.getChangeUser());
	currStatus.setStatusReason(newStatus.getStatusReason());
	ordInv.getOrdInvStatusHistory().add(currStatus);
	
	factory.save(ordInv);
}
 
Example 26
Project: openMAXIMS   File: PatientClericalTaskDialogImpl.java   Source Code and License 6 votes vote down vote up
public PatientClericalTaskVoCollection getPatientClericalTasksByResultSelected(OrderInvestigationRefVo resultSelectedId) //WDEV-14080
{
	if(resultSelectedId == null || resultSelectedId.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("Can not get ResultSelected value on null Id.");
	
	StringBuffer hql = new StringBuffer();
	hql.append("select patClericalTask from PatientClericalTask as patClericalTask left join patClericalTask.investigation as orderInvestigation ");
	hql.append("where orderInvestigation.id = :orderId ");
	hql.append("order by patClericalTask.requestedDateTime desc");
	
	DomainFactory factory = getDomainFactory();
	List<?> list = factory.find(hql.toString(), new String[] {"orderId"}, new Object[] {resultSelectedId.getID_OrderInvestigation()});
	
	return PatientClericalTaskVoAssembler.createPatientClericalTaskVoCollectionFromPatientClericalTask(list); //WDEV-14080
	
}
 
Example 27
Project: openmaxims-linux   File: ClinicalOrdersResultsOCRRFormImpl.java   Source Code and License 6 votes vote down vote up
public ReferralAppointmentDetailsOrderInvestigationVo getReferralAppointmentDetailsOrderInv(OrderInvestigationRefVo orderInvRef)
{
	if (orderInvRef==null || orderInvRef.getID_OrderInvestigation()==null)
		throw new CodingRuntimeException("OrderInvestigation parameter cannot be null !");
	
	DomainFactory factory = getDomainFactory();
	OrderInvestigation domainOrderInv = (OrderInvestigation)factory.getDomainObject(OrderInvestigation.class, orderInvRef.getID_OrderInvestigation());
	return ReferralAppointmentDetailsOrderInvestigationVoAssembler.create(domainOrderInv);
}
 
Example 28
Project: openmaxims-linux   File: PathologyDialogImpl.java   Source Code and License 6 votes vote down vote up
public PatientClericalTaskVo getPatientClericalTask(OrderInvestigationRefVo resultSelected) 
{
	if(resultSelected == null || resultSelected.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("Can not get ResultSelected value on null Id.");
	
	StringBuffer hql = new StringBuffer();
	hql.append("select patClericalTask from PatientClericalTask as patClericalTask left join patClericalTask.investigation as orderInvestigation ");
	hql.append("where orderInvestigation.id = :orderId ");
	hql.append("order by patClericalTask.requestedDateTime desc");
	
	DomainFactory factory = getDomainFactory();
	List<?> list = factory.find(hql.toString(), new String[] {"orderId"}, new Object[] {resultSelected.getID_OrderInvestigation()});
	
	if (list!=null && list.size()>0)
	{
		return PatientClericalTaskVoAssembler.createPatientClericalTaskVoCollectionFromPatientClericalTask(list).get(0);
	}
	return null;
	
}
 
Example 29
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
/**
 * Function used to fill in the OrderInvestigation.Containers field
 * <br>While this function doesn't have a return value, it does have a side-effect as it
 * modifies the OrderInvestigation VO
 */
private void fillInOrderInvestigationContainers(OrderInvestigationVo orderInvestigation, OrderSpecimenContainerVoCollection containers)
{
	if (orderInvestigation == null || containers == null)
		return;
	
	orderInvestigation.setContainer(new OrderSpecimenContainerVoCollection());
	
	for (OrderSpecimenContainerVo container : containers)
	{
		if (container.getOrderInvestigation() != null)
		{
			for (OrderInvestigationRefVo investigation : container.getOrderInvestigation())
			{
				if (investigation.equals(orderInvestigation))
					orderInvestigation.getContainer().add(container);
			}
		}
	}
}
 
Example 30
Project: openMAXIMS   File: MyOrderImpl.java   Source Code and License 6 votes vote down vote up
/**
 * Function used to update OrderInvestigationAppointment (with new Investigation - amended one)
 */
public void updateOrderInvestigationAppointment(OrderInvWithStatusApptVo orderInvestigationAppointment, OrderInvestigationLiteVo investigationToAmend) throws StaleObjectException
{
	if (orderInvestigationAppointment == null)
		throw new CodingRuntimeException("Can not save null OderInvestigationAppointemnt");
	
	if (orderInvestigationAppointment.isValidated() == false)
		throw new CodingRuntimeException("Can not save not validated OrderInvestigationAppointment");
	
	if (investigationToAmend == null)
		throw new CodingRuntimeException("Can not save null OrderInvestigation");
	
	// Get domain object to save
	OrderInvAppt domOrderInvestigationAppointment = OrderInvWithStatusApptVoAssembler.extractOrderInvAppt(getDomainFactory(), orderInvestigationAppointment);
	OrderInvestigation domOrderInvestigation = OrderInvestigationLiteVoAssembler.extractOrderInvestigation(getDomainFactory(), investigationToAmend);
	
	getDomainFactory().save(domOrderInvestigationAppointment);
	getDomainFactory().save(domOrderInvestigation);
	
	OCSExternalEvents impl = (OCSExternalEvents) getDomainImpl(OCSExternalEventsImpl.class);
	impl.generateOrderUpdateEvent(new Booking_AppointmentRefVo(domOrderInvestigationAppointment.getAppointment().getId(), domOrderInvestigationAppointment.getAppointment().getVersion()), new OrderInvestigationRefVo(domOrderInvestigationAppointment.getOrderInvestigation().getId(), domOrderInvestigationAppointment.getOrderInvestigation().getVersion()));
	
	return;
}
 
Example 31
Project: openmaxims-linux   File: OrderSummaryCatsImpl.java   Source Code and License 6 votes vote down vote up
/**
* cancelOrderInvestigations and generateOrderCanceEvent where applicable
*/
@Override
public void cancelOrderInvestigations(PatientShort patient, OrderInvestigationRefVoCollection collOrderInvestigation, InvestigationStatusChangeReason cancelReason, String cancelReasonComment) throws StaleObjectException, ForeignKeyViolationException
{
	super.cancelOrderInvestigations(patient, collOrderInvestigation, cancelReason, cancelReasonComment);
	
	//send the message where relevant
	String hql = "select ordInvAppt from OrderInvAppt as ordInvAppt where ordInvAppt.orderInvestigation.id in (" + getIdString(collOrderInvestigation) + ")";
	List<?> doOrdInvAppts = getDomainFactory().find(hql);

	if(doOrdInvAppts != null && doOrdInvAppts.size() > 0)
	{
		Iterator<?> it = doOrdInvAppts.iterator();
		while(it.hasNext())
		{
			OrderInvAppt doOrderInvAppt = (OrderInvAppt) it.next();

			OCSExternalEvents impl = (OCSExternalEvents) getDomainImpl(OCSExternalEventsImpl.class);
			impl.generateOrderCancelEvent(new Booking_AppointmentRefVo(doOrderInvAppt.getAppointment().getId(), doOrderInvAppt.getAppointment().getVersion()), new OrderInvestigationRefVo(doOrderInvAppt.getOrderInvestigation().getId(), doOrderInvAppt.getOrderInvestigation().getVersion()));	
		}
	}
}
 
Example 32
Project: openMAXIMS   File: PrintOrderImpl.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("rawtypes")
public ServiceLiteVo getModality(OrderInvestigationRefVo orderInv)
{
	if(orderInv == null || orderInv.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("orderInv parameter is null in method getModality");
	
	DomainFactory factory = getDomainFactory();
	String hql = "select o2_1.discipline from OrderInvestigation as o1_1 join o1_1.specimen as o2_1 where (o1_1.id = (:ID)) ";
	List list = factory.find(hql,new String[] {"ID"},new Object[] {orderInv.getID_OrderInvestigation()});

	if(list.size() > 0)
		return ServiceLiteVoAssembler.create((Service) list.get(0));
	
	//if current OrderInvestigation doesn't have a specimen we get the modality as follows:
	//OrderInvestigation.investigation.providerService.locationService.service
	hql = "select l2_1.service from OrderInvestigation as o1_1 left join o1_1.investigation as i1_1 left join i1_1.providerService as l1_1 left join l1_1.locationService as l2_1 left join l2_1.service as s1_1 where (o1_1.id = :ID)";
	list = factory.find(hql,new String[] {"ID"},new Object[] {orderInv.getID_OrderInvestigation()});

	if(list.size() > 0)
		return ServiceLiteVoAssembler.create((Service) list.get(0));
	
	return null;
}
 
Example 33
Project: AvoinApotti   File: OcsIfInboundImpl.java   Source Code and License 5 votes vote down vote up
public IfOutOcsOrderVo getOrderFromInv(OrderInvestigationRefVo inv) throws DomainInterfaceException
{
	if(null==inv)
	{
		throw new DomainInterfaceException("Investigation should not be null");
	}
	DomainFactory factory = getDomainFactory();
	OrderInvestigation domOrderInv = (OrderInvestigation)factory.getDomainObject(OrderInvestigation.class,inv.getBoId());
	OcsOrderSession order = domOrderInv.getOrderDetails();
	return IfOutOcsOrderVoAssembler.create(order);
}
 
Example 34
Project: AvoinApotti   File: OcsIfImpl.java   Source Code and License 5 votes vote down vote up
public IfOrderInvestigationVo createInvestigationStatusRecord(OrderInvestigationRefVo investigation, IfOrderInvCurrentStatusVo statusRecordVo) throws StaleObjectException
{
	DomainFactory factory = getDomainFactory();
	DecimalFormat dftFormatter = new DecimalFormat("G00000000");
	
	OrderInvestigation inv = (OrderInvestigation) factory.getDomainObject(OrderInvestigation.class, investigation.getID_OrderInvestigation());
	OrderedInvestigationStatus stat = IfOrderInvCurrentStatusVoAssembler.extractOrderedInvestigationStatus(factory, statusRecordVo);
	inv.getOrdInvStatusHistory().add(stat);
	inv.setOrdInvCurrentStatus(stat);
	
	// wdev-2998 If the status is SENT
	// we want to mark the investigation as processed
	if (stat.getOrdInvStatus().getId() == OrderInvStatus.SENT.getId())
	{
		inv.setWasProcessed(true);
		
		if (inv.getSpecimen() != null&&!inv.getSpecimen().isEmpty())
			for (Object objSpecimen : inv.getSpecimen()) {
				OrderSpecimen specimen = (OrderSpecimen)objSpecimen;
				specimen.setWasProcessed(true);
				if(inv.getInvestigation()!=null
						&&inv.getInvestigation().getEventType()!=null
						&& InvEventType.TIME_SERIES.equals( inv.getInvestigation().getEventType()))
				{
					specimen.setPlacerOrdNum(dftFormatter.format(inv.getId()));
				}
			}
	}
	factory.save(inv);
	return IfOrderInvestigationVoAssembler.create(inv);
}
 
Example 35
Project: AvoinApotti   File: VoMapper.java   Source Code and License 5 votes vote down vote up
protected IfOrderInvestigationVo getInvFromOrderVoAndMessage(IfOutOcsOrderVo orderVo, OrderInvestigationRefVo invRef)
throws Exception {
	IfOrderInvestigationVoCollection invColl= orderVo.getInvestigations();
	IfOrderInvestigationVo invVo=null;
	for (int i=0;i<invColl.size();i++)
	{
		invVo=invColl.get(i);
		if(invRef.getBoId().equals(invVo.getBoId()))
		{
			return invVo;
		}
	}
	throw new Exception("Could not find Investigation for Ref: "+invRef+" in Order:"
			+orderVo.toString());
}
 
Example 36
Project: AvoinApotti   File: DnaBatchUpdateImpl.java   Source Code and License 5 votes vote down vote up
private void createExternalEvent(Booking_AppointmentRefVo appointment, OrderInvestigationRefVo investigation, LookupInstVo type) throws StaleObjectException
{
	if (null == appointment)
		throw new DomainRuntimeException("Appointment Cannot be NULL");

	DomainFactory factory = getDomainFactory();
	ExternalSystemEvent event = new ExternalSystemEvent();
	
	// We need to deal with null investigations
	// when (not )sending the messages
	if (null != investigation) 
	{
		OrderInvestigation domInv = (OrderInvestigation) factory.getDomainObject(investigation);
		
		//WDEV-5912 For Investigations marked as NoInterface there are no interface calls
		if(domInv.getInvestigation() != null && domInv.getInvestigation().getInvestigationIndex() != null &&  domInv.getInvestigation().getInvestigationIndex().isNoInterface() != null && domInv.getInvestigation().getInvestigationIndex().isNoInterface())
			return;
		
		event.setInvestigation(domInv);
		event.setProviderSystem(domInv.getInvestigation().getProviderService().getProviderSystem());
	}

	Booking_Appointment domBookAppt = (Booking_Appointment) factory.getDomainObject(appointment);
	event.setAppointment(domBookAppt);
	event.setWasProcessed(Boolean.FALSE);
	event.setMessageStatus(getDomLookup(OrderMessageStatus.CREATED));
	event.setEventType(getDomLookup(type));
	factory.save(event);
}
 
Example 37
Project: AvoinApotti   File: OCSExternalEventsImpl.java   Source Code and License 5 votes vote down vote up
private void createExternalEvent(Booking_AppointmentRefVo appointment, OrderInvestigationRefVo investigation, LookupInstVo type) throws StaleObjectException
{
	if (null == appointment)
		throw new DomainRuntimeException("Appointment Cannot be NULL");

	DomainFactory factory = getDomainFactory();
	ExternalSystemEvent event = new ExternalSystemEvent();
	
	// We need to deal with null investigations
	// when (not )sending the messages
	if (null != investigation) 
	{
		OrderInvestigation domInv = (OrderInvestigation) factory.getDomainObject(investigation);
		
		//WDEV-5912 For Investigations marked as NoInterface there are no interface calls
		if(domInv.getInvestigation() != null && domInv.getInvestigation().getInvestigationIndex() != null &&  domInv.getInvestigation().getInvestigationIndex().isNoInterface() != null && domInv.getInvestigation().getInvestigationIndex().isNoInterface())
			return;
		
		event.setInvestigation(domInv);
		event.setProviderSystem(domInv.getInvestigation().getProviderService().getProviderSystem());
	}

	Booking_Appointment domBookAppt = (Booking_Appointment) factory.getDomainObject(appointment);
	
	if(type !=null //http://jira/browse/WDEV-12816 If it is not radiology then we doon't need a message
			&&ExternalSystemEventTypes.PATIENTARRIVING.getID()==type.getID()
			&&domBookAppt!=null&&domBookAppt.getSession()!=null
			&&domBookAppt.getSession().getService()!=null
			&&domBookAppt.getSession().getService().getServiceCategory()!=null
			&&ServiceCategory.RADIOLOGY_MODALITY.getID()!=domBookAppt.getSession().getService().getServiceCategory().getId())
	{
		return;
	}
	
	event.setAppointment(domBookAppt);
	event.setWasProcessed(Boolean.FALSE);
	event.setMessageStatus(getDomLookup(OrderMessageStatus.CREATED));
	event.setEventType(getDomLookup(type));
	factory.save(event);
}
 
Example 38
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private InvestigationUnderSpecimenVo getInvestUnderSpecimenVoFromContextByOrderInvestigation(OrderInvestigationRefVo voOrderInvestigation)
{
	OrderInvestigationVoCollection voCollOrderInvestigation = form.getGlobalContext().OCRR.getOrderInvestigationCollection();
	if (voCollOrderInvestigation != null && voCollOrderInvestigation.size() > 0)
	{
		for (int i = 0; i < voCollOrderInvestigation.size(); i++)
		{
			if (voCollOrderInvestigation.get(i).equals(voOrderInvestigation))
				return voCollOrderInvestigation.get(i).getInvestigation();
		}
	}
	return null;
}
 
Example 39
Project: AvoinApotti   File: MyOrderImpl.java   Source Code and License 5 votes vote down vote up
private OrderInvestigationRefVoCollection getNonDFTInvestigation(OrderSpecimenVo specimen, OrderInvestigationRefVoCollection investigationsDFT)
{
	OrderInvestigationRefVoCollection nonDFTInvestigations = new OrderInvestigationRefVoCollection();
	
	if (specimen.getInvestigations() != null)
	{
		for (OrderInvestigationRefVo investigation : specimen.getInvestigations())
		{
			if (investigationsDFT == null || !investigationsDFT.contains(investigation))
				nonDFTInvestigations.add(investigation);
		}
	}

	return nonDFTInvestigations;
}
 
Example 40
Project: AvoinApotti   File: MyOrderImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Function used to retrieve the OrderInvestigationAppointment for the investigation
 */
public OrderInvWithStatusApptVo getOrderInvestigationAppointment(OrderInvestigationRefVo investigation)
{
	if (investigation == null || !investigation.getID_OrderInvestigationIsNotNull())
		return null;
	
	StringBuilder query = new StringBuilder();
	query.append("SELECT orderInv FROM OrderInvAppt AS orderInv LEFT JOIN orderInv.orderInvestigation AS investigation ");
	query.append(" WHERE investigation.id = :ID_INV");
	
	return OrderInvWithStatusApptVoAssembler.create((OrderInvAppt) getDomainFactory().findFirst(query.toString(), "ID_INV", investigation.getID_OrderInvestigation()));
}
 
Example 41
Project: AvoinApotti   File: MyOrderImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Function used to retrieve the OrderInvestigation Booking VO
 */
public OrderInvestigationBookingWithStatusVo getOrderInvestigationBooking(OrderInvestigationRefVo investigation)
{
	if (investigation == null || !investigation.getID_OrderInvestigationIsNotNull())
		return null;

	return OrderInvestigationBookingWithStatusVoAssembler.create((OrderInvestigation) getDomainFactory().getDomainObject(OrderInvestigation.class, investigation.getID_OrderInvestigation()));
}
 
Example 42
Project: AvoinApotti   File: MyOrderImpl.java   Source Code and License 5 votes vote down vote up
public OrderInvestigationForStatusChangeVo getOrderInvestigation(OrderInvestigationRefVo investigation)
{
	if (investigation == null)
		throw new CodingRuntimeException("Error - Investigation to amend must not be null");
	
	return OrderInvestigationForStatusChangeVoAssembler.create((OrderInvestigation) getDomainFactory().getDomainObject(OrderInvestigation.class, investigation.getID_OrderInvestigation()));
}
 
Example 43
Project: AvoinApotti   File: PrintOrderImpl.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public LocSvcProviderSysLiteVo getProviderServiceForOrderInv(OrderInvestigationRefVo orderInv)
{
	if(orderInv == null || orderInv.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("orderInv parameter is null in method getProviderServiceForOrderInv");
	
	DomainFactory factory = getDomainFactory();
	String hql = "select inv.providerService from OrderInvestigation as orderInv left join orderInv.investigation as inv left join inv.providerService as provSer where orderInv.id = :idOrderInv";
	List providers = factory.find(hql,new String[] {"idOrderInv"},new Object[] {orderInv.getID_OrderInvestigation()});
	if(providers != null && providers.size() == 1)
		return LocSvcProviderSysLiteVoAssembler.create((LocSvcProviderSys) providers.get(0));
	
	return null;
}
 
Example 44
Project: AvoinApotti   File: ClinicalOrdersResultsOCRRFormImpl.java   Source Code and License 5 votes vote down vote up
public ReferralAppointmentDetailsOcsOrderVoCollection getRefAppDetOcsOrder(String listId, PatientRefVo patientRef, OrderInvestigationRefVo orderInvRef)
{
	if (patientRef==null || patientRef.getID_Patient()==null)
		throw new CodingRuntimeException("Patient parameter cannot be null !");
	
	ArrayList<String> markers = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();
	
	StringBuffer hql = new StringBuffer();
	hql.append("select ocsOrd from OcsOrderSession as ocsOrd left join ocsOrd.investigations as investigations left join investigations.investigation as inv left join ocsOrd.patient as patient ");
	hql.append("where inv.id in " + listId ) ;

	
	hql.append(" and patient.id=:PatID ");
	markers.add("PatID");
	values.add(patientRef.getID_Patient());

	if (orderInvRef!=null && orderInvRef.getID_OrderInvestigationIsNotNull())
	{
		hql.append(" and investigations.id=:OrderInvId ");
		markers.add("OrderInvId");
		values.add(orderInvRef.getID_OrderInvestigation());
	}

	List<?> ListReffApp = getDomainFactory().find(hql.toString(), markers, values);
	
	return ReferralAppointmentDetailsOcsOrderVoAssembler.createReferralAppointmentDetailsOcsOrderVoCollectionFromOcsOrderSession(ListReffApp);

}
 
Example 45
Project: AvoinApotti   File: ClinicalOrdersResultsOCRRFormImpl.java   Source Code and License 5 votes vote down vote up
public ReferralAppointmentDetailsOrderInvestigationVo getReferralAppointmentDetailsOrderInv(OrderInvestigationRefVo orderInvRef)
{
	if (orderInvRef==null || orderInvRef.getID_OrderInvestigation()==null)
		throw new CodingRuntimeException("OrderInvestigation parameter cannot be null !");
	
	DomainFactory factory = getDomainFactory();
	OrderInvestigation domainOrderInv = (OrderInvestigation)factory.getDomainObject(OrderInvestigation.class, orderInvRef.getID_OrderInvestigation());
	return ReferralAppointmentDetailsOrderInvestigationVoAssembler.create(domainOrderInv);
}
 
Example 46
Project: AvoinApotti   File: PathologyResultsImpl.java   Source Code and License 5 votes vote down vote up
public Date getSpecimenWorkListItemDateToCollectByInvestigation(OrderInvestigationRefVo orderInvestigation) 
{
	if (orderInvestigation == null || orderInvestigation.getID_OrderInvestigation() == null)
		throw new CodingRuntimeException("OrderInvestigation is null or id not provided in method getSpecimenWorkListItemDateToCollectByInvestigation");
		
	List<?> date = getDomainFactory().find("select specw.dateToCollect from SpecimenWorkListItem as specw left join specw.dFTOrderInvestigation as orderInv where orderInv.id = " + orderInvestigation.getID_OrderInvestigation());
	if(date != null && date.size() > 0)
	{
		if(date.get(0) instanceof java.util.Date)
			return new Date((java.util.Date)date.get(0));
	}
	
	return null;
}
 
Example 47
Project: AvoinApotti   File: ResultCommentsDialogImpl.java   Source Code and License 5 votes vote down vote up
public OrderInvestigationRefVo getOrderInvestigation(OrderInvestigationRefVo investigation)
{
	if (investigation == null || !investigation.getID_OrderInvestigationIsNotNull())
		return null;
	
	OrderInvestigation domInvestigation = (OrderInvestigation) getDomainFactory().getDomainObject(OrderInvestigation.class, investigation.getID_OrderInvestigation());
	
	return new OrderInvestigationRefVo(domInvestigation.getId(), domInvestigation.getVersion());
}
 
Example 48
Project: AvoinApotti   File: OrderInvStatusHistoryImpl.java   Source Code and License 5 votes vote down vote up
private void updateOcsPathRadResult(OrderInvestigationRefVo invRef, OrderInvStatus orderInvStatus, OcsPathRadResultVoCollection results)// 	WDEV-15894 
{
	if(invRef == null || results == null || results.size() == 0)
		return;
	
	for(int i=0; i<results.size(); i++)
	{
		if(invRef.getID_OrderInvestigation().equals(results.get(i).getOrderInvestigation().getID_OrderInvestigation()))
		{
			results.get(i).setOrderInvestigation(invRef);
			results.get(i).setCurrentInvestigationStatus(orderInvStatus);// 	WDEV-15894
			break;
		}
	}
}
 
Example 49
Project: AvoinApotti   File: CumulateResultsImpl.java   Source Code and License 5 votes vote down vote up
public OrderInvestigationVo getOrder(OrderInvestigationRefVo orderRef) 
{
	if(orderRef == null)
		return null;
	
	return OrderInvestigationVoAssembler.create((OrderInvestigation)getDomainFactory().getDomainObject(orderRef));
}
 
Example 50
Project: AvoinApotti   File: CumulateResultsImpl.java   Source Code and License 5 votes vote down vote up
public OrderInvestigationDFTForCumulateResultsVo getDTFOrderInvestigation(OrderInvestigationRefVo orderInvestigationRef) 
{
	if(orderInvestigationRef == null)
		return null;
	
	return OrderInvestigationDFTForCumulateResultsVoAssembler.create((OrderInvestigation)getDomainFactory().getDomainObject(orderInvestigationRef));
}
 
Example 51
Project: AvoinApotti   File: CumulateResultsImpl.java   Source Code and License 5 votes vote down vote up
public OrderInvestigationChartVo getOrderInvestigation(OrderInvestigationRefVo orderInvestigationRef) 
{
	if(orderInvestigationRef == null)
		return null;
	
	return OrderInvestigationChartVoAssembler.create((OrderInvestigation)getDomainFactory().getDomainObject(orderInvestigationRef));
}
 
Example 52
Project: AvoinApotti   File: OrderSummaryImpl.java   Source Code and License 5 votes vote down vote up
public OrderInvestigationLiteVo getOrderInvestigation(OrderInvestigationRefVo orderInvRef) 
{
	if(orderInvRef == null)
		return null;
	OrderInvestigation doOrderInv = (OrderInvestigation)getDomainFactory().getDomainObject(OrderInvestigation.class, orderInvRef.getID_OrderInvestigation());
	return OrderInvestigationLiteVoAssembler.create(doOrderInv);
}
 
Example 53
Project: AvoinApotti   File: OrderSummaryImpl.java   Source Code and License 5 votes vote down vote up
public PathologySpecimenOrderInvestigationVo getOrdInvestigation(OrderInvestigationRefVo orderInvestigationRef) 
{
	if(orderInvestigationRef == null)
		return null;
	
	OrderInvestigation doOrderInv = (OrderInvestigation)getDomainFactory().getDomainObject(OrderInvestigation.class, orderInvestigationRef.getID_OrderInvestigation());
	return PathologySpecimenOrderInvestigationVoAssembler.create(doOrderInv);
}
 
Example 54
Project: AvoinApotti   File: PathologyDialogImpl.java   Source Code and License 5 votes vote down vote up
public PathologySpecimenVo getSpecimen(OrderInvestigationRefVo orvInvRef)
{
	if(orvInvRef == null || orvInvRef.getID_OrderInvestigation() == null)
		throw new DomainRuntimeException("Invalid orderInvestigation");
	
	DomainFactory factory = getDomainFactory();
	OrderInvestigation domOrdInv = (OrderInvestigation)factory.getDomainObject(OrderInvestigation.class, orvInvRef.getID_OrderInvestigation());
	if (domOrdInv == null || domOrdInv.getSpecimen() == null || domOrdInv.getSpecimen().size() == 0)//WDEV-16463
		return null;
	
	return PathologySpecimenVoAssembler.create((OrderSpecimen) domOrdInv.getSpecimen().get(0));		
}
 
Example 55
Project: AvoinApotti   File: PathologyDialogImpl.java   Source Code and License 5 votes vote down vote up
public ClinicalImagingResultVo getClinicalImagingResult(OrderInvestigationRefVo resultId)
{
	if(resultId == null || resultId.getID_OrderInvestigation() == null)
		throw new DomainRuntimeException("Invalid OrderInvestigation id");
	
	return ClinicalImagingResultVoAssembler.create((OrderInvestigation)getDomainFactory().getDomainObject(OrderInvestigation.class, resultId.getID_OrderInvestigation()));		
}
 
Example 56
Project: AvoinApotti   File: PathologyDialogImpl.java   Source Code and License 5 votes vote down vote up
/**
 * WDEV-13321
 * Function used to reset the Allocated for review HCP
 */
public OrderInvestigationVo resetAllocatedReviewHCP(OrderInvestigationRefVo investigation) throws StaleObjectException
{
	if (investigation == null || !investigation.getID_OrderInvestigationIsNotNull())
		return null;
	
	DomainFactory factory = getDomainFactory();
	
	OrderInvestigation domOrdInv = (OrderInvestigation) factory.getDomainObject(OrderInvestigation.class, investigation.getID_OrderInvestigation());
	
	
	if (domOrdInv == null)
		return null;
	
	if (domOrdInv.getAllocatedHCPforReview() == null)
		return OrderInvestigationVoAssembler.create(domOrdInv);
	
	HcpLiteVo hcpUser = (HcpLiteVo) getHcpLiteUser();
	ims.core.resource.people.domain.objects.Hcp domHcpUser = HcpLiteVoAssembler.extractHcp(factory, hcpUser);

	if (domOrdInv.getAllocatedHCPforReview().equals(domHcpUser))
	{
		domOrdInv.setAllocatedHCPforReview(null);
		domOrdInv.setAllocatedDateForReview(null);
		domOrdInv.setResultSortDate(domOrdInv.getRepDateTime());//http://jira/browse/WDEV-18025
		domOrdInv.setForReview(null);							// WDEV-18052
		domOrdInv.setReviewRequestedBy(null);					// WDEV-18052
	}
	
	return OrderInvestigationVoAssembler.create(domOrdInv);
}
 
Example 57
Project: AvoinApotti   File: PathologyDialogImpl.java   Source Code and License 5 votes vote down vote up
public NewResultSpecDocVo getOrderInvestigation(OrderInvestigationRefVo refOrderInvestigation) {
	if(refOrderInvestigation == null || refOrderInvestigation.getID_OrderInvestigation() == null)
		throw new DomainRuntimeException("Invalid orderInvestigation");
	
	DomainFactory factory = getDomainFactory();
	OrderInvestigation domOrdInv = (OrderInvestigation)factory.getDomainObject(OrderInvestigation.class, refOrderInvestigation.getID_OrderInvestigation());
	if (domOrdInv == null)
		return null;		
	return NewResultSpecDocVoAssembler.create(domOrdInv);
}
 
Example 58
Project: AvoinApotti   File: PathologyDialogImpl.java   Source Code and License 5 votes vote down vote up
public NewResultOcsOrderVo getNewResultOcsOrderVo(OrderInvestigationRefVo resultId) 
{
	if(resultId == null || resultId.getID_OrderInvestigation() == null)
		throw new DomainRuntimeException("Invalid OrderInvestigation id");
	if(resultId != null)
	{
		DomainFactory factory = getDomainFactory();
		StringBuffer hql = new StringBuffer(" select o2_1 from OrderInvestigation as o1_1 left join o1_1.orderDetails as o2_1 where  "); 
		String andStr = " ";
	
		ArrayList<String> markers = new ArrayList<String>();
		ArrayList<Serializable> values = new ArrayList<Serializable>();
	
		hql.append(andStr + " o1_1.id  = :OrderInvId");
			markers.add("OrderInvId");
		values.add(resultId.getID_OrderInvestigation());
		andStr = " and ";	

		List<?> list = factory.find(hql.toString(), markers,values);
		if(list != null && list.size() > 0)
		{ 
			NewResultOcsOrderVoCollection voColl = NewResultOcsOrderVoAssembler.createNewResultOcsOrderVoCollectionFromOcsOrderSession(list);// 	WDEV-16232
			if(voColl != null && voColl.size() > 0)
				return voColl.get(0);
		}
	}
	return null;
}
 
Example 59
Project: AvoinApotti   File: PathologyDialogImpl.java   Source Code and License 5 votes vote down vote up
public String getCentricityPacsAccessionNumber(OrderInvestigationRefVo voOrderInvRefVo) 
{
	if(voOrderInvRefVo == null || voOrderInvRefVo.getID_OrderInvestigation() == null)
		throw new DomainRuntimeException("Invalid OrderInvestigation id");
	
	if(voOrderInvRefVo != null)
	{
		DomainFactory factory = getDomainFactory();
		StringBuffer hql = new StringBuffer(" select o1_1 from OrderInvestigation as o1_1 where  "); 
		String andStr = " ";
	
		ArrayList<String> markers = new ArrayList<String>();
		ArrayList<Serializable> values = new ArrayList<Serializable>();
	
		hql.append(andStr + " o1_1.id  = :OrderInvId");
			markers.add("OrderInvId");
		values.add(voOrderInvRefVo.getID_OrderInvestigation());
		andStr = " and ";	

		List<?> list = factory.find(hql.toString(), markers,values);
		if(list != null && list.size() > 0)
		{ 
			OrderInvestigationVoCollection voColl = OrderInvestigationVoAssembler.createOrderInvestigationVoCollectionFromOrderInvestigation(list);
			if(voColl != null && voColl.size() > 0)
				return voColl.get(0).getAccessionNumber();
		}
	}
	return null;
}
 
Example 60
Project: AvoinApotti   File: PathologyDialogImpl.java   Source Code and License 5 votes vote down vote up
public OcsPathRadResultVo addViewedToStatusHistory(OcsPathRadResultVo voPathRadResult) throws StaleObjectException
{
	if (voPathRadResult == null)
		throw new CodingRuntimeException("voPathRadResult cannot be null in method addViewedToStatusHistory");
	
	DomainFactory factory = getDomainFactory();
	OrderInvestigation domOrdInv = (OrderInvestigation)factory.getDomainObject(voPathRadResult.getOrderInvestigation());
	if (domOrdInv.getVersion() != voPathRadResult.getOrderInvestigation().getVersion_OrderInvestigation())
		throw new StaleObjectException(domOrdInv, "Data has been updated by another user");
	
	OrderSpecimen domSpec = (domOrdInv!=null && domOrdInv.getSpecimen()!=null && domOrdInv.getSpecimen().size()>0 ? (OrderSpecimen) domOrdInv.getSpecimen().get(0):null); //WDEV-16361
	
	//only pathology will have specimens
	if(domSpec != null)
	{
		@SuppressWarnings("rawtypes")
		Iterator iter = domSpec.getInvestigations().iterator();
		while (iter.hasNext())
		{
			OrderInvestigation ordInv = (OrderInvestigation)iter.next();		
			ordInv = addViewedStatus(ordInv);
		}		
		factory.save(domSpec);		
	}
	else
	{
		domOrdInv = addViewedStatus(domOrdInv);
		factory.save(domOrdInv);	
	}
	
	voPathRadResult.setOrderInvestigation(new OrderInvestigationRefVo (domOrdInv.getId(), domOrdInv.getVersion()));
	
	return voPathRadResult;
}