Java Code Examples for ims.framework.utils.Date.daysBetween()

The following are Jave code examples for showing how to use daysBetween() of the ims.framework.utils.Date class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private String getNumberOfDaysPostOp(DateTime surgeryStartTime) 
{
	if(surgeryStartTime == null)
		return "";
	
	Date currentDate = new Date();
	
	if(surgeryStartTime.getDate().equals(currentDate))
		return "Number of days post op = 0";
	
	if(surgeryStartTime.getDate().isGreaterThan(currentDate))
		return "";
	
	long a = Date.daysBetween(surgeryStartTime.getDate(), currentDate);
	
	return "Number of days post op = " + a;
}
 
Example 2
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private Integer calculateWaintingTime(Date sd, Date ed)
{
	if (sd != null && ed != null)	
		return (int)Date.daysBetween(sd, ed);
	
	return null;
}
 
Example 3
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private Integer updateActualDuration() 
{
	if(form.lyrDetails().tabDetails().dteStart().getValue() != null && form.lyrDetails().tabDetails().dteEnd().getValue() != null)
	{
		long duration = Date.daysBetween(form.lyrDetails().tabDetails().dteStart().getValue(), form.lyrDetails().tabDetails().dteEnd().getValue());
			
		return ((int) duration);
	}
	
	return null;
}
 
Example 4
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private void populate(IPatientJourney value) 
{					
	form.patientJourneyControl().setStartDate(value.getIPatientJourneyStartDate());
	form.patientJourneyControl().setProfileHeaderText(value.getIPatientJourneyProfileTitle());	
	
	String journeyHeaderText = "";
	journeyHeaderText += value.getIPatientJourneyStartDate() + (value.getIPatientJourneyEndDate() != null ? (" - " + value.getIPatientJourneyEndDate()) :("")); 
			
	if (value.getIPatientJourneyReferralReceivedDate() != null  && value.getIPatientJourneyOriginalReferralDate() != null)
	{
		new Date();
		journeyHeaderText += " - Referral Received on Day " + Date.daysBetween(value.getIPatientJourneyOriginalReferralDate(), value.getIPatientJourneyReferralReceivedDate());
	}							
	form.patientJourneyControl().setJourneyHeaderText(journeyHeaderText);
			
	int maxWeekNumber = getMaxWeekNumber(value);
	
	MaxWeek m = new MaxWeek();
	m.maxWeekNumber = maxWeekNumber; 		
	addClocks(value.getIPatientJourneyStartDate(), extractClocks(value), m);
	PatientJourneyEntry selectedEntry = null;
	for(int x = 1; x <= m.maxWeekNumber; x++)
	{
		addWeekNumberEntries(value, x, m, selectedEntry);
	}		
	form.patientJourneyControl().scrollToCurrentWeek();
}
 
Example 5
Project: AvoinApotti   File: ReferralStatusListImpl.java   Source Code and License Vote up 4 votes
private CatsReferralListManualAssemblyVoCollection assembleRecords(List<?> refList) 
{
	CatsReferralListManualAssemblyVo voItem = null;
	CatsReferralListManualAssemblyVoCollection voColl = new CatsReferralListManualAssemblyVoCollection();
	for (int i = 0 ; i < refList.size(); i ++)
	{
		CatsReferralManualClass doCats = (CatsReferralManualClass)refList.get(i);
		voItem = new CatsReferralListManualAssemblyVo();

		voItem.setCatsReferralId(doCats.getCatsReferralId());
		voItem.setPatientName(doCats.getPatientName());
		voItem.setVerifiedNHSNumber(doCats.getPatientnhsnum());
		voItem.setAnyNHSNumber(doCats.getAnynhsnum());
		voItem.setPatientDOD(doCats.getPatientDOD() != null ? new ims.framework.utils.Date(doCats.getPatientDOD()) : null);
		voItem.setLinkedICPID(doCats.getLinkedICPID() != null ? Boolean.TRUE : null);
		voItem.setLinkedELEID(doCats.getLinkedELEID() != null ? Boolean.TRUE : null);
		voItem.setIsCAB(doCats.getisCAB());
		voItem.setReferralLocationName(doCats.getReferralLocationName());
		voItem.setServiceName(doCats.getServiceName());
		voItem.setIsFlaggedForReview(doCats.getisFlaggedForReview());
		voItem.setEnd18WW(doCats.getEnd18WW() != null ? new ims.framework.utils.Date(doCats.getEnd18WW()) : null);
		voItem.setIsCurrentlyAllocated(doCats.getisCurrentlyAllocated());
		voItem.setHasInvestigations(doCats.getHasInvestigations());
		voItem.setCatsCurrentStatus(doCats.getCatsCurrentStatusId() != null ? new LookupInstVo(doCats.getCatsCurrentStatusId(), doCats.getCatsCurrentStatusText(), Boolean.TRUE) : null);
		voItem.setAdditionalInvStatus(doCats.getAdditionalInvStatusID() != null ? new LookupInstVo(doCats.getAdditionalInvStatusID(), "", Boolean.TRUE) : null);
		voItem.setHasApointments(doCats.getHasApointments());
		voItem.setConsultationApptStatus(doCats.getConsAppointmentStatusID() != null ? new LookupInstVo(doCats.getConsAppointmentStatusID(), "", Boolean.TRUE) : null);
		voItem.setConsAppointmentDate(doCats.getConsAppointmentDate() != null ? new ims.framework.utils.Date(doCats.getConsAppointmentDate()) : null);
		voItem.setConsultationApptStartTime(doCats.getConsAppointmentStartTime() != null ? doCats.getConsAppointmentStartTime() : null);
		voItem.setAssociatedPatientId(doCats.getAssociatedPatientId());
		voItem.setDateReceived(doCats.getDateRecieved() != null ? new ims.framework.utils.Date(doCats.getDateRecieved()) : null);

		if (doCats.getEnd18WW() != null)
		{
			StringBuffer sb = new StringBuffer();
			sb.append(voItem.getEnd18WW().getYear());
			
			if (voItem.getEnd18WW().getMonth() > 9)
				sb.append(voItem.getEnd18WW().getMonth());
			else
			{
				sb.append("0");
				sb.append(voItem.getEnd18WW().getMonth());
			}
				
			if (voItem.getEnd18WW().getDay() > 9)
				sb.append(voItem.getEnd18WW().getDay());
			else
			{
				sb.append("0");
				sb.append(voItem.getEnd18WW().getDay());
			}
			voItem.setEnd18wwJulianDate(sb.toString());
		}
		
		//WDEV-12994
		if( voItem.getConsultationApptStatusIsNotNull()	&& voItem.getConsultationApptStatus().equals(Status_Reason.BOOKED))
		{
			if (voItem.getConsAppointmentDateIsNotNull())
			{
				long lval = Date.daysBetween(new Date(voItem.getConsAppointmentDate()), new Date());

				voItem.setDaysLeft(-(int)lval);
			}
		}

		voColl.add(voItem);
	}
	
	return voColl;	
}