Java Code Examples for ims.framework.utils.Time

The following are top voted examples for showing how to use ims.framework.utils.Time. 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: PatientICPListImpl.java   View source code 6 votes vote down vote up
public Boolean hasOpenAppointments(PatientICPRefVo patientICP) 
{
	if(patientICP == null || patientICP.getID_PatientICP() == null)
		throw new CodingRuntimeException("Cannot check if there are open appointments on null PatientICP Id.");
	
	DomainFactory factory = getDomainFactory();
	String query = "select count(b.id) from PatientICP as picp left join picp.appointments as b where picp.id = :PantientICPId and (b.appointmentDate > :ApptDate or (b.appointmentDate = :ApptDate and b.apptStartTime >= :ApptTime)) and b.apptStatus.id = :ApptStatus";//	WDEV-13198
	
	Object[] count = factory.find(query, new String[] {"PantientICPId", "ApptDate", "ApptTime", "ApptStatus"}, new Object[] {patientICP.getID_PatientICP(), new Date().getDate(), (new Time()).toString(), Status_Reason.BOOKED.getID()}).toArray();
	
	if(count != null && count.length > 0)
	{
		if(((Long) count[0]).intValue() > 0)
			return Boolean.TRUE;
	
	}
	
	return Boolean.FALSE;
}
 
Example 2
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private String[] getUIErrors()
{
	ArrayList<String> errors = new ArrayList<String>();
	
	if (form.dtimCancellation().getValue() != null && form.dtimCancellation().getValue().isGreaterThan(new DateTime()))
	{
		errors.add("Cancellation Date cannot be in the future");
	}
	
	if (form.dtimCancellation().getValue() != null 
		&& domain.getReferralDate(form.getGlobalContext().RefMan.getCatsReferral()) != null
		&& form.dtimCancellation().getValue().isLessThan(new DateTime(domain.getReferralDate(form.getGlobalContext().RefMan.getCatsReferral()), new Time(0, 0, 0))))
	{
		errors.add("Cancellation Date cannot be set before referral date");
	}

	if (errors.size() > 0)
	{
		String[] err = new String[errors.size()];
		errors.toArray(err);
		engine.showErrors("Invalid Provider Cancellation", err);
		return err;
	}

	return null;
}
 
Example 3
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void setDefaultTimeValue(DynamicGridCell cell)
{
	DynamicGridRow parentRow = cell.getRow().getParent();
	// Get Previous row time and set it to the current row
	for (int i = 0; parentRow != null && i < parentRow.getRows().size(); i++)
	{
		if (i > 0 && parentRow.getRows().get(i).getValue().equals(cell.getRow().getValue()))
		{
			DynamicGridColumn column = getColumn(TIME_COL);
			if (column != null)
			{
				DynamicGridCell timCell = parentRow.getRows().get(i - 1).getCells().get(column);
				if (timCell != null)
				{
					Object previousTime = timCell.getValue();
					if (previousTime instanceof Time)
						cell.setValue(previousTime);
				}
			}

			break;
		}
	}
}
 
Example 4
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private Booking_AppointmentVo createAppointment(grdSessionSlotsRow row) {
	Booking_AppointmentVo voBookAppt = null;
	if (row.getValue() instanceof Booking_AppointmentVo)
		voBookAppt = (Booking_AppointmentVo) row.getValue();
	else
		return null;

	voBookAppt.setAppointmentDate(form.bookingCalendarAppts()
			.getSelectedDay());
	
	Time slotTime = row.getValue() instanceof SessionSlotVo ? ((SessionSlotVo) row
			.getValue()).getStartTm() : null;
	voBookAppt
			.setApptStartTime(row.getValue() instanceof SessionSlotVo ? ((SessionSlotVo) row
					.getValue()).getStartTm() : null);
	voBookAppt.setActivity(form.cmbActivity().getValue());

	if (form.cmbActivity().getValue() != null
			&& form.cmbActivity().getValue().getTmReqIsNotNull())
		voBookAppt.setApptEndTime(Booking_AppointmentVo.calculateEndTime(
				slotTime, form.cmbActivity().getValue().getTmReq()
						.intValue()));

	voBookAppt.setApptStatus(Status_Reason.BOOKED);
	return voBookAppt;
}
 
Example 5
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
protected void onBNewClick() throws ims.framework.exceptions.PresentationLogicException
{
	form.btnUpdate().setEnabled(false);
	clearScreen();
	form.dteRecording().setValue(new Date());
	form.timRecorded().setValue(new Time());
	form.cmbAllRecords().setValue(null);
	Hcp voHcp = (Hcp) domain.getHcpUser();
	if (voHcp != null)
	{
		form.qmbAuthoringHcp().newRow(voHcp, voHcp.toString());
		form.qmbAuthoringHcp().setValue(voHcp);
	}
	
	form.getLocalContext().setInterventionChartRecord(null);
	form.getLocalContext().setSelectedInterventionRecord(null);
	form.setMode(FormMode.EDIT);
}
 
Example 6
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void makeInfectionHeaderInfoNew(Boolean bDefaultValues)
{
	if (bDefaultValues.booleanValue() == true)
	{
		form.dteDate().setValue(new Date());
		form.timTime().setValue(new Time());
		if (domain.getMosUser() != null)
			form.txtRecordingHCP().setValue(((MemberOfStaffShortVo) domain.getMosUser()).toString());
	}
	else
	// null values
	{
		form.dteDate().setValue(null);
		form.timTime().setValue(null);
		form.txtRecordingHCP().setValue(null);
	}

}
 
Example 7
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private Time getPatternEndTime()
{
	if (form.getLocalContext().getSavedDailyPatternConfigIsNotNull())
	{
		if (form.getLocalContext().getSavedDailyPatternConfig().getSignatoryPeriodIsNotNull())
		{
			SignatoryPeriodConfigVo voPeriod = form.getLocalContext().getSavedDailyPatternConfig().getSignatoryPeriod().get(form.getLocalContext().getSavedDailyPatternConfig().getSignatoryPeriod().size() - 1);
			if (voPeriod.getTimePeriodsIsNotNull())
			{
				if (form.getLocalContext().getDailyTimePeriods().size() > 0)
				{
					for (int i = 0; i < form.getLocalContext().getDailyTimePeriods().size(); i++)
					{
						if (form.getLocalContext().getDailyTimePeriods().get(i).equals(voPeriod.getTimePeriods().get(voPeriod.getTimePeriods().size() - 1)))
							return new Time(form.getLocalContext().getDailyTimePeriods().get(i).toString().substring(0, 2) + ":59:00");
					}
				}
			}
		}
	}
	return null;
}
 
Example 8
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
protected void onFormOpen() throws ims.framework.exceptions.FormOpenException
{	
	form.customControlAuthoring().setIsRequiredPropertyToControls(true);
	VitalSignsVo vo = form.getGlobalContext().Core.getVitalSign();
	if (vo != null)
	{
		populateForm(vo);

		form.setcustomControlAuthoringEnabled(false);
		form.dteTaken().setEnabled(false);
		form.timTaken().setEnabled(false);
	}
	else
	{
		form.dteTaken().setEnabled(true);
		form.timTaken().setEnabled(true);

		// New include default values
		form.dteTaken().setValue(new ims.framework.utils.Date());
		form.timTaken().setValue(new ims.framework.utils.Time());
		form.customControlAuthoring().initializeComponent();
		form.setcustomControlAuthoringEnabled(true);
	}
	
	updateControlState();
}
 
Example 9
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private boolean checkExistingTime(DailyFluidBalanceVo voDaily, FluidBalanceInstanceVo voFluidBalInst)
{
	FluidBalanceInstanceVoCollection voFluidBalInstances = voDaily.getFluidBalanceInstances();
	boolean result = false;
	if(voFluidBalInstances != null)
	{
		for(int x=0; x<voFluidBalInstances.size(); x++)
		{
			FluidBalanceInstanceVo voFluidBalInstance = voFluidBalInstances.get(x);
			Time existingTime = voFluidBalInstance.getStartTime();
			Time newTime = voFluidBalInst.getStartTime();
		 
			if(newTime.isLessOrEqualThan(existingTime))
			{
				result = true;
				break;
			}
		}
		return result;
	}	
	return result;
}
 
Example 10
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
protected void onImbCalculateClick() throws ims.framework.exceptions.PresentationLogicException
{
	Time startTime = form.timStart().getValue();
	Time endTime = form.getGlobalContext().Scheduling.getProfileEndTime();

	//this is mandatory for dialog
	if(form.getGlobalContext().Scheduling.getProfileEndTime() == null)
		return;
	
	if(startTime == null || (form.intSlotInterval().getValue() == null || form.intSlotInterval().getValue() == 0))
	{
		engine.showErrors(new String[] {"Start Time and Slot Interval need to be provided for calculation"});
		return;
	}
	
	int iDuration = form.intSlotInterval().getValue();
	
	int iTime = endTime.getTotalMinutes() - startTime.getTotalMinutes(); 
	form.intNoSlots().setValue(iTime/iDuration);
}
 
Example 11
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
protected void onImbCalculateClick() throws PresentationLogicException
{
	Time startTime = form.timStart().getValue();
	Time endTime = form.getGlobalContext().Scheduling.getProfileEndTime();

	//this is mandatory for dialog
	if(form.getGlobalContext().Scheduling.getProfileEndTime() == null)
		return;
	
	if(startTime == null || (form.intSlotInterval().getValue() == null || form.intSlotInterval().getValue() == 0))
	{
		engine.showErrors(new String[] {"Start Time and Slot Interval need to be provided for calculation"});
		return;
	}
	
	int iDuration = form.intSlotInterval().getValue();
	
	int iTime = endTime.getTotalMinutes() - startTime.getTotalMinutes(); 
	form.intNoSlots().setValue(iTime/iDuration);
}
 
Example 12
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private boolean appointmentOverlapsInterval(BookingAppointmentLiteVo appointment, Time startTime, Time endTime)
{
	if (appointment == null || appointment.getApptStartTime() == null || appointment.getApptEndTime() == null)
		return false;
	
	if (startTime == null || endTime == null)
		return false;
	
	if (appointment.getApptStartTime().isLessOrEqualThan(startTime) && appointment.getApptEndTime().isLessOrEqualThan(startTime))
		return false;
	
	if (appointment.getApptStartTime().isGreaterOrEqualThan(endTime) && appointment.getApptEndTime().isGreaterOrEqualThan(endTime))
		return false;
	
	return true;
}
 
Example 13
Project: AvoinApotti   File: BookAppointmentImpl.java   View source code 6 votes vote down vote up
private boolean appointmentOverlapsInterval(Booking_Appointment appointment, Time sessionStartTime, Time sessionEndTime)
{
	if (appointment == null || appointment.getApptStartTime() == null || appointment.getApptEndTime() == null)
		return false;
		
	if (sessionStartTime == null || sessionEndTime == null)
		return false;
	
	Time appointmentStartTime = new Time(appointment.getApptStartTime());
	Time appointmentEndTime = new Time(appointment.getApptEndTime());
	
	if (appointmentStartTime.isLessOrEqualThan(sessionStartTime) && appointmentEndTime.isLessOrEqualThan(sessionStartTime))
		return false;
	
	if (appointmentStartTime.isGreaterOrEqualThan(sessionEndTime) && appointmentEndTime.isGreaterOrEqualThan(sessionEndTime))
		return false;
	
	return true;
}
 
Example 14
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private boolean canBeDNAed(Status_Reason appStatus, Date apptDate, Time apptTime) 
{
	if(appStatus != null && appStatus.equals(Status_Reason.BOOKED))
	{
		if(apptDate != null)
		{
			if(new Date().isGreaterOrEqualThan(apptDate))
			{
				if(new Date().equals(apptDate))
				{
					if(apptTime != null)
					{
						if(new DateTime().getTime().isGreaterThan(apptTime))
							return true;
					}
				}
				else
					return true;
			}
		}
	}
	
	return false;
}
 
Example 15
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void doSearch()
{
	form.getGlobalContext().OCRR.setLastUpdatedPathRadResult(null);
	form.grdClinicalResults().getRows().clear();
	updateTotal();

	if (isSearchCriteriaValid())
	{

		DateTime dtFrom = (form.dteFrom().getValue() != null ? new DateTime(form.dteFrom().getValue(), new Time(0, 0, 0)) : null);
		DateTime dtTo = (form.dteTo().getValue() != null ? new DateTime(form.dteTo().getValue(), new Time(23, 59, 59)) : null);

		ClinicalResultListVoCollection voCollResults = domain.listResults(dtFrom, dtTo, form.cmbDepartment().getValue(), form.qmbInvestigation().getValue(), form.qmbClinician().getValue(), form.Group1().getValue().equals(Group1Enumeration.rdoResults) ? Boolean.TRUE : Boolean.FALSE, form.getGlobalContext().Core.getPatientShortIsNotNull() ? form.getGlobalContext().Core.getPatientShort() : null);

		form.getLocalContext().setinvIdList(getInvId(voCollResults));
		Integer nNewResUnseenDays = ConfigFlag.DOM.OCS_NEWRES_UNSEEN_CUTOFF.getValue();
		Date dateUnseen = new Date().addDay(-1 * nNewResUnseenDays.intValue());

		populateResultsGrid(voCollResults, dateUnseen);
	}
	updateControlsState();

}
 
Example 16
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void setDefaultTimeValue(DynamicGridCell cell)
{
	DynamicGridRow parentRow = cell.getRow().getParent();
	//Get Previous row time and set it to the current row
	for (int i = 0; parentRow != null && i < parentRow.getRows().size(); i++)
	{
		if(i > 0 && parentRow.getRows().get(i).getValue().equals(cell.getRow().getValue()))
		{
			DynamicGridColumn column = getColumn(TIME_COL);
			if(column != null)
			{
				DynamicGridCell timCell = parentRow.getRows().get(i-1).getCells().get(column);
				if(timCell != null)
				{
					Object previousTime = timCell.getValue();
					if(previousTime instanceof Time)
						cell.setValue(previousTime); 
				}
			}
			
			break;
		}
	}
}
 
Example 17
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object arg0, Object arg1)
{
	final int EQUAL  = 0;
	final int AFTER  = 1;
    
	SpecimenWorkListItemListVo voObj1 = (SpecimenWorkListItemListVo) arg0;
	SpecimenWorkListItemListVo voObj2 = (SpecimenWorkListItemListVo) arg1;
	Date startDateToCollect = voObj1.getDateToCollect();
	Date endDateToCollect 	= voObj2.getDateToCollect();
	Time startTimeToCollect = voObj1.getTimeToCollect();
	Time endTimeToCollect 	= voObj2.getTimeToCollect();
	
	if(startDateToCollect != null && endDateToCollect != null)
	{
		//Covers only equal dates and null time (Date Time sort moved into hql query)
		if(startDateToCollect.equals(endDateToCollect))
		{
			if(startTimeToCollect == null && endTimeToCollect != null)
			{
				return AFTER;
			}
		}
	}
	
	return EQUAL;
}
 
Example 18
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void checkForNurse() 
{
	Object hcp = domain.getHcpUser();
	
	if(hcp instanceof NurseVo && engine.hasRight(AppRight.CAN_CONFIRM_NURSING_DOCUMENTATION))
	{
		form.qmbConfirmedBy().newRow((Hcp) hcp, ((Hcp) hcp).toString());
		form.qmbConfirmedBy().setValue((Hcp) hcp);
		form.dteConfirmed().setValue(new Date());
		form.timConfirmed().setValue(new Time());
	}
}
 
Example 19
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void populateControls()
{		
	//Prepopulate Controls
	if(domain.getMosUser() != null)
		form.textBoxHCP().setValue(((MemberOfStaffShortVo)domain.getMosUser()).toString());
			
	form.dateAssess().setValue(new Date());
	form.timeAssess().setValue(new Time());
	form.chkSkinIntact().setValue(false);
	
	//Save the previous Assessment
	form.getLocalContext().setPreviousSkinAssessment(form.getGlobalContext().COE.SkinBodyChart.getSkinAssessmentVO());
	
	SkinAssessment skinAssVO = new SkinAssessment();
	DrawingImageVersionVo drawingVO =  new DrawingImageVersionVo();
	//Set the Current Image Name & Version No
	drawingVO.setImageName(getCurrentImageName());
	if(getCurrentVersionNumber() != null)
		drawingVO.setVersionNumber(getCurrentVersionNumber());
	skinAssVO.setImageVersion(drawingVO);
	
	skinAssVO.setSkinAssessmentFindings(new SkinAssessmentFindingsCollection());
	//Copy the previous Findings
	getPreviousFindings(skinAssVO);
	
	//Set back to the context the SkinAssVO
	form.getGlobalContext().COE.SkinBodyChart.setSkinAssessmentVO(skinAssVO);
	form.bNew().setEnabled(false);
	form.setMode(FormMode.EDIT);
	
}
 
Example 20
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void doSearch(boolean isCalledFromFormOpen)
{
	clearGrid();

	String[] uiErrors = getUISearchCriteriaErrors();
	if (uiErrors != null && isCalledFromFormOpen == false)
	{
		engine.showErrors(uiErrors);
		return;
	}

	if (uiErrors == null)
	{
		Date startDate = form.dteStart() != null ? form.dteStart().getValue() : null;
		Date endDate = form.dteEnd() != null ? form.dteEnd().getValue() : null;

		DateTime startDT = new DateTime(startDate, new Time(0, 0));
		DateTime endDT = new DateTime(endDate, new Time(23, 59));

		PatientSECSShortVoCollection voColl = domain.listPatientSECS(startDT, endDT,form.getGlobalContext().Core.getPatientShort());
		if (isCalledFromFormOpen == false && (voColl == null || voColl.size() == 0))
		{
			engine.showMessage("No records found for the Search Criteria Provided");
		}

		populateGridControl(voColl);
	}
}
 
Example 21
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
protected ims.nursing.vo.TransferNote populateDataFromScreen(ims.nursing.vo.TransferNote value)
{
	value = super.populateDataFromScreen(value);

	if (value == null)
		return null;

	if (value.getTransferDateIsNotNull())
	{
		if (form.timTransfer().getValue() == null)
		{
			Date date = value.getTransferDate().getDate();
			
			value.getTransferDate().setDateTime(date, new Time());
		}
	}

	if (value.getClinicalContact() == null)
		value.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());

	if (value.getCareContext() == null)
		value.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());

	MemberOfStaffShortVo memStaffShortVo = (MemberOfStaffShortVo) domain.getMosUser();
	if (memStaffShortVo != null && memStaffShortVo.getHcp() != null)
		value.setAuthoringCP(memStaffShortVo.getHcp());

	return value;

}
 
Example 22
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void populateDefaultCompleteData()
{
	form.dteStopDate().setValue(new Date());
	form.tmeStopTime().setValue(new Time());
	
	form.qmbStopHCP().clear();
	
	HcpLiteVo userHCP = (HcpLiteVo) domain.getHcpLiteUser();
	
	if (userHCP != null)
	{
		form.qmbStopHCP().newRow(userHCP, userHCP.toString());
		form.qmbStopHCP().setValue(userHCP);
	}
}
 
Example 23
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void setDefaultTimeValue(DynamicGridCell cell)
{
	DynamicGridRow parentRow = cell.getRow().getParent();
	//Get Previous row time and set it to the current row
	for (int i = 0; parentRow != null && i < parentRow.getRows().size(); i++)
	{
		if(i > 0 && parentRow.getRows().get(i).getValue().equals(cell.getRow().getValue()))
		{
			DynamicGridColumn column = getColumn(TIME_COL);
			if(column != null)
			{
				DynamicGridCell timCell = parentRow.getRows().get(i-1).getCells().get(column);
				if(timCell != null)
				{
					Object previousTime = timCell.getValue();
					if(previousTime instanceof Time)
						cell.setValue(previousTime); 
				}
			}
			
			break;
		}
	}
	if (cell.getValue() == null)
		cell.setValue(new Time()); 

}
 
Example 24
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void initialise() 
{
	// WDEV-12293 -  Get service for CatsReferral (but we need to pass the CareContext id as the CatsReferral is not available in context)
	// and default the speciality combo box to it
	Specialty specialty = domain.getReferralSpecialty(form.getGlobalContext().Scheduling.getBookingAppointmentRef());
	form.cmbSpecialty().setValue(specialty);
	
	
	if (form.getGlobalContext().RefMan.getDayCaseAdmApptDateIsNotNull() && form.getGlobalContext().RefMan.getDayCaseAdmApptTimeIsNotNull())
		form.dtimAdmDateTime().setValue(new DateTime(form.getGlobalContext().RefMan.getDayCaseAdmApptDate(), new Time(form.getGlobalContext().RefMan.getDayCaseAdmApptTime())));
	else if (form.getGlobalContext().RefMan.getDayCaseAdmApptDateIsNotNull() && form.getGlobalContext().RefMan.getDayCaseAdmApptTime() == null)
		form.dtimAdmDateTime().setValue(new DateTime(form.getGlobalContext().RefMan.getDayCaseAdmApptDate(), new Time()));
	else
		form.dtimAdmDateTime().setValue(new DateTime());
		
	populateWardCombo();
	
	HcpLiteVo hcpLiteVo = (HcpLiteVo) domain.getHcpLiteUser();
	if (hcpLiteVo != null
		&& hcpLiteVo.getHcpTypeIsNotNull() 
		&& hcpLiteVo.getHcpType().equals(HcpDisType.MEDICAL))
	{
		MedicLiteVo vo = new MedicLiteVo(hcpLiteVo.getID_Hcp(), hcpLiteVo.getVersion_Hcp());
		form.qmbConsultant().newRow( vo, hcpLiteVo.getName().toString());
		form.qmbConsultant().setValue(vo);
	}
}
 
Example 25
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void populateScreen()
{
	DateTime now = new DateTime(new Date(), new Time());
	
	//Prepopulate Controls----------------------------------------------------
	if(domain.getMosUser() != null)
		form.txtBoxHCP().setValue(((MemberOfStaffShortVo)domain.getMosUser()).toString());
			
	form.dteAssessment().setValue(new Date());
	form.timAssessment().setValue(new Time());
	form.dteRecording().setValue(new Date());
	form.timRecording().setValue(new Time());
	//-------------------------------------------------------------------------
	
	//Save previous PainAssessment
	form.getLocalContext().setPreviousPainAssessment(form.getGlobalContext().COE.PainBodyChart.getPainAssessmentVO());
	
	PainAssessment painAssessmentVO = new PainAssessment();
	painAssessmentVO.setAssessmentDateTime(now);
	painAssessmentVO.setDateTimeInitiated(now);

	Object hcpLite = domain.getHcpLiteUser();
	painAssessmentVO.setHcpInitiated(hcpLite != null ? ((HcpLiteVo)hcpLite) : null);
	
	painAssessmentVO.setSiteDetails(new PainAssessmentFindingsCollection());
	
	DrawingImageVersionVo versionNoVo = new DrawingImageVersionVo();
	versionNoVo.setImageName(getCurrentImageName());
	if(getCurrentVersionNumber() != null)
		versionNoVo.setVersionNumber(getCurrentVersionNumber());
	painAssessmentVO.setImageVersion(versionNoVo);
	//Copy the previous Active(Not Discontinued) Findings
	copyPreviousFindings(painAssessmentVO);
	
	//Add a new VO
	form.getGlobalContext().COE.PainBodyChart.setPainAssessmentVO(painAssessmentVO);

}
 
Example 26
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
/**
 * Function used to prepare form for creating a new stool scale assessment
 * Will clear the instance controls, local context, grid selection, initialize the authoring information
 * and set the form in EDIT mode.
 */
public void newInstance() throws PresentationLogicException
{
	// Clear selected stool scale from local context
	form.getLocalContext().setStoolScale(null);

	// Clear grid selection
	form.grdStoolScale().setValue(form.getLocalContext().getStoolScale());

	// Clear instance controls
	clearInstanceControls();

	// Initialize authoring HCP and recording date
	HcpLiteVo voHcp = (HcpLiteVo) domain.getHcpLiteUser();
	form.customControlAuthoringInfo().initializeComponent();
	form.setcustomControlAuthoringInfoEnabled(true);
	AuthoringInformationVo voAuthoringInformation = new AuthoringInformationVo();

	if (voHcp != null)
		voAuthoringInformation.setAuthoringHcp(voHcp);

	DateTime dt = new DateTime(new Date(),new Time());
	voAuthoringInformation.setAuthoringDateTime(dt);

	// Set form in edit mode
	form.setMode(FormMode.EDIT);
}
 
Example 27
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
public int compare(StoolScaleVo o1, StoolScaleVo o2)
{
	if (o1 != null && o1.getDateTimeInitiatedIsNotNull() && o2!=null && o2.getDateTimeInitiatedIsNotNull())
	{
		Time time1 = o1.getDateTimeInitiated().getTime();
		Time time2 = o2.getDateTimeInitiated().getTime();
		
		time1.setSecond(0);
		time2.setSecond(0);
		
		DateTime dateToCompare1 = new DateTime(o1.getDateTimeInitiated().getDate(), time1);
		DateTime dateToCompare2 = new DateTime(o2.getDateTimeInitiated().getDate(), time2);
		
		int dateOrder = order*dateToCompare1.compareTo(dateToCompare2);
		
		if(dateOrder == 0)
		{
			return compareByHcp(o1, o2);
		}
		
		return dateOrder;
	}
	
	if (o1 == null || !o1.getDateTimeInitiatedIsNotNull())
		return -1*order;
	
	if (o2 == null || !o2.getDateTimeInitiatedIsNotNull())
		return order;
	
	return 0;
}
 
Example 28
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
protected void onFormOpen() throws ims.framework.exceptions.FormOpenException
{
	String dsn = "";
	String host = "";
	String userName = "";
	String password = "";
	
	dsn = ConfigFlag.UI.REPORTS_DSN.getValue();
	host = ConfigFlag.UI.REPORTS_HOST.getValue();
	userName =  ConfigFlag.UI.REPORTS_USER.getValue();
	password = ConfigFlag.UI.REPORTS_PASS.getValue();
			
	String html = "";
	Integer ward_id = null;
	Integer hospital_id = null;
	 
	PatIdType dispIdType = PatIdType.getNegativeInstance(ConfigFlag.UI.DISPLAY_PATID_TYPE.getValue());
	
	Date startDate = form.getGlobalContext().Core.Reports.getStartDate();
	Date endDate = form.getGlobalContext().Core.Reports.getEndDate();
	Time startTime = form.getGlobalContext().Core.Reports.getStartTime();
	Time endTime = form.getGlobalContext().Core.Reports.getEndTime();
	
	if (form.getGlobalContext().Core.getWard() != null) ward_id = form.getGlobalContext().Core.getWard().getID_Location();
	
	if (form.getGlobalContext().Core.getHospital() !=null) hospital_id = form.getGlobalContext().Core.getHospital().getID_Location();
		
	String server = ConfigFlag.UI.REPORT_SERVER.getValue();
	
	html = "<IFRAME src='http://" + server + "/Hospital Report.asp?wardid=" + ward_id + "&hospitalid=" + hospital_id + "&idtype=" + dispIdType.getId() + "&startdate=" + startDate + "&enddate=" + endDate + "&startTime=" + startTime.toString() + ":00" + "&endTime=" + endTime.toString() + ":00" + "&dsn=" + dsn + "&host=" + host + "&userName=" + userName + "&password=" + password +"' style=\"width:100%; height:100%;\">";		
	
	form.htm1().setHTML(html);
}
 
Example 29
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private Time getShiftEndTime(DailyTimePeriods value, DailyPatternConfigVo voConfiguredPattern)
{
	if (voConfiguredPattern.getSignatoryPeriodIsNotNull() && voConfiguredPattern.getSignatoryPeriod().size() > 0)
	{
		for (int i = 0; i < voConfiguredPattern.getSignatoryPeriod().size(); i++)
		{
			if (voConfiguredPattern.getSignatoryPeriod().get(i).getTimePeriodsIsNotNull() && voConfiguredPattern.getSignatoryPeriod().get(i).getTimePeriods().size() > 0)
			{
				for (int j = 0; j < voConfiguredPattern.getSignatoryPeriod().get(i).getTimePeriods().size(); j++)
				{
					// Correct time found in shift, return the EndTime of
					// shift
					if (voConfiguredPattern.getSignatoryPeriod().get(i).getTimePeriods().get(j).equals(value))
					{
						if (form.getLocalContext().getDailyTimePeriods().size() > 0)
						{
							for (int k = 0; k < form.getLocalContext().getDailyTimePeriods().size(); k++)
							{
								if (form.getLocalContext().getDailyTimePeriods().get(k).equals(voConfiguredPattern.getSignatoryPeriod().get(i).getTimePeriods().get(voConfiguredPattern.getSignatoryPeriod().get(i).getTimePeriods().size() - 1)))
									return new Time(form.getLocalContext().getDailyTimePeriods().get(k).toString().substring(0, 2) + ":00:00");
							}
						}
					}
				}
			}
		}
	}
	return null;
}
 
Example 30
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
protected void onBNewClick() throws ims.framework.exceptions.PresentationLogicException
{
	clearScreen();
	form.ctnDetails().setCollapsed(false);
	form.getLocalContext().setselectedVitalCapacity(null);
	
	form.setMode(FormMode.EDIT);
	form.ctnDetails().customControlAuthoringInfo().initializeComponent();
	form.ctnDetails().setcustomControlAuthoringInfoEnabled(true);
	form.ctnDetails().customControlAuthoringInfo().setIsRequiredPropertyToControls(true);
	form.ctnDetails().dteTaken().setValue(new Date());
	form.ctnDetails().timTaken().setValue(new Time());
}
 
Example 31
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
protected void onBtnNewClick() throws PresentationLogicException
{
	clearScreen();
	
	//WDEV-15996  // Don't allow to create new Vital Signs when "Logged in User is not a Hcp
	if (isLoggedInUser() == false)
	{
		engine.showMessage("Logged in User is not a Hcp");
		return;
	}
	
	
	form.setMode(FormMode.EDIT);
	form.recbrAllRecords().setValue(null);

	form.customControlAuthoringInfo().initializeComponent();
	form.setcustomControlAuthoringInfoEnabled(true);
	
	Object mos = domain.getMosUser();
	if(mos != null){
		form.cmbRecordingHCP().newRow((MemberOfStaffLiteVo)mos, mos.toString());
		form.cmbRecordingHCP().setValue((MemberOfStaffLiteVo)mos);
	}
	form.dtimRecordingDateTime().setValue(new DateTime());

	form.dteTaken().setValue(new Date());
	form.timTaken().setValue(new Time());

	form.dteTaken().setEnabled(true);
	form.timTaken().setEnabled(true);

	form.lyrVSigns().tabSection1().GroupBP().setValue(GenForm.lyrVSignsLayer.tabSection1Container.GroupBPEnumeration.rdoBPSitting);
	onRadioButtonGroupBPValueChanged();

	showBloodGlucoseControls(false, false);
}
 
Example 32
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void applyDefaultsToSpecimenAlreadyCollectedGrid(Date date, Time time)
{
	DynamicGrid dynGridSpecimenAlreadyColl = form.lyrDetails().tabPathDetails().lyrPathology().tabSpecAlreadyCollected().dyngrdSpecAlreadyCollected();

	for (int i = 0; i < dynGridSpecimenAlreadyColl.getRows().size(); i++)
	{
		DynamicGridColumn colDate = dynGridSpecimenAlreadyColl.getColumns().getByIdentifier(DYN_COLDATE);
		colDate.setDynamicWidthSupported(true);
		colDate.setWidth(0);

		DynamicGridColumn colTime = dynGridSpecimenAlreadyColl.getColumns().getByIdentifier(DYN_COLTIME);
		colTime.setDynamicWidthSupported(true);
		colTime.setWidth(0);

		for (int childRowIndex = 0; childRowIndex < dynGridSpecimenAlreadyColl.getRows().get(i).getRows().size(); childRowIndex++)
		{
			DynamicGridRow cRow = dynGridSpecimenAlreadyColl.getRows().get(i).getRows().get(childRowIndex);
			DynamicGridCell cellDate = cRow.getCells().get(colDate);
			if (cellDate != null)
				cellDate.setValue(date);

			DynamicGridCell cellTime = cRow.getCells().get(colTime);
			if (cellTime != null)
				cellTime.setValue(time);
		}

		for (int p = 0; p < dynGridSpecimenAlreadyColl.getRows().get(i).getRows().size(); p++)
			dynGridSpecimenAlreadyColl.getRows().get(i).getRows().get(p).getCells().get(dynGridSpecimenAlreadyColl.getColumns().getByIdentifier(QTY_COLUMN)).setWidth(90);
	}
}
 
Example 33
Project: AvoinApotti   File: DynamicAssessmentsImpl.java   View source code 5 votes vote down vote up
private Answer_DetailsVo assemblePatientAnswerDetails(PatientAnswerDetails doPatientAnswerDetails) 
{
	if(doPatientAnswerDetails == null)
		return null;
	
	Answer_DetailsVo answerDetails = new Answer_DetailsVo(doPatientAnswerDetails.getId(), doPatientAnswerDetails.getVersion());
	answerDetails.setIsRIE(doPatientAnswerDetails.getIsRIE());
	answerDetails.setAnswerType(assembleQuestionAnswerType(doPatientAnswerDetails.getAnswerType()));
	answerDetails.setAnswerWidth(doPatientAnswerDetails.getAnswerWidth());
	answerDetails.setMaxMultiselectAllowed(doPatientAnswerDetails.getMaxMultiselectAllowed());
	answerDetails.setBoolValueAnswer(doPatientAnswerDetails.isBoolValueAnswer());
	answerDetails.setPicklist(assembleAnswerOption(doPatientAnswerDetails.getPicklist()));
	answerDetails.setCalculatedScore(doPatientAnswerDetails.getCalculatedScore());
	answerDetails.setDateAnswer(doPatientAnswerDetails.getDateAnswer() != null ? new Date(doPatientAnswerDetails.getDateAnswer()) : null);
	answerDetails.setTimeAnswer(doPatientAnswerDetails.getTimeAnswer() != null ? new Time(doPatientAnswerDetails.getTimeAnswer()) : null);
	answerDetails.setStringAnswer(doPatientAnswerDetails.getStringAnswer());
	answerDetails.setIntegerAnswer(doPatientAnswerDetails.getIntegerAnswer());
	answerDetails.setDecimalAnswer(doPatientAnswerDetails.getDecimalAnswer());
	answerDetails.setPartialDate(doPatientAnswerDetails.getPartialDate() != null ? new PartialDate(doPatientAnswerDetails.getPartialDate()) : null);
	
	if(doPatientAnswerDetails.getMultiSelectAnswers() != null)
	{
		answerDetails.setMultiSelectAnswers(new Answer_OptionVoCollection());
		
		for (Object next : doPatientAnswerDetails.getMultiSelectAnswers())
		{
			if(next instanceof AnswerOption)
			{
				answerDetails.getMultiSelectAnswers().add(assembleAnswerOption((AnswerOption) next));
			}
		}	
	}
	
	return answerDetails;
}
 
Example 34
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private Time getFirstAvailableSlotTime(SessionTheatreVo session)
{
	if (session == null)
		throw new CodingRuntimeException("session cannot be null in method getFirstAvailableSlotTime");
	
	if(session.getParentChildSlotsIsNotNull() && session.getParentChildSlots().size() > 0)
	{
		session.getParentChildSlots().sort(SortOrder.ASCENDING);
		int i=0;
		
		do
		{
			if(i < session.getParentChildSlots().size())
			{
				if(session.getParentChildSlots().get(i).getStatusIsNotNull() && (session.getParentChildSlots().get(i).getStatus().equals(Status_Reason.SLOTOPENED) || session.getParentChildSlots().get(i).getStatus().equals(Status_Reason.APPOINTMENT_BOOKED)))
					return session.getParentChildSlots().get(i).getStartTime().copy();
			}
			
			i++;
		}
		while(i<session.getParentChildSlots().size() && session.getParentChildSlots().get(i).getStatusIsNotNull() && !session.getParentChildSlots().get(i).getStatus().equals(Status_Reason.SLOTOPENED));
		
		
	}
	
	return null;
}
 
Example 35
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private boolean validTimes(Profile_Exc_TimeVo voExclTime, Sch_ProfileGenericVo profile)
{
	// Any exclusion dates must be between profile start and end dates
	Time startTime = voExclTime.getStartTime();
	Time endTime = voExclTime.getEndTime();
	Time profStartTime = profile.getStartTm();
	Time profEndTime = profile.getEndTm();
	if (startTime != null && endTime != null && profStartTime != null)
	{
		if (startTime.isLessThan(profStartTime) || startTime.isGreaterThan(profEndTime) || endTime.isLessThan(profStartTime) || endTime.isGreaterThan(profEndTime))
			return false;
	}
	return true;
}
 
Example 36
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private String[] getUIValidation()
{
	List<String> errors = new ArrayList<String>();
	
	if(form.intApptLength().getValue() == null)
		errors.add("'Appointment Length' is mandatory");
	if(form.cmbProcedure().getValue() == null)
		errors.add("'Procedure' is mandatory");
	if(form.cmbListOwners().getValue() == null)
		errors.add("'Consultant' is mandatory");
	
	if (form.timTCI().isVisible())
	{
		if (form.timTCI().getValue() == null)
			errors.add("'To Come in Time' is mandatory");
		else if (form.dteToComeIn().isVisible() && form.dteToComeIn().getValue() == null) //WDEV-18396 
			errors.add("'To Come in Date' is mandatory");
		//WDEV-18357
		else if (form.getGlobalContext().Scheduling.getBookTheatreSlotDialogData() != null && form.getGlobalContext().Scheduling.getBookTheatreSlotDialogData().getParentChildSlot() != null 
				&& form.getGlobalContext().Scheduling.getBookTheatreSlotDialogData().getParentChildSlot().getStartTime() != null 
				&& form.getGlobalContext().Scheduling.getBookTheatreSlotDialogData().getSession() != null 
				&& form.getGlobalContext().Scheduling.getBookTheatreSlotDialogData().getSession().getSessionDate() != null)
			{
				Date sessionDate = form.getGlobalContext().Scheduling.getBookTheatreSlotDialogData().getSession().getSessionDate();
				Time appTime = form.getGlobalContext().Scheduling.getBookTheatreSlotDialogData().getParentChildSlot().getStartTime();

				//WDEV-18396 
				if (form.dteToComeIn().isVisible() && (form.dteToComeIn().getValue().isGreaterThan(sessionDate) || (form.dteToComeIn().getValue().equals(sessionDate) && form.timTCI().getValue().isGreaterThan(appTime))))
					errors.add("To Come in Date/Time cannot be after Appointment Date/Time");
				else if (form.timTCI().getValue().isGreaterThan(appTime))
   					errors.add("'To Come in Time' cannot be after 'Appointment Time'");
			}
	}
	
	return errors.size() > 0 ? errors.toArray(new String[0]) : null;	
}
 
Example 37
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private int calculateDuration(Time startTime, Time endTime)
{
	if (startTime == null || endTime == null)
		throw new CodingRuntimeException("startTime or endTime is null in method calculateDuration");

	int mins = endTime.getTotalMinutes() - startTime.getTotalMinutes();
	if(endTime.isLessThan(startTime))	
	{
		Time midNight = new Time(23,59);
		mins = midNight.getTotalMinutes() + 1 - startTime.getTotalMinutes() + endTime.getTotalMinutes(); 
	}
		
	return mins;
}
 
Example 38
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private int calculateApptDuration(Time startTime, Time endTime)
{
	if (startTime == null || endTime == null)
		throw new CodingRuntimeException("apptStartTime or apptEndTime is null in method calculateApptDuration");

	int mins = endTime.getTotalMinutes() - startTime.getTotalMinutes();
	//appt has gone past midnight
	if(endTime.isLessThan(startTime))	
	{
		Time midNight = new Time(23,59);
		mins = midNight.getTotalMinutes() + 1 - startTime.getTotalMinutes() + endTime.getTotalMinutes(); 
	}
		
	return mins;
}
 
Example 39
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
protected void onBtnApplyOtherClick() throws PresentationLogicException
{
	SpecimenCollectionMethod type = form.lyrDetails().tabPathDetails().lyrPathology().tabOther().cmbRequestedTypeOther().getValue();
	Date date = form.lyrDetails().tabPathDetails().lyrPathology().tabOther().dteCollectOther().getValue();
	Time time = form.lyrDetails().tabPathDetails().lyrPathology().tabOther().timCollectOther().getValue();

	applyDefaultsToOtherGrid(type, date, time);
}
 
Example 40
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void storeApptTimeSelection(Booking_AppointmentVo value, Time getcolApptTime)
{
	Map map = form.getLocalContext().getSelectedApptTimes();
	if (map == null)
		map = new HashMap();

	Object entry = map.get(value);

	if (entry == null)
		map.put(value, getcolApptTime);

	form.getLocalContext().setSelectedApptTimes(map);
}