Java Code Examples for ims.core.vo.lookups.PatIdType.TYPE_ID

The following are Jave code examples for showing how to use TYPE_ID of the ims.core.vo.lookups.PatIdType class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: AvoinApotti   File: DemographicsLocalImpl.java   View Source Code Vote up 5 votes
public ims.core.vo.Patient getPatient(PatientShort patient) throws StaleObjectException
{
	DomainFactory factory = getDomainFactory();
	PatientId intfId = null;
	if (patient.getIdentifiers() == null || patient.getIdentifiers().size() == 0 || (intfId = patient.getIdentifiers().get(0)) == null)
	{
		throw new DomainRuntimeException("Patient Get call must contain valid identifier");
	}

	String hql = " from Patient p " +
		" join p.identifiers as ids" +
		" where ids.value = :idValue " + 
		" and ids.type = :idType "; 

	java.util.List patientList = factory.find(hql, new String[]{"idValue", "idType"}, new Object[]{intfId.getValue(), getDomLookup(intfId.getType())});			
	ims.core.patient.domain.objects.Patient domPatient=null;
	if (patientList != null && !patientList.isEmpty())
	{
		// Patient Should be unique per id value and type
		if (patientList.size() > 1) 
		{
			throw new DomainRuntimeException("More than one patient found with identifier type = " + PatIdType.TYPE_ID + " and value = " + intfId.getValue());
		}
		domPatient = (ims.core.patient.domain.objects.Patient)patientList.get(0);
		return PatientAssembler.create(domPatient);
	}

	return null;
}