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

The following are top voted examples for showing how to use ca.uhn.hl7v2.model.v24.segment.PV1. 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: A04NasMapper.java   Source Code and License 6 votes vote down vote up
public ImsNasMsg translate(Message msg) throws Exception 
{
	if (conn == null) 
	{
		throw new Exception("Cannot operate without connection to NAS Server.");
	}
	
	PV1 pv1 = (PV1) msg.get(SegName.PV1);
	String tmpVal = pv1.getPatientClass().getValue(); 
	if (tmpVal != null && tmpVal.equalsIgnoreCase("O"))
	{
		NasMapper mapper = HL7NasApplication.getNasMapper("A05");
		if (mapper == null)
		{
			throw new Exception("A04 mapper requires A05 mapper. A05 mapper not found in list of registerd mappers.");			
		}
		mapper.setConnection(conn);
		return mapper.translate(msg);
	}
	else return null; //will just pos ack.

}
 
Example 2
Project: AvoinApotti   File: A28VoMapper.java   Source Code and License 6 votes vote down vote up
protected Message processPatientUpdate(Message msg, ProviderSystemVo providerSystem, boolean includeNok) throws HL7Exception
{
	try
	{
		Patient patVo = savePatient(msg, providerSystem, includeNok);
		PV1 pv1 = (PV1) msg.get("PV1");
		if (ConfigFlag.HL7.INSTANTIATE_EPISODE_FROM_ADT.getValue())
		{
			createCareSpell(patVo, pv1,providerSystem);
		}
	}
	catch (Exception ex)
	{
		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 3
Project: AvoinApotti   File: A03VoMapper.java   Source Code and License 6 votes vote down vote up
public CareContextRefVo getCareContextFromPV1(PV1 pv) throws DataTypeException
{
	String visitId=pv.getVisitNumber().getID().getValue() + "_" + pv.getVisitNumber().getComponent(1);
	String pasEpisodeId = pv.getAlternateVisitID().getID().getValue();
	CareContextInterfaceVo careContext;
	
	if (pasEpisodeId!=null)
	{
		careContext=careSpellDialog.getCareContextFromPasEpisodeId(pasEpisodeId,visitId);
		if (careContext!=null)
		{
			if (careContext.getEpisodeOfCare()!=null)
			{
				setCareContextContext(careContext.getID_CareContext(),careContext.getEpisodeOfCare().getID_EpisodeOfCare());
				return (CareContextRefVo)careContext;
			}
		}
	}	
	return null;
}
 
Example 4
Project: openMAXIMS   File: A04NasMapper.java   Source Code and License 6 votes vote down vote up
public ImsNasMsg translate(Message msg) throws Exception 
{
	if (conn == null) 
	{
		throw new Exception("Cannot operate without connection to NAS Server.");
	}
	
	PV1 pv1 = (PV1) msg.get(SegName.PV1);
	String tmpVal = pv1.getPatientClass().getValue(); 
	if (tmpVal != null && tmpVal.equalsIgnoreCase("O"))
	{
		NasMapper mapper = HL7NasApplication.getNasMapper("A05");
		if (mapper == null)
		{
			throw new Exception("A04 mapper requires A05 mapper. A05 mapper not found in list of registerd mappers.");			
		}
		mapper.setConnection(conn);
		return mapper.translate(msg);
	}
	else return null; //will just pos ack.

}
 
Example 5
Project: openMAXIMS   File: VoMapper.java   Source Code and License 6 votes vote down vote up
protected MedicRefVo getReferringConsultant(PV1 pv1, ProviderSystemVo providerSystem) //WDEV-20278
	{
		MedicRefVo hcp=null;
		XCN[] xcns = pv1.getReferringDoctor();
		if (xcns!=null&&xcns.length>0&&xcns[0]!=null)
		{
			hcp= populateMedicRefFromXCN(xcns[0],TaxonomyType.NAT_CONS_CODE);
		}
		if(hcp==null&&xcns.length>1&&xcns[1]!=null)
		{
			//WDEV-20278
//			hcp=populateMedicRefFromXCN(xcns[1],TaxonomyType.PAS);
			hcp = populateMedicRefFromXCN(xcns[1], providerSystem.getCodeSystem()); //WDEV-20278
		}
		return hcp;
	}
 
Example 6
Project: openMAXIMS   File: VoMapper.java   Source Code and License 6 votes vote down vote up
protected HcpMinVo getAttendingDoctor(PV1 pv1, ProviderSystemVo providerSystem) //WDEV-20278
	{
		HcpMinVo hcp=null;
		XCN[] xcns = pv1.getAttendingDoctor();
		if (xcns!=null&&xcns.length>0&&xcns[0]!=null)
		{
			hcp= populateHcpMinFromXCN(xcns[0],TaxonomyType.NAT_CONS_CODE);
		}
		if(hcp==null&&xcns.length>1&&xcns[1]!=null)
		{
			//WDEV-20278
//			hcp=populateHcpMinFromXCN(xcns[1],TaxonomyType.PAS);
			hcp = populateHcpMinFromXCN(xcns[1], providerSystem.getCodeSystem()); //WDEV-20278
		}
		return hcp;
	}
 
Example 7
Project: openMAXIMS   File: A03VoMapper.java   Source Code and License 6 votes vote down vote up
public CareContextRefVo getCareContextFromPV1(PV1 pv) throws DataTypeException
{
	String visitId=pv.getVisitNumber().getID().getValue() + "_" + pv.getVisitNumber().getComponent(1);
	String pasEpisodeId = pv.getAlternateVisitID().getID().getValue();
	CareContextInterfaceVo careContext;
	
	if (pasEpisodeId!=null)
	{
		careContext=careSpellDialog.getCareContextFromPasEpisodeId(pasEpisodeId,visitId);
		if (careContext!=null)
		{
			if (careContext.getEpisodeOfCare()!=null)
			{
				setCareContextContext(careContext.getID_CareContext(),careContext.getEpisodeOfCare().getID_EpisodeOfCare());
				return (CareContextRefVo)careContext;
			}
		}
	}	
	return null;
}
 
Example 8
Project: openMAXIMS   File: A04NasMapper.java   Source Code and License 6 votes vote down vote up
public ImsNasMsg translate(Message msg) throws Exception 
{
	if (conn == null) 
	{
		throw new Exception("Cannot operate without connection to NAS Server.");
	}
	
	PV1 pv1 = (PV1) msg.get(SegName.PV1);
	String tmpVal = pv1.getPatientClass().getValue(); 
	if (tmpVal != null && tmpVal.equalsIgnoreCase("O"))
	{
		NasMapper mapper = HL7NasApplication.getNasMapper("A05");
		if (mapper == null)
		{
			throw new Exception("A04 mapper requires A05 mapper. A05 mapper not found in list of registerd mappers.");			
		}
		mapper.setConnection(conn);
		return mapper.translate(msg);
	}
	else return null; //will just pos ack.

}
 
Example 9
Project: openMAXIMS   File: A28VoMapper.java   Source Code and License 6 votes vote down vote up
protected Message processPatientUpdate(Message msg, ProviderSystemVo providerSystem, boolean includeNok) throws HL7Exception
{
	try
	{
		Patient patVo = savePatient(msg, providerSystem, includeNok);
		PV1 pv1 = (PV1) msg.get("PV1");
		if (ConfigFlag.HL7.INSTANTIATE_EPISODE_FROM_ADT.getValue())
		{
			createCareSpell(patVo, pv1,providerSystem);
		}
	}
	catch (Exception ex)
	{
		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 10
Project: openMAXIMS   File: A03VoMapper.java   Source Code and License 6 votes vote down vote up
public CareContextRefVo getCareContextFromPV1(PV1 pv) throws DataTypeException
{
	String visitId=pv.getVisitNumber().getID().getValue() + "_" + pv.getVisitNumber().getComponent(1);
	String pasEpisodeId = pv.getAlternateVisitID().getID().getValue();
	CareContextInterfaceVo careContext;
	
	if (pasEpisodeId!=null)
	{
		careContext=careSpellDialog.getCareContextFromPasEpisodeId(pasEpisodeId,visitId);
		if (careContext!=null)
		{
			if (careContext.getEpisodeOfCare()!=null)
			{
				setCareContextContext(careContext.getID_CareContext(),careContext.getEpisodeOfCare().getID_EpisodeOfCare());
				return (CareContextRefVo)careContext;
			}
		}
	}	
	return null;
}
 
Example 11
Project: openmaxims-linux   File: A04NasMapper.java   Source Code and License 6 votes vote down vote up
public ImsNasMsg translate(Message msg) throws Exception 
{
	if (conn == null) 
	{
		throw new Exception("Cannot operate without connection to NAS Server.");
	}
	
	PV1 pv1 = (PV1) msg.get(SegName.PV1);
	String tmpVal = pv1.getPatientClass().getValue(); 
	if (tmpVal != null && tmpVal.equalsIgnoreCase("O"))
	{
		NasMapper mapper = HL7NasApplication.getNasMapper("A05");
		if (mapper == null)
		{
			throw new Exception("A04 mapper requires A05 mapper. A05 mapper not found in list of registerd mappers.");			
		}
		mapper.setConnection(conn);
		return mapper.translate(msg);
	}
	else return null; //will just pos ack.

}
 
Example 12
Project: openmaxims-linux   File: A28VoMapper.java   Source Code and License 6 votes vote down vote up
protected Message processPatientUpdate(Message msg, ProviderSystemVo providerSystem, boolean includeNok) throws HL7Exception
{
	try
	{
		Patient patVo = savePatient(msg, providerSystem, includeNok);
		PV1 pv1 = (PV1) msg.get("PV1");
		if (ConfigFlag.HL7.INSTANTIATE_EPISODE_FROM_ADT.getValue())
		{
			createCareSpell(patVo, pv1,providerSystem);
		}
	}
	catch (Exception ex)
	{
		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 13
Project: openmaxims-linux   File: A03VoMapper.java   Source Code and License 6 votes vote down vote up
public CareContextRefVo getCareContextFromPV1(PV1 pv) throws DataTypeException
{
	String visitId=pv.getVisitNumber().getID().getValue() + "_" + pv.getVisitNumber().getComponent(1);
	String pasEpisodeId = pv.getAlternateVisitID().getID().getValue();
	CareContextInterfaceVo careContext;
	
	if (pasEpisodeId!=null)
	{
		careContext=careSpellDialog.getCareContextFromPasEpisodeId(pasEpisodeId,visitId);
		if (careContext!=null)
		{
			if (careContext.getEpisodeOfCare()!=null)
			{
				setCareContextContext(careContext.getID_CareContext(),careContext.getEpisodeOfCare().getID_EpisodeOfCare());
				return (CareContextRefVo)careContext;
			}
		}
	}	
	return null;
}
 
Example 14
Project: rassyeyanie   File: NotCDUVisitFilter.java   Source Code and License 6 votes vote down vote up
public boolean shouldProcessMessage(@Body AbstractMessage body)
    throws HL7Exception
{
    PV1 pv1 = HapiUtil.get(body, PV1.class);
    String patientLocation = 
     StringUtils.defaultString(pv1
 			.getAssignedPatientLocation()
 			.getPointOfCare()
 			.getValue());

    if (patientLocation.startsWith("CDU"))
    {
    	return false;
    }
    else
    {
    	return true;
    }

}
 
Example 15
Project: AvoinApotti   File: NasMapper.java   Source Code and License 5 votes vote down vote up
protected int isPatientClassValid(Message msg,StringBuffer classVal) throws Exception
{
	/*  
	 *  The A05's produced by these conversations all seem to have PV1.2 values like 
	 *  "PREADMIT" if it's an IP or OP pre-registration or "WAITLIST" if it's an OP 
	 *  referral or IP Waiting list addition 
	 * */
	
	// if current inp or outp records exists - return and do nothing (unless msg/event
	// is to specifically manipulate a current encounter)
	PV1 pv1 = (PV1) msg.get(SegName.PV1);
	
	classVal.append(pv1.getPatientClass().getValue());
	if (classVal.toString() == null || classVal.toString().length() == 0)
	{
		return INVALID_CLASS;
	}
	else if(classVal.toString().equalsIgnoreCase("E")) // Emergency
		return INPATIENT;
	else if(classVal.toString().equalsIgnoreCase("I")) // Inpatient
		return INPATIENT;
	else if(classVal.toString().equalsIgnoreCase("O")) // Outpatient
		return OUTPATIENT;
	else if(classVal.toString().equalsIgnoreCase("P")) // Pre-admit (Inpatient and Outpatient)
		return EITHER;
	else if(classVal.toString().equalsIgnoreCase("R")) // Recurring (Inpatient and Outpatient)
		return EITHER;
	else if(classVal.toString().equalsIgnoreCase("B")) // Obstetrics
		return EITHER;
	else if(classVal.toString().equalsIgnoreCase("W")) // Waitlist
		return WAITLIST;
	else if(classVal.toString().equalsIgnoreCase("N")) // 
		return INPATIENT;		
	else
		return INVALID_CLASS;
	
}
 
Example 16
Project: AvoinApotti   File: NasMapper.java   Source Code and License 5 votes vote down vote up
protected String getVisitNumberFromPV1(PV1 pv1) throws Exception
{
	String tmpVal = "";
	//if patient type is NEWBRON use a visit number of 0 (as a visit number will not be supplied)
	/* field 18 */
	
	if (pv1.getPatientType() != null && pv1.getPatientType().getValue() != null && pv1.getPatientType().getValue().equals("NEWBORN"))
	{
		return "0";
	}else
	{
		/* field 19 */
		tmpVal = pv1.getVisitNumber().getIdentifierTypeCode().getValue();
		if (tmpVal == null || !tmpVal.equalsIgnoreCase("VISITID"))
			throw new HL7Exception("PV1.19 - Visit must have identifier of type VISITID");
		
		tmpVal = pv1.getVisitNumber().getID().getValue();
		if (tmpVal == null || tmpVal.equals(""))
			throw new HL7Exception("PV1.19 - Visit Identifier is a mandatory field");
		
		try
		{
			return tmpVal;
			
		}catch (NumberFormatException nfe)
		{
			throw new HL7Exception("PV1.19 - Visit Identifier must be a valid integer value");
		}
	}		
}
 
Example 17
Project: AvoinApotti   File: VoMapper.java   Source Code and License 5 votes vote down vote up
protected MedicRefVo getReferringConsultant(PV1 pv1)
{
	MedicRefVo hcp=null;
	XCN[] xcns = pv1.getReferringDoctor();
	if (xcns!=null&&xcns.length>0&&xcns[0]!=null)
	{
		hcp= populateMedicRefFromXCN(xcns[0],TaxonomyType.NAT_CONS_CODE);
	}
	if(hcp==null&&xcns.length>1&&xcns[1]!=null)
	{
		hcp=populateMedicRefFromXCN(xcns[1],TaxonomyType.PAS);
	}
	return hcp;
}
 
Example 18
Project: AvoinApotti   File: VoMapper.java   Source Code and License 5 votes vote down vote up
protected HcpMinVo getAttendingDoctor(PV1 pv1)
{
	HcpMinVo hcp=null;
	XCN[] xcns = pv1.getAttendingDoctor();
	if (xcns!=null&&xcns.length>0&&xcns[0]!=null)
	{
		hcp= populateHcpMinFromXCN(xcns[0],TaxonomyType.NAT_CONS_CODE);
	}
	if(hcp==null&&xcns.length>1&&xcns[1]!=null)
	{
		hcp=populateHcpMinFromXCN(xcns[1],TaxonomyType.PAS);
	}
	return hcp;
}
 
Example 19
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 20
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 21
Project: AvoinApotti   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
private boolean isGPResultMessage(Message msg)
{
	PV1 pv1=null;
	if (msg!=null&&msg instanceof ORU_R01)
	{
		pv1=((ORU_R01)msg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI().getORU_R01_PIDPD1NK1NTEPV1PV2().getORU_R01_PV1PV2().getPV1();
	}
	//WDEV-13253 
	if (pv1 != null&&pv1.getPatientClass()!=null&&pv1.getPatientClass().getValue()!=null&&pv1.getPatientClass().getValue().equals("G"))
		{
			return true;
		}
	return false;
}
 
Example 22
Project: openMAXIMS   File: NasMapper.java   Source Code and License 5 votes vote down vote up
protected int isPatientClassValid(Message msg,StringBuffer classVal) throws Exception
{
	/*  
	 *  The A05's produced by these conversations all seem to have PV1.2 values like 
	 *  "PREADMIT" if it's an IP or OP pre-registration or "WAITLIST" if it's an OP 
	 *  referral or IP Waiting list addition 
	 * */
	
	// if current inp or outp records exists - return and do nothing (unless msg/event
	// is to specifically manipulate a current encounter)
	PV1 pv1 = (PV1) msg.get(SegName.PV1);
	
	classVal.append(pv1.getPatientClass().getValue());
	if (classVal.toString() == null || classVal.toString().length() == 0)
	{
		return INVALID_CLASS;
	}
	else if(classVal.toString().equalsIgnoreCase("E")) // Emergency
		return INPATIENT;
	else if(classVal.toString().equalsIgnoreCase("I")) // Inpatient
		return INPATIENT;
	else if(classVal.toString().equalsIgnoreCase("O")) // Outpatient
		return OUTPATIENT;
	else if(classVal.toString().equalsIgnoreCase("P")) // Pre-admit (Inpatient and Outpatient)
		return EITHER;
	else if(classVal.toString().equalsIgnoreCase("R")) // Recurring (Inpatient and Outpatient)
		return EITHER;
	else if(classVal.toString().equalsIgnoreCase("B")) // Obstetrics
		return EITHER;
	else if(classVal.toString().equalsIgnoreCase("W")) // Waitlist
		return WAITLIST;
	else if(classVal.toString().equalsIgnoreCase("N")) // 
		return INPATIENT;		
	else
		return INVALID_CLASS;
	
}
 
Example 23
Project: openMAXIMS   File: NasMapper.java   Source Code and License 5 votes vote down vote up
protected String getVisitNumberFromPV1(PV1 pv1) throws Exception
{
	String tmpVal = "";
	//if patient type is NEWBRON use a visit number of 0 (as a visit number will not be supplied)
	/* field 18 */
	
	if (pv1.getPatientType() != null && pv1.getPatientType().getValue() != null && pv1.getPatientType().getValue().equals("NEWBORN"))
	{
		return "0";
	}else
	{
		/* field 19 */
		tmpVal = pv1.getVisitNumber().getIdentifierTypeCode().getValue();
		if (tmpVal == null || !tmpVal.equalsIgnoreCase("VISITID"))
			throw new HL7Exception("PV1.19 - Visit must have identifier of type VISITID");
		
		tmpVal = pv1.getVisitNumber().getID().getValue();
		if (tmpVal == null || tmpVal.equals(""))
			throw new HL7Exception("PV1.19 - Visit Identifier is a mandatory field");
		
		try
		{
			return tmpVal;
			
		}catch (NumberFormatException nfe)
		{
			throw new HL7Exception("PV1.19 - Visit Identifier must be a valid integer value");
		}
	}		
}
 
Example 24
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 25
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
private boolean isGPResultMessage(Message msg)
{
	PV1 pv1=null;
	if (msg!=null&&msg instanceof ORU_R01)
	{
		pv1=((ORU_R01)msg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI().getORU_R01_PIDPD1NK1NTEPV1PV2().getORU_R01_PV1PV2().getPV1();
	}
	//WDEV-13253 
	if (pv1 != null&&pv1.getPatientClass()!=null&&pv1.getPatientClass().getValue()!=null&&pv1.getPatientClass().getValue().equals("G"))
		{
			return true;
		}
	return false;
}
 
Example 26
Project: openMAXIMS   File: A28VoMapper.java   Source Code and License 5 votes vote down vote up
protected EventResponse processPatientUpdate(Message msg, ProviderSystemVo providerSystem, boolean includeNok) throws HL7Exception //WDEV-20112
	{
		//WDEV-20112
		EventResponse response = new EventResponse(); //WDEV-20112
		
		try
		{
			Patient patVo = savePatient(msg, providerSystem, includeNok);
			
			//WDEV-20112
			response.setPatient(patVo); //WDEV-20112
			
			PV1 pv1 = (PV1) msg.get("PV1");
			if (ConfigFlag.HL7.INSTANTIATE_EPISODE_FROM_ADT.getValue())
			{
				createCareSpell(patVo, pv1,providerSystem);
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
			//WDEV-20112
//			return HL7Utils.buildRejAck( msg.get("MSH"), "Exception. " + ex.getMessage(), HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));
			response.setMessage(HL7Utils.buildRejAck(msg.get("MSH"), "Exception: " + ex.getMessage(), HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems())));
			return response; //WDEV-20112
		}
		
		//WDEV-20112
//		Message ack = HL7Utils.buildPosAck( msg.get("MSH"), toConfigItemArray(providerSystem.getConfigItems()));
//		return ack;
		response.setMessage(HL7Utils.buildPosAck( msg.get("MSH"), toConfigItemArray(providerSystem.getConfigItems())));
		return response; //WDEV-20112
	}
 
Example 27
Project: openMAXIMS   File: A25VoMapper.java   Source Code and License 5 votes vote down vote up
public Message populateMessage(IHL7OutboundMessageHandler event)  throws Exception
	{
		LOG.debug("A25VoMapper populateMessage: entry");
		
		ADT_A21 message = new ADT_A21();
		PV1 pv1 = message.getPV1();
		PV2 pv2 = message.getPV2();
		Patient patient=null;
	
		if(event instanceof InpatientEpisodeQueueVo)
		{
			a01Vomapper = (A01VoMapper)HL7EngineApplication.getVoMapper(EvnCodes.A01);
			if(a01Vomapper==null)
			{
				throw new HL7Exception("A25 mapper requires A01 mapper. A01 mapper not found in list of registered mappers.");			
			}

			InpatientEpisodeQueueVo feedVo = (InpatientEpisodeQueueVo)event;
			ifInpatientEpisodeVo inpatientEpisode = adt.getInpatientEpisodeDetails(feedVo);
			patient = inpatientEpisode.getPatient();
			a01Vomapper.populateBasicEpisodeData(event, inpatientEpisode, pv1, pv2);	
		}
		
		populateMSH(event.getProviderSystem(), message.getMSH(), Long.toString( new java.util.Date().getTime()), "ADT", "A25");
		message.getEVN().getEventTypeCode().setValue("A25");
		
		if(patient != null)
		{
			renderPatientVoToPID(patient, message.getPID(), event.getProviderSystem());
			PD1 pd1 = message.getPD1();
			//WDEV-20993
//			renderGPDetailsToPD1(patient, pd1);
			renderGPDetailsToPD1(patient, pd1, event.getProviderSystem());
			renderPatientDetailsToPD1(patient, pd1, event.getProviderSystem()); //WDEV-22624
		}
	
		return message;
		
	}
 
Example 28
Project: openMAXIMS   File: NasMapper.java   Source Code and License 5 votes vote down vote up
protected int isPatientClassValid(Message msg,StringBuffer classVal) throws Exception
{
	/*  
	 *  The A05's produced by these conversations all seem to have PV1.2 values like 
	 *  "PREADMIT" if it's an IP or OP pre-registration or "WAITLIST" if it's an OP 
	 *  referral or IP Waiting list addition 
	 * */
	
	// if current inp or outp records exists - return and do nothing (unless msg/event
	// is to specifically manipulate a current encounter)
	PV1 pv1 = (PV1) msg.get(SegName.PV1);
	
	classVal.append(pv1.getPatientClass().getValue());
	if (classVal.toString() == null || classVal.toString().length() == 0)
	{
		return INVALID_CLASS;
	}
	else if(classVal.toString().equalsIgnoreCase("E")) // Emergency
		return INPATIENT;
	else if(classVal.toString().equalsIgnoreCase("I")) // Inpatient
		return INPATIENT;
	else if(classVal.toString().equalsIgnoreCase("O")) // Outpatient
		return OUTPATIENT;
	else if(classVal.toString().equalsIgnoreCase("P")) // Pre-admit (Inpatient and Outpatient)
		return EITHER;
	else if(classVal.toString().equalsIgnoreCase("R")) // Recurring (Inpatient and Outpatient)
		return EITHER;
	else if(classVal.toString().equalsIgnoreCase("B")) // Obstetrics
		return EITHER;
	else if(classVal.toString().equalsIgnoreCase("W")) // Waitlist
		return WAITLIST;
	else if(classVal.toString().equalsIgnoreCase("N")) // 
		return INPATIENT;		
	else
		return INVALID_CLASS;
	
}
 
Example 29
Project: openMAXIMS   File: NasMapper.java   Source Code and License 5 votes vote down vote up
protected String getVisitNumberFromPV1(PV1 pv1) throws Exception
{
	String tmpVal = "";
	//if patient type is NEWBRON use a visit number of 0 (as a visit number will not be supplied)
	/* field 18 */
	
	if (pv1.getPatientType() != null && pv1.getPatientType().getValue() != null && pv1.getPatientType().getValue().equals("NEWBORN"))
	{
		return "0";
	}else
	{
		/* field 19 */
		tmpVal = pv1.getVisitNumber().getIdentifierTypeCode().getValue();
		if (tmpVal == null || !tmpVal.equalsIgnoreCase("VISITID"))
			throw new HL7Exception("PV1.19 - Visit must have identifier of type VISITID");
		
		tmpVal = pv1.getVisitNumber().getID().getValue();
		if (tmpVal == null || tmpVal.equals(""))
			throw new HL7Exception("PV1.19 - Visit Identifier is a mandatory field");
		
		try
		{
			return tmpVal;
			
		}catch (NumberFormatException nfe)
		{
			throw new HL7Exception("PV1.19 - Visit Identifier must be a valid integer value");
		}
	}		
}
 
Example 30
Project: openMAXIMS   File: VoMapper.java   Source Code and License 5 votes vote down vote up
protected MedicRefVo getReferringConsultant(PV1 pv1)
{
	MedicRefVo hcp=null;
	XCN[] xcns = pv1.getReferringDoctor();
	if (xcns!=null&&xcns.length>0&&xcns[0]!=null)
	{
		hcp= populateMedicRefFromXCN(xcns[0],TaxonomyType.NAT_CONS_CODE);
	}
	if(hcp==null&&xcns.length>1&&xcns[1]!=null)
	{
		hcp=populateMedicRefFromXCN(xcns[1],TaxonomyType.PAS);
	}
	return hcp;
}
 
Example 31
Project: openMAXIMS   File: VoMapper.java   Source Code and License 5 votes vote down vote up
protected HcpMinVo getAttendingDoctor(PV1 pv1)
{
	HcpMinVo hcp=null;
	XCN[] xcns = pv1.getAttendingDoctor();
	if (xcns!=null&&xcns.length>0&&xcns[0]!=null)
	{
		hcp= populateHcpMinFromXCN(xcns[0],TaxonomyType.NAT_CONS_CODE);
	}
	if(hcp==null&&xcns.length>1&&xcns[1]!=null)
	{
		hcp=populateHcpMinFromXCN(xcns[1],TaxonomyType.PAS);
	}
	return hcp;
}
 
Example 32
Project: openMAXIMS   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 33
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 34
Project: openMAXIMS   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
private boolean isGPResultMessage(Message msg)
{
	PV1 pv1=null;
	if (msg!=null&&msg instanceof ORU_R01)
	{
		pv1=((ORU_R01)msg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI().getORU_R01_PIDPD1NK1NTEPV1PV2().getORU_R01_PV1PV2().getPV1();
	}
	//WDEV-13253 
	if (pv1 != null&&pv1.getPatientClass()!=null&&pv1.getPatientClass().getValue()!=null&&pv1.getPatientClass().getValue().equals("G"))
		{
			return true;
		}
	return false;
}
 
Example 35
Project: openmaxims-linux   File: NasMapper.java   Source Code and License 5 votes vote down vote up
protected int isPatientClassValid(Message msg,StringBuffer classVal) throws Exception
{
	/*  
	 *  The A05's produced by these conversations all seem to have PV1.2 values like 
	 *  "PREADMIT" if it's an IP or OP pre-registration or "WAITLIST" if it's an OP 
	 *  referral or IP Waiting list addition 
	 * */
	
	// if current inp or outp records exists - return and do nothing (unless msg/event
	// is to specifically manipulate a current encounter)
	PV1 pv1 = (PV1) msg.get(SegName.PV1);
	
	classVal.append(pv1.getPatientClass().getValue());
	if (classVal.toString() == null || classVal.toString().length() == 0)
	{
		return INVALID_CLASS;
	}
	else if(classVal.toString().equalsIgnoreCase("E")) // Emergency
		return INPATIENT;
	else if(classVal.toString().equalsIgnoreCase("I")) // Inpatient
		return INPATIENT;
	else if(classVal.toString().equalsIgnoreCase("O")) // Outpatient
		return OUTPATIENT;
	else if(classVal.toString().equalsIgnoreCase("P")) // Pre-admit (Inpatient and Outpatient)
		return EITHER;
	else if(classVal.toString().equalsIgnoreCase("R")) // Recurring (Inpatient and Outpatient)
		return EITHER;
	else if(classVal.toString().equalsIgnoreCase("B")) // Obstetrics
		return EITHER;
	else if(classVal.toString().equalsIgnoreCase("W")) // Waitlist
		return WAITLIST;
	else if(classVal.toString().equalsIgnoreCase("N")) // 
		return INPATIENT;		
	else
		return INVALID_CLASS;
	
}
 
Example 36
Project: openmaxims-linux   File: NasMapper.java   Source Code and License 5 votes vote down vote up
protected String getVisitNumberFromPV1(PV1 pv1) throws Exception
{
	String tmpVal = "";
	//if patient type is NEWBRON use a visit number of 0 (as a visit number will not be supplied)
	/* field 18 */
	
	if (pv1.getPatientType() != null && pv1.getPatientType().getValue() != null && pv1.getPatientType().getValue().equals("NEWBORN"))
	{
		return "0";
	}else
	{
		/* field 19 */
		tmpVal = pv1.getVisitNumber().getIdentifierTypeCode().getValue();
		if (tmpVal == null || !tmpVal.equalsIgnoreCase("VISITID"))
			throw new HL7Exception("PV1.19 - Visit must have identifier of type VISITID");
		
		tmpVal = pv1.getVisitNumber().getID().getValue();
		if (tmpVal == null || tmpVal.equals(""))
			throw new HL7Exception("PV1.19 - Visit Identifier is a mandatory field");
		
		try
		{
			return tmpVal;
			
		}catch (NumberFormatException nfe)
		{
			throw new HL7Exception("PV1.19 - Visit Identifier must be a valid integer value");
		}
	}		
}
 
Example 37
Project: openmaxims-linux   File: VoMapper.java   Source Code and License 5 votes vote down vote up
protected MedicRefVo getReferringConsultant(PV1 pv1)
{
	MedicRefVo hcp=null;
	XCN[] xcns = pv1.getReferringDoctor();
	if (xcns!=null&&xcns.length>0&&xcns[0]!=null)
	{
		hcp= populateMedicRefFromXCN(xcns[0],TaxonomyType.NAT_CONS_CODE);
	}
	if(hcp==null&&xcns.length>1&&xcns[1]!=null)
	{
		hcp=populateMedicRefFromXCN(xcns[1],TaxonomyType.PAS);
	}
	return hcp;
}
 
Example 38
Project: openmaxims-linux   File: VoMapper.java   Source Code and License 5 votes vote down vote up
protected HcpMinVo getAttendingDoctor(PV1 pv1)
{
	HcpMinVo hcp=null;
	XCN[] xcns = pv1.getAttendingDoctor();
	if (xcns!=null&&xcns.length>0&&xcns[0]!=null)
	{
		hcp= populateHcpMinFromXCN(xcns[0],TaxonomyType.NAT_CONS_CODE);
	}
	if(hcp==null&&xcns.length>1&&xcns[1]!=null)
	{
		hcp=populateHcpMinFromXCN(xcns[1],TaxonomyType.PAS);
	}
	return hcp;
}
 
Example 39
Project: openmaxims-linux   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 40
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 41
Project: openmaxims-linux   File: R01VoMapper.java   Source Code and License 5 votes vote down vote up
private boolean isGPResultMessage(Message msg)
{
	PV1 pv1=null;
	if (msg!=null&&msg instanceof ORU_R01)
	{
		pv1=((ORU_R01)msg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI().getORU_R01_PIDPD1NK1NTEPV1PV2().getORU_R01_PV1PV2().getPV1();
	}
	//WDEV-13253 
	if (pv1 != null&&pv1.getPatientClass()!=null&&pv1.getPatientClass().getValue()!=null&&pv1.getPatientClass().getValue().equals("G"))
		{
			return true;
		}
	return false;
}
 
Example 42
Project: rassyeyanie   File: MessageMaker.java   Source Code and License 5 votes vote down vote up
private MessageMaker(AbstractMessage message)
    throws HL7Exception
{
    this.message = message;
    this.msh = HapiUtil.getWithTerser(this.message, MSH.class);
    this.msh.getFieldSeparator().setValue("|");
    this.msh.getEncodingCharacters().setValue("^~\\&");
    this.pv1 = HapiUtil.getWithTerser(message, PV1.class);
}
 
Example 43
Project: rassyeyanie   File: StillInpatientFilter.java   Source Code and License 5 votes vote down vote up
public boolean shouldProcessMessage(@Body AbstractMessage body)
    throws HL7Exception
{
PV1 pv1 = HapiUtil.get(body, PV1.class);
 
    return StringUtils.isEmpty(pv1.getDischargeDateTime(0).getTimeOfAnEvent().getValue());
 }
 
Example 44
Project: rassyeyanie   File: NotEDVisitFilter.java   Source Code and License 5 votes vote down vote up
public boolean shouldProcessMessage(@Body AbstractMessage body)
    throws HL7Exception
{
    PV1 pv1 = HapiUtil.get(body, PV1.class);
    String patientVisit =
     StringUtils.defaultString(
     		pv1.getPv119_VisitNumber().getCx1_ID().getValue());
   return (patientVisit.startsWith("V"));
}
 
Example 45
Project: rassyeyanie   File: PriorPatientLocationFilter.java   Source Code and License 5 votes vote down vote up
@Override
protected String getValueFromMessage(AbstractMessage message)
    throws HL7Exception
{
    PV1 pv1 = HapiUtil.getWithTerser(message, PV1.class);
    return pv1.getPriorPatientLocation().getPointOfCare().getValue();
}
 
Example 46
Project: rassyeyanie   File: EDVisitFilter.java   Source Code and License 5 votes vote down vote up
public boolean shouldProcessMessage(@Body AbstractMessage body)
    throws HL7Exception
{
    PV1 pv1 = HapiUtil.getWithTerser(body, PV1.class);
    String patientVisit =           		
    		StringUtils.defaultString(pv1.getPv119_VisitNumber().getCx1_ID().getValue());
   return (patientVisit.startsWith("ED"));
}
 
Example 47
Project: rassyeyanie   File: EmptyLocationFilter.java   Source Code and License 5 votes vote down vote up
public boolean shouldProcessMessage(@Body AbstractMessage body)
    throws HL7Exception
{
    PV1 pv1 = HapiUtil.getWithTerser(body, PV1.class);
    return !StringUtils.isEmpty(pv1
        .getAssignedPatientLocation()
        .getPointOfCare()
        .getValue());
    
}
 
Example 48
Project: rassyeyanie   File: OutpatientClassFilter.java   Source Code and License 5 votes vote down vote up
public boolean shouldProcessMessage(@Body AbstractMessage body)
    throws HL7Exception
{
    PV1 pv1 = HapiUtil.get(body, PV1.class);
    String patientClass =         		
    		StringUtils.defaultString(pv1.getPatientClass().getValue());
   return (patientClass.equals("P") || patientClass.equals("O"));
}
 
Example 49
Project: rassyeyanie   File: InpatientClassFilter.java   Source Code and License 5 votes vote down vote up
public boolean shouldProcessMessage(@Body AbstractMessage body)
    throws HL7Exception
{
    PV1 pv1 = HapiUtil.get(body, PV1.class);
    String patientClass =
    		pv1.getPatientClass().getValue();
    StringUtils.defaultString(patientClass);
   return (patientClass.equals("I"));
}
 
Example 50
Project: rassyeyanie   File: AEandCDULocationFilter.java   Source Code and License 5 votes vote down vote up
public boolean shouldProcessMessage(@Body AbstractMessage body)
    throws HL7Exception
{
    PV1 pv1 = HapiUtil.getWithTerser(body, PV1.class);
    String patientLocation =            		
    		StringUtils.defaultString(pv1
             .getAssignedPatientLocation()
             .getPointOfCare()
             .getValue());
    
   return (patientLocation.equals("A+E") || patientLocation.startsWith("CDU"));
}
 
Example 51
Project: rassyeyanie   File: DischargeDisposition.java   Source Code and License 5 votes vote down vote up
@Override
protected String getValueFromMessage(AbstractMessage message)
    throws HL7Exception
{
    PV1 pv1 = HapiUtil.getWithTerser(message, PV1.class);
    return pv1.getDischargeDisposition().getValue();
}
 
Example 52
Project: rassyeyanie   File: AdmissionTypeFilter.java   Source Code and License 5 votes vote down vote up
@Override
protected String getValueFromMessage(AbstractMessage message)
    throws HL7Exception
{
    PV1 pv1 = HapiUtil.getWithTerser(message, PV1.class);
    return pv1.getAdmissionType().getValue();
}
 
Example 53
Project: rassyeyanie   File: PatientTypeFilter.java   Source Code and License 5 votes vote down vote up
@Override
protected String getValueFromMessage(AbstractMessage message)
    throws HL7Exception
{
    PV1 pv1 = HapiUtil.getWithTerser(message, PV1.class);
    return pv1.getPatientType().getValue();
}
 
Example 54
Project: rassyeyanie   File: AssignedPatientLocationFilter.java   Source Code and License 5 votes vote down vote up
@Override
protected String getValueFromMessage(AbstractMessage message)
    throws HL7Exception
{
    PV1 pv1 = HapiUtil.getWithTerser(message, PV1.class);
    return pv1.getAssignedPatientLocation().getPointOfCare().getValue();
}
 
Example 55
Project: rassyeyanie   File: EventDateMatchesAdmitDateFilter.java   Source Code and License 5 votes vote down vote up
public boolean shouldProcessMessage(@Body AbstractMessage body)
		throws Exception {

	EVN evn = HapiUtil.get(body, EVN.class);
	PV1 pv1 = HapiUtil.get(body, PV1.class);
	String eventDtm = evn.getEvn2_RecordedDateTime().getTimeOfAnEvent()
			.getValue();
	String admitDtm = pv1.getPv144_AdmitDateTime().getTimeOfAnEvent()
			.getValue();

	return StringUtils.equals(StringUtils.substring(admitDtm, 0, 8),
			StringUtils.substring(eventDtm, 0, 8));

}
 
Example 56
Project: rassyeyanie   File: ApasA31PimsA31.java   Source Code and License 5 votes vote down vote up
public void transform(PV1 pv1)
    throws HL7Exception
{
    pv1.clear();
    pv1.getPv11_SetIDPV1().setValue("1");
    pv1.getPv12_PatientClass().setValue("R");
}
 
Example 57
Project: rassyeyanie   File: SymA02PimsA01.java   Source Code and License 5 votes vote down vote up
private void transform(PV1 pv1, Segment zref, EVN evn)
    throws HL7Exception
{
    pv1.getPv12_PatientClass().setValue("I");
    for (int i = 6; i < 9; i++)
        pv1.getField(i, 0).clear();
    pv1
        .getPv19_ConsultingDoctor(0)
        .getXcn1_IDNumber()
        .setValue(zref.getField(7, 0).encode().split("\\^")[0]);
    pv1.getPv110_HospitalService().setValue(
        zref.getField(9, 0).encode().split("\\^")[0]);
    pv1.getPv122_CourtesyCode().setValue("NSP");
    pv1.getPv128_InterestCode().setValue("NSP");
    zref.getField(2, 0).parse(
        pv1.getPv144_AdmitDateTime().getTs1_TimeOfAnEvent().getValue());
    pv1
        .getPv144_AdmitDateTime()
        .getTs1_TimeOfAnEvent()
        .setValueToSecond(
            evn
                .getEvn2_RecordedDateTime()
                .getTimeOfAnEvent()
                .getValueAsCalendar());
    pv1.getPv150_AlternateVisitID().clear();
    
    zref.getField(5, 0).parse(zref.getField(5, 0).encode() + "^^DGATE");
    zref.getField(8, 0).parse(zref.getField(9, 0).encode());
    zref.getField(11, 0).parse("R^^DGATE");
    ((Varies) zref.getField(12, 0)).setData(new ST(zref.getMessage()));
    zref.getField(12, 0).clear();
}
 
Example 58
Project: rassyeyanie   File: CommonSymphonyPims.java   Source Code and License 5 votes vote down vote up
public void dispatchProcessFixture(@Body AbstractMessage to)
		throws HL7Exception {
	this.transform(HapiUtil.get(to, MSH.class));
	this.transform(HapiUtil.get(to, PID.class));
	this.transform(HapiUtil.get(to, PV1.class));
	this.transform(HapiUtil.get(to, PV2.class));
	this.transform(HapiUtil.get(to, EVN.class));
}
 
Example 59
Project: rassyeyanie   File: SymA13PimsA11.java   Source Code and License 5 votes vote down vote up
private void transformZrf(Segment zrf, PV1 pv1)
    throws HL7Exception
{
    zrf.getField(1, 0).parse("EMERG^^DGATE");
    zrf.getField(2, 0).parse(
        pv1.getPv144_AdmitDateTime().getTimeOfAnEvent().getValue());
    
    ((Varies) zrf.getField(5, 0)).setData(new XCN(zrf.getMessage()));
    zrf.getField(5, 0).parse("^^DGATE");
    
    zrf.getField(6, 0).clear();
    zrf.getField(6, 0).parse("EDCDU^^DGATE");
    
    ((Varies) zrf.getField(7, 0)).setData(new XCN(zrf.getMessage()));
    zrf.getField(7, 0).parse("^^DGATE");
    
    ((Varies) zrf.getField(8, 0)).setData(new CE(zrf.getMessage()));
    zrf.getField(8, 0).parse("^^DGATE");
    
    ((Varies) zrf.getField(9, 0)).setData(new CE(zrf.getMessage()));
    zrf.getField(9, 0).parse("^^DGATE");
    
    ((Varies) zrf.getField(10, 0)).setData(new XCN(zrf.getMessage()));
    ((Varies) zrf.getField(11, 0)).setData(new XCN(zrf.getMessage()));
    ((Varies) zrf.getField(12, 0)).setData(new XCN(zrf.getMessage()));
    zrf.getField(10, 0).parse("");
    zrf.getField(11, 0).parse("R");
    zrf.getField(12, 0).parse("");
}
 
Example 60
Project: rassyeyanie   File: SymA13PimsA13.java   Source Code and License 5 votes vote down vote up
private void transform(PV1 pv1, Segment zrf)
    throws HL7Exception
{
    pv1.getPv12_PatientClass().setValue("I");
    pv1.getPv13_AssignedPatientLocation().clear();
    pv1
        .getPv13_AssignedPatientLocation()
        .getPl1_PointOfCare()
        .setValue(pv1.getPv14_AdmissionType().getValue());
    pv1
        .getPv13_AssignedPatientLocation()
        .getPl4_Facility()
        .getHd1_NamespaceID()
        .setValue("KCH");
    pv1.getPv14_AdmissionType().setValue("21");
    pv1.getPv15_PreadmitNumber().clear();
    pv1.getPv16_PriorPatientLocation().clear();
    
    pv1.getPv114_AdmitSource().setValue("19");
    
    pv1.getPv110_HospitalService().clear();
    pv1.getPv117_AdmittingDoctor(0).clear();
    pv1.getPv118_PatientType().clear();
    
    pv1.getPv122_CourtesyCode().setValue("NSP");
    pv1.getPv128_InterestCode().setValue("NSP");
    pv1.getPv136_DischargeDisposition().clear();
    pv1.getPv136_DischargeDisposition().setValue("NSP");
    
    pv1
        .getPv137_DischargedToLocation()
        .getDld1_DischargeLocation()
        .setValue("NSP");
    
    pv1.getPv138_DietType().getCe1_Identifier().setValue("NA");
    pv1.getPv139_ServicingFacility().clear();
    pv1.getPv140_BedStatus().setValue("NSP");
}