Java Code Examples for ims.edischarge.vo.SummaryRefVo

The following are top voted examples for showing how to use ims.edischarge.vo.SummaryRefVo. 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: EDischargeHelper.java   View source code 6 votes vote down vote up
public ims.framework.utils.Date getEstimatedDischargeDate(SummaryRefVo summary)
{
	if(summary == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" select summary.estimatedDischargeDate from Summary as summary where summary.id = :summaryId ");
	ArrayList<String> markers = new ArrayList<String>();
	markers.add("summaryId");
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	values.add(summary.getID_Summary());
	
	List list = factory.find(hql.toString(), markers,values);
	if(list != null && list.size() > 0)
	{
		return new ims.framework.utils.DateTime((java.util.Date)list.get(0)).getDate(); 
	}
	
	return null;
}
 
Example 2
Project: AvoinApotti   File: EDischargeDiagnosisEtcComponentImpl.java   View source code 6 votes vote down vote up
/**
* saveDiagnosisVo
*/
public PatientDiagnosisEDischargeVo saveDiagnosisVo(PatientDiagnosisEDischargeVo voDiagnosis, SummaryRefVo summaryVo) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException
{
	// Ensure the value object has been validated
	if (!voDiagnosis.isValidated())
		throw new DomainRuntimeException("Diagnosis has not been validated");
	
	DomainFactory factory = getDomainFactory();
	PatientDiagnosis doPatDiag = PatientDiagnosisEDischargeVoAssembler.extractPatientDiagnosis(factory, voDiagnosis);
	
	factory.save(doPatDiag);
	
	if (summaryVo != null
		&& voDiagnosis.getIsComplicationIsNotNull()
		&& voDiagnosis.getIsComorbidityIsNotNull()
		&& ! voDiagnosis.getIsComplication()
		&& ! voDiagnosis.getIsComorbidity())
	{
		IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); 
		impl.updateSummaryIfRequired(voDiagnosis, summaryVo, factory);
	}

	return PatientDiagnosisEDischargeVoAssembler.create(doPatDiag);//Create here to avoid possible StaleObj in PMH save
}
 
Example 3
Project: AvoinApotti   File: EDischargeDiagnosisEtcComponentImpl.java   View source code 6 votes vote down vote up
public DischargeDetailsVo saveDischargeDetails(DischargeDetailsVo voDischargeDetails, SummaryRefVo summaryVo) throws DomainInterfaceException, StaleObjectException
{
	if(voDischargeDetails == null)
		throw new CodingRuntimeException("DischargeDetailsVo is null");
	
	if(!voDischargeDetails.isValidated())
		throw new CodingRuntimeException("DischargeDetailsVo Value Object has not been validated");

	DomainFactory factory = getDomainFactory();
	DischargeDetails doDD = DischargeDetailsVoAssembler.extractDischargeDetails(factory, voDischargeDetails);

	factory.save(doDD);
	
	if (summaryVo != null)
	{
		IEDischargeHelper impl = (IEDischargeHelper)getDomainImpl(EDischargeHelper.class);
		impl.updateSummaryIfRequired(voDischargeDetails, summaryVo, factory);
	}

	return DischargeDetailsVoAssembler.create(doDD);

}
 
Example 4
Project: AvoinApotti   File: EDischargeDiagnosisEtcComponentImpl.java   View source code 6 votes vote down vote up
public void rieDiagnosis(PatientDiagnosisEDischargeListVo diag, FormName formName, Integer patientId, Integer contactId, Integer careContextId, String rieMessage, SummaryRefVo summary) throws StaleObjectException
{
 
	if (summary!=null && summary.getID_SummaryIsNotNull())
	{
		//Check to see if letter status is generated 
		String sql = "select count(summ.id) from Summary as summ left join summ.dischargeLetterStatus as lookup where (summ.id=:summId and lookup.id = :idGenerated)";
		
		long count = getDomainFactory().countWithHQL(sql, new String[]{"summId","idGenerated"}, new Object[]{summary.getID_Summary(),DischargeLetterStatus.GENERATED.getID()});
		if (count >0)
			throw new StaleObjectException(null);
	}
	
	markAsRie(diag, formName, patientId, contactId, careContextId, rieMessage);
	
	
}
 
Example 5
Project: AvoinApotti   File: EDischargePatientReadyToLeaveSTHKComponentImpl.java   View source code 6 votes vote down vote up
public String getDisplayStringAfterSave(SummaryRefVo summaryId)
{
	//Get number of incomplete sections
	String hql = "select count (detail.id) from Summary as summa left join summa.summaryDetails as detail where " +
			"(summa.id = :summaryId and detail.progressStatus.id <> :progressId and summa.isRIE is null and detail.isRIE is null)";
	DomainFactory df = getDomainFactory();
	long noOfNotCompleted = df.countWithHQL(hql, new String[] {"summaryId","progressId"}, new Object[]{summaryId.getID_Summary(),EDischargeSummarySectionStatus.COMPLETED.getID()});
	if (noOfNotCompleted > 0)
		return null;
	
	//Get GP's email
	hql = "select comm.commValue from Summary as summary left join summary.careContext as cc left join cc.episodeOfCare as eoc " +
			"left join eoc.careSpell as cs left join cs.patient as pat left join pat.gp as gp " +
			"left join gp.commChannels as comm left join comm.channelType as chanType where (summary.id = :summId and chanType.id = :emailId)"; 
	List<?> find = df.find(hql,new String[]{"summId","emailId"},new Object[]{summaryId.getID_Summary(),ChannelType.EMAIL.getID()});
	if (find!=null && find.size() > 0)
	{
		if (find.get(0) instanceof String)
		{
			String email = (String) find.get(0);
			if (email.trim().length()>0)
				return "Discharge Summary Sent to GP";
		}
	}
	return "Discharge Summary Sent to Print";
}
 
Example 6
Project: openMAXIMS   File: EDischargeHelper.java   View source code 6 votes vote down vote up
public ims.framework.utils.Date getEstimatedDischargeDate(SummaryRefVo summary)
{
	if(summary == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" select summary.estimatedDischargeDate from Summary as summary where summary.id = :summaryId ");
	ArrayList<String> markers = new ArrayList<String>();
	markers.add("summaryId");
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	values.add(summary.getID_Summary());
	
	List list = factory.find(hql.toString(), markers,values);
	if(list != null && list.size() > 0)
	{
		return new ims.framework.utils.DateTime((java.util.Date)list.get(0)).getDate(); 
	}
	
	return null;
}
 
Example 7
Project: openMAXIMS   File: EDischargeDiagnosisEtcComponentImpl.java   View source code 6 votes vote down vote up
/**
* saveDiagnosisVo
*/
public PatientDiagnosisEDischargeListVo saveDiagnosisVo(PatientDiagnosisEDischargeListVo patientDiagnosisEDischargeListVo, SummaryRefVo summaryVo) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException
{
	// Ensure the value object has been validated
	if (!patientDiagnosisEDischargeListVo.isValidated())
		throw new DomainRuntimeException("Diagnosis has not been validated");
	
	DomainFactory factory = getDomainFactory();
	@SuppressWarnings("rawtypes")
	HashMap map = new HashMap();
	PatientDiagnosis doPatDiag = PatientDiagnosisEDischargeListVoAssembler.extractPatientDiagnosis(factory, patientDiagnosisEDischargeListVo, map);
	
	factory.save(doPatDiag);
	
	if (summaryVo != null
		&& patientDiagnosisEDischargeListVo.getIsComplicationIsNotNull()
		&& patientDiagnosisEDischargeListVo.getIsComorbidityIsNotNull()
		&& ! patientDiagnosisEDischargeListVo.getIsComplication()
		&& ! patientDiagnosisEDischargeListVo.getIsComorbidity())
	{
		IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); 
		impl.updateSummaryIfRequired(patientDiagnosisEDischargeListVo, summaryVo, factory);
	}

	return PatientDiagnosisEDischargeListVoAssembler.create(doPatDiag);//Create here to avoid possible StaleObj in PMH save
}
 
Example 8
Project: openMAXIMS   File: EDischargePatientReadyToLeaveSTHKComponentImpl.java   View source code 6 votes vote down vote up
public String getDisplayStringAfterSave(SummaryRefVo summaryId)
{
	//Get number of incomplete sections
	String hql = "select count (detail.id) from Summary as summa left join summa.summaryDetails as detail where " +
			"(summa.id = :summaryId and detail.progressStatus.id <> :progressId and summa.isRIE is null and detail.isRIE is null)";
	DomainFactory df = getDomainFactory();
	long noOfNotCompleted = df.countWithHQL(hql, new String[] {"summaryId","progressId"}, new Object[]{summaryId.getID_Summary(),EDischargeSummarySectionStatus.COMPLETED.getID()});
	if (noOfNotCompleted > 0)
		return null;
	
	//Get GP's email
	hql = "select comm.commValue from Summary as summary left join summary.careContext as cc left join cc.episodeOfCare as eoc " +
			"left join eoc.careSpell as cs left join cs.patient as pat left join pat.gp as gp " +
			"left join gp.commChannels as comm left join comm.channelType as chanType where (summary.id = :summId and chanType.id = :emailId)"; 
	List<?> find = df.find(hql,new String[]{"summId","emailId"},new Object[]{summaryId.getID_Summary(),ChannelType.EMAIL.getID()});
	if (find!=null && find.size() > 0)
	{
		if (find.get(0) instanceof String)
		{
			String email = (String) find.get(0);
			if (email.trim().length()>0)
				return "Discharge Summary Sent to GP";
		}
	}
	return "Discharge Summary Sent to Print";
}
 
Example 9
Project: openMAXIMS   File: EDischargeHelper.java   View source code 6 votes vote down vote up
public ims.framework.utils.Date getEstimatedDischargeDate(SummaryRefVo summary)
{
	if(summary == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" select summary.estimatedDischargeDate from Summary as summary where summary.id = :summaryId ");
	ArrayList<String> markers = new ArrayList<String>();
	markers.add("summaryId");
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	values.add(summary.getID_Summary());
	
	List list = factory.find(hql.toString(), markers,values);
	if(list != null && list.size() > 0)
	{
		return new ims.framework.utils.DateTime((java.util.Date)list.get(0)).getDate(); 
	}
	
	return null;
}
 
Example 10
Project: openMAXIMS   File: EDischargeDiagnosisEtcComponentImpl.java   View source code 6 votes vote down vote up
/**
* saveDiagnosisVo
*/
public PatientDiagnosisEDischargeVo saveDiagnosisVo(PatientDiagnosisEDischargeVo voDiagnosis, SummaryRefVo summaryVo) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException
{
	// Ensure the value object has been validated
	if (!voDiagnosis.isValidated())
		throw new DomainRuntimeException("Diagnosis has not been validated");
	
	DomainFactory factory = getDomainFactory();
	PatientDiagnosis doPatDiag = PatientDiagnosisEDischargeVoAssembler.extractPatientDiagnosis(factory, voDiagnosis);
	
	factory.save(doPatDiag);
	
	if (summaryVo != null
		&& voDiagnosis.getIsComplicationIsNotNull()
		&& voDiagnosis.getIsComorbidityIsNotNull()
		&& ! voDiagnosis.getIsComplication()
		&& ! voDiagnosis.getIsComorbidity())
	{
		IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); 
		impl.updateSummaryIfRequired(voDiagnosis, summaryVo, factory);
	}

	return PatientDiagnosisEDischargeVoAssembler.create(doPatDiag);//Create here to avoid possible StaleObj in PMH save
}
 
Example 11
Project: openMAXIMS   File: EDischargeDiagnosisEtcComponentImpl.java   View source code 6 votes vote down vote up
public DischargeDetailsVo saveDischargeDetails(DischargeDetailsVo voDischargeDetails, SummaryRefVo summaryVo) throws DomainInterfaceException, StaleObjectException
{
	if(voDischargeDetails == null)
		throw new CodingRuntimeException("DischargeDetailsVo is null");
	
	if(!voDischargeDetails.isValidated())
		throw new CodingRuntimeException("DischargeDetailsVo Value Object has not been validated");

	DomainFactory factory = getDomainFactory();
	DischargeDetails doDD = DischargeDetailsVoAssembler.extractDischargeDetails(factory, voDischargeDetails);

	factory.save(doDD);
	
	if (summaryVo != null)
	{
		IEDischargeHelper impl = (IEDischargeHelper)getDomainImpl(EDischargeHelper.class);
		impl.updateSummaryIfRequired(voDischargeDetails, summaryVo, factory);
	}

	return DischargeDetailsVoAssembler.create(doDD);

}
 
Example 12
Project: openMAXIMS   File: EDischargeDiagnosisEtcComponentImpl.java   View source code 6 votes vote down vote up
public void rieDiagnosis(PatientDiagnosisEDischargeListVo diag, FormName formName, Integer patientId, Integer contactId, Integer careContextId, String rieMessage, SummaryRefVo summary) throws StaleObjectException
{
 
	if (summary!=null && summary.getID_SummaryIsNotNull())
	{
		//Check to see if letter status is generated 
		String sql = "select count(summ.id) from Summary as summ left join summ.dischargeLetterStatus as lookup where (summ.id=:summId and lookup.id = :idGenerated)";
		
		long count = getDomainFactory().countWithHQL(sql, new String[]{"summId","idGenerated"}, new Object[]{summary.getID_Summary(),DischargeLetterStatus.GENERATED.getID()});
		if (count >0)
			throw new StaleObjectException(null);
	}
	
	markAsRie(diag, formName, patientId, contactId, careContextId, rieMessage);
	
	
}
 
Example 13
Project: openMAXIMS   File: EDischargePatientReadyToLeaveSTHKComponentImpl.java   View source code 6 votes vote down vote up
public String getDisplayStringAfterSave(SummaryRefVo summaryId)
{
	//Get number of incomplete sections
	String hql = "select count (detail.id) from Summary as summa left join summa.summaryDetails as detail where " +
			"(summa.id = :summaryId and detail.progressStatus.id <> :progressId and summa.isRIE is null and detail.isRIE is null)";
	DomainFactory df = getDomainFactory();
	long noOfNotCompleted = df.countWithHQL(hql, new String[] {"summaryId","progressId"}, new Object[]{summaryId.getID_Summary(),EDischargeSummarySectionStatus.COMPLETED.getID()});
	if (noOfNotCompleted > 0)
		return null;
	
	//Get GP's email
	hql = "select comm.commValue from Summary as summary left join summary.careContext as cc left join cc.episodeOfCare as eoc " +
			"left join eoc.careSpell as cs left join cs.patient as pat left join pat.gp as gp " +
			"left join gp.commChannels as comm left join comm.channelType as chanType where (summary.id = :summId and chanType.id = :emailId)"; 
	List<?> find = df.find(hql,new String[]{"summId","emailId"},new Object[]{summaryId.getID_Summary(),ChannelType.EMAIL.getID()});
	if (find!=null && find.size() > 0)
	{
		if (find.get(0) instanceof String)
		{
			String email = (String) find.get(0);
			if (email.trim().length()>0)
				return "Discharge Summary Sent to GP";
		}
	}
	return "Discharge Summary Sent to Print";
}
 
Example 14
Project: openmaxims-linux   File: EDischargeHelper.java   View source code 6 votes vote down vote up
public ims.framework.utils.Date getEstimatedDischargeDate(SummaryRefVo summary)
{
	if(summary == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" select summary.estimatedDischargeDate from Summary as summary where summary.id = :summaryId ");
	ArrayList<String> markers = new ArrayList<String>();
	markers.add("summaryId");
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	values.add(summary.getID_Summary());
	
	List list = factory.find(hql.toString(), markers,values);
	if(list != null && list.size() > 0)
	{
		return new ims.framework.utils.DateTime((java.util.Date)list.get(0)).getDate(); 
	}
	
	return null;
}
 
Example 15
Project: openmaxims-linux   File: EDischargeDiagnosisEtcComponentImpl.java   View source code 6 votes vote down vote up
/**
* saveDiagnosisVo
*/
public PatientDiagnosisEDischargeVo saveDiagnosisVo(PatientDiagnosisEDischargeVo voDiagnosis, SummaryRefVo summaryVo) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException
{
	// Ensure the value object has been validated
	if (!voDiagnosis.isValidated())
		throw new DomainRuntimeException("Diagnosis has not been validated");
	
	DomainFactory factory = getDomainFactory();
	PatientDiagnosis doPatDiag = PatientDiagnosisEDischargeVoAssembler.extractPatientDiagnosis(factory, voDiagnosis);
	
	factory.save(doPatDiag);
	
	if (summaryVo != null
		&& voDiagnosis.getIsComplicationIsNotNull()
		&& voDiagnosis.getIsComorbidityIsNotNull()
		&& ! voDiagnosis.getIsComplication()
		&& ! voDiagnosis.getIsComorbidity())
	{
		IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); 
		impl.updateSummaryIfRequired(voDiagnosis, summaryVo, factory);
	}

	return PatientDiagnosisEDischargeVoAssembler.create(doPatDiag);//Create here to avoid possible StaleObj in PMH save
}
 
Example 16
Project: openmaxims-linux   File: EDischargeDiagnosisEtcComponentImpl.java   View source code 6 votes vote down vote up
public DischargeDetailsVo saveDischargeDetails(DischargeDetailsVo voDischargeDetails, SummaryRefVo summaryVo) throws DomainInterfaceException, StaleObjectException
{
	if(voDischargeDetails == null)
		throw new CodingRuntimeException("DischargeDetailsVo is null");
	
	if(!voDischargeDetails.isValidated())
		throw new CodingRuntimeException("DischargeDetailsVo Value Object has not been validated");

	DomainFactory factory = getDomainFactory();
	DischargeDetails doDD = DischargeDetailsVoAssembler.extractDischargeDetails(factory, voDischargeDetails);

	factory.save(doDD);
	
	if (summaryVo != null)
	{
		IEDischargeHelper impl = (IEDischargeHelper)getDomainImpl(EDischargeHelper.class);
		impl.updateSummaryIfRequired(voDischargeDetails, summaryVo, factory);
	}

	return DischargeDetailsVoAssembler.create(doDD);

}
 
Example 17
Project: openmaxims-linux   File: EDischargeDiagnosisEtcComponentImpl.java   View source code 6 votes vote down vote up
public void rieDiagnosis(PatientDiagnosisEDischargeListVo diag, FormName formName, Integer patientId, Integer contactId, Integer careContextId, String rieMessage, SummaryRefVo summary) throws StaleObjectException
{
 
	if (summary!=null && summary.getID_SummaryIsNotNull())
	{
		//Check to see if letter status is generated 
		String sql = "select count(summ.id) from Summary as summ left join summ.dischargeLetterStatus as lookup where (summ.id=:summId and lookup.id = :idGenerated)";
		
		long count = getDomainFactory().countWithHQL(sql, new String[]{"summId","idGenerated"}, new Object[]{summary.getID_Summary(),DischargeLetterStatus.GENERATED.getID()});
		if (count >0)
			throw new StaleObjectException(null);
	}
	
	markAsRie(diag, formName, patientId, contactId, careContextId, rieMessage);
	
	
}
 
Example 18
Project: openmaxims-linux   File: EDischargePatientReadyToLeaveSTHKComponentImpl.java   View source code 6 votes vote down vote up
public String getDisplayStringAfterSave(SummaryRefVo summaryId)
{
	//Get number of incomplete sections
	String hql = "select count (detail.id) from Summary as summa left join summa.summaryDetails as detail where " +
			"(summa.id = :summaryId and detail.progressStatus.id <> :progressId and summa.isRIE is null and detail.isRIE is null)";
	DomainFactory df = getDomainFactory();
	long noOfNotCompleted = df.countWithHQL(hql, new String[] {"summaryId","progressId"}, new Object[]{summaryId.getID_Summary(),EDischargeSummarySectionStatus.COMPLETED.getID()});
	if (noOfNotCompleted > 0)
		return null;
	
	//Get GP's email
	hql = "select comm.commValue from Summary as summary left join summary.careContext as cc left join cc.episodeOfCare as eoc " +
			"left join eoc.careSpell as cs left join cs.patient as pat left join pat.gp as gp " +
			"left join gp.commChannels as comm left join comm.channelType as chanType where (summary.id = :summId and chanType.id = :emailId)"; 
	List<?> find = df.find(hql,new String[]{"summId","emailId"},new Object[]{summaryId.getID_Summary(),ChannelType.EMAIL.getID()});
	if (find!=null && find.size() > 0)
	{
		if (find.get(0) instanceof String)
		{
			String email = (String) find.get(0);
			if (email.trim().length()>0)
				return "Discharge Summary Sent to GP";
		}
	}
	return "Discharge Summary Sent to Print";
}
 
Example 19
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
public void initialise(SummaryRefVo summary)
{
	form.getLocalContext().setSTHKSummary(summary);
	form.getLocalContext().setisReadonly(false);
	form.setMode(FormMode.VIEW);
	if (form.getLocalContext().getbInitialised() == null)
	{
		initializeComponent();
		form.getLocalContext().setbInitialised(Boolean.TRUE);
	}
			
	open();
}
 
Example 20
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
public void initialise(SummaryRefVo summary)
{
	form.getLocalContext().setSTHKSummary(summary);
	form.getLocalContext().setisReadonly(false);
	form.setMode(FormMode.VIEW);
	if (form.getLocalContext().getbInitialised() == null)
	{
		initializeComponent();
		form.getLocalContext().setbInitialised(Boolean.TRUE);
	}
	open();
}
 
Example 21
Project: AvoinApotti   File: EDischargeHelper.java   View source code 5 votes vote down vote up
private void updateSummary(SummaryRefVo summary, TTAStatus status) throws ims.domain.exceptions.StaleObjectException
{
	if(summary == null || status == null)
		return;
	
	DomainFactory factory = getDomainFactory();
	Summary doSummary = (Summary)factory.getDomainObject(summary);
	if (getDomLookup(DischargeLetterStatus.GENERATED).equals(doSummary.getDischargeLetterStatus()))
		throw new StaleObjectException(null);
	doSummary.setTTAStatus(getDomLookup(status));
	
	factory.save(doSummary);			
}
 
Example 22
Project: AvoinApotti   File: EDischargeHelper.java   View source code 5 votes vote down vote up
public void updateSummaryIfRequired(IEDischargeSummary record, SummaryRefVo summary, DomainFactory factory) throws ims.domain.exceptions.StaleObjectException
{
	if(summary == null)
		return;
	
	boolean updateRequired = false;
	Summary doSummary = (Summary)factory.getDomainObject(summary);
	/*
	 * If in the meantime the Discharge Letter has been generated than it's a SOE
	 */
	if (getDomLookup(DischargeLetterStatus.GENERATED).equals(doSummary.getDischargeLetterStatus()))
		throw new StaleObjectException(null);
	SummaryDetail doSummaryDetail = (SummaryDetail) doSummary.getSummaryDetails().get(findDetailRecordForType(doSummary.getSummaryDetails(),record.getIEDischargeSummarySection()));
	if(record.getIEDischargeSummaryIsComplete())
	{
		updateRequired = true;
		doSummaryDetail.setProgressStatus(getDomLookup(EDischargeSummarySectionStatus.COMPLETED));
	}
	else
	{
		updateRequired = true;
		doSummaryDetail.setProgressStatus(getDomLookup(EDischargeSummarySectionStatus.IN_PROGRESS));
	}
	
	if(updateRequired)
		factory.save(doSummaryDetail);
}
 
Example 23
Project: AvoinApotti   File: EDischargeOpsProcsComponentImpl.java   View source code 5 votes vote down vote up
public void rieProcedure(PatientProcedureProcsComponentLiteVo proc,	FormName formName, Integer patientId, Integer contactId, Integer careContextId, String rieMessage, SummaryRefVo summary) throws StaleObjectException 
{
	if (summary!=null && summary.getID_SummaryIsNotNull())
	{
		//Check to see if letter status is generated 
		String sql = "select count(summ.id) from Summary as summ left join summ.dischargeLetterStatus as lookup where (summ.id=:summId and lookup.id = :idGenerated)";
		
		long count = getDomainFactory().countWithHQL(sql, new String[]{"summId","idGenerated"}, new Object[]{summary.getID_Summary(),DischargeLetterStatus.GENERATED.getID()});
		if (count >0)
			throw new StaleObjectException(null);
	}
	
	markAsRie(proc, formName, patientId, contactId, careContextId, rieMessage);
}
 
Example 24
Project: AvoinApotti   File: EDischargeOpsProcsComponentImpl.java   View source code 5 votes vote down vote up
public EDischargeSTHKSummaryForProcComponentVo getEDischargeSummary(SummaryRefVo summary) 
{
	if(summary == null || summary.getID_Summary() == null)
		throw new CodingRuntimeException("Can not get EDischargeSummary on nul Id.");
	
	return EDischargeSTHKSummaryForProcComponentVoAssembler.create((Summary) getDomainFactory().getDomainObject(Summary.class, summary.getID_Summary()));
}
 
Example 25
Project: AvoinApotti   File: EDischargePlasticSurgeryAndBurnsCentreDischargeComponentImpl.java   View source code 5 votes vote down vote up
public ims.clinical.vo.PlasticSurgeryAndBurnsVo savePlasticSurgeryAndBurnsVo(ims.clinical.vo.PlasticSurgeryAndBurnsVo voPlasticSurgeryAndBurns, SummaryRefVo summary) throws ims.domain.exceptions.StaleObjectException
{
	if (voPlasticSurgeryAndBurns == null)
		throw new CodingRuntimeException("PlasticSurgeryAndBurns is null");

	if (!voPlasticSurgeryAndBurns.isValidated())
		throw new CodingRuntimeException("PlasticSurgeryAndBurns Value Object Alert has not been validated");

	DomainFactory factory = getDomainFactory();
	PlasticSurgeryAndBurns doPlasticSurgeryAndBurns = PlasticSurgeryAndBurnsVoAssembler.extractPlasticSurgeryAndBurns(factory, voPlasticSurgeryAndBurns);// //

	if (!voPlasticSurgeryAndBurns.getID_PlasticSurgeryAndBurnsIsNotNull())
	{
		List list = factory.find("from PlasticSurgeryAndBurns as psb where psb.careContext.id = :CONTEXTID and psb.isRIE is null", new String[] { "CONTEXTID" }, new Object[] { voPlasticSurgeryAndBurns.getCareContext().getID_CareContext() });
		if (list != null && list.size() > 0)
		{
			throw new StaleObjectException(null);
		}
	}

	factory.save(doPlasticSurgeryAndBurns);
	
	IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); 
	impl.updateSummaryIfRequired(voPlasticSurgeryAndBurns, summary, factory);
	
	return PlasticSurgeryAndBurnsVoAssembler.create(doPlasticSurgeryAndBurns);
}
 
Example 26
Project: AvoinApotti   File: EDischargeSpecialCareBabyUnitDischargeComponentImpl.java   View source code 5 votes vote down vote up
/**
* saveNeonatal
*/
public void saveNeonatal(ims.clinical.vo.NeonatalVo neonatal, SummaryRefVo summary) throws ims.domain.exceptions.StaleObjectException
{
	if (neonatal == null)
		throw new CodingRuntimeException("neonatal is null in method saveNeonatal");
	if (!neonatal.isValidated())
		throw new CodingRuntimeException("neonatal has not been validated in method saveNeonatal");

	DomainFactory factory = getDomainFactory();
	factory.save(NeonatalVoAssembler.extractNeoNatal(factory, neonatal));
	
	//updating summary WDEV-11348
	IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); 
	impl.updateSummaryIfRequired(neonatal, summary, factory);
}
 
Example 27
Project: AvoinApotti   File: EDischargeDiagnosisEtcComponentImpl.java   View source code 5 votes vote down vote up
public DischargeDetailsVo save(DischargeDetailsVo dd, PatientDiagnosisEDischargeVoCollection diags, SummaryRefVo summary) throws StaleObjectException, UniqueKeyViolationException, DomainInterfaceException
{
	if (diags!=null)
	{
		for (int i = 0 ; i < diags.size() ; i++)
		{
			saveDiagnosisVo(diags.get(i),summary);
		}
	}
	return saveDischargeDetails(dd, summary);
	
}
 
Example 28
Project: AvoinApotti   File: EDischargePatientReadyToLeaveSTHKComponentImpl.java   View source code 5 votes vote down vote up
public DischargeReadyToLeaveVo saveReadyToLeave(DischargeReadyToLeaveVo voReady, SummaryRefVo voSummary) throws DomainInterfaceException, StaleObjectException 
{
	if(voReady == null)
		throw new CodingRuntimeException("DischargeReadyToLeaveVo is null");
	
	if(!voReady.isValidated())
		throw new CodingRuntimeException("DischargeReadyToLeaveVo Value Object has not been validated");

	DomainFactory factory = getDomainFactory();
	
	//There is a situation where is possible that the scheduled jobs have run while you
	//are editing the ready to leave record. This should be dealt with by throwing a StaleObjectException
	String hql = "select count(summa.id) from Summary as summa where (summa.id=:sumId and (summa.dischargeLetterStatus.id =:dischLettId  or summa.dischargeSupplementaryLetterStatus.id = :dischSuppLettId))";
	long isCompleted = factory.countWithHQL(hql, new String[]{"sumId","dischLettId","dischSuppLettId"}, new Object[]{voSummary.getID_Summary(),DischargeLetterStatus.GENERATED.getId(),DischargeSupplementaryLetterStatus.GENERATED.getID()});
	if (isCompleted > 0)
	{
		throw new StaleObjectException(null);
	}
	
	ReadyToLeave doRTL = DischargeReadyToLeaveVoAssembler.extractReadyToLeave(factory, voReady);
	factory.save(doRTL);
	
	//updating summary WDEV-11348
	IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); 
	impl.updateSummaryIfRequired(voReady, voSummary, factory);

	return DischargeReadyToLeaveVoAssembler.create(doRTL);
}
 
Example 29
Project: AvoinApotti   File: EDischargeSummarySthkComponentImpl.java   View source code 5 votes vote down vote up
public Boolean allowChangeNeoNatalPlastics(SummaryRefVo summary) 
{
	if(summary == null || summary.getID_Summary() == null)
		return true;
	
	DomainFactory factory = getDomainFactory();
	
	List<?> records = factory.find("from Summary as s left join s.summaryDetails as sd where s.id = :SummaryId and (sd.section.id = :SummarySection1 or sd.section.id = :SummarySection2) and (sd.progressStatus.id = :ProgressStatus1 or sd.progressStatus.id = :ProgressStatus2)", new String[] {"SummaryId", "SummarySection1", "SummarySection2", "ProgressStatus1", "ProgressStatus2"}, new Object[] {summary.getID_Summary(), ims.clinical.vo.lookups.EDischargeSummarySection.NEONATAL.getID(), ims.clinical.vo.lookups.EDischargeSummarySection.PLASTICS.getID(), ims.clinical.vo.lookups.EDischargeSummarySectionStatus.IN_PROGRESS.getID(), ims.clinical.vo.lookups.EDischargeSummarySectionStatus.COMPLETED.getID()});
	
	if(records != null && records.size() > 0)
		return false;
	
	return true;
}
 
Example 30
Project: AvoinApotti   File: EDischargeClinicalInfoSTHKComponentImpl.java   View source code 5 votes vote down vote up
/**
 * Save clinical info
 */
public ims.core.vo.DischargeClinicalInformationSTHKVo saveClinicalInfo(DischargeClinicalInformationSTHKVo voClinicalInfo, SummaryRefVo summary) throws ims.domain.exceptions.StaleObjectException
{
	if (voClinicalInfo == null)
		throw new CodingRuntimeException("DischargeClinicalInformationVo is null");

	if (!voClinicalInfo.isValidated())
		throw new CodingRuntimeException("DischargeClinicalInformationVo Value Object Alert has not been validated");

	DomainFactory factory = getDomainFactory();
	DischargeClinicalInformation doClinInfo = DischargeClinicalInformationSTHKVoAssembler.extractDischargeClinicalInformation(factory, voClinicalInfo);// //

	if (!voClinicalInfo.getID_DischargeClinicalInformationIsNotNull())
	{
		List list = factory.find("from DischargeClinicalInformation as dci where dci.careContext.id = :CONTEXTID and dci.isRIE is null", new String[] { "CONTEXTID" }, new Object[] { voClinicalInfo.getCareContext().getID_CareContext() });
		if (list != null && list.size() > 0)
		{
			throw new StaleObjectException(null);
		}
	}

	factory.save(doClinInfo);
	
	IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); 
	impl.updateSummaryIfRequired(voClinicalInfo, summary, factory);
	
	return DischargeClinicalInformationSTHKVoAssembler.create(doClinInfo);
}
 
Example 31
Project: AvoinApotti   File: EDischargeClinicalInfoSTHKComponentImpl.java   View source code 5 votes vote down vote up
public Boolean isSectionComplete(SummaryRefVo summary, EDischargeSummarySection section)
{
	final String hql = "select count(summ.id) from Summary as summ left join summ.summaryDetails " +
			"as sd left join sd.section as sec left join sd.progressStatus as prgress where " +
			"(summ.id = :summary and prgress.id = :progress and sec.id = :section and summ.isRIE is null)";
	
	long count = getDomainFactory().countWithHQL(hql, new String[]{"summary","progress","section"}, new Object[]{summary.getID_Summary(),EDischargeSummarySectionStatus.COMPLETED.getID(),section.getID()});
	return count > 0;
}
 
Example 32
Project: openMAXIMS   File: Logic.java   View source code 5 votes vote down vote up
public void initialise(SummaryRefVo summary)
{
	form.getLocalContext().setSTHKSummary(summary);
	form.getLocalContext().setisReadonly(false);
	form.setMode(FormMode.VIEW);
	if (form.getLocalContext().getbInitialised() == null)
	{
		initializeComponent();
		form.getLocalContext().setbInitialised(Boolean.TRUE);
	}
			
	open();
}
 
Example 33
Project: openMAXIMS   File: Logic.java   View source code 5 votes vote down vote up
public void initialise(SummaryRefVo summary)
{
	form.getLocalContext().setSTHKSummary(summary);
	form.getLocalContext().setisReadonly(false);
	form.setMode(FormMode.VIEW);
	if (form.getLocalContext().getbInitialised() == null)
	{
		initializeComponent();
		form.getLocalContext().setbInitialised(Boolean.TRUE);
	}
	open();
}
 
Example 34
Project: openMAXIMS   File: EDischargeHelper.java   View source code 5 votes vote down vote up
private void updateSummary(SummaryRefVo summary, TTAStatus status) throws ims.domain.exceptions.StaleObjectException
{
	if(summary == null || status == null)
		return;
	
	DomainFactory factory = getDomainFactory();
	Summary doSummary = (Summary)factory.getDomainObject(summary);
	if (getDomLookup(DischargeLetterStatus.GENERATED).equals(doSummary.getDischargeLetterStatus()))
		throw new StaleObjectException(null);
	doSummary.setTTAStatus(getDomLookup(status));
	
	factory.save(doSummary);			
}
 
Example 35
Project: openMAXIMS   File: EDischargeHelper.java   View source code 5 votes vote down vote up
public void updateSummaryIfRequired(IEDischargeSummary record, SummaryRefVo summary, DomainFactory factory) throws ims.domain.exceptions.StaleObjectException
{
	if(summary == null)
		return;
	
	boolean updateRequired = false;
	Summary doSummary = (Summary)factory.getDomainObject(summary);
	/*
	 * If in the meantime the Discharge Letter has been generated than it's a SOE
	 */
	if (getDomLookup(DischargeLetterStatus.GENERATED).equals(doSummary.getDischargeLetterStatus()))
		throw new StaleObjectException(null);
	SummaryDetail doSummaryDetail = (SummaryDetail) doSummary.getSummaryDetails().get(findDetailRecordForType(doSummary.getSummaryDetails(),record.getIEDischargeSummarySection()));
	if(record.getIEDischargeSummaryIsComplete())
	{
		updateRequired = true;
		doSummaryDetail.setProgressStatus(getDomLookup(EDischargeSummarySectionStatus.COMPLETED));
	}
	else
	{
		updateRequired = true;
		doSummaryDetail.setProgressStatus(getDomLookup(EDischargeSummarySectionStatus.IN_PROGRESS));
	}
	
	if(updateRequired)
		factory.save(doSummaryDetail);
}
 
Example 36
Project: openMAXIMS   File: EDischargeOpsProcsComponentImpl.java   View source code 5 votes vote down vote up
public void rieProcedure(PatientProcedureProcsComponentLiteVo proc,	FormName formName, Integer patientId, Integer contactId, Integer careContextId, String rieMessage, SummaryRefVo summary) throws StaleObjectException 
{
	if (summary!=null && summary.getID_SummaryIsNotNull())
	{
		//Check to see if letter status is generated 
		String sql = "select count(summ.id) from Summary as summ left join summ.dischargeLetterStatus as lookup where (summ.id=:summId and lookup.id = :idGenerated)";
		
		long count = getDomainFactory().countWithHQL(sql, new String[]{"summId","idGenerated"}, new Object[]{summary.getID_Summary(),DischargeLetterStatus.GENERATED.getID()});
		if (count >0)
			throw new StaleObjectException(null);
	}
	
	markAsRie(proc, formName, patientId, contactId, careContextId, rieMessage);
}
 
Example 37
Project: openMAXIMS   File: EDischargeOpsProcsComponentImpl.java   View source code 5 votes vote down vote up
public EDischargeSTHKSummaryForProcComponentVo getEDischargeSummary(SummaryRefVo summary) 
{
	if(summary == null || summary.getID_Summary() == null)
		throw new CodingRuntimeException("Can not get EDischargeSummary on nul Id.");
	
	return EDischargeSTHKSummaryForProcComponentVoAssembler.create((Summary) getDomainFactory().getDomainObject(Summary.class, summary.getID_Summary()));
}
 
Example 38
Project: openMAXIMS   File: EDischargePlasticSurgeryAndBurnsCentreDischargeComponentImpl.java   View source code 5 votes vote down vote up
public ims.clinical.vo.PlasticSurgeryAndBurnsVo savePlasticSurgeryAndBurnsVo(ims.clinical.vo.PlasticSurgeryAndBurnsVo voPlasticSurgeryAndBurns, SummaryRefVo summary) throws ims.domain.exceptions.StaleObjectException
{
	if (voPlasticSurgeryAndBurns == null)
		throw new CodingRuntimeException("PlasticSurgeryAndBurns is null");

	if (!voPlasticSurgeryAndBurns.isValidated())
		throw new CodingRuntimeException("PlasticSurgeryAndBurns Value Object Alert has not been validated");

	DomainFactory factory = getDomainFactory();
	PlasticSurgeryAndBurns doPlasticSurgeryAndBurns = PlasticSurgeryAndBurnsVoAssembler.extractPlasticSurgeryAndBurns(factory, voPlasticSurgeryAndBurns);// //

	if (!voPlasticSurgeryAndBurns.getID_PlasticSurgeryAndBurnsIsNotNull())
	{
		List list = factory.find("from PlasticSurgeryAndBurns as psb where psb.careContext.id = :CONTEXTID and psb.isRIE is null", new String[] { "CONTEXTID" }, new Object[] { voPlasticSurgeryAndBurns.getCareContext().getID_CareContext() });
		if (list != null && list.size() > 0)
		{
			throw new StaleObjectException(null);
		}
	}

	factory.save(doPlasticSurgeryAndBurns);
	
	IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); 
	impl.updateSummaryIfRequired(voPlasticSurgeryAndBurns, summary, factory);
	
	return PlasticSurgeryAndBurnsVoAssembler.create(doPlasticSurgeryAndBurns);
}
 
Example 39
Project: openMAXIMS   File: EDischargeSpecialCareBabyUnitDischargeComponentImpl.java   View source code 5 votes vote down vote up
/**
* saveNeonatal
*/
public void saveNeonatal(ims.clinical.vo.NeonatalVo neonatal, SummaryRefVo summary) throws ims.domain.exceptions.StaleObjectException
{
	if (neonatal == null)
		throw new CodingRuntimeException("neonatal is null in method saveNeonatal");
	if (!neonatal.isValidated())
		throw new CodingRuntimeException("neonatal has not been validated in method saveNeonatal");

	DomainFactory factory = getDomainFactory();
	factory.save(NeonatalVoAssembler.extractNeoNatal(factory, neonatal));
	
	//updating summary WDEV-11348
	IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); 
	impl.updateSummaryIfRequired(neonatal, summary, factory);
}
 
Example 40
Project: openMAXIMS   File: EDischargeDiagnosisEtcComponentImpl.java   View source code 5 votes vote down vote up
public DischargeDetailsVo saveDischargeDetails(DischargeDetailsVo voDischargeDetails, SummaryRefVo summaryVo, RTLSummaryVo rTLSummary, PatientNoDiagInfoForCCVo patientNoDiagInfo) throws DomainInterfaceException, StaleObjectException
{
	if(voDischargeDetails == null)
		throw new CodingRuntimeException("DischargeDetailsVo is null");
	
	if(!voDischargeDetails.isValidated())
		throw new CodingRuntimeException("DischargeDetailsVo Value Object has not been validated");

	DomainFactory factory = getDomainFactory();
	
	DischargeDetails doDD = DischargeDetailsVoAssembler.extractDischargeDetails(factory, voDischargeDetails);
	factory.save(doDD);
	
	//WDEV-19685
	if (rTLSummary != null)
	{
		RTLSummary rTLSummaryDO = RTLSummaryVoAssembler.extractRTLSummary(factory, rTLSummary);
		factory.save(rTLSummaryDO);
	}
	
	//WDEV-18627
	if (patientNoDiagInfo != null)
	{
		PatientNoDiagInfoForCC patientNoDiagInfoDo = PatientNoDiagInfoForCCVoAssembler.extractPatientNoDiagInfoForCC(factory, patientNoDiagInfo);
		factory.save(patientNoDiagInfoDo);
	}
	
	if (summaryVo != null)
	{
		IEDischargeHelper impl = (IEDischargeHelper)getDomainImpl(EDischargeHelper.class);
		impl.updateSummaryIfRequired(voDischargeDetails, summaryVo, factory);
	}

	return DischargeDetailsVoAssembler.create(doDD);

}