package com.fs.his.enums.hsyy;

/**
 * @Author：peicj
 * @Description: 药物剂型代码
 * @Date：2026/1/5 11:27
 */
public enum DrugFormulation {

    RAW_MATERIAL(0, "原料"),
    UNCOATED_TABLETS(1, "片剂(素片,压制片),浸膏片,非包衣片"),
    COATED_TABLETS(2, "糖衣片,包衣片,薄膜衣片"),
    CHEWING_TABLETS(3, "咀嚼片,糖片,异型片,糖胶片"),
    ENTERIC_COATED_TABLETS(4, "肠溶片(肠衣片)"),
    MODIFIED_RELEASE_TABLETS(5, "调释片,缓释片,控释片,长效片"),
    EFFERVESCENT_TABLETS(6, "泡腾片"),
    SUBLINGUAL_TABLETS(7, "舌下片"),
    LOZENGES(8, "含片,嗽口片(含嗽片),喉症片(喉片),口腔粘附片"),
    EXTERNAL_TABLETS(9, "外用片,外用膜,坐药片,环型片"),
    VAGINAL_TABLETS(10, "阴道片,外用阴道膜,阴道用药,阴道栓片"),
    WATER_SOLUBLE_TABLETS(11, "水溶片,眼药水片"),
    DISPERSIBLE_TABLETS(12, "分散片(适应片)"),
    PAPER_TABLETS(13, "纸片(纸型片),膜片(薄膜片)"),
    PILLS(14, "丸剂,药丸,眼丸,耳丸,糖丸,糖衣丸,浓缩丸,调释丸,水丸"),
    POWDER_INJECTION(15, "粉针剂(冻干粉针剂),冻干粉"),
    INJECTION(16, "注射液(水针剂),油针剂,混悬针剂"),
    INJECTION_SOLVENT(17, "注射溶媒(在16有冲突时,可代油针剂,混悬针剂)"),
    INFUSION(18, "输液剂,血浆代用品"),
    CAPSULES(19, "胶囊剂,硬胶囊"),
    SOFT_CAPSULES(20, "软胶囊,滴丸,胶丸"),
    ENTERIC_COATED_CAPSULES(21, "肠溶胶囊,肠溶胶丸"),
    MODIFIED_RELEASE_CAPSULES(22, "调释胶囊,控释胶囊,缓释胶囊"),
    SOLUTION(23, "溶液剂,含漱液,内服混悬液"),
    MIXTURE(24, "合剂"),
    EMULSION(25, "乳剂,乳胶"),
    GEL(26, "凝胶剂,胶剂(胶体),胶冻,胶体微粒"),
    MUCILAGE(27, "胶浆剂"),
    AROMATIC_WATER(28, "芳香水剂(露剂)"),
    DROPS(29, "滴剂"),
    SYRUP(30, "糖浆剂(蜜浆剂)"),
    ORAL_LIQUID(31, "口服液"),
    EXTRACT(32, "浸膏剂"),
    FLUID_EXTRACT(33, "流浸膏剂"),
    TINCTURE(34, "酊剂"),
    SPIRIT(35, "醑剂"),
    JUICE(36, "酏剂"),
    LINIMENT(37, "洗剂,阴道冲洗剂"),
    RUBEFACIENT(38, "搽剂(涂剂,擦剂),外用混悬液剂"),
    OIL(39, "油剂,甘油剂"),
    COLLIDION(40, "棉胶剂(火棉胶剂)"),
    FILM_FORMING_AGENT(41, "涂膜剂"),
    APPLICATION(42, "涂布剂"),
    EYE_DROPS(43, "滴眼剂,洗眼剂,粉剂眼花缭乱药"),
    NASAL_DROPS(44, "滴鼻剂,洗鼻剂"),
    EAR_DROPS(45, "滴耳剂,洗耳剂"),
    ORAL_CAVITY_AGENT(46, "口腔药剂,口腔用药,牙科用药"),
    ENEMA(47, "灌肠剂"),
    OINTMENT(48, "软膏剂(油膏剂,水膏剂)"),
    CREAM(49, "霜剂(乳膏剂)"),
    PASTE(50, "糊剂"),
    PLASTER(51, "硬膏剂,橡皮膏"),
    EYE_OINTMENT(52, "眼膏剂"),
    POWDER(53, "散剂(内服散剂,外用散剂,粉剂,撒布粉"),
    GRANULES(54, "颗粒剂(冲剂),晶剂(结晶,晶体),干糖浆"),
    EFFERVESCENT_GRANULES(55, "泡腾颗粒剂"),
    MODIFIED_RELEASE_GRANULES(56, "调释颗粒剂,缓释颗粒剂"),
    AEROSOL(57, "气雾剂,水雾剂, (加抛射剂)"),
    SPRAY(58, "喷雾剂, (不加抛射剂)"),
    SUSPENSION_AEROSOL(59, "混悬雾剂, (水,气,粉三相)"),
    INHALATION_AGENT(60, "吸入药剂(鼻吸式),粉雾剂"),
    FILM(61, "膜剂(口腔膜)"),
    SPONGE(62, "海绵剂"),
    SUPPOSITORY(63, "栓剂,痔疮栓,耳栓"),
    IMPLANT_SUPPOSITORY(64, "植入栓"),
    TRANSDERMAL_AGENT(65, "透皮剂,贴剂(贴膏,贴膜),贴片"),
    CONTROLLED_RELEASE_TRANSDERMAL(66, "控释透皮剂,控释贴片,控释口颊片"),
    SCARIFICATION_AGENT(67, "划痕剂"),
    PEARL_CHAIN(68, "珠链(泥珠链)"),
    LOZENGE(69, "锭剂,糖锭"),
    MICROCAPSULE(70, "微囊胶囊(微丸胶囊)"),
    DRY_SUSPENSION(71, "干混悬剂(干悬乳剂/口服乳干粉)"),
    INHALANT(72, "吸放剂(气体)"),
    KIT(90, "试剂盒(诊断用试剂),药盒"),
    OTHER(99, "其它剂型(空心胶囊,绷带,纱布,胶布");

    private final int code;
    private final String description;

    DrugFormulation(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    // 根据code获取枚举
    public static DrugFormulation fromCode(int code) {
        for (DrugFormulation formulation : values()) {
            if (formulation.code == code) {
                return formulation;
            }
        }
        return OTHER; // 默认返回其他
    }

    // 根据code获取描述
    public static String getDescriptionByCode(int code) {
        return fromCode(code).getDescription();
    }

    // 根据描述获取code
    public static int getCodeByDescription(String description) {
        for (DrugFormulation formulation : values()) {
            if (formulation.description.equals(description)) {
                return formulation.code;
            }
        }
        return OTHER.code;
    }

}
