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

The following are top voted examples for showing how to use ca.uhn.hl7v2.model.v24.segment.OBR. 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: R01VoMapper.java   Source Code and License 6 votes vote down vote up
private IfOcsRadResultVo getRadResultDetails(OBR obr, ORU_R01_ORCOBRNTECTDOBXNTEFT1CTI orc_group) throws Exception
{
	LOG.debug("R01VoMapper getRadResultDetails: entry");
	IfOcsRadResultVo radResVo = new IfOcsRadResultVo();

	radResVo.setReportText(getReportTextFromOBXGroup(orc_group));

	if (obr.getAssistantResultInterpreter().length > 0)
		radResVo.setAuthoringRadiologistName(getNameFromNDL(obr.getAssistantResultInterpreter(0)));
	if (obr.getTechnician().length > 0)
		radResVo.setRadiographerName(getNameFromNDL(obr.getTechnician(0)));
	radResVo.setExamDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime()));
	if (radResVo.getExamDateTimeIsNotNull())
		radResVo.setExamTimeSupplied(Boolean.valueOf(radResVo.getExamDateTime().getTime() != null));
	radResVo.setRadiographerName("");
	// iSoft spec - "unused"
	if (obr.getTranscriptionist().length > 0)
		radResVo.setTranscriberName(getNameFromNDL(obr.getTranscriptionist(0)));

	radResVo.setVerifyingRadiologistName(getNameFromNDL(obr.getPrincipalResultInterpreter()));
	LOG.debug("R01VoMapper getRadResultDetails: exit");
	return radResVo;
}
 
Example 2
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 6 votes vote down vote up
private IfOcsRadResultVo getRadResultDetails(OBR obr, ORU_R01_ORCOBRNTECTDOBXNTEFT1CTI orc_group) throws Exception
{
	LOG.debug("R01VoMapper getRadResultDetails: entry");
	IfOcsRadResultVo radResVo = new IfOcsRadResultVo();

	radResVo.setReportText(getReportTextFromOBXGroup(orc_group));

	if (obr.getAssistantResultInterpreter().length > 0)
		radResVo.setAuthoringRadiologistName(getNameFromNDL(obr.getAssistantResultInterpreter(0)));
	if (obr.getTechnician().length > 0)
		radResVo.setRadiographerName(getNameFromNDL(obr.getTechnician(0)));
	radResVo.setExamDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime()));
	if (radResVo.getExamDateTimeIsNotNull())
		radResVo.setExamTimeSupplied(Boolean.valueOf(radResVo.getExamDateTime().getTime() != null));
	radResVo.setRadiographerName("");
	// iSoft spec - "unused"
	if (obr.getTranscriptionist().length > 0)
		radResVo.setTranscriberName(getNameFromNDL(obr.getTranscriptionist(0)));

	radResVo.setVerifyingRadiologistName(getNameFromNDL(obr.getPrincipalResultInterpreter()));
	LOG.debug("R01VoMapper getRadResultDetails: exit");
	return radResVo;
}
 
Example 3
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 6 votes vote down vote up
private IfOcsRadResultVo getRadResultDetails(OBR obr, ORU_R01_ORCOBRNTECTDOBXNTEFT1CTI orc_group) throws Exception
{
	LOG.debug("R01VoMapper getRadResultDetails: entry");
	IfOcsRadResultVo radResVo = new IfOcsRadResultVo();

	radResVo.setReportText(getReportTextFromOBXGroup(orc_group));

	if (obr.getAssistantResultInterpreter().length > 0)
		radResVo.setAuthoringRadiologistName(getNameFromNDL(obr.getAssistantResultInterpreter(0)));
	if (obr.getTechnician().length > 0)
		radResVo.setRadiographerName(getNameFromNDL(obr.getTechnician(0)));
	radResVo.setExamDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime()));
	if (radResVo.getExamDateTimeIsNotNull())
		radResVo.setExamTimeSupplied(Boolean.valueOf(radResVo.getExamDateTime().getTime() != null));
	radResVo.setRadiographerName("");
	// iSoft spec - "unused"
	if (obr.getTranscriptionist().length > 0)
		radResVo.setTranscriberName(getNameFromNDL(obr.getTranscriptionist(0)));

	radResVo.setVerifyingRadiologistName(getNameFromNDL(obr.getPrincipalResultInterpreter()));
	LOG.debug("R01VoMapper getRadResultDetails: exit");
	return radResVo;
}
 
Example 4
Project: openmaxims-linux   File: R01VoMapper.java   Source Code and License 6 votes vote down vote up
private IfOcsRadResultVo getRadResultDetails(OBR obr, ORU_R01_ORCOBRNTECTDOBXNTEFT1CTI orc_group) throws Exception
{
	LOG.debug("R01VoMapper getRadResultDetails: entry");
	IfOcsRadResultVo radResVo = new IfOcsRadResultVo();

	radResVo.setReportText(getReportTextFromOBXGroup(orc_group));

	if (obr.getAssistantResultInterpreter().length > 0)
		radResVo.setAuthoringRadiologistName(getNameFromNDL(obr.getAssistantResultInterpreter(0)));
	if (obr.getTechnician().length > 0)
		radResVo.setRadiographerName(getNameFromNDL(obr.getTechnician(0)));
	radResVo.setExamDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime()));
	if (radResVo.getExamDateTimeIsNotNull())
		radResVo.setExamTimeSupplied(Boolean.valueOf(radResVo.getExamDateTime().getTime() != null));
	radResVo.setRadiographerName("");
	// iSoft spec - "unused"
	if (obr.getTranscriptionist().length > 0)
		radResVo.setTranscriberName(getNameFromNDL(obr.getTranscriptionist(0)));

	radResVo.setVerifyingRadiologistName(getNameFromNDL(obr.getPrincipalResultInterpreter()));
	LOG.debug("R01VoMapper getRadResultDetails: exit");
	return radResVo;
}
 
Example 5
Project: rassyeyanie   File: MicroAndBloodbankResultsFilter.java   Source Code and License 6 votes vote down vote up
public boolean shouldProcessMessage(@Body ORU_R01 r01) throws HL7Exception {
	boolean conformsFiller = true;
	boolean conformsService = true;

	int resultCount = r01.getPATIENT_RESULT().getORDER_OBSERVATIONReps();
	
	

	for (int i = 0; i < resultCount && conformsFiller && conformsService; i++) {
		OBR obr = r01.getPATIENT_RESULT().getORDER_OBSERVATION(i).getOBR();
		conformsFiller = this.checkFillerOrderNumberConforms(obr
				.getObr3_FillerOrderNumber().getEi1_EntityIdentifier()
				.getValue());
		conformsService = this.checkDiagnosticServiceConforms(obr
				.getObr24_DiagnosticServSectID().getValue());
	}
	return (conformsFiller && conformsService);

}
 
Example 6
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 7
Project: AvoinApotti   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
private IfOrderInvestigationVo populateRADInvestigationVoFromOBR(OBR obr, String sendingApplication, ProviderSystemVo providerSystem) throws Exception
{
	IfOrderInvestigationVo orderInvVo = new IfOrderInvestigationVo();
	
	String providerInvCode = obr.getUniversalServiceIdentifier().getIdentifier().getValue();
	
	// wdev-2397 specimen source is now part of the search criteria to get the investigation
	SPS sps = obr.getSpecimenSource();

	IfProviderInvSearchVo search = new IfProviderInvSearchVo();
	search.setProviderInvCode(providerInvCode);
	search.setProvider(providerSystem);
	search.setHl7App(sendingApplication);
	search.setSpecimenSource(sps.getSpecimenSourceNameOrCode().getIdentifier().getValue());
	IfInvestigationLiteVo invVo = ocsIfInbound.getInvestigationByHl7AppInvAndService(search);
	if (invVo == null)
		throw new HL7Exception("Investigation not found for provider system and providerInvCode = " + providerInvCode);
	
	
	fillRADInvestigationFromOBR(orderInvVo, obr, invVo,providerSystem);
	
		// OBR-27   Quantity/timing
	// wdev-2746 - If obr-27 is not populated, we can check obr-5
	String priority = obr.getQuantityTiming(0).getPriority().getValue();
	if (priority == null)
		priority = obr.getPriority().getValue();
	if (priority != null)
	{
		orderInvVo.setOrderPriority((OrderPriority) svc.getLocalLookup(OrderPriority.class, OrderPriority.TYPE_ID, providerSystem.getCodeSystem().getText(), priority));
	}
	
	orderInvVo.setWasOrdered(Boolean.FALSE);
	return orderInvVo;
}
 
Example 8
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 9
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 10
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
private IfOrderInvestigationVo populateRADInvestigationVoFromOBR(OBR obr, String sendingApplication, ProviderSystemVo providerSystem) throws Exception
{
	IfOrderInvestigationVo orderInvVo = new IfOrderInvestigationVo();
	
	String providerInvCode = obr.getUniversalServiceIdentifier().getIdentifier().getValue();
	
	// wdev-2397 specimen source is now part of the search criteria to get the investigation
	SPS sps = obr.getSpecimenSource();

	IfProviderInvSearchVo search = new IfProviderInvSearchVo();
	search.setProviderInvCode(providerInvCode);
	search.setProvider(providerSystem);
	search.setHl7App(sendingApplication);
	search.setSpecimenSource(sps.getSpecimenSourceNameOrCode().getIdentifier().getValue());
	IfInvestigationLiteVo invVo = ocsIfInbound.getInvestigationByHl7AppInvAndService(search);
	if (invVo == null)
		throw new HL7Exception("Investigation not found for provider system and providerInvCode = " + providerInvCode);
	
	
	fillRADInvestigationFromOBR(orderInvVo, obr, invVo,providerSystem);
	
		// OBR-27   Quantity/timing
	// wdev-2746 - If obr-27 is not populated, we can check obr-5
	String priority = obr.getQuantityTiming(0).getPriority().getValue();
	if (priority == null)
		priority = obr.getPriority().getValue();
	if (priority != null)
	{
		orderInvVo.setOrderPriority((OrderPriority) svc.getLocalLookup(OrderPriority.class, OrderPriority.TYPE_ID, providerSystem.getCodeSystem().getText(), priority));
	}
	
	orderInvVo.setWasOrdered(Boolean.FALSE);
	return orderInvVo;
}
 
Example 11
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 12
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 13
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
private IfOrderInvestigationVo populateRADInvestigationVoFromOBR(OBR obr, String sendingApplication, ProviderSystemVo providerSystem) throws Exception
{
	IfOrderInvestigationVo orderInvVo = new IfOrderInvestigationVo();
	
	String providerInvCode = obr.getUniversalServiceIdentifier().getIdentifier().getValue();
	
	// wdev-2397 specimen source is now part of the search criteria to get the investigation
	SPS sps = obr.getSpecimenSource();

	IfProviderInvSearchVo search = new IfProviderInvSearchVo();
	search.setProviderInvCode(providerInvCode);
	search.setProvider(providerSystem);
	search.setHl7App(sendingApplication);
	search.setSpecimenSource(sps.getSpecimenSourceNameOrCode().getIdentifier().getValue());
	IfInvestigationLiteVo invVo = ocsIfInbound.getInvestigationByHl7AppInvAndService(search);
	if (invVo == null)
		throw new HL7Exception("Investigation not found for provider system and providerInvCode = " + providerInvCode);
	
	
	fillRADInvestigationFromOBR(orderInvVo, obr, invVo,providerSystem);
	
		// OBR-27   Quantity/timing
	// wdev-2746 - If obr-27 is not populated, we can check obr-5
	String priority = obr.getQuantityTiming(0).getPriority().getValue();
	if (priority == null)
		priority = obr.getPriority().getValue();
	if (priority != null)
	{
		orderInvVo.setOrderPriority((OrderPriority) svc.getLocalLookup(OrderPriority.class, OrderPriority.TYPE_ID, providerSystem.getCodeSystem().getText(), priority));
	}
	
	orderInvVo.setWasOrdered(Boolean.FALSE);
	return orderInvVo;
}
 
Example 14
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 15
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 16
Project: openmaxims-linux   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
private IfOrderInvestigationVo populateRADInvestigationVoFromOBR(OBR obr, String sendingApplication, ProviderSystemVo providerSystem) throws Exception
{
	IfOrderInvestigationVo orderInvVo = new IfOrderInvestigationVo();
	
	String providerInvCode = obr.getUniversalServiceIdentifier().getIdentifier().getValue();
	
	// wdev-2397 specimen source is now part of the search criteria to get the investigation
	SPS sps = obr.getSpecimenSource();

	IfProviderInvSearchVo search = new IfProviderInvSearchVo();
	search.setProviderInvCode(providerInvCode);
	search.setProvider(providerSystem);
	search.setHl7App(sendingApplication);
	search.setSpecimenSource(sps.getSpecimenSourceNameOrCode().getIdentifier().getValue());
	IfInvestigationLiteVo invVo = ocsIfInbound.getInvestigationByHl7AppInvAndService(search);
	if (invVo == null)
		throw new HL7Exception("Investigation not found for provider system and providerInvCode = " + providerInvCode);
	
	
	fillRADInvestigationFromOBR(orderInvVo, obr, invVo,providerSystem);
	
		// OBR-27   Quantity/timing
	// wdev-2746 - If obr-27 is not populated, we can check obr-5
	String priority = obr.getQuantityTiming(0).getPriority().getValue();
	if (priority == null)
		priority = obr.getPriority().getValue();
	if (priority != null)
	{
		orderInvVo.setOrderPriority((OrderPriority) svc.getLocalLookup(OrderPriority.class, OrderPriority.TYPE_ID, providerSystem.getCodeSystem().getText(), priority));
	}
	
	orderInvVo.setWasOrdered(Boolean.FALSE);
	return orderInvVo;
}
 
Example 17
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 18
Project: rassyeyanie   File: AbstractCrisO01Test.java   Source Code and License 5 votes vote down vote up
@Test
public void test_message_to_message_obr_1() throws Exception {
	Structure expectedSegment = getExpected().getGroup("ORDER", 0).get(
			OBR.class);
	Structure actualSegment = getActual().getGroup("ORDER", 0)
			.getGroup("ORDER_DETAIL", 0).get(OBR.class);
	assertEquals(expectedSegment, actualSegment);
}
 
Example 19
Project: rassyeyanie   File: MicroResultsFilter.java   Source Code and License 5 votes vote down vote up
public boolean shouldProcessMessage(@Body ORU_R01 r01)
    throws HL7Exception
{
    
    boolean conformsFiller = true;
    boolean conformsService = true;
    
    int resultCount = r01.getPATIENT_RESULT().getORDER_OBSERVATIONReps();
    
    for (int i = 0; i < resultCount && conformsFiller && conformsService; i++)
    {
        OBR obr = r01.getPATIENT_RESULT().getORDER_OBSERVATION(i).getOBR();
        conformsFiller =
            this.checkFillerOrderNumberConforms(obr
                .getObr3_FillerOrderNumber()
                .getEi1_EntityIdentifier()
                .getValue());
        conformsService =
            this.checkDiagnosticServiceConforms(obr
                .getObr24_DiagnosticServSectID()
                .getValue());
    }
    
    if (this.verify)
    {
        return (conformsFiller && conformsService);
    }
    else
    {
        return !(conformsFiller && conformsService);
    }
    
}
 
Example 20
Project: rassyeyanie   File: FillerOrderNumberFilter.java   Source Code and License 5 votes vote down vote up
private boolean checkResultMessage(AbstractMessage message) {
       boolean conformsFiller = true;
       
       ORU_R01 r01 = (ORU_R01) message;
       
       int resultCount = r01.getPATIENT_RESULT().getORDER_OBSERVATIONReps();
       
       for (int i = 0; i < resultCount && conformsFiller; i++)
       {
           OBR obr = r01.getPATIENT_RESULT().getORDER_OBSERVATION(i).getOBR();
           String fillerOrderNumber = StringUtils.defaultString(obr
                   .getObr3_FillerOrderNumber()
                   .getEi1_EntityIdentifier()
                   .getValue());
           
           if(fillerOrderNumber.isEmpty())
           {
           	if(matchValue.isEmpty())
           		conformsFiller = true;
           	else
           		conformsFiller = false;
           }
           else                  
           {
           	conformsFiller =
           			this.checkFillerOrderNumberConforms(StringUtils.defaultString(fillerOrderNumber));
           }
       }      
           return (conformsFiller);
	
}
 
Example 21
Project: rassyeyanie   File: FillerOrderNumberFilter.java   Source Code and License 5 votes vote down vote up
private boolean checkOrderMessage(AbstractMessage message) {
       boolean conformsFiller = true;
       
       ORM_O01 o01 = (ORM_O01) message;
       
       int orderCount = o01.getORDERReps();
       
       for (int i = 0; i < orderCount && conformsFiller ; i++)
       {
           OBR obr = o01.getORDER(i).getORDER_DETAIL().getOBR();
           
           String fillerOrderNumber = StringUtils.defaultString(obr
                   .getObr3_FillerOrderNumber()
                   .getEi1_EntityIdentifier()
                   .getValue());
           
           if(fillerOrderNumber.isEmpty())
           {
           	if(matchValue.isEmpty())
           		conformsFiller = true;
           	else
           		conformsFiller = false;
           }
           else                  
           {
           	conformsFiller =
           			this.checkFillerOrderNumberConforms(StringUtils.defaultString(fillerOrderNumber));
           }
       }      
           return (conformsFiller);

}
 
Example 22
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 23
Project: AvoinApotti   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private IfOrderInvestigationVo populatePATHInvestigationVoFromOBR(OBR obr, String sendingApplication, IfOrderSpecimenVo specimen, HashMap<String, Object> fillerSpecimens, IfOrderSpecimenVoCollection specColl, ProviderSystemVo providerSystem,boolean isResultMessage) throws Exception
	{
		IfOrderInvestigationVo orderInvVo = new IfOrderInvestigationVo();
		String providerInvCode = obr.getUniversalServiceIdentifier().getIdentifier().getValue();

		// wdev-5526 - method created and called from here now
		IfInvestigationLiteVo invVo = getInvestigation(obr, sendingApplication, providerSystem, providerInvCode,true,isResultMessage);
		if (invVo == null)
			throw new HL7Exception("Investigation not found for provider system and providerInvCode = " + providerInvCode);
		
		fillPATHInvestigationFromOBR(orderInvVo, obr, invVo,providerSystem);

		// OBR-27   Quantity/timing
		// wdev-2746 - If obr-27 is not populated, we can check obr-5
		String priority = obr.getQuantityTiming(0).getPriority().getValue();
		if (priority == null)
			priority = obr.getPriority().getValue();
		if (priority != null)
		{
			orderInvVo.setOrderPriority((OrderPriority) svc.getLocalLookup(OrderPriority.class, OrderPriority.TYPE_ID, providerSystem.getCodeSystem().getText(), priority));
		}

		orderInvVo.setWasOrdered(Boolean.FALSE);
		
		// Specimens only for Pathology orders
		//	OBR-3   Filler order number   
		//  WDEV-1354 
		// We hold onto the specimens for each fillerOrderNumber in case
		// the same specimen is required again
		String fillerOrderNum = obr.getFillerOrderNumber().getEntityIdentifier().getValue();
		if (fillerSpecimens.containsKey(fillerOrderNum)&&!ConfigFlag.HL7.UNSOLICTED_NEW_SPECIMEN_PER_INVESTIGATION.getValue())
			specimen = (IfOrderSpecimenVo) fillerSpecimens.get(fillerOrderNum);
		else
		{
			specimen = new IfOrderSpecimenVo();
			populateSpecimenVoFromOBR(specimen, orderInvVo.getInvestigation(), obr,providerSystem);
			specimen.getInvestigations();
			if(InvEventType.TIME_SERIES.equals(orderInvVo.getInvestigation().getEventType()))
			{
				specimen.setWasProcessed(true);	
//				specimen.setPlacerOrdNum(value);
			}
			if(!specimen.getInvestigationsIsNotNull())
			{
				specimen.setInvestigations(new IfOrderInvestigationVoCollection());
			}
			specimen.getInvestigations().add(orderInvVo);
			specColl.add(specimen);

			if (!fillerSpecimens.containsKey(specimen.getFillerOrdNum()))
			{
				fillerSpecimens.put(specimen.getFillerOrdNum(), specimen);
			}
		}
		if(orderInvVo.getSpecimen()==null&&!ConfigFlag.HL7.UNSOLICTED_NEW_SPECIMEN_PER_INVESTIGATION.getValue())
		{
			orderInvVo.setSpecimen(specColl);
		}
		else
		{
			orderInvVo.setSpecimen(new IfOrderSpecimenVoCollection());
			orderInvVo.getSpecimen().add(specimen);
		}
		
		//WDEV-15552
		SPS sps = obr.getSpecimenSource();
		LookupInstVo resultSpecimenSource=svc.getLocalLookup(LookupInstVo.class, ResultSpecimenTypes.TYPE_ID, providerSystem.getCodeSystem().getText(), sps.getSpecimenSourceNameOrCode().getIdentifier().getValue().trim()); 
		orderInvVo.setResultSpecimenType(resultSpecimenSource);

		return orderInvVo;
	}
 
Example 24
Project: AvoinApotti   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private void fillPATHInvestigationFromOBR(IfOrderInvestigationVo invVo, OBR obr, IfInvestigationLiteVo cfgInv,ProviderSystemVo providerSystem) throws Exception
{
	LOG.debug("R01VoMapper fillPATHInvestigationFromOBR: entry");

	invVo.setInvestigation(cfgInv);
	invVo.setFillerOrdNum(obr.getFillerOrderNumber().getEntityIdentifier().getValue());
	invVo.setResultStatus((ResultStatus) svc.getLocalLookup(ResultStatus.class, ResultStatus.TYPE_ID, providerSystem.getCodeSystem().getText(), obr.getResultStatus().getValue()));
	
	//http://jira/browse/WDEV-15552
	SPS sps = obr.getSpecimenSource();
	LookupInstVo resultSpecimenSource=svc.getLocalLookup(LookupInstVo.class, ResultSpecimenTypes.TYPE_ID, providerSystem.getCodeSystem().getText(), sps.getSpecimenSourceNameOrCode().getIdentifier().getValue().trim()); 
	invVo.setResultSpecimenType(resultSpecimenSource);
	//End http://jira/browse/WDEV-15552
	
	// wdev-2746 ResultStatus must map to a valid lookup value 
	if (obr.getResultStatus().getValue() != null && !invVo.getResultStatusIsNotNull())
		throw new HL7Exception("ResultStatus (OBR-25) does not map to a valid local lookup (ResultStatus) - Message Rejected");
		
	if (obr.getRequestedDateTime() != null && obr.getRequestedDateTime().getTimeOfAnEvent().getValue() != null)
	{
		invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getRequestedDateTime()));
		invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getRequestedDateTime())));
		invVo.setDisplayFlag(OcsDisplayFlag.REQUESTED);
	}
	if (obr.getResultsRptStatusChngDateTime() != null && obr.getResultsRptStatusChngDateTime().getTimeOfAnEvent().getValue() != null)
	{
		DateTime dt = populateDateTimeVoFromTS(obr.getResultsRptStatusChngDateTime());
		//JME: 20061205: Change to handle WinPath sending 189912300000 in OBR.22 instead of a null date/time
		if (!dt.equals(new DateTime("189912300000")))
		{
			invVo.setDisplayDateTime(dt);				
			invVo.setRepDateTime(dt);
			invVo.setResultSortDate(dt);//http://jira/browse/WDEV-18025
			invVo.setRepTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getResultsRptStatusChngDateTime())));					
			invVo.setDisplayFlag(OcsDisplayFlag.REPORTED);
			invVo.setDisplayTimeSupplied(invVo.getRepTimeSupplied());					
		}
	}
	if (obr.getSpecimenReceivedDateTime() != null && obr.getSpecimenReceivedDateTime().getTimeOfAnEvent().getValue() != null)
	{
		invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getSpecimenReceivedDateTime()));			
		invVo.setDisplayFlag(OcsDisplayFlag.SPEC_RECVD);
		invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getSpecimenReceivedDateTime())));
		
		// WDEV-16384  - Check if expected turnaround values configured.  If they are, calculated the expected result datetime
		invVo.setExpectedDateTime(ocsIfInbound.calculateExpectedDateTime(invVo.getInvestigation(), invVo.getDisplayDateTime()));

	}
	if (obr.getObservationDateTime() != null && obr.getObservationDateTime().getTimeOfAnEvent().getValue() != null)
	{
		invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime()));
		invVo.setDisplayFlag(OcsDisplayFlag.SPEC_COLL);
		invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getObservationDateTime())));
	}			
	/*
	 * etc investVo.setOrderPriority(); investVo.setOrdInvCurrentStatus();
	 */
	LOG.debug("R01VoMapper fillPATHInvestigationFromOBR: exit");
}
 
Example 25
Project: AvoinApotti   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private void fillRADInvestigationFromOBR(IfOrderInvestigationVo invVo, OBR obr, IfInvestigationLiteVo cfgInv,ProviderSystemVo providerSystem) throws Exception
	{
		LOG.debug("R01VoMapper fillRADInvestigationFromOBR: entry");

		invVo.setInvestigation(cfgInv);
		invVo.setFillerOrdNum(obr.getFillerOrderNumber().getEntityIdentifier().getValue());
		invVo.setResultStatus((ResultStatus) svc.getLocalLookup(ResultStatus.class, ResultStatus.TYPE_ID, providerSystem.getCodeSystem().getText(), obr.getResultStatus().getValue()));
		// http://jira/browse/WDEV-9727
		String accession = obr.getFillerField2().getValue();
		if (accession!=null && !Hl7Null.equals(accession))
		{
			invVo.setAccessionNumber(accession);
		}
		// wdev-2746 ResultStatus must map to a valid lookup value 
		if (obr.getResultStatus().getValue() != null && !invVo.getResultStatusIsNotNull())
			throw new HL7Exception("ResultStatus (OBR-25) does not map to a valid local lookup (ResultStatus) - Message Rejected");
			
		if (obr.getRequestedDateTime() != null && obr.getRequestedDateTime().getTimeOfAnEvent().getValue() !=null)
		{
			invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getRequestedDateTime()));
			invVo.setDisplayFlag(OcsDisplayFlag.REQUESTED);
			invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getRequestedDateTime())));
		}
		if (obr.getObservationDateTime() != null && obr.getObservationDateTime().getTimeOfAnEvent().getValue() != null)
		{
			invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime()));
			invVo.setDisplayFlag(OcsDisplayFlag.EXAMINED);
			invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getObservationDateTime())));
			
			// WDEV-16384  - Check if expected turnaround values configured.  If they are, calculated the expected result datetime
			invVo.setExpectedDateTime(ocsIfInbound.calculateExpectedDateTime(invVo.getInvestigation(), invVo.getDisplayDateTime()));
		}
		if (obr.getResultsRptStatusChngDateTime() != null && obr.getResultsRptStatusChngDateTime().getTimeOfAnEvent().getValue() != null)
		{
			invVo.setRepDateTime(populateDateTimeVoFromTS(obr.getResultsRptStatusChngDateTime()));	
			invVo.setResultSortDate(populateDateTimeVoFromTS(obr.getResultsRptStatusChngDateTime())); //http://jira/browse/WDEV-18025
			invVo.setRepTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getResultsRptStatusChngDateTime())));					
		}
		else
		{
			invVo.setRepDateTime(null);	
			invVo.setResultSortDate(null); //http://jira/browse/WDEV-18025
			invVo.setRepTimeSupplied(Boolean.FALSE);	
//			invVo.setDisplayFlag(OcsDisplayFlag.REQUESTED);
//			invVo.setDisplayTimeSupplied(false);
//			invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime()));
		}
		
		/*
		 * etc investVo.setOrderPriority(); investVo.setOrdInvCurrentStatus();
		 */
		LOG.debug("R01VoMapper fillRADInvestigationFromOBR: exit");
	}
 
Example 26
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 27
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 28
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 29
Project: AvoinApotti   File: O01VoMapper.java   Source Code and License 4 votes vote down vote up
private void renderSpecimenToOBR(IfOrdSpecLiteVo specimen, OBR obr,ProviderSystemVo providerSystem) throws Exception
{
	LOG.debug("O01VoMapper renderSpecimenToOBR: entry");

	// OBR-7   Observation date/time   (TS)   00241
	renderDateTimeVoToTS(specimen.getCollDateTimePlacer(), obr.getObservationDateTime());
	
	// OBR-8   Observation end date/time   (TS)   
	renderDateTimeVoToTS(specimen.getCollEndDateTimePlacer(), obr.getObservationEndDateTime());
	
	// OBR-11   Specimen action code 
	obr.getSpecimenActionCode().setValue(svc.getRemoteLookup(SpecimenActionCode.O.getId(), providerSystem.getCodeSystem().getText()));
	
	// OBR-15 Specimen source   (CM)
	// This is build up of siteCd, siteText and the SpecimenSource lookup
	SPS sps = obr.getSpecimenSource();
	if (specimen.getSpecimenSourceIsNotNull())
	{
		sps.getSpecimenSourceNameOrCode().getIdentifier().setValue(svc.getRemoteLookup(specimen.getSpecimenSource().getId(), providerSystem.getCodeSystem().getText()));
		sps.getSpecimenSourceNameOrCode().getText().setValue(specimen.getSpecimenSource().getText());
	}
	
	//Leaving open the option for certain disciplines to use coded site field.
	if (specimen.getSiteCdIsNotNull())
	{
		String remoteLookup = svc.getRemoteLookup(specimen.getSiteCd().getId(), providerSystem.getCodeSystem().getText()); 
		
		sps.getBodySite().getIdentifier().setValue(remoteLookup);
		sps.getBodySite().getText().setValue(specimen.getSiteCd().getText());
		
		//JME: 20061013: copy body site component into specimen source component even if value for specimen source available. 
		//http://jira/browse/WDEV-11634
		String sendSiteAndSource = HL7Utils.getConfigItem(toConfigItemArray(providerSystem.getConfigItems()), ConfigItems.useSiteAndSource);
		if (sendSiteAndSource == null || (sendSiteAndSource.equalsIgnoreCase("FALSE") || sendSiteAndSource.equalsIgnoreCase("NO")))
		{
			sps.getSpecimenSourceNameOrCode().getIdentifier().setValue(remoteLookup);
			sps.getSpecimenSourceNameOrCode().getText().setValue(specimen.getSiteCd().getText());
		}
	}

	// OBR-24   Diagnostic serv sect ID
	if (specimen.getDisciplineIsNotNull())
	{
		String extMapping = ocsIf.getServiceMapping(specimen.getDiscipline(), providerSystem.getCodeSystem());
		obr.getDiagnosticServSectID().setValue(extMapping);
	}
	
	// OBR-39   Collector�s comment   (CE)  
	obr.getCollectorSComment(0).getText().setValue(specimen.getCollectorComment());
	LOG.debug("O01VoMapper renderSpecimenToOBR: exit");

}
 
Example 30
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 31
Project: openMAXIMS   File: VoMapper.java   Source Code and License 4 votes vote down vote up
protected final void renderGpShortVoToOrderingProvider(GpShortVo gp, OBR obr, ProviderSystemVo providerSystem) throws HL7Exception
{
	LOG.debug("VoMapper renderGpShortVoToOrderingProvider: entry");

	int xcnCount = 0;
	
	if (gp != null)
	{
		if (gp.getCodeMappings() != null)
		{
			for (int i = 0; i < gp.getCodeMappings().size(); i++)
			{
				ims.core.vo.TaxonomyMap map = gp.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)
						obr.getOrderingProvider(xcnCount).getIDNumber().setValue(map.getTaxonomyCode());
						if (gp.getNameIsNotNull())
						{
							//XCN.1 Family name (ST)
							if (gp.getName().getSurnameIsNotNull())
								obr.getOrderingProvider(xcnCount).getFamilyName().getSurname().setValue(gp.getName().getSurname().toString());
							//XCN.2 Given name (ST)
							if (gp.getName().getForenameIsNotNull())
								obr.getOrderingProvider(xcnCount).getGivenName().setValue(gp.getName().getForename().toString());
							//XCN.3 Second and further names (ST)
							if (gp.getName().getMiddleNameIsNotNull())
								obr.getOrderingProvider(xcnCount).getSecondAndFurtherGivenNamesOrInitialsThereof().setValue(gp.getName().getMiddleName().toString());
							//XCN.5 Prefix (ST)
							if (gp.getName().getTitleIsNotNull())
								obr.getOrderingProvider(xcnCount).getPrefixEgDR().setValue(gp.getName().getTitle().toString());
						}
						//XCN.9 Assigning authority (HD)
						obr.getOrderingProvider(xcnCount).getAssigningAuthority().getNamespaceID().setValue(map.getTaxonomyName().toString());
						//XCN.10 Name type code (ID)
						obr.getOrderingProvider(xcnCount).getNameTypeCode().setValue(taxTypeText);
						
						xcnCount ++;
					}
				}
			}
		}
		
		if (xcnCount == 0)
		{
			if (gp.getNameIsNotNull())
			{
				//XCN.1 Family name (ST)
				if (gp.getName().getSurnameIsNotNull())
					obr.getOrderingProvider(xcnCount).getFamilyName().getSurname().setValue(gp.getName().getSurname().toString());
				//XCN.2 Given name (ST)
				if (gp.getName().getForenameIsNotNull())
					obr.getOrderingProvider(xcnCount).getGivenName().setValue(gp.getName().getForename().toString());
				//XCN.3 Second and further names (ST)
				if (gp.getName().getMiddleNameIsNotNull())
					obr.getOrderingProvider(xcnCount).getSecondAndFurtherGivenNamesOrInitialsThereof().setValue(gp.getName().getMiddleName().toString());
				//XCN.5 Prefix (ST)
				if (gp.getName().getTitleIsNotNull())
					obr.getOrderingProvider(xcnCount).getPrefixEgDR().setValue(gp.getName().getTitle().toString());
			}
		}

	}

	LOG.debug("VoMapper renderGpShortVoToOrderingProvider: exit");
}
 
Example 32
Project: openMAXIMS   File: VoMapper.java   Source Code and License 4 votes vote down vote up
protected final void renderMemberOfStaffShortVoToOrderingProvider(MemberOfStaffShortVo mos, OBR obr, 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)
						obr.getOrderingProvider(xcnCount).getIDNumber().setValue(map.getTaxonomyCode());
						if (mos.getNameIsNotNull())
						{
							//XCN.1 Family name (ST)
							if (mos.getName().getSurnameIsNotNull())
								obr.getOrderingProvider(xcnCount).getFamilyName().getSurname().setValue(mos.getName().getSurname().toString());
							//XCN.2 Given name (ST)
							if (mos.getName().getForenameIsNotNull())
								obr.getOrderingProvider(xcnCount).getGivenName().setValue(mos.getName().getForename().toString());
							//XCN.3 Second and further names (ST)
							if (mos.getName().getMiddleNameIsNotNull())
								obr.getOrderingProvider(xcnCount).getSecondAndFurtherGivenNamesOrInitialsThereof().setValue(mos.getName().getMiddleName().toString());
							//XCN.5 Prefix (ST)
							if (mos.getName().getTitleIsNotNull())
								obr.getOrderingProvider(xcnCount).getPrefixEgDR().setValue(mos.getName().getTitle().toString());
						}
						//XCN.9 Assigning authority (HD)
						obr.getOrderingProvider(xcnCount).getAssigningAuthority().getNamespaceID().setValue(map.getTaxonomyName().toString());
						//XCN.10 Name type code (ID)
						obr.getOrderingProvider(xcnCount).getNameTypeCode().setValue(taxTypeText);
						
						xcnCount ++;
					}
				}
			}
		}
		
		if (xcnCount == 0)
		{
			if (mos.getNameIsNotNull())
			{
				//XCN.1 Family name (ST)
				if (mos.getName().getSurnameIsNotNull())
					obr.getOrderingProvider(xcnCount).getFamilyName().getSurname().setValue(mos.getName().getSurname().toString());
				//XCN.2 Given name (ST)
				if (mos.getName().getForenameIsNotNull())
					obr.getOrderingProvider(xcnCount).getGivenName().setValue(mos.getName().getForename().toString());
				//XCN.3 Second and further names (ST)
				if (mos.getName().getMiddleNameIsNotNull())
					obr.getOrderingProvider(xcnCount).getSecondAndFurtherGivenNamesOrInitialsThereof().setValue(mos.getName().getMiddleName().toString());
				//XCN.5 Prefix (ST)
				if (mos.getName().getTitleIsNotNull())
					obr.getOrderingProvider(xcnCount).getPrefixEgDR().setValue(mos.getName().getTitle().toString());
			}
		}
		
	}

	LOG.debug("VoMapper renderMemberOfStaffShortVoToOrderingProvider: exit");
}
 
Example 33
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 34
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private IfOrderInvestigationVo populatePATHInvestigationVoFromOBR(OBR obr, String sendingApplication, IfOrderSpecimenVo specimen, HashMap<String, Object> fillerSpecimens, IfOrderSpecimenVoCollection specColl, ProviderSystemVo providerSystem,boolean isResultMessage) throws Exception
	{
		IfOrderInvestigationVo orderInvVo = new IfOrderInvestigationVo();
		String providerInvCode = obr.getUniversalServiceIdentifier().getIdentifier().getValue();

		// wdev-5526 - method created and called from here now
		IfInvestigationLiteVo invVo = getInvestigation(obr, sendingApplication, providerSystem, providerInvCode,true,isResultMessage);
		if (invVo == null)
			throw new HL7Exception("Investigation not found for provider system and providerInvCode = " + providerInvCode);
		
		fillPATHInvestigationFromOBR(orderInvVo, obr, invVo,providerSystem);

		// OBR-27   Quantity/timing
		// wdev-2746 - If obr-27 is not populated, we can check obr-5
		String priority = obr.getQuantityTiming(0).getPriority().getValue();
		if (priority == null)
			priority = obr.getPriority().getValue();
		if (priority != null)
		{
			orderInvVo.setOrderPriority((OrderPriority) svc.getLocalLookup(OrderPriority.class, OrderPriority.TYPE_ID, providerSystem.getCodeSystem().getText(), priority));
		}

		orderInvVo.setWasOrdered(Boolean.FALSE);
		
		// Specimens only for Pathology orders
		//	OBR-3   Filler order number   
		//  WDEV-1354 
		// We hold onto the specimens for each fillerOrderNumber in case
		// the same specimen is required again
		String fillerOrderNum = obr.getFillerOrderNumber().getEntityIdentifier().getValue();
		if (fillerSpecimens.containsKey(fillerOrderNum)&&!ConfigFlag.HL7.UNSOLICTED_NEW_SPECIMEN_PER_INVESTIGATION.getValue())
			specimen = (IfOrderSpecimenVo) fillerSpecimens.get(fillerOrderNum);
		else
		{
			specimen = new IfOrderSpecimenVo();
			populateSpecimenVoFromOBR(specimen, orderInvVo.getInvestigation(), obr,providerSystem);
			specimen.getInvestigations();
			if(InvEventType.TIME_SERIES.equals(orderInvVo.getInvestigation().getEventType()))
			{
				specimen.setWasProcessed(true);	
//				specimen.setPlacerOrdNum(value);
			}
			if(!specimen.getInvestigationsIsNotNull())
			{
				specimen.setInvestigations(new IfOrderInvestigationVoCollection());
			}
			specimen.getInvestigations().add(orderInvVo);
			specColl.add(specimen);

			if (!fillerSpecimens.containsKey(specimen.getFillerOrdNum()))
			{
				fillerSpecimens.put(specimen.getFillerOrdNum(), specimen);
			}
		}
		if(orderInvVo.getSpecimen()==null&&!ConfigFlag.HL7.UNSOLICTED_NEW_SPECIMEN_PER_INVESTIGATION.getValue())
		{
			orderInvVo.setSpecimen(specColl);
		}
		else
		{
			orderInvVo.setSpecimen(new IfOrderSpecimenVoCollection());
			orderInvVo.getSpecimen().add(specimen);
		}
		
		//WDEV-15552
		SPS sps = obr.getSpecimenSource();
		LookupInstVo resultSpecimenSource=svc.getLocalLookup(LookupInstVo.class, ResultSpecimenTypes.TYPE_ID, providerSystem.getCodeSystem().getText(), sps.getSpecimenSourceNameOrCode().getIdentifier().getValue().trim()); 
		orderInvVo.setResultSpecimenType(resultSpecimenSource);

		return orderInvVo;
	}
 
Example 35
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private void fillPATHInvestigationFromOBR(IfOrderInvestigationVo invVo, OBR obr, IfInvestigationLiteVo cfgInv,ProviderSystemVo providerSystem) throws Exception
{
	LOG.debug("R01VoMapper fillPATHInvestigationFromOBR: entry");

	invVo.setInvestigation(cfgInv);
	invVo.setFillerOrdNum(obr.getFillerOrderNumber().getEntityIdentifier().getValue());
	invVo.setResultStatus((ResultStatus) svc.getLocalLookup(ResultStatus.class, ResultStatus.TYPE_ID, providerSystem.getCodeSystem().getText(), obr.getResultStatus().getValue()));
	
	//http://jira/browse/WDEV-15552
	SPS sps = obr.getSpecimenSource();
	LookupInstVo resultSpecimenSource=svc.getLocalLookup(LookupInstVo.class, ResultSpecimenTypes.TYPE_ID, providerSystem.getCodeSystem().getText(), sps.getSpecimenSourceNameOrCode().getIdentifier().getValue().trim()); 
	invVo.setResultSpecimenType(resultSpecimenSource);
	//End http://jira/browse/WDEV-15552
	
	// wdev-2746 ResultStatus must map to a valid lookup value 
	if (obr.getResultStatus().getValue() != null && !invVo.getResultStatusIsNotNull())
		throw new HL7Exception("ResultStatus (OBR-25) does not map to a valid local lookup (ResultStatus) - Message Rejected");
		
	if (obr.getRequestedDateTime() != null && obr.getRequestedDateTime().getTimeOfAnEvent().getValue() != null)
	{
		invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getRequestedDateTime()));
		invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getRequestedDateTime())));
		invVo.setDisplayFlag(OcsDisplayFlag.REQUESTED);
	}
	if (obr.getResultsRptStatusChngDateTime() != null && obr.getResultsRptStatusChngDateTime().getTimeOfAnEvent().getValue() != null)
	{
		DateTime dt = populateDateTimeVoFromTS(obr.getResultsRptStatusChngDateTime());
		//JME: 20061205: Change to handle WinPath sending 189912300000 in OBR.22 instead of a null date/time
		if (!dt.equals(new DateTime("189912300000")))
		{
			invVo.setDisplayDateTime(dt);				
			invVo.setRepDateTime(dt);
			invVo.setResultSortDate(dt);//http://jira/browse/WDEV-18025
			invVo.setRepTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getResultsRptStatusChngDateTime())));					
			invVo.setDisplayFlag(OcsDisplayFlag.REPORTED);
			invVo.setDisplayTimeSupplied(invVo.getRepTimeSupplied());					
		}
	}
	if (obr.getSpecimenReceivedDateTime() != null && obr.getSpecimenReceivedDateTime().getTimeOfAnEvent().getValue() != null)
	{
		invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getSpecimenReceivedDateTime()));			
		invVo.setDisplayFlag(OcsDisplayFlag.SPEC_RECVD);
		invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getSpecimenReceivedDateTime())));
		
		// WDEV-16384  - Check if expected turnaround values configured.  If they are, calculated the expected result datetime
		invVo.setExpectedDateTime(ocsIfInbound.calculateExpectedDateTime(invVo.getInvestigation(), invVo.getDisplayDateTime()));

	}
	if (obr.getObservationDateTime() != null && obr.getObservationDateTime().getTimeOfAnEvent().getValue() != null)
	{
		invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime()));
		invVo.setDisplayFlag(OcsDisplayFlag.SPEC_COLL);
		invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getObservationDateTime())));
	}			
	/*
	 * etc investVo.setOrderPriority(); investVo.setOrdInvCurrentStatus();
	 */
	LOG.debug("R01VoMapper fillPATHInvestigationFromOBR: exit");
}
 
Example 36
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 4 votes vote down vote up
private void fillRADInvestigationFromOBR(IfOrderInvestigationVo invVo, OBR obr, IfInvestigationLiteVo cfgInv,ProviderSystemVo providerSystem) throws Exception
	{
		LOG.debug("R01VoMapper fillRADInvestigationFromOBR: entry");

		invVo.setInvestigation(cfgInv);
		invVo.setFillerOrdNum(obr.getFillerOrderNumber().getEntityIdentifier().getValue());
		invVo.setResultStatus((ResultStatus) svc.getLocalLookup(ResultStatus.class, ResultStatus.TYPE_ID, providerSystem.getCodeSystem().getText(), obr.getResultStatus().getValue()));
		// http://jira/browse/WDEV-9727
		String accession = obr.getFillerField2().getValue();
		if (accession!=null && !Hl7Null.equals(accession))
		{
			invVo.setAccessionNumber(accession);
		}
		// wdev-2746 ResultStatus must map to a valid lookup value 
		if (obr.getResultStatus().getValue() != null && !invVo.getResultStatusIsNotNull())
			throw new HL7Exception("ResultStatus (OBR-25) does not map to a valid local lookup (ResultStatus) - Message Rejected");
			
		if (obr.getRequestedDateTime() != null && obr.getRequestedDateTime().getTimeOfAnEvent().getValue() !=null)
		{
			invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getRequestedDateTime()));
			invVo.setDisplayFlag(OcsDisplayFlag.REQUESTED);
			invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getRequestedDateTime())));
		}
		if (obr.getObservationDateTime() != null && obr.getObservationDateTime().getTimeOfAnEvent().getValue() != null)
		{
			invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime()));
			invVo.setDisplayFlag(OcsDisplayFlag.EXAMINED);
			invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getObservationDateTime())));
			
			// WDEV-16384  - Check if expected turnaround values configured.  If they are, calculated the expected result datetime
			invVo.setExpectedDateTime(ocsIfInbound.calculateExpectedDateTime(invVo.getInvestigation(), invVo.getDisplayDateTime()));
		}
		if (obr.getResultsRptStatusChngDateTime() != null && obr.getResultsRptStatusChngDateTime().getTimeOfAnEvent().getValue() != null)
		{
			invVo.setRepDateTime(populateDateTimeVoFromTS(obr.getResultsRptStatusChngDateTime()));	
			invVo.setResultSortDate(populateDateTimeVoFromTS(obr.getResultsRptStatusChngDateTime())); //http://jira/browse/WDEV-18025
			invVo.setRepTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getResultsRptStatusChngDateTime())));					
		}
		else
		{
			invVo.setRepDateTime(null);	
			invVo.setResultSortDate(null); //http://jira/browse/WDEV-18025
			invVo.setRepTimeSupplied(Boolean.FALSE);	
//			invVo.setDisplayFlag(OcsDisplayFlag.REQUESTED);
//			invVo.setDisplayTimeSupplied(false);
//			invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime()));
		}
		
		/*
		 * etc investVo.setOrderPriority(); investVo.setOrdInvCurrentStatus();
		 */
		LOG.debug("R01VoMapper fillRADInvestigationFromOBR: exit");
	}
 
Example 37
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 38
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 39
Project: openMAXIMS   File: O01VoMapper.java   Source Code and License 4 votes vote down vote up
private void renderSpecimenToOBR(IfOrdSpecLiteVo specimen, OBR obr,ProviderSystemVo providerSystem) throws Exception
{
	LOG.debug("O01VoMapper renderSpecimenToOBR: entry");

	// OBR-7   Observation date/time   (TS)   00241
	renderDateTimeVoToTS(specimen.getCollDateTimePlacer(), obr.getObservationDateTime());
	
	// OBR-8   Observation end date/time   (TS)   
	renderDateTimeVoToTS(specimen.getCollEndDateTimePlacer(), obr.getObservationEndDateTime());
	
	// OBR-11   Specimen action code 
	obr.getSpecimenActionCode().setValue(svc.getRemoteLookup(SpecimenActionCode.O.getId(), providerSystem.getCodeSystem().getText()));
	
	// OBR-15 Specimen source   (CM)
	// This is build up of siteCd, siteText and the SpecimenSource lookup
	SPS sps = obr.getSpecimenSource();
	if (specimen.getSpecimenSourceIsNotNull())
	{
		sps.getSpecimenSourceNameOrCode().getIdentifier().setValue(svc.getRemoteLookup(specimen.getSpecimenSource().getId(), providerSystem.getCodeSystem().getText()));
		sps.getSpecimenSourceNameOrCode().getText().setValue(specimen.getSpecimenSource().getText());
	}
	
	//Leaving open the option for certain disciplines to use coded site field.
	if (specimen.getSiteCdIsNotNull())
	{
		String remoteLookup = svc.getRemoteLookup(specimen.getSiteCd().getId(), providerSystem.getCodeSystem().getText()); 
		
		sps.getBodySite().getIdentifier().setValue(remoteLookup);
		sps.getBodySite().getText().setValue(specimen.getSiteCd().getText());
		
		//JME: 20061013: copy body site component into specimen source component even if value for specimen source available. 
		//http://jira/browse/WDEV-11634
		String sendSiteAndSource = HL7Utils.getConfigItem(toConfigItemArray(providerSystem.getConfigItems()), ConfigItems.useSiteAndSource);
		if (sendSiteAndSource == null || (sendSiteAndSource.equalsIgnoreCase("FALSE") || sendSiteAndSource.equalsIgnoreCase("NO")))
		{
			sps.getSpecimenSourceNameOrCode().getIdentifier().setValue(remoteLookup);
			sps.getSpecimenSourceNameOrCode().getText().setValue(specimen.getSiteCd().getText());
		}
	}

	// OBR-24   Diagnostic serv sect ID
	if (specimen.getDisciplineIsNotNull())
	{
		String extMapping = ocsIf.getServiceMapping(specimen.getDiscipline(), providerSystem.getCodeSystem());
		obr.getDiagnosticServSectID().setValue(extMapping);
	}
	
	// OBR-39   Collector’s comment   (CE)  
	obr.getCollectorSComment(0).getText().setValue(specimen.getCollectorComment());
	LOG.debug("O01VoMapper renderSpecimenToOBR: exit");

}
 
Example 40
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;
}