Package clips.delegate.doctor.certificate.tag.certTags

Source Code of clips.delegate.doctor.certificate.tag.certTags.CertTagPacientIsChild

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package clips.delegate.doctor.certificate.tag.certTags;

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.TypeSelectableRO;
import cli_fmw.delegate.report.ReportParam;
import cli_fmw.delegate.utils.TimeLocal;
import cli_fmw.main.ClipsException;
import framework.utils.DateTimeUtils;
import framework.utils.PairIntStr;
import java.util.Date;

/**
*
* @author vip
*/
@TagToClass(tagName="pacient_is_child", title="Ребенок/взрослый")
public class CertTagPacientIsChild extends TypeSelectableRO {

    public CertTagPacientIsChild() throws ClipsException {
    }

    public CertTagPacientIsChild(CertificateLocal certificateLocal, ReportParam reportParam, DiseaseLocal diseaseLocal) throws ClipsException {
        super(certificateLocal, reportParam, diseaseLocal);
        if (certificateLocal.isNewlyCreated()) {
            Date born = certificateLocal.getClientLocal().getBorn();
            if (born != null) {
                int age = DateTimeUtils.calcAge(born, TimeLocal.getCurrentTime().getTime());
                if (age < 18) {
                    setItem(1);
                } else {
                    setItem(2);
                }
            } else {
                setItem(0);
            }
        }
    }

    @Override
    public void fillItems() throws ClipsException {
        allItems.add(new PairIntStr(0,""));
        allItems.add(new PairIntStr(1,"ребенок"));
        allItems.add(new PairIntStr(2,"взрослый"));
    }

}
TOP

Related Classes of clips.delegate.doctor.certificate.tag.certTags.CertTagPacientIsChild

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.