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

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

/*
* 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 clips.delegate.doctor.diagnosis.DiagnosisLocal;
import cli_fmw.delegate.report.ReportParam;
import cli_fmw.main.ClipsException;
import framework.utils.PairIntStr;

/**
*
* @author vip
*/
@TagToClass(tagName="tuber_type", title="Тип туберкулеза")
public class CertTagTuberType extends TypeSelectableRO {
    public static final int LUNGS = 1;
    public static final int NO_LUNGS = 2;
    public static final int OTHER = 3;

    public CertTagTuberType() throws ClipsException {
    }

    public CertTagTuberType(CertificateLocal certificateLocal, ReportParam reportParam, DiseaseLocal diseaseLocal) throws ClipsException {
        super(certificateLocal, reportParam, diseaseLocal);
        if (certificateLocal.isNewlyCreated()) {
            if (diseaseLocal != null) {
                DiagnosisLocal diag = diseaseLocal.getSpecificDiagnosis();
                if (diag != null) {
                    setItem(getDefaultID(diag));
                } else {
                    setItem(0);
                }
            } else {
                setItem(0);
            }
        }
    }

    private int getDefaultID(DiagnosisLocal diag) throws ClipsException {
        String code = diag.getMkb().getDiseaseCode().trim();
        if (code.equals("A15-A19")) {
            return 0; //неопределенный тип туберкулеза
        }
        if (code.startsWith("A15") || code.startsWith("A16")) {
            if (code.equalsIgnoreCase("A15") ||
                code.equalsIgnoreCase("A15.0") ||
                code.equalsIgnoreCase("A15.1") ||
                code.equalsIgnoreCase("A15.2") ||
                code.equalsIgnoreCase("A15.3") ||
                code.equalsIgnoreCase("A16") ||
                code.equalsIgnoreCase("A16.0") ||
                code.equalsIgnoreCase("A16.1") ||
                code.equalsIgnoreCase("A16.2") ) {
                return LUNGS;
            } else {
                return NO_LUNGS;
            }
        } else if (code.startsWith("A17") || code.startsWith("A18") || code.startsWith("A19")){
            return OTHER;
        } else {
            return 0;
        }
    }

    @Override
    public void fillItems() throws ClipsException {
        allItems.add(new PairIntStr(0, ""));
        allItems.add(new PairIntStr(LUNGS, "туберкулез легких"));
        allItems.add(new PairIntStr(NO_LUNGS, "туберкулез плевры, ВДП, трахеи и бронхов, ВГДЛУ"));
        allItems.add(new PairIntStr(OTHER, "внелегочный туберкулез"));
    }

}
TOP

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

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.