Java Code Examples for ims.domain.DomainFactory.getDomainObject()

The following are Jave code examples for showing how to use getDomainObject() of the ims.domain.DomainFactory class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   View Source Code Vote up 6 votes
public String getPracticeNationalCodeForSurgery(LocationRefVo surgery)
{
	DomainFactory factory = getDomainFactory();
	if (surgery==null)
		return null;
	
	 LocSite loc=(LocSite)factory.getDomainObject(surgery);//(Organisation.class, id));
	 if (loc!=null&&
			 loc.getType()!=null&&
			 loc.getType().equals(getDomLookup(LocationType.SURGERY))&&
			 loc.getParentOrganisation()!=null)
	 {
		 return loc.getParentOrganisation().getMappingValueOfType(getDomLookup(TaxonomyType.NAT_LOC_CODE));
	 }
	 else 
	 {
		 return null;
	 }
	 
}
 
Example 2
Project: AvoinApotti   File: BedAwaitingBedAvailableImpl.java   View Source Code Vote up 6 votes
public Boolean isStaleTracking(TrackingForBedAvailabilityVo trackingToSave)
{
	if (trackingToSave == null || trackingToSave.getID_Tracking() == null)
	{
		throw new CodingRuntimeException("Cannot get TrackingForBedAvailabilityVo on null Id ");
	}

	DomainFactory factory = getDomainFactory();
	Tracking domainTracking = (Tracking) factory.getDomainObject(Tracking.class, trackingToSave.getID_Tracking());

	if (domainTracking == null)
	{
		return true;
	}

	if (domainTracking.getVersion() > trackingToSave.getVersion_Tracking())
	{
		return true;
	}

	return false;
}
 
Example 3
Project: AvoinApotti   File: OcsIfImpl.java   View Source Code Vote up 6 votes
public void processSpecimenWithoutInvestigations(OrderSpecimenRefVo specimen)
{
	if(specimen==null)
		return;
	LOG.error("processSpecimenWithoutInvestigations"+specimen.getID_OrderSpecimen());

	DomainFactory factory = getDomainFactory();
	OrderSpecimen orderSpecimen =  (OrderSpecimen)factory.getDomainObject(specimen);
	if(orderSpecimen.getInvestigations()==null||orderSpecimen.getInvestigations().size()==0)
	{
		orderSpecimen.setWasProcessed(true);
		try
		{
			factory.save(orderSpecimen);
		}catch (StaleObjectException e)
		{
			LOG.error("StaleObjectException processSpecimenWithoutInvestigations "+specimen.getID_OrderSpecimen());
		}
		
	}
}
 
Example 4
Project: AvoinApotti   File: PatientKioskOperationsImpl.java   View Source Code Vote up 6 votes
private PatientKioskPatientVo populatePatientKioskFromBookingAppointment(PatientRefVo patient) 
{
	if(patient == null || patient.getID_Patient() == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	ims.core.patient.domain.objects.Patient doPatient = (Patient) factory.getDomainObject(Patient.class, patient.getID_Patient());
	PatientShort patientShort = PatientShortAssembler.create(doPatient);
	
	if(patientShort != null)
	{
		PatientKioskPatientVo newPatient = new PatientKioskPatientVo();
		newPatient.setID(patientShort.getID_Patient());
		newPatient.setSurname(patientShort.getNameIsNotNull() ? patientShort.getName().getSurname() : null);
		newPatient.setDOB(patientShort.getDob() != null ? patientShort.getDob().toDate() : null);
		newPatient.setDisplayName(patientShort.getNameIsNotNull() ? patientShort.getName().toString() : null);
		newPatient.setGender(patientShort.getSex());
		newPatient.setPostCode(patientShort.getAddress() != null ? removeString(patientShort.getAddress().getPostCode(), " ") : null);
		
		return newPatient;
	}
	
	return null;
}
 
Example 5
Project: AvoinApotti   File: BedAwaitingBedAvailableImpl.java   View Source Code Vote up 6 votes
public Boolean isStale(BedAvailabilityVo bedAvailabilityToSave)
{
	if (bedAvailabilityToSave == null || bedAvailabilityToSave.getID_BedAvailability() == null)
	{
		throw new CodingRuntimeException("Cannot get BedAvailabilityVo on null Id ");
	}

	DomainFactory factory = getDomainFactory();
	BedAvailability domainBedAvailability = (BedAvailability) factory.getDomainObject(BedAvailability.class, bedAvailabilityToSave.getID_BedAvailability());

	if (domainBedAvailability == null)
	{
		return true;
	}

	if (domainBedAvailability.getVersion() > bedAvailabilityToSave.getVersion_BedAvailability())
	{
		return true;
	}

	return false;
}
 
Example 6
Project: AvoinApotti   File: MyOrderImpl.java   View Source Code Vote up 5 votes
public LocSiteShortVo getTypeOfLocSite(LocationRefVo locRef)
{
	if (locRef == null)
		throw new CodingRuntimeException("Location not provided");

	DomainFactory factory = getDomainFactory();
	LocSite doLocation = (LocSite) factory.getDomainObject(LocSite.class, locRef.getID_Location());
	return LocSiteShortVoAssembler.create(doLocation);
}
 
Example 7
Project: AvoinApotti   File: DocumentGenerationImpl.java   View Source Code Vote up 5 votes
public CareContextListVo getCareContextList(Integer id)
{
	if(id == null)
		throw new CodingRuntimeException("null id passed to getCareContextList !");

	DomainFactory factory = getDomainFactory();
	CareContext  boCareContext = (CareContext)factory.getDomainObject(CareContext.class, id);
	
	return CareContextListVoAssembler.create(boCareContext);
}
 
Example 8
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   View Source Code Vote up 5 votes
/**
 * Method wil step into the structure and retrieve from all sub-levels items that match the search criteria
 * 
 * @param type
 * @param parentLocation
 * @param isActive
 * @param referringHospital
 * @param treatingHosp
 * @param name
 * @return
 */
@SuppressWarnings("unchecked")
private List listLocationsByParentLocation(LocationType type, LocationRefVo parentLocation, Boolean isActive, Boolean referringHospital, Boolean treatingHosp, String name)
{
	//WDEV-6887
	if(name != null)
	{
		String[] arr = null;
		if(name.contains("%"))
		{
			arr = name.split("%");
			if(arr.length > 0)
				name = arr[0] + "%";
			else
				name = "%";
		}
	}

	if(parentLocation == null)
		return listLocations(type, isActive, referringHospital, treatingHosp, name);
	
	DomainFactory factory = getDomainFactory();
	Location doLocation = (Location) factory.getDomainObject(Location.class, parentLocation.getID_Location());
	ArrayList listItems = new ArrayList();
	buildLocationsList(doLocation, listItems, type, isActive, referringHospital, treatingHosp, name);

	return listItems;
}
 
Example 9
Project: AvoinApotti   File: WaitingListConfigurationImpl.java   View Source Code Vote up 5 votes
public ims.admin.vo.ElectiveListConfigurationVo getConfiguration(ims.core.configuration.vo.ElectiveListConfigurationRefVo configurationRef)
{
	if (configurationRef==null ||configurationRef.getID_ElectiveListConfiguration()==null)
	{
		throw new CodingRuntimeException("Cannot get ElectiveListConfigurationVo on null Id ");
	}

	DomainFactory factory = getDomainFactory();

	ElectiveListConfiguration domainWaitListConfig = (ElectiveListConfiguration) factory.getDomainObject(ElectiveListConfiguration.class,configurationRef.getID_ElectiveListConfiguration());

	return ElectiveListConfigurationVoAssembler.create(domainWaitListConfig);
}
 
Example 10
Project: AvoinApotti   File: BedInfoDialogImpl.java   View Source Code Vote up 5 votes
public VTERiskAssessmentWorklistVo getVTERiskAssessmentWorklistById(InpatientEpisodeRefVo inpatEpRef) 
{
	if(	inpatEpRef == null )
		return null;
	
	DomainFactory factory = getDomainFactory();
	InpatientEpisode doInpatientEpisode  =(InpatientEpisode) factory.getDomainObject(InpatientEpisode.class, inpatEpRef.getID_InpatientEpisode());
	return VTERiskAssessmentWorklistVoAssembler.create(doInpatientEpisode);
}
 
Example 11
Project: AvoinApotti   File: GPSelectionImpl.java   View Source Code Vote up 5 votes
public GPLiteWithPracticesVo listGPS(GpRefVo filter)
{
	DomainFactory factory = getDomainFactory();
		
	Gp doGP = (Gp) factory.getDomainObject(Gp.class, filter.getID_Gp());
	return GPLiteWithPracticesVoAssembler.create(doGP);
}
 
Example 12
Project: AvoinApotti   File: AllocateCubicleImpl.java   View Source Code Vote up 5 votes
public ims.emergency.vo.CubicleAllocationVo getCubicleAllocation(ims.emergency.vo.CubicleAllocationRefVo cubicleRef)
{
	if(	cubicleRef == null )
		throw new CodingRuntimeException("CubicleAllocation not provided");
	
	DomainFactory factory = getDomainFactory();
	CubicleAllocation doCubicleAllocation  =(CubicleAllocation) factory.getDomainObject(CubicleAllocation.class, cubicleRef.getID_CubicleAllocation());
	return CubicleAllocationVoAssembler.create(doCubicleAllocation);
	
}
 
Example 13
Project: AvoinApotti   File: EDischargeHelper.java   View Source Code Vote up 5 votes
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 14
Project: AvoinApotti   File: ExternalEventsImpl.java   View Source Code Vote up 5 votes
public OcsOrderSessionRefVo getOrderFromInvestigation(
		OrderInvestigationRefVo investigation) throws DomainInterfaceException {
	if(null==investigation)
	{
		throw new DomainInterfaceException("Investigation should not be null");
	}
	DomainFactory factory = getDomainFactory();
	OrderInvestigation domOrderInv = (OrderInvestigation)factory.getDomainObject(OrderInvestigation.class,investigation.getBoId());
	OcsOrderSessionRefVo orderRef = new OcsOrderSessionRefVo();
	orderRef.setID_OcsOrderSession(domOrderInv.getOrderDetails().getId());
	return orderRef;
}
 
Example 15
Project: AvoinApotti   File: SurgicalAuditPlannedActualProcedureDetailsImpl.java   View Source Code Vote up 5 votes
public LocationLiteVo getLocationLiteVo(LocSiteRefVo locRef) 
{
	if( locRef == null)
		throw new DomainRuntimeException("Location cannot be null.");
	
	
	DomainFactory factory = getDomainFactory();
	Location doLocation = (Location) factory.getDomainObject(Location.class, locRef.getID_Location());
	return LocationLiteVoAssembler.create(doLocation);
}
 
Example 16
Project: AvoinApotti   File: SpecimenCollectionClinicImpl.java   View Source Code Vote up 5 votes
public SpecimenWorkListItemListVo getWorkListItem(Integer workListItemId)
{
	if(workListItemId == null)
		throw new CodingRuntimeException("Cannot get SpecimenWorkListItemListVo for null id");
	
	DomainFactory factory = getDomainFactory();
	SpecimenWorkListItem doSpecimenWorkListItem = (SpecimenWorkListItem) factory.getDomainObject(SpecimenWorkListItem.class, workListItemId);
	return SpecimenWorkListItemListVoAssembler.create(doSpecimenWorkListItem);		
}
 
Example 17
Project: AvoinApotti   File: BookTheatreImpl.java   View Source Code Vote up 4 votes
/**
 * getReferralDetail - Referral Booking Vo contains all the data for the top
 * panel (Referral Details) - in the Booking Screen for CARE_UK
 */
public ims.RefMan.vo.ReferralBookingVo getReferralDetail(ims.RefMan.vo.CatsReferralRefVo catsReferral)
{
	if (catsReferral == null || catsReferral.getID_CatsReferral() == null)
		throw new CodingRuntimeException("catsReferral is null or id not provide for method getReferralDetail");

	DomainFactory factory = getDomainFactory();

	ReferralBookingVo voReferralBooking = new ReferralBookingVo();

	CatsReferral doCatsRef = (CatsReferral) factory.getDomainObject(catsReferral);
	if (doCatsRef != null)
	{
		// WDEV-8144
		voReferralBooking.setIsFitForSurgery(doCatsRef.isIsFitForSurgery());
		if (doCatsRef.getCareContext() != null)
			voReferralBooking.setCareContext(new CareContextRefVo(doCatsRef.getCareContext().getId(), doCatsRef.getCareContext().getVersion()));

		java.util.Date triageDateTime = doCatsRef.getTriageDateTime();
		if (triageDateTime != null)
			voReferralBooking.setTriageDateTime(new ims.framework.utils.DateTime(triageDateTime));

		ReferralLetterDetailsBookingVo voReferralLetterDetail = ReferralLetterDetailsBookingVoAssembler.create(doCatsRef.getReferralDetails());

		if (voReferralLetterDetail != null)
		{
			// WDEV-11713-Start
			if (doCatsRef.getContract() != null)
			{
				voReferralLetterDetail.setDayTo1stApp(doCatsRef.getContract().getDaysTo1stAppt());
				voReferralLetterDetail.setDaysToRTTBreachDate(doCatsRef.getContract().getDaysToRTTBreachDate());
			}
			// WDEV-11713-End
			// WDEV-10473
			if (voReferralLetterDetail.getDateOfReferralIsNotNull())
			{
				ExclusionDatesVo voExDate = listExclusionDates();
				// WDEV-8017 - kpi days within 13 weeks
				Date[] arrDates = null;
				if (voReferralLetterDetail.getDayTo1stAppIsNotNull())// WDEV-11713
					arrDates = ExclusionDatesVo.getKPIDays(voReferralLetterDetail.getDateOfReferral(), voReferralLetterDetail.getDaysToRTTBreachDate(), voExDate != null ? voExDate.getDates() : null, true);// WDEV-11713 & WDEV-12918
				voReferralLetterDetail.setKPIDays(arrDates);
				// WDEV-9539 superceding - kpi within 13 weeks
				voReferralLetterDetail.setEndXdayKPI((ExclusionDatesVo.addBusinessDays(voReferralLetterDetail.getDateOfReferral(), voReferralLetterDetail.getDaysToRTTBreachDate(), voExDate != null ? voExDate.getDates() : null, true)));// WDEV-11713 & WDEV-12918
			}
			voReferralBooking.setReferralLetterDetail(voReferralLetterDetail);
		}
	}

	// Theatre CurrentAppts - theatre appts with status of Booked for
	// Referral
	List theatreAppts = factory.find("select appt from CatsReferral as catsRef join catsRef.appointments as appt where (catsRef.id = :idCatsRef and appt.apptStatus = :bookedStatus and appt.theatreBooking <> null )", new String[]{"idCatsRef", "bookedStatus"}, new Object[]{catsReferral.getID_CatsReferral(), getDomLookup(Status_Reason.BOOKED)});
	voReferralBooking.setCurrentAppointments(BookingAppointmentLiteVoAssembler.createBookingAppointmentLiteVoCollectionFromBooking_Appointment(theatreAppts));

	// TheatreAppts Requiring Rebook for Referral
	List rebookTheatreAppts = factory.find("select appt from CatsReferral as catsRef join catsRef.appointments as appt where (catsRef.id = :idCatsRef and appt.requiresRebook = 1 and appt.theatreBooking <> null )", new String[]{"idCatsRef"}, new Object[]{catsReferral.getID_CatsReferral()});
	voReferralBooking.setAppointmentsRequiringRebook(BookingAppointmentLiteVoAssembler.createBookingAppointmentLiteVoCollectionFromBooking_Appointment(rebookTheatreAppts));

	// Clinical Appts - WDEV-7653
	List clinAppts = factory.find("select appt from CatsReferral as catsRef join catsRef.appointments as appt where (catsRef.id = :idCatsRef and appt.theatreBooking is null )", new String[]{"idCatsRef"}, new Object[]{catsReferral.getID_CatsReferral()});
	voReferralBooking.setOtherAppointments(BookingAppointmentLiteVoAssembler.createBookingAppointmentLiteVoCollectionFromBooking_Appointment(clinAppts));

	// Invs Requiring an appt - For the CatsReferral - orderInvestigations
	// that are in the InvestigationOrders Collection and not in the
	// collection of OrderInvAppt
	List ordInvs = listInvsRequiringAppt(catsReferral, factory);
	voReferralBooking.setOrdersRequiringAppt(OrderInvestigationBookingVoAssembler.createOrderInvestigationBookingVoCollectionFromOrderInvestigation(ordInvs));
	
	voReferralBooking.setReferralEROD(getLastTheatreEROD(catsReferral));
	
	return voReferralBooking;
}
 
Example 18
Project: AvoinApotti   File: ReferralDetailsComponentImpl.java   View Source Code Vote up 4 votes
public ProcedureLiteVoCollection listProcedures(String procedureName, ServiceLiteVo serviceLiteVo) throws DomainInterfaceException
{
	if (serviceLiteVo == null || !serviceLiteVo.getID_ServiceIsNotNull())
		throw new DomainRuntimeException("serviceLiteVo not provided for get call. ");

	DomainFactory factory = getDomainFactory();

	Service domServ = (Service) factory.getDomainObject(Service.class, serviceLiteVo.getID_Service());
	ServiceVo serviceVo = ServiceVoAssembler.create(domServ);

	if (serviceVo.getSpecialty() == null)
		return null;

	ArrayList<String> markers = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();
	StringBuffer condStr = new StringBuffer();
	String hql = " select proc from ProcedureHotlist phot left join phot.hotlistItem as pitem left join pitem.procedure as proc ";
	String andStr = " ";

	if (serviceVo.getSpecialtyIsNotNull())
	{
		condStr.append(andStr + " phot.specialty.id = :specID");
		markers.add("specID");
		values.add(serviceVo.getSpecialty().getID());
		andStr = " and ";
	}

	condStr.append(andStr + " proc.procedureName like :pName");
	markers.add("pName");
	values.add("%" + procedureName + "%");
	andStr = " and ";

	condStr.append(andStr + " proc.isActive = :pAct");
	markers.add("pAct");
	values.add(Boolean.TRUE);

	if (andStr.equals(" and "))
		hql += " where ";

	hql += condStr.toString();
	List pList = factory.find(hql, markers, values);
	if (pList.size() > 0)
		return ProcedureLiteVoAssembler.createProcedureLiteVoCollectionFromProcedure(pList);
	else
		return null;
}
 
Example 19
Project: AvoinApotti   File: CcoContextSetter.java   View Source Code Vote up 4 votes
public void setClinicalContact(int conId)
{
	DomainFactory factory = this.getDomainFactory();
	ClinicalContact cc = (ClinicalContact)factory.getDomainObject(ClinicalContact.class, conId);
	CcoContextReader.setClinicalContact(ClinicalContactShortVoAssembler.create(cc), ctx);		
}
 
Example 20
Project: AvoinApotti   File: MedExamGeneralImpl.java   View Source Code Vote up 4 votes
/**
* saveExamGeneral
*/
public PatientShort saveAdmisExamGeneral(AdmisExamGeneralVo admisExamGeneralVo, ClinicalContactShortVo contactVo) throws StaleObjectException
{
	if (!admisExamGeneralVo.isValidated())
		throw new DomainRuntimeException("Exam General has not been validated");
	
	DomainFactory factory = getDomainFactory();
		
	ClinicalContact doClinicalContact = (ClinicalContact)factory.getDomainObject(ClinicalContact.class, contactVo.getID_ClinicalContact());
	
	PatientShort patient=null;
	if(admisExamGeneralVo.getVitalssignsrecordedIsNotNull())
	{
		//wdev-10669
		if(admisExamGeneralVo.getGenExaminationDet().getID_ExamGen() == null && admisExamGeneralVo.getGenExaminationDet().getClinicalContactIsNotNull())
		{
			StringBuffer hql = new StringBuffer();
			hql.append("from ExamGen as e1_1 where e1_1.clinicalContact.id = :CCID and e1_1.isRIE is null");
			java.util.List<?> list = getDomainFactory().find(hql.toString(), "CCID",admisExamGeneralVo.getGenExaminationDet().getClinicalContact().getID_ClinicalContact());
			if (list == null || list.size() > 0)
				throw new StaleObjectException(null);
		}
		//-----------
		VitalSigns doVitals = VitalSignsVoAssembler.extractVitalSigns(factory,admisExamGeneralVo.getVitalssignsrecorded());
		
		if(doVitals != null)
		{
			List<?> recordedExistColl = doVitals.getRecordedSigns();
			if(recordedExistColl.size() > 0) //existing vitals must be inactivated if new recorded ones
				checkAndInactivate(recordedExistColl, doVitals, admisExamGeneralVo.getVitalssignsrecorded());
		}

		doVitals = VitalSignsVoAssembler.extractVitalSigns(factory, admisExamGeneralVo.getVitalssignsrecorded());
		factory.save(doVitals);
		admisExamGeneralVo.setVitalssignsrecorded(VitalSignsVoAssembler.create(doVitals));
		
		//set the VitalSigns - Metrics to Patient 
		if(admisExamGeneralVo.getVitalssignsrecorded().getMetricsIsNotNull())
		{
			admisExamGeneralVo.getVitalssignsrecorded().getMetrics().validate();
			saveMetricsToPatient(admisExamGeneralVo.getVitalssignsrecorded().getMetrics());
		}
		
	}
	
	if(admisExamGeneralVo.getGenExaminationDetIsNotNull())
	{
		ExamGen doExamGen = MedExamGeneralVoAssembler.extractExamGen(factory, admisExamGeneralVo.getGenExaminationDet());
		
		if(doExamGen.getClinicalContact()==null)
			doExamGen.setClinicalContact(doClinicalContact);
		
		factory.save(doExamGen);
	
		admisExamGeneralVo.setGenExaminationDet(MedExamGeneralVoAssembler.create(doExamGen));
	}
	
	
	MedicalProbOnAdmisVoCollection collMedicalProbOnAdmis = new MedicalProbOnAdmisVoCollection(); 
	
	if(admisExamGeneralVo.getProblemsOnAdmissionIsNotNull())
		for(int i=0; i<admisExamGeneralVo.getProblemsOnAdmission().size(); i++)
		{
			PatientProblem doMedicalProbOnAdmis = MedicalProbOnAdmisVoAssembler.extractPatientProblem(factory, admisExamGeneralVo.getProblemsOnAdmission().get(i));

			factory.save(doMedicalProbOnAdmis);

			collMedicalProbOnAdmis.add(MedicalProbOnAdmisVoAssembler.create(doMedicalProbOnAdmis));
		}
			
	// A valid/updated patient vo will be returned if it was updated by the saveMetricsToCoreClinical method
	// otherwise, null will be returned and handled by the calling logic
	return patient;
}