import ims.vo.LookupInstVo; //導入方法依賴的package包/類
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);
}