Java Code Examples for ims.framework.utils.DateTime

The following are top voted examples for showing how to use ims.framework.utils.DateTime. 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   View source code 6 votes vote down vote up
private void populateAttendanceTimes() 
{
	if(form.getLocalContext().getSelectedWaitingPatient() == null)
		return;
	
	form.dtimIncidentTime().setValue(form.getLocalContext().getSelectedWaitingPatient().getEpisode() != null ? form.getLocalContext().getSelectedWaitingPatient().getEpisode().getInjuryDateTime() : null);
	form.dtimArrivalTime().setValue(form.getLocalContext().getSelectedWaitingPatient().getAttendance() != null ? form.getLocalContext().getSelectedWaitingPatient().getAttendance().getArrivalDateTime() : null);
	form.dtimRegistrationTime().setValue(form.getLocalContext().getSelectedWaitingPatient().getAttendance() != null ? form.getLocalContext().getSelectedWaitingPatient().getAttendance().getRegistrationDateTime() : null);
	form.dtimTriageStartTime().setValue(form.getLocalContext().getSelectedWaitingPatient().getTriageDetails() != null ? form.getLocalContext().getSelectedWaitingPatient().getTriageDetails().getTriageStartDateTime() : null);
	form.dtimTriageEndTime().setValue(form.getLocalContext().getSelectedWaitingPatient().getTriageDetails() != null ? form.getLocalContext().getSelectedWaitingPatient().getTriageDetails().getTriageCompletionTime() : null);
	
	form.txtLOS().setValue(EmergencyDisplayHelper.minutesToHoursAndMinutes(calculateDateDiffInMinutes(new DateTime(), form.dtimRegistrationTime().getValue())));//WDEV-15818
	
	form.dtimMedicStartTime().setValue(form.getLocalContext().getSelectedWaitingPatient().getTriageDetails() != null ? form.getLocalContext().getSelectedWaitingPatient().getTriageDetails().getMedicInterventionStartDateTime() : null);
	form.dtimDischargeBreachTime().setValue(calculateDischargeBreachTime(form.dtimRegistrationTime().getValue()));
}
 
Example 2
Project: AvoinApotti   File: DnaBatchUpdateImpl.java   View source code 6 votes vote down vote up
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo, CatsReferralVo catReferral)
{
	PatientDocumentVo vo = new PatientDocumentVo();
	vo.setPatient(catReferral.getPatient());
	vo.setEpisodeofCare(null);
	vo.setCareContext(null);
	vo.setClinicalContact(null);
	vo.setReferral(null);
			
	vo.setName("Letter to patient DNA");
	vo.setServerDocument(serverDocumentVo);
	vo.setCreationType(DocumentCreationType.GENERATED);
	vo.setCategory(DocumentCategory.LETTER_TO_PATIENT_DNA);
	
	vo.setRecordingUser(null);
	vo.setRecordingDateTime(new DateTime());
	vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);
	return vo;
}
 
Example 3
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private TrackingAttendanceStatusVo populateTrackingAttendanceStatus(TrackingStatus status)
{
	TrackingAttendanceStatusVo trackingAttStatus = new TrackingAttendanceStatusVo();

	trackingAttStatus.setPatient(form.getGlobalContext().Core.getPatientShort());
	trackingAttStatus.setEpisode(form.getGlobalContext().Core.getEpisodeofCareShort());
	trackingAttStatus.setAttendance(form.getGlobalContext().Core.getCurrentCareContext());
	trackingAttStatus.setTrackingArea(form.getLocalContext().getTrackingForReferral().getCurrentArea());

	trackingAttStatus.setStatusDatetime(new DateTime());

	Object mos = domain.getMosUser();
	if (mos instanceof MemberOfStaffLiteVo)
	{
		trackingAttStatus.setCreatedBy((MemberOfStaffLiteVo) mos);
	}

	trackingAttStatus.setStatus(status);
	trackingAttStatus.setPrevStatus((form.getLocalContext().getTrackingForReferral()!=null && form.getLocalContext().getTrackingForReferral().getCurrentStatus()!=null  ) ? form.getLocalContext().getTrackingForReferral().getCurrentStatus().getStatus() : null);
	
	return trackingAttStatus;
}
 
Example 4
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object ob1, Object ob2) 
{
	DateTime pdate1 = null;
	DateTime pdate2 = null;
	if(ob1 instanceof TransferHistoryVo )
	{
		TransferHistoryVo ps1 = (TransferHistoryVo)ob1;
		pdate1 = ps1.getAcceptTransferDateTime();
	}
	if(ob2 instanceof TransferHistoryVo)
	{
		TransferHistoryVo ps2 = (TransferHistoryVo)ob2;
		pdate2 = ps2.getAcceptTransferDateTime();
	}
	if(pdate1 != null )
		return  pdate1.compareTo(pdate2)*direction;
	if(pdate2 != null)
		return (-1)*direction;
	
	return 0;
}
 
Example 5
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object ob1, Object ob2) 
{
	DateTime date1 = null;
	DateTime date2 = null;
	if(ob1 instanceof CubicleAllocationShortVo)
	{
		CubicleAllocationShortVo ps1 = (CubicleAllocationShortVo)ob1;
		date1 = ps1.getAllocatedCubicleDateTime();
	}
	if(ob2 instanceof CubicleAllocationShortVo)
	{
		CubicleAllocationShortVo ps2 = (CubicleAllocationShortVo)ob2;
		date2 = ps2.getAllocatedCubicleDateTime();
	}
	if(date1 != null )
		return  date1.compareTo(date2)*direction;
	if(date2 != null)
		return (-1)*direction;
	
	return 0;
}
 
Example 6
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
@Override
protected void onBtnNewClick() throws PresentationLogicException
{
	clearScreen();
	form.customControlAuthoringInfo().initializeComponent();

	form.getLocalContext().setSelectedUrinalysis(null);
	form.chkNoSample().setValue(false);

	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.setMode(FormMode.EDIT);
}
 
Example 7
Project: AvoinApotti   File: NotificationsImpl.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
public OcsOrderWebServiceListVoCollection getPatientOrders(Integer patientId, Integer lastNumberOfDays) 
{
	if(patientId == null)
		throw new CodingRuntimeException("Invalid patient Id.");
	
	if(lastNumberOfDays == null || (lastNumberOfDays != null && lastNumberOfDays < 0))
		return null;
	
	DomainFactory factory = getDomainFactory();
	String query = "from OcsOrder ocsOrd where ocsOrd.patient.id = :patient and ocsOrd.systemInformation.creationDateTime >= :lastDate order by ocsOrd.systemInformation.creationDateTime desc";
	
	List listOrder = factory.find(query, new String[] {"patient", "lastDate"}, new Object[] {patientId, (new DateTime()).addDays(-lastNumberOfDays).getJavaDate()});
	
	return OcsOrderWebServiceListVoAssembler.createOcsOrderWebServiceListVoCollectionFromOcsOrderSession(listOrder);
}
 
Example 8
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
protected FallAssessment populateDataFromScreen()
{
	FallAssessment record = super.populateDataFromScreen();
	
	if(form.getLocalContext().getHcp() != null)
		record.setHcpInitiated(form.getLocalContext().getHcp());
	
	if (record.getClinicalContact() == null)
		record.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
	
	if (record.getCareContext() == null)
		record.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
	
	record.setDateTimeInitiated(new DateTime(form.dteDate().getValue(), form.timTime().getValue()));

	return record;
}
 
Example 9
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private ReferralNoteVo populateReferralNote(CatsReferralProviderCancellationVo voCatsReferral) 
{
	ReferralNoteVo voNote = new ReferralNoteVo();
	
	voNote.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
	
	Object voMos = domain.getMosUser();
	if (voMos instanceof MemberOfStaffLiteVo)
		voNote.setRecordingUser((MemberOfStaffLiteVo) voMos);
	
	voNote.setRecordingDateTime(new DateTime());
	voNote.setNoteType(ReferralNoteType.NON_CLINICAL);	
	
	if(voCatsReferral != null && voCatsReferral.getProviderCancellation() != null)
	{
		ProviderCancellationVo voProviderCancellation = voCatsReferral.getProviderCancellation();
		
		String note = "PROVIDER CANCELLATION \n Reason : " + 
		(voProviderCancellation.getReasonIsNotNull() ? voProviderCancellation.getReason().getText() : "")
			+ "\n Comment : " + (voProviderCancellation.getCommentsIsNotNull() ? voProviderCancellation.getComments() : "");
		
		voNote.setNote(note);
	}
	
	return voNote;
}
 
Example 10
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void populateAppointmentWithTrackingStatus(Booking_AppointmentShortVo voAppt, AppointmentTrackingStatus trackingStatus) 
{
	if(voAppt == null || trackingStatus == null)
		return;
	
	Appt_Tracking_Status_HistoryVoCollection trackingCollection = voAppt.getApptTrackingStatusHistory();
	
	if(trackingCollection == null)
		trackingCollection = new Appt_Tracking_Status_HistoryVoCollection();
	
	Appt_Tracking_Status_HistoryVo newTrackingStatus = new Appt_Tracking_Status_HistoryVo();
	newTrackingStatus.setTrackingStatus(trackingStatus);
	newTrackingStatus.setApptDate(voAppt.getAppointmentDate());
	newTrackingStatus.setApptTime(voAppt.getApptStartTime());
	newTrackingStatus.setStatusChangeDateTime(new DateTime());
	
	Object mosUser = domain.getMosUser();
	newTrackingStatus.setChangedBy(mosUser instanceof MemberOfStaffRefVo ? (MemberOfStaffRefVo) mosUser : null);
	
	trackingCollection.add(newTrackingStatus);
	voAppt.setApptTrackingStatusHistory(trackingCollection);
}
 
Example 11
Project: AvoinApotti   File: CDSGenerateImpl.java   View source code 6 votes vote down vote up
private void saveHistory(CDSHistoryVo histVo) throws StaleObjectException
{
	histVo.setJobEndTime(new DateTime());
	
	if(histVo.getErrorMessageIsNotNull() && histVo.getErrorMessage().length() > histVo.getErrorMessageMaxLength())
	{
		histVo.setErrorMessage(histVo.getErrorMessage().substring(0, histVo.getErrorMessageMaxLength() - 1));	
	}
	
	histVo.validate();
	
	DomainFactory domainFactory = getDomainFactory();
	
	CDSHistory hist = CDSHistoryVoAssembler.extractCDSHistory(domainFactory, histVo);
	
	domainFactory.save(hist);
}
 
Example 12
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private String[] validateUI()
{
	ArrayList<String> errorList = new ArrayList<String>();

	if (form.checkBoxComplete().getValue())
	{
		if (form.dteStopDate().getValue() == null || form.tmeStopTime().getValue() == null)
		{
			errorList.add("Stop date and time are mandatory");
		}
		
		if (form.dteStartDate().getValue() != null && form.tmeStartTime().getValue() != null
			&& form.dteStopDate().getValue() != null && form.tmeStopTime().getValue() != null)
		{
			if (new DateTime(form.dteStartDate().getValue(), form.tmeStartTime().getValue()).isGreaterThan(new DateTime(form.dteStopDate().getValue(), form.tmeStopTime().getValue())))
			{
				errorList.add("Stop date/time can not be set before start date/time.");
			}
		}
	}
	
	return errorList.toArray(new String[errorList.size()]);
}
 
Example 13
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
public int compare(HospitalAtNightNotesVo o1, HospitalAtNightNotesVo o2)
{
	DateTime o1DateTime = o1.getAuthoringInformation() != null ? o1.getAuthoringInformation().getAuthoringDateTime() : null;
	DateTime o2DateTime = o2.getAuthoringInformation() != null ? o2.getAuthoringInformation().getAuthoringDateTime() : null;
	
	if (o1DateTime != null && o2DateTime != null)
	{
		return order * o1DateTime.compareTo(o2DateTime);
	}
	
	if (o1DateTime == null)
		return -1 * order;
	
	if (o2DateTime == null)
		return order;
	
	return 0;
}
 
Example 14
Project: AvoinApotti   File: VoMapper.java   View source code 6 votes vote down vote up
public void fillPasEventFromEVN(EVN evn, PasEventVo pe, DateTime transactionDT) throws HL7Exception
{
	try
	{
		if (evn.getRecordedDateTime().getTimeOfAnEvent() != null && evn.getRecordedDateTime().getTimeOfAnEvent().getValue() != null)
		{
			pe.setEventDateTime(new DateTime(evn.getRecordedDateTime().getTimeOfAnEvent().getValue()));
			if(transactionDT != null)
				transactionDT.setDateTime(pe.getEventDateTime().getDate(), pe.getEventDateTime().getTime());
		}
	}
	catch (ParseException e)
	{
		throw new HL7Exception(e.getMessage(), e);
	}
}
 
Example 15
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private SeenByHCPVo populateAllocatedNurse()
{
	if( form.getLocalContext().getAllocatedNurseIsNotNull())
	{
		SeenByHCPVo tempVo = form.getLocalContext().getAllocatedNurse();
		tempVo.setPatient(form.getLocalContext().getSelectedTriagePatient().getPatient());
		tempVo.setAttendance(form.getLocalContext().getSelectedTriagePatient().getAttendance().getCareContext());
		tempVo.setEpisode(form.getLocalContext().getSelectedTriagePatient().getEpisode().getEpisodeOfCare());
		tempVo.setTrackingArea(form.getLocalContext().getSelectedTriagePatient().getCurrentArea());
		tempVo.setAllocatedDateTime(new DateTime());
		tempVo.setSeenDateTime(new DateTime());
		if(domain.getHcpUser() instanceof NurseVo)
		{
			NurseVo tempHcpVo = (NurseVo) domain.getHcpUser();
			tempVo.setAllocatedNurse(tempHcpVo);
		}
		
		return tempVo;
		
	}
	
	return null;
}
 
Example 16
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private FollowUpNoteVo populateDataFromScreen() 
{	
	FollowUpNoteVo editedFollowUpNote = form.getLocalContext().getEditedRecord();
	if (editedFollowUpNote == null) {
		editedFollowUpNote = new FollowUpNoteVo();
	}		
	
	editedFollowUpNote.setAuthoringInformation(form.ccAuthoring().getValue());
	editedFollowUpNote.setCatsReferral(form.getGlobalContext().RefMan.getCatsReferral());
	editedFollowUpNote.setFollowUpType(form.cmbType().getValue());
	editedFollowUpNote.setFollowUpNote(form.richTextNote().getValue());
	editedFollowUpNote.setIncludeInCatsReport(form.chkIncludeNoteInCATSReport().getValue());
	
	AuthoringInformationVo recording = new AuthoringInformationVo();
	recording.setAuthoringDateTime(new DateTime());
	HcpLiteVo hcp = new HcpLiteVo();
	hcp.setID_Hcp(engine.getLoggedInUser().getHcpId());
	hcp.setMos(domain.getMosUser() != null ? (MemberOfStaffLiteVo) domain.getMosUser() : null);
	recording.setAuthoringHcp(hcp);					
	editedFollowUpNote.setRecordingInformation(recording);		
	
	return editedFollowUpNote;
}
 
Example 17
Project: AvoinApotti   File: DischargeInpatientImpl.java   View source code 6 votes vote down vote up
public CareContextShortVo updateCareContextAndEpisodeOfCareWithEndDateTime(CareContextRefVo careContext, DateTime endDateTime) throws StaleObjectException
{
	if(careContext == null || careContext.getID_CareContext() == null)
		throw new CodingRuntimeException("careContext parameter cannot be null in method updateCareContextAndEpisodeOfCareWithEndDateTime");
	
	if(endDateTime == null)
		throw new CodingRuntimeException("endDateTime parameter cannot be null in method updateCareContextAndEpisodeOfCareWithEndDateTime");
	
	
	DomainFactory factory = getDomainFactory();
	
	CareContext doCareContext = (CareContext) factory.getDomainObject(careContext);
	
	if(endDateTime != null)
		doCareContext.setEndDateTime(endDateTime.getJavaDate());
	if(doCareContext.getEpisodeOfCare() != null && endDateTime != null)
		doCareContext.getEpisodeOfCare().setEndDate(endDateTime.getJavaDate());
		
	factory.save(doCareContext);
	return CareContextShortVoAssembler.create(doCareContext);
}
 
Example 18
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private AuthoringInformationVo getAuthoringInfo()
{
	AuthoringInformationVo auth = new AuthoringInformationVo();
	
	if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull())
	{
		auth.setAuthoringDateTime(form.getGlobalContext().Core.getCurrentClinicalContact().getStartDateTime() == null ? new DateTime() : form.getGlobalContext().Core.getCurrentClinicalContact().getStartDateTime());
		auth.setAuthoringHcp(form.getGlobalContext().Core.getCurrentClinicalContact().getSeenBy());			
	}
	else
	{
		auth.setAuthoringDateTime(new DateTime());
		auth.setAuthoringHcp((HcpLiteVo) domain.getHcpLiteUser());
	}
	
	return auth;
}
 
Example 19
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 20
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private VitalSignsForNursingNotesVo getVitalSigns(VitalSignsForNursingNotesVo vitalSigns)
{
	if (vitalSigns == null)
		vitalSigns = new  VitalSignsForNursingNotesVo();

	vitalSigns.setBloodPressure(getBloodPressure(vitalSigns.getBloodPressure()));
	vitalSigns.setPulse(getPulse(vitalSigns.getPulse()));
	vitalSigns.setTemperature(getTemperature(vitalSigns.getTemperature()));
	vitalSigns.setRespiratory(getRespiratory(vitalSigns.getRespiratory()));
	vitalSigns.setMetrics(getMetrics(vitalSigns.getMetrics()));
	vitalSigns.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
	vitalSigns.setVitalsTakenDateTime(new DateTime());

	if (vitalSigns.getBloodPressureIsNotNull() || vitalSigns.getPulseIsNotNull() || vitalSigns.getTemperatureIsNotNull() || vitalSigns.getMetricsIsNotNull())
		return vitalSigns;

	return null;
}
 
Example 21
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.ccAuthoringInfo().getValue()!=null && form.ccAuthoringInfo().getValue().getAuthoringDateTimeIsNotNull() && form.ccAuthoringInfo().getValue().getAuthoringDateTime().isGreaterThan(new DateTime()))
	{
		errors.add("Authoring Date/Time cannot be set in the future!");
	}

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

	return null;
}
 
Example 22
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void newInstanceFromNOK()
{
	form.ctnFamilySupport().customControlAuth().initializeComponent();			
	form.getLocalContext().setSelectedRecord(new SupportNetworkFamily());
	//wdev-16515
	Object mos = domain.getMosUser();
	if(mos != null){
		form.ctnFamilySupport().cmbRecordingHCP().newRow((MemberOfStaffLiteVo)mos, mos.toString());
		form.ctnFamilySupport().cmbRecordingHCP().setValue((MemberOfStaffLiteVo)mos);
	}
	form.ctnFamilySupport().dtimRecordingDateTime().setValue(new DateTime());
	//----------
	
	if (form.getLocalContext().getNextOfKinIsNotNull())
	{
		form.ctnFamilySupport().txtName().setValue(form.getLocalContext().getNextOfKin().getNameIsNotNull()?form.getLocalContext().getNextOfKin().getName().toString():null);
		form.ctnFamilySupport().txtAddress().setValue(form.getLocalContext().getNextOfKin().getAddressIsNotNull()?form.getLocalContext().getNextOfKin().getAddress().toDisplayStringForMultiLineTextBox():null);
		form.ctnFamilySupport().txtHomePhone().setValue(form.getLocalContext().getNextOfKin().getAddressIsNotNull()?form.getLocalContext().getNextOfKin().getAddress().getPhone():null);
		form.ctnFamilySupport().txtMobilrPhone().setValue(form.getLocalContext().getNextOfKin().getMobile() != null?form.getLocalContext().getNextOfKin().getMobile().getCommValue():null);
		form.ctnFamilySupport().txtWorkPhone().setValue(form.getLocalContext().getNextOfKin().getWorkPhoneNumber() != null?form.getLocalContext().getNextOfKin().getWorkPhoneNumber().getCommValue():null);
		form.ctnFamilySupport().txtEmailAddress().setValue(form.getLocalContext().getNextOfKin().getMobile() != null?form.getLocalContext().getNextOfKin().getMobile().getCommValue():null);
		
		form.setMode(FormMode.EDIT);
	}
}
 
Example 23
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private SupportNetworkFamily setRecordActive() 
{
	SupportNetworkFamily voFamily = form.getLocalContext().getSelectedFamilyRecord();
	
	voFamily.setInactivatingUser(null);	
	voFamily.setInactivatingDateTime(null);
	
	if(voFamily.getIsCurrentlyActiveFamilySupportIsNotNull() && voFamily.getIsCurrentlyActiveFamilySupport().equals(Boolean.TRUE)) //if its true,goes to false (inactivate)
	{
		voFamily.setIsCurrentlyActiveFamilySupport(Boolean.FALSE);	//if its false already,goes to true (reactivate)
		
		Object mos = domain.getMosUser();
		if(mos instanceof MemberOfStaffShortVo)
		{
			voFamily.setInactivatingUser((MemberOfStaffLiteVo) mos);
		}
		
		voFamily.setInactivatingDateTime(new DateTime());	
	}
	else if(voFamily.getIsCurrentlyActiveFamilySupportIsNotNull() && voFamily.getIsCurrentlyActiveFamilySupport().equals(Boolean.FALSE)) //if its true,goes to false (inactivate)
		voFamily.setIsCurrentlyActiveFamilySupport(Boolean.TRUE);
	else if(voFamily.getIsCurrentlyActiveFamilySupport() == null)
		voFamily.setIsCurrentlyActiveFamilySupport(Boolean.TRUE);
	
	return voFamily;
}
 
Example 24
Project: AvoinApotti   File: HL7EngineOutbound.java   View source code 6 votes vote down vote up
private String generateADT_A03Message(EDAttendanceFeedVo event) throws HL7Exception 
{
	a03mapper.processedCount++;
	try
	{
		Message msg =a03mapper.populateMessage(event);
		if (msg != null)
		{
			String ret = parser.encode(msg);
			a03mapper.successCount++;
			a03mapper.lastSuccessDateTime = new DateTime();
			a03mapper.lastSuccessMessage = ret;

			return ret;
		}
	}
	catch (Exception e)
	{
		a03mapper.errorCount++;
		a03mapper.lastFailedDateTime = new DateTime();
		throw new HL7Exception("Exception occurred generating A03 Message for HL7App - " + event.getProviderSystem().getHl7Application() + " - " + e.getMessage(), e);
	}
	a03mapper.errorCount++;
	a03mapper.lastFailedDateTime = new DateTime();
	throw new HL7Exception("A null message cannot be parsed!");
}
 
Example 25
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object ob1, Object ob2) 
{
	DateTime pdate1 = null;
	DateTime pdate2 = null;
	if(ob1 instanceof EpisodeOfCareHistVo )
	{
		EpisodeOfCareHistVo ps1 = (EpisodeOfCareHistVo)ob1;
		pdate1 = ps1 != null && ps1.getSysInformationIsNotNull() ? ps1.getSysInformation().getCreationDateTime():null;
	}
	if(ob2 instanceof EpisodeOfCareHistVo)
	{
		EpisodeOfCareHistVo ps2 = (EpisodeOfCareHistVo)ob2;
		pdate2 = ps2 != null && ps2.getSysInformationIsNotNull() ? ps2.getSysInformation().getCreationDateTime():null;
	}
	if(pdate1 != null )
		return  pdate1.compareTo(pdate2)*direction;
	if(pdate2 != null)
		return (-1)*direction;
	
	return 0;
}
 
Example 26
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void newInstance()
{
	clearInstanceControls();
	form.recbrReferralsForAttendance().clear();//WDEV-17340
	
	form.getLocalContext().setSelectedReferralToSpecialty(null);
	
	Object mos = domain.getHcpLiteUser();

	if (mos instanceof HcpLiteVo)
	{
		form.ccRefferedBy().setValue((HcpLiteVo) mos);
	}

	form.dtimReffered().setValue(new DateTime());

	form.setMode(FormMode.EDIT);
}
 
Example 27
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private DateTime calculateDischargeBreachTime(DateTime registrationDateTime) 
{
	if(registrationDateTime == null)
		return null;
	
	if(form.getLocalContext().getAttendanceKPIConfig() == null || form.getLocalContext().getAttendanceKPIConfig().getLosBreachedKPI() == null)
		return null;
	
	return ((DateTime) registrationDateTime.clone()).addMinutes(form.getLocalContext().getAttendanceKPIConfig().getLosBreachedKPI());
}
 
Example 28
Project: AvoinApotti   File: HL7EngineOutbound.java   View source code 5 votes vote down vote up
private String generateMDM_T02Message(IfPatientDocumentMessageVo event) throws HL7Exception 
{
	t02mapper.processedCount++;
	try
	{
		// IfOutOcsOrderVo orderVo= ocsIf.getOrder(order);
		Message msg = t02mapper.populateMDM_T02Message(event);
		if (msg != null)
		{
			String ret = parser.encode(msg);
			t02mapper.successCount++;
			t02mapper.lastSuccessDateTime = new DateTime();
			t02mapper.lastSuccessMessage = ret;

			return ret;
		}
	}
	catch (Exception e)
	{
		t02mapper.errorCount++;
		t02mapper.lastFailedDateTime = new DateTime();
		throw new HL7Exception("Exception occurred generating T02 Message for HL7App - " + event.getProviderSystem().getHl7Application() + " - " + e.getMessage(), e);
	}
	t02mapper.errorCount++;
	t02mapper.lastFailedDateTime = new DateTime();
	throw new HL7Exception("A null message cannot be parsed!");
}
 
Example 29
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void setDefaultValues()
{
	Hcp hcpUser = (Hcp)domain.getHcpUser();
	if(hcpUser != null)
	{
		form.qmbAuthoringCP().newRow(hcpUser, hcpUser.getName().toString());
		form.qmbAuthoringCP().setValue(hcpUser);
	}
	form.dtimAuthoring().setValue(new DateTime());		
}
 
Example 30
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private  SkinAssessment copySkinAssessment(SkinAssessment skinAssessment)
{
	if (skinAssessment == null)
		return null;
	skinAssessment.clearIDAndVersion();
	skinAssessment.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
	skinAssessment.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
	skinAssessment.setDateTimeInitiated(new DateTime());
	skinAssessment.setHcpInitiated(domain.getHcpLiteUser() instanceof HcpLiteVo ? (HcpLiteVo) domain.getHcpLiteUser() : null);
	skinAssessment.setSkinAssessmentFindings(copySkinAssessmentFindings(skinAssessment.getSkinAssessmentFindings()));
	return skinAssessment;

}
 
Example 31
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
@Override
protected void onFormOpen(Object[] args) throws PresentationLogicException
{
	form.ccRequestedBy().isRequired(true);
	form.getLocalContext().setcurrentTracking(domain.getTracking(form.getGlobalContext().Emergency.getTracking()));
	clearControls();
	
	if (form.getLocalContext().getcurrentTracking().getBedAvailabilityIsNotNull())
	{
		form.getLocalContext().setcurrentBedAvailability(form.getLocalContext().getcurrentTracking().getBedAvailability());
		populateScreenFromData(form.getLocalContext().getcurrentBedAvailability(), form.getLocalContext().getcurrentTracking());

	}
	else
	{
		Object mos = domain.getMosUser();

		if (mos == null)
		{
			engine.showMessage("Current User is not a Member of Staff!");
			return;
		}

		if (mos instanceof MemberOfStaffLiteVo)
		{
			form.ccRequestedBy().setValue((MemberOfStaffLiteVo) mos);
		}

		form.dtimAwaitingBed().setValue(new DateTime());
		form.dtimAvailableBed().setEnabled(false);

	}

	form.btnRemove().setVisible(form.getLocalContext().getcurrentTracking().getBedAvailabilityIsNotNull());
}
 
Example 32
Project: AvoinApotti   File: HL7MessageParser.java   View source code 5 votes vote down vote up
protected static void logMessage(String message, String msgType, String msgLocation)
  {
  	try
{
  		// File should be timestamped
  		DateTime tst = new DateTime(); 
  		
  		// WDEV-989 - messages are held in subfolders
   	String month = months[tst.getDate().getMonth()];
       String logFolder = msgLocation +  "/" + msgType + "/" +  tst.getDate().getYear() + "/" + month + "/" + tst.getDate().getDay();
       File fileFolder = new File(logFolder);
       if (!fileFolder.exists())
       	fileFolder.mkdirs();
  		
  		String fileName = logFolder + "/" + tst.toString(DateTimeFormat.MILLI) + ".msg";
  		
  		File f = new File(fileName);
  		// Should always be unique, so append _instance until not found
  		int inst=1;
  		while (f.exists())
  		{
  			if (fileName.indexOf(FILE_SEPARATOR) < 0)
  				fileName = fileName.substring(0, fileName.indexOf(".msg")) + FILE_SEPARATOR + inst + ".msg";
  			else
  				fileName = fileName.substring(0, fileName.indexOf(FILE_SEPARATOR)) + FILE_SEPARATOR + inst + ".msg";
  			inst++;

  			f = new File(fileName);
  		}
  		FileOutputStream fout  = new FileOutputStream(f);
  		fout.write(message.getBytes());
	fout.close();
}
catch (IOException e)
{
	LOG.error("IOException occurred storing log message - " + e.getMessage(), e);
}

  }
 
Example 33
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
@Override
protected void onFormOpen(Object[] args) throws PresentationLogicException 
{	
	form.cc1().initialize(MosType.ALL);//	WDEV-13691
	form.cc1().isRequired(true);//	WDEV-13691
	form.cc1().setValue(domain.getMosUser() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo) domain.getMosUser() : null);//	WDEV-13691
	form.dtim1().setValue(new DateTime());
}
 
Example 34
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void open()
	{
		populateScreenFromData(form.getLocalContext().getPendingEmergencyAdmission(), form.getLocalContext().getBedAvailabilityForTrackVo());

		// If no MoS was populated into control default in logged in MoS user, if any
		if (form.ccRequestedBy().getValue() == null)
		{
			Object mos = domain.getMosUser();

			if (mos instanceof MemberOfStaffLiteVo)
			{
				form.ccRequestedBy().setValue((MemberOfStaffLiteVo) mos);
			}
		}
		
		if (form.dtimDecisionToAdmitDate().getValue() == null)
		{
//			if (form.getLocalContext().getConclusionDateTime() != null)
//				form.dtimDecisionToAdmitDate().setValue(form.getLocalContext().getConclusionDateTime());
//			else
				form.dtimDecisionToAdmitDate().setValue(new DateTime());
		}
		
		form.setMode(FormMode.EDIT);
		updateControlsState();
		
	}
 
Example 35
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private TriageForClinicianWorklistVo createNewTriage(TrackingAreaRefVo currentArea) 
{
	TriageForClinicianWorklistVo triage = new TriageForClinicianWorklistVo();
	triage.setPatient(form.getGlobalContext().Core.getPatientShort());
	triage.setEpisode(form.getGlobalContext().Core.getEpisodeofCareShort());
	triage.setAttendance(form.getGlobalContext().Core.getCurrentCareContext());
	triage.setTriageStartDateTime(new DateTime());
	triage.setTrackingArea(currentArea);
	
	return triage;
}
 
Example 36
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
protected void onBtnConfirmClick() throws ims.framework.exceptions.PresentationLogicException
{
	form.setMode(FormMode.EDIT);
	form.getLocalContext().setbuttonAction(4);
	updateControlsState();
	form.ccConfirmedBy().setValue((IMos)domain.getMosUser());
	form.dtimConfirmed().setValue(new DateTime());
}
 
Example 37
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private DateTime getSelectedDisplayDateTime()
{
	if (form.grdResults().getValue() == null)
		return null;

	OrderInvestigationLiteVo voOrderInv = (OrderInvestigationLiteVo) form.grdResults().getValue().getOrderInvestigation();
	return voOrderInv.getDisplayDateTime();
}
 
Example 38
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private ServerDocumentVo populateServetDocumentVo(String fileName)
{
	DateTime date = new DateTime();
	int year = date.getDate().getYear();
	int month = date.getDate().getMonth();
	int day = date.getDate().getDay();

	ServerDocumentVo vo = new ServerDocumentVo();
	String filePath = year + "/" + month + "/" + day + "/" + fileName;
	vo.setFileName(filePath);
	vo.setFileType(FileType.PDF);
	return vo;
}
 
Example 39
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
protected FallAssessment populateDataFromScreen(FallAssessment value)
{
	FallAssessment record = super.populateDataFromScreen(value);

	//we keep the original HCP
	//if(form.getLocalContext().getHcp() != null)
		//record.setHcpInitiated(form.getLocalContext().getHcp());
	
	record.setDateTimeInitiated(new DateTime(form.dteDate().getValue(), form.timTime().getValue()));
	
	return record;
}
 
Example 40
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private ElectiveListStatusVo populateElectiveListStatus(WaitingListStatus status)
{
	ElectiveListStatusVo electiveListStatus = new ElectiveListStatusVo();
	
	electiveListStatus.setElectiveListStatus(status); 
	electiveListStatus.setStatusDateTime(new DateTime());
	
	Object mos = domain.getMosUser();
	if (mos !=null && mos instanceof MemberOfStaffLiteVo)
	{
		electiveListStatus.setAuthoringUser((MemberOfStaffLiteVo) mos);
	}
	return electiveListStatus;
}