import ims.framework.utils.Time; //导入方法依赖的package包/类
private String[] validateUIRules()
{
List uiErrors = new ArrayList();
if( form.dtimDischargeDateTime().getValue() == null )
{
uiErrors.add("Discharge Date/Time is mandatory !");//WDEV-16843
}
else
{
if( form.dtimDischargeDateTime().getValue().isGreaterThan(new DateTime()))
{
uiErrors.add("Discharge Date/Time cannot be set it in the future");
}
else if(form.getLocalContext().getAdmissionDetailIsNotNull() && form.getLocalContext().getAdmissionDetail().getTransferHistoryIsNotNull() && form.getLocalContext().getAdmissionDetail().getTransferHistory().size() > 0 ) //wdev-16770
{
DateTime dtimD = getTheLastWardTransferDateTime(form.getLocalContext().getAdmissionDetail());
if( dtimD != null)
{
Date dtD = dtimD.getDate();
Time tD = dtimD.getTime();
Date dtD1 = form.dtimDischargeDateTime().getValue().getDate();
Time tD1 = form.dtimDischargeDateTime().getValue().getTime();
if( dtD1.isLessThan(dtD))
uiErrors.add("Discharge Date/Time must be later than or equal to the last Ward transfer Date/Time");
else if(dtD1.equals(dtD))
{
if( tD1.isLessThan(tD))
uiErrors.add("Discharge Date/Time must be later than or equal to the last Ward transfer Date/Time");
}
}
}
else if(form.getLocalContext().getAdmissionDetailIsNotNull() && form.dtimDischargeDateTime().getValue().isLessThan(form.getLocalContext().getAdmissionDetail().getAdmissionDateTime()))
{
uiErrors.add("Discharge Date/Time must be later than or equal to the Admission Date/Time");
}
}
if( form.cmbDischargeReason().getValue() == null)
{
uiErrors.add("Discharge Reason is mandatory.");
}
String[] result = new String[uiErrors.size()];
uiErrors.toArray(result);
return result;
}