Java Code Examples for ims.framework.utils.Date

The following are top voted examples for showing how to use ims.framework.utils.Date. 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: Logic.java   Source Code and License 6 votes vote down vote up
public void newInstance() throws PresentationLogicException
{
	if (allowNew())
	{
		// initalise the screen for a new record
		form.getLocalContext().setSelectedRecord(new SocialStatusVo());
		clearInstanceControls();
		form.ctnSocialStatus().customControlAuthor().initializeComponent();
		form.ctnSocialStatus().dteDateOPD().setValue(new Date());
		form.ctnSocialStatus().setCollapsed(false);
		//set the form mode
		form.grdModalityIndex().setValue(null);//wdev-2041
		form.setMode(FormMode.EDIT);
		//set any control status specific this form
		//form.ctnSocialStatus().setcustomControlAuthorEnabled(true);
	}	
}
 
Example 2
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private boolean validateSearchCriteria() 
{
	ArrayList<String> uiErrors = new ArrayList<String>();
	Date dateFrom = form.dteFrom().getValue();
	Date dateTo = form.dteTo().getValue();
	
	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		uiErrors.add("From Date can not be greater than End Date");
	}
	
	if (uiErrors.size() > 0)
	{
		engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		return false;
	}
	return true;
}
 
Example 3
Project: AvoinApotti   File: ClinicListwithICPActionsImpl.java   Source Code and License 6 votes vote down vote up
private PathwayRTTStatus createPatientRTTStatus(int nationalCode) //WDEV-18325
{
	PathwayRTTStatus rttSTatusDO = new PathwayRTTStatus();
	
	RTTStatusPoint rttStatusPoint = getRTTStatusPointFromConfig(nationalCode);
	
	rttSTatusDO.setRTTStatus(rttStatusPoint);
	
	Object mos = getMosUser();
	MemberOfStaff doMos = null;
	
	if(mos instanceof MemberOfStaffLiteVo)
	{
		doMos = MemberOfStaffLiteVoAssembler.extractMemberOfStaff(getDomainFactory(), (MemberOfStaffLiteVo) mos);
	}
	
	rttSTatusDO.setStatusBy(doMos);
	rttSTatusDO.setStatusDateTime(new java.util.Date());
	
	rttSTatusDO.setSetting("O");
	
	return rttSTatusDO;
}
 
Example 4
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private boolean validateSearchCriteria(boolean showErrors)
{
	ArrayList<String> uiErrors = new ArrayList<String>();
	
	Date dateFrom = form.dteFrom().getValue();
	Date dateTo = form.dteTo().getValue();
	
	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		uiErrors.add("Date from can not be greater than date to");
	}
	
	if (uiErrors.size() > 0)
	{
		if (showErrors)
			engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		return false;
	}
	
	return true;
}
 
Example 5
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void listSessions(boolean useFirstAvaialbleCheck)
{

	ActivityVo voActivity = form.cmbActivity().getValue();

	if (useFirstAvaialbleCheck)
	{
		if (form.chkFirst().getValue() == true)
		{
			Date currentDate = domain.getCurrentMonth(form.cmbClinic().getValue(), voActivity, form.cmbSpecialty().getValue(), form.cmbLocation().getValue(), form.customControlHcp().getValue(), form.chkFirst().getValue());
			if (currentDate != null)
			{
				form.bookingCalendar1().setCurrentMonth(currentDate);
				form.getLocalContext().setCurrentDate(currentDate);
			}
		}
	}

	Date dateStart = new Date(form.bookingCalendar1().getCurrentMonth().getYear(), form.bookingCalendar1().getCurrentMonth().getMonth(), 1);
	Date dateEnd = new Date(form.bookingCalendar1().getCurrentMonth().getYear(), form.bookingCalendar1().getCurrentMonth().getMonth(), form.bookingCalendar1().getCurrentMonth().getNumberOfDaysInTheMonth());

	SessionShortVoCollection voCollSessionShort = domain.listGenericSession(dateStart, dateEnd, form.cmbClinic().getValue(), voActivity, form.cmbSpecialty().getValue(), form.cmbLocation().getValue(), form.customControlHcp().getValue(), form.chkFirst().getValue(), form.chkOverBook().getValue());
	form.getLocalContext().setSessions(voCollSessionShort);
}
 
Example 6
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void updateDocumentStatus(DocumentStatus value)
{

	if (value.equals(DocumentStatus.SUPLEMENTRY))
	{

		CorrespondenceDetailsVo voCorrespondenceDetails = form.getLocalContext().getcorrespondenceDetails();
		DocumentVo nuDoc = new DocumentVo();
		nuDoc.setTemplate(form.getGlobalContext().Correspondence.getReportTemplate());
		nuDoc.setPatient(form.getGlobalContext().Core.getPatientShort());
		nuDoc.setStatus(DocumentStatus.GENNOTPRINTED);
		nuDoc.setContent(voCorrespondenceDetails.getCurrentDocument().getContent());
		nuDoc.setCreationDate(new Date());
		voCorrespondenceDetails.setCurrentDocument(nuDoc);
		voCorrespondenceDetails.setCurrentStatus(DocumentStatus.GENNOTPRINTED);
		form.getLocalContext().setcorrespondenceDetails(voCorrespondenceDetails);
		form.getLocalContext().getcorrespondenceDetails();

	}
	else
	{

		form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().setStatus(value);

	}
}
 
Example 7
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void initialise()
{
	if(form.getGlobalContext().Nursing.getCarePlanEvaluationFilterIsNotNull())		//wdev-10789
	{
		CarePlanEvaluationFilterVo tempVo = form.getGlobalContext().Nursing.getCarePlanEvaluationFilter();
		form.dteFrom().setValue(tempVo.getFromDate());
		form.dteTo().setValue(tempVo.getToDate());
		form.chkActive().setValue(tempVo.getActiveOnly());
	}
	else
	{
		form.dteFrom().setValue(new Date().addDay(-30));
		form.dteTo().setValue(new Date());
		form.chkActive().setValue(true);
	}
}
 
Example 8
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void prePopulateOtherControls()
{
	SpecimenCollectionMethodCollection collTypes = LookupHelper.getSpecimenCollectionMethod(domain.getLookupService());
	for (int i = 0; i < collTypes.size(); i++)
	{
		if (collTypes.get(i).equals(SpecimenCollectionMethod.OTHER))
		{
			for (int p = 0; p < collTypes.get(i).getChildren().length; p++)
				form.lyrDetails().tabPathDetails().lyrPathology().tabOther().cmbRequestedTypeOther().newRow((SpecimenCollectionMethod) collTypes.get(i).getChildren()[p], ((SpecimenCollectionMethod) collTypes.get(i).getChildren()[p]).getText());

			break;
		}
	}

	form.lyrDetails().tabPathDetails().lyrPathology().tabOther().dteCollectOther().setValue(new Date());
	form.lyrDetails().tabPathDetails().lyrPathology().tabOther().cmbRequestedTypeOther().setValue(SpecimenCollectionMethod.WARDCOLLECTION);
	form.lyrDetails().tabPathDetails().lyrPathology().tabOther().btnApplyOther().setEnabled(true);
}
 
Example 9
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void initialize()
{
	form.lyrMain().tabCharting().chartingControl().initialize(engine.isDialog());
	
	populateDispipline();
	populateChartTypes();
	form.lyrMain().tabSearch().GroupFilterResults().setValue(GenForm.lyrMainLayer.tabSearchContainer.GroupFilterResultsEnumeration.rdoAll);
	form.lyrMain().tabSearch().GrpCriteria().setValue(GenForm.lyrMainLayer.tabSearchContainer.GrpCriteriaEnumeration.rdoBegins);
	updateTotal(0);

	form.lyrMain().tabCharting().dteChartingStartDate().setValue(new Date().addYear(-1));
	form.lyrMain().tabCharting().dteChartingEndDate().setValue(new Date());

	setupGraphingView();
	
	//security level WDEV-11036
	RoleDisciplineSecurityLevelLiteGCVo voRoleDisciplineSecurityLevels = form.getGlobalContext().OCRR.getRoleDisciplineSecurityLevels();
	if(voRoleDisciplineSecurityLevels == null || (voRoleDisciplineSecurityLevels != null &&  voRoleDisciplineSecurityLevels.getIsConfigLoadedIsNotNull() && !voRoleDisciplineSecurityLevels.getIsConfigLoaded().equals(false)))
		form.getGlobalContext().OCRR.setRoleDisciplineSecurityLevels(domain.getRoleDisciplineSecurityLevels(engine.getLoggedInRole()));
	
	form.btnPrint().setEnabled(false);
	
	updatePrintCumulativeButtonStatus();
}
 
Example 10
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
protected void onBtnNewClick() throws PresentationLogicException
{

	clearScreen();
	form.setMode(FormMode.EDIT);
	form.txtComments().setFocus();

	TransferNote voTran = new TransferNote();
	form.getLocalContext().setRecord(voTran);

	if (domain.getMosUser() != null)
		form.txtHCP().setValue(((MemberOfStaffShortVo) domain.getMosUser()).toString());

	form.dteRecording().setValue(new Date());
	form.timRecording().setValue(new Time());

	form.dteTransfer().setValue(new Date());
	form.timTransfer().setValue(new Time());

	form.btnUpdate().setEnabled(false);
}
 
Example 11
Project: AvoinApotti   File: IntraOperativeCareRecordImpl.java   Source Code and License 6 votes vote down vote up
public Booking_AppointmentShortVo getMostRecentOutPatientAppointment(PatientRefVo voPatientRef)
{
	if (voPatientRef == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	
	String hql = "from Booking_Appointment as b1	where (b1.appointmentDate <= :todayDate and b1.theatreBooking is null and b1.patient.id = :patID) order by b1.appointmentDate desc";

	ArrayList<String> paramNames = new ArrayList<String>();
	ArrayList<Object> paramValues = new ArrayList<Object>();

	paramNames.add("todayDate");
	paramValues.add(new Date().getDate());
	
	paramNames.add("patID");
	paramValues.add(voPatientRef.getID_Patient());
	
	List list = factory.find(hql, paramNames, paramValues);
	if (list != null && list.size() > 0)
		return Booking_AppointmentShortVoAssembler.createBooking_AppointmentShortVoCollectionFromBooking_Appointment(list).get(0);
	else
		return null;
}
 
Example 12
Project: AvoinApotti   File: DemographicsImpl.java   Source Code and License 6 votes vote down vote up
private PathwayRTTStatus createPathwRTTStatus(int nationalCode) throws StaleObjectException //WDEV-18326
{
	PathwayRTTStatus rttSTatusDO = new PathwayRTTStatus();

	RTTStatusPoint rttStatusPoint = getRTTStatusPointFromConfig(nationalCode);

	rttSTatusDO.setRTTStatus(rttStatusPoint);

	Object mos = getMosUser();
	MemberOfStaff doMos = null;

	if(mos instanceof MemberOfStaffLiteVo)
	{
		doMos = MemberOfStaffLiteVoAssembler.extractMemberOfStaff(getDomainFactory(), (MemberOfStaffLiteVo) mos);
	}

	rttSTatusDO.setStatusBy(doMos);
	rttSTatusDO.setStatusDateTime(new java.util.Date());

	return rttSTatusDO;
}
 
Example 13
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private Date[] getDateArray()
{
	Date[] arrDates = new Date[8];
	Date dispDate1 = form.dteStart().getValue().copy();
	arrDates[0] = dispDate1;
	Date dispDate2 = form.dteStart().getValue().copy().addDay(1);
	arrDates[1] = dispDate2;
	Date dispDate3 = form.dteStart().getValue().copy().addDay(2);
	arrDates[2] = dispDate3;
	Date dispDate4 = form.dteStart().getValue().copy().addDay(3);
	arrDates[3] = dispDate4;
	Date dispDate5 = form.dteStart().getValue().copy().addDay(4);
	arrDates[4] = dispDate5;
	Date dispDate6 = form.dteStart().getValue().copy().addDay(5);
	arrDates[5] = dispDate6;
	Date dispDate7 = form.dteStart().getValue().copy().addDay(6);
	arrDates[6] = dispDate7;
	Date dispDate8 = form.dteStart().getValue().copy().addDay(7);
	arrDates[7] = dispDate8;

	return arrDates;
}
 
Example 14
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
protected void onGridActionsGridCheckBoxClicked(int column, gridActionsRow row, boolean isChecked) throws PresentationLogicException
{
	if (isChecked)
	{
		row.setColActionDate(new Date().toString(DateFormat.STANDARD));

		Object hcpLite = domain.getHcpLiteUser();
		row.setColByValue(hcpLite != null ? (HcpLiteVo) hcpLite : null);
		row.setColBy(hcpLite != null ? (((HcpLiteVo) hcpLite).getName() != null ? ((HcpLiteVo) hcpLite).getName().toString() : null) : null);
	}
	else
	{
		row.setColActionDate(null);
		row.setColBy("");
		row.setColDetails("");
		// row.setReadOnly(true);
	}

}
 
Example 15
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
@Override
protected void onGrdHomeLeaveSelectionChanged() throws PresentationLogicException 
{
	form.getLocalContext().setAdmissionDetail(null);
	clearScreen();
	if(form.lyrAdmission().tabHomeLeave().grdHomeLeave().getValue() == null)
		return;

	form.dteHLDateReturn().setEnabled(true);
	form.timHLTimeOfReturn().setEnabled(true);
	form.dteHLDateReturn().setValue(new Date());

	form.getLocalContext().setRecordSelected(true);
	
	InpatientEpisodeLiteVo voInWaiting = form.lyrAdmission().tabHomeLeave().grdHomeLeave().getValue();
	AdmissionDetailVo voAdmission = domain.getAdmissionDetailByPasEvent(voInWaiting.getPasEvent());
	if(voAdmission == null)
		return;
	
	form.getLocalContext().setAdmissionDetail(voAdmission);
	form.fireCustomControlValueChanged();
}
 
Example 16
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateResultsGrid(ClinicalResultListVoCollection voCollResults, Date dateUnseen)
{
	if (voCollResults == null || voCollResults.size() == 0)
	{
		engine.showMessage("No records match your search criteria.");
		return;
	}

	form.getLocalContext().setResultCollectionFromGrid(null); //WDEV-16882
	
	for (int i = 0; i < voCollResults.size(); i++)
	{
		Color backColour = ((i % 2) == 0 ? Color.Beige : Color.Default);
		addResultRow(voCollResults.get(i), dateUnseen, backColour);
	}
	
	updateTotal();
}
 
Example 17
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private boolean isSearchCriteriaValid()
{
	Date dateFrom = form.dteDateFrom().getValue();
	Date dateTo = form.dteDateTo().getValue();

	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		engine.showMessage("Date From cannot be greater than Date To", "Validation error", MessageButtons.OK, MessageIcon.ERROR);
		return false;
	}

	if( isAtLeastOneSearchFieldCompleted() == false)
	{
		engine.showMessage("Complete at least one search field.", "Validation error", MessageButtons.OK, MessageIcon.ERROR);
		return false;
	}

	return true;
}
 
Example 18
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
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 19
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateScreenFromPatientSelected(PatientShort voPatient)
{
	clearScreen();
	
	if(voPatient == null)
		return;
	
	if(form.getGlobalContext().Core.getADTWardIsNotNull())
	{
		form.cmbWard().newRow(form.getGlobalContext().Core.getADTWard(), form.getGlobalContext().Core.getADTWard().toString());
		form.cmbWard().setValue(form.getGlobalContext().Core.getADTWard());			
	}
	
	//WDEV-10076
	form.cmbMethod().setValue(null);
	form.dtimAdmit().setValue(new DateTime());
	form.dteEstDischarge().setValue(new Date()); 	
	form.chkChaplain().setValue(false);
	
	form.cmbPatientStatus().setValue(PatientStatus.NHS);

	loadEpisodes();
	
}
 
Example 20
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void listAppointments(Date endDate, Date startDate, boolean listBookedAppointments)
{
	try
	{
		// Perform domain search
		Booking_AppointmentTransportVoCollection appointments = domain.listAppoinments(startDate, endDate, listBookedAppointments);
		
		// Show message for no results found
		if (appointments == null || appointments.size() == 0)
		{
			engine.showMessage("No results were found.");
		}
		
		// Show the search results
		setSearchResultsGrid(appointments);
	}
	catch (DomainInterfaceException e)
	{
		// Show errors message for exceptions
		engine.showMessage(e.getMessage(), "Error");
	}
}
 
Example 21
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void clearBookingCalendar()
{
	form.bookingCalendar().clearBookedChecks();
	form.bookingCalendar().clearChecks();
	form.bookingCalendar().clearPercentages();
	form.bookingCalendar().clearNoSessionDates();
	form.bookingCalendar().clearNoSlotDates();
	form.bookingCalendar().clearBackColors();

	Date dateStart = new Date(form.bookingCalendar().getCurrentMonth().getYear(), form.bookingCalendar().getCurrentMonth().getMonth(), 1);
	Date dateEnd = new Date(form.bookingCalendar().getCurrentMonth().getYear(), form.bookingCalendar().getCurrentMonth().getMonth(), form.bookingCalendar().getCurrentMonth().getNumberOfDaysInTheMonth());

	while (dateStart.isLessOrEqualThan(dateEnd))
	{
		form.bookingCalendar().addNoSessionDates(new Date(dateStart));
		dateStart.addDay(1);
	}
}
 
Example 22
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private boolean isSearchCriteriaValid()
{
	if (form.txtType().getValue() != null && form.cmbType().getValue() == null)
	{
		engine.showMessage("Please select a Patient ID Type");
		return false;
	}

	ArrayList<String> uiErrors = new ArrayList<String>();

	Date dateFrom = form.dteFrom().getValue();
	Date dateTo = form.dteTo().getValue();

	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		uiErrors.add("'Date From' can not be greater than 'Date To'");
	}

	if (uiErrors.size() > 0)
	{
		engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		return false;
	}

	return true;
}
 
Example 23
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
@Override
protected void onFormOpen(Object[] args) throws PresentationLogicException
{
	initializeDynamicGrid();
	//WDEV-16115
	form.ccPrinter().initialize(domain.getCurrentLocation(), PrinterScope.NEWRESULT);
	if (form.ccPrinter().getSelectedPrinter() == null)
	{
		form.ccPrinter().initialize(domain.getCurrentLocation(), PrinterScope.OCSORDER);
	}
	PathologyResultListShortVoCollection results = form.getGlobalContext().OCRR.getResultsForPrint();
	if (results == null)
		return;

	Integer nNewResUnseenDays = new Integer(ConfigFlag.DOM.OCS_NEWRES_UNSEEN_CUTOFF.getValue());
	Date dateUnseen = new Date().addDay(-1 * nNewResUnseenDays.intValue());

	for (int x = 0; x < results.size(); x++)
	{
		addResult(results.get(x), dateUnseen);
	}		
}
 
Example 24
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void clearBookingCalendar()
{
	form.bookingCalendar1().clearBookedChecks();
	form.bookingCalendar1().clearChecks();
	form.bookingCalendar1().clearPercentages();
	form.bookingCalendar1().clearNoSessionDates();
	form.bookingCalendar1().clearNoSlotDates();
	form.bookingCalendar1().clearBackColors();

	Date dateStart = new Date(form.bookingCalendar1().getCurrentMonth().getYear(), form.bookingCalendar1().getCurrentMonth().getMonth(), 1);
	Date dateEnd = new Date(form.bookingCalendar1().getCurrentMonth().getYear(), form.bookingCalendar1().getCurrentMonth().getMonth(), form.bookingCalendar1().getCurrentMonth().getNumberOfDaysInTheMonth());

	while (dateStart.isLessOrEqualThan(dateEnd))
	{
		form.bookingCalendar1().addNoSessionDates(new Date(dateStart));
		dateStart.addDay(1);
	}
}
 
Example 25
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
protected void onRadioButtongrpShowByValueChanged() throws PresentationLogicException 
{
	if(form.grpShowBy().getValue().equals(GenForm.grpShowByEnumeration.rdoByDay))
	{
		form.dteShowByDay().setEnabled(true);
		form.dteShowByDay().setValue(new Date());
		form.dteFrom().setEnabled(false);
		form.dteTo().setEnabled(false);
		form.dteFrom().setValue(null);
		form.dteTo().setValue(null);
	}
	else
	{
		form.dteShowByDay().setEnabled(false);
		form.dteShowByDay().setValue(null);
		form.dteFrom().setEnabled(true);
		form.dteTo().setEnabled(true);
		form.dteFrom().setValue(new Date());
		form.dteTo().setValue(new Date());
	}
	onBtnViewClick();
}
 
Example 26
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
protected void onRadioButtongrpShowByValueChanged() throws PresentationLogicException 
{
	if(form.grpShowBy().getValue().equals(GenForm.grpShowByEnumeration.rdoDay))
	{
		form.dteShowByDay().setEnabled(true);
		form.dteShowByDay().setValue(new Date());
		form.dteFrom().setEnabled(false);
		form.dteTo().setEnabled(false);
		form.dteFrom().setValue(null);
		form.dteTo().setValue(null);
	}
	else
	{
		form.dteShowByDay().setEnabled(false);
		form.dteShowByDay().setValue(null);
		form.dteFrom().setEnabled(true);
		form.dteTo().setEnabled(true);
		form.dteFrom().setValue(new Date());
		form.dteTo().setValue(new Date());
	}
	
	onBtnViewClick();
	
}
 
Example 27
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
protected void onRadioButtongrpShowByValueChanged() throws ims.framework.exceptions.PresentationLogicException
{
	if(form.grpShowBy().getValue().equals(GenForm.grpShowByEnumeration.rdoDay))
	{
		form.dteDay().setEnabled(true);
		form.dteDay().setValue(new Date());
		form.dteFrom().setEnabled(false);
		form.dteTo().setEnabled(false);
		form.dteFrom().setValue(null);
		form.dteTo().setValue(null);
	}
	else
	{
		form.dteDay().setEnabled(false);
		form.dteDay().setValue(null);
		form.dteFrom().setEnabled(true);
		form.dteTo().setEnabled(true);
		form.dteFrom().setValue(new Date());
		form.dteTo().setValue(new Date());
	}
	
	onBtnViewClick();
}
 
Example 28
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private Integer calculateWaintingTime(Date sd, Date ed)
{
	if (sd != null && ed != null)	
		return (int)Date.daysBetween(sd, ed);
	
	return null;
}
 
Example 29
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
protected void onBookingCalendarApptsMonthSelected(
		ims.framework.utils.Date date)
		throws ims.framework.exceptions.PresentationLogicException {
	if (validateSearchCriteria() == null) {
		clearBookingCalendar();
		listSessions();
		form.bookingCalendarAppts().clearNoSessionDates();
		initialiseCalendar();
	}
}
 
Example 30
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
public String[] validateUIRules()
{
	List<String> uiErrors = new ArrayList<String>();
	
	if (form.cmbStatus().getValue() != null)
	{
		if (form.cmbStatus().getValue().equals(PreActiveActiveInactiveStatus.ACTIVE) && form.dteActiveFrom().getValue() == null)
			uiErrors.add("Please enter Active From date value.");
	
		if (form.cmbStatus().getValue().equals(PreActiveActiveInactiveStatus.INACTIVE) && (form.dteActiveFrom().getValue() == null || form.dteActiveTo().getValue() == null))
			uiErrors.add("Please enter Active From and Active To date values.");
		
	}
	
	// Validate Active To date not to be set into future if version status is inactive
	if (PreActiveActiveInactiveStatus.INACTIVE.equals(form.cmbStatus().getValue()) && form.dteActiveTo().getValue() != null && form.dteActiveTo().getValue().isGreaterThan(new Date()))
		uiErrors.add("Active To date can not be set into future if version status is inactive");
	
	if (form.dteActiveFrom().getValue() != null && form.dteActiveTo().getValue() != null)
		if (form.dteActiveFrom().getValue().isGreaterThan(form.dteActiveTo().getValue()))
			uiErrors.add("Active From date must be before Active To date.");
	
	String[] voValidate = new String[uiErrors.size()];
	uiErrors.toArray(voValidate);
	
	return voValidate;
}
 
Example 31
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
protected void onRadioButtonGroup1ValueChanged() throws PresentationLogicException 
{
	//WDEV-15957
	if(Group1Enumeration.rdoYes.equals(form.lyrAdditionalDetails().tabCopy().Group1().getValue()) && form.lyrAdditionalDetails().tabCopy().dteEffectiveFromDate().getValue() == null)
	{
		form.lyrAdditionalDetails().tabCopy().dteEffectiveFromDate().setValue(new Date());
		form.lyrAdditionalDetails().tabCopy().dteEffectiveFromDate().setRequired(true);
	}
	else
	{
		form.lyrAdditionalDetails().tabCopy().dteEffectiveFromDate().setValue(null);
		form.lyrAdditionalDetails().tabCopy().dteEffectiveFromDate().setRequired(false);
	}
}
 
Example 32
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void listAppointmentsForPatientAndDate()
{
	Date dteAppt = null;
	if(form.getLocalContext().getDateApptIsNotNull())
		dteAppt = form.getLocalContext().getDateAppt();
	else
		dteAppt = form.dteAppt().getValue();
	Booking_AppointmentShortVoCollection voCollBookingAppointment = domain.listBookingAppointmentByPatientAndDate(form.getLocalContext().getselectedPatient(), dteAppt);
	populateApptsGrid(voCollBookingAppointment);
}
 
Example 33
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private String[] validateUIRules()
{
	ArrayList<String> errors = new ArrayList<String>();
	
	if (form.lyrDetails().tabDetails().dteDecisionTreat().getValue() != null && form.lyrDetails().tabDetails().dteDecisionTreat().getValue().isGreaterThan(new Date()))
		errors.add("Date Decision to Treat can not be set in the future.");

	if (form.lyrDetails().tabDetails().dteStart().getValue() != null && form.lyrDetails().tabDetails().dteEnd().getValue() != null && form.lyrDetails().tabDetails().dteStart().getValue().isGreaterThan(form.lyrDetails().tabDetails().dteEnd().getValue()))
		errors.add("Actual Start Date can not be greater than Actual End Date.");
	
	if (errors.size() == 0)
		return null;

	return errors.toArray(new String[errors.size()]);
}
 
Example 34
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
@Override
protected void onIntAMPeriodValueChanged() throws PresentationLogicException 
{
	if (form.lyr1().tabActiveMonitoring().dteAMApptBy().getValue() == null
		&& form.lyr1().tabActiveMonitoring().intAMPeriod().getValue() != null
		&& form.lyr1().tabActiveMonitoring().intAMPeriod().getValue() > 0)
		form.lyr1().tabActiveMonitoring().dteAMApptBy().setValue(new Date().addDay(form.lyr1().tabActiveMonitoring().intAMPeriod().getValue()));
}
 
Example 35
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void initialise()
{
	form.dteDate().setValue(new Date());
	loadHospitals();

	createDynamicGrid();

	updateControlsState();
}
 
Example 36
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void initialize()
{
	form.qmbClinic().setEnabled(false);

	PatIdType dispIdType = PatIdType.getNegativeInstance(ConfigFlag.UI.DISPLAY_PATID_TYPE.getValue());
	form.grdOutPatient().setcolHospnumCaption(dispIdType.getText());
	loadClinicLocationCombo();

	UserAccessVo voUserAccess = domain.getUserAccess(engine.getLoggedInUser().getUserId());
	
	if(voUserAccess!=null){
		form.qmbClinic().setVisible(false);
		form.cmbClinic().setVisible(true);
		form.qmbConsultant().setVisible(false);
		form.cmbConsultant().setVisible(true);
		populateCombos(voUserAccess);
	}
	else{
		form.qmbClinic().setVisible(true);
		form.qmbClinic().setEnabled(true);
		form.cmbClinic().setVisible(false);
		form.qmbConsultant().setVisible(true);
		form.cmbConsultant().setVisible(false);
		// WDEV-2847
		populateQmbConsultants();
	}
	form.dteApptDateTo().setValue(new Date());

}
 
Example 37
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private Date calculateEnd18WW(ContractConfigShortVo contract)
{
	if (contract != null)
		return new Date().addDay(contract.getDaysToRTTBreachDate());

	return new Date();
}
 
Example 38
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private String getSlotDateTimeString(SessionSlotListVo slot) {
	String slotDateTime = "";

	Date daySel = form.bookingCalendarAppts().getSelectedDay();
	if (daySel != null)
		slotDateTime += daySel.toString();

	if (slot.getStartTmIsNotNull())
		slotDateTime += " " + slot.getStartTm();

	return slotDateTime;
}
 
Example 39
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void calculateAndSetDateRange()
{
	if (form.cmbDays().getValue() != null)
	{
		int days = form.cmbDays().getValue().intValue();
		form.dteTo().setValue(new Date());
		form.dteFrom().setValue(new Date().addDay(-1 * days));
	}
}
 
Example 40
Project: AvoinApotti   File: PatientAppointmentMangementRefManImpl.java   Source Code and License 5 votes vote down vote up
private void saveLastApptArrivedDate(DomainFactory factory, Booking_Appointment doBookAppt) throws StaleObjectException
{
	if(factory == null || doBookAppt == null)
		throw new CodingRuntimeException("all mandatory params not populated for method saveLastApptArrivedDate");
	
	List lstCatsRef = factory.find("from CatsReferral catsRef join fetch catsRef.appointments appt where appt.id = '" + doBookAppt.getId() + "'");
	if(lstCatsRef != null && lstCatsRef.size() == 1)
	{
		CatsReferral doCatsRef = (CatsReferral) lstCatsRef.get(0);
		doCatsRef.setLastApptArrivedDate(new Date().getDate());
		factory.save(doCatsRef);
	}
}
 
Example 41
Project: AvoinApotti   File: EDischargeFuturePlanComponentImpl.java   Source Code and License 5 votes vote down vote up
public OrderInvestigationBookingVoCollection listResultsAwaited(PatientRefVo patientRefVo, Integer numDays) 
{
	if(numDays == null)
		throw new CodingRuntimeException("Invalid numDays");
	
	if(patientRefVo == null)
		throw new CodingRuntimeException("Invalid patientRefVo");
	
	Date dtFrom = new Date().addDay(-numDays);
					
	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();		
	StringBuffer sb = new StringBuffer(" from OrderInvestigation as oi where ");
	
	sb.append(" oi.systemInformation.creationDateTime >= :fromDate");
	markers.add("fromDate");			
	values.add(dtFrom.getDate());
	
	sb.append(" and oi.ordInvCurrentStatus.ordInvStatus in (:id1, :id2)");
	markers.add("id1");			
	values.add(getDomLookup(OrderInvStatus.ORDERED));
	markers.add("id2");			
	values.add(getDomLookup(OrderInvStatus.SENT));
		
	sb.append(" and ");
	sb.append(" oi.orderDetails.patient.id = :pat ");
	markers.add("pat");
	values.add(patientRefVo.getID_Patient());
	
	sb.append(" order by oi.repDateTime desc, oi.ordInvSeq asc");
	
	List result = getDomainFactory().find(sb.toString(), markers, values);
	return OrderInvestigationBookingVoAssembler.createOrderInvestigationBookingVoCollectionFromOrderInvestigation(result);
}
 
Example 42
Project: AvoinApotti   File: MyOrderImpl.java   Source Code and License 5 votes vote down vote up
public PhlebotomyRoundShortVoCollection listClosedRounds(Date date, SpecimenCollectionTime round, LocationRefVo ward)
{
	if (date == null || round == null || ward == null)
		return null;

	DomainFactory factory = getDomainFactory();

	String hql = "select pRound from PhlebotomyRound" + " as pRound left join pRound.wards as ward where pRound.date = :date and pRound.roundToCollect = :round and ward.id = :wardId";

	List items = factory.find(hql, new String[]{"date", "round", "wardId"}, new Object[]{date.getDate(), getDomLookup(round), ward.getID_Location()});
	if (items != null && items.size() > 0)
		return PhlebotomyRoundShortVoAssembler.createPhlebotomyRoundShortVoCollectionFromPhlebotomyRound(items);

	return null;
}
 
Example 43
Project: AvoinApotti   File: Logic.java   Source Code and License 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 44
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private boolean canBeDNAed(Status_Reason apptStatus, Date dateSession) 
{
	if (apptStatus != null 
		&& apptStatus.equals(Status_Reason.BOOKED))
		{
			if(dateSession != null)
			{
				if(new Date().isGreaterOrEqualThan(dateSession))
				{
					return true;
				}
			}
		}
		return false;
}
 
Example 45
Project: AvoinApotti   File: MyOrderImpl.java   Source Code and License 5 votes vote down vote up
private MyOrderOutpatAttendVo findTodayAppointment(PatientRefVo patient, PASEventRefVo pasEvent)
{
	if (patient == null)
		return null;
	
	ArrayList<String> paramNames = new ArrayList<String>();
	ArrayList<Object> paramValues = new ArrayList<Object>();

	StringBuilder todayQuery = new StringBuilder("FROM OutpatientAttendance AS outp ");
	
	todayQuery.append("WHERE outp.pasEvent.patient.id = :PATIENT_ID ");
	paramNames.add("PATIENT_ID");
	paramValues.add(patient.getID_Patient());
	
	if (pasEvent != null)
	{
		todayQuery.append("AND outp.pasEvent.id = :PAS_EVENT_ID ");
		paramNames.add("PAS_EVENT_ID");
		paramValues.add(pasEvent.getID_PASEvent());
	}
	
	todayQuery.append("AND outp.clinic is not null AND outp.appointmentStatus.id != :CANCELLED_STATUS and outp.appointmentDateTime BETWEEN :TODAY AND :TODAY_MIDNIGHT");
	
	paramNames.add("CANCELLED_STATUS");
	paramValues.add(Status_Reason.CANCELLED.getID());
	
	paramNames.add("TODAY");
	paramValues.add(new DateTime(new Date(), new Time(0, 0, 0)).getJavaDate());
	
	paramNames.add("TODAY_MIDNIGHT");
	paramValues.add(new DateTime(new Date(), new Time(23, 59, 59)).getJavaDate());

	MyOrderOutpatAttendVoCollection outpatientAttendances = MyOrderOutpatAttendVoAssembler.createMyOrderOutpatAttendVoCollectionFromOutpatientAttendance(getDomainFactory().find(todayQuery.toString(), paramNames, paramValues));
	
	if (outpatientAttendances != null && outpatientAttendances.size() > 0)
		return outpatientAttendances.get(0);
	
	return null;
}
 
Example 46
Project: AvoinApotti   File: GenerateSessionsImpl.java   Source Code and License 5 votes vote down vote up
private Set generateTheatreSlots(Set profileTheatreSlots, String dt, Sch_Session session) throws ParseException
{
	Set theatreSessionSlots = new  HashSet();

	Iterator it = profileTheatreSlots.iterator();
	while (it.hasNext())
	{
		ProfileTheatreTCISlot doProfTCISlot = (ProfileTheatreTCISlot) it.next();
		
		int count = 1;
		if(doProfTCISlot.getNoOfInstances() != null)
			count = doProfTCISlot.getNoOfInstances();
		
		for(int i=0; i<count; i++)
		{
			if(doProfTCISlot.isIsActive())
			{						
				SessionTheatreTCISlot doSessTSlot = new SessionTheatreTCISlot();
				
				doSessTSlot.setIsActive(doProfTCISlot.isIsActive());
				doSessTSlot.setProfileSlot(doProfTCISlot);
				
				ims.framework.utils.Date sessDate = new ims.framework.utils.Date(dt, DateFormat.ISO);
				doSessTSlot.setSessDateTime(sessDate.getDate());
				
				doSessTSlot.setSession(session);
				doSessTSlot.setStatus(getDomLookup(Status_Reason.SLOTOPENED));
				doSessTSlot.setStatusReason(getDomLookup(Status_Reason.SLOTOPENED));
				doSessTSlot.setToComeInTime(doProfTCISlot.getToComeInTime());
		
				theatreSessionSlots.add(doSessTSlot);
			}
		}
	}
	return theatreSessionSlots;
}
 
Example 47
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private boolean validateSearchCriteria(boolean showErrors) {
	Date dateFrom = form.dteFrom().getValue();
	Date dateTo = form.dteTo().getValue();
	
	ArrayList<String> uiErrors = new ArrayList<String>();
	Date today = new Date();
	
	if (dateFrom != null)
	{
		if (dateFrom.isGreaterThan(today))
		{
			uiErrors.add("Date from can not be in the future");
		}
		if (dateTo != null && dateTo.isLessThan(dateFrom))
		{
			uiErrors.add("Date from can not be greater than date to");
		}
		if (dateFrom.isLessThan(form.getGlobalContext().Core.getPatientShort().getDob()))
		{
			uiErrors.add("Date from can not be less than patient's date of birth");
		}
	}
	
		if (today.isLessThan(dateTo))
		{
			uiErrors.add("Date to can not be in the future");
		}
		
	
	if (uiErrors.size() > 0)
	{
	
		if (showErrors)
			engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		return false;
	}
	return true;
}
 
Example 48
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private String[] getUIErrors()
{
	ArrayList<String> errors = new ArrayList<String>();

	if (form.dteNextEvaluationDate().getValue() == null)
	{
		errors.add("Next Evaluation Date is mandatory!");
	}
	else
	{
		if (form.dteNextEvaluationDate().getValue().isLessThan(new Date()))
		{
			errors.add("The Next Evaluation Date cannot be in the past!");
		}
	}

	if(	ims.configuration.gen.ConfigFlag.DOM.CAREPLAN_NEXT_EVALUTION_DATE_VALIDATION.getValue() != 0 )
	{
		Date dateT = new Date();
		dateT.addDay(ims.configuration.gen.ConfigFlag.DOM.CAREPLAN_NEXT_EVALUTION_DATE_VALIDATION.getValue());
		if( form.dteNextEvaluationDate().getValue() != null && form.dteNextEvaluationDate().getValue().isGreaterThan(dateT))
		{
			errors.add("Next Evaluation Date exceeds " +ims.configuration.gen.ConfigFlag.DOM.CAREPLAN_NEXT_EVALUTION_DATE_VALIDATION.getValue()+" day policy!" ); //WDEV-15275
		}
	}

	if (errors.size() > 0)
	{
		String[] UIErrors = new String[errors.size()];
		errors.toArray(UIErrors);
		return UIErrors;
	}

	return null;
}
 
Example 49
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void applyDefaultsToOtherGrid(SpecimenCollectionMethod type, Date date, Time time)
{
	DynamicGrid dynGridOther = form.lyrDetails().tabPathDetails().lyrPathology().tabOther().dyngrdOther();

	for (int i = 0; i < dynGridOther.getRows().size(); i++)
	{
		DynamicGridCell cell = dynGridOther.getRows().get(i).getCells().get(dynGridOther.getColumns().getByIdentifier(PATTYPE_COLUMN));
		cell.setValue(type);

		DynamicGridColumn colDate = dynGridOther.getColumns().getByIdentifier(DYN_COLDATE);
		colDate.setDynamicWidthSupported(true);
		colDate.setWidth(0);

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

		if (dynGridOther.getRows().get(i).getRows().size() > 0)
		{
			for (int childRowsIndex = 0; childRowsIndex < dynGridOther.getRows().get(i).getRows().size(); childRowsIndex++)
			{
   				DynamicGridRow cRow = dynGridOther.getRows().get(i).getRows().get(childRowsIndex);
   				
   				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 < dynGridOther.getRows().get(i).getRows().size(); p++)
			dynGridOther.getRows().get(i).getRows().get(p).getCells().get(dynGridOther.getColumns().getByIdentifier(QTY_COLUMN)).setWidth(90);
	}
}
 
Example 50
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
protected void onBtnNewClick() throws ims.framework.exceptions.PresentationLogicException
{
	DateTime now = new DateTime(new Date(), new Time());
	
	if ((form.getGlobalContext().COE.PainBodyChart.getPainAssessmentVOIsNotNull()) && form.getGlobalContext().COE.PainBodyChart.getPainAssessmentVO().getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext()))
	{
		
		PainAssessment lastPainAssessment = form.getGlobalContext().COE.PainBodyChart.getPainAssessmentVO();
		
		if(lastPainAssessment.getDateTimeInitiatedIsNotNull() 
		&& lastPainAssessment.getDateTimeInitiated().getDate().equals(now.getDate()) 
		&& lastPainAssessment.getDateTimeInitiated().getTime().equals(now.getTime())) 
		{
			engine.showMessage("An assessment already exists for " + now);
			return;
		}
		else
			populateScreen();
	}
	else if (form.getGlobalContext().COE.PainBodyChart.getPainAssessmentVOIsNotNull())
	{
		form.getGlobalContext().Core.setYesNoDialogMessage("Do you wish to copy this assessment?");
		engine.open(form.getForms().Core.YesNoDialog,false);
	}
	else
	{
		populateScreen();
	}
	
	form.setMode(FormMode.EDIT);
}
 
Example 51
Project: AvoinApotti   File: ReferralStatusListImpl.java   Source Code and License 5 votes vote down vote up
private List<?> domListDischargeReportRequired(String hql, StringBuffer sb, ArrayList<String> markers, ArrayList<Serializable> values, String andStr, String hqlJoin, CATSReferralFilterVo voCATSFilter) 
{
	//String hql = "select catsref from CatsReferral as catsref left join catsref.referralDetails as refDetails "; 

	if (hqlJoin != "")
		hql += hqlJoin;

	
	if(voCATSFilter.getDischargeFromDateIsNotNull())
	{
		sb.append(andStr + " catsref.dischargeDate >= :dischFrom ");
		markers.add("dischFrom");
		values.add(voCATSFilter.getDischargeFromDate().getDate());
		andStr = " and ";
	}
	
	if(voCATSFilter.getDischargeToDateIsNotNull())
	{
		sb.append(" and catsref.dischargeDate < :dischTo ");
		markers.add("dischTo");
		values.add(((Date) voCATSFilter.getDischargeToDate().clone()).addDay(1).getDate());
		andStr = " and ";
	}


	sb.append(andStr + " catsref.requiresDischargeRep = :isReq");

	markers.add("isReq");
	values.add(Boolean.TRUE);

	sb.append(" and catsref.isRIE is null order by refDetails.dateOfReferral asc, refDetails.id asc");
	
	hql += " where ";
	
	hql += sb.toString();
	return getDomainFactory().find(hql.toString(), markers, values);
}
 
Example 52
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
@Override
protected void onImbClearClick() throws ims.framework.exceptions.PresentationLogicException
{
	clearSearchCriteria();
	clearScreen(true);
	form.bookingCalendar().setCurrentMonth(new Date());
	form.getLocalContext().setCurrentDate(null);
	clearBookingCalendar();
}
 
Example 53
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void newMedicationInstance() 
{
	form.ctnDetails().setCollapsed(false);
	PatientMedicationVo voNewInstance = new PatientMedicationVo();
	voNewInstance.setIsCopied(new Boolean(false));
	voNewInstance.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
	voNewInstance.setPatient(form.getGlobalContext().Core.getPatientShort());
	voNewInstance.setIsDiscontinued(Boolean.FALSE);								// WDEV-13309
	form.getLocalContext().setSelectedInstance(voNewInstance);

	clearInstanceControls();
	setDefaultInstanceControls();
	form.setMode(FormMode.EDIT);
	displayOrHideEnableDisableScreenSpecificControls();
	allowEditingInstanceControls(true);
	
	//Defaulting Authoring HCP and Date
	form.ctnDetails().dteCommenced().setValue(new Date());
	form.ctnDetails().cmbCommencedBy().setValue(MedciationCommencedDiscontinuedType.MOS);
	Hcp hcp = (Hcp) domain.getHcpUser();
	if(hcp != null)
	{
		form.ctnDetails().qmbCommencedBy().newRow(hcp, hcp.toString());
		form.ctnDetails().qmbCommencedBy().setValue(hcp);
	}
	
	//WDEV-2162
	newMedicationDoseInstance();
	updateDiscontinueDoseMenu();//WDEV-14928
}
 
Example 54
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void updatePlannedTabDateSearchCriteria() 
{
	Boolean todayOnly = Boolean.TRUE.equals(form.lyrAdmission().tabPlanned().chkTodayOnly().getValue());
	
	Date fromDate = todayOnly ? new Date().addDay(0) : new Date().addDay(-7);
	Date toDate = todayOnly ? new Date().addDay(0) : new Date().addDay(7);
	
	form.lyrAdmission().tabPlanned().dteFrom().setValue(fromDate);
	form.lyrAdmission().tabPlanned().dteTo().setValue(toDate);
	
	enableDateSearch(!todayOnly);
}
 
Example 55
Project: AvoinApotti   File: CarePlanDetailsImpl.java   Source Code and License 5 votes vote down vote up
public CarePlanEvaluationNoteCollection listEvaluationNotesforCarePlanAndByDateRange(CarePlanRefVo carePlanRefVo, Date dateFrom, Date dateTo, Boolean activeOnly)
{
	if (carePlanRefVo != null && carePlanRefVo.getID_CarePlan() == null || dateFrom == null || dateTo == null)
		throw new CodingRuntimeException("Mandatory arguments not supplied to listClinicalNotesForCarePlanAndDateRange method");
	
	String hql = "from ims.nursing.careplans.domain.objects.CarePlanEvaluationNote cpen where cpen.carePlan.id = :idCarePlan and (cpen.recordedDateTime >= :startDate and cpen.recordedDateTime < :endDate ) ";
	if(activeOnly == true)
		hql += "and cpen.active = true";
	
	List notes = getDomainFactory().find(hql, new String[]{"idCarePlan", "startDate", "endDate"},new Object[]{carePlanRefVo.getID_CarePlan(), dateFrom.getDate(), dateTo.copy().addDay(1).getDate()});
	return CarePlanEvaluationNoteAssembler.createCarePlanEvaluationNoteCollectionFromCarePlanEvaluationNote(notes);
}
 
Example 56
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private PatientElectiveListNotesVo populateElectiveListNotes()
{
	PatientElectiveListNotesVo notes = new PatientElectiveListNotesVo();
	notes.setAuthoringDateTime(new Date());
	
	Object mos = domain.getMosUser();
	if (mos !=null && mos instanceof MemberOfStaffLiteVo)
	{
		notes.setAuthoringUser((MemberOfStaffLiteVo) mos);
	}
	notes.setNotes(form.txtTCINotes().getValue());
	
	return notes;
}
 
Example 57
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
public Integer calculateWeekNumber(ims.framework.utils.Date startDate, ims.framework.utils.Date targetDate) 
{
	if(startDate == null)
		throw new ims.framework.exceptions.CodingRuntimeException("Invalid start date");
	if(targetDate == null)
		throw new ims.framework.exceptions.CodingRuntimeException("Invalid target date");
	
	long curr = targetDate.getDate().getTime();
	long start = startDate.getDate().getTime();			
	long noDays = (curr - start) / (1000*60*60*24);
				
	return ((int)noDays / 7) + 1;
}
 
Example 58
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private boolean validateMaritalDate()
{
	if(ConfigFlag.UI.SOCIAL_HIS_DISPLAY_MARR_DATE.getValue())
	{
	if(form.pdtMaritalStatus().getValue() != null)
	{
		if(form.pdtMaritalStatus().getValue().isGreaterThan(new Date()))
		{
			engine.showMessage("Date of marriage cannot be in the future");
			return true;
			
		}
	
	if(form.getGlobalContext().Core.getPatientShort().getDob()!= null)
	{
		if(form.pdtMaritalStatus().getValue().isLessThan(form.getGlobalContext().Core.getPatientShort().getDob()))
		{
			
			engine.showMessage("Date of marriage cannot be before DOB");
			return true;
			
		}
	}	
		
		
	}
	}
	return false;



}
 
Example 59
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private Date getDefaultEventDate() 
{
	if(ConfigFlag.UI.DEFAULT_DOCUMENT_TO_CONTEXT_DATE.getValue())
	{
		if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull())
			return form.getGlobalContext().Core.getCurrentClinicalContact().getStartDateTime().getDate();
		else if(form.getGlobalContext().Core.getCurrentCareContextIsNotNull())
			return form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime().getDate();
		else if(form.getGlobalContext().Core.getEpisodeofCareShortIsNotNull())
			return form.getGlobalContext().Core.getEpisodeofCareShort().getStartDate();
	}
	
	return new Date();
}
 
Example 60
Project: AvoinApotti   File: Logic.java   Source Code and License 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);
}