Java Code Examples for ca.uhn.hl7v2.model.v24.segment.ORC

The following are top voted examples for showing how to use ca.uhn.hl7v2.model.v24.segment.ORC. 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: elexis-3-core   File: HL7ReaderV24.java   Source Code and License 6 votes vote down vote up
private OrcMessage extractOrc(ORC orc) throws HL7Exception{
	if (orc != null) {
		OrcMessage orcMessage = new OrcMessage();
		XCN[] ops = orc.getOrderingProvider();
		for (XCN op : ops) {
			FN fn = op.getFamilyName();
			ST familyName = null;
			if (fn != null) {
				familyName = fn.getSurname();
				if (familyName == null) {
					familyName = fn.getOwnSurname();
				}
			}
			addNameValuesToOrcMessage(op.getGivenName(), familyName, orcMessage);
		}
		return orcMessage;
	}
	return null;
}
 
Example 2
Project: AvoinApotti   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
/**
 * wdev-2367
 * updateOrderLevelValues
 * This method will update the Patient Location and Responsible Clinician if they are specified with a result message. 
 * @param ormMsg
 * @param obr 
 * @param orc 
 * @param voOrder
 * @param providerSystem
 * @return 
 * @return
 * @throws HL7Exception 
 * @throws StaleObjectException 
 */
private IfOcsOrderVo updateOrderLevelValues(Message ormMsg, ORC orc, OBR obr, IfOcsOrderVo voOrder, ProviderSystemVo providerSystem) throws HL7Exception, StaleObjectException
{
	PV1 pv1=null;
	if (ormMsg instanceof ORM_O01)
	{
		pv1=((ORM_O01)ormMsg).getORM_O01_PIDPD1NTEPV1PV2IN1IN2IN3GT1AL1().getORM_O01_PV1PV2().getPV1();
	}
	else if (ormMsg instanceof OMG_O19)
	{
		pv1=((OMG_O19)ormMsg).getOMG_O19_PIDPD1NTEPV1PV2IN1IN2IN3GT1AL1().getOMG_O19_PV1PV2().getPV1();
	}
	else if (ormMsg instanceof ORU_R01)
	{
		pv1=((ORU_R01)ormMsg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI().getORU_R01_PIDPD1NK1NTEPV1PV2().getORU_R01_PV1PV2().getPV1();
	}

	if (pv1 != null)
	{
		populateLocationVoFromPL(pv1.getAssignedPatientLocation(), voOrder, providerSystem);			
	}

	// ORC-12   Ordering provider
	populateWithOrderingProvider(voOrder, orc, obr, providerSystem);
	
	// wdev-3054 - Removed code that appends value to Additional Clinical Info as now only populated
	// on un-solicited results
	
	String errors[] = voOrder.validate();
	if (errors != null)
		throw new HL7Exception("Validation errors found for order - " + VoMapper.toDisplayString(errors));
	voOrder = ocsIfInbound.saveOrderLevelItems(voOrder);
	return voOrder;
}
 
Example 3
Project: AvoinApotti   File: O01VoMapper.java   Source Code and License 5 votes vote down vote up
private void renderOrder(IfOrderInvestigationVo investigation, IfOrderMessageVo msgVo, IfOutOcsOrderVo newOrder, ORC orc, OBR obr, int id) throws Exception
{
	LOG.debug("O01VoMapper renderOrder: entry");

	// OBR-1   Set ID � OBR   (SI)
	obr.getSetIDOBR().setValue(String.valueOf(id+1));

	// OBR-2   Placer order number   (EI)   00216
	obr.getPlacerOrderNumber().getEntityIdentifier().setValue(msgVo.getPlacerOrdNum());
	
	// OBR-3 Filler Order Number
	if (msgVo.getFillerNumberIsNotNull())
	{
		obr.getFillerOrderNumber().getEntityIdentifier().setValue(msgVo.getFillerNumber());
	}

	renderInvestigationToORC_OBR(investigation, orc, obr,msgVo.getProviderSystem());
	renderMsgVoToORC(msgVo, orc);
	renderNewOrderToORC_OBR(msgVo.getProviderSystem(),newOrder, orc, obr);
	
	if (orc.getDateTimeOfTransaction().getTimeOfAnEvent().getValue() == null)
		renderDateTimeVoToTS(new DateTime(), orc.getDateTimeOfTransaction());
	
	if(investigation.getInvestigationIsNotNull()
			&&investigation.getInvestigation().getEventType().equals(InvEventType.TIME_SERIES)
			&&investigation.getInvestigation().getPathInvDetailsIsNotNull()
			&&investigation.getInvestigation().getPathInvDetails().getSpecimens().size()>0
			&&investigation.getInvestigation().getPathInvDetails().getSpecimens().get(0).getTypeIsNotNull())
	{
		SpecimenType type = investigation.getInvestigation().getPathInvDetails().getSpecimens().get(0).getType();
		
		SPS sps = obr.getSpecimenSource();
		sps.getSpecimenSourceNameOrCode().getIdentifier().setValue(svc.getRemoteLookup(type.getId(), msgVo.getProviderSystem().getCodeSystem().getText()));
		sps.getSpecimenSourceNameOrCode().getText().setValue(type.getText());

	}
	LOG.debug("O01VoMapper renderOrder: exit");

}
 
Example 4
Project: AvoinApotti   File: O01VoMapper.java   Source Code and License 5 votes vote down vote up
private void renderMsgVoToORC(IfOrderMessageVo msgVo, ORC commonOrder) throws HL7Exception
{
	LOG.debug("O01VoMapper renderMsgVoToORC: entry");

	// ORC-1 Order Control (First New Order)
	
	if(msgVo.getOrderDetailsIsNotNull()&& msgVo.getOrderDetails().getSendNumberIsNotNull()
			&&Boolean.TRUE.equals(msgVo.getOrderDetails().getSendNumber()))
	{
		commonOrder.getOrderControl().setValue("NA"); 
	}
	else
	{
		commonOrder.getOrderControl().setValue("NW"); 
	}
	
	
	// ORC-2   Placer order number   (EI)   00216
	commonOrder.getPlacerOrderNumber().getEntityIdentifier().setValue(msgVo.getPlacerOrdNum());
	if (msgVo.getFillerNumberIsNotNull())
	{
		commonOrder.getFillerOrderNumber().getEntityIdentifier().setValue(msgVo.getFillerNumber());
	}

	// ORC-6   Response flag   (ID)   00220
	// Possible values..
	//		E	Report exceptions only
	//		R	Same as E, also Replacement and Parent-Child
	//		D	Same as R, also other associated segments
	//		F	Same as D, plus confirmations explicitly
	//		N	Only the MSA segment is returned
	commonOrder.getResponseFlag().setValue("D");  // Default Value 
	LOG.debug("O01VoMapper renderMsgVoToORC: exit");

}
 
Example 5
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
/**
 * wdev-2367
 * updateOrderLevelValues
 * This method will update the Patient Location and Responsible Clinician if they are specified with a result message. 
 * @param ormMsg
 * @param obr 
 * @param orc 
 * @param voOrder
 * @param providerSystem
 * @return 
 * @return
 * @throws HL7Exception 
 * @throws StaleObjectException 
 */
private IfOcsOrderVo updateOrderLevelValues(Message ormMsg, ORC orc, OBR obr, IfOcsOrderVo voOrder, ProviderSystemVo providerSystem) throws HL7Exception, StaleObjectException
{
	PV1 pv1=null;
	if (ormMsg instanceof ORM_O01)
	{
		pv1=((ORM_O01)ormMsg).getORM_O01_PIDPD1NTEPV1PV2IN1IN2IN3GT1AL1().getORM_O01_PV1PV2().getPV1();
	}
	else if (ormMsg instanceof OMG_O19)
	{
		pv1=((OMG_O19)ormMsg).getOMG_O19_PIDPD1NTEPV1PV2IN1IN2IN3GT1AL1().getOMG_O19_PV1PV2().getPV1();
	}
	else if (ormMsg instanceof ORU_R01)
	{
		pv1=((ORU_R01)ormMsg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI().getORU_R01_PIDPD1NK1NTEPV1PV2().getORU_R01_PV1PV2().getPV1();
	}

	if (pv1 != null)
	{
		populateLocationVoFromPL(pv1.getAssignedPatientLocation(), voOrder, providerSystem);			
	}

	// ORC-12   Ordering provider
	populateWithOrderingProvider(voOrder, orc, obr, providerSystem);
	
	// wdev-3054 - Removed code that appends value to Additional Clinical Info as now only populated
	// on un-solicited results
	
	String errors[] = voOrder.validate();
	if (errors != null)
		throw new HL7Exception("Validation errors found for order - " + VoMapper.toDisplayString(errors));
	voOrder = ocsIfInbound.saveOrderLevelItems(voOrder);
	return voOrder;
}
 
Example 6
Project: openMAXIMS   File: O01VoMapper.java   Source Code and License 5 votes vote down vote up
private void renderOrder(IfOrderInvestigationVo investigation, IfOrderMessageVo msgVo, IfOutOcsOrderVo newOrder, ORC orc, OBR obr, int id) throws Exception
{
	LOG.debug("O01VoMapper renderOrder: entry");

	// OBR-1   Set ID – OBR   (SI)
	obr.getSetIDOBR().setValue(String.valueOf(id+1));

	// OBR-2   Placer order number   (EI)   00216
	obr.getPlacerOrderNumber().getEntityIdentifier().setValue(msgVo.getPlacerOrdNum());
	
	// OBR-3 Filler Order Number
	if (msgVo.getFillerNumberIsNotNull())
	{
		obr.getFillerOrderNumber().getEntityIdentifier().setValue(msgVo.getFillerNumber());
	}

	renderInvestigationToORC_OBR(investigation, orc, obr,msgVo.getProviderSystem());
	renderMsgVoToORC(msgVo, orc);
	renderNewOrderToORC_OBR(msgVo.getProviderSystem(),newOrder, orc, obr);
	
	if (orc.getDateTimeOfTransaction().getTimeOfAnEvent().getValue() == null)
		renderDateTimeVoToTS(new DateTime(), orc.getDateTimeOfTransaction());
	
	if(investigation.getInvestigationIsNotNull()
			&&investigation.getInvestigation().getEventType().equals(InvEventType.TIME_SERIES)
			&&investigation.getInvestigation().getPathInvDetailsIsNotNull()
			&&investigation.getInvestigation().getPathInvDetails().getSpecimens().size()>0
			&&investigation.getInvestigation().getPathInvDetails().getSpecimens().get(0).getTypeIsNotNull())
	{
		SpecimenType type = investigation.getInvestigation().getPathInvDetails().getSpecimens().get(0).getType();
		
		SPS sps = obr.getSpecimenSource();
		sps.getSpecimenSourceNameOrCode().getIdentifier().setValue(svc.getRemoteLookup(type.getId(), msgVo.getProviderSystem().getCodeSystem().getText()));
		sps.getSpecimenSourceNameOrCode().getText().setValue(type.getText());

	}
	LOG.debug("O01VoMapper renderOrder: exit");

}
 
Example 7
Project: openMAXIMS   File: O01VoMapper.java   Source Code and License 5 votes vote down vote up
private void renderMsgVoToORC(IfOrderMessageVo msgVo, ORC commonOrder) throws HL7Exception
{
	LOG.debug("O01VoMapper renderMsgVoToORC: entry");

	// ORC-1 Order Control (First New Order)
	
	if(msgVo.getOrderDetailsIsNotNull()&& msgVo.getOrderDetails().getSendNumberIsNotNull()
			&&Boolean.TRUE.equals(msgVo.getOrderDetails().getSendNumber()))
	{
		commonOrder.getOrderControl().setValue("NA"); 
	}
	else
	{
		commonOrder.getOrderControl().setValue("NW"); 
	}
	
	
	// ORC-2   Placer order number   (EI)   00216
	commonOrder.getPlacerOrderNumber().getEntityIdentifier().setValue(msgVo.getPlacerOrdNum());
	if (msgVo.getFillerNumberIsNotNull())
	{
		commonOrder.getFillerOrderNumber().getEntityIdentifier().setValue(msgVo.getFillerNumber());
	}

	// ORC-6   Response flag   (ID)   00220
	// Possible values..
	//		E	Report exceptions only
	//		R	Same as E, also Replacement and Parent-Child
	//		D	Same as R, also other associated segments
	//		F	Same as D, plus confirmations explicitly
	//		N	Only the MSA segment is returned
	commonOrder.getResponseFlag().setValue("D");  // Default Value 
	LOG.debug("O01VoMapper renderMsgVoToORC: exit");

}
 
Example 8
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
/**
 * wdev-2367
 * updateOrderLevelValues
 * This method will update the Patient Location and Responsible Clinician if they are specified with a result message. 
 * @param ormMsg
 * @param obr 
 * @param orc 
 * @param voOrder
 * @param providerSystem
 * @return 
 * @return
 * @throws HL7Exception 
 * @throws StaleObjectException 
 */
private IfOcsOrderVo updateOrderLevelValues(Message ormMsg, ORC orc, OBR obr, IfOcsOrderVo voOrder, ProviderSystemVo providerSystem) throws HL7Exception, StaleObjectException
{
	PV1 pv1=null;
	if (ormMsg instanceof ORM_O01)
	{
		pv1=((ORM_O01)ormMsg).getORM_O01_PIDPD1NTEPV1PV2IN1IN2IN3GT1AL1().getORM_O01_PV1PV2().getPV1();
	}
	else if (ormMsg instanceof OMG_O19)
	{
		pv1=((OMG_O19)ormMsg).getOMG_O19_PIDPD1NTEPV1PV2IN1IN2IN3GT1AL1().getOMG_O19_PV1PV2().getPV1();
	}
	else if (ormMsg instanceof ORU_R01)
	{
		pv1=((ORU_R01)ormMsg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI().getORU_R01_PIDPD1NK1NTEPV1PV2().getORU_R01_PV1PV2().getPV1();
	}

	if (pv1 != null)
	{
		populateLocationVoFromPL(pv1.getAssignedPatientLocation(), voOrder, providerSystem);			
	}

	// ORC-12   Ordering provider
	populateWithOrderingProvider(voOrder, orc, obr, providerSystem);
	
	// wdev-3054 - Removed code that appends value to Additional Clinical Info as now only populated
	// on un-solicited results
	
	String errors[] = voOrder.validate();
	if (errors != null)
		throw new HL7Exception("Validation errors found for order - " + VoMapper.toDisplayString(errors));
	voOrder = ocsIfInbound.saveOrderLevelItems(voOrder);
	return voOrder;
}
 
Example 9
Project: openMAXIMS   File: O01VoMapper.java   Source Code and License 5 votes vote down vote up
private void renderOrder(IfOrderInvestigationVo investigation, IfOrderMessageVo msgVo, IfOutOcsOrderVo newOrder, ORC orc, OBR obr, int id) throws Exception
{
	LOG.debug("O01VoMapper renderOrder: entry");

	// OBR-1   Set ID � OBR   (SI)
	obr.getSetIDOBR().setValue(String.valueOf(id+1));

	// OBR-2   Placer order number   (EI)   00216
	obr.getPlacerOrderNumber().getEntityIdentifier().setValue(msgVo.getPlacerOrdNum());
	
	// OBR-3 Filler Order Number
	if (msgVo.getFillerNumberIsNotNull())
	{
		obr.getFillerOrderNumber().getEntityIdentifier().setValue(msgVo.getFillerNumber());
	}

	renderInvestigationToORC_OBR(investigation, orc, obr,msgVo.getProviderSystem());
	renderMsgVoToORC(msgVo, orc);
	renderNewOrderToORC_OBR(msgVo.getProviderSystem(),newOrder, orc, obr);
	
	if (orc.getDateTimeOfTransaction().getTimeOfAnEvent().getValue() == null)
		renderDateTimeVoToTS(new DateTime(), orc.getDateTimeOfTransaction());
	
	if(investigation.getInvestigationIsNotNull()
			&&investigation.getInvestigation().getEventType().equals(InvEventType.TIME_SERIES)
			&&investigation.getInvestigation().getPathInvDetailsIsNotNull()
			&&investigation.getInvestigation().getPathInvDetails().getSpecimens().size()>0
			&&investigation.getInvestigation().getPathInvDetails().getSpecimens().get(0).getTypeIsNotNull())
	{
		SpecimenType type = investigation.getInvestigation().getPathInvDetails().getSpecimens().get(0).getType();
		
		SPS sps = obr.getSpecimenSource();
		sps.getSpecimenSourceNameOrCode().getIdentifier().setValue(svc.getRemoteLookup(type.getId(), msgVo.getProviderSystem().getCodeSystem().getText()));
		sps.getSpecimenSourceNameOrCode().getText().setValue(type.getText());

	}
	LOG.debug("O01VoMapper renderOrder: exit");

}
 
Example 10
Project: openMAXIMS   File: O01VoMapper.java   Source Code and License 5 votes vote down vote up
private void renderMsgVoToORC(IfOrderMessageVo msgVo, ORC commonOrder) throws HL7Exception
{
	LOG.debug("O01VoMapper renderMsgVoToORC: entry");

	// ORC-1 Order Control (First New Order)
	
	if(msgVo.getOrderDetailsIsNotNull()&& msgVo.getOrderDetails().getSendNumberIsNotNull()
			&&Boolean.TRUE.equals(msgVo.getOrderDetails().getSendNumber()))
	{
		commonOrder.getOrderControl().setValue("NA"); 
	}
	else
	{
		commonOrder.getOrderControl().setValue("NW"); 
	}
	
	
	// ORC-2   Placer order number   (EI)   00216
	commonOrder.getPlacerOrderNumber().getEntityIdentifier().setValue(msgVo.getPlacerOrdNum());
	if (msgVo.getFillerNumberIsNotNull())
	{
		commonOrder.getFillerOrderNumber().getEntityIdentifier().setValue(msgVo.getFillerNumber());
	}

	// ORC-6   Response flag   (ID)   00220
	// Possible values..
	//		E	Report exceptions only
	//		R	Same as E, also Replacement and Parent-Child
	//		D	Same as R, also other associated segments
	//		F	Same as D, plus confirmations explicitly
	//		N	Only the MSA segment is returned
	commonOrder.getResponseFlag().setValue("D");  // Default Value 
	LOG.debug("O01VoMapper renderMsgVoToORC: exit");

}
 
Example 11
Project: openmaxims-linux   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
/**
 * wdev-2367
 * updateOrderLevelValues
 * This method will update the Patient Location and Responsible Clinician if they are specified with a result message. 
 * @param ormMsg
 * @param obr 
 * @param orc 
 * @param voOrder
 * @param providerSystem
 * @return 
 * @return
 * @throws HL7Exception 
 * @throws StaleObjectException 
 */
private IfOcsOrderVo updateOrderLevelValues(Message ormMsg, ORC orc, OBR obr, IfOcsOrderVo voOrder, ProviderSystemVo providerSystem) throws HL7Exception, StaleObjectException
{
	PV1 pv1=null;
	if (ormMsg instanceof ORM_O01)
	{
		pv1=((ORM_O01)ormMsg).getORM_O01_PIDPD1NTEPV1PV2IN1IN2IN3GT1AL1().getORM_O01_PV1PV2().getPV1();
	}
	else if (ormMsg instanceof OMG_O19)
	{
		pv1=((OMG_O19)ormMsg).getOMG_O19_PIDPD1NTEPV1PV2IN1IN2IN3GT1AL1().getOMG_O19_PV1PV2().getPV1();
	}
	else if (ormMsg instanceof ORU_R01)
	{
		pv1=((ORU_R01)ormMsg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI().getORU_R01_PIDPD1NK1NTEPV1PV2().getORU_R01_PV1PV2().getPV1();
	}

	if (pv1 != null)
	{
		populateLocationVoFromPL(pv1.getAssignedPatientLocation(), voOrder, providerSystem);			
	}

	// ORC-12   Ordering provider
	populateWithOrderingProvider(voOrder, orc, obr, providerSystem);
	
	// wdev-3054 - Removed code that appends value to Additional Clinical Info as now only populated
	// on un-solicited results
	
	String errors[] = voOrder.validate();
	if (errors != null)
		throw new HL7Exception("Validation errors found for order - " + VoMapper.toDisplayString(errors));
	voOrder = ocsIfInbound.saveOrderLevelItems(voOrder);
	return voOrder;
}
 
Example 12
Project: openmaxims-linux   File: O01VoMapper.java   Source Code and License 5 votes vote down vote up
private void renderOrder(IfOrderInvestigationVo investigation, IfOrderMessageVo msgVo, IfOutOcsOrderVo newOrder, ORC orc, OBR obr, int id) throws Exception
{
	LOG.debug("O01VoMapper renderOrder: entry");

	// OBR-1   Set ID – OBR   (SI)
	obr.getSetIDOBR().setValue(String.valueOf(id+1));

	// OBR-2   Placer order number   (EI)   00216
	obr.getPlacerOrderNumber().getEntityIdentifier().setValue(msgVo.getPlacerOrdNum());
	
	// OBR-3 Filler Order Number
	if (msgVo.getFillerNumberIsNotNull())
	{
		obr.getFillerOrderNumber().getEntityIdentifier().setValue(msgVo.getFillerNumber());
	}

	renderInvestigationToORC_OBR(investigation, orc, obr,msgVo.getProviderSystem());
	renderMsgVoToORC(msgVo, orc);
	renderNewOrderToORC_OBR(msgVo.getProviderSystem(),newOrder, orc, obr);
	
	if (orc.getDateTimeOfTransaction().getTimeOfAnEvent().getValue() == null)
		renderDateTimeVoToTS(new DateTime(), orc.getDateTimeOfTransaction());
	
	if(investigation.getInvestigationIsNotNull()
			&&investigation.getInvestigation().getEventType().equals(InvEventType.TIME_SERIES)
			&&investigation.getInvestigation().getPathInvDetailsIsNotNull()
			&&investigation.getInvestigation().getPathInvDetails().getSpecimens().size()>0
			&&investigation.getInvestigation().getPathInvDetails().getSpecimens().get(0).getTypeIsNotNull())
	{
		SpecimenType type = investigation.getInvestigation().getPathInvDetails().getSpecimens().get(0).getType();
		
		SPS sps = obr.getSpecimenSource();
		sps.getSpecimenSourceNameOrCode().getIdentifier().setValue(svc.getRemoteLookup(type.getId(), msgVo.getProviderSystem().getCodeSystem().getText()));
		sps.getSpecimenSourceNameOrCode().getText().setValue(type.getText());

	}
	LOG.debug("O01VoMapper renderOrder: exit");

}
 
Example 13
Project: openmaxims-linux   File: O01VoMapper.java   Source Code and License 5 votes vote down vote up
private void renderMsgVoToORC(IfOrderMessageVo msgVo, ORC commonOrder) throws HL7Exception
{
	LOG.debug("O01VoMapper renderMsgVoToORC: entry");

	// ORC-1 Order Control (First New Order)
	
	if(msgVo.getOrderDetailsIsNotNull()&& msgVo.getOrderDetails().getSendNumberIsNotNull()
			&&Boolean.TRUE.equals(msgVo.getOrderDetails().getSendNumber()))
	{
		commonOrder.getOrderControl().setValue("NA"); 
	}
	else
	{
		commonOrder.getOrderControl().setValue("NW"); 
	}
	
	
	// ORC-2   Placer order number   (EI)   00216
	commonOrder.getPlacerOrderNumber().getEntityIdentifier().setValue(msgVo.getPlacerOrdNum());
	if (msgVo.getFillerNumberIsNotNull())
	{
		commonOrder.getFillerOrderNumber().getEntityIdentifier().setValue(msgVo.getFillerNumber());
	}

	// ORC-6   Response flag   (ID)   00220
	// Possible values..
	//		E	Report exceptions only
	//		R	Same as E, also Replacement and Parent-Child
	//		D	Same as R, also other associated segments
	//		F	Same as D, plus confirmations explicitly
	//		N	Only the MSA segment is returned
	commonOrder.getResponseFlag().setValue("D");  // Default Value 
	LOG.debug("O01VoMapper renderMsgVoToORC: exit");

}
 
Example 14
Project: rassyeyanie   File: AbstractCrisO01Test.java   Source Code and License 5 votes vote down vote up
@Test
public void test_message_to_message_orc_1() throws Exception {
	Structure expectedSegment = getExpected().getGroup("ORDER", 0).get(
			ORC.class);
	Structure actualSegment = getActual().getGroup("ORDER", 0).get(
			ORC.class);
	assertEquals(expectedSegment, actualSegment);
}
 
Example 15
Project: AvoinApotti   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private void populateWithOrderingProvider(IfOcsOrderVo order, ORC orc, OBR obr, ProviderSystemVo providerSystem) throws HL7Exception
{
	
	XCN orderingProvider=null;
	if (orc.getOrderingProvider(0) != null && orc.getOrderingProvider(0).getIDNumber().getValue() != null)
	{		
		orderingProvider = orc.getOrderingProvider(0);
	}
	if (orderingProvider == null)
	{
		//Need to also check OBR-16   Ordering provider  (XCN)
		if (obr.getOrderingProvider(0) != null && obr.getOrderingProvider(0).getIDNumber().getValue() != null)
		{
			orderingProvider = obr.getOrderingProvider(0);
		}
	}
	
	if (orderingProvider != null)
	{
		HcpLiteVo hcp = populateHcpVoFromXCN(orderingProvider, providerSystem.getCodeSystem());
		if (hcp != null)
		{
			order.setResponsibleClinician(hcp);
			if (!order.getOrderedByIsNotNull())  // wdev-4443
				order.setOrderedBy(hcp.getMos());
		}
		else
		{
			GpShortVo gp = populateGPVoFromXCN(orderingProvider, providerSystem.getCodeSystem());
			if (gp == null)
			{
				// We need to log the fact that the GP is not on our system
				LOG.warn("GP with code " + orderingProvider.getIDNumber() + " was not found on the IMS database");												
			}
			else
			{
				order.setResponsibleGp(gp);
			}
		}
		//WDEV-8884 
		if(ConfigFlag.HL7.REJECT_RESULTS_FOR_UNKNOWN_ORDERINGPROVIDER_OR_LOCATION.getValue())
		{
			// wdev-2746 If Neither Clinician nor GP are populated, reject the message as
			// one or the other are mandatory
			if (orderingProvider.getIDNumber().getValue() != null &&
					!order.getResponsibleClinicianIsNotNull() && !order.getResponsibleGpIsNotNull())
			{
				throw new HL7Exception("Ordering Provider (ORC-12, OBR-16) does not map to a valid Clinician or GP - Message Rejected");
			}
		}
	}

}
 
Example 16
Project: AvoinApotti   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private String getPlacerNumFromMessage(Message msg,int invCount,int PIDcounter) throws HL7Exception
{
	String placerOrdNum=null;
	for (int j = 0; j < invCount; j++)
	{
		ORU_R01_ORCOBRNTECTDOBXNTEFT1CTI orc_group = null;				
		ORC orc = null;
		ORC lastOrc = null;
		OBR obr =  null;
		if (msg instanceof ORM_O01)
		{
			orc = ((ORM_O01)msg).getORM_O01_ORCOBRRQDRQ1RXOODSODTNTECTDDG1OBXNTEFT1CTIBLG(j).getORC();
			obr = ((ORM_O01)msg).getORM_O01_ORCOBRRQDRQ1RXOODSODTNTECTDDG1OBXNTEFT1CTIBLG(j).getORM_O01_OBRRQDRQ1RXOODSODTNTECTDDG1OBXNTE().getOBR();
		}
		else if (msg instanceof OMG_O19)
		{
			orc = ((OMG_O19)msg).getOMG_O19_ORCOBRNTECTDDG1OBXNTEPIDPD1PV1PV2AL1ORCOBRNTECTDOBXNTEFT1CTIBLG(j).getORC();
			obr = ((OMG_O19)msg).getOMG_O19_ORCOBRNTECTDDG1OBXNTEPIDPD1PV1PV2AL1ORCOBRNTECTDOBXNTEFT1CTIBLG(j).getOBR();
		}
		else if (msg instanceof ORU_R01)
		{
			orc_group = ((ORU_R01)msg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI(PIDcounter).getORU_R01_ORCOBRNTECTDOBXNTEFT1CTI(j);
			orc = orc_group.getORC();
			if (orc == null)
				orc = lastOrc;
			else
				lastOrc = orc;
					
			obr = orc_group.getOBR();
		}
		else if (msg instanceof ORR_O02)
		{
			orc = ((ORR_O02)msg).getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI(j).getORC();
			obr = ((ORR_O02)msg).getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI(j).getOBR();
		}
		else if (msg instanceof ORG_O20)
		{
			orc = ((ORG_O20)msg).getORG_O20_PIDNTEORCOBRNTECTI().getORG_O20_ORCOBRNTECTI().getORC();
			obr = ((ORG_O20)msg).getORG_O20_PIDNTEORCOBRNTECTI().getORG_O20_ORCOBRNTECTI().getOBR();
		}
		else
		{
			throw new HL7Exception("Invalid message type passed to R01.processResult");
		}
		
		placerOrdNum=null;
		if ( orc.getPlacerOrderNumber() != null && orc.getPlacerOrderNumber().getEntityIdentifier() != null)
		{
			placerOrdNum = orc.getPlacerOrderNumber().getEntityIdentifier().getValue();
		}
		//JME: 20060627: Need to also check in OBR, in case sender is not filling ORC
		if (placerOrdNum == null && obr.getPlacerOrderNumber() != null && obr.getPlacerOrderNumber().getEntityIdentifier() != null)
		{
			placerOrdNum = obr.getPlacerOrderNumber().getEntityIdentifier().getValue();
		}
		if (placerOrdNum != null && placerOrdNum.equals("#R"))
			placerOrdNum=null;
		
		if(placerOrdNum!=null)
			return placerOrdNum;
		
	}
	return placerOrdNum;
}
 
Example 17
Project: AvoinApotti   File: O01VoMapper.java   Source Code and License 4 votes vote down vote up
private void renderNewOrderToORC_OBR(ProviderSystemVo providerSystem,IfOutOcsOrderVo newOrder, ORC commonOrder, OBR obr) throws Exception
{
	LOG.debug("O01VoMapper renderNewOrderToORC_OBR: entry");

	// ORC-4   Placer group number   (EI)   00218
	commonOrder.getPlacerGroupNumber().getEntityIdentifier().setValue("" + newOrder.getID_OcsOrderSession());
	
	if (newOrder.getOrderedByIsNotNull())
	{
		// ORC-10   Entered by   (XCN)   00224
		renderMemberOfStaffShortVoToXCN(newOrder.getOrderedBy(), commonOrder.getEnteredBy(0),providerSystem);

		// ORC-13   Enterer�s location   (PL)   00227 
		if (newOrder.getOrderedBy().getPrimaryLocationIsNotNull())
		{
			commonOrder.getEntererSLocation().getLocationDescription().setValue(newOrder.getOrderedBy().getPrimaryLocation().getName());
		}
		
		if (newOrder.getOrderedBy().getCommChannelsIsNotNull())
		{
			// ORC-14   Call back phone number   (XTN)   00228
			renderCommChannelVoCollectionToXTN(newOrder.getOrderedBy().getCommChannels(), commonOrder.getCallBackPhoneNumber(0));
		}
	}
	
	// OBR-16   Ordering provider  (XCN)   
	// ORC-12   Ordering provider   (XCN)   00226
	
	
	//http://jira/browse/WDEV-6910
	ConfigPropertyVo prop= providerSystem.getConfigurationProperty(ConfigItems.UseGpAsOrderingProvider);
	if (prop != null && (prop.getPropertyValueIsNotNull())&&(prop.getPropertyValue().length() > 0)
			&&prop.getPropertyValue().trim().equalsIgnoreCase("TRUE"))
	{
		if(newOrder.getResponsibleGpIsNotNull())
		{
			renderGpShortVoToXCN(newOrder.getResponsibleGp(), commonOrder.getOrderingProvider(0),providerSystem);
			renderGpShortVoToXCN(newOrder.getResponsibleGp(), obr.getOrderingProvider(0),providerSystem);
		}
	}
	
	else if (newOrder.getResponsibleClinicianIsNotNull())
	{
		renderMemberOfStaffShortVoToXCN(newOrder.getResponsibleClinician().getMos(), commonOrder.getOrderingProvider(0),providerSystem);
		renderMemberOfStaffShortVoToXCN(newOrder.getResponsibleClinician().getMos(), obr.getOrderingProvider(0),providerSystem);
		// OBR-17   Order callback phone number 
		
		if (!ConfigFlag.GEN.SITE_USES_ORDER_BLEEP_EXT_NUMBER.getValue()
				&& newOrder.getResponsibleClinician().getMosIsNotNull())
			renderCommChannelVoToXTN(newOrder.getResponsibleClinician().getMos().getCommChannel(ChannelType.BLEEP), obr.getOrderCallbackPhoneNumber(0));
	}

	if(ConfigFlag.GEN.SITE_USES_ORDER_BLEEP_EXT_NUMBER.getValue()&&newOrder.getBleepExtNumberIsNotNull())
	{
		CommChannelVo bleepVo = new CommChannelVo();
		bleepVo.setCommValue(newOrder.getBleepExtNumber());
		bleepVo.setChannelType(ChannelType.BLEEP);
		renderCommChannelVoToXTN(bleepVo, obr.getOrderCallbackPhoneNumber(0));
	}
		
		
	// OBR-28   Result copies to   
	if (newOrder.getReportToIsNotNull())
	{
		for (int i=0; i<newOrder.getReportTo().size(); i++)
		{
			obr.getResultCopiesTo(i).getFamilyName().getSurname().setValue(newOrder.getReportTo().get(i).getValue());
		}
	}
	
	// OBR-30   Transportation mode
	if (newOrder.getPatMobilityIsNotNull())
	{
		obr.getTransportationMode().setValue(svc.getRemoteLookup(newOrder.getPatMobility().getId(), providerSystem.getCodeSystem().getText()));
	}
	
	LOG.debug("O01VoMapper renderNewOrderToORC_OBR: exit");

}
 
Example 18
Project: AvoinApotti   File: O01VoMapper.java   Source Code and License 4 votes vote down vote up
private void renderInvestigationToORC_OBR(IfOrderInvestigationVo investigation, ORC commonOrder, OBR obr,ProviderSystemVo providerSystem) throws Exception
	{
		LOG.debug("O01VoMapper renderInvestigationToORC_OBR: entry");

		IfInvestigationLiteVo invVo = investigation.getInvestigation();

		// ORC-5   Order status   (ID)   00219
		if (investigation.getOrdInvCurrentStatusIsNotNull() && investigation.getOrdInvCurrentStatus().getOrdInvStatusIsNotNull())
			commonOrder.getOrderStatus().setValue(svc.getRemoteLookup(investigation.getOrdInvCurrentStatus().getOrdInvStatus().getId(), providerSystem.getCodeSystem().getText()));
	
		// ORC-9   Date/time of transaction   (TS)   00223
		//TODO: Not sure if this should override the sysinfo values.
		//The assembler would ignore them anyway.
		//WDEV-8866
		if (investigation.getDisplayDateTimeIsNotNull())
			renderDateTimeVoToTS(investigation.getDisplayDateTime(), commonOrder.getDateTimeOfTransaction());
		else 
			renderDateTimeVoToTS(new DateTime(), commonOrder.getDateTimeOfTransaction());
		
		// ORC-24   Ordering provider address   (XAD)   01314
		//TODO: Will leave out for now. 
//		if (invVo.getProviderServiceIsNotNull() && invVo.getProviderService().getLocationServiceIsNotNull() && invVo.getProviderService().getLocationService().getLocationIsNotNull())
//			renderAddressVoToXAD(invVo.getProviderService().getLocationService().getLocation().getAddress(), commonOrder.getOrderingProviderAddress(0));

		// OBR-4   Universal service identifier   (CE)   00238
		// Test Name
		obr.getUniversalServiceIdentifier().getIdentifier().setValue(invVo.getProviderInvCode());
		obr.getUniversalServiceIdentifier().getText().setValue(invVo.getInvestigationIndex().getName());
		// Coding System
//		if (invVo.getProviderServiceIsNotNull() && invVo.getProviderService().getProviderSystemIsNotNull() && invVo.getProviderService().getProviderSystem().getCodeSystemIsNotNull())
//			obr.getUniversalServiceIdentifier().getNameOfCodingSystem().setValue(invVo.getProviderService().getProviderSystem().getCodeSystem().getText());

		// OBR-5   Priority - OBR
		// ORC-7   Quantity/timing   
		// OBR-27   Quantity/timing   
		if (investigation.getOrderPriorityIsNotNull())
		{
			String extPriority = svc.getRemoteLookup(investigation.getOrderPriority().getId(), providerSystem.getCodeSystem().getText()); 
			commonOrder.getQuantityTiming(0).getPriority().setValue(extPriority);
			obr.getPriority().setValue(extPriority);
			obr.getQuantityTiming(0).getPriority().setValue(extPriority);
		}
		
		// OBR-31   Reason for study
		if (investigation.getReasonForStudyIsNotNull())
			obr.getReasonForStudy(0).getText().setValue(investigation.getReasonForStudy());
		
		// JP 10/11/2006 WDEV-2110
		ServiceShortVo service = ocsIf.getService(investigation.getInvestigation());
		String extMapping = ocsIf.getServiceMapping(service,providerSystem.getCodeSystem());
		obr.getDiagnosticServSectID().setValue(extMapping);
		
		
		// ORC-7   Quantity/timing   
		// OBR-27   Quantity/timing
		// wdev-2559 Moved from renderOrder method, examination required by is now at investigation level
		renderDateVoToTS(investigation.getExamReqOnAfterDate(), obr.getQuantityTiming(0).getStartDateTime());
		renderDateVoToTS(investigation.getExamReqOnAfterDate(), commonOrder.getQuantityTiming(0).getStartDateTime());
		
		LOG.debug("O01VoMapper renderInvestigationToORC_OBR: exit");

	}
 
Example 19
Project: AvoinApotti   File: RefManHL7Helper.java   Source Code and License 4 votes vote down vote up
public ORR_O02 PopulateOrderMessage(ORR_O02 order, IfOrderInvestigationVo invVo,
		IfOutOcsOrderVo newOrder, DomainInterface domObj)
		throws DataTypeException, HL7Exception {
	
	
	PID pid=order.getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_PIDNTE().getPID();
	
	ORC orc = order.getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI().getORC();
	
	// If it is an NA message just send back the numbers
	if(orc.getOrderControl().getValue().equals("NA") )
		return order;
	
	//Get the OBR if there is one already in the order but don't create one 
	// the status change messages should not contain any obrs
	OBR obr = null;
	if(0!= order.getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI().getAll("OBR").length)
		obr = order.getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI().getOBR();

	IFCATSExternalEventVo catsEventVo = null;

	if(domObj  instanceof ExternalEvents)
	{
		ExternalEvents eventObject = (ExternalEvents)domObj;
		
		//If it is a new order then we don't bother with the appointment status
		if(orc.getOrderControl().getValue().equals("NW") ) 
			catsEventVo=eventObject.getCATSIFValues( invVo,false );
		else
			catsEventVo=eventObject.getCATSIFValues( invVo,true );

		if(null== catsEventVo)
			throw new HL7Exception("No appointment details found for schedulable service : "+invVo.toString());


	String referralID=catsEventVo.getReferralID();
	String transportArranged = catsEventVo.getTransportArranged();
	String interperterRequired=catsEventVo.getInterperterRequired();
	String commentsOnTransport=catsEventVo.getCommentsOnTransport();
	String documentType = catsEventVo.getDocumentType();
	String documentPath=catsEventVo.getDocumentPath();
	String documentFormat=catsEventVo.getDocumentFormat();
	DateTime startTimeVo = catsEventVo.getStartDateTime();
	DateTime endTimeVo = catsEventVo.getEndDateTime();
	String appointmentStatusCode = catsEventVo.getAppointmentStatusCode();
	String appointmentStatusComment = catsEventVo.getAppointmentStatusComment();
	
	
	pid.getPatientAccountNumber().getID().setValue(referralID);
	
	
	renderDateTimeVoToTS(startTimeVo, orc.getQuantityTiming(0).getStartDateTime());
	renderDateTimeVoToTS(endTimeVo, orc.getQuantityTiming(0).getEndDateTime());
	
	//ORC-16
	if(null!=appointmentStatusCode)
		orc.getOrderControlCodeReason().getIdentifier().setValue(appointmentStatusCode);
	if(null!=appointmentStatusComment)
		orc.getOrderControlCodeReason().getText().setValue(HL7Utils.toHL7Text(appointmentStatusComment));

	
	if(null!=obr)
	{
		obr.getTransportArranged().setValue(transportArranged);
		obr.getEscortRequired().setValue(interperterRequired);
		obr.getPlannedPatientTransportComment(0).getIdentifier().setValue(commentsOnTransport);
		obr.getPlacerSupplementalServiceInformation(0).getIdentifier().setValue(documentType);
		obr.getPlacerSupplementalServiceInformation(0).getText().setValue(documentPath);
		obr.getPlacerSupplementalServiceInformation(0).getNameOfCodingSystem().setValue(documentFormat);
	}
	
	}		
	return order;
}
 
Example 20
Project: openMAXIMS   File: VoMapper.java   Source Code and License 4 votes vote down vote up
protected final void renderMemberOfStaffShortVoToEnteredBy(MemberOfStaffShortVo mos, ORC commonOrder, ProviderSystemVo providerSystem) throws HL7Exception
{
	LOG.debug("VoMapper renderMemberOfStaffShortVoToEnteredBy: entry");

	int xcnCount = 0;
	
	if (mos != null)
	{
		
		if (mos.getCodeMappings() != null)
		{
			for (int i = 0; i < mos.getCodeMappings().size(); i++)
			{
				ims.core.vo.TaxonomyMap map = mos.getCodeMappings().get(i);

				/* 
				 * First check to see if the code is defined as a  valid Taxonomy Type for provider system
				 * If it isn't, then skip this code mapping 
				 */

				TaxonomyType taxonomyType = map.getTaxonomyName();
				if (taxonomyType != null)
				{
					String taxTypeText = svc.getRemoteLookup(taxonomyType.getID(), providerSystem.getCodeSystem().getText());
					if (taxTypeText != null)
					{
						/* 
						 * This code mapping has a valid taxonomy type defined for the provider system
						 */
						
						//XCN.0 ID Number (ST)
						commonOrder.getEnteredBy(xcnCount).getIDNumber().setValue(map.getTaxonomyCode());
						if (mos.getNameIsNotNull())
						{
							//XCN.1 Family name (ST)
							if (mos.getName().getSurnameIsNotNull())
								commonOrder.getEnteredBy(xcnCount).getFamilyName().getSurname().setValue(mos.getName().getSurname().toString());
							//XCN.2 Given name (ST)
							if (mos.getName().getForenameIsNotNull())
								commonOrder.getEnteredBy(xcnCount).getGivenName().setValue(mos.getName().getForename().toString());
							//XCN.3 Second and further names (ST)
							if (mos.getName().getMiddleNameIsNotNull())
								commonOrder.getEnteredBy(xcnCount).getSecondAndFurtherGivenNamesOrInitialsThereof().setValue(mos.getName().getMiddleName().toString());
							//XCN.5 Prefix (ST)
							if (mos.getName().getTitleIsNotNull())
								commonOrder.getEnteredBy(xcnCount).getPrefixEgDR().setValue(mos.getName().getTitle().toString());
						}
						//XCN.9 Assigning authority (HD)
						commonOrder.getEnteredBy(xcnCount).getAssigningAuthority().getNamespaceID().setValue(map.getTaxonomyName().toString());
						//XCN.10 Name type code (ID)
						commonOrder.getEnteredBy(xcnCount).getNameTypeCode().setValue(taxTypeText);
						
						xcnCount ++;
					}
				}
			}
		}
		
		if (xcnCount == 0)
		{
			if (mos.getNameIsNotNull())
			{
				//XCN.1 Family name (ST)
				if (mos.getName().getSurnameIsNotNull())
					commonOrder.getEnteredBy(xcnCount).getFamilyName().getSurname().setValue(mos.getName().getSurname().toString());
				//XCN.2 Given name (ST)
				if (mos.getName().getForenameIsNotNull())
					commonOrder.getEnteredBy(xcnCount).getGivenName().setValue(mos.getName().getForename().toString());
				//XCN.3 Second and further names (ST)
				if (mos.getName().getMiddleNameIsNotNull())
					commonOrder.getEnteredBy(xcnCount).getSecondAndFurtherGivenNamesOrInitialsThereof().setValue(mos.getName().getMiddleName().toString());
				//XCN.5 Prefix (ST)
				if (mos.getName().getTitleIsNotNull())
					commonOrder.getEnteredBy(xcnCount).getPrefixEgDR().setValue(mos.getName().getTitle().toString());
			}
		}

	}

	LOG.debug("VoMapper renderMemberOfStaffShortVoToEnteredBy: exit");
}
 
Example 21
Project: openMAXIMS   File: VoMapper.java   Source Code and License 4 votes vote down vote up
protected final void renderMemberOfStaffShortVoToOrderingProvider(MemberOfStaffShortVo mos, ORC orc, ProviderSystemVo providerSystem) throws HL7Exception
{
	LOG.debug("VoMapper renderMemberOfStaffShortVoToOrderingProvider: entry");

	int xcnCount = 0;
	
	if (mos != null)
	{
		
		if (mos.getCodeMappings() != null)
		{
			for (int i = 0; i < mos.getCodeMappings().size(); i++)
			{
				ims.core.vo.TaxonomyMap map = mos.getCodeMappings().get(i);

				/* 
				 * First check to see if the code is defined as a  valid Taxonomy Type for provider system
				 * If it isn't, then skip this code mapping 
				 */

				TaxonomyType taxonomyType = map.getTaxonomyName();
				if (taxonomyType != null)
				{
					String taxTypeText = svc.getRemoteLookup(taxonomyType.getID(), providerSystem.getCodeSystem().getText());
					if (taxTypeText != null)
					{
						/* 
						 * This code mapping has a valid taxonomy type defined for the provider system
						 */
						
						//XCN.0 ID Number (ST)
						orc.getOrderingProvider(xcnCount).getIDNumber().setValue(map.getTaxonomyCode());
						if (mos.getNameIsNotNull())
						{
							//XCN.1 Family name (ST)
							if (mos.getName().getSurnameIsNotNull())
								orc.getOrderingProvider(xcnCount).getFamilyName().getSurname().setValue(mos.getName().getSurname().toString());
							//XCN.2 Given name (ST)
							if (mos.getName().getForenameIsNotNull())
								orc.getOrderingProvider(xcnCount).getGivenName().setValue(mos.getName().getForename().toString());
							//XCN.3 Second and further names (ST)
							if (mos.getName().getMiddleNameIsNotNull())
								orc.getOrderingProvider(xcnCount).getSecondAndFurtherGivenNamesOrInitialsThereof().setValue(mos.getName().getMiddleName().toString());
							//XCN.5 Prefix (ST)
							if (mos.getName().getTitleIsNotNull())
								orc.getOrderingProvider(xcnCount).getPrefixEgDR().setValue(mos.getName().getTitle().toString());
						}
						//XCN.9 Assigning authority (HD)
						orc.getOrderingProvider(xcnCount).getAssigningAuthority().getNamespaceID().setValue(map.getTaxonomyName().toString());
						//XCN.10 Name type code (ID)
						orc.getOrderingProvider(xcnCount).getNameTypeCode().setValue(taxTypeText);
						
						xcnCount ++;
					}
				}
			}
		}
		
		if (xcnCount == 0)
		{
			if (mos.getNameIsNotNull())
			{
				//XCN.1 Family name (ST)
				if (mos.getName().getSurnameIsNotNull())
					orc.getOrderingProvider(xcnCount).getFamilyName().getSurname().setValue(mos.getName().getSurname().toString());
				//XCN.2 Given name (ST)
				if (mos.getName().getForenameIsNotNull())
					orc.getOrderingProvider(xcnCount).getGivenName().setValue(mos.getName().getForename().toString());
				//XCN.3 Second and further names (ST)
				if (mos.getName().getMiddleNameIsNotNull())
					orc.getOrderingProvider(xcnCount).getSecondAndFurtherGivenNamesOrInitialsThereof().setValue(mos.getName().getMiddleName().toString());
				//XCN.5 Prefix (ST)
				if (mos.getName().getTitleIsNotNull())
					orc.getOrderingProvider(xcnCount).getPrefixEgDR().setValue(mos.getName().getTitle().toString());
			}
		}

	}

	LOG.debug("VoMapper renderMemberOfStaffShortVoToOrderingProvider: exit");
}
 
Example 22
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private void populateWithOrderingProvider(IfOcsOrderVo order, ORC orc, OBR obr, ProviderSystemVo providerSystem) throws HL7Exception
{
	
	XCN orderingProvider=null;
	if (orc.getOrderingProvider(0) != null && orc.getOrderingProvider(0).getIDNumber().getValue() != null)
	{		
		orderingProvider = orc.getOrderingProvider(0);
	}
	if (orderingProvider == null)
	{
		//Need to also check OBR-16   Ordering provider  (XCN)
		if (obr.getOrderingProvider(0) != null && obr.getOrderingProvider(0).getIDNumber().getValue() != null)
		{
			orderingProvider = obr.getOrderingProvider(0);
		}
	}
	
	if (orderingProvider != null)
	{
		HcpLiteVo hcp = populateHcpVoFromXCN(orderingProvider, providerSystem.getCodeSystem());
		if (hcp != null)
		{
			order.setResponsibleClinician(hcp);
			if (!order.getOrderedByIsNotNull())  // wdev-4443
				order.setOrderedBy(hcp.getMos());
		}
		else
		{
			GpShortVo gp = populateGPVoFromXCN(orderingProvider, providerSystem.getCodeSystem());
			if (gp == null)
			{
				// We need to log the fact that the GP is not on our system
				LOG.warn("GP with code " + orderingProvider.getIDNumber() + " was not found on the IMS database");												
			}
			else
			{
				order.setResponsibleGp(gp);
			}
		}
		//WDEV-8884 
		if(ConfigFlag.HL7.REJECT_RESULTS_FOR_UNKNOWN_ORDERINGPROVIDER_OR_LOCATION.getValue())
		{
			// wdev-2746 If Neither Clinician nor GP are populated, reject the message as
			// one or the other are mandatory
			if (orderingProvider.getIDNumber().getValue() != null &&
					!order.getResponsibleClinicianIsNotNull() && !order.getResponsibleGpIsNotNull())
			{
				throw new HL7Exception("Ordering Provider (ORC-12, OBR-16) does not map to a valid Clinician or GP - Message Rejected");
			}
		}
	}

}
 
Example 23
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private String getPlacerNumFromMessage(Message msg,int invCount,int PIDcounter) throws HL7Exception
{
	String placerOrdNum=null;
	for (int j = 0; j < invCount; j++)
	{
		ORU_R01_ORCOBRNTECTDOBXNTEFT1CTI orc_group = null;				
		ORC orc = null;
		ORC lastOrc = null;
		OBR obr =  null;
		if (msg instanceof ORM_O01)
		{
			orc = ((ORM_O01)msg).getORM_O01_ORCOBRRQDRQ1RXOODSODTNTECTDDG1OBXNTEFT1CTIBLG(j).getORC();
			obr = ((ORM_O01)msg).getORM_O01_ORCOBRRQDRQ1RXOODSODTNTECTDDG1OBXNTEFT1CTIBLG(j).getORM_O01_OBRRQDRQ1RXOODSODTNTECTDDG1OBXNTE().getOBR();
		}
		else if (msg instanceof OMG_O19)
		{
			orc = ((OMG_O19)msg).getOMG_O19_ORCOBRNTECTDDG1OBXNTEPIDPD1PV1PV2AL1ORCOBRNTECTDOBXNTEFT1CTIBLG(j).getORC();
			obr = ((OMG_O19)msg).getOMG_O19_ORCOBRNTECTDDG1OBXNTEPIDPD1PV1PV2AL1ORCOBRNTECTDOBXNTEFT1CTIBLG(j).getOBR();
		}
		else if (msg instanceof ORU_R01)
		{
			orc_group = ((ORU_R01)msg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI(PIDcounter).getORU_R01_ORCOBRNTECTDOBXNTEFT1CTI(j);
			orc = orc_group.getORC();
			if (orc == null)
				orc = lastOrc;
			else
				lastOrc = orc;
					
			obr = orc_group.getOBR();
		}
		else if (msg instanceof ORR_O02)
		{
			orc = ((ORR_O02)msg).getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI(j).getORC();
			obr = ((ORR_O02)msg).getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI(j).getOBR();
		}
		else if (msg instanceof ORG_O20)
		{
			orc = ((ORG_O20)msg).getORG_O20_PIDNTEORCOBRNTECTI().getORG_O20_ORCOBRNTECTI().getORC();
			obr = ((ORG_O20)msg).getORG_O20_PIDNTEORCOBRNTECTI().getORG_O20_ORCOBRNTECTI().getOBR();
		}
		else
		{
			throw new HL7Exception("Invalid message type passed to R01.processResult");
		}
		
		placerOrdNum=null;
		if ( orc.getPlacerOrderNumber() != null && orc.getPlacerOrderNumber().getEntityIdentifier() != null)
		{
			placerOrdNum = orc.getPlacerOrderNumber().getEntityIdentifier().getValue();
		}
		//JME: 20060627: Need to also check in OBR, in case sender is not filling ORC
		if (placerOrdNum == null && obr.getPlacerOrderNumber() != null && obr.getPlacerOrderNumber().getEntityIdentifier() != null)
		{
			placerOrdNum = obr.getPlacerOrderNumber().getEntityIdentifier().getValue();
		}
		if (placerOrdNum != null && placerOrdNum.equals("#R"))
			placerOrdNum=null;
		
		if(placerOrdNum!=null)
			return placerOrdNum;
		
	}
	return placerOrdNum;
}
 
Example 24
Project: openMAXIMS   File: O01VoMapper.java   Source Code and License 4 votes vote down vote up
private void renderInvestigationToORC_OBR(IfOrderInvestigationVo investigation, ORC commonOrder, OBR obr,ProviderSystemVo providerSystem) throws Exception
	{
		LOG.debug("O01VoMapper renderInvestigationToORC_OBR: entry");

		IfInvestigationLiteVo invVo = investigation.getInvestigation();

		// ORC-5   Order status   (ID)   00219
		if (investigation.getOrdInvCurrentStatusIsNotNull() && investigation.getOrdInvCurrentStatus().getOrdInvStatusIsNotNull())
			commonOrder.getOrderStatus().setValue(svc.getRemoteLookup(investigation.getOrdInvCurrentStatus().getOrdInvStatus().getId(), providerSystem.getCodeSystem().getText()));
	
		// ORC-9   Date/time of transaction   (TS)   00223
		//TODO: Not sure if this should override the sysinfo values.
		//The assembler would ignore them anyway.
		//WDEV-8866
		if (investigation.getDisplayDateTimeIsNotNull())
			renderDateTimeVoToTS(investigation.getDisplayDateTime(), commonOrder.getDateTimeOfTransaction());
		else 
			renderDateTimeVoToTS(new DateTime(), commonOrder.getDateTimeOfTransaction());
		
		// ORC-24   Ordering provider address   (XAD)   01314
		//TODO: Will leave out for now. 
//		if (invVo.getProviderServiceIsNotNull() && invVo.getProviderService().getLocationServiceIsNotNull() && invVo.getProviderService().getLocationService().getLocationIsNotNull())
//			renderAddressVoToXAD(invVo.getProviderService().getLocationService().getLocation().getAddress(), commonOrder.getOrderingProviderAddress(0));

		// OBR-4   Universal service identifier   (CE)   00238
		// Test Name
		obr.getUniversalServiceIdentifier().getIdentifier().setValue(invVo.getProviderInvCode());
		obr.getUniversalServiceIdentifier().getText().setValue(invVo.getInvestigationIndex().getName());
		// Coding System
//		if (invVo.getProviderServiceIsNotNull() && invVo.getProviderService().getProviderSystemIsNotNull() && invVo.getProviderService().getProviderSystem().getCodeSystemIsNotNull())
//			obr.getUniversalServiceIdentifier().getNameOfCodingSystem().setValue(invVo.getProviderService().getProviderSystem().getCodeSystem().getText());

		// OBR-5   Priority - OBR
		// ORC-7   Quantity/timing   
		// OBR-27   Quantity/timing   
		if (investigation.getOrderPriorityIsNotNull())
		{
			String extPriority = svc.getRemoteLookup(investigation.getOrderPriority().getId(), providerSystem.getCodeSystem().getText()); 
			commonOrder.getQuantityTiming(0).getPriority().setValue(extPriority);
			obr.getPriority().setValue(extPriority);
			obr.getQuantityTiming(0).getPriority().setValue(extPriority);
		}
		
		// OBR-31   Reason for study
		if (investigation.getReasonForStudyIsNotNull())
			obr.getReasonForStudy(0).getText().setValue(investigation.getReasonForStudy());
		
		// JP 10/11/2006 WDEV-2110
		ServiceShortVo service = ocsIf.getService(investigation.getInvestigation());
		String extMapping = ocsIf.getServiceMapping(service,providerSystem.getCodeSystem());
		obr.getDiagnosticServSectID().setValue(extMapping);
		
		
		// ORC-7   Quantity/timing   
		// OBR-27   Quantity/timing
		// wdev-2559 Moved from renderOrder method, examination required by is now at investigation level
		renderDateVoToTS(investigation.getExamReqOnAfterDate(), obr.getQuantityTiming(0).getStartDateTime());
		renderDateVoToTS(investigation.getExamReqOnAfterDate(), commonOrder.getQuantityTiming(0).getStartDateTime());
		
		LOG.debug("O01VoMapper renderInvestigationToORC_OBR: exit");

	}
 
Example 25
Project: openMAXIMS   File: RefManHL7Helper.java   Source Code and License 4 votes vote down vote up
public ORR_O02 PopulateOrderMessage(ORR_O02 order, IfOrderInvestigationVo invVo,
		IfOutOcsOrderVo newOrder, DomainInterface domObj)
		throws DataTypeException, HL7Exception {
	
	
	PID pid=order.getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_PIDNTE().getPID();
	
	ORC orc = order.getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI().getORC();
	
	// If it is an NA message just send back the numbers
	if(orc.getOrderControl().getValue().equals("NA") )
		return order;
	
	//Get the OBR if there is one already in the order but don't create one 
	// the status change messages should not contain any obrs
	OBR obr = null;
	if(0!= order.getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI().getAll("OBR").length)
		obr = order.getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI().getOBR();

	IFCATSExternalEventVo catsEventVo = null;

	if(domObj  instanceof ExternalEvents)
	{
		ExternalEvents eventObject = (ExternalEvents)domObj;
		
		//If it is a new order then we don't bother with the appointment status
		if(orc.getOrderControl().getValue().equals("NW") ) 
			catsEventVo=eventObject.getCATSIFValues( invVo,false );
		else
			catsEventVo=eventObject.getCATSIFValues( invVo,true );

		if(null== catsEventVo)
			throw new HL7Exception("No appointment details found for schedulable service : "+invVo.toString());


	String referralID=catsEventVo.getReferralID();
	String transportArranged = catsEventVo.getTransportArranged();
	String interperterRequired=catsEventVo.getInterperterRequired();
	String commentsOnTransport=catsEventVo.getCommentsOnTransport();
	String documentType = catsEventVo.getDocumentType();
	String documentPath=catsEventVo.getDocumentPath();
	String documentFormat=catsEventVo.getDocumentFormat();
	DateTime startTimeVo = catsEventVo.getStartDateTime();
	DateTime endTimeVo = catsEventVo.getEndDateTime();
	String appointmentStatusCode = catsEventVo.getAppointmentStatusCode();
	String appointmentStatusComment = catsEventVo.getAppointmentStatusComment();
	
	
	pid.getPatientAccountNumber().getID().setValue(referralID);
	
	
	renderDateTimeVoToTS(startTimeVo, orc.getQuantityTiming(0).getStartDateTime());
	renderDateTimeVoToTS(endTimeVo, orc.getQuantityTiming(0).getEndDateTime());
	
	//ORC-16
	if(null!=appointmentStatusCode)
		orc.getOrderControlCodeReason().getIdentifier().setValue(appointmentStatusCode);
	if(null!=appointmentStatusComment)
		orc.getOrderControlCodeReason().getText().setValue(HL7Utils.toHL7Text(appointmentStatusComment));

	
	if(null!=obr)
	{
		obr.getTransportArranged().setValue(transportArranged);
		obr.getEscortRequired().setValue(interperterRequired);
		obr.getPlannedPatientTransportComment(0).getIdentifier().setValue(commentsOnTransport);
		obr.getPlacerSupplementalServiceInformation(0).getIdentifier().setValue(documentType);
		obr.getPlacerSupplementalServiceInformation(0).getText().setValue(documentPath);
		obr.getPlacerSupplementalServiceInformation(0).getNameOfCodingSystem().setValue(documentFormat);
	}
	
	}		
	return order;
}
 
Example 26
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private void populateWithOrderingProvider(IfOcsOrderVo order, ORC orc, OBR obr, ProviderSystemVo providerSystem) throws HL7Exception
{
	
	XCN orderingProvider=null;
	if (orc.getOrderingProvider(0) != null && orc.getOrderingProvider(0).getIDNumber().getValue() != null)
	{		
		orderingProvider = orc.getOrderingProvider(0);
	}
	if (orderingProvider == null)
	{
		//Need to also check OBR-16   Ordering provider  (XCN)
		if (obr.getOrderingProvider(0) != null && obr.getOrderingProvider(0).getIDNumber().getValue() != null)
		{
			orderingProvider = obr.getOrderingProvider(0);
		}
	}
	
	if (orderingProvider != null)
	{
		HcpLiteVo hcp = populateHcpVoFromXCN(orderingProvider, providerSystem.getCodeSystem());
		if (hcp != null)
		{
			order.setResponsibleClinician(hcp);
			if (!order.getOrderedByIsNotNull())  // wdev-4443
				order.setOrderedBy(hcp.getMos());
		}
		else
		{
			GpShortVo gp = populateGPVoFromXCN(orderingProvider, providerSystem.getCodeSystem());
			if (gp == null)
			{
				// We need to log the fact that the GP is not on our system
				LOG.warn("GP with code " + orderingProvider.getIDNumber() + " was not found on the IMS database");												
			}
			else
			{
				order.setResponsibleGp(gp);
			}
		}
		//WDEV-8884 
		if(ConfigFlag.HL7.REJECT_RESULTS_FOR_UNKNOWN_ORDERINGPROVIDER_OR_LOCATION.getValue())
		{
			// wdev-2746 If Neither Clinician nor GP are populated, reject the message as
			// one or the other are mandatory
			if (orderingProvider.getIDNumber().getValue() != null &&
					!order.getResponsibleClinicianIsNotNull() && !order.getResponsibleGpIsNotNull())
			{
				throw new HL7Exception("Ordering Provider (ORC-12, OBR-16) does not map to a valid Clinician or GP - Message Rejected");
			}
		}
	}

}
 
Example 27
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private String getPlacerNumFromMessage(Message msg,int invCount,int PIDcounter) throws HL7Exception
{
	String placerOrdNum=null;
	for (int j = 0; j < invCount; j++)
	{
		ORU_R01_ORCOBRNTECTDOBXNTEFT1CTI orc_group = null;				
		ORC orc = null;
		ORC lastOrc = null;
		OBR obr =  null;
		if (msg instanceof ORM_O01)
		{
			orc = ((ORM_O01)msg).getORM_O01_ORCOBRRQDRQ1RXOODSODTNTECTDDG1OBXNTEFT1CTIBLG(j).getORC();
			obr = ((ORM_O01)msg).getORM_O01_ORCOBRRQDRQ1RXOODSODTNTECTDDG1OBXNTEFT1CTIBLG(j).getORM_O01_OBRRQDRQ1RXOODSODTNTECTDDG1OBXNTE().getOBR();
		}
		else if (msg instanceof OMG_O19)
		{
			orc = ((OMG_O19)msg).getOMG_O19_ORCOBRNTECTDDG1OBXNTEPIDPD1PV1PV2AL1ORCOBRNTECTDOBXNTEFT1CTIBLG(j).getORC();
			obr = ((OMG_O19)msg).getOMG_O19_ORCOBRNTECTDDG1OBXNTEPIDPD1PV1PV2AL1ORCOBRNTECTDOBXNTEFT1CTIBLG(j).getOBR();
		}
		else if (msg instanceof ORU_R01)
		{
			orc_group = ((ORU_R01)msg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI(PIDcounter).getORU_R01_ORCOBRNTECTDOBXNTEFT1CTI(j);
			orc = orc_group.getORC();
			if (orc == null)
				orc = lastOrc;
			else
				lastOrc = orc;
					
			obr = orc_group.getOBR();
		}
		else if (msg instanceof ORR_O02)
		{
			orc = ((ORR_O02)msg).getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI(j).getORC();
			obr = ((ORR_O02)msg).getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI(j).getOBR();
		}
		else if (msg instanceof ORG_O20)
		{
			orc = ((ORG_O20)msg).getORG_O20_PIDNTEORCOBRNTECTI().getORG_O20_ORCOBRNTECTI().getORC();
			obr = ((ORG_O20)msg).getORG_O20_PIDNTEORCOBRNTECTI().getORG_O20_ORCOBRNTECTI().getOBR();
		}
		else
		{
			throw new HL7Exception("Invalid message type passed to R01.processResult");
		}
		
		placerOrdNum=null;
		if ( orc.getPlacerOrderNumber() != null && orc.getPlacerOrderNumber().getEntityIdentifier() != null)
		{
			placerOrdNum = orc.getPlacerOrderNumber().getEntityIdentifier().getValue();
		}
		//JME: 20060627: Need to also check in OBR, in case sender is not filling ORC
		if (placerOrdNum == null && obr.getPlacerOrderNumber() != null && obr.getPlacerOrderNumber().getEntityIdentifier() != null)
		{
			placerOrdNum = obr.getPlacerOrderNumber().getEntityIdentifier().getValue();
		}
		if (placerOrdNum != null && placerOrdNum.equals("#R"))
			placerOrdNum=null;
		
		if(placerOrdNum!=null)
			return placerOrdNum;
		
	}
	return placerOrdNum;
}
 
Example 28
Project: openMAXIMS   File: O01VoMapper.java   Source Code and License 4 votes vote down vote up
private void renderNewOrderToORC_OBR(ProviderSystemVo providerSystem,IfOutOcsOrderVo newOrder, ORC commonOrder, OBR obr) throws Exception
{
	LOG.debug("O01VoMapper renderNewOrderToORC_OBR: entry");

	// ORC-4   Placer group number   (EI)   00218
	commonOrder.getPlacerGroupNumber().getEntityIdentifier().setValue("" + newOrder.getID_OcsOrderSession());
	
	if (newOrder.getOrderedByIsNotNull())
	{
		// ORC-10   Entered by   (XCN)   00224
		renderMemberOfStaffShortVoToXCN(newOrder.getOrderedBy(), commonOrder.getEnteredBy(0),providerSystem);

		// ORC-13   Enterer�s location   (PL)   00227 
		if (newOrder.getOrderedBy().getPrimaryLocationIsNotNull())
		{
			commonOrder.getEntererSLocation().getLocationDescription().setValue(newOrder.getOrderedBy().getPrimaryLocation().getName());
		}
		
		if (newOrder.getOrderedBy().getCommChannelsIsNotNull())
		{
			// ORC-14   Call back phone number   (XTN)   00228
			renderCommChannelVoCollectionToXTN(newOrder.getOrderedBy().getCommChannels(), commonOrder.getCallBackPhoneNumber(0));
		}
	}
	
	// OBR-16   Ordering provider  (XCN)   
	// ORC-12   Ordering provider   (XCN)   00226
	
	
	//http://jira/browse/WDEV-6910
	ConfigPropertyVo prop= providerSystem.getConfigurationProperty(ConfigItems.UseGpAsOrderingProvider);
	if (prop != null && (prop.getPropertyValueIsNotNull())&&(prop.getPropertyValue().length() > 0)
			&&prop.getPropertyValue().trim().equalsIgnoreCase("TRUE"))
	{
		if(newOrder.getResponsibleGpIsNotNull())
		{
			renderGpShortVoToXCN(newOrder.getResponsibleGp(), commonOrder.getOrderingProvider(0),providerSystem);
			renderGpShortVoToXCN(newOrder.getResponsibleGp(), obr.getOrderingProvider(0),providerSystem);
		}
	}
	
	else if (newOrder.getResponsibleClinicianIsNotNull())
	{
		renderMemberOfStaffShortVoToXCN(newOrder.getResponsibleClinician().getMos(), commonOrder.getOrderingProvider(0),providerSystem);
		renderMemberOfStaffShortVoToXCN(newOrder.getResponsibleClinician().getMos(), obr.getOrderingProvider(0),providerSystem);
		// OBR-17   Order callback phone number 
		
		if (!ConfigFlag.GEN.SITE_USES_ORDER_BLEEP_EXT_NUMBER.getValue()
				&& newOrder.getResponsibleClinician().getMosIsNotNull())
			renderCommChannelVoToXTN(newOrder.getResponsibleClinician().getMos().getCommChannel(ChannelType.BLEEP), obr.getOrderCallbackPhoneNumber(0));
	}

	if(ConfigFlag.GEN.SITE_USES_ORDER_BLEEP_EXT_NUMBER.getValue()&&newOrder.getBleepExtNumberIsNotNull())
	{
		CommChannelVo bleepVo = new CommChannelVo();
		bleepVo.setCommValue(newOrder.getBleepExtNumber());
		bleepVo.setChannelType(ChannelType.BLEEP);
		renderCommChannelVoToXTN(bleepVo, obr.getOrderCallbackPhoneNumber(0));
	}
		
		
	// OBR-28   Result copies to   
	if (newOrder.getReportToIsNotNull())
	{
		for (int i=0; i<newOrder.getReportTo().size(); i++)
		{
			obr.getResultCopiesTo(i).getFamilyName().getSurname().setValue(newOrder.getReportTo().get(i).getValue());
		}
	}
	
	// OBR-30   Transportation mode
	if (newOrder.getPatMobilityIsNotNull())
	{
		obr.getTransportationMode().setValue(svc.getRemoteLookup(newOrder.getPatMobility().getId(), providerSystem.getCodeSystem().getText()));
	}
	
	LOG.debug("O01VoMapper renderNewOrderToORC_OBR: exit");

}
 
Example 29
Project: openMAXIMS   File: O01VoMapper.java   Source Code and License 4 votes vote down vote up
private void renderInvestigationToORC_OBR(IfOrderInvestigationVo investigation, ORC commonOrder, OBR obr,ProviderSystemVo providerSystem) throws Exception
	{
		LOG.debug("O01VoMapper renderInvestigationToORC_OBR: entry");

		IfInvestigationLiteVo invVo = investigation.getInvestigation();

		// ORC-5   Order status   (ID)   00219
		if (investigation.getOrdInvCurrentStatusIsNotNull() && investigation.getOrdInvCurrentStatus().getOrdInvStatusIsNotNull())
			commonOrder.getOrderStatus().setValue(svc.getRemoteLookup(investigation.getOrdInvCurrentStatus().getOrdInvStatus().getId(), providerSystem.getCodeSystem().getText()));
	
		// ORC-9   Date/time of transaction   (TS)   00223
		//TODO: Not sure if this should override the sysinfo values.
		//The assembler would ignore them anyway.
		//WDEV-8866
		if (investigation.getDisplayDateTimeIsNotNull())
			renderDateTimeVoToTS(investigation.getDisplayDateTime(), commonOrder.getDateTimeOfTransaction());
		else 
			renderDateTimeVoToTS(new DateTime(), commonOrder.getDateTimeOfTransaction());
		
		// ORC-24   Ordering provider address   (XAD)   01314
		//TODO: Will leave out for now. 
//		if (invVo.getProviderServiceIsNotNull() && invVo.getProviderService().getLocationServiceIsNotNull() && invVo.getProviderService().getLocationService().getLocationIsNotNull())
//			renderAddressVoToXAD(invVo.getProviderService().getLocationService().getLocation().getAddress(), commonOrder.getOrderingProviderAddress(0));

		// OBR-4   Universal service identifier   (CE)   00238
		// Test Name
		obr.getUniversalServiceIdentifier().getIdentifier().setValue(invVo.getProviderInvCode());
		obr.getUniversalServiceIdentifier().getText().setValue(invVo.getInvestigationIndex().getName());
		// Coding System
//		if (invVo.getProviderServiceIsNotNull() && invVo.getProviderService().getProviderSystemIsNotNull() && invVo.getProviderService().getProviderSystem().getCodeSystemIsNotNull())
//			obr.getUniversalServiceIdentifier().getNameOfCodingSystem().setValue(invVo.getProviderService().getProviderSystem().getCodeSystem().getText());

		// OBR-5   Priority - OBR
		// ORC-7   Quantity/timing   
		// OBR-27   Quantity/timing   
		if (investigation.getOrderPriorityIsNotNull())
		{
			String extPriority = svc.getRemoteLookup(investigation.getOrderPriority().getId(), providerSystem.getCodeSystem().getText()); 
			commonOrder.getQuantityTiming(0).getPriority().setValue(extPriority);
			obr.getPriority().setValue(extPriority);
			obr.getQuantityTiming(0).getPriority().setValue(extPriority);
		}
		
		// OBR-31   Reason for study
		if (investigation.getReasonForStudyIsNotNull())
			obr.getReasonForStudy(0).getText().setValue(investigation.getReasonForStudy());
		
		// JP 10/11/2006 WDEV-2110
		ServiceShortVo service = ocsIf.getService(investigation.getInvestigation());
		String extMapping = ocsIf.getServiceMapping(service,providerSystem.getCodeSystem());
		obr.getDiagnosticServSectID().setValue(extMapping);
		
		
		// ORC-7   Quantity/timing   
		// OBR-27   Quantity/timing
		// wdev-2559 Moved from renderOrder method, examination required by is now at investigation level
		renderDateVoToTS(investigation.getExamReqOnAfterDate(), obr.getQuantityTiming(0).getStartDateTime());
		renderDateVoToTS(investigation.getExamReqOnAfterDate(), commonOrder.getQuantityTiming(0).getStartDateTime());
		
		LOG.debug("O01VoMapper renderInvestigationToORC_OBR: exit");

	}
 
Example 30
Project: openMAXIMS   File: RefManHL7Helper.java   Source Code and License 4 votes vote down vote up
public ORR_O02 PopulateOrderMessage(ORR_O02 order, IfOrderInvestigationVo invVo,
		IfOutOcsOrderVo newOrder, DomainInterface domObj)
		throws DataTypeException, HL7Exception {
	
	
	PID pid=order.getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_PIDNTE().getPID();
	
	ORC orc = order.getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI().getORC();
	
	// If it is an NA message just send back the numbers
	if(orc.getOrderControl().getValue().equals("NA") )
		return order;
	
	//Get the OBR if there is one already in the order but don't create one 
	// the status change messages should not contain any obrs
	OBR obr = null;
	if(0!= order.getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI().getAll("OBR").length)
		obr = order.getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI().getOBR();

	IFCATSExternalEventVo catsEventVo = null;

	if(domObj  instanceof ExternalEvents)
	{
		ExternalEvents eventObject = (ExternalEvents)domObj;
		
		//If it is a new order then we don't bother with the appointment status
		if(orc.getOrderControl().getValue().equals("NW") ) 
			catsEventVo=eventObject.getCATSIFValues( invVo,false );
		else
			catsEventVo=eventObject.getCATSIFValues( invVo,true );

		if(null== catsEventVo)
			throw new HL7Exception("No appointment details found for schedulable service : "+invVo.toString());


	String referralID=catsEventVo.getReferralID();
	String transportArranged = catsEventVo.getTransportArranged();
	String interperterRequired=catsEventVo.getInterperterRequired();
	String commentsOnTransport=catsEventVo.getCommentsOnTransport();
	String documentType = catsEventVo.getDocumentType();
	String documentPath=catsEventVo.getDocumentPath();
	String documentFormat=catsEventVo.getDocumentFormat();
	DateTime startTimeVo = catsEventVo.getStartDateTime();
	DateTime endTimeVo = catsEventVo.getEndDateTime();
	String appointmentStatusCode = catsEventVo.getAppointmentStatusCode();
	String appointmentStatusComment = catsEventVo.getAppointmentStatusComment();
	
	
	pid.getPatientAccountNumber().getID().setValue(referralID);
	
	
	renderDateTimeVoToTS(startTimeVo, orc.getQuantityTiming(0).getStartDateTime());
	renderDateTimeVoToTS(endTimeVo, orc.getQuantityTiming(0).getEndDateTime());
	
	//ORC-16
	if(null!=appointmentStatusCode)
		orc.getOrderControlCodeReason().getIdentifier().setValue(appointmentStatusCode);
	if(null!=appointmentStatusComment)
		orc.getOrderControlCodeReason().getText().setValue(HL7Utils.toHL7Text(appointmentStatusComment));

	
	if(null!=obr)
	{
		obr.getTransportArranged().setValue(transportArranged);
		obr.getEscortRequired().setValue(interperterRequired);
		obr.getPlannedPatientTransportComment(0).getIdentifier().setValue(commentsOnTransport);
		obr.getPlacerSupplementalServiceInformation(0).getIdentifier().setValue(documentType);
		obr.getPlacerSupplementalServiceInformation(0).getText().setValue(documentPath);
		obr.getPlacerSupplementalServiceInformation(0).getNameOfCodingSystem().setValue(documentFormat);
	}
	
	}		
	return order;
}
 
Example 31
Project: openmaxims-linux   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private void populateWithOrderingProvider(IfOcsOrderVo order, ORC orc, OBR obr, ProviderSystemVo providerSystem) throws HL7Exception
{
	
	XCN orderingProvider=null;
	if (orc.getOrderingProvider(0) != null && orc.getOrderingProvider(0).getIDNumber().getValue() != null)
	{		
		orderingProvider = orc.getOrderingProvider(0);
	}
	if (orderingProvider == null)
	{
		//Need to also check OBR-16   Ordering provider  (XCN)
		if (obr.getOrderingProvider(0) != null && obr.getOrderingProvider(0).getIDNumber().getValue() != null)
		{
			orderingProvider = obr.getOrderingProvider(0);
		}
	}
	
	if (orderingProvider != null)
	{
		HcpLiteVo hcp = populateHcpVoFromXCN(orderingProvider, providerSystem.getCodeSystem());
		if (hcp != null)
		{
			order.setResponsibleClinician(hcp);
			if (!order.getOrderedByIsNotNull())  // wdev-4443
				order.setOrderedBy(hcp.getMos());
		}
		else
		{
			GpShortVo gp = populateGPVoFromXCN(orderingProvider, providerSystem.getCodeSystem());
			if (gp == null)
			{
				// We need to log the fact that the GP is not on our system
				LOG.warn("GP with code " + orderingProvider.getIDNumber() + " was not found on the IMS database");												
			}
			else
			{
				order.setResponsibleGp(gp);
			}
		}
		//WDEV-8884 
		if(ConfigFlag.HL7.REJECT_RESULTS_FOR_UNKNOWN_ORDERINGPROVIDER_OR_LOCATION.getValue())
		{
			// wdev-2746 If Neither Clinician nor GP are populated, reject the message as
			// one or the other are mandatory
			if (orderingProvider.getIDNumber().getValue() != null &&
					!order.getResponsibleClinicianIsNotNull() && !order.getResponsibleGpIsNotNull())
			{
				throw new HL7Exception("Ordering Provider (ORC-12, OBR-16) does not map to a valid Clinician or GP - Message Rejected");
			}
		}
	}

}
 
Example 32
Project: openmaxims-linux   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private String getPlacerNumFromMessage(Message msg,int invCount,int PIDcounter) throws HL7Exception
{
	String placerOrdNum=null;
	for (int j = 0; j < invCount; j++)
	{
		ORU_R01_ORCOBRNTECTDOBXNTEFT1CTI orc_group = null;				
		ORC orc = null;
		ORC lastOrc = null;
		OBR obr =  null;
		if (msg instanceof ORM_O01)
		{
			orc = ((ORM_O01)msg).getORM_O01_ORCOBRRQDRQ1RXOODSODTNTECTDDG1OBXNTEFT1CTIBLG(j).getORC();
			obr = ((ORM_O01)msg).getORM_O01_ORCOBRRQDRQ1RXOODSODTNTECTDDG1OBXNTEFT1CTIBLG(j).getORM_O01_OBRRQDRQ1RXOODSODTNTECTDDG1OBXNTE().getOBR();
		}
		else if (msg instanceof OMG_O19)
		{
			orc = ((OMG_O19)msg).getOMG_O19_ORCOBRNTECTDDG1OBXNTEPIDPD1PV1PV2AL1ORCOBRNTECTDOBXNTEFT1CTIBLG(j).getORC();
			obr = ((OMG_O19)msg).getOMG_O19_ORCOBRNTECTDDG1OBXNTEPIDPD1PV1PV2AL1ORCOBRNTECTDOBXNTEFT1CTIBLG(j).getOBR();
		}
		else if (msg instanceof ORU_R01)
		{
			orc_group = ((ORU_R01)msg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI(PIDcounter).getORU_R01_ORCOBRNTECTDOBXNTEFT1CTI(j);
			orc = orc_group.getORC();
			if (orc == null)
				orc = lastOrc;
			else
				lastOrc = orc;
					
			obr = orc_group.getOBR();
		}
		else if (msg instanceof ORR_O02)
		{
			orc = ((ORR_O02)msg).getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI(j).getORC();
			obr = ((ORR_O02)msg).getORR_O02_PIDNTEORCOBRRQDRQ1RXOODSODTNTECTI().getORR_O02_ORCOBRRQDRQ1RXOODSODTNTECTI(j).getOBR();
		}
		else if (msg instanceof ORG_O20)
		{
			orc = ((ORG_O20)msg).getORG_O20_PIDNTEORCOBRNTECTI().getORG_O20_ORCOBRNTECTI().getORC();
			obr = ((ORG_O20)msg).getORG_O20_PIDNTEORCOBRNTECTI().getORG_O20_ORCOBRNTECTI().getOBR();
		}
		else
		{
			throw new HL7Exception("Invalid message type passed to R01.processResult");
		}
		
		placerOrdNum=null;
		if ( orc.getPlacerOrderNumber() != null && orc.getPlacerOrderNumber().getEntityIdentifier() != null)
		{
			placerOrdNum = orc.getPlacerOrderNumber().getEntityIdentifier().getValue();
		}
		//JME: 20060627: Need to also check in OBR, in case sender is not filling ORC
		if (placerOrdNum == null && obr.getPlacerOrderNumber() != null && obr.getPlacerOrderNumber().getEntityIdentifier() != null)
		{
			placerOrdNum = obr.getPlacerOrderNumber().getEntityIdentifier().getValue();
		}
		if (placerOrdNum != null && placerOrdNum.equals("#R"))
			placerOrdNum=null;
		
		if(placerOrdNum!=null)
			return placerOrdNum;
		
	}
	return placerOrdNum;
}
 
Example 33
Project: openmaxims-linux   File: O01VoMapper.java   Source Code and License 4 votes vote down vote up
private void renderNewOrderToORC_OBR(ProviderSystemVo providerSystem,IfOutOcsOrderVo newOrder, ORC commonOrder, OBR obr) throws Exception
{
	LOG.debug("O01VoMapper renderNewOrderToORC_OBR: entry");

	// ORC-4   Placer group number   (EI)   00218
	commonOrder.getPlacerGroupNumber().getEntityIdentifier().setValue("" + newOrder.getID_OcsOrderSession());
	
	if (newOrder.getOrderedByIsNotNull())
	{
		// ORC-10   Entered by   (XCN)   00224
		renderMemberOfStaffShortVoToXCN(newOrder.getOrderedBy(), commonOrder.getEnteredBy(0),providerSystem);

		// ORC-13   Enterer’s location   (PL)   00227 
		if (newOrder.getOrderedBy().getPrimaryLocationIsNotNull())
		{
			commonOrder.getEntererSLocation().getLocationDescription().setValue(newOrder.getOrderedBy().getPrimaryLocation().getName());
		}
		
		if (newOrder.getOrderedBy().getCommChannelsIsNotNull())
		{
			// ORC-14   Call back phone number   (XTN)   00228
			renderCommChannelVoCollectionToXTN(newOrder.getOrderedBy().getCommChannels(), commonOrder.getCallBackPhoneNumber(0));
		}
	}
	
	// OBR-16   Ordering provider  (XCN)   
	// ORC-12   Ordering provider   (XCN)   00226
	
	
	//http://jira/browse/WDEV-6910
	ConfigPropertyVo prop= providerSystem.getConfigurationProperty(ConfigItems.UseGpAsOrderingProvider);
	if (prop != null && (prop.getPropertyValueIsNotNull())&&(prop.getPropertyValue().length() > 0)
			&&prop.getPropertyValue().trim().equalsIgnoreCase("TRUE"))
	{
		if(newOrder.getResponsibleGpIsNotNull())
		{
			renderGpShortVoToXCN(newOrder.getResponsibleGp(), commonOrder.getOrderingProvider(0),providerSystem);
			renderGpShortVoToXCN(newOrder.getResponsibleGp(), obr.getOrderingProvider(0),providerSystem);
		}
	}
	
	else if (newOrder.getResponsibleClinicianIsNotNull())
	{
		renderMemberOfStaffShortVoToXCN(newOrder.getResponsibleClinician().getMos(), commonOrder.getOrderingProvider(0),providerSystem);
		renderMemberOfStaffShortVoToXCN(newOrder.getResponsibleClinician().getMos(), obr.getOrderingProvider(0),providerSystem);
		// OBR-17   Order callback phone number 
		
		if (!ConfigFlag.GEN.SITE_USES_ORDER_BLEEP_EXT_NUMBER.getValue()
				&& newOrder.getResponsibleClinician().getMosIsNotNull())
			renderCommChannelVoToXTN(newOrder.getResponsibleClinician().getMos().getCommChannel(ChannelType.BLEEP), obr.getOrderCallbackPhoneNumber(0));
	}

	if(ConfigFlag.GEN.SITE_USES_ORDER_BLEEP_EXT_NUMBER.getValue()&&newOrder.getBleepExtNumberIsNotNull())
	{
		CommChannelVo bleepVo = new CommChannelVo();
		bleepVo.setCommValue(newOrder.getBleepExtNumber());
		bleepVo.setChannelType(ChannelType.BLEEP);
		renderCommChannelVoToXTN(bleepVo, obr.getOrderCallbackPhoneNumber(0));
	}
		
		
	// OBR-28   Result copies to   
	if (newOrder.getReportToIsNotNull())
	{
		for (int i=0; i<newOrder.getReportTo().size(); i++)
		{
			obr.getResultCopiesTo(i).getFamilyName().getSurname().setValue(newOrder.getReportTo().get(i).getValue());
		}
	}
	
	// OBR-30   Transportation mode
	if (newOrder.getPatMobilityIsNotNull())
	{
		obr.getTransportationMode().setValue(svc.getRemoteLookup(newOrder.getPatMobility().getId(), providerSystem.getCodeSystem().getText()));
	}
	
	LOG.debug("O01VoMapper renderNewOrderToORC_OBR: exit");

}
 
Example 34
Project: openmaxims-linux   File: O01VoMapper.java   Source Code and License 4 votes vote down vote up
private void renderInvestigationToORC_OBR(IfOrderInvestigationVo investigation, ORC commonOrder, OBR obr,ProviderSystemVo providerSystem) throws Exception
	{
		LOG.debug("O01VoMapper renderInvestigationToORC_OBR: entry");

		IfInvestigationLiteVo invVo = investigation.getInvestigation();

		// ORC-5   Order status   (ID)   00219
		if (investigation.getOrdInvCurrentStatusIsNotNull() && investigation.getOrdInvCurrentStatus().getOrdInvStatusIsNotNull())
			commonOrder.getOrderStatus().setValue(svc.getRemoteLookup(investigation.getOrdInvCurrentStatus().getOrdInvStatus().getId(), providerSystem.getCodeSystem().getText()));
	
		// ORC-9   Date/time of transaction   (TS)   00223
		//TODO: Not sure if this should override the sysinfo values.
		//The assembler would ignore them anyway.
		//WDEV-8866
		if (investigation.getDisplayDateTimeIsNotNull())
			renderDateTimeVoToTS(investigation.getDisplayDateTime(), commonOrder.getDateTimeOfTransaction());
		else 
			renderDateTimeVoToTS(new DateTime(), commonOrder.getDateTimeOfTransaction());
		
		// ORC-24   Ordering provider address   (XAD)   01314
		//TODO: Will leave out for now. 
//		if (invVo.getProviderServiceIsNotNull() && invVo.getProviderService().getLocationServiceIsNotNull() && invVo.getProviderService().getLocationService().getLocationIsNotNull())
//			renderAddressVoToXAD(invVo.getProviderService().getLocationService().getLocation().getAddress(), commonOrder.getOrderingProviderAddress(0));

		// OBR-4   Universal service identifier   (CE)   00238
		// Test Name
		obr.getUniversalServiceIdentifier().getIdentifier().setValue(invVo.getProviderInvCode());
		obr.getUniversalServiceIdentifier().getText().setValue(invVo.getInvestigationIndex().getName());
		// Coding System
//		if (invVo.getProviderServiceIsNotNull() && invVo.getProviderService().getProviderSystemIsNotNull() && invVo.getProviderService().getProviderSystem().getCodeSystemIsNotNull())
//			obr.getUniversalServiceIdentifier().getNameOfCodingSystem().setValue(invVo.getProviderService().getProviderSystem().getCodeSystem().getText());

		// OBR-5   Priority - OBR
		// ORC-7   Quantity/timing   
		// OBR-27   Quantity/timing   
		if (investigation.getOrderPriorityIsNotNull())
		{
			String extPriority = svc.getRemoteLookup(investigation.getOrderPriority().getId(), providerSystem.getCodeSystem().getText()); 
			commonOrder.getQuantityTiming(0).getPriority().setValue(extPriority);
			obr.getPriority().setValue(extPriority);
			obr.getQuantityTiming(0).getPriority().setValue(extPriority);
		}
		
		// OBR-31   Reason for study
		if (investigation.getReasonForStudyIsNotNull())
			obr.getReasonForStudy(0).getText().setValue(investigation.getReasonForStudy());
		
		// JP 10/11/2006 WDEV-2110
		ServiceShortVo service = ocsIf.getService(investigation.getInvestigation());
		String extMapping = ocsIf.getServiceMapping(service,providerSystem.getCodeSystem());
		obr.getDiagnosticServSectID().setValue(extMapping);
		
		
		// ORC-7   Quantity/timing   
		// OBR-27   Quantity/timing
		// wdev-2559 Moved from renderOrder method, examination required by is now at investigation level
		renderDateVoToTS(investigation.getExamReqOnAfterDate(), obr.getQuantityTiming(0).getStartDateTime());
		renderDateVoToTS(investigation.getExamReqOnAfterDate(), commonOrder.getQuantityTiming(0).getStartDateTime());
		
		LOG.debug("O01VoMapper renderInvestigationToORC_OBR: exit");

	}
 
Example 35
Project: AvoinApotti   File: IHL7Helper.java   Source Code and License votes vote down vote up
void ProcessOrderMessage(ORC orc,IfOrderInvestigationVo invVo,IfOrderInvestigationVo invFromMesssageVo,DomainInterface domObj,DateTime startDT,DateTime endDT,HcpRefVo seenBy); 
Example 36
Project: openMAXIMS   File: IHL7Helper.java   Source Code and License votes vote down vote up
void ProcessOrderMessage(ORC orc,IfOrderInvestigationVo invVo,IfOrderInvestigationVo invFromMesssageVo,DomainInterface domObj,DateTime startDT,DateTime endDT,HcpRefVo seenBy); 
Example 37
Project: openMAXIMS   File: IHL7Helper.java   Source Code and License votes vote down vote up
void ProcessOrderMessage(ORC orc,IfOrderInvestigationVo invVo,IfOrderInvestigationVo invFromMesssageVo,DomainInterface domObj,DateTime startDT,DateTime endDT,HcpRefVo seenBy); 
Example 38
Project: openmaxims-linux   File: IHL7Helper.java   Source Code and License votes vote down vote up
void ProcessOrderMessage(ORC orc,IfOrderInvestigationVo invVo,IfOrderInvestigationVo invFromMesssageVo,DomainInterface domObj,DateTime startDT,DateTime endDT,HcpRefVo seenBy);