Java Code Examples for ims.framework.utils.PartialDate

The following are top voted examples for showing how to use ims.framework.utils.PartialDate. 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
public int compare(Object ob1, Object ob2) 
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
	if(ob1 instanceof PatientShort )
	{
		PatientShort ps1 = (PatientShort)ob1;
		pdate1 = ps1.getDob();
	}
	if(ob2 instanceof PatientShort)
	{
		PatientShort ps2 = (PatientShort)ob2;
		pdate2 = ps2.getDob();
	}
	if(pdate1 != null )
		return  pdate1.compareTo(pdate2)*direction;
	if(pdate2 != null)
		return (-1)*direction;
	
	return 0;
}
 
Example 2
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object ob1, Object ob2) 
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
	if(ob1 instanceof PatientShort )
	{
		PatientShort ps1 = (PatientShort)ob1;
		pdate1 = ps1.getDob();
	}
	if(ob2 instanceof PatientShort)
	{
		PatientShort ps2 = (PatientShort)ob2;
		pdate2 = ps2.getDob();
	}
	if(pdate1 != null )
		return  pdate1.compareTo(pdate2)*direction;
	if(pdate2 != null)
		return (-1)*direction;
	
	return 0;
}
 
Example 3
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
public Integer calculateAge()
{
	if (form.getGlobalContext().Core.getPatientShort() != null)
	{
		PartialDate dob = form.getGlobalContext().Core.getPatientShort().getDob();
		Date dod = form.getGlobalContext().Core.getPatientShort().getDod();
		Date arrival = form.dtimArrival().getValue() != null ? form.dtimArrival().getValue().getDate() : null;
		int patAge = 0;
		if (dob != null)
		{

			if (dod != null)
			{
				patAge = dod.yearDiff(dob);
			}
			else
			{
				patAge = new ims.framework.utils.Age(dob, arrival).getYears();
			}

		}
		return new Integer(patAge);
	}
	return null;
}
 
Example 4
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private PatientDiagnosisApptDetailVo populatePatientDiagnoseFromScreen(DiagLiteVo diagnose, Boolean isMain, CatsReferralForClinicalNotesVo referral)
{
	if(diagnose == null)
		return null;
	
	PatientDiagnosisApptDetailVo patientDiagnose = new PatientDiagnosisApptDetailVo();
	patientDiagnose.setAppointment(form.getGlobalContext().RefMan.getAppointmentForPatientDiagnosisOrProcedures());
	
	patientDiagnose.setDiagnosis(diagnose);
	patientDiagnose.setDiagnosisDescription(diagnose.getDiagnosisName());
	patientDiagnose.setSourceofInformation(SourceofInformation.CLINICALCONTACT);
	patientDiagnose.setAuthoringInfo(form.ccAuthoringInfo().getValue());
	patientDiagnose.setEpisodeOfCare(referral.getCareContext().getEpisodeOfCare());
	patientDiagnose.setCareContext(referral.getCareContext());
	patientDiagnose.setDiagnosedDate(new PartialDate(new Date()));
	
	setCsPrimaryDiagnosis(patientDiagnose, isMain);
	
	return patientDiagnose;
}
 
Example 5
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private String getDate(PatientProcedureShortVo voPatientProcedureShort)
{
	PartialDate procDate = null;
	if (voPatientProcedureShort != null)
	{
		PatientProcedureStatus procedureStatus = voPatientProcedureShort.getProcedureStatus();
		if (procedureStatus != null)
		{
			if (procedureStatus.equals(PatientProcedureStatus.PLANNED))
			{
				procDate = voPatientProcedureShort.getDatePlanned();
			}
			else if (procedureStatus.equals(PatientProcedureStatus.PERFORMED))
			{
				procDate = voPatientProcedureShort.getProcDate();
			}
		}
	}

	return procDate != null ? procDate.toString() : "";
}
 
Example 6
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private String[] validateAlertUIRules() 
{
	List<String> errors = new ArrayList<String>();
	PartialDate dateIdentified = form.ctnAlert().pdtAlertDateIdentified().getValue();
	
	if(dateIdentified != null)
	{
		if(dateIdentified.isGreaterThan(new Date()))
		{
			errors.add("'Date Identified' can not be in the future");				
		}
		
		PartialDate pdob = form.getGlobalContext().Core.getPatientShort().getDob();			
		if(pdob != null)
		{
			PartialDate dateToCompare = new PartialDate(dateIdentified.getYear(), dateIdentified.getMonth() == null ? pdob.getMonth() : dateIdentified.getMonth(), dateIdentified.getDay() == null ? pdob.getDay() : dateIdentified.getDay());
			if (dateToCompare.isLessThan(pdob))
				errors.add("'Date Identified' cannot be previous to DOB");									
		}
	}				
	
	String[] searchErrors = new String[errors.size()];
	errors.toArray(searchErrors);
	return searchErrors;		
}
 
Example 7
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
protected void onBtnNewClick() throws ims.framework.exceptions.PresentationLogicException
{
	this.clearScreen();
	
	form.grdProcedure().setValue(null);
	
	form.customControlAuthoringInfo().initializeComponent();
	
	form.pdtProcedure().setValue(new PartialDate(new Date()));
	form.tmeProcedure().setValue(new Time());
	
	//form.btnUpdate().setEnabled(false);//wdev-15298
	
	//WDEV-11545 - Set local context to null when creating a new PatientProcedure
	form.getLocalContext().setpatientProcedure(null);
	form.setMode(FormMode.EDIT);
	form.setcustomControlAuthoringInfoEnabled(true);
}
 
Example 8
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private ims.framework.utils.Date getDateFromPartialDate(PartialDate pdate)
{
	ims.framework.utils.Date date = new ims.framework.utils.Date();
	Integer aux = pdate.getDay();
	if (aux == null)
	{
		aux = 1;
	}
	date.setDay(aux.intValue());
	aux = pdate.getMonth();
	if (aux == null)
	{
		aux = 1;
	}
	date.setMonth(aux.intValue());
	aux = pdate.getYear();
	if (aux == null)
	{
		aux = 2000;
	}
	date.setYear(aux.intValue());

	return date;
}
 
Example 9
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private String getDate(PatientProcedureShortVo voPatientProcedureShort)
{
	PartialDate procDate = null;
	if (voPatientProcedureShort != null)
	{
		PatientProcedureStatus procedureStatus = voPatientProcedureShort.getProcedureStatus();
		if (procedureStatus != null)
		{
			if (procedureStatus.equals(PatientProcedureStatus.PLANNED))
			{
				procDate = voPatientProcedureShort.getDatePlanned();
			}
			else if (procedureStatus.equals(PatientProcedureStatus.PERFORMED))
			{
				procDate = voPatientProcedureShort.getProcDate();
			}
		}
	}

	return procDate != null ? procDate.toString() : "";
}
 
Example 10
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private PatientProcedureLiteVo newPatientProcedure(ProcedureLiteVo procedure, String description, CareContextShortVo careContext, AuthoringInformationVo authoringInformation, SourceofInformation sourceOfInformation)
{
	if (description == null || careContext == null || sourceOfInformation == null)
		return null;

	PatientProcedureLiteVo patientProcedure = new PatientProcedureLiteVo();

	patientProcedure.setProcedure(procedure);
	patientProcedure.setProcedureDescription(description);

	patientProcedure.setCareContext(careContext);
	patientProcedure.setEpisodeOfCare(form.getGlobalContext().Core.getEpisodeofCareShort());
	
	patientProcedure.setAuthoringInformation(authoringInformation);
	patientProcedure.setInfoSource(sourceOfInformation);
	patientProcedure.setProcedureStatus(PatientProcedureStatus.PLANNED);
	patientProcedure.setProcDate(form.lyr1().tabCareRecord().dteDate().getValue() != null ? new PartialDate(form.lyr1().tabCareRecord().dteDate().getValue()) : null);// wdev-8393

	return patientProcedure;
}
 
Example 11
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object ob1, Object ob2) 
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
	if (ob1 instanceof DementialManualClassAssemblyVo)
	{
		DementialManualClassAssemblyVo dem1=(DementialManualClassAssemblyVo)ob1;
		pdate1 = dem1.getPatientDOBIsNotNull()?dem1.getPatientDOB():null;
	}
	if (ob2 instanceof DementialManualClassAssemblyVo)
	{
		DementialManualClassAssemblyVo dem2=(DementialManualClassAssemblyVo)ob2;
		pdate2 = dem2.getPatientDOBIsNotNull()?dem2.getPatientDOB():null;
	}
	if(pdate1 != null )
		return  pdate1.compareTo(pdate2)*direction;
	if(pdate2 != null)
		return (-1)*direction;
	
	return 0;
}
 
Example 12
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private PatientProcedureLiteVo newPatientProcedure(ProcedureLiteVo procedure, String description, CareContextShortVo careContext, AuthoringInformationVo authoringInformation, SourceofInformation sourceOfInformation)
{
	if (description == null || careContext == null || sourceOfInformation == null)
		return null;

	PatientProcedureLiteVo patientProcedure = new PatientProcedureLiteVo();

	patientProcedure.setProcedure(procedure);
	patientProcedure.setProcedureDescription(description);
	patientProcedure.setEpisodeOfCare(form.getGlobalContext().Core.getEpisodeofCareShort());
	patientProcedure.setCareContext(careContext);
	patientProcedure.setAuthoringInformation(authoringInformation);
	patientProcedure.setInfoSource(sourceOfInformation);
	patientProcedure.setProcedureStatus(PatientProcedureStatus.PLANNED);
	patientProcedure.setProcDate(form.lyrMain().tabCareRecord().dteDate().getValue() != null ? new PartialDate(form.lyrMain().tabCareRecord().dteDate().getValue()) : null);// wdev-8393

	return patientProcedure;
}
 
Example 13
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void initialize()
{
	AuthoringInformationVo voAuthoringInformation=new AuthoringInformationVo();
	voAuthoringInformation.setAuthoringDateTime(new DateTime());
	if (domain.getHcpLiteUser()!=null)
		voAuthoringInformation.setAuthoringHcp((HcpLiteVo) domain.getHcpLiteUser());
	form.cc2().setValue(voAuthoringInformation);
	form.pdt1().setValue(new PartialDate(new Date()));
	
	form.grpFilter().setValue(grpFilterEnumeration.rdoSpecialty);
	
	if (domain.getHcpLiteUser() == null)
	{			
		form.pdt1().setEnabled(false);
		form.setcc1Enabled(false);
		form.setcc2Enabled(false);
	}
}
 
Example 14
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object ob1, Object ob2) 
{
	PartialDate dob1 = null;
	PartialDate dob2 = null;
	if(ob1 instanceof CaseNoteForWorklistVo )
	{
		CaseNoteForWorklistVo cn1 = (CaseNoteForWorklistVo)ob1;
		dob1 = cn1.getPatient() != null ? cn1.getPatient().getDob() : null;
	}
	if(ob2 instanceof CaseNoteForWorklistVo)
	{
		CaseNoteForWorklistVo cn2 = (CaseNoteForWorklistVo)ob2;
		dob2 = cn2.getPatient() != null ? cn2.getPatient().getDob() : null;
	}
	
	if(dob1 != null )
		return  dob1.compareTo(dob2)*direction;
	if(dob2 != null)
		return (-1)*direction;
	
	return 0;
}
 
Example 15
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object o1, Object o2)
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
			
	if (o1 instanceof PatientElectiveListForPendingAdmissionVo && o2 instanceof PatientElectiveListForPendingAdmissionVo)
	{
		PatientElectiveListForPendingAdmissionVo ps1 = (PatientElectiveListForPendingAdmissionVo)o1;
		pdate1 = ps1.getPatient() != null && ps1.getPatient().getDobIsNotNull()? ps1.getPatient().getDob() : null;
		PatientElectiveListForPendingAdmissionVo ps2 = (PatientElectiveListForPendingAdmissionVo)o2;
		pdate2 = ps2.getPatient() != null && ps2.getPatient().getDobIsNotNull()  ? ps2.getPatient().getDob() : null;
	}
	
	
	
	if (pdate1 != null && pdate2 != null)
		return  pdate1.compareTo(pdate2)*direction;
	if (pdate1 != null)
		return direction;
	if (pdate2 != null)
		return -1*direction;
	
	return 0;
}
 
Example 16
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object o1, Object o2)
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
			
	if (o1 instanceof STHKPendingElectiveAdmissionListVo && o2 instanceof STHKPendingElectiveAdmissionListVo)
	{
		STHKPendingElectiveAdmissionListVo ps1 = (STHKPendingElectiveAdmissionListVo)o1;
		pdate1 = ps1.getPasEventIsNotNull()  && ps1.getPasEvent().getPatientIsNotNull() ? ps1.getPasEvent().getPatient().getDob() : null;
		STHKPendingElectiveAdmissionListVo ps2 = (STHKPendingElectiveAdmissionListVo)o2;
		pdate2 = ps2.getPasEventIsNotNull() && ps2.getPasEvent().getPatientIsNotNull()  ? ps2.getPasEvent().getPatient().getDob() : null;
	}
	
	
	
	if (pdate1 != null && pdate2 != null)
		return  pdate1.compareTo(pdate2)*direction;
	if (pdate1 != null)
		return direction;
	if (pdate2 != null)
		return -1*direction;
	
	return 0;
}
 
Example 17
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object ob1, Object ob2) 
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
	if(ob1 instanceof PatientShort )
	{
		PatientShort ps1 = (PatientShort)ob1;
		pdate1 = ps1.getDob();
	}
	if(ob2 instanceof PatientShort)
	{
		PatientShort ps2 = (PatientShort)ob2;
		pdate2 = ps2.getDob();
	}
	if(pdate1 != null )
		return  pdate1.compareTo(pdate2)*direction;
	if(pdate2 != null)
		return (-1)*direction;
	
	return 0;
}
 
Example 18
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object o1, Object o2)
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
			
	if (o1 instanceof InpatientEpisodeForPendingDischargesVo && o2 instanceof InpatientEpisodeForPendingDischargesVo)
	{
		InpatientEpisodeForPendingDischargesVo ps1 = (InpatientEpisodeForPendingDischargesVo)o1;
		pdate1 = ps1.getPasEventIsNotNull()  && ps1.getPasEvent().getPatientIsNotNull() ? ps1.getPasEvent().getPatient().getDob() : null;
		InpatientEpisodeForPendingDischargesVo ps2 = (InpatientEpisodeForPendingDischargesVo)o2;
		pdate2 = ps2.getPasEventIsNotNull() && ps2.getPasEvent().getPatientIsNotNull()  ? ps2.getPasEvent().getPatient().getDob() : null;
	}
	
	
	
	if (pdate1 != null && pdate2 != null)
		return  pdate1.compareTo(pdate2)*direction;
	if (pdate1 != null)
		return direction;
	if (pdate2 != null)
		return -1*direction;
	
	return 0;
}
 
Example 19
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private Date getDateToExtended(Integer rangeValue, TimeUnitsSecondsToYears rangeType, PartialDate date)
{
	Date dateFrom=getDateTo(date);
	
	if (rangeValue==null || rangeType==null || dateFrom==null)
		return dateFrom;
	
	Date newDate=null;
	
	if (TimeUnitsSecondsToYears.DAYS.equals(rangeType))
	{
		newDate=dateFrom.addDay(rangeValue);
	}
	else if (TimeUnitsSecondsToYears.MONTHS.equals(rangeType))
	{
		newDate=dateFrom.addMonth(rangeValue);
	}
	else if (TimeUnitsSecondsToYears.YEARS.equals(rangeType))
	{
		newDate=dateFrom.addYear(rangeValue);
	}
	
	return newDate;
}
 
Example 20
Project: openmaxims-linux   File: Logic.java   View source code 6 votes vote down vote up
private int calculateAgeAtCareContextDate(PartialDate dob, Date dateCareContext) 
{
	int age = 0;
	if(dateCareContext!=null && dob!=null){
		
		Date dateOfbirth = null; 
		dateOfbirth = dob.toDate();
		//WDEV-11421 complete partial date
		if(dateOfbirth==null)
			dateOfbirth = new Date(dob.getYear(),01,01);
		
		age = dateCareContext.yearDiff(dateOfbirth);
	}
	
	return age;
}
 
Example 21
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
@Override
protected void onChkExtendedDoBValueChanged() throws PresentationLogicException 
{
	//defaultDoB(form.lyrSearch().tabLocalSearch().pdtLocalSearchDOB().getValue());
	//WDEV-21622
	if (!form.lyrSearch().tabLocalSearch().chkLocalSearchExtendedDoB().getValue())
	{
		return;
	}
	PartialDate dobValue = form.lyrSearch().tabLocalSearch().pdtLocalSearchDOB().getValue();
	
	if (TimeUnitsSecondsToYears.MONTHS.equals(form.getLocalContext().getPDSConfiguration().getDOB_DATE_RANGE_TYPE()) && (dobValue==null || (dobValue!=null  && dobValue.getMonth()==null)))
	{
		form.lyrSearch().tabLocalSearch().chkLocalSearchExtendedDoB().setValue(null);
		engine.showMessage("Please enter a month and a year for Date Of Birth for extended search .", "Error", MessageButtons.OK, MessageIcon.ERROR);
	}
	else if (TimeUnitsSecondsToYears.YEARS.equals(form.getLocalContext().getPDSConfiguration().getDOB_DATE_RANGE_TYPE()) && (dobValue==null || (dobValue!=null  && dobValue.getYear()==null)))
	{
		form.lyrSearch().tabLocalSearch().chkLocalSearchExtendedDoB().setValue(null);
		engine.showMessage("Please enter a year for Date Of Birth for extended search. ", "Error", MessageButtons.OK, MessageIcon.ERROR);
	}
}
 
Example 22
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private PatientProcedureLiteVo newPatientProcedure(ProcedureLiteVo procedure, String description, CareContextShortVo careContext, AuthoringInformationVo authoringInformation, SourceofInformation sourceOfInformation)
{
	if (description == null || careContext == null || sourceOfInformation == null)
		return null;

	PatientProcedureLiteVo patientProcedure = new PatientProcedureLiteVo();

	patientProcedure.setProcedure(procedure);
	patientProcedure.setProcedureDescription(description);

	patientProcedure.setCareContext(careContext);
	patientProcedure.setEpisodeOfCare(form.getGlobalContext().Core.getEpisodeofCareShort());
	
	patientProcedure.setAuthoringInformation(authoringInformation);
	patientProcedure.setInfoSource(sourceOfInformation);
	patientProcedure.setProcedureStatus(PatientProcedureStatus.PLANNED);
	patientProcedure.setProcDate(form.lyr1().tabCareRecord().dteDate().getValue() != null ? new PartialDate(form.lyr1().tabCareRecord().dteDate().getValue()) : null);// wdev-8393

	return patientProcedure;
}
 
Example 23
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object ob1, Object ob2) 
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
	if(ob1 instanceof PatientShort )
	{
		PatientShort ps1 = (PatientShort)ob1;
		pdate1 = ps1.getDob();
	}
	if(ob2 instanceof PatientShort)
	{
		PatientShort ps2 = (PatientShort)ob2;
		pdate2 = ps2.getDob();
	}
	if(pdate1 != null )
		return  pdate1.compareTo(pdate2)*direction;
	if(pdate2 != null)
		return (-1)*direction;

	return 0;
}
 
Example 24
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object o1, Object o2)
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
			
	if (o1 instanceof PendingEmergencyAdmissionLiteVo && o2 instanceof PendingEmergencyAdmissionLiteVo)
	{
		PendingEmergencyAdmissionLiteVo ps1 = (PendingEmergencyAdmissionLiteVo)o1;
		pdate1 = ps1.getPasEventIsNotNull()  && ps1.getPasEvent().getPatientIsNotNull() ? ps1.getPasEvent().getPatient().getDob() : null;
		PendingEmergencyAdmissionLiteVo ps2 = (PendingEmergencyAdmissionLiteVo)o2;
		pdate2 = ps2.getPasEventIsNotNull() && ps2.getPasEvent().getPatientIsNotNull()  ? ps2.getPasEvent().getPatient().getDob() : null;
	}
	
	
	
	if (pdate1 != null && pdate2 != null)
		return  pdate1.compareTo(pdate2)*direction;
	if (pdate1 != null)
		return direction;
	if (pdate2 != null)
		return -1*direction;
	
	return 0;
}
 
Example 25
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object ob1, Object ob2) 
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
	if(ob1 instanceof PatientShort )
	{
		PatientShort ps1 = (PatientShort)ob1;
		pdate1 = ps1.getDob();
	}
	if(ob2 instanceof PatientShort)
	{
		PatientShort ps2 = (PatientShort)ob2;
		pdate2 = ps2.getDob();
	}
	if(pdate1 != null )
		return  pdate1.compareTo(pdate2)*direction;
	if(pdate2 != null)
		return (-1)*direction;
	
	return 0;
}
 
Example 26
Project: openmaxims-linux   File: Logic.java   View source code 6 votes vote down vote up
private String[] validateAlertUIRules() 
{
	List<String> errors = new ArrayList<String>();
	PartialDate dateIdentified = form.ctnAlert().pdtAlertDateIdentified().getValue();
	
	if(dateIdentified != null)
	{
		if(dateIdentified.isGreaterThan(new Date()))
		{
			errors.add("'Date Identified' can not be in the future");				
		}
		
		PartialDate pdob = form.getGlobalContext().Core.getPatientShort().getDob();			
		if(pdob != null)
		{
			PartialDate dateToCompare = new PartialDate(dateIdentified.getYear(), dateIdentified.getMonth() == null ? pdob.getMonth() : dateIdentified.getMonth(), dateIdentified.getDay() == null ? pdob.getDay() : dateIdentified.getDay());
			if (dateToCompare.isLessThan(pdob))
				errors.add("'Date Identified' cannot be previous to DOB");									
		}
	}				
	
	String[] searchErrors = new String[errors.size()];
	errors.toArray(searchErrors);
	return searchErrors;		
}
 
Example 27
Project: openMAXIMS   File: PdsQuery.java   View source code 6 votes vote down vote up
public void populateBirthTime(PatientShort pat, TS bt)
{
   	if(bt != null)
   	{
   		try
   		{
   			pat.setDob(new PartialDate(bt.getValue()));
   		}
   		catch(Exception e)
   		{
               addIssueMessage("xml response has an incorrect value for Person.BirthTime field !", e);
   		}
   	}
   	else
   	{
   		addIssueMessage("xml response is missing Person.BirthTime field !");
   	}
}
 
Example 28
Project: openMAXIMS   File: DemographicsImpl.java   View source code 6 votes vote down vote up
private Integer calculateAgeAtAttendance(Patient voPatient, java.util.Date arrivalDate)
{
	PartialDate dob = voPatient.getDob();
	Date dod = voPatient.getDod();
	int patAge = 0;
	
	if (dob != null)
	{
		if (dod != null)
		{
			patAge = dod.yearDiff(dob);
		}
		else
		{
			patAge = arrivalDate != null ?  new ims.framework.utils.Age(dob, new Date(arrivalDate)).getYears() :  new ims.framework.utils.Age(dob, new Date()).getYears();
		}
		return new Integer(patAge);
	}			
	return null;	
}
 
Example 29
Project: openMAXIMS   File: PDSPatientSearchImpl.java   View source code 6 votes vote down vote up
private Date getDateToExtended(Integer rangeValue, TimeUnitsSecondsToYears rangeType, PartialDate date)
{
	Date dateFrom=getDateTo(date);
	
	if (rangeValue==null || rangeType==null || dateFrom==null)
		return dateFrom;
	
	Date newDate=null;
	
	if (TimeUnitsSecondsToYears.DAYS.equals(rangeType))
	{
		newDate=dateFrom.addDay(rangeValue);
	}
	else if (TimeUnitsSecondsToYears.MONTHS.equals(rangeType))
	{
		newDate=dateFrom.addMonth(rangeValue);
	}
	else if (TimeUnitsSecondsToYears.YEARS.equals(rangeType))
	{
		newDate=dateFrom.addYear(rangeValue);
	}
	
	return newDate;
}
 
Example 30
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private String[] validateAlertUIRules() 
{
	List<String> errors = new ArrayList<String>();
	PartialDate dateIdentified = form.ctnAlert().pdtAlertDateIdentified().getValue();
	
	if(dateIdentified != null)
	{
		if(dateIdentified.isGreaterThan(new Date()))
		{
			errors.add("'Date Identified' can not be in the future");				
		}
		
		PartialDate pdob = form.getGlobalContext().Core.getPatientShort().getDob();			
		if(pdob != null)
		{
			PartialDate dateToCompare = new PartialDate(dateIdentified.getYear(), dateIdentified.getMonth() == null ? pdob.getMonth() : dateIdentified.getMonth(), dateIdentified.getDay() == null ? pdob.getDay() : dateIdentified.getDay());
			if (dateToCompare.isLessThan(pdob))
				errors.add("'Date Identified' cannot be previous to DOB");									
		}
	}				
	
	String[] searchErrors = new String[errors.size()];
	errors.toArray(searchErrors);
	return searchErrors;		
}
 
Example 31
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private Integer calculateAge() //WDEV-23085 
{
	if (form.getLocalContext().getpatientToSaveIsNotNull())
	{
		PartialDate dob = form.pdtDOB().getValue();
		Date dod = form.getGlobalContext().Emergency.getSelectedPatient() != null ? form.getGlobalContext().Emergency.getSelectedPatient().getDod() : null;
		Date arrival = form.dtimArrival().getValue() != null ? form.dtimArrival().getValue().getDate() : null;
		int patAge = 0;
		if (dob != null)
		{
			if (dod != null)
			{
				patAge = dod.yearDiff(dob);
			}
			else
			{
				patAge = new ims.framework.utils.Age(dob, arrival).getYears();
			}
			return new Integer(patAge);
		}			
	}
	return null;
}
 
Example 32
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object ob1, Object ob2) 
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
	if (ob1 instanceof DementialManualClassAssemblyVo)
	{
		DementialManualClassAssemblyVo dem1=(DementialManualClassAssemblyVo)ob1;
		pdate1 = dem1.getPatientDOBIsNotNull()?dem1.getPatientDOB():null;
	}
	if (ob2 instanceof DementialManualClassAssemblyVo)
	{
		DementialManualClassAssemblyVo dem2=(DementialManualClassAssemblyVo)ob2;
		pdate2 = dem2.getPatientDOBIsNotNull()?dem2.getPatientDOB():null;
	}
	if(pdate1 != null )
		return  pdate1.compareTo(pdate2)*direction;
	if(pdate2 != null)
		return (-1)*direction;
	
	return 0;
}
 
Example 33
Project: openMAXIMS   File: VoMapper.java   View source code 6 votes vote down vote up
/**
 * populateDateVoFromTS
 * <p>
 * Populates a Date class with values from TS YYYY[MM[DD[HHMM[SS[.S[S[S[S]]]]]]]][+/-
 * 
 * @param ts
 * @return ims.framework.utils.Date or null if partial date
 *         </p>
 * @throws Exception
 */
protected final DateTime populateDateTimeVoFromTS(TS ts) throws Exception
{
	LOG.debug("VoMapper populateDateTimeVoFromTS: entry");

	if (ts == null || ts.getTimeOfAnEvent().getValue() == null)
		return null;

	DateTime dt;
	String st = ts.getTimeOfAnEvent().getValue();
	if (st.length() < 12)
	{
		// Time is not included, so we will have to create a date and then instantiate a datetime
		// from that
		PartialDate pdt = new PartialDate(st);
		dt = new DateTime(pdt.toDate(), null);
	}
	else
		dt = new DateTime(st);
	if (dt != null)
		LOG.debug("VoMapper populateDateTimeVoFromTS: exit (" + dt.toString() + ")");
	return dt;
}
 
Example 34
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private PatientDiagnosisApptDetailVo populatePatientDiagnoseFromScreen(DiagLiteVo diagnose, Boolean isMain, CatsReferralForClinicalNotesVo referral)
{
	if(diagnose == null)
		return null;
	
	PatientDiagnosisApptDetailVo patientDiagnose = new PatientDiagnosisApptDetailVo();
	patientDiagnose.setAppointment(form.getGlobalContext().RefMan.getAppointmentForPatientDiagnosisOrProcedures());
	
	patientDiagnose.setDiagnosis(diagnose);
	patientDiagnose.setDiagnosisDescription(diagnose.getDiagnosisName());
	patientDiagnose.setSourceofInformation(SourceofInformation.CLINICALCONTACT);
	patientDiagnose.setAuthoringInfo(form.ccAuthoringInfo().getValue());
	patientDiagnose.setEpisodeOfCare(referral.getCareContext().getEpisodeOfCare());
	patientDiagnose.setCareContext(referral.getCareContext());
	patientDiagnose.setDiagnosedDate(new PartialDate(new Date()));
	
	setCsPrimaryDiagnosis(patientDiagnose, isMain);
	
	return patientDiagnose;
}
 
Example 35
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private String getDate(PatientProcedureShortVo voPatientProcedureShort)
{
	PartialDate procDate = null;
	if (voPatientProcedureShort != null)
	{
		PatientProcedureStatus procedureStatus = voPatientProcedureShort.getProcedureStatus();
		if (procedureStatus != null)
		{
			if (procedureStatus.equals(PatientProcedureStatus.PLANNED))
			{
				procDate = voPatientProcedureShort.getDatePlanned();
			}
			else if (procedureStatus.equals(PatientProcedureStatus.PERFORMED))
			{
				procDate = voPatientProcedureShort.getProcDate();
			}
		}
	}

	return procDate != null ? procDate.toString() : "";
}
 
Example 36
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private int calculateAgeAtCareContextDate(PartialDate dob, Date dateCareContext) 
{
	int age = 0;
	if(dateCareContext!=null && dob!=null){
		
		Date dateOfbirth = null; 
		dateOfbirth = dob.toDate();
		//WDEV-11421 complete partial date
		if(dateOfbirth==null)
			dateOfbirth = new Date(dob.getYear(),01,01);
		
		age = dateCareContext.yearDiff(dateOfbirth);
	}
	
	return age;
}
 
Example 37
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object ob1, Object ob2) 
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
	if (ob1 instanceof PatientProcedureVo)
	{
		PatientProcedureVo proc1 = (PatientProcedureVo) ob1;
		pdate1 = proc1.getProcDateIsNotNull() ? proc1.getProcDate():null;
	}
	if (ob2 instanceof PatientProcedureVo)
	{
		PatientProcedureVo proc2 = (PatientProcedureVo) ob2;
		pdate2 = proc2.getProcDateIsNotNull() ? proc2.getProcDate():null;
	}
	if (pdate1 != null)
		return  pdate1.compareTo(pdate2)*direction;
	if (pdate2 != null)
		return (-1)*direction;

	return 0;
}
 
Example 38
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private ims.framework.utils.Date getDateFromPartialDate(PartialDate pdate)
{
	ims.framework.utils.Date date = new ims.framework.utils.Date();
	Integer aux = pdate.getDay();
	if (aux == null)
	{
		aux = 1;
	}
	date.setDay(aux.intValue());
	aux = pdate.getMonth();
	if (aux == null)
	{
		aux = 1;
	}
	date.setMonth(aux.intValue());
	aux = pdate.getYear();
	if (aux == null)
	{
		aux = 2000;
	}
	date.setYear(aux.intValue());

	return date;
}
 
Example 39
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private String getDate(PatientProcedureShortVo voPatientProcedureShort)
{
	PartialDate procDate = null;
	if (voPatientProcedureShort != null)
	{
		PatientProcedureStatus procedureStatus = voPatientProcedureShort.getProcedureStatus();
		if (procedureStatus != null)
		{
			if (procedureStatus.equals(PatientProcedureStatus.PLANNED))
			{
				procDate = voPatientProcedureShort.getDatePlanned();
			}
			else if (procedureStatus.equals(PatientProcedureStatus.PERFORMED))
			{
				procDate = voPatientProcedureShort.getProcDate();
			}
		}
	}

	return procDate != null ? procDate.toString() : "";
}
 
Example 40
Project: openmaxims-linux   File: Logic.java   View source code 6 votes vote down vote up
public int compare(Object ob1, Object ob2) 
{
	PartialDate pdate1 = null;
	PartialDate pdate2 = null;
	if(ob1 instanceof PatientShort )
	{
		PatientShort ps1 = (PatientShort)ob1;
		pdate1 = ps1.getDob();
	}
	if(ob2 instanceof PatientShort)
	{
		PatientShort ps2 = (PatientShort)ob2;
		pdate2 = ps2.getDob();
	}
	if(pdate1 != null )
		return  pdate1.compareTo(pdate2)*direction;
	if(pdate2 != null)
		return (-1)*direction;
	
	return 0;
}