Java Code Examples for ims.framework.utils.Time.addMinutes()

The following are Jave code examples for showing how to use addMinutes() of the ims.framework.utils.Time 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: GenerateSessionsImpl.java   View Source Code Vote up 6 votes
private boolean isSlotTimeWithinExclusionTimes(String newStartTime, Set exclusionTimes, Integer duration)
{
	Time proposedSlotTime = new Time(newStartTime);
	Iterator it = exclusionTimes.iterator();
	while(it.hasNext())
	{
		Session_Exc_Time exTime = (Session_Exc_Time) it.next();
		Time exStartTime = new Time(exTime.getStartTime());
		Time exEndTime = new Time(exTime.getEndTime());
		
		Time proposedSlotEndTime = (Time) proposedSlotTime.clone();
		proposedSlotEndTime.addMinutes(duration);
		
		if((proposedSlotTime.isGreaterOrEqualThan(exStartTime) || proposedSlotEndTime.isGreaterThan(exStartTime)) && proposedSlotTime.isLessThan(exEndTime) )
			return true;
	}
	
	return false;
}
 
Example 2
Project: AvoinApotti   File: VitalSignsVentilationChartDialogImpl.java   View Source Code Vote up 4 votes
public VitalSignsVo getVentilationChartByShiftAndTime(ShiftDetailsVo shift, DateTime datetime)
{
	DomainFactory factory = getDomainFactory();
	StringBuffer hql = new StringBuffer(" ");
	String query = "from VitalSigns vc ";
	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();
	String andStr = " ";

	hql.append(andStr + " vc.isVentilationChartRecord = :record");
	markers.add("record");
	values.add(Boolean.TRUE);
	andStr = " and ";
	
	if (shift != null)
	{
		hql.append(andStr + " vc.ventilationChart.shiftDetails.id = :shiftId ");
		markers.add("shiftId");
		values.add(shift.getID_ShiftDetails());
		andStr = " and ";
	}

	if (datetime != null)
	{
		Time time1 = new Time(datetime.getTime().getHour(), 0);
		
		DateTime date1 = new DateTime(datetime.getDate(), time1);
		time1.addMinutes(59);
		DateTime date2 = new DateTime(datetime.getDate(), time1);
		
		hql.append(andStr + " vc.vitalsTakenDateTime between :date1 and :date2 ");
		markers.add("date1");
		values.add(date1.getJavaDate());
		markers.add("date2");
		values.add(date2.getJavaDate());
		andStr = " and ";
	}
	
	if(andStr.equals(" and "))
		query += " where";
	query += hql.toString();
	List lst = factory.find(query, markers, values);		
	
	VitalSignsVoCollection voVitalsColl = VitalSignsVoAssembler.createVitalSignsVoCollectionFromVitalSigns(lst);
	
	if(voVitalsColl != null && voVitalsColl.size() > 0)
		return voVitalsColl.get(0);
	
	return null;
}
 
Example 3
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
/**
 * get first appt time and stack appts on top of each other by procedure duration
 */
private void reStackAppointments()
{
	Sch_Session_Appointment_OrderVo voSessApptOrder = form.getLocalContext().getSessApptOrder();
	if(voSessApptOrder != null && voSessApptOrder.getAppointmentsIsNotNull() &&  voSessApptOrder.getAppointments().size() > 0)
	{
		if(voSessApptOrder.getAppointments().get(0).getApptStartTime() != null)
		{
			Time nextApptStartTime = getFirstAvailableSlotTime(voSessApptOrder.getSession());
			for(int i=0;i<voSessApptOrder.getAppointments().size();i++)
			{
				
				int duration = 0;
				if(voSessApptOrder.getAppointments().get(i).getCustomProcedureDurationIsNotNull())
					duration = voSessApptOrder.getAppointments().get(i).getCustomProcedureDuration();
				
				int tciDuration = 0;
				if(voSessApptOrder.getAppointments().get(i).getApptStartTimeIsNotNull() && voSessApptOrder.getAppointments().get(i).getAppointmentTCITimeIsNotNull())
					tciDuration = SlotGenerationUtils.calculateDuration(voSessApptOrder.getAppointments().get(i).getApptStartTime().toString(), voSessApptOrder.getAppointments().get(i).getAppointmentTCITime().toString());
				
				
				if(nextApptStartTime != null)
				{
					voSessApptOrder.getAppointments().get(i).setApptStartTime(nextApptStartTime.copy());
				
					Time apptEndTime = nextApptStartTime.copy();
					apptEndTime.addMinutes(duration);
					voSessApptOrder.getAppointments().get(i).setApptEndTime(apptEndTime);
					
					Time newApptTciTime = voSessApptOrder.getAppointments().get(i).getApptStartTime().copy();
					newApptTciTime.addMinutes(tciDuration);
					voSessApptOrder.getAppointments().get(i).setAppointmentTCITime(newApptTciTime);	
				}	
				
				nextApptStartTime = Booking_AppointmentVo.calculateEndTime(voSessApptOrder.getAppointments().get(i).getApptStartTime(), duration);
				
			}
		}
	}
	
	form.grdAppts().getRows().clear();
	populateScreenFromData(form.getLocalContext().getSessApptOrder());
}
 
Example 4
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
/**
 * @param rowupped
 * @param rowdowned
 */
private void swapTCITimes(grdApptsRow rowupped, grdApptsRow rowdowned)
{
	Time newUppedApptTime = null;
	if(rowdowned.getColApptTime() != null)
		newUppedApptTime = rowdowned.getColApptTime().copy();	
	
	Time newDownedApptTime = null;
	if(newUppedApptTime != null)
		newDownedApptTime = newUppedApptTime.copy();
	
	if(rowupped.getValue().getCustomProcedureDuration() != null && newDownedApptTime != null)
		newDownedApptTime.addMinutes(rowupped.getValue().getCustomProcedureDuration());
		
	//calculate the new TCI times
	Time uppedTCiTime = null; 
	if(rowdowned.getColApptTime() != null)	
	{
		uppedTCiTime = rowdowned.getColApptTime().copy();
		if (rowupped.getColApptTime() != null && rowupped.getColComeInTime() != null)
			uppedTCiTime.addMinutes(calculateTCIMins(rowupped));
		else
			uppedTCiTime.addMinutes(calculateInitialTCIMins(rowupped.getValue()));
	}
	
	Time downedTCITime = null; 
	if(newDownedApptTime != null)	
	{
		downedTCITime = newDownedApptTime.copy();
		if (rowdowned.getColApptTime() != null && rowdowned.getColComeInTime() != null)
			downedTCITime.addMinutes(calculateTCIMins(rowdowned));
		else
			downedTCITime.addMinutes(calculateInitialTCIMins(rowdowned.getValue()));
	}
	
	rowdowned.setColComeInTime(downedTCITime);	
	rowdowned.setColApptTime(newDownedApptTime);		

	rowupped.setColApptTime(newUppedApptTime);
	rowupped.setColComeInTime(uppedTCiTime);	
}
 
Example 5
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
private String calculateEndTime(Time startTm, Integer duration)
{
	startTm.addMinutes(duration);
	return startTm.toString();
}
 
Example 6
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
private void populateExtendedView(SessionSlotForSessionManagementVoCollection sessionSlots)
{
	form.lyrTabs().showtabExtendedView();

	form.getLocalContext().setSelectedSession(form.lyrTabs().tabClinicView().grdSessions().getValue());
	form.getLocalContext().setSelectedTab(ClinicView);

	populateExtendedViewSessionLabel();

	form.lyrTabs().tabExtendedView().grdSlots().getRows().clear();

	if (sessionSlots == null || sessionSlots.size() == 0)
		return;

	for (int i = 0; i < sessionSlots.size(); i++)
	{
		SessionSlotForSessionManagementVo slot = sessionSlots.get(i);

		grdSlotsRow newRow = form.lyrTabs().tabExtendedView().grdSlots().getRows().newRow();

		newRow.setColActivity(slot.getActivity() != null ? slot.getActivity().getName() : "");
		newRow.setTooltipForColActivity(newRow.getColActivity());

		newRow.setColStartTime(slot.getStartTm() != null ? slot.getStartTm().toString() : "");

		Time endTime = null;

		if (slot.getStartTm() != null && slot.getDuration() != null)
		{
			endTime = slot.getStartTm();
			endTime.addMinutes(slot.getDuration());
		}

		newRow.setColEndTime(endTime != null ? endTime.toString() : "");

		newRow.setColStatus(slot.getStatus() != null ? slot.getStatus().getText() : "");
		newRow.setTooltipForColStatus(newRow.getColStatus());

		newRow.setColSlotOwner(slot.getSlotResp() != null && slot.getSlotResp().getHcp() != null && slot.getSlotResp().getHcp().getName() != null ? slot.getSlotResp().getHcp().getName().toString() : "");
		newRow.setTooltipForColSlotOwner(newRow.getColSlotOwner());

		if (slot.getAppointment() != null)
		{
			CatsReferralForSessionManagementVo referral = domain.getCatsReferralForAppointment(slot.getAppointment());
			newRow.setColRTT(referral != null && referral.getReferralDetails() != null && referral.getReferralDetails().getEnd18WW() != null ? referral.getReferralDetails().getEnd18WW().toString() : "");
			slot.setCatsReferral(referral);

			newRow.setColPatient(slot.getAppointment().getPatient() != null && slot.getAppointment().getPatient().getName() != null ? slot.getAppointment().getPatient().getName().toString() : "");
			newRow.setTooltipForColPatient(newRow.getColPatient());

			if (Boolean.TRUE.equals(slot.getAppointment().getIsCABBooking()))
			{
				newRow.setColumnCBAppt(form.getImages().OCRR.LetterC);
				newRow.setTooltipForColumnCBAppt("C&B Appointment");
			}
		}

		newRow.setValue(slot);
	}
}
 
Example 7
Project: AvoinApotti   File: PatientKioskOperationsImpl.java   View Source Code Vote up 3 votes
public Boolean isPatientLate(Integer patientId) throws DomainInterfaceException 
{
	if(patientId == null)
		throw new DomainInterfaceException("Cannot search on a null Patient ID!");
	
	Booking_AppointmentVoCollection bookingAppointmentCol = getBookingAppointmentColl(patientId);
	
	if(bookingAppointmentCol == null || bookingAppointmentCol.size() == 0)
		throw new DomainInterfaceException("Patient doesn't have an appointment.");
	
	Booking_AppointmentVo firstAppointment = getFirstAppointment(bookingAppointmentCol);//null;
	
	if(firstAppointment == null || !firstAppointment.getApptStartTimeIsNotNull())
		throw new DomainInterfaceException("Patient doesn't have an appointment.");

	//get delay from PatientKioskConfigImpl
	Integer delayInMinutes = getDelay();
	
	Time timeForFirstAppointment = firstAppointment.getApptStartTime();
	Time currentTime = new Time();
	
	Time testTime = (Time) timeForFirstAppointment.clone();
	testTime.addMinutes(delayInMinutes);
	
	if(testTime.isLessThan(timeForFirstAppointment))
		throw new DomainInterfaceException("Error. AppointmentTime + Delay > 23:59:59!");
					
	timeForFirstAppointment.addMinutes(delayInMinutes);
	
	return currentTime.isGreaterThan(timeForFirstAppointment) ? true : false;
}