/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package clips.delegate.doctor.certificate.tag.certTags;
import cli_fmw.delegate.utils.TimeLocal;
import clips.delegate.client.ClientLocal;
import clips.delegate.doctor.DiseaseLocal;
import clips.delegate.doctor.certificate.CertificateLocal;
import clips.delegate.doctor.certificate.tag.TagToClass;
import clips.delegate.doctor.certificate.tag.interfaces.TypeTextField;
import cli_fmw.delegate.report.ReportParam;
import cli_fmw.main.ClipsException;
import framework.utils.DateTimeUtils;
import java.util.Date;
/**
*
* @author vip
*/
@TagToClass(tagName="pacient_age",title="Возраст пациента")
public class CertTagPacientAge extends TypeTextField {
public CertTagPacientAge(CertificateLocal certificateLocal, ReportParam reportParam, DiseaseLocal diseaseLocal) throws ClipsException {
super(certificateLocal, reportParam, diseaseLocal);
ClientLocal clientLocal = certificateLocal.getClientLocal();
if (certificateLocal.isNewlyCreated()) {
Date born = clientLocal.getBorn();
Date current = TimeLocal.getCurrentTime().getTime();
int calcAge = DateTimeUtils.calcAge(born, current);
setText(Integer.toString(calcAge), true);
}
}
@Override
public boolean isEditable() {
return true;
}
}