Java Code Examples for ims.ocrr.vo.ProviderSystemVo

The following are top voted examples for showing how to use ims.ocrr.vo.ProviderSystemVo. 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: VoMapper.java   Source Code and License 6 votes vote down vote up
public ProviderSystemVo getProviderSystem(String sendingApplication) throws HL7Exception
{
	LOG.debug("VoMapper getProviderSystem for SendingApplication = " + sendingApplication);
	ProviderSystemVo vo = ocsIf.getProviderSystem(sendingApplication);
	if (vo == null)
	{
		LOG.warn("Provider System not found for sendingApplication = " + sendingApplication);
		throw new HL7Exception("Provider System not found for sendingApplication = " + sendingApplication);			
	}
	if (null==vo.getCodeSystem()||null==vo.getCodeSystem().getText())
	{
		throw new HL7Exception("Provider System Coding configuration incorrect for = " + sendingApplication);
	}
	LOG.info("Provider System " + vo.getCodeSystem().getText() + " found for sendingApplication" + sendingApplication);		
	LOG.debug("VoMapper getProviderSystem - CurrentProviderExternalCode = " + vo.getCodeSystem().getText());
	return vo;
}
 
Example 2
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateConfigurationItemsControl(ProviderSystemVo voProviderSystem)
{
	if (!voProviderSystem.getConfigItemsIsNotNull())
		return;

	GenForm.grdConfigurationItemsRow row;
	for (int i = 0; i < form.grdConfigurationItems().getRows().size(); i++)
	{
		row = form.grdConfigurationItems().getRows().get(i);
		ConfigPropertyVo vo = voProviderSystem.getConfigurationProperty(row.getProperty());
		if (vo != null)
		{
			row.setValue(vo);
			row.setColValue(vo.getPropertyValue());
		}
	}

}
 
Example 3
Project: AvoinApotti   File: LocationServiceProviderSysImpl.java   Source Code and License 6 votes vote down vote up
public ProviderSystemVo saveProviderSystem(ProviderSystemVo voProviderSystem) throws StaleObjectException, UniqueKeyViolationException 
{
	if(voProviderSystem == null)
		throw new RuntimeException("Cannot save null value for ProviderSystemVo");
	if(!voProviderSystem.isValidated())
	{
		throw new CodingRuntimeException("Provider System Value Object has not been validated");
	}
	DomainFactory factory = getDomainFactory();
	ProviderSystem doProviderSystem = ProviderSystemVoAssembler.extractProviderSystem(factory, voProviderSystem);			
	try
	{
		factory.save(doProviderSystem);
	}
	catch(UnqViolationUncheckedException e)
	{
		throw new ims.domain.exceptions.UniqueKeyViolationException("A System called " + (voProviderSystem.getSystemNameIsNotNull()?voProviderSystem.getSystemName():"") + "or an HL7 Application called " + (voProviderSystem.getHl7ApplicationIsNotNull()?voProviderSystem.getHl7Application():"") + " already exists. Duplicates not allowed.", e);
	}
	return ProviderSystemVoAssembler.create(doProviderSystem);
}
 
Example 4
Project: AvoinApotti   File: VoMapper.java   Source Code and License 6 votes vote down vote up
protected final void renderPatientVoToPID(Patient patVo, PID pid, ProviderSystemVo providerSystem) throws Exception
{
	LOG.debug("VoMapper renderPatientVoToPID: entry");
	if (patVo == null)
		return;

	renderPatientShortVoToPID(patVo, pid, providerSystem);

	for (int i = 0; i < patVo.getOtherNames().size(); i++)
	{
		renderNameVoToXPN(patVo.getOtherNames().get(i), pid.getPatientName(i+1),providerSystem);
	}

	for (int i = 0; i < patVo.getAddresses().size(); i++)
	{
		if (!patVo.getAddressIsNotNull()) // First instance will not have been populated if permanent address was null
			renderAddressVoToXAD(patVo.getAddresses().get(i), pid.getPatientAddress(i),providerSystem);
		else
			renderAddressVoToXAD(patVo.getAddresses().get(i), pid.getPatientAddress(i+1),providerSystem);
	}

	if (patVo.getMaritalStatusIsNotNull())
		pid.getMaritalStatus().getIdentifier().setValue(svc.getRemoteLookup(patVo.getMaritalStatus().getID(), providerSystem.getCodeSystem().getText()));

	LOG.debug("VoMapper renderPatientVoToPID: exit (" + pid.toString() + ")");
}
 
Example 5
Project: AvoinApotti   File: VoMapper.java   Source Code and License 6 votes vote down vote up
protected final void renderNameVoToXPN(PersonName name, XPN xpn,ProviderSystemVo providerSystem) throws Exception
{
	LOG.debug("VoMapper renderNameVoToXPN: entry");
	if (name == null)
		return;

	xpn.getFamilyName().getSurname().setValue(name.getSurname());
	xpn.getGivenName().setValue(name.getForename());
	xpn.getSecondAndFurtherGivenNamesOrInitialsThereof().setValue(name.getMiddleName());
	if (name.getTitleIsNotNull())
		xpn.getPrefixEgDR().setValue(svc.getRemoteLookup(name.getTitle().getID(), providerSystem.getCodeSystem().getText()));
	if (name.getNameTypeIsNotNull())
	{
		xpn.getNameTypeCode().setValue(svc.getRemoteLookup(name.getNameType().getID(), providerSystem.getCodeSystem().getText()));
	}
	else
	{
		xpn.getNameTypeCode().setValue(svc.getRemoteLookup( NameType.LEGAL.getID(), providerSystem.getCodeSystem().getText()));
	}
		
	LOG.debug("VoMapper renderNameVoToXPN: exit (" + xpn.toString() + ")");
}
 
Example 6
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateConfigurationItemsControl(ProviderSystemVo voProviderSystem)
{
	if (!voProviderSystem.getConfigItemsIsNotNull())
		return;

	GenForm.grdConfigurationItemsRow row;
	for (int i = 0; i < form.grdConfigurationItems().getRows().size(); i++)
	{
		row = form.grdConfigurationItems().getRows().get(i);
		ConfigPropertyVo vo = voProviderSystem.getConfigurationProperty(row.getProperty());
		if (vo != null)
		{
			row.setValue(vo);
			row.setColValue(vo.getPropertyValue());
		}
	}

}
 
Example 7
Project: AvoinApotti   File: M05VoMapper.java   Source Code and License 6 votes vote down vote up
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception 
{
	
	try
	{
		if (isClinicType(msg))
			processClinic(msg, providerSystem);
		else
			processLocation(msg,providerSystem);
	}
	catch (Exception ex)
	{
		LOG.error(ex.getMessage(), ex);
		return HL7Utils.buildRejAck( msg.get("MSH"), "Exception. " + ex.getMessage(), HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));
	}

	Message ack = HL7Utils.buildPosAck( msg.get("MSH"), toConfigItemArray(providerSystem.getConfigItems()));
	return ack;
}
 
Example 8
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private DynamicGridRow searchForProvider(ExternalEventMappingVo vo, DynamicGridRow row) 
{
		int size = form.dyngrdList().getRows().size();
		for (int i = 0; i < size; i++) 
		{
			ProviderSystemVo voProvoder = vo.getProviderSystem();

			if (form.dyngrdList().getRows().get(i).getIdentifier().equals(PROVIDER) &&
					form.dyngrdList().getRows().get(i).getCells().get(getColumn(COLPROVIDER)).getValue().equals("<b>"+voProvoder.getSystemName()+"</b>")&&
						form.dyngrdList().getRows().get(i).getCells().get(getColumn(COLGROUP)).getValue().equals("<b>"+vo.getGroup().getText()+"</b>") &&
							form.dyngrdList().getRows().get(i).getCells().get(getColumn(COLDETAIL)).getValue().equals("<b>"+vo.getDetail().getText()+"</b>"))// &&
							//(vo.getClinicCodeIsNotNull() || vo.getConsultantIsNotNull()) )
								return form.dyngrdList().getRows().get(i);
		}
		
	return form.dyngrdList().getRows().newRow();
}
 
Example 9
Project: AvoinApotti   File: O01VoMapper.java   Source Code and License 6 votes vote down vote up
private String getAlertsText(PatientRefVo patient,ProviderSystemVo provider )
{
String [] alerts = demog.listPatientAlertsTextByTaxonomy(patient, true, provider.getCodeSystem());
if (alerts==null||alerts.length==0)
{
	return null;
}
String alertText = "Patient has alert(s): ";
for (int i=0;i<alerts.length;i++)
{
	if(i<(alerts.length-1))
	{
		alertText+=(alerts[i]+", ");
	}
	else
	{
		alertText+=(alerts[i]+"\r");
	}
}
return alertText;
}
 
Example 10
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
protected void populateScreenFromData(ProviderSystemVo voProviderSystem)
{
	if (voProviderSystem == null)
		return;

	form.cmbIdComp().setValue(voProviderSystem.getIdtypeComponent());
	super.populateScreenFromData(voProviderSystem);
	
	// Populate Configuration Items
	if (voProviderSystem.getConfigItemsIsNotNull())
	{
		GenForm.grdConfigItemsRow row;
		form.grdConfigItems().getRows().clear();
		for (int i=0; i<voProviderSystem.getConfigItems().size(); i++)
		{
			ConfigPropertyVo vo = voProviderSystem.getConfigItems().get(i);
			row = form.grdConfigItems().getRows().newRow();
			row.setProperty(vo.getPropertyName());
			if (vo.getPropertyValueIsNotNull())
			{
				//TODO review
				row.setColValue(vo.getPropertyValue().equals("TRUE")?true:false);
			}
		}
	}
}
 
Example 11
Project: AvoinApotti   File: OcsIfImpl.java   Source Code and License 5 votes vote down vote up
public ProviderSystemVo getProviderSystem(String sendingApplication)
{
	if (sendingApplication == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	List lst = factory.find(" from ProviderSystem ps where ps.hl7Application = '" + sendingApplication + "'");
	if (lst == null || lst.size() == 0)
		return null;
	
	return ProviderSystemVoAssembler.create((ProviderSystem) lst.get(0));
		
}
 
Example 12
Project: AvoinApotti   File: OcsIfImpl.java   Source Code and License 5 votes vote down vote up
public ProviderSystemVo getProviderSystem(InvestigationRefVo invVo)
{
	if (invVo == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	Investigation domInv = (Investigation)factory.getDomainObject(Investigation.class, invVo.getID_Investigation());
	return ProviderSystemVoAssembler.create(domInv.getProviderService().getProviderSystem());
}
 
Example 13
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void bindCmbProviderSystem()
{
	ProviderSystemVoCollection providerSystems = domain.listProviderSystems();
	
	if (providerSystems != null)
	{
		for (ProviderSystemVo providerSystemVo : providerSystems)
		{
			form.cmbProviderSystem().newRow(providerSystemVo, providerSystemVo.getSystemName());
		}
	}
}
 
Example 14
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateProviderSystem()
{
	ProviderSystemVo selectedProviderSystem = form.cmbProviderSystem().getValue();
	
	if(selectedProviderSystem instanceof ProviderSystemVo)
	{
		form.txtHost().setValue(selectedProviderSystem.getIPAddress());
		form.intPort().setValue(selectedProviderSystem.getIPPort());
	}
}
 
Example 15
Project: AvoinApotti   File: VoMapper.java   Source Code and License 5 votes vote down vote up
protected final void renderNextOfKinVoToNK1(NextOfKin nok, NK1 nk1,ProviderSystemVo providerSystem) throws Exception
{
	LOG.debug("VoMapper renderNextOfKinVoToNK1: entry");
	if (nok == null)
		return;

	renderNameVoToXPN(nok.getName(), nk1.getNKName(0),providerSystem);
	renderAddressVoToXAD(nok.getAddress(), nk1.getAddress(0),providerSystem);

	CommChannelVo voWork = nok.getCommunicationChannel(ChannelType.WORK_PHONE);
	if (voWork != null)
		nk1.getBusinessPhoneNumber(0).getAnyText().setValue(voWork.getCommValue());
	CommChannelVo vo = nok.getCommunicationChannel(ChannelType.HOME_PHONE);
	if (vo != null)
	{
		nk1.getPhoneNumber(0).getAnyText().setValue(vo.getCommValue());
	}
	else
	{
		// wdev-3087 Check if home phone is set at address level
		if (nok.getAddressIsNotNull() && nok.getAddress().getPhoneIsNotNull())
			nk1.getPhoneNumber(0).getAnyText().setValue(nok.getAddress().getPhone());
	}

	if (nok.getRelationshipIsNotNull())
		nk1.getRelationship().getIdentifier().setValue(svc.getRemoteLookup(nok.getRelationship().getID(), providerSystem.getCodeSystem().getText()));

	LOG.debug("VoMapper renderNextOfKinVoToNK1: exit (" + nk1.toString() + ")");
}
 
Example 16
Project: AvoinApotti   File: I14VoMapper.java   Source Code and License 5 votes vote down vote up
private void processMessage(Message msg, ProviderSystemVo providerSystem) throws Exception 
{
	RF1 rf1 = (RF1) msg.get("RF1");

	// Identify the Patient, Register if required
	Patient patient = savePatient(msg, providerSystem);

	
	// Get the external referral identifier which is unique per referral
	String rkey = rf1.getOriginatingReferralIdentifier().getEntityIdentifier().getValue();
	
	// See if a referral exists for this patient and referral key
	// if so, we will update it, if not, create it
	HL7ReferralVo referral = hL7PathwayIf.getReferralByPatientAndRKEY(patient, rkey);

	// If this message is an instance of I13 and the referral is not found, reject
	// the message as I13 is a referral update message
	if (referral == null)
		throw new HL7Exception("Referral not found, this referral cannot be cancelled");
	
	referral.setIsActive(Boolean.FALSE);
	String[] errors = referral.validate();
	if (errors != null && errors.length > 0)
	{
		StringBuffer errStr = new StringBuffer();
		for (int i=0; i<errors.length; i++)
		{
			if (i >0)
				errStr.append(". ");
			errStr.append(errors[i]);
		}
		throw new HL7Exception("Referral Validation Failed - " + errStr.toString());
	}
	hL7PathwayIf.saveReferral(referral);
	
	// Message Processed
	return;
}
 
Example 17
Project: AvoinApotti   File: HL7EngineOutbound.java   Source Code and License 5 votes vote down vote up
private String generateA40Message(PatientRefVo patient, PatientRefVo priorPatient, PatientIdCollection priorPatIds, String hl7Application, ProviderSystemVo providerSystem) throws HL7Exception
{
	Message msg;
	a40mapper.processedCount++;
	try
	{
		msg = a40mapper.populateMessage(patient, priorPatient, priorPatIds, hl7Application, providerSystem);
		if (msg != null)
		{
			String ret = parser.encode(msg);
			a40mapper.successCount++;
			a40mapper.lastSuccessDateTime = new DateTime();
			a40mapper.lastSuccessMessage = ret;
			return ret;
		}
	}
	catch (Exception e)
	{
		a40mapper.errorCount++;
		a40mapper.lastFailedDateTime = new DateTime();
		throw new HL7Exception("Exception occurred generating ADT Message for HL7App - " + hl7Application + " - " + e.getMessage(), e);
	}

	a40mapper.errorCount++;
	a40mapper.lastFailedDateTime = new DateTime();
	throw new HL7Exception("generateA40Message: A null message cannot be parsed!");
}
 
Example 18
Project: AvoinApotti   File: VoMapper.java   Source Code and License 5 votes vote down vote up
private PersonTitle getTitleLookup(String titleTxt,ProviderSystemVo providerSystem)
{
	if (titleTxt == null)
		return null;
	String modifiedText = titleTxt.toUpperCase().trim().replaceAll("\\.", "");
	PersonTitle titleValue =(PersonTitle) svc.getLocalLookup(PersonTitle.class, PersonTitle.TYPE_ID, providerSystem.getCodeSystem().getText(), modifiedText);
	if (titleValue != null)
		return titleValue;
	else
		return (PersonTitle)addLookupInstanceMapping(PersonTitle.class, PersonTitle.TYPE_ID, titleTxt, modifiedText, providerSystem.getCodeSystem().getText());
}
 
Example 19
Project: AvoinApotti   File: VoMapper.java   Source Code and License 5 votes vote down vote up
protected final void renderAddressVoToXAD(PersonAddress pa, XAD xad,ProviderSystemVo providerSystem) throws Exception
{
	LOG.debug("VoMapper renderAddressVoToXAD: entry");
	if (pa == null)
		return;

	xad.getStreetAddress().getStreetOrMailingAddress().setValue(pa.getLine1());
	xad.getOtherDesignation().setValue(pa.getLine2());
	xad.getCity().setValue(pa.getLine3());
	xad.getStateOrProvince().setValue(pa.getLine4());
	xad.getOtherGeographicDesignation().setValue(pa.getLine5());
	xad.getZipOrPostalCode().setValue(pa.getPostCode());

	if (pa.getCountyIsNotNull())
		xad.getCountyParishCode().setValue(svc.getRemoteLookup(pa.getCounty().getID(), providerSystem.getCodeSystem().getText()));
	
	if(pa.getAddressTypeIsNotNull())
	{
		xad.getAddressType().setValue(svc.getRemoteLookup(pa.getAddressType().getID(), providerSystem.getCodeSystem().getText()));
	}
	else
	{
		xad.getAddressType().setValue(svc.getRemoteLookup(AddressType.PERMANENT.getID(), providerSystem.getCodeSystem().getText()));
	}

	LOG.debug("VoMapper renderAddressVoToXAD: exit (" + xad.toString() + ")");
}
 
Example 20
Project: AvoinApotti   File: VoMapper.java   Source Code and License 5 votes vote down vote up
protected final void renderMaximsIdentifier(Integer ID,PID pid,ProviderSystemVo providerSystem)throws Exception
{
	if(null==ID||null==pid||null==providerSystem)
		return;
	int identiferCount=pid.getPatientIdentifierList().length;
	CX maximsID=pid.getPatientIdentifierList(identiferCount);
	maximsID.getID().setValue(ID.toString());
	if (providerSystem.getIdtypeComponent().intValue() == 4)
		maximsID.getAssigningAuthority().getNamespaceID().setValue("MAXIMS");
	else
		maximsID.getIdentifierTypeCode().setValue("MAXIMS");
}
 
Example 21
Project: AvoinApotti   File: VoMapper.java   Source Code and License 5 votes vote down vote up
protected final void renderMemberOfStaffShortVoToXCN(MemberOfStaffShortVo mos, XCN xcn,ProviderSystemVo providerSystem) throws DataTypeException
{
	LOG.debug("VoMapper renderMemberOfStaffShortVoToXCN: entry");

	xcn.getGivenName().setValue(mos.getName().getForename());
	xcn.getFamilyName().getSurname().setValue(mos.getName().getSurname());
	TaxonomyMap mapping = mos.getExternalCode(providerSystem.getCodeSystem());
	if (mapping != null)
	{
		xcn.getIDNumber().setValue(mapping.getTaxonomyCode());			
	}
	LOG.debug("VoMapper renderMemberOfStaffShortVoToXCN: exit");

}
 
Example 22
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateInstanceControl(ProviderSystemVo voProviderSystem)
{
	clearInstanceControls();

	if (voProviderSystem != null)
	{
		populateIpAddressesInstanceControls(voProviderSystem);
		form.cmbIdComponent().setValue(voProviderSystem.getIdtypeComponent());
		super.populateScreenFromData(voProviderSystem);

		populateConfigurationItemsControl(voProviderSystem);
	}

}
 
Example 23
Project: AvoinApotti   File: VoMapper.java   Source Code and License 5 votes vote down vote up
protected void populateMSH(ProviderSystemVo proVo, MSH msh, String messageControlID,
		String messageType, String triggerEvent) throws DataTypeException, Exception {
	LOG.debug("VoMapper populateMSH: entry");
	renderDateTimeVoToTS(new DateTime(), msh.getDateTimeOfMessage());

	String receivingFacility=null;
	ConfigPropertyVo prop = proVo.getConfigurationProperty(ConfigItems.Hl7Facility);
	if (prop != null)
	{
		receivingFacility = prop.getPropertyValue();
	}
	if (receivingFacility == null)
		receivingFacility = cfg.getReceivingFacility();

	String processingId=null;
	ConfigPropertyVo hl7Prop = proVo.getConfigurationProperty(ConfigItems.ProcessingID);
	if (hl7Prop != null)
	{
		processingId=hl7Prop.getPropertyValue();
	}
	if (processingId == null)
		processingId = cfg.getProcessingId();

	msh.getSendingApplication().getNamespaceID().setValue(cfg.getSendApplication());	
	msh.getSendingFacility().getNamespaceID().setValue(cfg.getSendFacility()); 
	msh.getFieldSeparator().setValue("|");  
	msh.getEncodingCharacters().setValue("^~\\&");
	msh.getReceivingFacility().getNamespaceID().setValue(receivingFacility);
	msh.getReceivingApplication().getNamespaceID().setValue(proVo.getHl7Application());
	msh.getVersionID().getVersionID().setValue("2.4");
	msh.getMessageType().getMessageType().setValue(messageType);
	msh.getMessageType().getTriggerEvent().setValue(triggerEvent);
	msh.getProcessingID().getProcessingID().setValue(processingId);  // Debug / Production / Training
	msh.getMessageControlID().setValue(messageControlID);
	//		order.getMSH().getMessageControlID().setValue(new String() + new java.util.Date().getTime());
	LOG.debug("VoMapper populateMSH: exit");

}
 
Example 24
Project: AvoinApotti   File: A12VoMapper.java   Source Code and License 5 votes vote down vote up
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
	a02mapper = (A02VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.A02);
	if (a02mapper == null)
	{
		throw new HL7Exception("A12 mapper requires A02 mapper. A02 mapper not found in list of registerd mappers.");			
	}
	return(a02mapper.processPatientTransfer(msg, providerSystem));
}
 
Example 25
Project: AvoinApotti   File: A21VoMapper.java   Source Code and License 5 votes vote down vote up
protected Message processPatientLeave(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
	try
	{
		
		PatientShort patVo = (PatientShort)getPrimaryIdFromPid(msg, providerSystem);
		
		if (patVo != null)
		{
			patVo = getDemog().getPatient(patVo);
			
			if (patVo == null)
				return HL7Utils.buildRejAck(msg.get("MSH"), "This patient has not been registered within the system", HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));

			String eventCode = HL7Utils.getEventCode(msg);
			if (eventCode.equals("A21") || eventCode.equals("A53"))  // A21 set's patient on leave, A53 cancels the cancelled Patient Leave i.e. sets them on leave again
				adt.recordInpatientLeave(patVo);
			else if (eventCode.equals("A22") || eventCode.equals("A52"))  // Cancel Patient's Leave
			{
				PV1 pv1 = (PV1) msg.get("PV1");
				LocShortVo loc = null;
				loc = orgLoc.getLocationByTaxonomyType(pv1.getAssignedPatientLocation().getPointOfCare().getValue(), TaxonomyType.PAS);
				patVo.setWard(loc);
				adt.cancelInpatientLeave(patVo);  // A22
			}
		}
	}
	catch (StaleObjectException ex)
	{
		return HL7Utils.buildRejAck( msg.get("MSH"), "StaleObjectException occured recording Inpatient Leave - " + ex.getMessage(), HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));
	}

	Message ack = HL7Utils.buildPosAck( msg.get("MSH"), toConfigItemArray(providerSystem.getConfigItems()));
	return ack;
}
 
Example 26
Project: AvoinApotti   File: A40VoMapper.java   Source Code and License 5 votes vote down vote up
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
	a34mapper = (A34VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.A34);
	if (a34mapper == null)
	{
		throw new HL7Exception("A40 mapper requires A34 mapper. A34 mapper not found in list of registerd mappers.");			
	}
	
	return(a34mapper.processPatientMerge(msg, providerSystem));

}
 
Example 27
Project: AvoinApotti   File: A40VoMapper.java   Source Code and License 5 votes vote down vote up
private final void renderPatidCollectionToMrg(PatientIdCollection coll, MRG mrg, ProviderSystemVo providerSystem) throws Exception
{
	if (coll == null)
		return;
	LOG.debug("VoMapper renderPatidCollectionToMrg: entry");
	int posInMsg=0;
	for (int i = 0; i < coll.size(); i++)
	{
		PatientId patId = coll.get(i);
		
		//http://jira/browse/WDEV-10022
		if(ConfigFlag.HL7.SEND_ONLY_VERIFIED_NHSN.getValue()==true 
				&&patId.getTypeIsNotNull()&&patId.getType().equals(PatIdType.NHSN)
				&&(!patId.getVerifiedIsNotNull()||patId.getVerified()==false))
		{
			
			continue;
		}
		String patIdType = svc.getRemoteLookup(patId.getType().getID(), providerSystem.getCodeSystem().getText());
		if (patIdType == null)
		{
			continue;
		}
		CX id1 = mrg.getPriorPatientIdentifierList(posInMsg);
		posInMsg++;
		renderPatientIdtoCX( patId,id1, providerSystem);
		if(patId.getType().equals(providerSystem.getPrimaryPatientId()))
		{
			CX accNum = mrg.getPriorPatientAccountNumber();
			renderPatientIdtoCX( patId,accNum, providerSystem);
		}
	}
	LOG.debug("VoMapper renderPatidCollectionToMrg: exit");
}
 
Example 28
Project: AvoinApotti   File: A40VoMapper.java   Source Code and License 5 votes vote down vote up
private final void renderPatientIdtoCX(PatientId patId,CX cx,ProviderSystemVo providerSystem) throws Exception
{
	if (null==patId.getType())
		return;
	String patIdType = svc.getRemoteLookup(patId.getType().getID(), providerSystem.getCodeSystem().getText());
	if (patIdType == null)
		return;
	
	if (patId.getType().equals(PatIdType.NHSN))
		cx.getID().setValue((patId.getValue()!=null)?patId.getValue().replace(" ", ""):null);

	else
		cx.getID().setValue(patId.getValue());

	if (providerSystem.getIdtypeComponent().intValue() == 4)
		cx.getAssigningAuthority().getNamespaceID().setValue(patIdType);
	else
		cx.getIdentifierTypeCode().setValue(patIdType);
	
	if (patId.getType().equals(PatIdType.NHSN))
	{
		if(patId.getVerifiedIsNotNull()&&patId.getVerified())
		{
			cx.getCheckDigit().setValue("V");
			cx.getCodeIdentifyingTheCheckDigitSchemeEmployed().setValue("MAXIMS");
		}
	}
}
 
Example 29
Project: AvoinApotti   File: HL7EngineOutbound.java   Source Code and License 5 votes vote down vote up
private String generateA47Message(PatientRefVo patient, String hl7Application, ProviderSystemVo providerSystem) throws HL7Exception
{
	Message msg;
	a47mapper.processedCount++;
	try
	{
		msg = a47mapper.populateMessage(patient, hl7Application, providerSystem);
		if (msg != null)
		{
			String ret = parser.encode(msg);
			a47mapper.successCount++;
			a47mapper.lastSuccessDateTime = new DateTime();
			a47mapper.lastSuccessMessage = ret;
			return ret;
		}
	}
	catch (Exception e)
	{
		a47mapper.errorCount++;
		a47mapper.lastFailedDateTime = new DateTime();
		throw new HL7Exception("Exception occurred generating ADT Message for HL7App - " + hl7Application + " - " + e.getMessage(), e);
	}

	a47mapper.errorCount++;
	a47mapper.lastFailedDateTime = new DateTime();
	throw new HL7Exception("generateA47Message: A null message cannot be parsed!");
}
 
Example 30
Project: AvoinApotti   File: A60VoMapper.java   Source Code and License 5 votes vote down vote up
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{		
	try {
		processPatientAllergy(msg, providerSystem);
	}
	catch (Exception ex)
	{
		return HL7Utils.buildRejAck(msg.get("MSH"), ex.getClass().getName() + " occurred. " + ex.getMessage(), HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));
	}
	
	Message ack = HL7Utils.buildPosAck(msg.get("MSH"), toConfigItemArray(providerSystem.getConfigItems()));
	return ack;	
	
}
 
Example 31
Project: AvoinApotti   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
	try
	{
		processResult(msg,providerSystem);
	}
	catch (StaleObjectException soe)
	{
		try
		{
			System.out.println("Handeling SOE");
			Thread.sleep(10000);
			processResult(msg,providerSystem);
		}
		catch(Exception ie)
		{
			this.errorCount++;
			ie.printStackTrace();
			return HL7Utils.buildRejAck(msg.get("MSH"), "Exception. " + ie.getMessage(), HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));
		}
	}
	catch (Exception ex)
	{
		this.errorCount++;
		ex.printStackTrace();
		return HL7Utils.buildRejAck(msg.get("MSH"), "Exception. " + ex.getMessage(), HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));
	}

	Message ack = HL7Utils.buildPosAck(msg.get("MSH"), toConfigItemArray(providerSystem.getConfigItems()));
	return ack;
}
 
Example 32
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 33
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 34
Project: AvoinApotti   File: A28VoMapper.java   Source Code and License 5 votes vote down vote up
protected void renderPatientMedicalInsuranceToIN1(PatientMedicalInsuranceVo medicalInsurance,IN1 in1,ProviderSystemVo providerSystem) throws HL7Exception
{
	if(medicalInsurance==null||in1==null||providerSystem==null)
	{
		return;
	}
	//IN1-3
	if(medicalInsurance.getCompanyIsNotNull()&&medicalInsurance.getCompany().getCodeMappingsIsNotNull())
	{
		String companyName  = medicalInsurance.getCompany().getCodeMappings().getMappingValue(providerSystem.getCodeSystem());
		in1.getInsuranceCompanyID(0).getID().setValue(companyName);
	}
	//IN1-36
	if(medicalInsurance.getPolicyNumberIsNotNull())
	{
		in1.getPolicyNumber().setValue(medicalInsurance.getPolicyNumber());
	}
	//IN1-2
	if(medicalInsurance.getPolicyTypeIsNotNull())
	{
		in1.getInsurancePlanID().getIdentifier().setValue(svc.getRemoteLookup(medicalInsurance.getPolicyType().getID(), providerSystem.getCodeSystem().getText()));
	}
	//IN1-13
	if(medicalInsurance.getExpiryDateIsNotNull())
	{
		in1.getPlanExpirationDate().setValue(medicalInsurance.getExpiryDate().toString(DateFormat.ISO));
	}
	
}
 
Example 35
Project: AvoinApotti   File: A28VoMapper.java   Source Code and License 5 votes vote down vote up
protected void renderInsuranceToIN1(InsuranceVo insurance,IN1 in1,ProviderSystemVo providerSystem) throws HL7Exception
{
	if(insurance!=null||in1==null||providerSystem==null)
	{
	// Medical Card / Insurance	
	
	//IN1-28
		in1.getSetIDIN1().setValue("1");
		if(insurance.getHealthActCategoryIsNotNull())
		{
			in1.getPreAdmitCert().setValue(svc.getRemoteLookup(insurance.getHealthActCategory().getID(), providerSystem.getCodeSystem().getText()));
		}
	//IN1-35
	//IN1-31
		if(insurance.getMedicalCardProvedIsNotNull())
		{
			in1.getBillingStatus().setValue(svc.getRemoteLookup(insurance.getMedicalCardProved().getID(), providerSystem.getCodeSystem().getText()));
		}
	//IN1-14-3
		if(insurance.getEligibilityProofIsNotNull())
		{
			in1.getAuthorizationInformation().getSource().setValue(insurance.getEligibilityProof());
		}
	//IN1-29
		if(insurance.getMedicalCardNoIsNotNull())
		{
			in1.getCompanyPlanCode().setValue(insurance.getMedicalCardNo());
		}
	}
	
}
 
Example 36
Project: AvoinApotti   File: A28VoMapper.java   Source Code and License 5 votes vote down vote up
protected void renderEHICToIN1(InsuranceVo insurance, IN1 in1,ProviderSystemVo providerSystem) throws HL7Exception {
	if (insurance != null || in1 == null || providerSystem == null)
	{
		in1.getSetIDIN1().setValue("2");
		// IN1-2
		in1.getInsurancePlanID().getIdentifier().setValue("EHIC");
		// IN1-3
		in1.getInsuranceCompanyID(0).getID().setValue("EHIC");
		// IN1-36
		if (insurance.getEHICNumberIsNotNull())
		{
			in1.getPolicyNumber().setValue(insurance.getEHICNumber());
		}
		// IN1-13
		if (insurance.getEHICExpiryDateIsNotNull())
		{
			in1.getPlanExpirationDate().setValue(
					insurance.getEHICExpiryDate().toString(DateFormat.ISO));
		}
		// IN1-5-6
		if (insurance.getEHICCountryIsNotNull())
		{
			in1.getInsuranceCompanyAddress(0).getCountry().setValue(svc.getRemoteLookup(insurance.getEHICCountry().getID(),providerSystem.getCodeSystem().getText()));
		}
		// IN1-4
		if (insurance.getEHICInstitutionIsNotNull())
		{
			in1.getInsuranceCompanyName(0).getOrganizationName().setValue(insurance.getEHICInstitution());
		}
	}
}
 
Example 37
Project: AvoinApotti   File: A28VoMapper.java   Source Code and License 5 votes vote down vote up
private void populateMSH(ADT_A05 msg, ProviderSystemVo providerSystem) throws DataTypeException, Exception
{
	LOG.debug("A28VoMapper populateMSH: entry");
	String receivingFacility=null;
	ConfigPropertyVo prop = providerSystem.getConfigurationProperty(ConfigItems.Hl7Facility);
	if (prop != null)
	{
		receivingFacility = prop.getPropertyValue();
	}
	if (receivingFacility == null)
		receivingFacility = cfg.getReceivingFacility();
	String processingId=null;
	ConfigPropertyVo hl7Prop = providerSystem.getConfigurationProperty(ConfigItems.ProcessingID);
	if (hl7Prop != null)
	{
		processingId=hl7Prop.getPropertyValue();
	}
	if (processingId == null)
		processingId = cfg.getProcessingId();
	DateTime msgDateTime = new DateTime();
	renderDateTimeVoToTS(msgDateTime, msg.getMSH().getDateTimeOfMessage());
	msg.getMSH().getSendingApplication().getNamespaceID().setValue(cfg.getSendApplication());
	msg.getMSH().getSendingFacility().getNamespaceID().setValue(cfg.getSendFacility()); 

	msg.getMSH().getFieldSeparator().setValue("|");  
	msg.getMSH().getEncodingCharacters().setValue("^~\\&");
	msg.getMSH().getReceivingApplication().getNamespaceID().setValue(providerSystem.getHl7Application());
	msg.getMSH().getReceivingFacility().getNamespaceID().setValue(receivingFacility);
	msg.getMSH().getVersionID().getVersionID().setValue("2.4");
	msg.getMSH().getMessageType().getMessageType().setValue("ADT");
	msg.getMSH().getMessageType().getTriggerEvent().setValue("A28");
	msg.getMSH().getProcessingID().getProcessingID().setValue(processingId);  // Debug / Production / Training
	msg.getMSH().getMessageControlID().setValue(new String() + new java.util.Date().getTime());
	LOG.debug("A28VoMapper populateMSH: exit");
	
}
 
Example 38
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void newInstance()
{
	// initalise the screen for a new record
	form.getLocalContext().setSelectedRecord(new ProviderSystemVo());
	clearInstanceControls();
	// set the form mode
	form.setMode(FormMode.EDIT);
	updateIPAndHostControlsState();

}
 
Example 39
Project: AvoinApotti   File: A01VoMapper.java   Source Code and License 5 votes vote down vote up
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
	a28mapper = (A28VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.A28);
	if (a28mapper == null)
	{
		throw new HL7Exception("A01 mapper requires A28 mapper. A28 mapper not found in list of registerd mappers.");			
	}
	
	Message ack = processPatientAdmission(msg, providerSystem);
	return ack;
}
 
Example 40
Project: AvoinApotti   File: HL7EngineOutbound.java   Source Code and License 5 votes vote down vote up
private String generateA31Message(PatientRefVo patient, String hl7Application, ProviderSystemVo providerSystem) throws HL7Exception
{
	Message msg;
	a31mapper.processedCount++;
	try
	{
		msg = a31mapper.populateMessage(patient, hl7Application, providerSystem);
		if (msg != null)
		{
			String ret = parser.encode(msg);
			a31mapper.successCount++;
			a31mapper.lastSuccessDateTime = new DateTime();
			a31mapper.lastSuccessMessage = ret;
			return ret;
		}
	}
	catch (Exception e)
	{
		a31mapper.errorCount++;
		a31mapper.lastFailedDateTime = new DateTime();
		throw new HL7Exception("Exception occurred generating ADT Message for HL7App - " + hl7Application + " - " + e.getMessage(), e);
	}

	a31mapper.errorCount++;
	a31mapper.lastFailedDateTime = new DateTime();
	throw new HL7Exception("generateA31Message: A null message cannot be parsed!");
}
 
Example 41
Project: AvoinApotti   File: O20VoMapper.java   Source Code and License 5 votes vote down vote up
@Override
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception 
{
	O02VoMapper o02mapper = (O02VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.O02);
	if (o02mapper == null)
	{
		throw new HL7Exception("O20 mapper requires O02 mapper. O02 mapper not found in list of registerd mappers.");			
	}
	return o02mapper.processEvent(msg, providerSystem);
	
}
 
Example 42
Project: AvoinApotti   File: A53VoMapper.java   Source Code and License 5 votes vote down vote up
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
	a21mapper = (A21VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.A21);
	if (a21mapper == null)
	{
		throw new HL7Exception("A53 mapper requires A21 mapper. A21 mapper not found in list of registerd mappers.");			
	}
	return(a21mapper.processPatientLeave(msg, providerSystem));
}
 
Example 43
Project: AvoinApotti   File: O01VoMapper.java   Source Code and License 5 votes vote down vote up
/**
 * processMessage
 * <p> ORM^O01 message may be received from GPs.  If this is the case, and placerId will be null
 * and we need to check for the existence of the specimen.  If not found, we will create the order
 * and set wasProcessed to true so that it won't be picked up by our outbound app. </p>
 */
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
	R01VoMapper r01mapper = (R01VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.R01);
	if (r01mapper == null)
	{
		throw new HL7Exception("O02 mapper requires R01 mapper. R01 mapper not found in list of registerd mappers.");			
	}
	return r01mapper.processEvent(msg, providerSystem);
}
 
Example 44
Project: AvoinApotti   File: A22VoMapper.java   Source Code and License 5 votes vote down vote up
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
	a21mapper = (A21VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.A21);
	if (a21mapper == null)
	{
		throw new HL7Exception("A22 mapper requires A21 mapper. A21 mapper not found in list of registerd mappers.");			
	}
	return(a21mapper.processPatientLeave(msg, providerSystem));
}
 
Example 45
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateInstanceControl(ProviderSystemVo voProviderSystem)
{
	clearInstanceControls();

	if (voProviderSystem != null)
	{
		populateIpAddressesInstanceControls(voProviderSystem);
		form.cmbIdComponent().setValue(voProviderSystem.getIdtypeComponent());
		super.populateScreenFromData(voProviderSystem);

		populateConfigurationItemsControl(voProviderSystem);
	}

}
 
Example 46
Project: AvoinApotti   File: A31VoMapper.java   Source Code and License 5 votes vote down vote up
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
	a28mapper = (A28VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.A28);
	if (a28mapper == null)
	{
		throw new HL7Exception("A31 mapper requires A28 mapper. A28 mapper not found in list of registerd mappers.");			
	}
	return(a28mapper.processPatientUpdate(msg, providerSystem));
}
 
Example 47
Project: AvoinApotti   File: A31VoMapper.java   Source Code and License 5 votes vote down vote up
public Message populateMessage(PatientRefVo patient, String hl7Application,ProviderSystemVo providerSystem) throws Exception
{
	a28mapper = (A28VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.A28);
	if (a28mapper == null)
	{
		throw new HL7Exception("A31 mapper requires A28 mapper. A28 mapper not found in list of registerd mappers.");			
	}
	ADT_A05 msg =(ADT_A05)a28mapper.populateMessage(patient,hl7Application,providerSystem);
	EVN evn = msg.getEVN();
	evn.getEventTypeCode().setValue("A31");
	msg.getMSH().getMessageType().getTriggerEvent().setValue("A31");
	return msg;
}
 
Example 48
Project: AvoinApotti   File: O19VoMapper.java   Source Code and License 5 votes vote down vote up
@Override
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception 
{
	O01VoMapper o01mapper = (O01VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.O01);
	if (o01mapper == null)
	{
		throw new HL7Exception("O19 mapper requires O01 mapper. O01 mapper not found in list of registerd mappers.");			
	}
	return o01mapper.processEvent(msg, providerSystem);
	
}
 
Example 49
Project: AvoinApotti   File: A10VoMapper.java   Source Code and License 5 votes vote down vote up
private void populateMSH(ADT_A09 msg, ProviderSystemVo providerSystem) throws DataTypeException, Exception
{
	
	LOG.debug("A10VoMapper populateMSH: entry");
	String receivingFacility=null;
	ConfigPropertyVo prop = providerSystem.getConfigurationProperty(ConfigItems.Hl7Facility);
	if (prop != null)
	{
		receivingFacility = prop.getPropertyValue();
	}
	if (receivingFacility == null)
		receivingFacility = cfg.getReceivingFacility();
	String processingId=null;
	ConfigPropertyVo hl7Prop = providerSystem.getConfigurationProperty(ConfigItems.ProcessingID);
	if (hl7Prop != null)
	{
		processingId=hl7Prop.getPropertyValue();
	}
	if (processingId == null)
		processingId = cfg.getProcessingId();
	DateTime msgDateTime = new DateTime();
	renderDateTimeVoToTS(msgDateTime, msg.getMSH().getDateTimeOfMessage());
	msg.getMSH().getSendingApplication().getNamespaceID().setValue(cfg.getSendApplication());
	msg.getMSH().getSendingFacility().getNamespaceID().setValue(cfg.getSendFacility()); 

	msg.getMSH().getFieldSeparator().setValue("|");  
	msg.getMSH().getEncodingCharacters().setValue("^~\\&");
	msg.getMSH().getReceivingApplication().getNamespaceID().setValue(providerSystem.getHl7Application());
	msg.getMSH().getReceivingFacility().getNamespaceID().setValue(receivingFacility);
	msg.getMSH().getVersionID().getVersionID().setValue("2.4");
	msg.getMSH().getMessageType().getMessageType().setValue("ADT");
	msg.getMSH().getMessageType().getTriggerEvent().setValue("A10");
	msg.getMSH().getProcessingID().getProcessingID().setValue(processingId);  // Debug / Production / Training
	msg.getMSH().getMessageControlID().setValue(new String() + new java.util.Date().getTime());
	LOG.debug("A10VoMapper populateMSH: exit");
	
}
 
Example 50
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void newInstance()
{
	if (allowNew())
	{
		// initalise the screen for a new record
		form.getLocalContext().setSelectedRecord(new ProviderSystemVo());
		clearInstanceControls();
		// set the form mode
		form.setMode(FormMode.EDIT);
		updateIPAndHostControlsState();
		// set any control status specific this form
	}

}
 
Example 51
Project: AvoinApotti   File: A52VoMapper.java   Source Code and License 5 votes vote down vote up
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
	a21mapper = (A21VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.A21);
	if (a21mapper == null)
	{
		throw new HL7Exception("A52 mapper requires A21 mapper. A21 mapper not found in list of registerd mappers.");			
	}
	return(a21mapper.processPatientLeave(msg, providerSystem));
}
 
Example 52
Project: AvoinApotti   File: I13VoMapper.java   Source Code and License 5 votes vote down vote up
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
	i12mapper = (I12VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.I12);
	if (i12mapper == null)
	{
		throw new HL7Exception("I13 mapper requires I12 mapper. I12 mapper not found in list of registerd mappers.");			
	}
	return(i12mapper.processEvent(msg, providerSystem));
}
 
Example 53
Project: AvoinApotti   File: O02VoMapper.java   Source Code and License 5 votes vote down vote up
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception 
{
	R01VoMapper r01mapper = (R01VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.R01);
	if (r01mapper == null)
	{
		throw new HL7Exception("O02 mapper requires R01 mapper. R01 mapper not found in list of registerd mappers.");			
	}
	return r01mapper.processEvent(msg, providerSystem);
}
 
Example 54
Project: AvoinApotti   File: Logic.java   Source Code and License 4 votes vote down vote up
private void updateControlsState()
{
	form.btnSend().setEnabled(form.txtMessage().getValue() != null && form.txtMessage().getValue().length() > 0 && form.cmbProviderSystem().getValue() instanceof ProviderSystemVo);
	form.btnTest().setEnabled(form.cmbProviderSystem().getValue() instanceof ProviderSystemVo);
	form.txtHost().setTooltip(form.txtHost().getValue() != null ? form.txtHost().getValue(): "Please enter the Provider System Name"); //WDEV-16213
}
 
Example 55
Project: AvoinApotti   File: VoMapper.java   Source Code and License 4 votes vote down vote up
public Patient savePatient(Message msg, ProviderSystemVo providerSystem) throws Exception
{
	return savePatient(msg, providerSystem, true);
}
 
Example 56
Project: AvoinApotti   File: VoMapper.java   Source Code and License 4 votes vote down vote up
protected Patient getPrimaryIdFromPid(PID pid, ProviderSystemVo providerSystem) throws HL7Exception
{
	CX[] idList = pid.getPatientIdentifierList();
	return getPrimaryIdPatient(idList, providerSystem);
}
 
Example 57
Project: AvoinApotti   File: VoMapper.java   Source Code and License 4 votes vote down vote up
private Patient getPrimaryIdPatient(CX[] idList, ProviderSystemVo providerSystem) throws HL7Exception
{
	LOG.debug("VoMapper getPrimaryIdPatient - entry");
	
	Patient vo = new Patient();
	if (idList.length == 0)
		throw new HL7Exception("PID must contain Primary Patient ID Type : " + providerSystem.getPrimaryPatientId().getText());
	
	if (providerSystem.getPrimaryPatientId() == null || providerSystem.getIdtypeComponent() == null)
		throw new HL7Exception("Provider System " + providerSystem.getSystemName() + " must specify ID Component and Primary Patient ID Type "); 
	
	PatientIdCollection coll = new PatientIdCollection();
	for (int i = 0; i < idList.length; i++)
	{
		String idType;
		if (providerSystem.getIdtypeComponent().intValue() == 4)
		{
			idType = idList[i].getAssigningAuthority().getNamespaceID().getValue();
		}
		else if (providerSystem.getIdtypeComponent().intValue() == 5)
		{
			idType = idList[i].getIdentifierTypeCode().getValue();
		}
		else
		{
			idType = idList[i].getIdentifierTypeCode().getValue();
		}
			
		if (idType == null)
		{
			throw new HL7Exception("Identifier type code must be sent in the configured component C" + providerSystem.getIdtypeComponent() + " for all repetitions of CX.");
		}
		
		// If the value is null then move to the next in the list
		String idVal = idList[i].getID().getValue();
		if (idVal == null||"".equals(idVal)||Hl7Null.equals(idVal)) //http://jira/browse/WDEV-13709
			continue;
		

		PatIdType providedType = (PatIdType) getDemog().getLookupService().getLocalLookup(PatIdType.class, PatIdType.TYPE_ID, providerSystem.getCodeSystem().getText(), idType);
		if (providedType != null && providedType.equals(providerSystem.getPrimaryPatientId()))
		{
			if (providedType != null)
			{
				//JME: 20060119: for all id types, remove the leading char.					
				if (providerSystem.getCodeSystem().getText().equals("PAS") && !providedType.equals(PatIdType.NHSN) && !providedType.equals(PatIdType.DISTRICT) && ConfigFlag.HL7.HL7_STRIP_PATIENT_IDENTIFIER_CHARACTER.getValue())
					idVal = idVal.substring(1);

				PatientId patid = new PatientId();
				patid.setType(providedType);
				patid.setValue(idVal.trim());
				//wdev-8055
				if (providedType.equals(PatIdType.NHSN) && idList[i].getCheckDigit().getValue() != null && idList[i].getCheckDigit().getValue().equals("V")) 
					patid.setVerified(true);
				else
					patid.setVerified(false);
				coll.add(patid);
			}
			else
			{					
				throw new HL7Exception("Lookup Mapping for Primary Patient ID Type not available : " + providerSystem.getPrimaryPatientId() + " ExternalCode=" + providerSystem.getCodeSystem().getText());
			}
		}
	}
	
	// wdev-4259
	if (coll != null && coll.size() > 0)
	{
		vo.setIdentifiers(coll);
		LOG.debug("VoMapper getPrimaryIdPatient - exit");
		return vo;
	}

	throw new HL7Exception("PID must contain Primary Patient ID Type : " + providerSystem.getPrimaryPatientId());
}
 
Example 58
Project: AvoinApotti   File: VoMapper.java   Source Code and License 4 votes vote down vote up
protected PatientIdCollection getIdentifiersFromPid(PID pid, ProviderSystemVo providerSystem, PatIdType patIdType) throws HL7Exception
{
	CX[] idList = pid.getPatientIdentifierList();
	return getIdentifiersFromPid(idList, providerSystem,patIdType);
}
 
Example 59
Project: AvoinApotti   File: VoMapper.java   Source Code and License 4 votes vote down vote up
public NextOfKin populateNextOfKinVoFromNK1(NK1 nk1,ProviderSystemVo providerSystem) throws HL7Exception
{
	return (populateNextOfKinVoFromNK1(new NextOfKin(), nk1,providerSystem));
}
 
Example 60
Project: AvoinApotti   File: VoMapper.java   Source Code and License 4 votes vote down vote up
public InpatientEpisodeVo fillEpisFromMsg(Message msg, OrganisationAndLocation orgLoc, HcpAdmin hcpAdmin,ProviderSystemVo providerSystem) throws Exception
{
	return fillEpisFromMsg(new InpatientEpisodeVo(), msg, orgLoc, hcpAdmin,providerSystem);
}