package org.diagbot.graph.jdbc;

import java.util.HashMap;
import java.util.Map;

public class DrugsPattern {
    public static void main(String[] args) {
        String str = "镇痛药(阿片类强效镇痛剂)";
        Map<String, String> stringStringMap = new DrugsPattern().bigSubDrugs(str);

        System.out.println(stringStringMap.get("big")+"\t"+stringStringMap.get("sub"));
    }
    public Map<String,String> bigSubDrugs(String drugs){
        Map<String,String> bigSubMap=new HashMap<>();
        String bigDrugs="" ,subDrugs="";
        if(drugs.contains("(")){
            bigDrugs=drugs.split("\\(")[0];
            subDrugs=drugs.split("\\(")[1].replace(")","");
        }else {
            bigDrugs=drugs;
            subDrugs=drugs;
        }
        bigSubMap.put("big",bigDrugs);
        bigSubMap.put("sub",subDrugs);
        return bigSubMap;
    }
}
