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

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

/*
* 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 cli_fmw.delegate.report.ReportParam;
import cli_fmw.main.ClipsException;
import clips.delegate.client.ClientLocal;
import clips.delegate.doctor.certificate.tag.interfaces.TypeSelectableEdit;
import framework.utils.PairIntStr;
import java.util.HashSet;

/**
*
* @author vip
*/
@TagToClass(tagName="pacient_social_group", title="Социальная группа")
public class CertTagSocialGroup extends TypeSelectableEdit {
    public static final int WORKER = 1;
    public static final int OFFICE_WORKER = 2;
    public static final int JOBLESS = 3;
    public static final int PUPIL = 4;
    public static final int PENSIONER = 5;
    public static final int INVALID = 6;
    public static final int OTHER = 7;
    public static final int BUSINESSMAN = 8;

    public CertTagSocialGroup() throws ClipsException {
    }

    public CertTagSocialGroup(CertificateLocal certificateLocal, ReportParam reportParam, DiseaseLocal diseaseLocal) throws ClipsException {
        super(certificateLocal, reportParam, diseaseLocal);
        if (certificateLocal.isNewlyCreated()) {
            setItem(getDefaultID(certificateLocal.getClientLocal()));
        }
    }

    @Override
    public void fillItems() throws ClipsException {
        allItems.add(new PairIntStr(0, ""));
        allItems.add(new PairIntStr(WORKER, "рабочий"));
        allItems.add(new PairIntStr(OFFICE_WORKER, "служащий"));
        allItems.add(new PairIntStr(JOBLESS, "неработающий"));
        allItems.add(new PairIntStr(PUPIL, "учащийся"));
        allItems.add(new PairIntStr(PENSIONER, "пенсионер"));
        allItems.add(new PairIntStr(INVALID, "инвалид"));
        allItems.add(new PairIntStr(OTHER, "другая (указать)"));
        allItems.add(new PairIntStr(BUSINESSMAN, "предприниматель"));

        editableItems = new HashSet<Integer>();
        editableItems.add(OTHER);
    }

    private int getDefaultID(ClientLocal client) throws ClipsException {
        String title = client.getSocialStatus().getTitle().toLowerCase().trim();
        if (title.equals("безработный")) {
            return JOBLESS;
        }
        int def = 0;
        for (int i = 0; i < allItems.size(); i++) {
            String item = allItems.get(i).str.toLowerCase().trim();
            if (item.startsWith(title)) {
                def = allItems.get(i).num;
            }
        }
        return def;
    }
}
TOP

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

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.