瀏覽代碼

解析-数据元字段有多字典情况处理

huangzhiyong 6 年之前
父節點
當前提交
e267627656
共有 1 個文件被更改,包括 20 次插入3 次删除
  1. 20 3
      src/main/java/com/yihu/ehr/resolve/service/resource/stage2/PackMillService.java

+ 20 - 3
src/main/java/com/yihu/ehr/resolve/service/resource/stage2/PackMillService.java

@ -409,13 +409,20 @@ public class PackMillService {
        //字典ID不为空且原始值不为空的情况下
        if (StringUtils.isNotBlank(dictId) && StringUtils.isNotBlank(value)) {
            //查找对应的字典值
            String _value = redisService.getDictEntryValue(cdaVersion, dictId, value);
            //多个字典值用“,”分割获取
            String[] values = value.split(",");
            StringBuffer _values = new StringBuffer();
            for (String val: values) {
                String _value = redisService.getDictEntryValue(cdaVersion, dictId, val);
                _values.append(_value).append(",");
            }
            _values = _values.replace(_values.lastIndexOf(","),_values.length(),"");
            //对应字典值不为空的情况下,保存原始值和字典值
            if (StringUtils.isNotBlank(_value)) {
            if (StringUtils.isNotBlank(_values.toString())) {
                //保存标准字典值编码(code)
                dataRecord.addResource(metadataId, value);
                //保存标准字典值名称(value)
                dataRecord.addResource(metadataId + "_VALUE", _value);
                dataRecord.addResource(metadataId + "_VALUE", _values.toString());
            } else {
                dataRecord.addResource(metadataId, value);
            }
@ -423,4 +430,14 @@ public class PackMillService {
            dataRecord.addResource(metadataId, value);
        }
    }
    public static void main(String[] args) {
        String[] values = {"aa"};
        StringBuffer _values = new StringBuffer();
        for (String val: values) {
            _values.append(val).append(",");
        }
        _values = _values.replace(_values.lastIndexOf(","),_values.length(),"");
        System.out.println(_values);
    }
}