Java Code Examples for ims.pathways.domain.objects.PatientPathwayJourney

The following are top voted examples for showing how to use ims.pathways.domain.objects.PatientPathwayJourney. 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: PatientJourneyImpl.java   View source code 6 votes vote down vote up
public PatientJourneyInterfaceVo getPatientJourney(PatientPathwayJourneyRefVo profile, PathwayRefVo pathway) 
{
	if(profile == null)
		throw new DomainRuntimeException("Invalid profile");
	
	DomainFactory factory = getDomainFactory();
			
		PatientJourneyInterfaceVo vo = PatientJourneyInterfaceVoAssembler.create((PatientPathwayJourney)factory.getDomainObject(profile));
	
		if(vo == null)
			throw new DomainRuntimeException("Profile not found");
		
	vo.setJourneyEvents(PatientJourneyEventInterfaceVoAssembler.createPatientJourneyEventInterfaceVoCollectionFromPatientEvent(factory.find("from PatientEvent pe where pe.journey.id = " + profile.getID_PatientPathwayJourney() + " order by pe.eventDateTime, pe.id",ConfigFlag.UI.MAX_NO_OF_PATIENT_JOURNEY_EVENTS_LISTED.getValue()))); //wdev-12567
		vo.setPathwayTargets(PatientJourneyTargetInterfaceVoAssembler.createPatientJourneyTargetInterfaceVoCollectionFromPatientJourneyTarget( listCurrentPathwayJourneyTargets(factory, profile, pathway != null ? pathway : vo.getPathway())));
	return vo;
}
 
Example 2
Project: AvoinApotti   File: HL7PathwayIfImpl.java   View source code 6 votes vote down vote up
/**
 * wdev-8754
 * isTargetForCurrentClock
 * As opposed to the isPatientJourneyTargForClock method, this method checks whether the target
 * is current for the current clock in the current journey.  It doesn't check for the PathwayTarget,
 * the reason for this is because the target may be for a different pathway, but still within journey
 * and same clock.
 */
private boolean isTargetForCurrentClock(DomainFactory factory, PatientPathwayJourney journey, Target target, Integer clock)
{
	String hql = " select count(*) from PatientJourneyTarget pjt where pjt.journeyClock.id = :clock " +
	      " and pjt.pathwayJourney = :journey and pjt.pathwayTarget.target = :target";
	
	ArrayList<String> labels = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();
	labels.add("clock");
	labels.add("journey");
	labels.add("target");
	values.add(clock);
	values.add(journey);
	values.add(target);

	List lst = factory.find(hql, labels, values);
	if (lst == null || lst.size() == 0)
		return false;
	Long res = (Long) lst.get(0);
	if (res == 0)
		return false;
	
	return true;
}
 
Example 3
Project: openMAXIMS   File: DemographicsImpl.java   View source code 6 votes vote down vote up
private PatientPathwayJourney updateJourneyStatus(PatientPathwayJourney journeyDO, java.util.Date dateOfDeath)
{
	if (journeyDO == null)
		return null;
	
	PatientJourneyStatus journeyStatus = new PatientJourneyStatus();
	journeyStatus.setDateTime(dateOfDeath);
	journeyStatus.setStatus(getDomLookup(JourneyStatus.ENDPATHWAYJOURNEY));
	
	if (journeyDO.getStatusHistory() == null)
	{
		journeyDO.setStatusHistory(new HashSet());
	}		

	journeyDO.setEndedOnDate(dateOfDeath);
	journeyDO.setCurrentStatus(journeyStatus);
	journeyDO.getStatusHistory().add(journeyStatus);
	
	return journeyDO;
}
 
Example 4
Project: openMAXIMS   File: PatientJourneyComponentImpl.java   View source code 6 votes vote down vote up
public PatientJourneyInterfaceVo getPatientJourney(PatientPathwayJourneyRefVo journey)
{
	if (journey == null)
		throw new DomainRuntimeException("Invalid Journey");

	DomainFactory factory = getDomainFactory();

	PatientJourneyInterfaceVo vo = PatientJourneyInterfaceVoAssembler.create((PatientPathwayJourney) factory.getDomainObject(journey));

	if (vo == null)
		throw new DomainRuntimeException("Journey not found");

	vo.setJourneyEvents(PatientJourneyEventInterfaceVoAssembler.createPatientJourneyEventInterfaceVoCollectionFromPatientEvent(factory.find("from PatientEvent pe where pe.journey.id = " + journey.getID_PatientPathwayJourney() + " order by pe.eventDateTime, pe.id", ConfigFlag.UI.MAX_NO_OF_PATIENT_JOURNEY_EVENTS_LISTED.getValue())));
	vo.setPathwayTargets(PatientJourneyTargetInterfaceVoAssembler.createPatientJourneyTargetInterfaceVoCollectionFromPatientJourneyTarget(listCurrentPathwayJourneyTargets(factory, journey, vo.getPathway())));
	return vo;
}
 
Example 5
Project: openMAXIMS   File: PDSDemographicsImpl.java   View source code 6 votes vote down vote up
private PatientPathwayJourney updateJourneyStatus(PatientPathwayJourney journeyDO, java.util.Date dateOfDeath)
{
	if (journeyDO == null)
		return null;
	
	PatientJourneyStatus journeyStatus = new PatientJourneyStatus();
	journeyStatus.setDateTime(dateOfDeath);
	journeyStatus.setStatus(getDomLookup(JourneyStatus.ENDPATHWAYJOURNEY));
	
	if (journeyDO.getStatusHistory() == null)
	{
		journeyDO.setStatusHistory(new HashSet());
	}		

	journeyDO.setEndedOnDate(dateOfDeath);
	journeyDO.setCurrentStatus(journeyStatus);
	journeyDO.getStatusHistory().add(journeyStatus);
	
	return journeyDO;
}
 
Example 6
Project: openMAXIMS   File: TheatreSessionManagementImpl.java   View source code 6 votes vote down vote up
private void createPatientEvent(CatsReferral doCatsReferral, EventLiteVo hardCodedEvent) throws StaleObjectException
{
	PatientPathwayJourney patientJBo = doCatsReferral != null ? doCatsReferral.getJourney() : null;

	if (patientJBo != null && hardCodedEvent != null)
	{				
			PatientEventVo patEvent = new PatientEventVo();
			patEvent.setPatient((PatientRefVo)PatientListVoAssembler.create(doCatsReferral.getPatient()));
			patEvent.setEvent(hardCodedEvent);
			patEvent.setEventDateTime(patientJBo.getCurrentClock() != null && patientJBo.getCurrentClock().getCurrentPause() != null && patientJBo.getCurrentClock().getCurrentPause().getPauseStop() != null ? new DateTime( patientJBo.getCurrentClock().getCurrentPause().getPauseStop()) : new DateTime());
			patEvent.setEventStatus(EventStatus.ACTIVE);
			patEvent.setJourney(PatientJourneyVoAssembler.create(patientJBo));
			
			HL7PathwayIf implPath = (HL7PathwayIf) getDomainImpl(HL7PathwayIfImpl.class);
			try
			{
				implPath.instantiatePatientEvent(patEvent);
			}
			catch (DomainInterfaceException e)
			{throw new DomainRuntimeException("Domain Error occured in save Event " + e.getMessage(), e);}
	}		
}
 
Example 7
Project: openMAXIMS   File: PatientJourneyImpl.java   View source code 6 votes vote down vote up
public PatientJourneyInterfaceVo getPatientJourney(PatientPathwayJourneyRefVo profile, PathwayRefVo pathway) 
{
	if(profile == null)
		throw new DomainRuntimeException("Invalid profile");
	
	DomainFactory factory = getDomainFactory();
			
		PatientJourneyInterfaceVo vo = PatientJourneyInterfaceVoAssembler.create((PatientPathwayJourney)factory.getDomainObject(profile));
	
		if(vo == null)
			throw new DomainRuntimeException("Profile not found");
		
	vo.setJourneyEvents(PatientJourneyEventInterfaceVoAssembler.createPatientJourneyEventInterfaceVoCollectionFromPatientEvent(factory.find("from PatientEvent pe where pe.journey.id = " + profile.getID_PatientPathwayJourney() + " order by pe.eventDateTime, pe.id",ConfigFlag.UI.MAX_NO_OF_PATIENT_JOURNEY_EVENTS_LISTED.getValue()))); //wdev-12567
		vo.setPathwayTargets(PatientJourneyTargetInterfaceVoAssembler.createPatientJourneyTargetInterfaceVoCollectionFromPatientJourneyTarget( listCurrentPathwayJourneyTargets(factory, profile, pathway != null ? pathway : vo.getPathway())));
	return vo;
}
 
Example 8
Project: openMAXIMS   File: HL7PathwayIfImpl.java   View source code 6 votes vote down vote up
/**
 * wdev-8754
 * isTargetForCurrentClock
 * As opposed to the isPatientJourneyTargForClock method, this method checks whether the target
 * is current for the current clock in the current journey.  It doesn't check for the PathwayTarget,
 * the reason for this is because the target may be for a different pathway, but still within journey
 * and same clock.
 */
private boolean isTargetForCurrentClock(DomainFactory factory, PatientPathwayJourney journey, Target target, Integer clock)
{
	String hql = " select count(*) from PatientJourneyTarget pjt where pjt.journeyClock.id = :clock " +
	      " and pjt.pathwayJourney = :journey and pjt.pathwayTarget.target = :target";
	
	ArrayList<String> labels = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();
	labels.add("clock");
	labels.add("journey");
	labels.add("target");
	values.add(clock);
	values.add(journey);
	values.add(target);

	List lst = factory.find(hql, labels, values);
	if (lst == null || lst.size() == 0)
		return false;
	Long res = (Long) lst.get(0);
	if (res == 0)
		return false;
	
	return true;
}
 
Example 9
Project: openMAXIMS   File: HL7PathwayIfImpl.java   View source code 6 votes vote down vote up
public void takeTargetOutOfScopeWithoutEvent(PatientJourneyTargetRefVo target, PatientPathwayJourneyRefVo journey) throws DomainInterfaceException, StaleObjectException
{
	DomainFactory factory = getDomainFactory();
	
	PatientJourneyTarget domPjt = (PatientJourneyTarget) factory.getDomainObject(PatientJourneyTarget.class, target.getID_PatientJourneyTarget());
	JourneyTargetStatus tStat = createJourneyTargetStatus(getDomLookup(PatientTargetStatus.NOTINSCOPE));
	domPjt.setCurrentStatus(tStat);
	domPjt.getStatusHistory().add(tStat);
	
	// WDEV-20636
	factory.save(domPjt);
	super.createSystemLogEntry(SystemLogType.APPLICATION, SystemLogLevel.INFORMATION, "Target " + domPjt.getPathwayTarget().getTarget().getName() + " (" + domPjt.getId() + ") set to not-in-scope");
	
	PatientPathwayJourney domJourney = (PatientPathwayJourney)factory.getDomainObject(PatientPathwayJourney.class, journey.getID_PatientPathwayJourney());

	// WDEV-20416
	// If this is a 31 or 62 day target we need to update the CatsReferral details
	updateCatsReferralTargetDates(factory, domJourney, domPjt, false);
}
 
Example 10
Project: openMAXIMS   File: ElectiveListDetailsImpl.java   View source code 6 votes vote down vote up
private void createPatientEvent(CatsReferral doCatsReferral, EventLiteVo hardCodedEvent, java.util.Date erodStartDate) throws StaleObjectException
{
	PatientPathwayJourney patientJBo = doCatsReferral != null ? doCatsReferral.getJourney() : null;

	if (patientJBo != null && hardCodedEvent != null)
	{				
		PatientEventVo patEvent = new PatientEventVo();
		
		patEvent.setPatient((PatientRefVo)PatientListVoAssembler.create(doCatsReferral.getPatient()));
		patEvent.setEvent(hardCodedEvent);
		patEvent.setEventDateTime(erodStartDate != null ? new DateTime(erodStartDate) : new DateTime());
		patEvent.setEventStatus(EventStatus.ACTIVE);
		patEvent.setJourney(PatientJourneyVoAssembler.create(patientJBo));
		
		HL7PathwayIf implPath = (HL7PathwayIf) getDomainImpl(HL7PathwayIfImpl.class);
		try
		{
			implPath.instantiatePatientEvent(patEvent);
		}
		catch (DomainInterfaceException e)
		{
			throw new DomainRuntimeException("Domain Error occured in save Event " + e.getMessage(), e);
		}
	}		
}
 
Example 11
Project: openMAXIMS   File: RTTManagementImpl.java   View source code 6 votes vote down vote up
@Override
public void savePatientPathwaysAwaitingValidationWorklistVo(PatientPathwaysAwaitingValidationWorklistVo patientPathwaysAwaitingValidationWorklistVo) throws StaleObjectException
{

	if(patientPathwaysAwaitingValidationWorklistVo == null)
		throw new CodingRuntimeException("Invalid patientPathwaysAwaitingValidationWorklistVo");

	DomainFactory factory = getDomainFactory();
	PatientPathwayJourney domPatientPathwayJourney = PatientPathwaysAwaitingValidationWorklistVoAssembler.extractPatientPathwayJourney(factory, patientPathwaysAwaitingValidationWorklistVo);
	
	if (patientPathwaysAwaitingValidationWorklistVo.getValidationCompletedBy() != null
			&& patientPathwaysAwaitingValidationWorklistVo.getValidationCompletedDT() != null)
	{
		domPatientPathwayJourney.setLastValidationDate(domPatientPathwayJourney.getNextValidationDate());
		domPatientPathwayJourney.setNextValidationDate(null);
	}
	factory.save(domPatientPathwayJourney);

}
 
Example 12
Project: openMAXIMS   File: BookAppointmentImpl.java   View source code 6 votes vote down vote up
private void createNewClock(PatientPathwayJourney journeyDO, Booking_Appointment doAppt, PathwayClock currentClockDO,boolean createNow) throws StaleObjectException
{
	int X = getNumberOfClocks(journeyDO.getClockHistory());

	PathwayClock newClockDO = new PathwayClock ();
	newClockDO.setExtClockId("MAXIMS_" + X);
	newClockDO.setExtClockName("MaximsClock_" + X);
	if(createNow) //WDEV-21154 when rebooking a DNA set the clock to now
		newClockDO.setStartDate(new java.util.Date());
	else
		newClockDO.setStartDate(doAppt.getAppointmentDate());
	
	newClockDO.setCurrentRTTStatus(currentClockDO != null ? currentClockDO.getCurrentRTTStatus() : null);
	newClockDO.getRTTStatusHistory().add(currentClockDO != null ? currentClockDO.getCurrentRTTStatus() : null);
	
	journeyDO.setCurrentClock(newClockDO);
	
	if (journeyDO.getClockHistory() == null)
		journeyDO.setClockHistory(new HashSet<PathwayClock>());

	journeyDO.getClockHistory().add(newClockDO);

	getDomainFactory().save(journeyDO);
}
 
Example 13
Project: openMAXIMS   File: BookTheatreSlotDetailDialogImpl.java   View source code 6 votes vote down vote up
private void createPatientEvent(CatsReferral doCatsReferral, EventLiteVo hardCodedEvent, Date erodStartDate) throws StaleObjectException, DomainInterfaceException
{
	PatientPathwayJourney patientJBo = doCatsReferral != null ? doCatsReferral.getJourney() : null;

	if (patientJBo != null && hardCodedEvent != null)
	{
		PatientEventVo patEvent = new PatientEventVo();
		patEvent.setPatient((PatientRefVo) PatientListVoAssembler.create(doCatsReferral.getPatient()));
		patEvent.setEvent(hardCodedEvent);
		patEvent.setEventDateTime(erodStartDate != null ? new DateTime(erodStartDate) : new DateTime());
		patEvent.setEventStatus(EventStatus.ACTIVE);
		patEvent.setJourney(PatientJourneyVoAssembler.create(patientJBo));

		HL7PathwayIf implPath = (HL7PathwayIf) getDomainImpl(HL7PathwayIfImpl.class);
		implPath.instantiatePatientEvent(patEvent);
	}
}
 
Example 14
Project: openMAXIMS   File: NewElectiveListTCIErodDialogImpl.java   View source code 6 votes vote down vote up
private void createPatientEvent(CatsReferral doCatsReferral, EventLiteVo hardCodedEvent) throws StaleObjectException
{
	PatientPathwayJourney patientJBo = doCatsReferral != null ? doCatsReferral.getJourney() : null;

	if (patientJBo != null && hardCodedEvent != null)
	{				
			PatientEventVo patEvent = new PatientEventVo();
			patEvent.setPatient((PatientRefVo)PatientListVoAssembler.create(doCatsReferral.getPatient()));
			patEvent.setEvent(hardCodedEvent);		
			patEvent.setEventDateTime(patientJBo.getCurrentClock() != null && patientJBo.getCurrentClock().getCurrentPause() != null && patientJBo.getCurrentClock().getCurrentPause().getPauseStop() != null ? new DateTime( patientJBo.getCurrentClock().getCurrentPause().getPauseStop()) : new DateTime());
			patEvent.setEventStatus(EventStatus.ACTIVE);
			patEvent.setJourney(PatientJourneyVoAssembler.create(patientJBo));
			
			HL7PathwayIf implPath = (HL7PathwayIf) getDomainImpl(HL7PathwayIfImpl.class);
			try
			{
				implPath.instantiatePatientEvent(patEvent);
			}
			catch (DomainInterfaceException e)
			{throw new DomainRuntimeException("Domain Error occured in save Event " + e.getMessage(), e);}
	}		
}
 
Example 15
Project: openMAXIMS   File: NewElectiveListTCIErodDialogImpl.java   View source code 6 votes vote down vote up
private void createPatientEvent(CatsReferral doCatsReferral, EventLiteVo hardCodedEvent, java.util.Date erodStartDate) throws StaleObjectException
{
	PatientPathwayJourney patientJBo = doCatsReferral != null ? doCatsReferral.getJourney() : null;

	if (patientJBo != null && hardCodedEvent != null)
	{				
			PatientEventVo patEvent = new PatientEventVo();
			patEvent.setPatient((PatientRefVo)PatientListVoAssembler.create(doCatsReferral.getPatient()));
			patEvent.setEvent(hardCodedEvent);
			patEvent.setEventDateTime(erodStartDate != null ? new DateTime(erodStartDate) : new DateTime());
			patEvent.setEventStatus(EventStatus.ACTIVE);
			patEvent.setJourney(PatientJourneyVoAssembler.create(patientJBo));
			
			HL7PathwayIf implPath = (HL7PathwayIf) getDomainImpl(HL7PathwayIfImpl.class);
			try
			{
				implPath.instantiatePatientEvent(patEvent);
			}
			catch (DomainInterfaceException e)
			{throw new DomainRuntimeException("Domain Error occured in save Event " + e.getMessage(), e);}
	}		
}
 
Example 16
Project: openMAXIMS   File: ERODDialogImpl.java   View source code 6 votes vote down vote up
private void createPatientEvent(CatsReferral doCatsReferral, EventLiteVo hardCodedEvent, java.util.Date erodStartDate) throws StaleObjectException
{
	PatientPathwayJourney patientJBo = doCatsReferral != null ? doCatsReferral.getJourney() : null;

	if (patientJBo != null && hardCodedEvent != null)
	{				
			PatientEventVo patEvent = new PatientEventVo();
			patEvent.setPatient((PatientRefVo)PatientListVoAssembler.create(doCatsReferral.getPatient()));
			patEvent.setEvent(hardCodedEvent);
			patEvent.setEventDateTime(erodStartDate != null ? new DateTime(erodStartDate) : new DateTime());
			patEvent.setEventStatus(EventStatus.ACTIVE);
			patEvent.setJourney(PatientJourneyVoAssembler.create(patientJBo));
			
			HL7PathwayIf implPath = (HL7PathwayIf) getDomainImpl(HL7PathwayIfImpl.class);
			try
			{
				implPath.instantiatePatientEvent(patEvent);
			}
			catch (DomainInterfaceException e)
			{throw new DomainRuntimeException("Domain Error occured in save Event " + e.getMessage(), e);}
	}		
}
 
Example 17
Project: openMAXIMS   File: PatientJourneyImpl.java   View source code 6 votes vote down vote up
public PatientJourneyInterfaceVo getPatientJourney(PatientPathwayJourneyRefVo profile, PathwayRefVo pathway) 
{
	if(profile == null)
		throw new DomainRuntimeException("Invalid profile");
	
	DomainFactory factory = getDomainFactory();
			
		PatientJourneyInterfaceVo vo = PatientJourneyInterfaceVoAssembler.create((PatientPathwayJourney)factory.getDomainObject(profile));
	
		if(vo == null)
			throw new DomainRuntimeException("Profile not found");
		
	vo.setJourneyEvents(PatientJourneyEventInterfaceVoAssembler.createPatientJourneyEventInterfaceVoCollectionFromPatientEvent(factory.find("from PatientEvent pe where pe.journey.id = " + profile.getID_PatientPathwayJourney() + " order by pe.eventDateTime, pe.id",ConfigFlag.UI.MAX_NO_OF_PATIENT_JOURNEY_EVENTS_LISTED.getValue()))); //wdev-12567
		vo.setPathwayTargets(PatientJourneyTargetInterfaceVoAssembler.createPatientJourneyTargetInterfaceVoCollectionFromPatientJourneyTarget( listCurrentPathwayJourneyTargets(factory, profile, pathway != null ? pathway : vo.getPathway())));
	return vo;
}
 
Example 18
Project: openMAXIMS   File: PatientJourneyImpl.java   View source code 6 votes vote down vote up
/**
* WDEV-18474
        * saveCancerPathway
        */
public void saveCancerPathway(PatientPathwayJourneyRefVo journey, Date cancerPathwayDate) throws StaleObjectException
{
	if (journey == null || cancerPathwayDate == null)
		return;

	DomainFactory factory = getDomainFactory();
	
	PatientPathwayJourney domJourney = (PatientPathwayJourney)factory.getDomainObject(PatientPathwayJourney.class, journey.getID_PatientPathwayJourney());
	domJourney.setIsCancerPathway(true);
	domJourney.setCancerPathwayDate(cancerPathwayDate.getDate());
	factory.save(domJourney);
	
	// We now need to  check the referral type for the associated CatsReferral.  If it is GP, then we want the 62 day target in scope
	ArrayList<String> labels = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();
	labels.add("journey");
	values.add(domJourney);	
	String query = " select cat.referralDetails from CatsReferral cat where cat.journey = :journey ";
	
	List<?> referralDetails = factory.find(query, labels, values);
	if (referralDetails != null && referralDetails.size() > 0)
	{
		// There should be just one!
		ReferralLetterDetails domRefLetter = (ReferralLetterDetails) referralDetails.get(0);
		if (domRefLetter != null && domRefLetter.getReferrerType() != null &&
				domRefLetter.getReferrerType().getId() == SourceOfReferral.GP.getId())
		{
			// Find the Target 62Day
			HL7PathwayIf hl7Impl = (HL7PathwayIf) getDomainImpl(HL7PathwayIfImpl.class);
			try 
			{
				TargetRefVo target = hl7Impl.getTargetByTaxonomyMap(TaxonomyType.PAS, "62D");
				hl7Impl.bringTargetIntoScopeWithoutEvent(target, journey, cancerPathwayDate);
				
			}
			catch (DomainInterfaceException e) 
			{
				super.createSystemLogEntry(SystemLogType.APPLICATION, SystemLogLevel.WARNING, e.getMessage());
				return;
			}
		}		
	}
}
 
Example 19
Project: openMAXIMS   File: HL7PathwayIfImpl.java   View source code 6 votes vote down vote up
/**
 * wdev-8754
 * isTargetForCurrentClock
 * As opposed to the isPatientJourneyTargForClock method, this method checks whether the target
 * is current for the current clock in the current journey.  It doesn't check for the PathwayTarget,
 * the reason for this is because the target may be for a different pathway, but still within journey
 * and same clock.
 */
private boolean isTargetForCurrentClock(DomainFactory factory, PatientPathwayJourney journey, Target target, Integer clock)
{
	String hql = " select count(*) from PatientJourneyTarget pjt where pjt.journeyClock.id = :clock " +
	      " and pjt.pathwayJourney = :journey and pjt.pathwayTarget.target = :target";
	
	ArrayList<String> labels = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();
	labels.add("clock");
	labels.add("journey");
	labels.add("target");
	values.add(clock);
	values.add(journey);
	values.add(target);

	List lst = factory.find(hql, labels, values);
	if (lst == null || lst.size() == 0)
		return false;
	Long res = (Long) lst.get(0);
	if (res == 0)
		return false;
	
	return true;
}
 
Example 20
Project: openmaxims-linux   File: PatientJourneyImpl.java   View source code 6 votes vote down vote up
public PatientJourneyInterfaceVo getPatientJourney(PatientPathwayJourneyRefVo profile, PathwayRefVo pathway) 
{
	if(profile == null)
		throw new DomainRuntimeException("Invalid profile");
	
	DomainFactory factory = getDomainFactory();
			
		PatientJourneyInterfaceVo vo = PatientJourneyInterfaceVoAssembler.create((PatientPathwayJourney)factory.getDomainObject(profile));
	
		if(vo == null)
			throw new DomainRuntimeException("Profile not found");
		
	vo.setJourneyEvents(PatientJourneyEventInterfaceVoAssembler.createPatientJourneyEventInterfaceVoCollectionFromPatientEvent(factory.find("from PatientEvent pe where pe.journey.id = " + profile.getID_PatientPathwayJourney() + " order by pe.eventDateTime, pe.id",ConfigFlag.UI.MAX_NO_OF_PATIENT_JOURNEY_EVENTS_LISTED.getValue()))); //wdev-12567
		vo.setPathwayTargets(PatientJourneyTargetInterfaceVoAssembler.createPatientJourneyTargetInterfaceVoCollectionFromPatientJourneyTarget( listCurrentPathwayJourneyTargets(factory, profile, pathway != null ? pathway : vo.getPathway())));
	return vo;
}
 
Example 21
Project: openmaxims-linux   File: HL7PathwayIfImpl.java   View source code 6 votes vote down vote up
/**
 * wdev-8754
 * isTargetForCurrentClock
 * As opposed to the isPatientJourneyTargForClock method, this method checks whether the target
 * is current for the current clock in the current journey.  It doesn't check for the PathwayTarget,
 * the reason for this is because the target may be for a different pathway, but still within journey
 * and same clock.
 */
private boolean isTargetForCurrentClock(DomainFactory factory, PatientPathwayJourney journey, Target target, Integer clock)
{
	String hql = " select count(*) from PatientJourneyTarget pjt where pjt.journeyClock.id = :clock " +
	      " and pjt.pathwayJourney = :journey and pjt.pathwayTarget.target = :target";
	
	ArrayList<String> labels = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();
	labels.add("clock");
	labels.add("journey");
	labels.add("target");
	values.add(clock);
	values.add(journey);
	values.add(target);

	List lst = factory.find(hql, labels, values);
	if (lst == null || lst.size() == 0)
		return false;
	Long res = (Long) lst.get(0);
	if (res == 0)
		return false;
	
	return true;
}
 
Example 22
Project: AvoinApotti   File: BookAppointmentImpl.java   View source code 5 votes vote down vote up
public PatientJourneyVoCollection listJourneyByPatient(PatientRefVo voPatient)
{
	if (voPatient == null)
		throw new CodingRuntimeException("voPatient parameter is null in method listJourneyByPatient");

	DomainFactory factory = getDomainFactory();

	IMSCriteria imsc = new IMSCriteria(PatientPathwayJourney.class, factory);
	imsc.isNull("endedOnDate");
	imsc.equal("patient.id", voPatient.getID_Patient());
	List pathways = imsc.find();
	PatientJourneyVoCollection pathColl = PatientJourneyVoAssembler.createPatientJourneyVoCollectionFromPatientPathwayJourney(pathways);
	return pathColl;
}
 
Example 23
Project: AvoinApotti   File: PatientJourneyImpl.java   View source code 5 votes vote down vote up
public PatientJourneyCommentsVo getPatientPathwayJourney(PatientPathwayJourneyRefVo voRef)
{
	if (voRef.getID_PatientPathwayJourney() == null)
		throw new CodingRuntimeException("No id provided for Patient Journey");

	return PatientJourneyCommentsVoAssembler.create((PatientPathwayJourney) getDomainFactory().getDomainObject(voRef));
}
 
Example 24
Project: AvoinApotti   File: CreateNewPathwayImpl.java   View source code 5 votes vote down vote up
public PatientJourneyVo getPatientJourney(PatientPathwayJourneyRefVo journey)
{
	if (journey.getID_PatientPathwayJourney() == null)
		throw new CodingRuntimeException("No id provided for PatientJourney in method getPatientJourney");

	return PatientJourneyVoAssembler.create((PatientPathwayJourney) getDomainFactory().getDomainObject(journey));
}
 
Example 25
Project: AvoinApotti   File: CreateNewPathwayImpl.java   View source code 5 votes vote down vote up
public PatientJourneyShortVo getPatientJourneyShort(PatientPathwayJourneyRefVo journey)
{
	if (journey.getID_PatientPathwayJourney() == null)
		throw new CodingRuntimeException("No id provided for PatientJourney in method getPatientJourney");

	return PatientJourneyShortVoAssembler.create((PatientPathwayJourney) getDomainFactory().getDomainObject(journey));
}
 
Example 26
Project: AvoinApotti   File: HL7PathwayIfImpl.java   View source code 5 votes vote down vote up
/**
 * wdev-6362
 * recalculateTargetDates
 * This method is called when an unpause event is received.  It needs
 * to recalculate the target dates based on the difference between the paused
 * and unpaused dates
 * @param journey
 */
private void recalculateTargetDates(PatientPathwayJourney journey) 
{
	// Get all current in-scope targets
	Iterator it = journey.getPatientTargets().iterator();
	while (it.hasNext())
	{
		PatientJourneyTarget domPjt = (PatientJourneyTarget) it.next();
		domPjt.setTargetDate(addValueToDate(journey.getCurrentClock().getStartDate(), domPjt.getPathwayTarget().getTargetPeriod(), domPjt.getPathwayTarget().getPathway().getJourneyCountType(), journey.getCurrentClock(), domPjt.getTargetDate(), domPjt.getTargetCalFromDate()));
		if (domPjt.getTargetCalFromDate() == null)
			domPjt.setTargetCalFromDate(journey.getCurrentClock().getStartDate());
	}
}
 
Example 27
Project: AvoinApotti   File: HL7PathwayIfImpl.java   View source code 5 votes vote down vote up
/**
* This method will cancel the given patient journey i.e. it will set the status as ended
* and update all patient journey targets to ended
*/
public void endPatientJourney(PatientPathwayJourneyRefVo journey) throws StaleObjectException 
{
	DomainFactory factory = getDomainFactory();
	
	PatientPathwayJourney domJourney = (PatientPathwayJourney) factory.getDomainObject(PatientPathwayJourney.class, journey.getBoId());
	PatientJourneyStatus stat = createPatientJourneyStatus(getDomLookup(JourneyStatus.ENDPATHWAYJOURNEY));
	domJourney.setCurrentStatus(stat);
	domJourney.getStatusHistory().add(stat);
	domJourney.setEndedOnDate(new Date());
	
	// For All PatientJourneyTargets, we want to set their status to cancelled and set the cancelledDate
	Iterator it = domJourney.getPatientTargets().iterator();
	while (it.hasNext())
	{
		PatientJourneyTarget domPatTarget = (PatientJourneyTarget) it.next();
		domPatTarget.setCancelledDate(new Date());
		JourneyTargetStatus tStat = createJourneyTargetStatus(getDomLookup(PatientTargetStatus.NOTINSCOPE));  // TODO - What should this status be set to?
		domPatTarget.setCurrentStatus(tStat);
		domPatTarget.getStatusHistory().add(tStat);
	}
	
	// wdev-4597
	// When ending a Patient Journey, we need to stop the clock too
	if (domJourney.getCurrentClock() != null && domJourney.getCurrentClock().getStopDate() == null)
		domJourney.getCurrentClock().setStopDate(new Date());
	
	factory.save(domJourney);

}
 
Example 28
Project: AvoinApotti   File: PatientJourneyCommentsImpl.java   View source code 5 votes vote down vote up
/**
* save
 * @throws StaleObjectException 
*/
public ims.pathways.vo.PatientJourneyCommentsVo save(ims.pathways.vo.PatientJourneyCommentsVo record) throws StaleObjectException
{
	DomainFactory factory = getDomainFactory();
	PatientPathwayJourney domainRecord = PatientJourneyCommentsVoAssembler.extractPatientPathwayJourney(factory, record);		
	factory.save(domainRecord);
	
	return record;
}
 
Example 29
Project: AvoinApotti   File: PatientJourneyClockImpl.java   View source code 5 votes vote down vote up
/**
* Retrieve the Clock history for the patient journey
*/
public ims.pathways.vo.PathwayClockVoCollection listPatientJourneyClockHistory(ims.pathways.vo.PatientPathwayJourneyRefVo patJourneyRefVo) throws ims.domain.exceptions.DomainInterfaceException
{
	if(patJourneyRefVo == null)
		throw new CodingRuntimeException("PatientJourneyRefVo is a mandatory parameter");
	
	DomainFactory factory = getDomainFactory();
	PatientPathwayJourney domPatJourney = (PatientPathwayJourney)factory.getDomainObject(patJourneyRefVo);
	return PathwayClockVoAssembler.createPathwayClockVoCollectionFromPathwayClock(domPatJourney.getClockHistory());
	
}
 
Example 30
Project: openMAXIMS   File: DemographicsImpl.java   View source code 5 votes vote down vote up
private void updateRTTStatusAndJourney(CatsReferral catsRefDO, java.util.Date eventDateTime) throws StaleObjectException, DomainInterfaceException //WDEV-18326 
{
	int nationalCode = RTT_PATIENT_DIED_BEFORE_TREATMENT_NAT_CODE;

	if (catsRefDO == null ||  !Boolean.TRUE.equals(catsRefDO.isRTTClockImpact()) || (catsRefDO.getCurrentRTTStatus() != null && catsRefDO.getCurrentRTTStatus().getRTTStatus() != null && nationalCode == catsRefDO.getCurrentRTTStatus().getRTTStatus().getNationalCode()))
		return;

	PatientPathwayJourney journeyDO = catsRefDO.getJourney();
	PathwayRTTStatus rttSTatusDO = createPathwRTTStatus(nationalCode,isInpatient(catsRefDO.getPatient()), eventDateTime);//WDEV-23292
			
	if (journeyDO != null)
	{			
		journeyDO = updateJourneyStatus(journeyDO, catsRefDO.getPatient().getDod());

		if (journeyDO.getCurrentClock() != null)
		{				
			//WDEV-18446
			journeyDO.getCurrentClock().setStopDate(catsRefDO.getPatient().getDod());

			journeyDO.getCurrentClock().setCurrentRTTStatus(rttSTatusDO);

			List<PathwayRTTStatus> ptwClockHistory = journeyDO.getCurrentClock().getRTTStatusHistory();

			if (ptwClockHistory == null)
			{
				ptwClockHistory = new java.util.ArrayList();
			}
			ptwClockHistory.add(rttSTatusDO);

			instantiatePatientEvent(catsRefDO, rttSTatusDO);	
		}	
	}
	catsRefDO.setCurrentRTTStatus(rttSTatusDO);
}
 
Example 31
Project: openMAXIMS   File: PDSDemographicsImpl.java   View source code 5 votes vote down vote up
private void updateRTTStatusAndJourney(CatsReferral catsRefDO, java.util.Date eventDateTime) throws StaleObjectException, DomainInterfaceException //WDEV-18326 
{
	int nationalCode = RTT_PATIENT_DIED_BEFORE_TREATMENT_NAT_CODE;

	if (catsRefDO == null ||  !Boolean.TRUE.equals(catsRefDO.isRTTClockImpact()) || (catsRefDO.getCurrentRTTStatus() != null && catsRefDO.getCurrentRTTStatus().getRTTStatus() != null && nationalCode == catsRefDO.getCurrentRTTStatus().getRTTStatus().getNationalCode()))
		return;

	PatientPathwayJourney journeyDO = catsRefDO.getJourney();
	PathwayRTTStatus rttSTatusDO = createPathwRTTStatus(nationalCode,isInpatient(catsRefDO.getPatient()), eventDateTime); ///WDEV-23292
			
	if (journeyDO != null)
	{			
		journeyDO = updateJourneyStatus(journeyDO, catsRefDO.getPatient().getDod());

		if (journeyDO.getCurrentClock() != null)
		{				
			//WDEV-18446
			journeyDO.getCurrentClock().setStopDate(catsRefDO.getPatient().getDod());

			journeyDO.getCurrentClock().setCurrentRTTStatus(rttSTatusDO);

			List<PathwayRTTStatus> ptwClockHistory = journeyDO.getCurrentClock().getRTTStatusHistory();

			if (ptwClockHistory == null)
			{
				ptwClockHistory = new java.util.ArrayList();
			}
			ptwClockHistory.add(rttSTatusDO);

			instantiatePatientEvent(catsRefDO, rttSTatusDO);	
		}	
	}
	catsRefDO.setCurrentRTTStatus(rttSTatusDO);
}
 
Example 32
Project: openMAXIMS   File: BookAppointmentImpl.java   View source code 5 votes vote down vote up
public PatientJourneyVoCollection listJourneyByPatient(PatientRefVo voPatient)
{
	if (voPatient == null)
		throw new CodingRuntimeException("voPatient parameter is null in method listJourneyByPatient");

	DomainFactory factory = getDomainFactory();

	IMSCriteria imsc = new IMSCriteria(PatientPathwayJourney.class, factory);
	imsc.isNull("endedOnDate");
	imsc.equal("patient.id", voPatient.getID_Patient());
	List pathways = imsc.find();
	PatientJourneyVoCollection pathColl = PatientJourneyVoAssembler.createPatientJourneyVoCollectionFromPatientPathwayJourney(pathways);
	return pathColl;
}
 
Example 33
Project: openMAXIMS   File: PatientAppointmentMangementRefManImpl.java   View source code 5 votes vote down vote up
private PatientEventVo createPatientEvent(Booking_Appointment doBookAppt, EventLiteVo hardCodedEvent) throws StaleObjectException
{
	CatsReferral catsReferral = getCatsReferralforAppt(doBookAppt);
	PatientPathwayJourney patientJBo = catsReferral != null ? catsReferral.getJourney() : null;
	
	PatientEventVo savedPatEv = null;
	
	if (patientJBo != null && hardCodedEvent != null)
	{				
			DateTime arrivalDateTime = getArrivalDateTime(doBookAppt);
			PatientEventVo patEvent = new PatientEventVo();
			patEvent.setPatient((PatientRefVo)PatientListVoAssembler.create(catsReferral.getPatient()));
			patEvent.setEvent(hardCodedEvent);
			patEvent.setEventDateTime(arrivalDateTime!= null ? arrivalDateTime : new DateTime() );//WDEV-20603- if is not Arrival events the method will return actual date/time 
			patEvent.setEventStatus(EventStatus.ACTIVE);
			patEvent.setJourney(PatientJourneyVoAssembler.create(patientJBo));
			
			HL7PathwayIf implPath = (HL7PathwayIf) getDomainImpl(HL7PathwayIfImpl.class);
			try
			{
				savedPatEv = implPath.instantiatePatientEvent(patEvent);
			}
			catch (DomainInterfaceException e)
			{ throw new DomainRuntimeException("Domain Error occured in save Event " + e.getMessage(), e);}
	}
	
	return savedPatEv;
}
 
Example 34
Project: openMAXIMS   File: PatientJourneyImpl.java   View source code 5 votes vote down vote up
public PatientJourneyCommentsVo getPatientPathwayJourney(PatientPathwayJourneyRefVo voRef)
{
	if (voRef.getID_PatientPathwayJourney() == null)
		throw new CodingRuntimeException("No id provided for Patient Journey");

	return PatientJourneyCommentsVoAssembler.create((PatientPathwayJourney) getDomainFactory().getDomainObject(voRef));
}
 
Example 35
Project: openMAXIMS   File: CreateNewPathwayImpl.java   View source code 5 votes vote down vote up
public PatientJourneyVo getPatientJourney(PatientPathwayJourneyRefVo journey)
{
	if (journey.getID_PatientPathwayJourney() == null)
		throw new CodingRuntimeException("No id provided for PatientJourney in method getPatientJourney");

	return PatientJourneyVoAssembler.create((PatientPathwayJourney) getDomainFactory().getDomainObject(journey));
}
 
Example 36
Project: openMAXIMS   File: CreateNewPathwayImpl.java   View source code 5 votes vote down vote up
public PatientJourneyShortVo getPatientJourneyShort(PatientPathwayJourneyRefVo journey)
{
	if (journey.getID_PatientPathwayJourney() == null)
		throw new CodingRuntimeException("No id provided for PatientJourney in method getPatientJourney");

	return PatientJourneyShortVoAssembler.create((PatientPathwayJourney) getDomainFactory().getDomainObject(journey));
}
 
Example 37
Project: openMAXIMS   File: HL7PathwayIfImpl.java   View source code 5 votes vote down vote up
private CatsReferral getCatsReferralForJourney(PatientPathwayJourney journey)
{
	if (journey == null)
		return null;
	
	String sql="select referral from CatsReferral as referral left join referral.journey as journey where journey.id = :journeyID" ;
	
	List <?>  referrals = getDomainFactory().find(sql,new String[]{"journeyID"}, new Object[]{journey.getId()}) ;
	
	if (referrals != null && referrals.size() > 0 && referrals.get(0) instanceof CatsReferral)
		return (CatsReferral) referrals.get(0);
	
	return null;
}
 
Example 38
Project: openMAXIMS   File: HL7PathwayIfImpl.java   View source code 5 votes vote down vote up
/**
* This method will cancel the given patient journey i.e. it will set the status as ended
* and update all patient journey targets to ended
*/
public void endPatientJourney(PatientPathwayJourneyRefVo journey) throws StaleObjectException 
{
	DomainFactory factory = getDomainFactory();
	
	PatientPathwayJourney domJourney = (PatientPathwayJourney) factory.getDomainObject(PatientPathwayJourney.class, journey.getBoId());
	PatientJourneyStatus stat = createPatientJourneyStatus(getDomLookup(JourneyStatus.ENDPATHWAYJOURNEY));
	domJourney.setCurrentStatus(stat);
	domJourney.getStatusHistory().add(stat);
	domJourney.setEndedOnDate(new Date());
	
	// For All PatientJourneyTargets, we want to set their status to cancelled and set the cancelledDate
	Iterator it = domJourney.getPatientTargets().iterator();
	while (it.hasNext())
	{
		PatientJourneyTarget domPatTarget = (PatientJourneyTarget) it.next();
		domPatTarget.setCancelledDate(new Date());
		JourneyTargetStatus tStat = createJourneyTargetStatus(getDomLookup(PatientTargetStatus.NOTINSCOPE));  // TODO - What should this status be set to?
		domPatTarget.setCurrentStatus(tStat);
		domPatTarget.getStatusHistory().add(tStat);
	}
	
	// wdev-4597
	// When ending a Patient Journey, we need to stop the clock too
	if (domJourney.getCurrentClock() != null && domJourney.getCurrentClock().getStopDate() == null)
		domJourney.getCurrentClock().setStopDate(new Date());
	
	factory.save(domJourney);

}
 
Example 39
Project: openMAXIMS   File: PatientJourneyCommentsImpl.java   View source code 5 votes vote down vote up
/**
* save
 * @throws StaleObjectException 
*/
public ims.pathways.vo.PatientJourneyCommentsVo save(ims.pathways.vo.PatientJourneyCommentsVo record) throws StaleObjectException
{
	DomainFactory factory = getDomainFactory();
	PatientPathwayJourney domainRecord = PatientJourneyCommentsVoAssembler.extractPatientPathwayJourney(factory, record);		
	factory.save(domainRecord);
	
	return record;
}
 
Example 40
Project: openMAXIMS   File: PatientJourneyCommentImpl.java   View source code 5 votes vote down vote up
public PatientJourneyVo getJourney(PatientPathwayJourneyRefVo refVo)
{
	if (refVo == null)
		throw new CodingRuntimeException("Cannot retrieve argument for a null PatientPathwayJourneyRefVo argument.");

	return PatientJourneyVoAssembler.create((PatientPathwayJourney) getDomainFactory().getDomainObject(PatientPathwayJourney.class, refVo.getID_PatientPathwayJourney()));
}