Bladeren bron

增加会诊单相关解析代码

liuqq 4 jaren geleden
bovenliggende
commit
0d1bc62d05

+ 15 - 0
src/main/java/com/diagbot/config/RedisConfigurer.java

@@ -153,6 +153,21 @@ public class RedisConfigurer extends CachingConfigurerSupport {
         return getRedisTemplate(factory);
     }
 
+    /**
+     * 表字段和注释使用的redis
+     *
+     * @return
+     */
+    @Bean("factoryForTable")
+    public LettuceConnectionFactory redisConnectionFactoryForTable() {
+        return getRedisConnectionFactory(Integer.valueOf(databaseMr));
+    }
+
+    @Bean(name = "redisTemplateForTable")
+    public RedisTemplate<String, Object> redisTemplateForTable(@Qualifier("factoryForTable") LettuceConnectionFactory factory) {
+        return getRedisTemplate(factory);
+    }
+
 
     private LettuceConnectionFactory getRedisConnectionFactory(Integer database) {
         RedisStandaloneConfiguration connection = new RedisStandaloneConfiguration();

+ 1 - 0
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -157,6 +157,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/data/sendHomeDiagnose").permitAll()
                 .antMatchers("/qc/data/sendHomeOperation").permitAll()
                 .antMatchers("/qc/data/sendCrisis").permitAll()
+                .antMatchers("/qc/data/getColumnZhAndCh").permitAll()
                 .antMatchers("/qc/doctoradvice/getPage").permitAll()
                 .antMatchers("/qc/medPacsInfo/getCheckPage").permitAll()
                 .antMatchers("/qc/medLisInfo/getExaminePage").permitAll()

+ 1 - 0
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -201,6 +201,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/data/sendHomeDiagnose", request)
                 || matchers("/qc/data/sendHomeOperation", request)
                 || matchers("/qc/data/sendCrisis", request)
+                || matchers("/qc/data/getColumnZhAndCh", request)
                 || matchers("/qc/doctoradvice/getPage", request)
                 || matchers("/qc/medPacsInfo/getCheckPage", request)
                 || matchers("/qc/medLisInfo/getExaminePage", request)

+ 11 - 0
src/main/java/com/diagbot/dto/data/ColumnZhAndChDTO.java

@@ -0,0 +1,11 @@
+package com.diagbot.dto.data;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class ColumnZhAndChDTO {
+    private String en;//英文字段名转对应的属性名
+    private String ch;//中文注释
+}

+ 91 - 0
src/main/java/com/diagbot/enums/ModeIdEnum.java

@@ -0,0 +1,91 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+public enum ModeIdEnum implements KeyedNamed {
+    //BEHOSPITAL_INFO(1, "入院记录"),
+    FIRST_RECORD(2, "首次病程录"),
+    /*
+    DATA_MODEL(3, "死亡病例讨论记录"),
+    DATA_MODEL(4, "查房记录"),
+    DATA_MODEL(5, "出院小结"),
+    DATA_MODEL(6, "病案首页"),
+    DATA_MODEL(7, "会诊记录"),
+    DATA_MODEL(8, "医嘱信息"),
+    DATA_MODEL(9, "交接班记录"),
+    DATA_MODEL(10, "输血/血制品病程记录"),
+    DATA_MODEL(11, "术前讨论、术前小结"),
+    DATA_MODEL(12, "麻醉记录"),
+    DATA_MODEL(13, "麻醉知情同意书"),
+    DATA_MODEL(14, "麻醉术前访视记录"),
+    DATA_MODEL(15, "麻醉术后访视记录"),
+    DATA_MODEL(16, "手术知情同意书"),
+    DATA_MODEL(17, "手术记录"),
+    DATA_MODEL(18, "术后首次病程及谈话记录"),
+    DATA_MODEL(19, "疑难病例讨论记录"),
+    DATA_MODEL(20, "手术风险评估表"),
+    DATA_MODEL(21, "手术安全核查表"),
+    DATA_MODEL(22, "抢救记录"),
+    DATA_MODEL(23, "危急值记录"),
+    DATA_MODEL(24, "死亡记录"),
+    DATA_MODEL(25, "病危通知书"),
+    DATA_MODEL(26, "转入记录"),
+    DATA_MODEL(27, "转出记录"),
+    DATA_MODEL(28, "阶段小结"),
+    DATA_MODEL(29, "病重通知书"),
+    */
+    CONSULTATION_APPLY(30, "会诊申请单"),
+    CONSULTATION_RESULT(31, "会诊结果单"),
+    /*
+    DATA_MODEL(32, "输血后效果评价"),
+    DATA_MODEL(33, "专科交接单"),
+    DATA_MODEL(34, "转科记录"),
+    DATA_MODEL(35, "病理检验送检单"),
+    DATA_MODEL(36, "自定义病程记录"),
+    DATA_MODEL(37, "病程信息"),
+    DATA_MODEL(52, "授权知情同意书"),
+    DATA_MODEL(53, "知情同意书"),
+    DATA_MODEL(54, "谈话告知书"),
+    DATA_MODEL(55, "其他"),
+    DATA_MODEL(56, "日常病程录"),
+    DATA_MODEL(57, "检查信息"),
+    */
+    LIS_INFO(58, "检验信息"),
+    //LIS_INFO(59, "有创操作"),
+    CONSULTATION_NOTE(60, "会诊单");
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    ModeIdEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static ModeIdEnum getEnum(int key) {
+        for (ModeIdEnum item : ModeIdEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        ModeIdEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}

+ 4 - 0
src/main/java/com/diagbot/facade/data/ADataFacade.java

@@ -0,0 +1,4 @@
+package com.diagbot.facade.data;
+
+public class ADataFacade {
+}

+ 32 - 0
src/main/java/com/diagbot/facade/data/AMedConsultationNoteFacade.java

@@ -0,0 +1,32 @@
+package com.diagbot.facade.data;
+
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.service.impl.MedConsultationNoteServiceImpl;
+import com.diagbot.util.EntityUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class AMedConsultationNoteFacade extends MedConsultationNoteServiceImpl {
+
+    @Autowired
+    private ColumnFacade columnFacade;
+
+    public Boolean getColumnZhAndCh(){
+        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
+        list.forEach(s->{
+            s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
+        });
+
+        Map<String, String> columnMap=EntityUtil.makeMapWithKeyValue(list,"ch","en");
+        Boolean flag=columnFacade.createColumn(columnMap,"medConsultationNote");
+
+        //Map<String, String> map=columnFacade.getColumn("medConsultationNote");
+        return flag;
+    }
+
+}

+ 8 - 0
src/main/java/com/diagbot/facade/data/ColumnFacade.java

@@ -0,0 +1,8 @@
+package com.diagbot.facade.data;
+
+import com.diagbot.service.impl.ColumnServiceImpl;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ColumnFacade extends ColumnServiceImpl {
+}

+ 6 - 1
src/main/java/com/diagbot/mapper/MedConsultationNoteMapper.java

@@ -1,7 +1,10 @@
 package com.diagbot.mapper;
 
-import com.diagbot.entity.MedConsultationNote;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.MedConsultationNote;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +15,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @since 2020-09-22
  */
 public interface MedConsultationNoteMapper extends BaseMapper<MedConsultationNote> {
+    void updateBatchByKey(List<MedConsultationNote> list);
 
+    List<ColumnZhAndChDTO> getColumnZhAndCh();
 }

+ 21 - 0
src/main/java/com/diagbot/service/ColumnService.java

@@ -0,0 +1,21 @@
+package com.diagbot.service;
+
+import java.util.Map;
+
+public interface ColumnService {
+    /**
+     * 创建
+     *
+     * @param
+     * @return
+     */
+    Boolean createColumn(Map<String, String> columnMap, String tableResKey);
+
+    /**
+     * 获取用户jwt
+     *
+     * @param tableResKey redis的key
+     * @return jwt信息
+     */
+    Map<String, String> getColumn(String tableResKey);
+}

+ 77 - 0
src/main/java/com/diagbot/service/impl/ColumnServiceImpl.java

@@ -0,0 +1,77 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.service.ColumnService;
+import com.diagbot.util.EntityUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.dao.DataAccessException;
+import org.springframework.data.redis.connection.RedisConnection;
+import org.springframework.data.redis.core.RedisCallback;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Service
+public class ColumnServiceImpl implements ColumnService {
+    @Autowired
+    @Qualifier("redisTemplateForTable")
+    RedisTemplate redisForTable;
+
+    private byte[] serializeKey(Object o) {
+        return redisForTable.getKeySerializer().serialize(o);
+    }
+
+    private byte[] serializeValue(Object o) {
+        return redisForTable.getValueSerializer().serialize(o);
+    }
+
+    private Object deserializeValue(byte[] b) {
+        return redisForTable.getValueSerializer().deserialize(b);
+    }
+
+    @Override
+    public Boolean createColumn(Map<String, String> columnMap, String tableResKey) {
+        final byte[] redis_key = serializeKey(tableResKey);
+        redisForTable.execute(new RedisCallback<Object>() {
+            @Override
+            public Object doInRedis(RedisConnection connection) throws DataAccessException {
+                //获取旧的
+                byte[] bytes = connection.get(redis_key);
+                //删除旧的
+                if (bytes != null) {
+                    connection.del(bytes);
+                }
+                //设置新的
+                connection.setNX(redis_key,serializeValue(columnMap));
+                return true;
+            }
+        });
+        return true;
+    }
+
+    @Override
+    public Map<String, String> getColumn(String tableResKey) {
+        final byte[] redis_key =serializeKey(tableResKey);
+        List<ColumnZhAndChDTO> list=(List<ColumnZhAndChDTO>)redisForTable.execute(new RedisCallback<List<ColumnZhAndChDTO>>() {
+            @Override
+            public List<ColumnZhAndChDTO> doInRedis(RedisConnection connection) throws DataAccessException {
+                byte[] bytes = connection.get(redis_key);
+                if (bytes == null) {
+                    return null;
+                }
+                return (List<ColumnZhAndChDTO>) deserializeValue(bytes);
+            }
+        });
+        list.forEach(s->{
+            s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
+        });
+        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
+        return columnMap;
+    }
+}

+ 9 - 1
src/main/java/com/diagbot/service/impl/MedConsultationNoteServiceImpl.java

@@ -1,9 +1,9 @@
 package com.diagbot.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.entity.MedConsultationNote;
 import com.diagbot.mapper.MedConsultationNoteMapper;
 import com.diagbot.service.MedConsultationNoteService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 /**
@@ -17,4 +17,12 @@ import org.springframework.stereotype.Service;
 @Service
 public class MedConsultationNoteServiceImpl extends ServiceImpl<MedConsultationNoteMapper, MedConsultationNote> implements MedConsultationNoteService {
 
+    /**
+     * 批量更新会诊(申请和结果)
+     * @param list
+
+    void updateBatchByKey(List<MedConsultationNote> list){
+        this.updateBatchByKey(list);
+    }
+     */
 }

+ 441 - 0
src/main/java/com/diagbot/util/EntityUtil.java

@@ -0,0 +1,441 @@
+package com.diagbot.util;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Validate;
+import org.apache.commons.lang3.reflect.FieldUtils;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * @Description: 实体对象工具类
+ * @author: gaodm
+ * @time: 2018/9/13 20:12
+ */
+@Slf4j
+public class EntityUtil {
+
+    private static final String DATE_CLASS_NAME = Date.class.getName();
+
+    /**
+     * 将list中元素的某一成员组装成list返回。注意:会去重!
+     *
+     * @param list      元素列表
+     * @param fieldName 成员变量的field
+     * @param <T>       元素类型
+     * @return 返回该字段组成的list
+     */
+    public static <T> List makeListByFieldName(List<T> list, String fieldName) {
+        List returnList = new LinkedList();
+        if (list.isEmpty()) {
+            return returnList;
+        }
+        Object firstObj = list.get(0);
+        Field field = FieldUtils.getField(firstObj.getClass(), fieldName, true);
+        if (field == null) {
+            throw new RuntimeException(firstObj.getClass().getName() + "不存在" + fieldName);
+        }
+        try {
+            for (T o : list) {
+                if (!returnList.contains(field.get(o))) {
+                    returnList.add(field.get(o));
+                }
+            }
+        } catch (IllegalAccessException e) {
+            //懒得在外面try catch, 直接ignore
+            throw new RuntimeException(e);
+        }
+        return returnList;
+    }
+
+    /**
+     * 将Collection中元素的某一成员组装成Set返回
+     *
+     * @param collection 元素列表
+     * @param fieldName  成员变量的field
+     * @param <T>        元素类型
+     * @return 返回该字段组成的LinkedHashSet。若元素中不存在名为fieldName的成员变量,则返回EmptySet
+     */
+    public static <T> LinkedHashSet makeLinkedSetByFieldName(Collection<T> collection, String fieldName) {
+        LinkedHashSet returnLinkedSet = new LinkedHashSet<>();
+        Iterator<T> it = collection.iterator();
+        boolean isFirst = true;
+        Field field = null;
+        while (it.hasNext()) {
+            T o = it.next();
+            if (isFirst) {
+                field = FieldUtils.getField(o.getClass(), fieldName, true);
+                if (field == null) {
+                    throw new RuntimeException(o.getClass().getName() + "不存在" + fieldName);
+                }
+                isFirst = false;
+            }
+            try {
+                returnLinkedSet.add(field.get(o));
+            } catch (IllegalAccessException e) {
+                //ignore
+                throw new RuntimeException(e);
+            }
+        }
+        return returnLinkedSet;
+    }
+
+    /**
+     * 将list中的元素放到Map<M, N>以建立 key - value 索引<p>
+     * modified from com.tqmall.saint.biz.util.EntityUtil#makeEntityMap(java.util.List, java.lang.String)
+     *
+     * @param collection     Collection<V> 元素列表
+     * @param keyFieldName   String 元素的属性名称, 该属性的值作为Map的key
+     * @param valueFieldName String 元素的属性名称, 该属性的值作为Map的value
+     * @param <M>            key类型
+     * @param <N>            value类型
+     * @param <V>            列表元素类型
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static <M, N, V> Map<M, N> makeMapWithKeyValue(Collection<V> collection, String keyFieldName, String valueFieldName) {
+        Map<M, N> map = new HashMap<>();
+        if (collection == null || collection.isEmpty()) {
+            return map;
+        }
+        Iterator<V> it = collection.iterator();
+        boolean isFirst = true;
+        Method keyGetter = null;
+        Method valueGetter = null;
+        try {
+            while (it.hasNext()) {
+                V o = it.next();
+                if (isFirst) {
+                    keyGetter = getMethod(o.getClass(), keyFieldName, "get");
+                    valueGetter = getMethod(o.getClass(), valueFieldName, "get");
+                    isFirst = false;
+                }
+                map.put((M) keyGetter.invoke(o), (N) valueGetter.invoke(o));
+            }
+        } catch (Exception e) {
+            log.error("makeEntityMap error list is " + collection, e);
+            return map;
+        }
+        return map;
+    }
+
+    /**
+     * 将list中的元素放到Map<K, V>以建立 key - value 索引<p>
+     *
+     * @param list         List<V> 元素列表
+     * @param keyFieldName String 元素的属性名称, 该属性的值作为索引key
+     * @param <K>          key类型
+     * @param <V>          value类型
+     * @return Map<K   ,       V> key - value 索引
+     */
+    @SuppressWarnings("unchecked")
+    public static <K, V> Map<K, V> makeEntityMap(List<V> list, String keyFieldName) {
+        Map<K, V> map = new HashMap<>();
+        if (list == null || list.size() == 0) {
+            return map;
+        }
+        try {
+            Method getter = getMethod(list.get(0).getClass(), keyFieldName, "get");
+            for (V item : list) {
+                map.put((K) getter.invoke(item), item);
+            }
+        } catch (Exception e) {
+            log.error("makeEntityMap error list is " + list, e);
+            return map;
+        }
+        return map;
+    }
+
+    /**
+     * 将list中的元素放到Map<String, V>以建立 key - value 索引<p>
+     *
+     * @param list          List<V> 元素列表
+     * @param splitVar      属性之间间隔
+     * @param keyFieldNames String 元素的属性名称动态数组, 依次循环该属性的值作为索引key
+     * @param <V>           value类型
+     * @return Map<String   ,       V> key - value 索引
+     */
+
+    @SuppressWarnings("unchecked")
+    public static <V> Map<String, V> makeEntityMapByKeys(List<V> list, String splitVar, String... keyFieldNames) {
+        Map<String, V> map = new HashMap<>();
+        if (list == null || list.size() == 0 || keyFieldNames == null || keyFieldNames.length == 0 || StringUtil.isEmpty(splitVar)) {
+            return map;
+        }
+        try {
+            List<Method> getterList = new ArrayList<>();
+            for (String key : keyFieldNames) {
+                getterList.add(getMethod(list.get(0).getClass(), key, "get"));
+            }
+            for (V item : list) {
+                StringBuffer keys = new StringBuffer("");
+                for (int i = 0; i < getterList.size(); i++) {
+                    keys.append(getterList.get(i).invoke(item));
+                    if (i < getterList.size() - 1) {
+                        keys.append(splitVar);
+                    }
+                }
+                map.put(keys.toString(), item);
+            }
+        } catch (Exception e) {
+            log.error("makeEntityMap error list is " + list, e);
+            return map;
+        }
+        return map;
+    }
+
+    /**
+     * 将list中的元素放到Map<K, List<V>> 以建立 key - List<value> 索引<p>
+     *
+     * @param list         List<V> 元素列表
+     * @param keyFieldName String 元素的属性名称, 该属性的值作为索引key
+     * @param <K>          key类型
+     * @param <V>          value类型
+     * @return Map<K   ,       V> key - value 索引
+     */
+    public static <K, V> Map<K, List<V>> makeEntityListMap(List<V> list, String keyFieldName) {
+        Map<K, List<V>> map = new LinkedHashMap<>();
+        if (list == null || list.size() == 0) {
+            return map;
+        }
+        try {
+            Method getter = getMethod(list.get(0).getClass(), keyFieldName, "get");
+            for (V item : list) {
+                @SuppressWarnings("unchecked")
+                K key = (K) getter.invoke(item);
+                List<V> groupList = map.get(key);
+                if (groupList == null) {
+                    groupList = new ArrayList<>();
+                    map.put(key, groupList);
+                }
+                groupList.add(item);
+            }
+        } catch (Exception e) {
+            log.error("makeEntityListMap error list is " + list, e);
+            return map;
+        }
+        return map;
+    }
+
+    /**
+     * 获取getter或setter
+     */
+    @SuppressWarnings("unchecked")
+    private static Method getMethod(@SuppressWarnings("rawtypes") Class clazz, String fieldName,
+                                    String methodPrefix) throws NoSuchMethodException {
+        String first = fieldName.substring(0, 1);
+        String getterName = methodPrefix + fieldName.replaceFirst(first, first.toUpperCase());
+        return clazz.getMethod(getterName);
+    }
+
+    /**
+     * 比较两个对象改变了的属性值,然后以string拼接返回
+     *
+     * @param oldObj 对象1
+     * @param newObj 对象2
+     * @return 改变的属性值拼接的字符串
+     */
+    public static <T> String compareToObjProperty(T oldObj, T newObj) {
+        String modifiedStr = "";
+        Field[] fields = oldObj.getClass().getDeclaredFields();
+        for (Field field : fields) {
+            try {
+                if (!Modifier.isStatic(field.getModifiers())) {
+                    String tempFieldType = field.getType().getName();
+                    Method tempMethod = getMethod(oldObj.getClass(), field.getName(), "get");
+                    if (field.getName().equals("ATTRIBUTE_ORDER_SN")) {
+                        System.out.println("aa");
+                    }
+                    if (tempMethod != null) {
+                        Object tempOld = tempMethod.invoke(oldObj);
+                        Object tempNew = tempMethod.invoke(newObj);
+                        if (findDifference(tempOld, tempNew)) {
+                            if (tempFieldType.equals("java.util.Date")) {
+                                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd mm:HH:ss");
+                                modifiedStr += field.getName() + "[" + (tempOld == null ? null : sdf.format(tempOld)) + "," +
+                                        (tempNew == null ? null : sdf.format(tempNew)) + "],";
+                            } else {
+                                modifiedStr += field.getName() + "[" + tempOld + "," + tempNew + "],";
+                            }
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                log.error("compareTo error", e);
+            }
+        }
+        return modifiedStr;
+    }
+
+    /**
+     * 获取所有field,不包含field,修改自FieldUtils的getAllFieldsList方法
+     *
+     * @param cls         类
+     * @param forceAccess 是否包含private的field
+     * @return
+     */
+    private static List<Field> getFieldsList(Class<?> cls, final boolean forceAccess) {
+        Validate.isTrue(cls != null, "The class must not be null");
+        final List<Field> allFields = new ArrayList<Field>();
+        Class<?> currentClass = cls;
+        final Field[] declaredFields = currentClass.getDeclaredFields();
+        for (Field field : declaredFields) {
+            if (!Modifier.isPublic(field.getModifiers())) {
+                if (forceAccess) {
+                    field.setAccessible(true);
+                } else {
+                    continue;
+                }
+            }
+            allFields.add(field);
+        }
+        return allFields;
+    }
+
+    /**
+     * 获取所有field,包含所有父类,来自FieldUtils的getAllFieldsList方法
+     *
+     * @param cls         类
+     * @param forceAccess 是否包含private的field
+     * @return
+     */
+    private static List<Field> getAllFieldsList(Class<?> cls, final boolean forceAccess) {
+        Validate.isTrue(cls != null, "The class must not be null");
+        final List<Field> allFields = new ArrayList<Field>();
+        Class<?> currentClass = cls;
+        while (currentClass != null) {
+            final Field[] declaredFields = currentClass.getDeclaredFields();
+            for (Field field : declaredFields) {
+                if (!Modifier.isPublic(field.getModifiers())) {
+                    if (forceAccess) {
+                        field.setAccessible(true);
+                    } else {
+                        continue;
+                    }
+                }
+                allFields.add(field);
+            }
+            currentClass = currentClass.getSuperclass();
+        }
+        return allFields;
+    }
+
+    /**
+     * 获取类型的field
+     *
+     * @param cls         类型
+     * @param checkSupers 是否要获取父类的field
+     * @param forceAccess 是否包含private的field
+     * @return
+     */
+    private static List<Field> getFieldsList(Class<?> cls, final boolean checkSupers, final boolean forceAccess) {
+        if (checkSupers) {
+            return getAllFieldsList(cls, forceAccess);
+        } else {
+            return getFieldsList(cls, forceAccess);
+        }
+    }
+
+    /**
+     * 比较两个对象改变了的属性值,然后以string拼接返回
+     *
+     * @param oldObj      对象1
+     * @param newObj      对象2
+     * @param formatter   格式(默认为%s[%s,%s],第一个%s对应fieldname,第二个%对应对象1的fieldname的值,第三个%s对应对象2的fieldname的值)
+     * @param checkSupers 是否需要比较所有父类(无视继承的接口)
+     * @param forceAccess 是否需要比较private成员变量
+     * @param <T>         要比较的对象类型
+     * @return
+     */
+    public static <T> String compareToObjProperty(T oldObj, T newObj, String formatter, final boolean checkSupers, final boolean forceAccess) {
+        StringBuilder builder = new StringBuilder();
+        if (oldObj == newObj) {
+            return builder.toString();
+        }
+        if (StringUtils.isEmpty(formatter)) {
+            formatter = "%s[%s,%s]";
+        }
+        List<Field> fields = getFieldsList(oldObj.getClass(), checkSupers, forceAccess);
+        for (Field field : fields) {
+            try {
+                Object tmpOld = field.get(oldObj);
+                Object tmpNew = field.get(newObj);
+                if (findDifference(tmpOld, tmpNew)) {
+                    if (field.getType().getName().equals(DATE_CLASS_NAME)) {
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd mm:HH:ss");
+                        String strOld = tmpOld == null ? null : sdf.format(tmpOld);
+                        String strNew = tmpNew == null ? null : sdf.format(tmpNew);
+                        builder.append(String.format(formatter, field.getName(), strOld, strNew));
+                        builder.append(",");
+                    } else {
+                        builder.append(String.format(formatter, field.getName(), tmpOld, tmpNew));
+                        builder.append(",");
+                    }
+                }
+            } catch (Exception e) {
+                log.error("compareTo error", e);
+            }
+        }
+        return builder.toString();
+    }
+
+    /**
+     * 比较两个对象的值是否不同
+     *
+     * @param obj1 对象1
+     * @param obj2 对象2
+     * @param <T>  object
+     * @return 若俩对象的值不相同则为true,反之为false
+     */
+    public static <T> Boolean findDifference(T obj1, T obj2) {
+        if (obj1 == null && obj2 == null) {
+            return false;
+        }
+        if (obj1 == null || obj2 == null) {
+            return true;
+        }
+        if (obj1 instanceof BigDecimal) {
+            return ((BigDecimal) obj1).compareTo((BigDecimal) obj2) != 0;
+        } else {
+            return !obj1.equals(obj2);
+        }
+    }
+
+    public static <V, K> Map<V, K> makeEntityMapNew(List<Map<String, Object>> hashMap, String keyFieldName) {
+        Map<V, K> map = new HashMap<>();
+        if (hashMap == null || hashMap.size() == 0) {
+            return map;
+        }
+        try {
+            for (Map linkedHashMap : hashMap) {
+                map.put((V) linkedHashMap.get(keyFieldName).toString(), (K) linkedHashMap);
+            }
+        } catch (Exception e) {
+            log.error("makeEntityListMap error list is " + hashMap, e);
+            return map;
+        }
+        return map;
+    }
+
+
+    public static Map<Integer, Map> makeEntityMapSpecial(List<Map> hashMap, String keyFieldName) {
+        Map<Integer, Map> map = new HashMap<>();
+        if (hashMap == null || hashMap.size() == 0) {
+            return map;
+        }
+        try {
+            for (Map linkedHashMap : hashMap) {
+                map.put(Integer.valueOf(linkedHashMap.get(keyFieldName).toString()), linkedHashMap);
+            }
+        } catch (Exception e) {
+            log.error("makeEntityListMap error list is " + hashMap, e);
+            return map;
+        }
+        return map;
+    }
+}

+ 107 - 0
src/main/java/com/diagbot/util/MapUtil.java

@@ -0,0 +1,107 @@
+package com.diagbot.util;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Description: map工具类
+ * @author: gaodm
+ * @time: 2018/9/4 9:24
+ */
+public class MapUtil {
+    private static final String SP = ";";
+    private static final String SSP = ":";
+
+    /**
+     * 把Map转换成String。注意以英文分号字符';'开始和结束
+     *
+     * @param attrs
+     * @return
+     */
+    public static String toString(Map<String, String> attrs) {
+        StringBuilder sb = new StringBuilder();
+        if (null != attrs && !attrs.isEmpty()) {
+            sb.append(SP);
+            for (String key : attrs.keySet()) {
+                String val = attrs.get(key);
+                if (val != null && !"".equals(val)) {
+                    sb.append(key).append(SSP).append(val).append(SP);
+                }
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * 把key:value;key:value格式的String转换成Map
+     *
+     * @param str
+     * @return
+     */
+    public static Map<String, String> fromString(String str) {
+        Map<String, String> attrs = new HashMap<String, String>();
+        if (str != null && !"".equals(str)) {
+            String[] arr = str.split(SP);
+            if (null != arr) {
+                for (String kv : arr) {
+                    if (kv != null && !"".equals(kv)) {
+                        String[] ar = kv.split(SSP);
+                        if (null != ar && ar.length == 2) {
+                            String key = ar[0];
+                            String val = ar[1];
+                            if (val != null && !"".equals(val)) {
+                                attrs.put(key, val);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return attrs;
+    }
+
+    public static Object mapToObject(Map<String, Object> map, Class<?> beanClass) throws Exception {
+        if (map == null) {
+            return null;
+        }
+
+        Object obj = beanClass.newInstance();
+
+        BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
+        PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+        for (PropertyDescriptor property : propertyDescriptors) {
+            Method setter = property.getWriteMethod();
+            if (setter != null) {
+                setter.invoke(obj, map.get(property.getName()));
+            }
+        }
+
+        return obj;
+    }
+
+    public static Map<String, Object> objectToMap(Object obj) throws Exception {
+        if (obj == null) {
+            return null;
+        }
+
+        Map<String, Object> map = new HashMap<String, Object>();
+
+        BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
+        PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+        for (PropertyDescriptor property : propertyDescriptors) {
+            String key = property.getName();
+            if (key.compareToIgnoreCase("class") == 0) {
+                continue;
+            }
+            Method getter = property.getReadMethod();
+            Object value = getter != null ? getter.invoke(obj) : null;
+            map.put(key, value);
+        }
+        return map;
+    }
+
+}

+ 12 - 0
src/main/java/com/diagbot/vo/data/AContentVO.java

@@ -0,0 +1,12 @@
+package com.diagbot.vo.data;
+
+import lombok.Data;
+
+@Data
+public class AContentVO {
+    private String standModelName;
+    private String recTitle;
+    private String recId;
+    private String recTypeId;
+    private Long modeId;
+}

+ 13 - 0
src/main/java/com/diagbot/vo/data/AMedRecInVO.java

@@ -0,0 +1,13 @@
+package com.diagbot.vo.data;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class AMedRecInVO {
+    private List<AContentVO> medrec;
+    private String cid;//医院简称,具体询问大数据部
+    private Long hospitalId;
+
+}

+ 12 - 4
src/main/java/com/diagbot/web/DataController.java

@@ -4,17 +4,14 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.data.*;
 import com.diagbot.facade.data.*;
 import com.diagbot.vo.data.*;
+import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import jdk.nashorn.internal.ir.annotations.Ignore;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-
-import io.swagger.annotations.Api;
-
 import javax.validation.Valid;
 import java.util.List;
 import java.util.Map;
@@ -57,6 +54,9 @@ public class DataController {
     @Autowired
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
 
+    @Autowired
+    private AMedConsultationNoteFacade aMedConsultationNoteFacade;
+
     @ApiOperation(value = "数据引擎-获取医院所有在职医生的基本信息")
     @PostMapping("/sendDoctorInfos")
     @SysLogger("sendDoctorInfos")
@@ -148,4 +148,12 @@ public class DataController {
         return aMedCrisisFacade.executeMedCrisis(list);
     }
 
+    @ApiOperation(value = "数据引擎-列字段名和注释")
+    @PostMapping("/getColumnZhAndCh")
+    @SysLogger("getColumnZhAndCh")
+    public RespDTO getColumnZhAndCh(){
+        aMedConsultationNoteFacade.getColumnZhAndCh();
+        return RespDTO.onSuc(true);
+    }
+
 }

+ 44 - 0
src/main/resources/mapper/MedConsultationNoteMapper.xml

@@ -39,4 +39,48 @@
         <result column="modifier" property="modifier" />
     </resultMap>
 
+    <update id="updateBatchByKey">
+        <foreach collection="list" item="item"  separator=";">
+            update med_consultation_note
+            <set>
+                name = #{item.name},
+                sex = #{item.sex},
+                age = #{item.age},
+                bed_no = #{item.bedNo},
+                dept_name = #{item.deptName},
+                record_date = #{item.recordDate},
+                behospital_date = #{item.behospitalDate},
+                apply_dept = #{item.applyDept},
+                apply_doctor = #{item.applyDoctor},
+                apply_date = #{item.applyDate},
+                invite_type = #{item.inviteType},
+                invite_dept = #{item.inviteDept},
+                invite_doctor = #{item.inviteDoctor},
+                brief_note = #{item.briefNote},
+                diagnosis = #{item.diagnosis},
+                treatment_situation = #{item.treatmentSituation},
+                consultation_date = #{item.consultationDate},
+                consultation_purpose = #{item.consultationPurpose},
+                consultation_opinions = #{item.consultationOpinions},
+                rec_doctor = #{item.recDoctor},
+                rec_date = #{item.recDate},
+                audit_doctor = #{item.auditDoctor},
+                audit_date = #{item.auditDate},
+                whole_data = #{item.wholeData},
+                remark = #{item.remark},
+                <if test="item.gmtModified != null">
+                    gmt_modified = #{item.gmtModified},
+                </if>
+                <if test="item.modifier != null">
+                    modifier = #{item.modifier},
+                </if>
+            </set>
+            where rec_id = #{item.recId} and hospital_id = #{item.hospitalId} and behospital_code = #{item.behospitalCode}
+        </foreach>
+    </update>
+
+    <select id="getColumnZhAndCh" resultType="com.diagbot.dto.data.ColumnZhAndChDTO">
+        select COLUMN_NAME as en,column_comment as ch from INFORMATION_SCHEMA.Columns where table_name='med_consultation_note'
+    </select>
+
 </mapper>