Java Code Examples for ims.core.admin.pas.domain.objects.AdmissionDetail

The following are top voted examples for showing how to use ims.core.admin.pas.domain.objects.AdmissionDetail. 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: BedInfoDialogImpl.java   Source Code and License 6 votes vote down vote up
private String getPatientIdValue(AdmissionDetail doAdmissionDetail, PatIdType type) 
{
	if(doAdmissionDetail == null)
		return null;
	
	if(doAdmissionDetail.getPasEvent() != null && doAdmissionDetail.getPasEvent().getPatient() != null && doAdmissionDetail.getPasEvent().getPatient().getIdentifiers() != null)
	{
		Iterator it = doAdmissionDetail.getPasEvent().getPatient().getIdentifiers().iterator();
		while(it.hasNext())
		{
			PatientId patId = (PatientId) it.next();
			if(patId.getType().equals( getDomLookup(type)))
				return patId.getValue();
		}
	}
	
	return null;
}
 
Example 2
Project: AvoinApotti   File: BedAdmissionComponentImpl.java   Source Code and License 6 votes vote down vote up
private String getPatientIdValue(AdmissionDetail doAdmissionDetail, PatIdType type) 
{
	if(doAdmissionDetail == null)
		return null;
	
	if(doAdmissionDetail.getPasEvent() != null && doAdmissionDetail.getPasEvent().getPatient() != null && doAdmissionDetail.getPasEvent().getPatient().getIdentifiers() != null)
	{
		Iterator it = doAdmissionDetail.getPasEvent().getPatient().getIdentifiers().iterator();
		while(it.hasNext())
		{
			PatientId patId = (PatientId) it.next();
			if(patId.getType().equals( getDomLookup(type)))
				return patId.getValue();
		}
	}
	
	return null;
}
 
Example 3
Project: AvoinApotti   File: WardViewImpl.java   Source Code and License 6 votes vote down vote up
public AdmissionDetailLiteVo getMothersAdmission(PatientRefVo patient)
{
	if (patient == null || patient.getID_Patient() == null)
		throw new CodingRuntimeException("patient is null or id not provided in method getMothersAdmission");
	
	//get the patient to read ClientParent value
	Patient doPatient = (Patient) getDomainFactory().getDomainObject(patient); 		
	
	if(doPatient != null && doPatient.getClientParent() != null)
	{
		List admissions = getDomainFactory().find("from AdmissionDetail adm left join fetch adm.pasEvent as pe left join fetch pe.patient as pat where pat.id = " + doPatient.getClientParent().getId());
		if(admissions != null && admissions.size() > 0)
			return AdmissionDetailLiteVoAssembler.create((AdmissionDetail) admissions.get(0));
	}
	
	return null;
}
 
Example 4
Project: AvoinApotti   File: EDischargeSummarySthkComponentImpl.java   Source Code and License 6 votes vote down vote up
public AdmissionDetailVo getAdmissionDetailByCareContext(CareContextRefVo voCC) 
{
	if (voCC == null || voCC.getID_CareContext() == null)
		throw new CodingRuntimeException("careContext is null or id not provided in method getAdmissionDetailByCareContext");
	
	List items = getDomainFactory().find(" select cc.pasEvent.id from CareContext as cc where cc.id = " +  voCC.getID_CareContext());
	if(items != null && items.size() > 0)
	{
		Integer eventId = (Integer) items.get(0);
	
		if(eventId!= null && eventId  > 0)
		{
			List ieItems = getDomainFactory().find(" from AdmissionDetail ad where ad.pasEvent.id = " +  eventId);
			if(ieItems != null && ieItems.size() > 0)
				return AdmissionDetailVoAssembler.create((AdmissionDetail) ieItems.get(0));
		}	
	}
	
	return null;
}
 
Example 5
Project: AvoinApotti   File: AdmissionDetailsImpl.java   Source Code and License 6 votes vote down vote up
/**
* Method used to retrieve Admission Details.
*/
public AdmissionDetailLiteWithInpatientEpisodeVo getAdmission(AdmissionDetailRefVo admission)
{
	// Check admission record parameter
	if (admission == null || !admission.getID_AdmissionDetailIsNotNull())
		return null;
	
	AdmissionDetailLiteWithInpatientEpisodeVo admissionDetails = AdmissionDetailLiteWithInpatientEpisodeVoAssembler.create((AdmissionDetail) getDomainFactory().getDomainObject(AdmissionDetail.class, admission.getID_AdmissionDetail()));

	// Get Inpatient episode if exists
	String query = "SELECT inpEp FROM InpatientEpisode AS inpEp LEFT JOIN inpEp.pasEvent AS pas1, AdmissionDetail AS admtDetail LEFT JOIN admtDetail.pasEvent AS pas2 WHERE pas1.id = pas2.id AND admtDetail.id = :ADM_ID AND inpEp.isRIE is null";
	
	ArrayList<String> paramNames = new ArrayList<String>();
	ArrayList<Object> paramValues = new ArrayList<Object>();
	
	paramNames.add("ADM_ID");
	paramValues.add(admissionDetails.getID_AdmissionDetail());
	
	InpatientEpisodeBedNumberUpdateVo inpatientEpisode = InpatientEpisodeBedNumberUpdateVoAssembler.create((InpatientEpisode) getDomainFactory().findFirst(query, paramNames, paramValues));
	
	admissionDetails.setInpatientEpisode(inpatientEpisode);
	
	return admissionDetails;
}
 
Example 6
Project: openMAXIMS   File: BedInfoDialogImpl.java   Source Code and License 6 votes vote down vote up
private String getPatientIdValue(AdmissionDetail doAdmissionDetail, PatIdType type) 
{
	if(doAdmissionDetail == null)
		return null;
	
	if(doAdmissionDetail.getPasEvent() != null && doAdmissionDetail.getPasEvent().getPatient() != null && doAdmissionDetail.getPasEvent().getPatient().getIdentifiers() != null)
	{
		Iterator it = doAdmissionDetail.getPasEvent().getPatient().getIdentifiers().iterator();
		while(it.hasNext())
		{
			PatientId patId = (PatientId) it.next();
			if(patId.getType().equals( getDomLookup(type)))
				return patId.getValue();
		}
	}
	
	return null;
}
 
Example 7
Project: openMAXIMS   File: BedAdmissionComponentImpl.java   Source Code and License 6 votes vote down vote up
private String getPatientIdValue(AdmissionDetail doAdmissionDetail, PatIdType type) 
{
	if(doAdmissionDetail == null)
		return null;

	if(doAdmissionDetail.getPasEvent() != null && doAdmissionDetail.getPasEvent().getPatient() != null && doAdmissionDetail.getPasEvent().getPatient().getIdentifiers() != null)
	{
		Iterator it = doAdmissionDetail.getPasEvent().getPatient().getIdentifiers().iterator();
		while(it.hasNext())
		{
			PatientId patId = (PatientId) it.next();
			if(patId.getType().equals( getDomLookup(type)))
				return patId.getValue();
		}
	}

	return null;
}
 
Example 8
Project: openMAXIMS   File: WardViewImpl.java   Source Code and License 6 votes vote down vote up
public AdmissionDetailMotherVo getMothersAdmission(PatientRefVo patient)
{
	if (patient == null || patient.getID_Patient() == null)
		throw new CodingRuntimeException("patient is null or id not provided in method getMothersAdmission");
	
	//get the patient to read ClientParent value
	Patient doPatient = (Patient) getDomainFactory().getDomainObject(patient); 		
	
	if(doPatient != null && doPatient.getClientParent() != null)
	{
		List<?> admissions = getDomainFactory().find("from AdmissionDetail adm left join fetch adm.pasEvent as pe left join fetch pe.patient as pat where pat.id = " + doPatient.getClientParent().getId()  + "order by adm.systemInformation.creationDateTime desc");
		if(admissions != null && admissions.size() > 0)
			return AdmissionDetailMotherVoAssembler.create((AdmissionDetail) admissions.get(0));
	}
	
	return null;
}
 
Example 9
Project: openMAXIMS   File: RTTMaintainanceImpl.java   Source Code and License 6 votes vote down vote up
private void undoAdmissionClockImpact(PathwayRTTClockImpactUndoVo clockImpact) throws DomainInterfaceException, StaleObjectException
{
	// Get Admission Details record for Clock Impact
	String query = "SELECT admissionDetail FROM AdmissionDetail AS admissionDetail LEFT JOIN admissionDetail.admissionRTTOutcome AS clockImpact WHERE clockImpact.id = :ID_IMPACT";
	
	ArrayList<String> paramNames = new ArrayList<String>();
	ArrayList<Object> paramValues = new ArrayList<Object>();
	
	paramNames.add("ID_IMPACT");
	paramValues.add(clockImpact.getID_PathwaysRTTClockImpact());
	
	AdmissionDetail admissionDetailDom = (AdmissionDetail) getDomainFactory().findFirst(query, paramNames, paramValues);
	PathwayRTTClockImpactVo pathwayClockImpact = PathwayRTTClockImpactVoAssembler.create((PathwaysRTTClockImpact) getDomainFactory().getDomainObject(PathwaysRTTClockImpact.class, clockImpact.getID_PathwaysRTTClockImpact()));

	if (admissionDetailDom != null)
	{
		AdmissionDetailUndoClockImpactVo admissionDetail = AdmissionDetailUndoClockImpactVoAssembler.create(admissionDetailDom);
		IRecordRTTClockImpact referralDetailsImpl = (IRecordRTTClockImpact) getDomainImpl(ReferralDetailsImpl.class);
		referralDetailsImpl.undoAdmissionClockImpact(admissionDetail, pathwayClockImpact);
	}
}
 
Example 10
Project: openMAXIMS   File: EDischargeSummarySthkComponentImpl.java   Source Code and License 6 votes vote down vote up
public AdmissionDetailVo getAdmissionDetailByCareContext(CareContextRefVo voCC) 
{
	if (voCC == null || voCC.getID_CareContext() == null)
		throw new CodingRuntimeException("careContext is null or id not provided in method getAdmissionDetailByCareContext");
	
	List items = getDomainFactory().find(" select cc.pasEvent.id from CareContext as cc where cc.id = " +  voCC.getID_CareContext());
	if(items != null && items.size() > 0)
	{
		Integer eventId = (Integer) items.get(0);
	
		if(eventId!= null && eventId  > 0)
		{
			List ieItems = getDomainFactory().find(" from AdmissionDetail ad where ad.pasEvent.id = " +  eventId);
			if(ieItems != null && ieItems.size() > 0)
				return AdmissionDetailVoAssembler.create((AdmissionDetail) ieItems.get(0));
		}	
	}
	
	return null;
}
 
Example 11
Project: openMAXIMS   File: AdmissionDetailsImpl.java   Source Code and License 6 votes vote down vote up
/**
* Method used to retrieve Admission Details.
*/
public AdmissionDetailLiteWithInpatientEpisodeVo getAdmission(AdmissionDetailRefVo admission)
{
	// Check admission record parameter
	if (admission == null || !admission.getID_AdmissionDetailIsNotNull())
		return null;
	
	AdmissionDetailLiteWithInpatientEpisodeVo admissionDetails = AdmissionDetailLiteWithInpatientEpisodeVoAssembler.create((AdmissionDetail) getDomainFactory().getDomainObject(AdmissionDetail.class, admission.getID_AdmissionDetail()));

	// Get Inpatient episode if exists
	String query = "SELECT inpEp FROM InpatientEpisode AS inpEp LEFT JOIN inpEp.pasEvent AS pas1, AdmissionDetail AS admtDetail LEFT JOIN admtDetail.pasEvent AS pas2 WHERE pas1.id = pas2.id AND admtDetail.id = :ADM_ID AND inpEp.isRIE is null";
	
	ArrayList<String> paramNames = new ArrayList<String>();
	ArrayList<Object> paramValues = new ArrayList<Object>();
	
	paramNames.add("ADM_ID");
	paramValues.add(admissionDetails.getID_AdmissionDetail());
	
	InpatientEpisodeBedNumberUpdateVo inpatientEpisode = InpatientEpisodeBedNumberUpdateVoAssembler.create((InpatientEpisode) getDomainFactory().findFirst(query, paramNames, paramValues));
	
	admissionDetails.setInpatientEpisode(inpatientEpisode);
	
	return admissionDetails;
}
 
Example 12
Project: openMAXIMS   File: BedInfoDialogImpl.java   Source Code and License 6 votes vote down vote up
private String getPatientIdValue(AdmissionDetail doAdmissionDetail, PatIdType type) 
{
	if(doAdmissionDetail == null)
		return null;
	
	if(doAdmissionDetail.getPasEvent() != null && doAdmissionDetail.getPasEvent().getPatient() != null && doAdmissionDetail.getPasEvent().getPatient().getIdentifiers() != null)
	{
		Iterator it = doAdmissionDetail.getPasEvent().getPatient().getIdentifiers().iterator();
		while(it.hasNext())
		{
			PatientId patId = (PatientId) it.next();
			if(patId.getType().equals( getDomLookup(type)))
				return patId.getValue();
		}
	}
	
	return null;
}
 
Example 13
Project: openMAXIMS   File: BedAdmissionComponentImpl.java   Source Code and License 6 votes vote down vote up
private String getPatientIdValue(AdmissionDetail doAdmissionDetail, PatIdType type) 
{
	if(doAdmissionDetail == null)
		return null;
	
	if(doAdmissionDetail.getPasEvent() != null && doAdmissionDetail.getPasEvent().getPatient() != null && doAdmissionDetail.getPasEvent().getPatient().getIdentifiers() != null)
	{
		Iterator it = doAdmissionDetail.getPasEvent().getPatient().getIdentifiers().iterator();
		while(it.hasNext())
		{
			PatientId patId = (PatientId) it.next();
			if(patId.getType().equals( getDomLookup(type)))
				return patId.getValue();
		}
	}
	
	return null;
}
 
Example 14
Project: openMAXIMS   File: WardViewImpl.java   Source Code and License 6 votes vote down vote up
public AdmissionDetailLiteVo getMothersAdmission(PatientRefVo patient)
{
	if (patient == null || patient.getID_Patient() == null)
		throw new CodingRuntimeException("patient is null or id not provided in method getMothersAdmission");
	
	//get the patient to read ClientParent value
	Patient doPatient = (Patient) getDomainFactory().getDomainObject(patient); 		
	
	if(doPatient != null && doPatient.getClientParent() != null)
	{
		List admissions = getDomainFactory().find("from AdmissionDetail adm left join fetch adm.pasEvent as pe left join fetch pe.patient as pat where pat.id = " + doPatient.getClientParent().getId());
		if(admissions != null && admissions.size() > 0)
			return AdmissionDetailLiteVoAssembler.create((AdmissionDetail) admissions.get(0));
	}
	
	return null;
}
 
Example 15
Project: openMAXIMS   File: EDischargeSummarySthkComponentImpl.java   Source Code and License 6 votes vote down vote up
public AdmissionDetailVo getAdmissionDetailByCareContext(CareContextRefVo voCC) 
{
	if (voCC == null || voCC.getID_CareContext() == null)
		throw new CodingRuntimeException("careContext is null or id not provided in method getAdmissionDetailByCareContext");
	
	List items = getDomainFactory().find(" select cc.pasEvent.id from CareContext as cc where cc.id = " +  voCC.getID_CareContext());
	if(items != null && items.size() > 0)
	{
		Integer eventId = (Integer) items.get(0);
	
		if(eventId!= null && eventId  > 0)
		{
			List ieItems = getDomainFactory().find(" from AdmissionDetail ad where ad.pasEvent.id = " +  eventId);
			if(ieItems != null && ieItems.size() > 0)
				return AdmissionDetailVoAssembler.create((AdmissionDetail) ieItems.get(0));
		}	
	}
	
	return null;
}
 
Example 16
Project: openMAXIMS   File: AdmissionDetailsImpl.java   Source Code and License 6 votes vote down vote up
/**
* Method used to retrieve Admission Details.
*/
public AdmissionDetailLiteWithInpatientEpisodeVo getAdmission(AdmissionDetailRefVo admission)
{
	// Check admission record parameter
	if (admission == null || !admission.getID_AdmissionDetailIsNotNull())
		return null;
	
	AdmissionDetailLiteWithInpatientEpisodeVo admissionDetails = AdmissionDetailLiteWithInpatientEpisodeVoAssembler.create((AdmissionDetail) getDomainFactory().getDomainObject(AdmissionDetail.class, admission.getID_AdmissionDetail()));

	// Get Inpatient episode if exists
	String query = "SELECT inpEp FROM InpatientEpisode AS inpEp LEFT JOIN inpEp.pasEvent AS pas1, AdmissionDetail AS admtDetail LEFT JOIN admtDetail.pasEvent AS pas2 WHERE pas1.id = pas2.id AND admtDetail.id = :ADM_ID AND inpEp.isRIE is null";
	
	ArrayList<String> paramNames = new ArrayList<String>();
	ArrayList<Object> paramValues = new ArrayList<Object>();
	
	paramNames.add("ADM_ID");
	paramValues.add(admissionDetails.getID_AdmissionDetail());
	
	InpatientEpisodeBedNumberUpdateVo inpatientEpisode = InpatientEpisodeBedNumberUpdateVoAssembler.create((InpatientEpisode) getDomainFactory().findFirst(query, paramNames, paramValues));
	
	admissionDetails.setInpatientEpisode(inpatientEpisode);
	
	return admissionDetails;
}
 
Example 17
Project: openmaxims-linux   File: BedInfoDialogImpl.java   Source Code and License 6 votes vote down vote up
private String getPatientIdValue(AdmissionDetail doAdmissionDetail, PatIdType type) 
{
	if(doAdmissionDetail == null)
		return null;
	
	if(doAdmissionDetail.getPasEvent() != null && doAdmissionDetail.getPasEvent().getPatient() != null && doAdmissionDetail.getPasEvent().getPatient().getIdentifiers() != null)
	{
		Iterator it = doAdmissionDetail.getPasEvent().getPatient().getIdentifiers().iterator();
		while(it.hasNext())
		{
			PatientId patId = (PatientId) it.next();
			if(patId.getType().equals( getDomLookup(type)))
				return patId.getValue();
		}
	}
	
	return null;
}
 
Example 18
Project: openmaxims-linux   File: BedAdmissionComponentImpl.java   Source Code and License 6 votes vote down vote up
private String getPatientIdValue(AdmissionDetail doAdmissionDetail, PatIdType type) 
{
	if(doAdmissionDetail == null)
		return null;
	
	if(doAdmissionDetail.getPasEvent() != null && doAdmissionDetail.getPasEvent().getPatient() != null && doAdmissionDetail.getPasEvent().getPatient().getIdentifiers() != null)
	{
		Iterator it = doAdmissionDetail.getPasEvent().getPatient().getIdentifiers().iterator();
		while(it.hasNext())
		{
			PatientId patId = (PatientId) it.next();
			if(patId.getType().equals( getDomLookup(type)))
				return patId.getValue();
		}
	}
	
	return null;
}
 
Example 19
Project: openmaxims-linux   File: WardViewImpl.java   Source Code and License 6 votes vote down vote up
public AdmissionDetailLiteVo getMothersAdmission(PatientRefVo patient)
{
	if (patient == null || patient.getID_Patient() == null)
		throw new CodingRuntimeException("patient is null or id not provided in method getMothersAdmission");
	
	//get the patient to read ClientParent value
	Patient doPatient = (Patient) getDomainFactory().getDomainObject(patient); 		
	
	if(doPatient != null && doPatient.getClientParent() != null)
	{
		List admissions = getDomainFactory().find("from AdmissionDetail adm left join fetch adm.pasEvent as pe left join fetch pe.patient as pat where pat.id = " + doPatient.getClientParent().getId());
		if(admissions != null && admissions.size() > 0)
			return AdmissionDetailLiteVoAssembler.create((AdmissionDetail) admissions.get(0));
	}
	
	return null;
}
 
Example 20
Project: openmaxims-linux   File: EDischargeSummarySthkComponentImpl.java   Source Code and License 6 votes vote down vote up
public AdmissionDetailVo getAdmissionDetailByCareContext(CareContextRefVo voCC) 
{
	if (voCC == null || voCC.getID_CareContext() == null)
		throw new CodingRuntimeException("careContext is null or id not provided in method getAdmissionDetailByCareContext");
	
	List items = getDomainFactory().find(" select cc.pasEvent.id from CareContext as cc where cc.id = " +  voCC.getID_CareContext());
	if(items != null && items.size() > 0)
	{
		Integer eventId = (Integer) items.get(0);
	
		if(eventId!= null && eventId  > 0)
		{
			List ieItems = getDomainFactory().find(" from AdmissionDetail ad where ad.pasEvent.id = " +  eventId);
			if(ieItems != null && ieItems.size() > 0)
				return AdmissionDetailVoAssembler.create((AdmissionDetail) ieItems.get(0));
		}	
	}
	
	return null;
}
 
Example 21
Project: openmaxims-linux   File: AdmissionDetailsImpl.java   Source Code and License 6 votes vote down vote up
/**
* Method used to retrieve Admission Details.
*/
public AdmissionDetailLiteWithInpatientEpisodeVo getAdmission(AdmissionDetailRefVo admission)
{
	// Check admission record parameter
	if (admission == null || !admission.getID_AdmissionDetailIsNotNull())
		return null;
	
	AdmissionDetailLiteWithInpatientEpisodeVo admissionDetails = AdmissionDetailLiteWithInpatientEpisodeVoAssembler.create((AdmissionDetail) getDomainFactory().getDomainObject(AdmissionDetail.class, admission.getID_AdmissionDetail()));

	// Get Inpatient episode if exists
	String query = "SELECT inpEp FROM InpatientEpisode AS inpEp LEFT JOIN inpEp.pasEvent AS pas1, AdmissionDetail AS admtDetail LEFT JOIN admtDetail.pasEvent AS pas2 WHERE pas1.id = pas2.id AND admtDetail.id = :ADM_ID AND inpEp.isRIE is null";
	
	ArrayList<String> paramNames = new ArrayList<String>();
	ArrayList<Object> paramValues = new ArrayList<Object>();
	
	paramNames.add("ADM_ID");
	paramValues.add(admissionDetails.getID_AdmissionDetail());
	
	InpatientEpisodeBedNumberUpdateVo inpatientEpisode = InpatientEpisodeBedNumberUpdateVoAssembler.create((InpatientEpisode) getDomainFactory().findFirst(query, paramNames, paramValues));
	
	admissionDetails.setInpatientEpisode(inpatientEpisode);
	
	return admissionDetails;
}
 
Example 22
Project: AvoinApotti   File: ClinicalAdmissionImpl.java   Source Code and License 5 votes vote down vote up
public AdmissionDetailForClinicalAdmissionVo getPASAdmissionDetails(PASEventRefVo pasEvent) 
{
	if(pasEvent == null || pasEvent.getID_PASEvent() == null)
		throw new CodingRuntimeException("Can not get AdmissionDetail on null PASEvent Id.");
	
	DomainFactory factory = getDomainFactory();
	String query = "from AdmissionDetail as ad where ad.pasEvent.id = :PASEvent";
	
	List<?> list = factory.find(query, new String[] {"PASEvent"}, new Object[] {pasEvent.getID_PASEvent()});
	
	if(list != null && list.size() > 0)
		return AdmissionDetailForClinicalAdmissionVoAssembler.create((AdmissionDetail) list.get(0));
	
	return null;
}
 
Example 23
Project: AvoinApotti   File: BedInfoDialogImpl.java   Source Code and License 5 votes vote down vote up
public void saveTransferOut(PendingTransfersLiteVo pendingTransfer) throws StaleObjectException, DomainInterfaceException
{
	if(pendingTransfer == null)
		throw new CodingRuntimeException("pendingTransfer is null in method saveTransferOut");
	if(!pendingTransfer.isValidated())
		throw new CodingRuntimeException("pendingTransfer has not been validated in method saveTransferOut");
	
	//WDEV-9192
	if(pendingTransfer.getInpatientEpisodeIsNotNull())
	{
		String currentTransfer = "";
		if(pendingTransfer.getID_PendingTransfers() != null)
			currentTransfer = " and pt.id <> '" +  pendingTransfer.getID_PendingTransfers() + "'";
		
		List existingPTs = getDomainFactory().find("from PendingTransfers pt where pt.inpatientEpisode.id = '" + pendingTransfer.getInpatientEpisode().getID_InpatientEpisode() + "'" + currentTransfer);
		if(existingPTs != null && existingPTs.size() > 0)
			throw new DomainInterfaceException("Patient already has a transfer pending, the screen will be refreshed");
	}
	
	//WDEV-10421
	PendingTransfers doTransfer = PendingTransfersLiteVoAssembler.extractPendingTransfers(getDomainFactory(), pendingTransfer);
	//get the admission detail record and update its history for transfers
	AdmissionDetail doAdmissionDetail = populateTransferHistory(doTransfer, TRANSFEROUT, null);
		
	try
	{
		getDomainFactory().save(doTransfer);	
		if(doAdmissionDetail != null)
			getDomainFactory().save(doAdmissionDetail);	
	}
	catch (IllegalArgumentException e)
	{
		//where object has been deleted - this happens when a transfer in has been deleted (transfer complete) and this user has the old pending transfer record and is trying to update it
		throw new DomainInterfaceException("Patient's transfer has already been processed, the screen will be refreshed");
	}
}
 
Example 24
Project: AvoinApotti   File: BedInfoDialogImpl.java   Source Code and License 5 votes vote down vote up
public void cancelTransfer(PendingTransfersRefVo voTransfer, LocationRefVo voCancellingFromWard) throws StaleObjectException, ForeignKeyViolationException
{		
	if (voTransfer == null || voTransfer.getID_PendingTransfers() == null)
		throw new CodingRuntimeException("voTransfer is null or id not provided in method cancelTransfer");
	
	//WDEV-10421 - get the admission detail record and update its history for transfers
	PendingTransfers doPending = (PendingTransfers) getDomainFactory().getDomainObject(voTransfer);
	AdmissionDetail doAdmissionDetail = populateTransferHistory(doPending, TRANSFERCANCEL, voCancellingFromWard);

	getDomainFactory().delete("from PendingTransfers p where p.id = '" + voTransfer.getID_PendingTransfers() + "'");
	
	//WDEV-10421
	if(doAdmissionDetail != null)
		getDomainFactory().save(doAdmissionDetail);
}
 
Example 25
Project: AvoinApotti   File: BedInfoDialogImpl.java   Source Code and License 5 votes vote down vote up
public PatientElectiveListBedAdmissionVo getPatientElectiveListForDischarge(PASEventRefVo pasEvent)
{
	if (pasEvent == null || pasEvent.getID_PASEvent() == null)
		return null;
	
	// WDEV-18617  - For some reason only one pasevent being created so have to get the most recent
	StringBuilder query = new StringBuilder("SELECT adm from AdmissionDetail adm LEFT JOIN adm.pasEvent AS pas ");
	
	//StringBuilder query = new StringBuilder("SELECT pel FROM PatientElectiveList AS pel LEFT JOIN pel.referral AS cats LEFT JOIN cats.careContext AS context LEFT JOIN context.pasEvent AS pas ");
	query.append(" WHERE pas.id = :PAS_ID");
	query.append(" order by adm.admissionDateTime desc ");
	
	ArrayList<String> paramNames = new ArrayList<String>();		
	ArrayList<Object> paramValues = new ArrayList<Object>();
	paramNames.add("PAS_ID");														
	paramValues.add(pasEvent.getID_PASEvent());
	
	AdmissionDetail domAdmission = (AdmissionDetail) getDomainFactory().findFirst(query.toString(), paramNames, paramValues);
	
	// WDEV-18617  - Get the ELE for this pas event - not the first one for the Referral!!!
	query = new StringBuilder("SELECT pel FROM PatientElectiveList AS pel LEFT JOIN pel.tCIDetails AS tci LEFT JOIN tci.admissionDetail AS adm ");
	
	//StringBuilder query = new StringBuilder("SELECT pel FROM PatientElectiveList AS pel LEFT JOIN pel.referral AS cats LEFT JOIN cats.careContext AS context LEFT JOIN context.pasEvent AS pas ");
	query.append(" WHERE adm.id = :ADM_ID");
	
	
	paramNames = new ArrayList<String>();
	paramValues = new ArrayList<Object>();
	paramNames.add("ADM_ID");				
	paramValues.add(domAdmission.getId());
	
	return PatientElectiveListBedAdmissionVoAssembler.create((PatientElectiveList) getDomainFactory().findFirst(query.toString(), paramNames, paramValues));
}
 
Example 26
Project: AvoinApotti   File: ADTImpl.java   Source Code and License 5 votes vote down vote up
private AdmissionDetail getCurrentAdmissionDetail(PASEvent pasEvent)
{
	DomainFactory factory = getDomainFactory();
	String hql = "from AdmissionDetail ad where ad.pasEvent=:pasEvent";
	List<?> l = factory.find(hql,new String[]{"pasEvent"},new Object[]{pasEvent});
	if (l != null && l.size() > 0)
	{
		return (AdmissionDetail)l.get(0);
	}
	return null;
}
 
Example 27
Project: AvoinApotti   File: ADTImpl.java   Source Code and License 5 votes vote down vote up
/**
 * WDEV-16240
 * Create Dementia Record - creates the Dementia record based on values from AdmissionDetail and the previous dementia record for the patient
 * @param factory
 * @param lastDementiaRecord - previous dementia record for the patient
 * @param adt - Admission Detail record to be associated with this new Dementia record
 * @param age - Patients age
 * @param breachHours - the number of hours following AdmissionDateTime in which this task would have breached
 * @throws StaleObjectException 
 */
private void createDementiaRecord(DomainFactory factory, Dementia lastDementiaRecord, AdmissionDetail adt, int age, int breachHours) throws StaleObjectException
{
	AuthoringInformation auth = new AuthoringInformation();
	auth.setAuthoringDateTime(new Date());

	Dementia domDem = new Dementia();
	DementiaWorklistStatus stat = new DementiaWorklistStatus();
	
	stat.setAuthoringInformation(auth);
	stat.setStatus(getDomLookup(ims.core.vo.lookups.DementiaWorklistStatus.STEP_ONE_FIND_OUTSTANDING));
	
	domDem.setAdmissionDateTime(adt.getAdmissionDateTime());
	domDem.setAdmissionDetail(adt);
	domDem.setAgeOnAdmission(age);
	domDem.setBreachDateTime(calculateBreachDate(adt.getAdmissionDateTime(), breachHours));
	domDem.setPatient(adt.getPasEvent().getPatient());
	domDem.setCurrentWorklistStatus(stat);
	domDem.getHistoricalWorklistStatus().add(stat);

	// If the previous Dementia Record as confirmedDementia, then this status needs to be set to complete
	if (lastDementiaRecord != null && lastDementiaRecord.isDementiaConfirmed()!= null && lastDementiaRecord.isDementiaConfirmed() == true)
	{
		stat.setStatus(getDomLookup(ims.core.vo.lookups.DementiaWorklistStatus.COMPLETED));
		domDem.setDementiaConfirmed(true);
		domDem.setBreachDateTime(null);
	}
	
	factory.save(domDem);
}
 
Example 28
Project: AvoinApotti   File: ADTImpl.java   Source Code and License 5 votes vote down vote up
/**
 * WDEV-16240
 * updateDementiaRecordForCancelDischarge - As this is a cancel discharge, we have to clear out discharge date and possibly remove excluded status records
 * @param factory
 * @param doAdmissionDetail
 * @throws StaleObjectException 
 * @throws ForeignKeyViolationException 
 */
private void updateDementiaRecordForCancelDischarge(DomainFactory factory, AdmissionDetail doAdmissionDetail) throws StaleObjectException, ForeignKeyViolationException
{
	if (ConfigFlag.GEN.DEMENTIA_FUNCTIONALITY.getValue() == false)
		return;
	
	// Get the Dementia Record for this Admission record
	ArrayList<Object> values = new ArrayList<Object>();
	ArrayList<String> labels = new ArrayList<String>();
	values.add(doAdmissionDetail);
	labels.add("admission");
	List lst = factory.find(" from Dementia d where d.admissionDetail = :admission and (d.isRIE is null or d.isRIE = false) ", labels, values);
	if (lst == null || lst.size() == 0)
		return;
	
	Dementia domDem = (Dementia) lst.get(0);
	
	domDem.setDischargeDateTime(null);
	// If the current status is excluded, we want to remove this
	if (domDem.getCurrentWorklistStatus().getReasonForExclusion() != null && domDem.getCurrentWorklistStatus().getReasonForExclusion().getId() == ims.core.vo.lookups.DementiaReasonForExclusion.EARLY_DISCHARGE.getID())
	{
		DementiaWorklistStatus stat = domDem.getCurrentWorklistStatus();
		domDem.getHistoricalWorklistStatus().remove(domDem.getHistoricalWorklistStatus().size()-1); // Remove the last record
		domDem.setCurrentWorklistStatus((DementiaWorklistStatus) domDem.getHistoricalWorklistStatus().get(domDem.getHistoricalWorklistStatus().size()-1));
		factory.delete(stat);
		domDem.setIsExcludedFromWorklist(false);
	}
	
	factory.save(domDem);

}
 
Example 29
Project: AvoinApotti   File: ADTImpl.java   Source Code and License 5 votes vote down vote up
/**
 * WDEV-16240
 * updateDementiaRecordForInpatient - update Dementia record if specific inpatient details modified
 * @param factory
 * @param doAdmissionDetail
 * @throws StaleObjectException 
 */
private void updateDementiaRecordForInpatient(DomainFactory factory, AdmissionDetail doAdmissionDetail) throws StaleObjectException
{
	if (ConfigFlag.GEN.DEMENTIA_FUNCTIONALITY.getValue() == false)
		return;
	
	// Get the Dementia Record for this Admission record
	ArrayList<Object> values = new ArrayList<Object>();
	ArrayList<String> labels = new ArrayList<String>();
	values.add(doAdmissionDetail);
	labels.add("admission");
	List lst = factory.find(" from Dementia d where d.admissionDetail = :admission and (d.isRIE is null or d.isRIE = false) ", labels, values);
	if (lst == null || lst.size() == 0)
		return;
	
	Dementia domDem = (Dementia) lst.get(0);
	
	// We only want to update the Dementia record if the admission datetime has been modified
	if (domDem.getAdmissionDateTime() != null && domDem.getAdmissionDateTime().equals(doAdmissionDetail.getAdmissionDateTime()))
		return;

	// Get the Dementia Configuration record
	DementiaConfiguration dementiaConfig = getDementiaConfigRecord(factory);
	if (dementiaConfig == null)
		return;
	
	domDem.setAdmissionDateTime(doAdmissionDetail.getAdmissionDateTime());
	domDem.setBreachDateTime(calculateBreachDate(doAdmissionDetail.getAdmissionDateTime(), dementiaConfig.getStepOnePeriod()));
	domDem.setAgeOnAdmission(calculateAge(doAdmissionDetail.getPasEvent().getPatient(), doAdmissionDetail.getAdmissionDateTime()));

	factory.save(domDem);
}
 
Example 30
Project: AvoinApotti   File: ADTDischargeDetailsComponentImpl.java   Source Code and License 5 votes vote down vote up
public ims.core.vo.AdmissionDetailVo getAdmissionDetailById(ims.core.admin.pas.vo.AdmissionDetailRefVo admDetRef)
{
	if( admDetRef == null)
		throw new CodingRuntimeException("This AdmissionDetailRefVo is null");
	
	DomainFactory factory = getDomainFactory();
	AdmissionDetail doAdmissionDetail = (AdmissionDetail) factory.getDomainObject(AdmissionDetail.class, admDetRef.getID_AdmissionDetail());
		
	return AdmissionDetailVoAssembler.create(doAdmissionDetail);
}
 
Example 31
Project: AvoinApotti   File: BedAdmissionComponentImpl.java   Source Code and License 5 votes vote down vote up
public AdmissionDetailVo getAdmissionDetailByPasEvent(PASEventRefVo pasEvent)
{
	if (pasEvent == null || pasEvent.getID_PASEvent() == null)
		throw new CodingRuntimeException("pasEvent is null or id not provided in method getAdmissionDetailByPasEvent");
	
	List lstAdmissions = getDomainFactory().find("from AdmissionDetail admDet where admDet.pasEvent.id = " + pasEvent.getID_PASEvent());
	if(lstAdmissions != null && lstAdmissions.size() == 1)
		return AdmissionDetailVoAssembler.create((AdmissionDetail) lstAdmissions.get(0));
	
	return null;
}
 
Example 32
Project: AvoinApotti   File: CDSGenerateImpl.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings({"rawtypes"})
private AdmissionDetail getAdmissionRecord(DomainFactory factory,PASEvent domEvent) 
{
	List lst = AdmissionDetail.listAdmissionDetailByPasEvent(factory, domEvent);
	if (lst == null || lst.size() == 0)
		return null;
	return (AdmissionDetail)lst.get(0);
}
 
Example 33
Project: AvoinApotti   File: AdmissionDetailsImpl.java   Source Code and License 5 votes vote down vote up
/**
* Method used to save Admission Details.
*/
public AdmissionDetailLiteWithInpatientEpisodeVo saveAdmission(AdmissionDetailLiteWithInpatientEpisodeVo admission) throws StaleObjectException, ForeignKeyViolationException, UniqueKeyViolationException
{
	// Check for validated parameter
	if (admission == null || admission.isValidated() == false)
		throw new DomainRuntimeException("Logical error - can't save null or not-validated object");

	boolean hasInpatient = admission.getInpatientEpisodeIsNotNull();

	// Extract domain objects (admission details & inpatient episode for bed number)
	AdmissionDetail domainAdmissionDetail = AdmissionDetailLiteVoAssembler.extractAdmissionDetail(getDomainFactory(), admission);
	InpatientEpisode domainInpatientEpisode = null;

	if (hasInpatient)
	{
		domainInpatientEpisode = InpatientEpisodeBedNumberUpdateVoAssembler.extractInpatientEpisode(getDomainFactory(), admission.getInpatientEpisode());
	}

	// Commit to database both domain objects
	getDomainFactory().save(domainAdmissionDetail);

	if (hasInpatient)
	{
		getDomainFactory().save(domainInpatientEpisode);
	}

	AdmissionDetailLiteWithInpatientEpisodeVo admissionDetails = AdmissionDetailLiteWithInpatientEpisodeVoAssembler.create(domainAdmissionDetail);

	if (hasInpatient)
	{
		InpatientEpisodeBedNumberUpdateVo inpatientEpisode = InpatientEpisodeBedNumberUpdateVoAssembler.create(domainInpatientEpisode);

		admissionDetails.setInpatientEpisode(inpatientEpisode);
	}

	// Return saved record
	return admissionDetails;
}
 
Example 34
Project: openMAXIMS   File: ClinicalAdmissionImpl.java   Source Code and License 5 votes vote down vote up
public AdmissionDetailForClinicalAdmissionVo getPASAdmissionDetails(PASEventRefVo pasEvent) 
{
	if(pasEvent == null || pasEvent.getID_PASEvent() == null)
		throw new CodingRuntimeException("Can not get AdmissionDetail on null PASEvent Id.");
	
	DomainFactory factory = getDomainFactory();
	String query = "from AdmissionDetail as ad where ad.pasEvent.id = :PASEvent";
	
	List<?> list = factory.find(query, new String[] {"PASEvent"}, new Object[] {pasEvent.getID_PASEvent()});
	
	if(list != null && list.size() > 0)
		return AdmissionDetailForClinicalAdmissionVoAssembler.create((AdmissionDetail) list.get(0));
	
	return null;
}
 
Example 35
Project: openMAXIMS   File: AssignBedToHomeLeaveInpatientImpl.java   Source Code and License 5 votes vote down vote up
public ims.core.vo.AdmissionDetailVo getAdmissionDetail(ims.core.admin.pas.vo.PASEventRefVo pasEventRef)
{
	if (pasEventRef == null)
		return null;
	DomainFactory factory = getDomainFactory();
	
	return AdmissionDetailVoAssembler.create((AdmissionDetail) factory.findFirst("select adm from AdmissionDetail adm left join adm.pasEvent as pevent where pevent.id = :PASEVENT_ID", "PASEVENT_ID", pasEventRef.getID_PASEvent()));
}
 
Example 36
Project: openMAXIMS   File: InpatientEpisodeMaintenanceImpl.java   Source Code and License 5 votes vote down vote up
private PendingEmergencyTheatre getPendingEmergencyTheatre(DomainFactory factory, AdmissionDetail doAdmissionDetail)
{
	if(doAdmissionDetail==null)
		return null;
	String query = "select pet from PendingEmergencyTheatre as pet left join pet.admissionDetail as ad where  (pet.isRIE is null or pet.isRIE = false) and ad.id = "+doAdmissionDetail.getId();
	List <PendingEmergencyTheatre> petList = factory.find(query);
	PendingEmergencyTheatre pendingEmergencyTheatre = null;
	if(petList!=null && petList.size()>0)
	{
		pendingEmergencyTheatre = (PendingEmergencyTheatre)petList.get(0);
	}
	return pendingEmergencyTheatre;
}
 
Example 37
Project: openMAXIMS   File: InpatientEpisodeMaintenanceImpl.java   Source Code and License 5 votes vote down vote up
private PendingNoEDEmergencyAdmit getPendingNoEDEmergencyAdmit(DomainFactory factory, AdmissionDetail doAdmissionDetail)
{
	if(doAdmissionDetail==null)
		return null;
	String query = "select pnoed from PendingNoEDEmergencyAdmit as pnoed left join pnoed.admissionDetail as ad where (pnoed.isRIE is null or pnoed.isRIE = false) and ad.id = "+doAdmissionDetail.getId();
	List <PendingNoEDEmergencyAdmit> petList = factory.find(query);
	PendingNoEDEmergencyAdmit pendingNoEDEmergencyAdmit = null;
	if(petList!=null && petList.size()>0)
	{
		pendingNoEDEmergencyAdmit = (PendingNoEDEmergencyAdmit)petList.get(0);
	}
	return pendingNoEDEmergencyAdmit;
}
 
Example 38
Project: openMAXIMS   File: InpatientEpisodeMaintenanceImpl.java   Source Code and License 5 votes vote down vote up
private void updateOccupiedBedsForWardAndBay(InpatientEpisode episode,  AdmissionDetail doAdmissionDetail) throws StaleObjectException
{
	if(doAdmissionDetail!=null
		&&doAdmissionDetail.getWard()!=null
		&&doAdmissionDetail.getWard().getId()!=null
		&&episode!=null
		&&episode.getBed()!=null
		&&episode.getBed().getBay()!=null)
	{
		LocationLiteVo locBay = LocationLiteVoAssembler.create(episode.getBed().getBay());
		updateOccupiedBedsForWardAndBay(new LocationRefVo(doAdmissionDetail.getWard().getId(),doAdmissionDetail.getWard().getVersion()),
			locBay,null);
	}
}
 
Example 39
Project: openMAXIMS   File: InpatientEpisodeMaintenanceImpl.java   Source Code and License 5 votes vote down vote up
private TCIForPatientElectiveList getTCIForPatientElectiveList(DomainFactory factory, AdmissionDetail doAdmissionDetail)
{
	if(doAdmissionDetail==null)
		return null;
	String query = "select tci from TCIForPatientElectiveList as tci left join tci.admissionDetail as ad where  (tci.isRIE is null or tci.isRIE = false) and ad.id = "+doAdmissionDetail.getId();
	List <TCIForPatientElectiveList> tciList = factory.find(query);
	TCIForPatientElectiveList tci = null;
	if(tciList!=null && tciList.size()>0)
	{
		tci = (TCIForPatientElectiveList)tciList.get(0);
	}
	return tci;
}
 
Example 40
Project: openMAXIMS   File: BedInfoDialogImpl.java   Source Code and License 5 votes vote down vote up
public void cancelTransfer(PendingTransfersLiteVo voTransfer, LocationRefVo voCancellingFromWard) throws StaleObjectException, ForeignKeyViolationException
{		
	if (voTransfer == null || voTransfer.getID_PendingTransfers() == null)
		throw new CodingRuntimeException("voTransfer is null or id not provided in method cancelTransfer");
	
	//WDEV-10421 - get the admission detail record and update its history for transfers
	PendingTransfers doPending = (PendingTransfers) getDomainFactory().getDomainObject(voTransfer);
	
	if (doPending == null || doPending.getVersion() > voTransfer.getVersion_PendingTransfers()) //WDEV-20326
		throw new StaleObjectException(doPending, "This transfer has been processed by another user");
	
	AdmissionDetail doAdmissionDetail = populateTransferHistory(doPending, TRANSFERCANCEL, voCancellingFromWard, voTransfer.getCancellationReasonDetails());
	
	// WDEV-19774 - Trigger creation of A26 Cancel Pending Transfer HL7 message
	InpatientEpisodeVo inpatEpisodeVo = InpatientEpisodeVoAssembler.create(doPending.getInpatientEpisode());
	if(inpatEpisodeVo.getPasEvent()!=null)
	{
    	ADT adtimpl = (ADT) getDomainImpl(ADTImpl.class);
		adtimpl.triggerCancelPendingTransferEvent(inpatEpisodeVo.getPasEvent());
	} //WDEV-19974

	getDomainFactory().delete("from PendingTransfers p where p.id = '" + voTransfer.getID_PendingTransfers() + "'");
	
	//WDEV-10421
	if(doAdmissionDetail != null)
		getDomainFactory().save(doAdmissionDetail);
}